1import{c as M1,g as E1}from"./@turf-D5d9tOZq.js";var Zy={exports:{}};(function($y,A1){var Bp={};(function(Wl,Hl){$y.exports=Hl()})(M1,function(){var Wl,Hl,Gd;function Zd(a,Pt){if(!Wl)Wl=Pt;else if(!Hl)Hl=Pt;else{var Qr="self.onerror = function() { console.error('An error occurred while parsing the WebWorker bundle. This is most likely due to improper transpilation by Babel; please see https://docs.mapbox.com/mapbox-gl-js/guides/install/#transpiling'); }; var sharedChunk = {}; ("+Wl+")(sharedChunk); ("+Hl+")(sharedChunk); self.onerror = null;",zt={};Wl(zt),Gd=Pt(zt),typeof window<"u"&&window&&window.URL&&window.URL.createObjectURL&&(Gd.workerUrl=window.URL.createObjectURL(new Blob([Qr],{type:"text/javascript"})))}}Zd(["exports"],function(a){var Pt="3.3.0";let Qr;const zt={API_URL:"https://api.mapbox.com",get API_URL_REGEX(){if(Qr==null){const t=/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/|\?|$)/i;try{Qr=Bp.API_URL_REGEX!=null?new RegExp(Bp.API_URL_REGEX):t}catch{Qr=t}}return Qr},get API_TILEJSON_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/v[0-9]*\/.*\.json.*$)/i},get API_SPRITE_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*\/sprite.*\..*$)/i},get API_FONTS_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/fonts\/v[0-9]*\/)(.*\.pbf.*$)/i},get API_STYLE_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*$)/i},get API_CDN_URL_REGEX(){return/^((https?:)?\/\/)?api\.mapbox\.c(n|om)(\/mapbox-gl-js\/)(.*$)/i},get EVENTS_URL(){if(!zt.API_URL)return null;try{const t=new URL(zt.API_URL);return t.hostname==="api.mapbox.cn"?"https://events.mapbox.cn/events/v2":t.hostname==="api.mapbox.com"?"https://events.mapbox.com/events/v2":null}catch{return null}},SESSION_PATH:"/map-sessions/v1",FEEDBACK_URL:"https://apps.mapbox.com/feedback",TILE_URL_VERSION:"v4",RASTER_URL_PREFIX:"raster/v1",RASTERARRAYS_URL_PREFIX:"rasterarrays/v1",REQUIRE_ACCESS_TOKEN:!0,ACCESS_TOKEN:null,DEFAULT_STYLE:"mapbox://styles/mapbox/standard",MAX_PARALLEL_IMAGE_REQUESTS:16,DRACO_URL:"https://api.mapbox.com/mapbox-gl-js/draco_decoder_gltf_v1.5.6.wasm",MESHOPT_URL:"https://api.mapbox.com/mapbox-gl-js/meshopt_base_v0.20.wasm",MESHOPT_SIMD_URL:"https://api.mapbox.com/mapbox-gl-js/meshopt_simd_v0.20.wasm",GLYPHS_URL:"mapbox://fonts/mapbox/{fontstack}/{range}.pbf"};function qn(t){return zt.API_URL_REGEX.test(t)}function Wt(t){return t.indexOf("mapbox:")===0}function Rr(t){return zt.API_CDN_URL_REGEX.test(t)}function _n(t){return zt.API_SPRITE_REGEX.test(t)}function gn(t){return zt.API_STYLE_REGEX.test(t)&&!_n(t)}const bo={create:"create",load:"load",fullLoad:"fullLoad"};function Ua(t){const e=t.name.split("?")[0];return Rr(e)&&e.includes("mapbox-gl.js")?"javascript":Rr(e)&&e.includes("mapbox-gl.css")?"css":function(i){return zt.API_FONTS_REGEX.test(i)}(e)?"fontRange":_n(e)?"sprite":gn(e)?"style":function(i){return zt.API_TILEJSON_REGEX.test(i)}(e)?"tilejson":"other"}function kr(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Ko=wo;function wo(t,e,i,n){this.cx=3*t,this.bx=3*(i-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(n-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=e,this.p2x=i,this.p2y=n}wo.prototype={sampleCurveX:function(t){return((this.ax*t+this.bx)*t+this.cx)*t},sampleCurveY:function(t){return((this.ay*t+this.by)*t+this.cy)*t},sampleCurveDerivativeX:function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},solveCurveX:function(t,e){if(e===void 0&&(e=1e-6),t<0)return 0;if(t>1)return 1;for(var i=t,n=0;n<8;n++){var s=this.sampleCurveX(i)-t;if(Math.abs(s)<e)return i;var l=this.sampleCurveDerivativeX(i);if(Math.abs(l)<1e-6)break;i-=s/l}var h=0,f=1;for(i=t,n=0;n<20&&(s=this.sampleCurveX(i),!(Math.abs(s-t)<e));n++)t>s?h=i:f=i,i=.5*(f-h)+h;return i},solve:function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))}};var $n=kr(Ko),Wn=Mn;function Mn(t,e){this.x=t,this.y=e}Mn.prototype={clone:function(){return new Mn(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},multByPoint:function(t){return this.clone()._multByPoint(t)},divByPoint:function(t){return this.clone()._divByPoint(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)}
1,rotateAround:function(t,e){return this.clone()._rotateAround(t,e)},matMult:function(t){return this.clone()._matMult(t)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var e=t.x-this.x,i=t.y-this.y;return e*e+i*i},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult:function(t){var e=t[2]*this.x+t[3]*this.y;return this.x=t[0]*this.x+t[1]*this.y,this.y=e,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_multByPoint:function(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint:function(t){return this.x/=t.x,this.y/=t.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var e=Math.cos(t),i=Math.sin(t),n=i*this.x+e*this.y;return this.x=e*this.x-i*this.y,this.y=n,this},_rotateAround:function(t,e){var i=Math.cos(t),n=Math.sin(t),s=e.y+n*(this.x-e.x)+i*(this.y-e.y);return this.x=e.x+i*(this.x-e.x)-n*(this.y-e.y),this.y=s,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},Mn.convert=function(t){return t instanceof Mn?t:Array.isArray(t)?new Mn(t[0],t[1]):t};var Ue=kr(Wn);const To=Math.PI/180,Us=180/Math.PI;function qt(t){return t*To}function dr(t){return t*Us}const ja=[[0,0],[1,0],[1,1],[0,1]];function $e(t){if(t<=0)return 0;if(t>=1)return 1;const e=t*t,i=e*t;return 4*(t<.5?i:3*(t-e)+i-.75)}function en(t,e,i,n){const s=new $n(t,e,i,n);return function(l){return s.solve(l)}}const xr=en(.25,.1,.25,1);function Dt(t,e,i){return Math.min(i,Math.max(e,t))}function Jo(t,e,i){return(i=Dt((i-t)/(e-t),0,1))*i*(3-2*i)}function Hn(t,e,i){const n=i-e,s=((t-e)%n+n)%n+e;return s===e?i:s}function tn(t,e,i){if(!t.length)return i(null,[]);let n=t.length;const s=new Array(t.length);let l=null;t.forEach((h,f)=>{e(h,(m,_)=>{m&&(l=m),s[f]=_,--n==0&&i(l,s)})})}function fr(t,...e){for(const i of e)for(const n in i)t[n]=i[n];return t}let Mo=1;function Qo(){return Mo++}function js(){return function t(e){return e?(e^Math.random()*(16>>e/4)).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,t)}()}function Gs(t){return t<=1?1:Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))}function Zs(t){return!!t&&/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(t)}function Eo(t,e){t.forEach(i=>{e[i]&&(e[i]=e[i].bind(e))})}function En(t,e){return t.indexOf(e,t.length-e.length)!==-1}function pr(t,e,i){const n={};for(const s in t)n[s]=e.call(i||this,t[s],s,t);return n}function jr(t,e,i){const n={};for(const s in t)e.call(i||this,t[s],s,t)&&(n[s]=t[s]);return n}function Or(t){return Array.isArray(t)?t.map(Or):typeof t=="object"&&t?pr(t,Or):t}const Ga={};function ki(t){Ga[t]||(typeof console<"u"&&console.warn(t),Ga[t]=!0)}function Gr(t,e,i){return(i.y-t.y)*(e.x-t.x)>(e.y-t.y)*(i.x-t.x)}function So(t){let e=0;for(let i,n,s=0,l=t.length,h=l-1;s<l;h=s++)i=t[s],n=t[h],e+=(n.x-i.x)*(i.y+n.y);return e}function Sn([t,e,i]){const n=qt(e+90),s=qt(i);return{x:t*Math.cos(n)*Math.sin(s),y:t*Math.sin(n)*Math.sin(s),z:t*Math.cos(s),azimuthal:e,polar:i}}function yn(){return typeof WorkerGlobalScope<"u"&&typeof self<"u"&&self instanceof WorkerGlobalScope}function Ao(t){const e={};if(t.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(i,n,s,l)=>{const h=s||l;return e[n]=!h||h.toLowerCase(),""}),e["max-age"]){const i=parseInt(e["max-age"],10);isNaN(i)?delete e["max-age"]:e["max-age"]=i}return e}let Vi,es,ts,Zr,An,Xn,Te=null;function U(t){try{const e=self[t];return e.setItem("_mapbox_test_",1),e.removeItem("_mapbox_test_"),!0}catch{return!1}}function H(t,e){return[t[4*e],t[4*e+1],t[4*e+2],t[4*e+3]]}function te(t,e,i,n){for(;e<i;){const s=e+i>>1;t[s]<n?e=s+1:i=s}return e}function ye(t,e,i,n){for(;e<i;){const s=e+i>>1;t[s]<=n?e=s+1:i=s}return e}function Ee(){return Vi==null&&(Vi=self.OffscreenCanvas&&new OffscreenCanvas(1,1).getContext("2d")&&typeof self.createImageBitmap=="function"),Vi}const ze={now:()=>Zr!==void 0?Zr:performance.now(),setNow(t){Zr=t},restoreNow(){Zr=void 0},frame(t){const e=requestAnimationFrame(t);return{cancel:()=>cancelAnimationFrame(e)}},getImageData(t,e=0){const{width:i,height:n}=t;An||(An=document.createElement("canvas"));const s=An.getContext("2d",{willReadFrequently:!0});if(!s)throw new Error("failed to create canvas 2d context");return(i>An.width||n>An.height)&&(An.width=i,An.height=n),s.clearRect(-e,-e,i+2*e,n+2*e),s.drawImage(t,0,0,i,n),s.getImageData(-e,-e,i+2*e,n+2*e)},resolveURL:t=>(es||(es=document.createElement("a")),es.href=t,es.href),get devicePixelRatio(){return window.devicePixelRatio},get prefersReducedMotion(){return!!window.matchMedia&&(ts==null&&(ts=window.matchMedia("(prefers-reduced-motion: reduce)")),ts.matches)},hasCanvasFingerprintNoise(){if(Xn!==void 0)return Xn;if(!Ee())return Xn=!1,!1;const t=new OffscreenCanvas(85,1),e=t.getContext("2d",{willReadFrequently:!0});let i=0;for(let s=0;s<t.width;++s)e.fillStyle=`rgba(${i++},${i++},${i++}, 255)`,e.fillRect(s,0,1,1);const n=e.getImageData(0,0,t.width,t.height);i=0;for(let s=0;s<n.data.length;++s)if(s%4!=3&&i++!==n.data[s])return Xn=!0,!0;return Xn=!1,!1}},tt="mapbox-tiles";let xe=500,rt=50,Ye,ot;function Lt(){try{return caches}catch{}}function hi(){const t=Lt();t&&!Ye&&(Ye=t.open(tt))}function wi(t){const e=t.indexOf("?");if(e<0)return t;const i=["language","worldview"],n=new URLSearchParams,s=new URLSearchParams(t.slice(e));for(const l of i){const h=s.get(l);h&&n.set(l,h)}return`${t.slice(0,e)}?${n.toString()}`}function di(t,e){const i=t.indexOf("?");if(i<0)return`${t}?${new URLSearchParams(e).toString()}`;const n=new URLSearchParams(t.slice(i));for(const s in e)n.set(s,e[s]);return`${t.slice(0,i)}?${n.toString()}`}let ai=1/0;const ri={supported:!1,testSupport:function(t){!Ki&&yi&&(bi?_r(t):ci=t)}};let ci,yi,Ki=!1,bi=!1;const vr=typeof self<"u"?self:{};function _r(t){const e=t.createTexture();t.bindTexture(t.TEXTURE_2D,e);try{if(t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,yi),t.isContextLost())return;ri.supported=!0}
1catch{}t.deleteTexture(e),Ki=!0}vr.document&&(yi=vr.document.createElement("img"),yi.onload=function(){ci&&_r(ci),ci=null,bi=!0},yi.onerror=function(){Ki=!0,ci=null},yi.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const Er={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image",Model:"Model"};typeof Object.freeze=="function"&&Object.freeze(Er);class Zi extends Error{constructor(e,i,n){i===401&&qn(n)&&(e+=": you may have provided an invalid Mapbox access token. See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes"),super(e),this.status=i,this.url=n}toString(){return`${this.name}: ${this.message} (${this.status}): ${this.url}`}}const Ui=yn()?()=>self.worker&&self.worker.referrer:()=>(location.protocol==="blob:"?parent:self).location.href,ge=function(t,e){if(!(/^file:/.test(i=t.url)||/^file:/.test(Ui())&&!/^\w+:/.test(i))){if(self.fetch&&self.Request&&self.AbortController&&Request.prototype.hasOwnProperty("signal"))return function(n,s){const l=new AbortController,h=new Request(n.url,{method:n.method||"GET",body:n.body,credentials:n.credentials,headers:n.headers,referrer:Ui(),referrerPolicy:n.referrerPolicy,signal:l.signal});let f=!1,m=!1;const _=(y=h.url).indexOf("sku=")>0&&qn(y);var y;n.type==="json"&&h.headers.set("Accept","application/json");const v=(E,A,I)=>{if(m)return;if(E&&E.message!=="SecurityError"&&ki(E.toString()),A&&I)return w(A);const z=Date.now();fetch(h).then(L=>{if(L.ok){const N=_?L.clone():null;return w(L,N,z)}return s(new Zi(L.statusText,L.status,n.url))}).catch(L=>{L.name!=="AbortError"&&s(new Error(`${L.message} ${n.url}`))})},w=(E,A,I)=>{(n.type==="arrayBuffer"?E.arrayBuffer():n.type==="json"?E.json():E.text()).then(z=>{m||(A&&I&&function(L,N,G){if(hi(),!Ye)return;const j=Ao(N.headers.get("Cache-Control")||"");if(j["no-store"])return;const X={status:N.status,statusText:N.statusText,headers:new Headers};N.headers.forEach((ie,oe)=>X.headers.set(oe,ie)),j["max-age"]&&X.headers.set("Expires",new Date(G+1e3*j["max-age"]).toUTCString());const W=X.headers.get("Expires");if(!W||new Date(W).getTime()-G<42e4)return;let J=wi(L.url);if(N.status===206){const ie=L.headers.get("Range");if(!ie)return;X.status=200,J=di(J,{range:ie})}(function(ie,oe){if(ot===void 0)try{new Response(new ReadableStream),ot=!0}catch{ot=!1}ot?oe(ie.body):ie.blob().then(oe)})(N,ie=>{const oe=new Response(ie,X);hi(),Ye&&Ye.then(ue=>ue.put(J,oe)).catch(ue=>ki(ue.message))})}(h,A,I),f=!0,s(null,z,E.headers.get("Cache-Control"),E.headers.get("Expires")))}).catch(z=>{m||s(new Error(z.message))})};return _?function(E,A){if(hi(),!Ye)return A(null);Ye.then(I=>{let z=wi(E.url);const L=E.headers.get("Range");L&&(z=di(z,{range:L})),I.match(z).then(N=>{const G=function(j){if(!j)return!1;const X=new Date(j.headers.get("Expires")||0),W=Ao(j.headers.get("Cache-Control")||"");return X>Date.now()&&!W["no-cache"]}(N);I.delete(z),G&&I.put(z,N.clone()),A(null,N,G)}).catch(A)}).catch(A)}(h,v):v(null,null),{cancel:()=>{m=!0,f||l.abort()}}}(t,e);if(yn()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",t,e,void 0,!0)}var i;return function(n,s){const l=new XMLHttpRequest;l.open(n.method||"GET",n.url,!0),n.type==="arrayBuffer"&&(l.responseType="arraybuffer");for(const h in n.headers)l.setRequestHeader(h,n.headers[h]);return n.type==="json"&&(l.responseType="text",l.setRequestHeader("Accept","application/json")),l.withCredentials=n.credentials==="include",l.onerror=()=>{s(new Error(l.statusText))},l.onload=()=>{if((l.status>=200&&l.status<300||l.status===0)&&l.response!==null){let h=l.response;if(n.type==="json")try{h=JSON.parse(l.response)}catch(f){return s(f)}s(null,h,l.getResponseHeader("Cache-Control"),l.getResponseHeader("Expires"))}else s(new Zi(l.statusText,l.status,n.url))},l.send(n.body),{cancel:()=>l.abort()}}(t,e)},ve=function(t,e){return ge(fr(t,{type:"arrayBuffer"}),e)};function De(t){const e=document.createElement("a");return e.href=t,e.protocol===location.protocol&&e.host===location.host}const Ne="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let ke,Ge;ke=[],Ge=0;const Ze=function(t,e){if(ri.supported&&(t.headers||(t.headers={}),t.headers.accept="image/webp,*/*"),Ge>=zt.MAX_PARALLEL_IMAGE_REQUESTS){const l={requestParameters:t,callback:e,cancelled:!1,cancel(){this.cancelled=!0}};return ke.push(l),l}Ge++;let i=!1;const n=()=>
1{if(!i)for(i=!0,Ge--;ke.length&&Ge<zt.MAX_PARALLEL_IMAGE_REQUESTS;){const l=ke.shift(),{requestParameters:h,callback:f,cancelled:m}=l;m||(l.cancel=Ze(h,f).cancel)}},s=ve(t,(l,h,f,m)=>{n(),l?e(l):h&&(self.createImageBitmap?function(_,y){const v=new Blob([new Uint8Array(_)],{type:"image/png"});createImageBitmap(v).then(w=>{y(null,w)}).catch(w=>{y(new Error(`Could not load image because of ${w.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})}(h,(_,y)=>e(_,y,f,m)):function(_,y){const v=new Image;v.onload=()=>{y(null,v),URL.revokeObjectURL(v.src),v.onload=null,requestAnimationFrame(()=>{v.src=Ne})},v.onerror=()=>y(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const w=new Blob([new Uint8Array(_)],{type:"image/png"});v.src=_.byteLength?URL.createObjectURL(w):Ne}(h,(_,y)=>e(_,y,f,m)))});return{cancel:()=>{s.cancel(),n()}}},Be="01",We="NO_ACCESS_TOKEN",Ve=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function _t(t){const e=t.match(Ve);if(!e)throw new Error("Unable to parse URL object");return{protocol:e[1],authority:e[2],path:e[3]||"/",params:e[4]?e[4].split("&"):[]}}function Vt(t){const e=t.params.length?`?${t.params.join("&")}`:"";return`${t.protocol}://${t.authority}${t.path}${e}`}const lt="mapbox.eventData";function fi(t){if(!t)return null;const e=t.split(".");if(!e||e.length!==3)return null;try{return JSON.parse(decodeURIComponent(atob(e[1]).split("").map(i=>"%"+("00"+i.charCodeAt(0).toString(16)).slice(-2)).join("")))}catch{return null}}class Ei{constructor(e){this.type=e,this.anonId=null,this.eventData={},this.queue=[],this.pendingRequest=null}getStorageKey(e){const i=fi(zt.ACCESS_TOKEN);let n="";return n=i&&i.u?btoa(encodeURIComponent(i.u).replace(/%([0-9A-F]{2})/g,(s,l)=>String.fromCharCode(+("0x"+l)))):zt.ACCESS_TOKEN||"",e?`${lt}.${e}:${n}`:`${lt}:${n}`}fetchEventData(){const e=U("localStorage"),i=this.getStorageKey(),n=this.getStorageKey("uuid");if(e)try{const s=localStorage.getItem(i);s&&(this.eventData=JSON.parse(s));const l=localStorage.getItem(n);l&&(this.anonId=l)}catch{ki("Unable to read from LocalStorage")}}saveEventData(){const e=U("localStorage"),i=this.getStorageKey(),n=this.getStorageKey("uuid"),s=this.anonId;if(e&&s)try{localStorage.setItem(n,s),Object.keys(this.eventData).length>=1&&localStorage.setItem(i,JSON.stringify(this.eventData))}catch{ki("Unable to write to LocalStorage")}}processRequests(e){}postEvent(e,i,n,s){if(!zt.EVENTS_URL)return;const l=_t(zt.EVENTS_URL);l.params.push(`access_token=${s||zt.ACCESS_TOKEN||""}`);const h={event:this.type,created:new Date(e).toISOString()},f=i?fr(h,i):h,m={url:Vt(l),headers:{"Content-Type":"text/plain"},body:JSON.stringify([f])};this.pendingRequest=function(_,y){return ge(fr(_,{method:"POST"}),y)}(m,_=>{this.pendingRequest=null,n(_),this.saveEventData(),this.processRequests(s)})}queueRequest(e,i){this.queue.push(e),this.processRequests(i)}}const gi=new class extends Ei{constructor(t){super("appUserTurnstile"),this._customAccessToken=t}postTurnstileEvent(t,e){zt.EVENTS_URL&&zt.ACCESS_TOKEN&&Array.isArray(t)&&t.some(i=>Wt(i)||qn(i))&&this.queueRequest(Date.now(),e)}processRequests(t){if(this.pendingRequest||this.queue.length===0)return;this.anonId&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();const e=fi(zt.ACCESS_TOKEN),i=e?e.u:zt.ACCESS_TOKEN;let n=i!==this.eventData.tokenU;Zs(this.anonId)||(this.anonId=js(),n=!0);const s=this.queue.shift();if(this.eventData.lastSuccess){const l=new Date(this.eventData.lastSuccess),h=new Date(s),f=(s-this.eventData.lastSuccess)/864e5;n=n||f>=1||f<-1||l.getDate()!==h.getDate()}else n=!0;n?this.postEvent(s,{sdkIdentifier:"mapbox-gl-js",sdkVersion:Pt,skuId:Be,"enabled.telemetry":!1,userId:this.anonId},l=>{l||(this.eventData.lastSuccess=s,this.eventData.tokenU=i)},t):this.processRequests()}},qi=gi.postTurnstileEvent.bind(gi),sr=new class extends Ei{constructor(){super("map.load"),this.success={},this.skuToken=""}postMapLoadEvent(t,e,i,n){this.skuToken=e,this.errorCb=n,zt.EVENTS_URL&&(i||zt.ACCESS_TOKEN?this.queueRequest({id:t,timestamp:Date.now()},i):this.errorCb(new Error(We)))}processRequests(t){if(this.pendingRequest||this.queue.length===0)return;const{id:e,timestamp:i}=this.queue.shift();e&&this.success[e]||(this.anonId||this.fetchEventData(),Zs(this.anonId)||(this.anonId=js()),this.postEvent(i,{sdkIdentifier:"mapbox-gl-js",sdkVersion:Pt,skuId:Be,skuToken:this.skuToken,userId:this.anonId},n=>{n?this.errorCb(n):e&&(this.success[e]=!0)},t))}remove(){this.errorCb=null}}
1,ti=sr.postMapLoadEvent.bind(sr),Br=new class extends Ei{constructor(){super("gljs.performance")}postPerformanceEvent(t,e){zt.EVENTS_URL&&(t||zt.ACCESS_TOKEN)&&this.queueRequest({timestamp:Date.now(),performanceData:e},t)}processRequests(t){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:e,performanceData:i}=this.queue.shift(),n=function(s){const l=performance.getEntriesByType("resource"),h=performance.getEntriesByType("mark"),f=function(E){const A={};if(E){for(const I in E)if(I!=="other")for(const z of E[I]){const L=`${I}ResolveRangeMin`,N=`${I}ResolveRangeMax`,G=`${I}RequestCount`,j=`${I}RequestCachedCount`;A[L]=Math.min(A[L]||1/0,z.startTime),A[N]=Math.max(A[N]||-1/0,z.responseEnd);const X=W=>{A[W]===void 0&&(A[W]=0),++A[W]};z.transferSize!==void 0&&z.transferSize===0&&X(j),X(G)}}return A}(function(E,A){const I={};if(E)for(const z of E){const L=A(z);I[L]===void 0&&(I[L]=[]),I[L].push(z)}return I}(l,Ua)),m=window.devicePixelRatio,_=navigator.connection||navigator.mozConnection||navigator.webkitConnection,y=_?_.effectiveType:void 0,v={counters:[],metadata:[],attributes:[]},w=(E,A,I)=>{I!=null&&E.push({name:A,value:I.toString()})};for(const E in f)w(v.counters,E,f[E]);if(s.interactionRange[0]!==1/0&&s.interactionRange[1]!==-1/0&&(w(v.counters,"interactionRangeMin",s.interactionRange[0]),w(v.counters,"interactionRangeMax",s.interactionRange[1])),h)for(const E of Object.keys(bo)){const A=bo[E],I=h.find(z=>z.name===A);I&&w(v.counters,A,I.startTime)}return w(v.counters,"visibilityHidden",s.visibilityHidden),w(v.attributes,"style",function(E){if(E)for(const A of E){const I=A.name.split("?")[0];if(gn(I)){const z=I.split("/").slice(-2);if(z.length===2)return`mapbox://styles/${z[0]}/${z[1]}`}}}(l)),w(v.attributes,"terrainEnabled",s.terrainEnabled?"true":"false"),w(v.attributes,"fogEnabled",s.fogEnabled?"true":"false"),w(v.attributes,"projection",s.projection),w(v.attributes,"zoom",s.zoom),w(v.metadata,"devicePixelRatio",m),w(v.metadata,"connectionEffectiveType",y),w(v.metadata,"navigatorUserAgent",navigator.userAgent),w(v.metadata,"screenWidth",window.screen.width),w(v.metadata,"screenHeight",window.screen.height),w(v.metadata,"windowWidth",window.innerWidth),w(v.metadata,"windowHeight",window.innerHeight),w(v.metadata,"mapWidth",s.width/m),w(v.metadata,"mapHeight",s.height/m),w(v.metadata,"webglRenderer",s.renderer),w(v.metadata,"webglVendor",s.vendor),w(v.metadata,"sdkVersion",Pt),w(v.metadata,"sdkIdentifier","mapbox-gl-js"),v}(i);for(const s of n.metadata);for(const s of n.counters);for(const s of n.attributes);this.postEvent(e,n,()=>{},t)}},rn=Br.postPerformanceEvent.bind(Br),ar=new class extends Ei{constructor(){super("map.auth"),this.success={},this.skuToken=""}getSession(t,e,i,n){if(!zt.API_URL||!zt.SESSION_PATH)return;const s=_t(zt.API_URL+zt.SESSION_PATH);s.params.push(`sku=${e||""}`),s.params.push(`access_token=${n||zt.ACCESS_TOKEN||""}`);const l={url:Vt(s),headers:{"Content-Type":"text/plain"}};this.pendingRequest=function(h,f){return ge(fr(h,{method:"GET"}),f)}(l,h=>{this.pendingRequest=null,i(h),this.saveEventData(),this.processRequests(n)})}getSessionAPI(t,e,i,n){this.skuToken=e,this.errorCb=n,zt.SESSION_PATH&&zt.API_URL&&(i||zt.ACCESS_TOKEN?this.queueRequest({id:t,timestamp:Date.now()},i):this.errorCb(new Error(We)))}processRequests(t){if(this.pendingRequest||this.queue.length===0)return;const{id:e,timestamp:i}=this.queue.shift();e&&this.success[e]||this.getSession(i,this.skuToken,n=>{n?this.errorCb(n):e&&(this.success[e]=!0)},t)}remove(){this.errorCb=null}},qs=ar.getSessionAPI.bind(ar),Yn=new Set;function is(t,e,i){i[t]&&i[t].indexOf(e)!==-1||(i[t]=i[t]||[],i[t].push(e))}function Xl(t,e,i){if(i&&i[t]){const n=i[t].indexOf(e);n!==-1&&i[t].splice(n,1)}}class Io{constructor(e,i={}){fr(this,i),this.type=e}}class Yl extends Io{constructor(e,i={}){super("error",fr({error:e},i))}}class rs{on(e,i){return this._listeners=this._listeners||{},is(e,i,this._listeners),this}off(e,i){return Xl(e,i,this._listeners),Xl(e,i,this._oneTimeListeners),this}once(e,i){return i?(this._oneTimeListeners=this._oneTimeListeners||{},is(e,i,this._oneTimeListeners),this):new Promise(n=>this.once(e,n))}fire(e,i){typeof e=="string"&&(e=new Io(e,i||{}));const n=e.type;if(this.listens(n)){e.target=this;const s=this._listeners&&this._listeners[n]?this._listeners[n].slice():[];for(const f of s)f.call(this,e);const l=this._oneTimeListeners&&this._oneTimeListeners[n]?this._oneTimeListeners[n].slice():[];for(const f of l)Xl(n,f,this._oneTimeListeners),f.call(this,e);const h=this._eventedParent;h&&(fr(e,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),h.fire(e))}else e instanceof Yl&&console.error(e.error);return this}listens(e){return!!(this._listeners&&this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e))}setEventedParent(e,i){return this._eventedParent=e,this._eventedParentData=i,this}}a.y=void 0;var Ku={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function Za(t){return(t=Math.round(t))<0?0:t>255?255:t}function Kl(t){return Za(t[t.length-1]==="%"?parseFloat(t)/100*255:parseInt(t))}function qa(t){return(e=t[t.length-1]==="%"?parseFloat(t)/100:parseFloat(t))<0?0:e>1?1:e;var e}function Jl(t,e,i){return i<0?i+=1:i>1&&(i-=1),6*i<1?t+(e-t)*i*6:2*i<1?e:3*i<2?t+(e-t)*(2/3-i)*6:t}try{a.y={}.parseCSSColor=function(t){var e,i=t.replace(/ /g,"").toLowerCase();if(i in Ku)return Ku[i].slice();if(i[0]==="#")return i.length===4?(e=parseInt(i.substr(1),16))>=0&&e<=4095?[(3840&e)>>4|(3840&e)>>8,240&e|(240&e)>>4,15&e|(15&e)<<4,1]:null:i.length===7&&(e=parseInt(i.substr(1),16))>=0&&e<=16777215?[(16711680&e)>>16,(65280&e)>>8,255&e,1]:null;var n=i.indexOf("("),s=i.indexOf(")");if(n!==-1&&s+1===i.length){var l=i.substr(0,n),h=i.substr(n+1,s-(n+1)).split(","),f=1;switch(l){case"rgba":if(h.length!==4)return null;f=qa(h.pop());case"rgb":return h.length!==3?null:[Kl(h[0]),Kl(h[1]),Kl(h[2]),f];case"hsla":if(h.length!==4)return null;f=qa(h.pop());case"hsl":if(h.length!==3)return null;var m=(parseFloat(h[0])%360+360)%360/360,_=qa(h[1]),y=qa(h[2]),v=y<=.5?y*(_+1):y+_-y*_,w=2*y-v;return[Za(255*Jl(w,v,m+1/3)),Za(255*Jl(w,v,m)),Za(255*Jl(w,v,m-1/3)),f];default:return null}}return null}}catch{}class Sr{constructor(e,i,n,s=1){this.r=e,this.g=i,this.b=n,this.a=s}static parse(e){if(!e)return;if(e instanceof Sr)return e;if(typeof e!="string")return;const i=a.y(e);return i?new Sr(i[0]/255*i[3],i[1]/255*i[3],i[2]/255*i[3],i[3]):void 0}toString(){const[e,i,n,s]=this.toArray();return`rgba(${Math.round(e)},${Math.round(i)},${Math.round(n)},${s})`}toArray(){const{r:e,g:i,b:n,a:s}=this;return s===0?[0,0,0,0]:[255*e/s,255*i/s,255*n/s,s]}toArray01(){const{r:e,g:i,b:n,a:s}=this;return s===0?[0,0,0,0]:[e/s,i/s,n/s,s]}toArray01Scaled(e){const{r:i,g:n,b:s,a:l}=this;return l===0?[0,0,0]:[i/l*e,n/l*e,s/l*e]}toArray01PremultipliedAlpha(){const{r:e,g:i,b:n,a:s}=this;return[e,i,n,s]}toArray01Linear(){const{r:e,g:i,b:n,a:s}=this;return s===0?[0,0,0,0]:[Math.pow(e/s,2.2),Math.pow(i/s,2.2),Math.pow(n/s,2.2),s]}}Sr.black=new Sr(0,0,0,1),Sr.white=new Sr(1,1,1,1),Sr.transparent=new Sr(0,0,0,0),Sr.red=new Sr(1,0,0,1),Sr.blue=new Sr(0,0,1,1);var ji=Sr;function Ut(t,e,i){return t*(1-i)+e*i}function Ju(t,e,i){return t.map((n,s)=>Ut(n,e[s],i))}var $a=Object.freeze({__proto__:null,array:Ju,color:function(t,e,
vendor: 15,817 bytes, line 1
1i){return new ji(Ut(t.r,e.r,i),Ut(t.g,e.g,i),Ut(t.b,e.b,i),Ut(t.a,e.a,i))},number:Ut});function Ql(t,...e){for(const i of e)for(const n in i)t[n]=i[n];return t}class qd extends Error{constructor(e,i){super(i),this.message=i,this.key=e}}var xn=qd;class ec{constructor(e,i=[]){this.parent=e,this.bindings={};for(const[n,s]of i)this.bindings[n]=s}concat(e){return new ec(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw new Error(`${e} not found in scope.`)}has(e){return!!this.bindings[e]||!!this.parent&&this.parent.has(e)}}var $d=ec;const ns={kind:"null"},Xe={kind:"number"},ni={kind:"string"},oi={kind:"boolean"},qr={kind:"color"},os={kind:"object"},Ht={kind:"value"},Wa={kind:"collator"},ss={kind:"formatted"},$s={kind:"resolvedImage"};function Ar(t,e){return{kind:"array",itemType:t,N:e}}function Ni(t){if(t.kind==="array"){const e=Ni(t.itemType);return typeof t.N=="number"?`array<${e}, ${t.N}>`:t.itemType.kind==="value"?"array":`array<${e}>`}return t.kind}const dt=[ns,Xe,ni,oi,qr,ss,os,Ar(Ht),$s];function Co(t,e){if(e.kind==="error")return null;if(t.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!Co(t.itemType,e.itemType))&&(typeof t.N!="number"||t.N===e.N))return null}else{if(t.kind===e.kind)return null;if(t.kind==="value"){for(const i of dt)if(!Co(i,e))return null}}return`Expected ${Ni(t)} but found ${Ni(e)} instead.`}function yt(t,e){return e.some(i=>i.kind===t.kind)}function Kn(t,e){return e.some(i=>i==="null"?t===null:i==="array"?Array.isArray(t):i==="object"?t&&!Array.isArray(t)&&typeof t=="object":i===typeof t)}class Rt{constructor(e,i,n){this.sensitivity=e?i?"variant":"case":i?"accent":"base",this.locale=n,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,i){return this.collator.compare(e,i)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class as{constructor(e,i,n,s,l){this.text=e.normalize?e.normalize():e,this.image=i,this.scale=n,this.fontStack=s,this.textColor=l}}class lr{constructor(e){this.sections=e}static fromString(e){return new lr([new as(e,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(e=>e.text.length!==0||e.image&&e.image.namePrimary.length!==0)}static factory(e){return e instanceof lr?e:lr.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map(e=>e.text).join("")}serialize(){const e=["format"];for(const i of this.sections){if(i.image){e.push(["image",i.image.namePrimary]);continue}e.push(i.text);const n={};i.fontStack&&(n["text-font"]=["literal",i.fontStack.split(",")]),i.scale&&(n["font-scale"]=i.scale),i.textColor&&(n["text-color"]=["rgba"].concat(i.textColor.toArray())),e.push(n)}return e}}class ft{constructor(e){this.namePrimary=e.namePrimary,e.nameSecondary&&(this.nameSecondary=e.nameSecondary),this.available=e.available}toString(){return this.nameSecondary?`[${this.namePrimary},${this.nameSecondary}]`:this.namePrimary}static fromString(e,i){return e?new ft({namePrimary:e,nameSecondary:i,available:!1}):null}serialize(){return this.nameSecondary?["image",this.namePrimary,this.nameSecondary]:["image",this.namePrimary]}}function Qu(t,e,i,n){return typeof t=="number"&&t>=0&&t<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof i=="number"&&i>=0&&i<=255?n===void 0||typeof n=="number"&&n>=0&&n<=1?null:`Invalid rgba value [${[t,e,i,n].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof n=="number"?[t,e,i,n]:[t,e,i]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Po(t){if(t===null||typeof t=="string"||typeof t=="boolean"||typeof t=="number"||t instanceof ji||t instanceof Rt||t instanceof lr||t instanceof ft)return!0;if(Array.isArray(t)){for(const e of t)if(!Po(e))return!1;return!0}if(typeof t=="object"){for(const e in t)if(!Po(t[e]))return!1;return!0}return!1}function $i(t){if(t===null)return ns;if(typeof t=="string")return ni;if(typeof t=="boolean")return oi;if(typeof t=="number")return Xe;if(t instanceof ji)return qr;if(t instanceof Rt)return Wa;if(t instanceof lr)return ss;if(t instanceof ft)return $s;if(Array.isArray(t)){const e=t.length;let i;for(const n of t){const s=$i(n);if(i){if(i===s)continue;i=Ht;break}i=s}return Ar(i||Ht,e)}return os}function $r(t){const e=typeof t;return t===null?"":e==="string"||e==="number"||e==="boolean"?String(t):t instanceof ji||t instanceof lr||t instanceof ft?t.toString():JSON.stringify(t)}class Jn{constructor(e,i){this.type=e,this.value=i}static parse(e,i){if(e.length!==2)return i.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!Po(e[1]))return i.error("invalid value");const n=e[1];let s=$i(n);const l=i.expectedType;return s.kind!=="array"||s.N!==0||!l||l.kind!=="array"||typeof l.N=="number"&&l.N!==0||(s=l),new Jn(s,n)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}serialize(){return this.type.kind==="array"||this.type.kind==="object"?["literal",this.value]:this.value instanceof ji?["rgba"].concat(this.value.toArray()):this.value instanceof lr?this.value.serialize():this.value}}var In=Jn,Wi=class{constructor(t){this.name="ExpressionEvaluationError",this.message=t}toJSON(){return this.message}};const tc={string:ni,number:Xe,boolean:oi,object:os};class ic{constructor(e,i){this.type=e,this.args=i}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");let n,s=1;const l=e[0];if(l==="array"){let f,m;if(e.length>2){const _=e[1];if(typeof _!="string"||!(_ in tc)||_==="object")return i.error('The item type argument of "array" must be one of string, number, boolean',1);f=tc[_],s++}else f=Ht;if(e.length>3){if(e[2]!==null&&(typeof e[2]!="number"||e[2]<0||e[2]!==Math.floor(e[2])))return i.error('The length argument to "array" must be a positive integer literal',2);m=e[2],s++}n=Ar(f,m)}else n=tc[l];const h=[];for(;s<e.length;s++){const f=i.parse(e[s],s,Ht);if(!f)return null;h.push(f)}return new ic(n,h)}evaluate(e){for(let i=0;i<this.args.length;i++){const n=this.args[i].evaluate(e);if(!Co(this.type,$i(n)))return n;if(i===this.args.length-1)throw new Wi(`Expected value to be of type ${Ni(this.type)}, but found ${Ni($i(n))} instead.`)}return null}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}serialize(){const e=this.type,i=[e.kind];if(e.kind==="array"){const n=e.itemType;if(n.kind==="string"||n.kind==="number"||n.kind==="boolean"){i.push(n.kind);const s=e.N;(typeof s=="number"||this.args.length>1)&&i.push(s)}}return i.concat(this.args.map(n=>n.serialize()))}}var Cn=ic;class ls{constructor(e){this.type=ss,this.sections=e}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");const n=e[1];if(!Array.isArray(n)&&typeof n=="object")return i.error("First argument must be an image or text section.");const s=[];let l=!1;for(let h=1;h<=e.length-1;++h){const f=e[h];if(l&&typeof f=="object"&&!Array.isArray(f)){l=!1;let m=null;if(f["font-scale"]&&(m=i.parse(f["font-scale"],1,Xe),!m))return null;let _=null;if(f["text-font"]&&(_=i.parse(f["text-font"],1,Ar(ni)),!_))return null;let y=null;if(f["text-color"]&&(y=i.parse(f["text-color"],1,qr),!y))return null;const v=s[s.length-1];v.scale=m,v.font=_,v.textColor=y}else{const m=i.parse(e[h],1,Ht);if(!m)return null;const _=m.type.kind;if(_!=="string"&&_!=="value"&&_!=="null"&&_!=="resolvedImage")return i.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");l=!0,s.push({content:m,scale:null,font:null,textColor:null})}}return new ls(s)}evaluate(e){return new lr(this.sections.map(i=>{const n=i.content.evaluate(e);return $i(n)===$s?new as("",n,null,null,null):new as($r(n),null,i.scale?i.scale.evaluate(e):null,i.font?i.font.evaluate(e).join(","):null,i.textColor?i.textColor.evaluate(e):null)}))}eachChild(e){for(const i of this.sections)e(i.content),i.scale&&e(i.scale),i.font&&e(i.font),i.textColor&&e(i.textColor)}outputDefined(){return!1}serialize(){const e=["format"];for(const i of this.sections){e.push(i.content.serialize());const n={};i.scale&&(n["font-scale"]=i.scale.serialize()),i.font&&(n["text-font"]=i.font.serialize()),i.textColor&&(n["text-color"]=i.textColor.serialize()),e.push(n)}return e}}class zo{constructor(e,i){this.type=$s,this.inputPrimary=e,this.inputSecondary=i}static parse(e,i){if(e.length<2)return i.error("Expected two or more arguments.");const n=i.parse(e[1],1,ni);if(!n)return i.error("No image name provided.");if(e.length===2)return new zo(n);const s=i.parse(e[2],1,ni);return s?new zo(n,s):i.error("Secondary image variant is not a string.")}evaluate(e){const i=ft.fromString(this.inputPrimary.evaluate(e),this.inputSecondary?this.inputSecondary.evaluate(e):void 0);return i&&e.availableImages&&(i.available=e.availableImages.indexOf(i.namePrimary)>-1,i.nameSecondary&&i.available&&e.availableImages&&(i.available=e.availableImages.indexOf(i.nameSecondary)>-1)),i}eachChild(e){e(this.inputPrimary),this.inputSecondary&&e(this.inputSecondary)}outputDefined(){return!1}serialize(){return this.inputSecondary?["image",this.inputPrimary.serialize(),this.inputSecondary.serialize()]:["image",this.inputPrimary.serialize()]}}function cs(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":t===null?"null":typeof t}const nn={"to-boolean":oi,"to-color":qr,"to-number":Xe,"to-string":ni};class Ha{constructor(e,i){this.type=e,this.args=i}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");const n=e[0],s=[];let l=ns;if(n==="to-array"){if(!Array.isArray(e[1]))return null;const h=e[1].length;if(i.expectedType){if(i.expectedType.kind!=="array")return i.error(`Expected ${i.expectedType.kind} but found array.`);l=Ar(i.expectedType.itemType,h)}else{if(!(h>0&&Po(e[1][0])))return null;l=Ar($i(e[1][0]),h)}for(let f=0;f<h;f++){const m=e[1][f];let _;if(cs(m)==="array")_=i.parse(m,void 0,l.itemType);else{const y=cs(m);if(y!==l.itemType.kind)return i.error(`Expected ${l.itemType.kind} but found ${y}.`);_=i.registry.literal.parse(["literal",m===void 0?null:m],i)}if(!_)return null;s.push(_)}}else{if((n==="to-boolean"||n==="to-string")&&e.length!==2)return i.error("Expected one argument.");l=nn[n];for(let h=1;h<e.length;h++){const f=i.parse(e[h],h,Ht);if(!f)return null;s.push(f)}}return new Ha(l,s)}evaluate(e){if(this.type.kind==="boolean")return!!this.args[0].evaluate(e);if(this.type.kind==="color"){let i,n;for(const s of this.args){if(i=s.evaluate(e),n=null,i instanceof ji)return i;if(typeof i=="string"){const l=e.parseColor(i);if(l)return l}else if(Array.isArray(i)&&(n=i.length<3||i.length>4?`Invalid rbga value ${JSON.stringify(i)}: expected an array containing either three or four numeric values.`:Qu(i[0],i[1],i[2],i[3]),!n))return new ji(i[0]/255,i[1]/255,i[2]/255,i[3])}throw new Wi(n||`Could not parse color from value '${typeof i=="string"?i:String(JSON.stringify(i))}'`)}if(this.type.kind==="number"){let i=null;for(const n of this.args){if(i=n.evaluate(e),i===null)return 0;const s=Number(i);if(!isNaN(s))return s}throw new Wi(`Could not convert ${JSON.stringify(i)} to number.`)}return this.type.kind==="formatted"?lr.fromString($r(this.args[0].evaluate(e))):this.type.kind==="resolvedImage"?ft.fromString($r(this.args[0].evaluate(e))):this.type.kind==="array"?this.args.map(i=>i.evaluate(e)):$r(this.args[0].evaluate(e))}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}serialize(){if(this.type.kind==="formatted")return new ls([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if(this.type.kind==="resolvedImage")return new zo(this.args[0]).serialize();const e=this.type.kind==="array"?[]:[`to-${this.type.kind}`];return this.eachChild(i=>{e.push(i.serialize())}),e}}var Pn=Ha;const Ws=["Unknown","Point","LineString","Polygon"];var eh=class{constructor(t,e){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null,this.featureTileCoord=null,this.featureDistanceData=null,this.scope=t,this.options=e}id(){return this.feature&&this.feature.id!==void 0?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?Ws[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||{}}measureLight(t){return this.globals.brightness||0}distanceFromCenter(){if(this.featureTileCoord&&this.featureDistanceData){const t=this.featureDistanceData.center,e=this.featureDistanceData.scale,{x:i,y:n}=this.featureTileCoord;return this.featureDistanceData.bearing[0]*(i*e-t[0])+this.featureDistanceData.bearing[1]*(n*e-t[1])}return 0}parseColor(t){let e=this._parseColorCache[t];return e||(e=this._parseColorCache[t]=ji.parse(t)),e}getConfig(t){return this.options?this.options.get(t):null}};class Do{constructor(e,i,n,s,l){this.name=e,this.type=i,this._evaluate=n,this.args=s,this._overloadIndex=l}evaluate(e){if(!this._evaluate){const i=Do.definitions[this.name];this._evaluate=Array.isArray(i)?i[2]:i.overloads[this._overloadIndex][1]}return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}serialize(){return[this.name].concat(this.args.map(e=>e.serialize()))}static parse(e,i){const n=e[0],s=Do.definitions[n];if(!s)return i.error(`Unknown expression "${n}". If you wanted a literal array, use ["literal", [...]].`,0);const l=Array.isArray(s)?s[0]:s.type,h=Array.isArray(s)?[[s[1],s[2]]]:s.overloads,f=[];let m=null,_=-1;for(const[y,v]of h){if(Array.isArray(y)&&y.length!==e.length-1)continue;f.push(y),_++,m=new ah(i.registry,i.path,null,i.scope,void 0,i._scope,i.options);const w=[];let E=!1;for(let A=1;A<e.length;A++){const I=e[A],z=Array.isArray(y)?y[A-1]:y.type,L=m.parse(I,1+w.length,z);if(!L){E=!0;break}w.push(L)}if(!E)if(Array.isArray(y)&&y.length!==w.length)m.error(`Expected ${y.length} arguments, but found ${w.length} instead.`);else{for(let A=0;A<w.length;A++){const I=Array.isArray(y)?y[A]:y.type,z=w[A];m.concat(A+1).checkSubtype(I,z.type)}if(m.errors.length===0)return new Do(n,l,v,w,_)}}if(f.length===1)i.errors.push(...m.errors);else{const y=(f.length?f:h.map(([w])=>w)).map(th).join(" | "),v=[];for(let w=1;w<e.length;w++){const E=i.parse(e[w],1+v.length);if(!E)return null;v.push(Ni(E.type))}i.error(`Expected arguments of type ${y}, but found (${v.join(", ")}) instead.`)}return null}static register(e,i){Do.definitions=i;for(const n in i)e[n]=Do}}function th(t){return Array.isArray(t)?`(${t.map(Ni).join(", ")})`:`(${Ni(t.type)}...)`}var Gt=Do;class Hs{constructor(e,i,n){this.type=Wa,this.locale=n,this.caseSensitive=e,this.diacriticSensitive=i}static parse(e,i){if(e.length!==2)return i.error("Expected one argument.");const n=e[1];if(typeof n!="object"||Array.isArray(n))return i.error("Collator options argument must be an object.");const s=i.parse(n["case-sensitive"]!==void 0&&n["case-sensitive"],1,oi);if(!s)return null;const l=i.parse(n["diacritic-sensitive"]!==void 0&&n["diacritic-sensitive"],1,oi);if(!l)return null;let h=null;return n.locale&&(h=i.parse(n.locale,1,ni),!h)?null:new Hs(s,l,h)}evaluate(e){return new Rt(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}serialize(){const e={};return e["case-sensitive"]=this.caseSensitive.serialize(),e["diacritic-sensitive"]=this.diacriticSensitive.serialize(),this.locale&&(e.locale=this.locale.serialize()),["collator",e]}}
1var rc={exports:{}};rc.exports=function(){function t(n,s,l,h,f){for(;h>l;){if(h-l>600){var m=h-l+1,_=s-l+1,y=Math.log(m),v=.5*Math.exp(2*y/3),w=.5*Math.sqrt(y*v*(m-v)/m)*(_-m/2<0?-1:1);t(n,s,Math.max(l,Math.floor(s-_*v/m+w)),Math.min(h,Math.floor(s+(m-_)*v/m+w)),f)}var E=n[s],A=l,I=h;for(e(n,l,s),f(n[h],E)>0&&e(n,l,h);A<I;){for(e(n,A,I),A++,I--;f(n[A],E)<0;)A++;for(;f(n[I],E)>0;)I--}f(n[l],E)===0?e(n,l,I):e(n,++I,h),I<=s&&(l=I+1),s<=I&&(h=I-1)}}function e(n,s,l){var h=n[s];n[s]=n[l],n[l]=h}function i(n,s){return n<s?-1:n>s?1:0}return function(n,s,l,h,f){t(n,s,l||0,h||n.length-1,f||i)}}();var Wd=kr(rc.exports);function Hd(t){let e=0;for(let i,n,s=0,l=t.length,h=l-1;s<l;h=s++)i=t[s],n=t[h],e+=(n.x-i.x)*(i.y+n.y);return e}function Qn(t,e){t[0]=Math.min(t[0],e[0]),t[1]=Math.min(t[1],e[1]),t[2]=Math.max(t[2],e[0]),t[3]=Math.max(t[3],e[1])}function eo(t,e){return!(t[0]<=e[0]||t[2]>=e[2]||t[1]<=e[1]||t[3]>=e[3])}function Xa(t,e,i){const n=t[0]-e[0],s=t[1]-e[1],l=t[0]-i[0],h=t[1]-i[1];return n*h-l*s==0&&n*l<=0&&s*h<=0}function us(t,e,i=!1){let n=!1;for(let f=0,m=e.length;f<m;f++){const _=e[f];for(let y=0,v=_.length,w=v-1;y<v;w=y++){const E=_[w],A=_[y];if(Xa(t,E,A))return i;(l=E)[1]>(s=t)[1]!=(h=A)[1]>s[1]&&s[0]<(h[0]-l[0])*(s[1]-l[1])/(h[1]-l[1])+l[0]&&(n=!n)}}var s,l,h;return n}function nc(t,e,i,n){const s=n[0]-i[0],l=n[1]-i[1],h=(t[0]-i[0])*l-s*(t[1]-i[1]),f=(e[0]-i[0])*l-s*(e[1]-i[1]);return h>0&&f<0||h<0&&f>0}function zn(t,e,i,n){return(s=[n[0]-i[0],n[1]-i[1]])[0]*(l=[e[0]-t[0],e[1]-t[1]])[1]-s[1]*l[0]!=0&&!(!nc(t,e,i,n)||!nc(i,n,t,e));var s,l}const to=8192;function Xs(t,e){const i=(180+t[0])/360,n=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t[1]*Math.PI/360)))/360,s=Math.pow(2,e.z);return[Math.round(i*s*to),Math.round(n*s*to)]}function oc(t,e){for(let i=0;i<e.length;i++)if(us(t,e[i]))return!0;return!1}function sc(t,e,i){for(const n of i)for(let s=0,l=n.length,h=l-1;s<l;h=s++)if(zn(t,e,n[h],n[s]))return!0;return!1}function Wr(t,e){for(let i=0;i<t.length;++i)if(!us(t[i],e))return!1;for(let i=0;i<t.length-1;++i)if(sc(t[i],t[i+1],e))return!1;return!0}function ih(t,e){for(let i=0;i<e.length;i++)if(Wr(t,e[i]))return!0;return!1}function ac(t,e,i){const n=[];for(let s=0;s<t.length;s++){const l=[];for(let h=0;h<t[s].length;h++){const f=Xs(t[s][h],i);Qn(e,f),l.push(f)}n.push(l)}return n}function lc(t,e,i){const n=[];for(let s=0;s<t.length;s++){const l=ac(t[s],e,i);n.push(l)}return n}function cc(t,e,i,n){if(t[0]<i[0]||t[0]>i[2]){const s=.5*n;let l=t[0]-i[0]>s?-n:i[0]-t[0]>s?n:0;l===0&&(l=t[0]-i[2]>s?-n:i[2]-t[0]>s?n:0),t[0]+=l}Qn(e,t)}function uc(t,e,i,n){const s=Math.pow(2,n.z)*to,l=[n.x*to,n.y*to],h=[];if(!t)return h;for(const f of t)for(const m of f){const _=[m.x+l[0],m.y+l[1]];cc(_,e,i,s),h.push(_)}return h}function hc(t,e,i,n){const s=Math.pow(2,n.z)*to,l=[n.x*to,n.y*to],h=[];if(!t)return h;for(const m of t){const _=[];for(const y of m){const v=[y.x+l[0],y.y+l[1]];Qn(e,v),_.push(v)}h.push(_)}if(e[2]-e[0]<=s/2){(f=e)[0]=f[1]=1/0,f[2]=f[3]=-1/0;for(const m of h)for(const _ of m)cc(_,e,i,s)}var f;return h}class hs{constructor(e,i){this.type=oi,this.geojson=e,this.geometries=i}static parse(e,i){if(e.length!==2)return i.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(Po(e[1])){const n=e[1];if(n.type==="FeatureCollection")for(let s=0;s<n.features.length;++s){const l=n.features[s].geometry.type;if(l==="Polygon"||l==="MultiPolygon")return new hs(n,n.features[s].geometry)}else if(n.type==="Feature"){const s=n.geometry.type;if(s==="Polygon"||s==="MultiPolygon")return new hs(n,n.geometry)}else if(n.type==="Polygon"||n.type==="MultiPolygon")return new hs(n,n)}return i.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return function(i,n){const s=[1/0,1/0,-1/0,-1/0],l=[1/0,1/0,-1/0,-1/0],h=i.canonicalID();if(!h)return!1;if(n.type==="Polygon"){const f=ac(n.coordinates,l,h),m=uc(i.geometry(),s,l,h);if(!eo(s,l))return!1;for(const _ of m)if(!us(_,f))return!1}if(n.type==="MultiPolygon"){const f=lc(n.coordinates,l,h),m=uc(i.geometry(),s,l,h);if(!eo(s,l))return!1;for(const _ of m)if(!oc(_,f))return!1}return!0}(e,this.geometries);if(e.geometryType()==="LineString")return function(i,n){const s=[1/0,1/0,-1/0,-1/0],l=[1/0,1/0,-1/0,-1/0],h=i.canonicalID();if(!h)return!1;if(n.type==="Polygon"){const f=ac(n.coordinates,l,h),m=hc(i.geometry(),s,l,h);if(!eo(s,l))return!1;for(const _ of m)if(!Wr(_,f))return!1}if(n.type==="MultiPolygon"){const f=lc(n.coordinates,l,h),m=hc(i.geometry(),s,l,h);if(!eo(s,l))return!1;for(const _ of m)if(!ih(_,f))return!1}return!0}(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}serialize(){return["within",this.geojson]}}var Ya=hs,Ys={exports:{}};Ys.exports=function(){var t={kilometers:1,miles:.621371192237334,nauticalmiles:.5399568034557235,meters:1e3,metres:1e3,yards:1093.6132983377079,feet:3280.839895013123,inches:39370.078740157485},e=1/298.257223563,i=e*(2-e),n=Math.PI/180,s=function(_,y){if(_===void 0)throw new Error("No latitude given.");if(y&&!t[y])throw new Error("Unknown unit "+y+". Use one of: "+Object.keys(t).join(", "));var v=6378.137*n*(y?t[y]:1),w=Math.cos(_*n),E=1/(1-i*(1-w*w)),A=Math.sqrt(E);this.kx=v*A*w,this.ky=v*A*E*(1-i)},l={units:{configurable:!0}};function h(_,y){return _[0]===y[0]&&_[1]===y[1]}function f(_,y,v){var w=m(y[0]-_[0]);return[_[0]+w*v,_[1]+(y[1]-_[1])*v]}function m(_){for(;_<-180;)_+=360;for(;_>180;)_-=360;return _}return s.fromTile=function(_,y,v){var w=Math.PI*(1-2*(_+.5)/Math.pow(2,y)),E=Math.atan(.5*(Math.exp(w)-Math.exp(-w)))/n;return new s(E,v)},l.units.get=function(){return t},s.prototype.distance=function(_,y){var v=m(_[0]-y[0])*this.kx,w=(_[1]-y[1])*this.ky;return Math.sqrt(v*v+w*w)},s.prototype.bearing=function(_,y){var v=m(y[0]-_[0])*this.kx;return Math.atan2(v,(y[1]-_[1])*this.ky)/n},s.prototype.destination=function(_,y,v){var w=v*n;return this.offset(_,Math.sin(w)*y,Math.cos(w)*y)},s.prototype.offset=function(_,y,v){return[_[0]+y/this.kx,_[1]+v/this.ky]},s.prototype.lineDistance=function(_){for(var y=0,v=0;v<_.length-1;v++)y+=this.distance(_[v],_[v+1]);return y},s.prototype.area=function(_){for(var y=0,v=0;v<_.length;v++)for(var w=_[v],E=0,A=w.length,I=A-1;E<A;I=E++)y+=m(w[E][0]-w[I][0])*(w[E][1]+w[I][1])*(v?-1:1);return Math.abs(y)/2*this.kx*this.ky},s.prototype.along=function(_,y){var v=0;if(y<=0)return _[0];for(var w=0;w<_.length-1;w++){var E=_[w],A=_[w+1],I=this.distance(E,A);if((v+=I)>y)return f(E,A,(y-(v-I))/I)}return _[_.length-1]},s.prototype.pointToSegmentDistance=function(_,y,v){var w=y[0],E=y[1],A=m(v[0]-w)*this.kx,I=(v[1]-E)*this.ky,z=0;return A===0&&I===0||((z=(m(_[0]-w)*this.kx*A+(_[1]-E)*this.ky*I)/(A*A+I*I))>1?(w=v[0],E=v[1]):z>0&&(w+=A/this.kx*z,E+=I/this.ky*z)),A=m(_[0]-w)*this.kx,I=(_[1]-E)*this.ky,Math.sqrt(A*A+I*I)},s.prototype.pointOnLine=function(_,y){for(var v,w,E,A,I=1/0,z=0;z<_.length-1;z++){var L=_[z][0],N=_[z][1],G=m(_[z+1][0]-L)*this.kx,j=(_[z+1][1]-N)*this.ky,X=0;G===0&&j===0||((X=(m(y[0]-L)*this.kx*G+(y[1]-N)*this.ky*j)/(G*G+j*j))>
11?(L=_[z+1][0],N=_[z+1][1]):X>0&&(L+=G/this.kx*X,N+=j/this.ky*X));var W=(G=m(y[0]-L)*this.kx)*G+(j=(y[1]-N)*this.ky)*j;W<I&&(I=W,v=L,w=N,E=z,A=X)}return{point:[v,w],index:E,t:Math.max(0,Math.min(1,A))}},s.prototype.lineSlice=function(_,y,v){var w=this.pointOnLine(v,_),E=this.pointOnLine(v,y);if(w.index>E.index||w.index===E.index&&w.t>E.t){var A=w;w=E,E=A}var I=[w.point],z=w.index+1,L=E.index;!h(v[z],I[0])&&z<=L&&I.push(v[z]);for(var N=z+1;N<=L;N++)I.push(v[N]);return h(v[L],E.point)||I.push(E.point),I},s.prototype.lineSliceAlong=function(_,y,v){for(var w=0,E=[],A=0;A<v.length-1;A++){var I=v[A],z=v[A+1],L=this.distance(I,z);if((w+=L)>_&&E.length===0&&E.push(f(I,z,(_-(w-L))/L)),w>=y)return E.push(f(I,z,(y-(w-L))/L)),E;w>_&&E.push(z)}return E},s.prototype.bufferPoint=function(_,y){var v=y/this.ky,w=y/this.kx;return[_[0]-w,_[1]-v,_[0]+w,_[1]+v]},s.prototype.bufferBBox=function(_,y){var v=y/this.ky,w=y/this.kx;return[_[0]-w,_[1]-v,_[2]+w,_[3]+v]},s.prototype.insideBBox=function(_,y){return m(_[0]-y[0])>=0&&m(_[0]-y[2])<=0&&_[1]>=y[1]&&_[1]<=y[3]},Object.defineProperties(s,l),s}();var io=kr(Ys.exports),dc={exports:{}};dc.exports=function(){var t=function(i,n){if(i===void 0&&(i=[]),n===void 0&&(n=e),this.data=i,this.length=this.data.length,this.compare=n,this.length>0)for(var s=(this.length>>1)-1;s>=0;s--)this._down(s)};function e(i,n){return i<n?-1:i>n?1:0}return t.prototype.push=function(i){this.data.push(i),this.length++,this._up(this.length-1)},t.prototype.pop=function(){if(this.length!==0){var i=this.data[0],n=this.data.pop();return this.length--,this.length>0&&(this.data[0]=n,this._down(0)),i}},t.prototype.peek=function(){return this.data[0]},t.prototype._up=function(i){for(var n=this.data,s=this.compare,l=n[i];i>0;){var h=i-1>>1,f=n[h];if(s(l,f)>=0)break;n[i]=f,i=h}n[i]=l},t.prototype._down=function(i){for(var n=this.data,s=this.compare,l=this.length>>1,h=n[i];i<l;){var f=1+(i<<1),m=n[f],_=f+1;if(_<this.length&&s(n[_],m)<0&&(f=_,m=n[_]),s(m,h)>=0)break;n[i]=m,i=f}n[i]=h},t}();var Hr=kr(dc.exports),qe=8192;function Ka(t,e){return e.dist-t.dist}const fc=100,Ks=50;function pc(t){const e=[1/0,1/0,-1/0,-1/0];if(e.length!==t.length)return!1;for(let i=0;i<e.length;i++)if(e[i]!==t[i])return!1;return!0}function ro(t){return t[1]-t[0]+1}function on(t,e){const i=t[1]>=t[0]&&t[1]<e;return i||console.warn("Distance Expression: Index is out of range"),i}function mc(t,e){if(t[0]>t[1])return[null,null];const i=ro(t);if(e){if(i===2)return[t,null];const n=Math.floor(i/2);return[[t[0],t[0]+n],[t[0]+n,t[1]]]}{if(i===1)return[t,null];const n=Math.floor(i/2)-1;return[[t[0],t[0]+n],[t[0]+n+1,t[1]]]}}function Lo(t,e){const i=[1/0,1/0,-1/0,-1/0];if(!on(e,t.length))return i;for(let n=e[0];n<=e[1];++n)Qn(i,t[n]);return i}function Ja(t){const e=[1/0,1/0,-1/0,-1/0];for(let i=0;i<t.length;++i)for(let n=0;n<t[i].length;++n)Qn(e,t[i][n]);return e}function Ro(t,e,i){if(pc(t)||pc(e))return NaN;let n=0,s=0;return t[2]<e[0]&&(n=e[0]-t[2]),t[0]>e[2]&&(n=t[0]-e[2]),t[1]>e[3]&&(s=t[1]-e[3]),t[3]<e[1]&&(s=e[1]-t[3]),i.distance([0,0],[n,s])}function _c(t){return 360*t-180}function Xd(t){return 360/Math.PI*Math.atan(Math.exp((180-360*t)*Math.PI/180))-90}function ds(t,e){const i=Math.pow(2,e.z),n=(t.y/qe+e.y)/i;return[_c((t.x/qe+e.x)/i),Xd(n)]}function Yd(t,e){const i=[];for(let n=0;n<t.length;++n)i.push(ds(t[n],e));return i}function rh(t,e,i){const n=i.pointOnLine(e,t).point;return i.distance(t,n)}function nh(t,e,i,n,s){const l=i.slice(n[0],n[1]+1);let h=1/0;for(let f=e[0];f<=e[1];++f)if((h=Math.min(h,rh(t[f],l,s)))===0)return 0;return h}function gc(t,e,i,n,s){const l=Math.min(s.pointToSegmentDistance(t,i,n),s.pointToSegmentDistance(e,i,n)),h=Math.min(s.pointToSegmentDistance(i,t,e),s.pointToSegmentDistance(n,t,e));return Math.min(l,h)}function Kd(t,e,i,n,s){if(!on(e,t.length)||!on(n,i.length))return NaN;let l=1/0;for(let h=e[0];h<e[1];++h)for(let f=n[0];f<n[1];++f){if(zn(t[h],t[h+1],i[f],i[f+1]))return 0;l=Math.min(l,gc(t[h],t[h+1],i[f],i[f+1],s))}return l}function Jd(t,e,i,n,s){if(!on(e,t.length)||!on(n,i.length))return NaN;let l=1/0;for(let h=e[0];h<=e[1];++h)for(let f=n[0];f<=n[1];++f)if((l=Math.min(l,s.distance(t[h],i[f])))===0)return l;return l}function Qd(t,e,i){if(us(t,e,!0))return 0;let n=1/0;for(const s of e){const l=s.length;if(l<2)return console.warn("Distance Expression: Invalid polygon!"),NaN;if(s[0]!==s[l-1]&&(n=Math.min(n,i.pointToSegmentDistance(t,s[l-1],s[0])))===0||(n=Math.min(n,rh(t,s,i)))===0)return n}return n}function oh(t,e,i,n){if(!on(e,t.length))return NaN;for(let l=e[0];l<=e[1];++l)if(us(t[l],i,!0))return 0;let s=1/0;for(let l=e[0];l<e[1];++l)for(const h of i)for(let f=0,m=h.length,_=m-1;f<m;_=f++){if(zn(t[l],t[l+1],h[_],h[f]))return 0;s=Math.min(s,gc(t[l],t[l+1],h[_],h[f],n))}return s}function Js(t,e){for(const i of t)for(let n=0;n<=i.length-1;++n)if(us(i[n],e,!0))return!0;return!1}function ef(t,e,i,n=1/0){const s=Ja(t),l=Ja(e);if(n!==1/0&&Ro(s,l,i)>=n)return n;if(eo(s,l)){if(Js(t,e))return 0}else if(Js(e,t))return 0;let h=n;for(const f of t)for(let m=0,_=f.length,y=_-1;m<_;y=m++)for(const v of e)for(let w=0,E=v.length,A=E-1;w<E;A=w++){if(zn(f[y],f[m],v[A],v[w]))return 0;h=Math.min(h,gc(f[y],f[m],v[A],v[w],i))}return h}function Qa(t,e,i,n,s,l,h){if(l===null||h===null)return;const f=Ro(Lo(n,l),Lo(s,h),i);f<e&&t.push({dist:f,range1:l,range2:h})}function yc(t,e,i,n,s=1/0){let l=Math.min(n.distance(t[0],i[0][0]),s);if(l===0)return l;const h=new Hr([{dist:0,range1:[0,t.length-1],range2:[0,0]}],Ka),f=e?Ks:fc,m=Ja(i);for(;h.length;){const _=h.pop();if(_.dist>=l)continue;const y=_.range1;if(ro(y)<=f){if(!on(y,t.length))return NaN;if(e){const v=oh(t,y,i,n);if((l=Math.min(l,v))===0)return l}else for(let v=y[0];v<=y[1];++v){const w=Qd(t[v],i,n);if((l=Math.min(l,w))===0)return l}}else{const v=mc(y,e);if(v[0]!==null){const w=Ro(Lo(t,v[0]),m,n);w<l&&h.push({dist:w,range1:v[0],range2:[0,0]})}if(v[1]!==null){const w=Ro(Lo(t,v[1]),m,n);w<l&&h.push({dist:w,range1:v[1],range2:[0,0]})}}}return l}function sh(t,e,i,n,s,l=1/0){let h=Math.min(l,s.distance(t[0],i[0]));if(h===0)return h;const f=new Hr([{dist:0,range1:[0,t.length-1],range2:[0,i.length-1]}],Ka),m=e?Ks:fc,_=n?Ks:fc;for(;f.length;){const y=f.pop();if(y.dist>=h)continue;const v=y.range1,w=y.range2;if(ro(v)<=m&&ro(w)<=_){if(!on(v,t.length)||!on(w,i.length))return NaN;
1if(e&&n?h=Math.min(h,Kd(t,v,i,w,s)):e||n?e&&!n?h=Math.min(h,nh(i,w,t,v,s)):!e&&n&&(h=Math.min(h,nh(t,v,i,w,s))):h=Math.min(h,Jd(t,v,i,w,s)),h===0)return h}else{const E=mc(v,e),A=mc(w,n);Qa(f,h,s,t,i,E[0],A[0]),Qa(f,h,s,t,i,E[0],A[1]),Qa(f,h,s,t,i,E[1],A[0]),Qa(f,h,s,t,i,E[1],A[1])}}return h}function xc(t,e,i,n,s=1/0){let l=s;const h=Lo(t,[0,t.length-1]);for(const f of i)if(!(l!==1/0&&Ro(h,Lo(f,[0,f.length-1]),n)>=l)&&(l=Math.min(l,sh(t,e,f,!0,n,l)),l===0))return l;return l}function el(t,e,i,n,s=1/0){let l=s;const h=Lo(t,[0,t.length-1]);for(const f of i){if(l!==1/0&&Ro(h,Ja(f),n)>=l)continue;const m=yc(t,e,f,n,l);if(isNaN(m))return m;if((l=Math.min(l,m))===0)return l}return l}function vc(t){return t==="Point"||t==="MultiPoint"||t==="LineString"||t==="MultiLineString"||t==="Polygon"||t==="MultiPolygon"}class ko{constructor(e,i){this.type=Xe,this.geojson=e,this.geometries=i}static parse(e,i){if(e.length!==2)return i.error(`'distance' expression requires either one argument, but found ' ${e.length-1} instead.`);if(Po(e[1])){const n=e[1];if(n.type==="FeatureCollection"){for(let s=0;s<n.features.length;++s)if(vc(n.features[s].geometry.type))return new ko(n,n.features[s].geometry)}else if(n.type==="Feature"){if(vc(n.geometry.type))return new ko(n,n.geometry)}else if(vc(n.type))return new ko(n,n)}return i.error("'distance' expression needs to be an array with format ['Distance', GeoJSONObj].")}evaluate(e){const i=e.geometry(),n=e.canonicalID();if(i!=null&&n!=null){if(e.geometryType()==="Point")return function(s,l,h){const f=[];for(const _ of s)for(const y of _)f.push(ds(y,l));const m=new io(f[0][1],"meters");return h.type==="Point"||h.type==="MultiPoint"||h.type==="LineString"?sh(f,!1,h.type==="Point"?[h.coordinates]:h.coordinates,h.type==="LineString",m):h.type==="MultiLineString"?xc(f,!1,h.coordinates,m):h.type==="Polygon"||h.type==="MultiPolygon"?el(f,!1,h.type==="Polygon"?[h.coordinates]:h.coordinates,m):null}(i,n,this.geometries);if(e.geometryType()==="LineString")return function(s,l,h){const f=[];for(const _ of s){const y=[];for(const v of _)y.push(ds(v,l));f.push(y)}const m=new io(f[0][0][1],"meters");if(h.type==="Point"||h.type==="MultiPoint"||h.type==="LineString")return xc(h.type==="Point"?[h.coordinates]:h.coordinates,h.type==="LineString",f,m);if(h.type==="MultiLineString"){let _=1/0;for(let y=0;y<h.coordinates.length;y++){const v=xc(h.coordinates[y],!0,f,m,_);if(isNaN(v))return v;if((_=Math.min(_,v))===0)return _}return _}if(h.type==="Polygon"||h.type==="MultiPolygon"){let _=1/0;for(let y=0;y<f.length;y++){const v=el(f[y],!0,h.type==="Polygon"?[h.coordinates]:h.coordinates,m,_);if(isNaN(v))return v;if((_=Math.min(_,v))===0)return _}return _}return null}(i,n,this.geometries);if(e.geometryType()==="Polygon")return function(s,l,h){const f=[];for(const _ of function(y,v){const w=y.length;if(w<=1)return[y];const E=[];let A,I;for(let z=0;z<w;z++){const L=Hd(y[z]);L!==0&&(y[z].area=Math.abs(L),I===void 0&&(I=L<0),I===L<0?(A&&E.push(A),A=[y[z]]):A.push(y[z]))}return A&&E.push(A),E}(s)){const y=[];for(let v=0;v<_.length;++v)y.push(Yd(_[v],l));f.push(y)}const m=new io(f[0][0][0][1],"meters");if(h.type==="Point"||h.type==="MultiPoint"||h.type==="LineString")return el(h.type==="Point"?[h.coordinates]:h.coordinates,h.type==="LineString",f,m);if(h.type==="MultiLineString"){let _=1/0;for(let y=0;y<h.coordinates.length;y++){const v=el(h.coordinates[y],!0,f,m,_);if(isNaN(v))return v;if((_=Math.min(_,v))===0)return _}return _}return h.type==="Polygon"||h.type==="MultiPolygon"?function(_,y,v){let w=1/0;for(const E of _)for(const A of y){const I=ef(E,A,v,w);if(isNaN(I))return I;if((w=Math.min(w,I))===0)return w}return w}(h.type==="Polygon"?[h.coordinates]:h.coordinates,f,m):null}(i,n,this.geometries);console.warn("Distance Expression: currently only evaluates valid Point/LineString/Polygon geometries.")}else console.warn("Distance Expression: requirs valid feature and canonical information.");return null}eachChild(){}outputDefined(){return!0}serialize(){return["distance",this.geojson]}}var tl=ko;function Qs(t,e){switch(t){case"string":return $r(e);case"number":return+e;case"boolean":return!!e;case"color":return ji.parse(e);case"formatted":return lr.fromString($r(e));case"resolvedImage":return ft.fromString($r(e))}return e}function bc(t,e,i,n){return n!==void 0&&(t=n*Math.round(t/n)),e!==void 0&&t<e&&(t=e),i!==void 0&&t>i&&(t=i),t}class ea{constructor(e,i,n){this.type=e,this.key=i,this.scope=n}static parse(e,i){let n=i.expectedType;if(n==null&&(n=Ht),e.length<2||e.length>3)return i.error("Invalid number of arguments for 'config' expression.");const s=i.parse(e[1],1);if(!(s instanceof In))return i.error("Key name of 'config' expression must be a string literal.");if(e.length>=3){const l=i.parse(e[2],2);return l instanceof In?new ea(n,$r(s.value),$r(l.value)):i.error("Scope of 'config' expression must be a string literal.")}return new ea(n,$r(s.value))}
vendor: 5,201 bytes, line 1
1evaluate(e){const i=[this.key,this.scope,e.scope].filter(Boolean).join("�"),n=e.getConfig(i);if(!n)return null;const{type:s,value:l,values:h,minValue:f,maxValue:m,stepValue:_}=n,y=n.default.evaluate(e);let v=y;if(l){const w=e.scope;e.scope=(w||"").split("�").slice(1).join("�"),v=l.evaluate(e),e.scope=w}return s&&(v=Qs(s,v)),v===void 0||f===void 0&&m===void 0&&_===void 0||(typeof v=="number"?v=bc(v,f,m,_):Array.isArray(v)&&(v=v.map(w=>typeof w=="number"?bc(w,f,m,_):w))),l!==void 0&&v!==void 0&&h&&!h.includes(v)&&(v=y,s&&(v=Qs(s,v))),(s&&s!==this.type||v!==void 0&&$i(v)!==this.type)&&(v=Qs(this.type.kind,v)),v}eachChild(){}outputDefined(){return!1}serialize(){const e=["config",this.key];return this.scope&&e.concat(this.key),e}}var fs=ea;function ps(t){if(t instanceof Gt&&(t.name==="get"&&t.args.length===1||t.name==="feature-state"||t.name==="has"&&t.args.length===1||t.name==="properties"||t.name==="geometry-type"||t.name==="id"||/^filter-/.test(t.name))||t instanceof Ya||t instanceof tl)return!1;let e=!0;return t.eachChild(i=>{e&&!ps(i)&&(e=!1)}),e}function ta(t){if(t instanceof Gt&&t.name==="feature-state")return!1;let e=!0;return t.eachChild(i=>{e&&!ta(i)&&(e=!1)}),e}function ia(t){if(t instanceof fs)return!1;let e=!0;return t.eachChild(i=>{e&&!ia(i)&&(e=!1)}),e}function cr(t,e){if(t instanceof Gt&&e.indexOf(t.name)>=0)return!1;let i=!0;return t.eachChild(n=>{i&&!cr(n,e)&&(i=!1)}),i}class no{constructor(e,i){this.type=i.type,this.name=e,this.boundExpression=i}static parse(e,i){if(e.length!==2||typeof e[1]!="string")return i.error("'var' expression requires exactly one string literal argument.");const n=e[1];return i.scope.has(n)?new no(n,i.scope.get(n)):i.error(`Unknown variable "${n}". Make sure "${n}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}serialize(){return["var",this.name]}}var br=no;class wc{constructor(e,i=[],n,s=new $d,l=[],h,f){this.registry=e,this.path=i,this.key=i.map(m=>`[${m}]`).join(""),this.scope=s,this.errors=l,this.expectedType=n,this._scope=h,this.options=f}parse(e,i,n,s,l={}){return i||n?this.concat(i,n,s)._parse(e,l):this._parse(e,l)}_parse(e,i){function n(s,l,h){return h==="assert"?new Cn(l,[s]):h==="coerce"?new Pn(l,[s]):s}if(e!==null&&typeof e!="string"&&typeof e!="boolean"&&typeof e!="number"||(e=["literal",e]),Array.isArray(e)){if(e.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const s=typeof e[0]=="string"?this.registry[e[0]]:void 0;if(s){let l=s.parse(e,this);if(!l)return null;if(this.expectedType){const h=this.expectedType,f=l.type;if(h.kind!=="string"&&h.kind!=="number"&&h.kind!=="boolean"&&h.kind!=="object"&&h.kind!=="array"||f.kind!=="value")if(h.kind!=="color"&&h.kind!=="formatted"&&h.kind!=="resolvedImage"||f.kind!=="value"&&f.kind!=="string"){if(this.checkSubtype(h,f))return null}else l=n(l,h,i.typeAnnotation||"coerce");else l=n(l,h,i.typeAnnotation||"assert")}if(!(l instanceof In)&&l.type.kind!=="resolvedImage"&&Tc(l)){const h=new eh(this._scope,this.options);try{l=new In(l.type,l.evaluate(h))}catch(f){return this.error(f.message),null}}return l}return Pn.parse(["to-array",e],this)}return this.error(e===void 0?"'undefined' value invalid. Use null instead.":typeof e=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof e} instead.`)}concat(e,i,n){const s=typeof e=="number"?this.path.concat(e):this.path,l=n?this.scope.concat(n):this.scope;return new wc(this.registry,s,i||null,l,this.errors,this._scope,this.options)}error(e,...i){const n=`${this.key}${i.map(s=>`[${s}]`).join("")}`;this.errors.push(new xn(n,e))}checkSubtype(e,i){const n=Co(e,i);return n&&this.error(n),n}}var ah=wc;function Tc(t){if(t instanceof br)return Tc(t.boundExpression);if(t instanceof Gt&&t.name==="error"||t instanceof Hs||t instanceof Ya||t instanceof tl||t instanceof fs)return!1;const e=t instanceof Pn||t instanceof Cn;let i=!0;return t.eachChild(n=>{i=e?i&&Tc(n):i&&n instanceof In}),!!i&&ps(t)&&cr(t,["zoom","heatmap-density","line-progress","raster-value","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center","measure-light","raster-particle-speed"])}function Oo(t,e){const i=t.length-1;let n,s,l=0,h=i,f=0;for(;l<=h;)if(f=Math.floor((l+h)/2),n=t[f],s=t[f+1],n<=e){if(f===i||e<s)return f;l=f+1}else{if(!(n>e))throw new Wi("Input is not a number.");h=f-1}return 0}class il{constructor(e,i,n){this.type=e,this.input=i,this.labels=[],this.outputs=[];for(const[s,l]of n)this.labels.push(s),this.outputs.push(l)}static parse(e,i){if(e.length-1<4)return i.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return i.error("Expected an even number of arguments.");const n=i.parse(e[1],1,Xe);if(!n)return null;const s=[];let l=null;i.expectedType&&i.expectedType.kind!=="value"&&(l=i.expectedType);for(let h=1;h<e.length;h+=2){const f=h===1?-1/0:e[h],m=e[h+1],_=h,y=h+1;if(typeof f!="number")return i.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not c
1omputed expressions) for the input values.',_);if(s.length&&s[s.length-1][0]>=f)return i.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',_);const v=i.parse(m,y,l);if(!v)return null;l=l||v.type,s.push([f,v])}return new il(l,n,s)}evaluate(e){const i=this.labels,n=this.outputs;if(i.length===1)return n[0].evaluate(e);const s=this.input.evaluate(e);if(s<=i[0])return n[0].evaluate(e);const l=i.length;return s>=i[l-1]?n[l-1].evaluate(e):n[Oo(i,s)].evaluate(e)}eachChild(e){e(this.input);for(const i of this.outputs)e(i)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}serialize(){const e=["step",this.input.serialize()];for(let i=0;i<this.labels.length;i++)i>0&&e.push(this.labels[i]),e.push(this.outputs[i].serialize());return e}}var ra=il;const lh=.95047,oo=1.08883,ch=4/29,ms=6/29,Mc=3*ms*ms,uh=ms*ms*ms,tf=Math.PI/180,sn=180/Math.PI;function rl(t){return t>uh?Math.pow(t,1/3):t/Mc+ch}function nl(t){return t>ms?t*t*t:Mc*(t-ch)}function ol(t){return 255*(t<=.0031308?12.92*t:1.055*M
vendor: 4,370 bytes, line 1
1ath.pow(t,1/2.4)-.055)}function sl(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Ec(t){const e=sl(t.r),i=sl(t.g),n=sl(t.b),s=rl((.4124564*e+.3575761*i+.1804375*n)/lh),l=rl((.2126729*e+.7151522*i+.072175*n)/1);return{l:116*l-16,a:500*(s-l),b:200*(l-rl((.0193339*e+.119192*i+.9503041*n)/oo)),alpha:t.a}}function Sc(t){let e=(t.l+16)/116,i=isNaN(t.a)?e:e+t.a/500,n=isNaN(t.b)?e:e-t.b/200;return e=1*nl(e),i=lh*nl(i),n=oo*nl(n),new ji(ol(3.2404542*i-1.5371385*e-.4985314*n),ol(-.969266*i+1.8760108*e+.041556*n),ol(.0556434*i-.2040259*e+1.0572252*n),t.alpha)}function hh(t,e,i){const n=e-t;return t+i*(n>180||n<-180?n-360*Math.round(n/360):n)}const _s={forward:Ec,reverse:Sc,interpolate:function(t,e,i){return{l:Ut(t.l,e.l,i),a:Ut(t.a,e.a,i),b:Ut(t.b,e.b,i),alpha:Ut(t.alpha,e.alpha,i)}}},gs={forward:function(t){const{l:e,a:i,b:n}=Ec(t),s=Math.atan2(n,i)*sn;return{h:s<0?s+360:s,c:Math.sqrt(i*i+n*n),l:e,alpha:t.a}},reverse:function(t){const e=t.h*tf,i=t.c;return Sc({l:t.l,a:Math.cos(e)*i,b:Math.sin(e)*i,alpha:t.alpha})},interpolate:function(t,e,i){return{h:hh(t.h,e.h,i),c:Ut(t.c,e.c,i),l:Ut(t.l,e.l,i),alpha:Ut(t.alpha,e.alpha,i)}}};var Ac=Object.freeze({__proto__:null,hcl:gs,lab:_s});class na{constructor(e,i,n,s,l){this.type=e,this.operator=i,this.interpolation=n,this.input=s,this.labels=[],this.outputs=[];for(const[h,f]of l)this.labels.push(h),this.outputs.push(f)}static interpolationFactor(e,i,n,s){let l=0;if(e.name==="exponential")l=ys(i,e.base,n,s);else if(e.name==="linear")l=ys(i,1,n,s);else if(e.name==="cubic-bezier"){const h=e.controlPoints;l=new $n(h[0],h[1],h[2],h[3]).solve(ys(i,1,n,s))}return l}static parse(e,i){let[n,s,l,...h]=e;if(!Array.isArray(s)||s.length===0)return i.error("Expected an interpolation type expression.",1);if(s[0]==="linear")s={name:"linear"};else if(s[0]==="exponential"){const _=s[1];if(typeof _!="number")return i.error("Exponential interpolation requires a numeric base.",1,1);s={name:"exponential",base:_}}else{if(s[0]!=="cubic-bezier")return i.error(`Unknown interpolation type ${String(s[0])}`,1,0);{const _=s.slice(1);if(_.length!==4||_.some(y=>typeof y!="number"||y<0||y>1))return i.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);s={name:"cubic-bezier",controlPoints:_}}}if(e.length-1<4)return i.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return i.error("Expected an even number of arguments.");if(l=i.parse(l,2,Xe),!l)return null;const f=[];let m=null;n==="interpolate-hcl"||n==="interpolate-lab"?m=qr:i.expectedType&&i.expectedType.kind!=="value"&&(m=i.expectedType);for(let _=0;_<h.length;_+=2){const y=h[_],v=h[_+1],w=_+3,E=_+4;if(typeof y!="number")return i.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',w);if(f.length&&f[f.length-1][0]>=y)return i.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',w);const A=i.parse(v,E,m);if(!A)return null;m=m||A.type,f.push([y,A])}return m.kind==="number"||m.kind==="color"||m.kind==="array"&&m.itemType.kind==="number"&&typeof m.N=="number"?new na(m,n,s,l,f):i.error(`Type ${Ni(m)} is not interpolatable.`)}evaluate(e){const i=this.labels,n=this.outputs;if(i.length===1)return n[0].evaluate(e);const s=this.input.evaluate(e);if(s<=i[0])return n[0].evaluate(e);const l=i.length;if(s>=i[l-1])return n[l-1].evaluate(e);const h=Oo(i,s),f=na.interpolationFactor(this.interpolation,s,i[h],i[h+1]),m=n[h].evaluate(e),_=n[h+1].evaluate(e);return this.operator==="interpolate"?$a[this.type.kind.toLowerCase()](m,_,f):this.operator==="interpolate-hcl"?gs.reverse(gs.interpolate(gs.forward(m),gs.forward(_),f)):_s.reverse(_s.interpolate(_s.forward(m),_s.forward(_),f))}eachChild(e){e(this.input);for(const i of this.outputs)e(i)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}serialize(){let e;e=this.interpolation.name==="linear"?["linear"]:this.interpolation.name==="exponential"?this.interpolation.base===1?["linear"]:["exponential",this.interpolation.base]:["cubic-bezier"].concat(this.interpolation.controlPoints);const i=[this.operator,e,this.input.serialize()];for(let n=0;n<this.labels.length;n++)i.push(this.labels[n],this.outputs[n].serialize());return i}}
vendor: 5,333 bytes, line 1
1function ys(t,e,i,n){const s=n-i,l=t-i;return s===0?0:e===1?l/s:(Math.pow(e,l)-1)/(Math.pow(e,s)-1)}var Fr=na;class xs{constructor(e,i){this.type=e,this.args=i}static parse(e,i){if(e.length<2)return i.error("Expectected at least one argument.");let n=null;const s=i.expectedType;s&&s.kind!=="value"&&(n=s);const l=[];for(const f of e.slice(1)){const m=i.parse(f,1+l.length,n,void 0,{typeAnnotation:"omit"});if(!m)return null;n=n||m.type,l.push(m)}const h=s&&l.some(f=>Co(s,f.type));return new xs(h?Ht:n,l)}evaluate(e){let i,n=null,s=0;for(const l of this.args){if(s++,n=l.evaluate(e),n&&n instanceof ft&&!n.available&&(i||(i=n),n=null,s===this.args.length))return i;if(n!==null)break}return n}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}serialize(){const e=["coalesce"];return this.eachChild(i=>{e.push(i.serialize())}),e}}var Ic=xs;class al{constructor(e,i){this.type=i.type,this.bindings=[].concat(e),this.result=i}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const i of this.bindings)e(i[1]);e(this.result)}static parse(e,i){if(e.length<4)return i.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);const n=[];for(let l=1;l<e.length-1;l+=2){const h=e[l];if(typeof h!="string")return i.error(`Expected string, but found ${typeof h} instead.`,l);if(/[^a-zA-Z0-9_]/.test(h))return i.error("Variable names must contain only alphanumeric characters or '_'.",l);const f=i.parse(e[l+1],l+1);if(!f)return null;n.push([h,f])}const s=i.parse(e[e.length-1],e.length-1,i.expectedType,n);return s?new al(n,s):null}outputDefined(){return this.result.outputDefined()}serialize(){const e=["let"];for(const[i,n]of this.bindings)e.push(i,n.serialize());return e.push(this.result.serialize()),e}}var Cc=al;class so{constructor(e,i,n){this.type=e,this.index=i,this.input=n}static parse(e,i){if(e.length!==3)return i.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const n=i.parse(e[1],1,Xe),s=i.parse(e[2],2,Ar(i.expectedType||Ht));return n&&s?new so(s.type.itemType,n,s):null}evaluate(e){const i=this.index.evaluate(e),n=this.input.evaluate(e);if(i<0)throw new Wi(`Array index out of bounds: ${i} < 0.`);if(i>=n.length)throw new Wi(`Array index out of bounds: ${i} > ${n.length-1}.`);if(i!==Math.floor(i))throw new Wi(`Array index must be an integer, but found ${i} instead.`);return n[i]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}var Xt=so;class Pc{constructor(e,i){this.type=oi,this.needle=e,this.haystack=i}static parse(e,i){if(e.length!==3)return i.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const n=i.parse(e[1],1,Ht),s=i.parse(e[2],2,Ht);return n&&s?yt(n.type,[oi,ni,Xe,ns,Ht])?new Pc(n,s):i.error(`Expected first argument to be of type boolean, string, number or null, but found ${Ni(n.type)} instead`):null}evaluate(e){const i=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(n==null)return!1;if(!Kn(i,["boolean","string","number","null"]))throw new Wi(`Expected first argument to be of type boolean, string, number or null, but found ${Ni($i(i))} instead.`);if(!Kn(n,["string","array"]))throw new Wi(`Expected second argument to be of type array or string, but found ${Ni($i(n))} instead.`);return n.indexOf(i)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize()]}}var rf=Pc;class ll{constructor(e,i,n){this.type=Xe,this.needle=e,this.haystack=i,this.fromIndex=n}static parse(e,i){if(e.length<=2||e.length>=5)return i.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const n=i.parse(e[1],1,Ht),s=i.parse(e[2],2,Ht);if(!n||!s)return null;if(!yt(n.type,[oi,ni,Xe,ns,Ht]))return i.error(`Expected first argument to be of type boolean, string, number or null, but found ${Ni(n.type)} instead`);if(e.length===4){const l=i.parse(e[3],3,Xe);return l?new ll(n,s,l):null}return new ll(n,s)}evaluate(e){const i=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(!Kn(i,["boolean","string","number","null"]))throw new Wi(`Expected first argument to be of type boolean, string, number or null, but found ${Ni($i(i))} instead.`);if(!Kn(n,["string","array"]))throw new Wi(`Expected second argument to be of type array or string, but found ${Ni($i(n))} instead.`);if(this.fromIndex){const s=this.fromIndex.evaluate(e);return n.indexOf(i,s)}return n.indexOf(i)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}serialize(){if(this.fromIndex!=null&&this.fromIndex!==void 0){const e=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),e]}return["index-of",this.needle.serialize(),this.haystack.serialize()]}}var dh=ll;class zc{constructor(e,i,n,s,l,h){this.inputType=e,this.type=i,this.input=n,this.cases=s,this.outputs=l,this.otherwise=h}static parse(e,i){if(e.length<5)return i.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return i.error("Expected an even number of arguments.");let n,s;i.expectedType&&i.expectedType.kind!=="value"&&(s=i.expectedType);const l={},h=[];for(let _=2;_<e.length-1;_+=2){let y=e[_];const v=e[_+1];Array.isArray(y)||(y=[y]);const w=i.concat(_);
vendor: 20,267 bytes, line 1
1if(y.length===0)return w.error("Expected at least one branch label.");for(const A of y){if(typeof A!="number"&&typeof A!="string")return w.error("Branch labels must be numbers or strings.");if(typeof A=="number"&&Math.abs(A)>Number.MAX_SAFE_INTEGER)return w.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof A=="number"&&Math.floor(A)!==A)return w.error("Numeric branch labels must be integer values.");if(n){if(w.checkSubtype(n,$i(A)))return null}else n=$i(A);if(l[String(A)]!==void 0)return w.error("Branch labels must be unique.");l[String(A)]=h.length}const E=i.parse(v,_,s);if(!E)return null;s=s||E.type,h.push(E)}const f=i.parse(e[1],1,Ht);if(!f)return null;const m=i.parse(e[e.length-1],e.length-1,s);return m?f.type.kind!=="value"&&i.concat(1).checkSubtype(n,f.type)?null:new zc(n,s,f,l,h,m):null}evaluate(e){const i=this.input.evaluate(e);return($i(i)===this.inputType&&this.outputs[this.cases[i]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every(e=>e.outputDefined())&&this.otherwise.outputDefined()}serialize(){const e=["match",this.input.serialize()],i=Object.keys(this.cases).sort(),n=[],s={};for(const h of i){const f=s[this.cases[h]];f===void 0?(s[this.cases[h]]=n.length,n.push([this.cases[h],[h]])):n[f][1].push(h)}const l=h=>this.inputType.kind==="number"?Number(h):h;for(const[h,f]of n)e.push(f.length===1?l(f[0]):f.map(l)),e.push(this.outputs[h].serialize());return e.push(this.otherwise.serialize()),e}}var fh=zc;class cl{constructor(e,i,n){this.type=e,this.branches=i,this.otherwise=n}static parse(e,i){if(e.length<4)return i.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return i.error("Expected an odd number of arguments.");let n;i.expectedType&&i.expectedType.kind!=="value"&&(n=i.expectedType);const s=[];for(let h=1;h<e.length-1;h+=2){const f=i.parse(e[h],h,oi);if(!f)return null;const m=i.parse(e[h+1],h+1,n);if(!m)return null;s.push([f,m]),n=n||m.type}const l=i.parse(e[e.length-1],e.length-1,n);return l?new cl(n,s,l):null}evaluate(e){for(const[i,n]of this.branches)if(i.evaluate(e))return n.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(const[i,n]of this.branches)e(i),e(n);e(this.otherwise)}outputDefined(){return this.branches.every(([e,i])=>i.outputDefined())&&this.otherwise.outputDefined()}serialize(){const e=["case"];return this.eachChild(i=>{e.push(i.serialize())}),e}}var ph=cl;class oa{constructor(e,i,n,s){this.type=e,this.input=i,this.beginIndex=n,this.endIndex=s}static parse(e,i){if(e.length<=2||e.length>=5)return i.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const n=i.parse(e[1],1,Ht),s=i.parse(e[2],2,Xe);if(!n||!s)return null;if(!yt(n.type,[Ar(Ht),ni,Ht]))return i.error(`Expected first argument to be of type array or string, but found ${Ni(n.type)} instead`);if(e.length===4){const l=i.parse(e[3],3,Xe);return l?new oa(n.type,n,s,l):null}return new oa(n.type,n,s)}evaluate(e){const i=this.input.evaluate(e),n=this.beginIndex.evaluate(e);if(!Kn(i,["string","array"]))throw new Wi(`Expected first argument to be of type array or string, but found ${Ni($i(i))} instead.`);if(this.endIndex){const s=this.endIndex.evaluate(e);return i.slice(n,s)}return i.slice(n)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}serialize(){if(this.endIndex!=null&&this.endIndex!==void 0){const e=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),e]}return["slice",this.input.serialize(),this.beginIndex.serialize()]}}var vs=oa;function Dc(t,e){return t==="=="||t==="!="?e.kind==="boolean"||e.kind==="string"||e.kind==="number"||e.kind==="null"||e.kind==="value":e.kind==="string"||e.kind==="number"||e.kind==="value"}function Lc(t,e,i,n){return n.compare(e,i)===0}function bs(t,e,i){const n=t!=="=="&&t!=="!=";return class qy{constructor(l,h,f){this.type=oi,this.lhs=l,this.rhs=h,this.collator=f,this.hasUntypedArgument=l.type.kind==="value"||h.type.kind==="value"}static parse(l,h){if(l.length!==3&&l.length!==4)return h.error("Expected two or three arguments.");const f=l[0];let m=h.parse(l[1],1,Ht);if(!m)return null;if(!Dc(f,m.type))return h.concat(1).error(`"${f}" comparisons are not supported for type '${Ni(m.type)}'.`);let _=h.parse(l[2],2,Ht);if(!_)return null;if(!Dc(f,_.type))return h.concat(2).error(`"${f}" comparisons are not supported for type '${Ni(_.type)}'.`);if(m.type.kind!==_.type.kind&&m.type.kind!=="value"&&_.type.kind!=="value")return h.error(`Cannot compare types '${Ni(m.type)}' and '${Ni(_.type)}'.`);n&&(m.type.kind==="value"&&_.type.kind!=="value"?m=new Cn(_.type,[m]):m.type.kind!=="value"&&_.type.kind==="value"&&(_=new Cn(m.type,[_])));let y=null;if(l.length===4){if(m.type.kind!=="string"&&_.type.kind!=="string"&&m.type.kind!=="value"&&_.type.kind!=="value")return h.error("Cannot use collator to compare non-string types.");if(y=h.parse(l[3],3,Wa),!y)return null}return new qy(m,_,y)}evaluate(l){const h=this.lhs.evaluate(l),f=this.rhs.evaluate(l);if(n&&this.hasUntypedArgument){const m=$i(h),_=$i(f);if(m.kind!==_.kind||m.kind!=="string"&&m.kind!=="number")throw new Wi(`Expected arguments for "${t}" to be (string, string) or (number, number), but found (${m.kind}, ${_.kind}) instead.`)}if(this.collator&&!n&&this.hasUntypedArgument){const m=$i(h),_=$i(f);if(m.kind!=="string"||_.kind!=="string")return e(l,h,f)}return this.collator?i(l,h,f,this.collator.evaluate(l)):e(l,h,f)}eachChild(l){l(this.lhs),l(this.rhs),this.collator&&l(this.collator)}outputDefined(){return!0}serialize(){const l=[t];return this.eachChild(h=>{l.push(h.serialize())}),l}}}const Rc=bs("==",function(t,e,i){return e===i},Lc),kc=bs("!=",function(t,e,i){return e!==i},function(t,e,i,n){return!Lc(0,e,i,n)}),nf=bs("<",function(t,e,i){return e<i},function(t,e,i,n){return n.compare(e,i)<0}),of=bs(">",function(t,e,i){return e>i},function(t,e,i,n){return n.compare(e,i)>0}),mh=bs("<=",function(t,e,i){return e<=i},function(t,e,i,n){return n.compare(e,i)<=0}),sf=bs(">=",function(t,e,i){return e>=i},function(t,e,i,n){return n.compare(e,i)>=0});class Oc{constructor(e,i,n,s,l,h){this.type=ni,this.number=e,this.locale=i,this.currency=n,this.unit=s,this.minFractionDigits=l,this.maxFractionDigits=h}static parse(e,i){if(e.length!==3)return i.error("Expected two arguments.");const n=i.parse(e[1],1,Xe);if(!n)return null;const s=e[2];if(typeof s!="object"||Array.isArray(s))return i.error("NumberFormat options argument must be an object.");let l=null;if(s.locale&&(l=i.parse(s.locale,1,ni),!l))return null;let h=null;if(s.currency&&(h=i.parse(s.currency,1,ni),!h))return null;let f=null;if(s.unit&&(f=i.parse(s.unit,1,ni),!f))return null;let m=null;if(s["min-fraction-digits"]&&(m=i.parse(s["min-fraction-digits"],1,Xe),!m))return null;let _=null;return s["max-fraction-digits"]&&(_=i.parse(s["max-fraction-digits"],1,Xe),!_)?null:new Oc(n,l,h,f,m,_)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:(this.currency?"currency":this.unit&&"unit")||"decimal",currency:this.currency?this.currency.evaluate(e):void 0,unit:this.unit?this.unit.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.unit&&e(this.unit),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}serialize(){const e={};return this.locale&&(e.locale=this.locale.serialize()),this.currency&&(e.currency=this.currency.serialize()),this.unit&&(e.unit=this.unit.serialize()),this.minFractionDigits&&(e["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(e["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),e]}}class Bc{constructor(e){this.type=Xe,this.input=e}static parse(e,i){if(e.length!==2)return i.error(`Expected 1 argument, but found ${e.length-1} instead.`);const n=i.parse(e[1],1);return n?n.type.kind!=="array"&&n.type.kind!=="string"&&n.type.kind!=="value"?i.error(`Expected argument of type string or array, but found ${Ni(n.type)} instead.`):new Bc(n):null}evaluate(e){const i=this.input.evaluate(e);if(typeof i=="string"||Array.isArray(i))return i.length;throw new Wi(`Expected value to be of type string or array, but found ${Ni($i(i))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}serialize(){const e=["length"];return this.eachChild(i=>{e.push(i.serialize())}),e}}function _h(t){return function(){t=1831565813+(t|=0)|0;let e=Math.imul(t^t>>>15,1|t);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296}}const Fc={"==":Rc,"!=":kc,">":of,"<":nf,">=":sf,"<=":mh,array:Cn,at:Xt,boolean:Cn,case:ph,coalesce:Ic,collator:Hs,format:ls,image:zo,in:rf,"index-of":dh,interpolate:Fr,"interpolate-hcl":Fr,"interpolate-lab":Fr,length:Bc,let:Cc,literal:In,match:fh,number:Cn,"number-format":Oc,object:Cn,slice:vs,step:ra,string:Cn,"to-boolean":Pn,"to-color":Pn,"to-number":Pn,"to-string":Pn,var:br,within:Ya,distance:tl,config:fs};function Nc(t,[e,i,n,s]){e=e.evaluate(t),i=i.evaluate(t),n=n.evaluate(t);const l=s?s.evaluate(t):1,h=Qu(e,i,n,l);if(h)throw new Wi(h);return new ji(e/255*l,i/255*l,n/255*l,l)}function gh(t,[e,i,n,s]){e=e.evaluate(t),i=i.evaluate(t),n=n.evaluate(t);const l=s?s.evaluate(t):1,h=function(_,y,v,w){return typeof _=="number"&&_>=0&&_<=360?typeof y=="number"&&y>=0&&y<=100&&typeof v=="number"&&v>=0&&v<=100?w===void 0||typeof w=="number"&&w>=0&&w<=1?null:`Invalid hsla value [${[_,y,v,w].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid hsla value [${(typeof w=="number"?[_,y,v,w]:[_,y,v]).join(", ")}]: 's', and 'l' must be between 0 and 100.`:`Invalid hsla value [${(typeof w=="number"?[_,y,v,w]:[_,y,v]).join(", ")}]: 'h' must be between 0 and 360.`}(e,i,n,l);if(h)throw new Wi(h);const f=`hsla(${e}, ${i}%, ${n}%, ${l})`,m=ji.parse(f);if(!m)throw new Wi(`Failed to parse HSLA color: ${f}`);return m}function Vc(t,e){return t in e}function Uc(t,e){const i=e[t];return i===void 0?null:i}function Bo(t){return{type:t}}Gt.register(Fc,{error:[{kind:"error"},[ni],(t,[e])=>{throw new Wi(e.evaluate(t))}],typeof:[ni,[Ht],(t,[e])=>Ni($i(e.evaluate(t)))],"to-rgba":[Ar(Xe,4),[qr],(t,[e])=>e.evaluate(t).toArray()],rgb:[qr,[Xe,Xe,Xe],Nc],rgba:[qr,[Xe,Xe,Xe,Xe],Nc],hsl:[qr,[Xe,Xe,Xe],gh],hsla:[qr,[Xe,Xe,Xe,Xe],gh],has:{type:oi,overloads:[[[ni],(t,[e])=>Vc(e.evaluate(t),t.properties())],[[ni,os],(t,[e,i])=>Vc(e.evaluate(t),i.evaluate(t))]]},get:{type:Ht,overloads:[[[ni],(t,[e])=>Uc(e.evaluate(t),t.properties())],[[ni,os],(t,[e,i])=>Uc(e.evaluate(t),i.evaluate(t))]]},"feature-state":[Ht,[ni],(t,[e])=>Uc(e.evaluate(t),t.featureState||{})],properties:[os,[],t=>t.properties()],"geometry-type":[ni,[],t=>t.geometryType()],id:[Ht,[],t=>t.id()],zoom:[Xe,[],t=>t.globals.zoom],pitch:[Xe,[],t=>t.globals.pitch||0],"distance-from-center":[Xe,[],t=>t.distanceFromCenter()],"measure-light":[Xe,[ni],(t,[e])=>t.measureLight(e.evaluate(t))],"heatmap-density":[Xe,[],t=>t.globals.heatmapDensity||0],"line-progress":[Xe,[],t=>t.globals.lineProgress||0],"raster-value":[Xe,[],t=>t.globals.rasterValue||0],"raster-particle-speed":[Xe,[],t=>t.globals.rasterParticleSpeed||0],"sky-radial-progress":[Xe,[],t=>t.globals.skyRadialProgress||0],accumulated:[Ht,[],t=>t.globals.accumulated===void 0?null:t.globals.accumulated],"+":[Xe,Bo(Xe),(t,e)=>{let i=0;for(const n of e)i+=n.evaluate(t);return i}],"*":[Xe,Bo(Xe),(t,e)=>{let i=1;for(const n of e)i*=n.evaluate(t);return i}],"-":{type:Xe,overloads:[[[Xe,Xe],(t,[e,i])=>e.evaluate(t)-i.evaluate(t)],[[Xe],(t,[e])=>-e.evaluate(t)]]},"/":[Xe,[Xe,Xe],(t,[e,i])=>e.evaluate(t)/i.evaluate(t)],"%":[Xe,[Xe,Xe],(t,[e,i])=>e.evaluate(t)%i.evaluate(t)],ln2:[Xe,[],()=>Math.LN2],pi:[Xe,[],()=>Math.PI],e:[Xe,[],()=>Math.E],"^":[Xe,[Xe,Xe],(t,[e,i])=>Math.pow(e.evaluate(t),i.evaluate(t))],sqrt:[Xe,[Xe],(t,[e])=>Math.sqrt(e.evaluate(t))],log10:[Xe,[Xe],(t,[e])=>Math.log(e.evaluate(t))/Math.LN10],ln:[Xe,[Xe],(t,[e])=>Math.log(e.evaluate(t))],log2:[Xe,[Xe],(t,[e])=>Math.log(e.evaluate(t))/Math.LN2],sin:[Xe,[Xe],(t,[e])=>Math.sin(e.evaluate(t))],cos:[Xe,[Xe],(t,[e])=>Math.cos(e.evaluate(t))],tan:[Xe,[Xe],(t,[e])=>Math.tan(e.evaluate(t))],asin:[Xe,[Xe],(t,[e])=>Math.asin(e.evaluate(t))],acos:[Xe,[Xe],(t,[e])=>Math.acos(e.evaluate(t))],atan:[Xe,[Xe],(t,[e])=>Math.atan(e.evaluate(t))],min:[Xe,Bo(Xe),(t,e)=>Math.min(...e.map(i=>i.evaluate(t)))],max:[Xe,Bo(Xe),(t,e)=>Math.max(...e.map(i=>i.evaluate(t)))],abs:[Xe,[Xe],(t,[e])=>Math.abs(e.evaluate(t))],round:[Xe,[Xe],(t,[e])=>{const i=e.evaluate(t);return i<0?-Math.round(-i):Math.round(i)}],floor:[Xe,[Xe],(t,[e])=>Math.floor(e.evaluate(t))],ceil:[Xe,[Xe],(t,[e])=>Math.ceil(e.evaluate(t))],"filter-==":[oi,[ni,Ht],(t,[e,i])=>t.properties()[e.value]===i.value],"filter-id-==":[oi,[Ht],(t,[e])=>t.id()===e.value],"filter-type-==":[oi,[ni],(t,[e])=>t.geometryType()===e.value],"filter-<":[oi,[ni,Ht],(t,[e,i])=>{const n=t.properties()[e.value],s=i.value;return typeof n==typeof s&&n<s}],"filter-id-<":[oi,[Ht],(t,[e])=>{const i=t.id(),n=e.value;return typeof i==typeof n&&i<n}],"filter->":[oi,[ni,Ht],(t,[e,i])=>{const n=t.properties()[e.value],s=i.value;return typeof n==typeof s&&n>s}],"filter-id->":[oi,[Ht],(t,[e])=>{const i=t.id(),n=e.value;return typeof i==typeof n&&i>n}],"filter-<=":[oi,[ni,Ht],(t,[e,i])=>{const n=t.properties()[e.value],s=i.value;return typeof n==typeof s&&n<=s}],"filter-id-<=":[oi,[Ht],(t,[e])=>{const i=t.id(),n=e.value;return typeof i==typeof n&&i<=n}],"filter->=":[oi,[ni,Ht],(t,[e,i])=>{const n=t.properties()[e.value],s=i.value;return typeof n==typeof s&&n>=s}],"filter-id->=":[oi,[Ht],(t,[e])=>{const i=t.id(),n=e.value;return typeof i==typeof n&&i>=n}],"filter-has":[oi,[Ht],(t,[e])=>e.value in t.properties()],"filter-has-id":[oi,[],t=>t.id()!==null&&t.id()!==void 0],"filter-type-in":[oi,[Ar(ni)],(t,[e])=>e.value.indexOf(t.geometryType())>=0],"filter-id-in":[oi,[Ar(Ht)],(t,[e])=>e.value.indexOf(t.id())>=0],"filter-in-small":[oi,[ni,Ar(Ht)],(t,[e,i])=>i.value.indexOf(t.properties()[e.value])>=0],"filter-in-large":[oi,[ni,Ar(Ht)],(t,[e,i])=>function(n,s,l,h){for(;l<=h;){const f=l+h>>1;if(s[f]===n)return!0;s[f]>n?h=f-1:l=f+1}return!1}(t.properties()[e.value],i.value,0,i.value.length-1)],all:{type:oi,overloads:[[[oi,oi],(t,[e,i])=>e.evaluate(t)&&i.evaluate(t)],[Bo(oi),(t,e)=>{for(const i of e)if(!i.evaluate(t))return!1;return!0}]]},any:{type:oi,overloads:[[[oi,oi],(t,[e,i])=>e.evaluate(t)||i.evaluate(t)],[Bo(oi),(t,e)=>{for(const i of e)if(i.evaluate(t))return!0;return!1}]]},"!":[oi,[oi],(t,[e])=>!e.evaluate(t)],"is-supported-script":[oi,[ni],(t,[e])=>{const i=t.globals&&t.globals.isSupportedScript;return!i||i(e.evaluate(t))}],upcase:[ni,[ni],(t,[e])=>e.evaluate(t).toUpperCase()],downcase:[ni,[ni],(t,[e])=>e.evaluate(t).toLowerCase()],concat:[ni,Bo(Ht),(t,e)=>e.map(i=>$r(i.evaluate(t))).join("")],"resolved-locale":[ni,[Wa],(t,[e])=>e.evaluate(t).resolvedLocale()],random:[Xe,[Xe,Xe,Ht],(t,e)=>{const[i,n,s]=e.map(h=>h.evaluate(t));if(i>n||i===n)return i;let l;if(typeof s=="string")l=function(h){let f=0;if(h.length===0)return f;for(let m=0;m<h.length;m++)f=(f<<5)-f+h.charCodeAt(m),f|=0;return f}(s);else{if(typeof s!="number")throw new Wi(`Invalid seed input: ${s}`);l=s}return i+_h(l)()*(n-i)}]});var ws=Fc;function jc(t){return{result:"success",value:t}}function Fo(t){return{result:"error",value:t}}function yh(t,e){return!!t&&!!t.parameters&&t.parameters.indexOf(e)>-1}function ul(t){return t["property-type"]==="data-driven"}function Gc(t){return yh(t.expression,"measure-light")}function xh(t){return yh(t.expression,"zoom")}function Zc(t){return!!t.expression&&t.expression.interpolated}function hl(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function vh(t){return t}function qc(t,e){const i=e.type==="color",n=t.stops&&typeof t.stops[0][0]=="object",s=n||!(n||t.property!==void 0),l=t.type||(Zc(e)?"exponential":"interval");if(i&&((t=Ql({},t)).stops&&(t.stops=t.stops.map(_=>[_[0],ji.parse(_[1])])),t.default=ji.parse(t.default?t.default:e.default)),t.colorSpace&&t.colorSpace!=="rgb"&&!Ac[t.colorSpace])throw new Error(`Unknown color space: ${t.colorSpace}`);let h,f,m;if(l==="exponential")h=bh;else if(l==="interval")h=lf;else if(l==="categorical"){h=af,f=Object.create(null);for(const _ of t.stops)f[_[0]]=_[1];m=typeof t.stops[0][0]}else{if(l!=="identity")throw new Error(`Unknown function type "${l}"`);h=wh}if(n){const _={},y=[];for(let E=0;E<t.stops.length;E++){const A=t.stops[E],I=A[0].zoom;_[I]===void 0&&(_[I]={zoom:I,type:t.type,property:t.property,default:t.default,stops:[]},y.push(I)),_[I].stops.push([A[0].value,A[1]])}const v=[];for(const E of y)v.push([_[E].zoom,qc(_[E],e)]);const w={name:"linear"};return{kind:"composite",interpolationType:w,interpolationFactor:Fr.interpolationFactor.bind(void 0,w),zoomStops:v.map(E=>E[0]),evaluate:({zoom:E},A)=>bh({stops:v,base:t.base},e,E).evaluate(E,A)}}if(s){const _=l==="exponential"?{name:"exponential",base:t.base!==void 0?t.base:1}:null;return{kind:"camera",interpolationType:_,interpolationFactor:Fr.interpolationFactor.bind(void 0,_),zoomStops:t.stops.map(y=>y[0]),evaluate:({zoom:y})=>h(t,e,y,f,m)}}return{kind:"source",evaluate(_,y){const v=y&&y.properties?y.properties[t.property]:void 0;return v===void 0?sa(t.default,e.default):h(t,e,v,f,m)}}}function sa(t,e,i){return t!==void 0?t:e!==void 0?e:i!==void 0?i:void 0}function af(t,e,i,n,s){return sa(typeof i===s?n[i]:void 0,t.default,e.default)}function lf(t,e,i){if(cs(i)!=="number")return sa(t.default,e.default);const n=t.stops.length;if(n===1||i<=t.stops[0][0])return t.stops[0][1];if(i>=t.stops[n-1][0])return t.stops[n-1][1];const s=Oo(t.stops.map(l=>l[0]),i);return t.stops[s][1]}function bh(t,e,i){const n=t.base!==void 0?t.base:1;if(cs(i)!=="number")return sa(t.default,e.default);const s=t.stops.length;if(s===1||i<=t.stops[0][0])return t.stops[0][1];if(i>=t.stops[s-1][0])return t.stops[s-1][1];const l=Oo(t.stops.map(y=>y[0]),i),h=function(y,v,w,E){const A=E-w,I=y-w;return A===0?0:v===1?I/A:(Math.pow(v,I)-1)/(Math.pow(v,A)-1)}(i,n,t.stops[l][0],t.stops[l+1][0]),f=t.stops[l][1],m=t.stops[l+1][1];let _=$a[e.type]||vh;if(t.colorSpace&&t.colorSpace!=="rgb"){const y=Ac[t.colorSpace];_=(v,w)=>y.reverse(y.interpolate(y.forward(v),y.forward(w),h))}return typeof f.evaluate=="function"?{evaluate(...y){const v=f.evaluate.apply(void 0,y),w=m.evaluate.apply(void 0,y);if(v!==void 0&&w!==void 0)return _(v,w,h)}}:_(f,m,h)}function wh(t,e,i){return e.type==="color"?i=ji.parse(i):e.type==="formatted"?i=lr.fromString(i.toString()):e.type==="resolvedImage"?i=ft.fromString(i.toString()):cs(i)===e.type||e.type==="enum"&&e.values[i]||(i=void 0),sa(i,t.default,e.default)}class dl{constructor(e,i,n,s){this.expression=e,this._warningHistory={},this._evaluator=new eh(n,s),this._defaultValue=i?function(l){return l.type==="color"&&(hl(l.default)||Array.isArray(l.default))?new ji(0,0,0,0):l.type==="color"?ji.parse(l.default)||null:l.default===void 0?null:l.default}(i):null,this._enumValues=i&&i.type==="enum"?i.values:null}evaluateWithoutErrorHandling(e,i,n,s,l,h,f,m){return this._evaluator.globals=e,this._evaluator.feature=i,this._evaluator.featureState=n,this._evaluator.canonical=s||null,this._evaluator.availableImages=l||null,this._evaluator.formattedSection=h,this._evaluator.featureTileCoord=f||null,this._evaluator.featureDistanceData=m||null,this.expression.evaluate(this._evaluator)}evaluate(e,i,n,s,l,h,f,m){this._evaluator.globals=e,this._evaluator.feature=i||null,this._evaluator.featureState=n||null,this._evaluator.canonical=s||null,this._evaluator.availableImages=l||null,this._evaluator.formattedSection=h||null,this._evaluator.featureTileCoord=f||null,this._evaluator.featureDistanceData=m||null;try{const _=this.expression.evaluate(this._evaluator);if(_==null||typeof _=="number"&&_!=_)return this._defaultValue;if(this._enumValues&&!(_ in this._enumValues))throw new Wi(`Expected value to be one of ${Object.keys(this._enumValues).map(y=>
1JSON.stringify(y)).join(", ")}, but found ${JSON.stringify(_)} instead.`);return _}catch(_){return this._warningHistory[_.message]||(this._warningHistory[_.message]=!0,typeof console<"u"&&console.warn(_.message)),this._defaultValue}}}function aa(t){return Array.isArray(t)&&t.length>0&&typeof t[0]=="string"&&t[0]in ws}function fl(t,e,i,n){const s=new ah(ws,[],e?function(h){const f={color:qr,string:ni,number:Xe,enum:ni,boolean:oi,formatted:ss,resolvedImage:$s};return h.type==="array"?Ar(f[h.value]||Ht,h.length):f[h.type]}(e):void 0,void 0,void 0,i,n),l=s.parse(t,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return l?jc(new dl(l,e,i,n)):Fo(s.errors)}class $c{constructor(e,i,n){this.kind=e,this._styleExpression=i,this.isLightConstant=n,this.isStateDependent=e!=="constant"&&!ta(i.expression),this.isConfigDependent=!ia(i.expression)}evaluateWithoutErrorHandling(e,i,n,s,l,h){return this._styleExpression.evaluateWithoutErrorHandling(e,i,n,s,l,h)}evaluate(e,i,n,s,l,h){return this._styleExpression.evaluate(e,i,n,s,l,h)}}class la{constructor(e,i,n,s,l){this.kind=e,this.zoomStops=n,this._styleExpression=i,this.isStateDependent=e!=="camera"&&!ta(i.expression),this.isLightConstant=l,this.isConfigDependent=!ia(i.expression),this.interpolationType=s}evaluateWithoutErrorHandling(e,i,n,s,l,h){return this._styleExpression.evaluateWithoutErrorHandling(e,i,n,s,l,h)}evaluate(e,i,n,s,l,h){return this._styleExpression.evaluate(e,i,n,s,l,h)}interpolationFactor(e,i,n){return this.interpolationType?Fr.interpolationFactor(this.interpolationType,e,i,n):0}}function pl(t,e,i,n){if((t=fl(t,e,i,n)).result==="error")return t;const s=t.value.expression,l=ps(s);if(!l&&!ul(e))return Fo([new xn("","data expressions not supported")]);const h=cr(s,["zoom","pitch","distance-from-center"]);if(!h&&!xh(e))return Fo([new xn("","zoom expressions not supported")]);const f=cr(s,["measure-light"]);if(!f&&!Gc(e))return Fo([new xn("","measure-light expression not supported")]);const m=e.expression&&e.expression.relaxZoomRestriction,_=ua(s);return _||h||m?_ instanceof xn?Fo([_]):_ instanceof Fr&&!Zc(e)?Fo([new xn("",'"interpolate" expressions cannot be used with this property')]):jc(_?new la(l?"camera":"composite",t.value,_.labels,_ instanceof Fr?_.interpolation:void 0,f):new $c(l?"constant":"source",t.value,f)):Fo([new xn("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression, or in the properties of atmosphere.')])}class ca{constructor(e,i){this._parameters=e,this._specification=i,Ql(this,qc(this._parameters,this._specification))}static deserialize(e){return new ca(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function ua(t){let e=null;if(t instanceof Cc)e=ua(t.result);else if(t instanceof Ic){for(const i of t.args)if(e=ua(i),e)break}else(t instanceof ra||t instanceof Fr)&&t.input instanceof Gt&&t.input.name==="zoom"&&(e=t);return e instanceof xn||t.eachChild(i=>{const n=ua(i);n instanceof xn?e=n:e&&n&&e!==n&&(e=new xn("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}var cf=ln,an=3;function ln(t,e,i){var n=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;var s=new Int32Array(this.arrayBuffer);t=s[0],this.d=(e=s[1])+2*(i=s[2]);for(var l=0;l<this.d*this.d;l++){var h=s[an+l],f=s[an+l+1];n.push(h===f?null:s.subarray(h,f))}var m=s[an+n.length+1];this.keys=s.subarray(s[an+n.length],m),this.bboxes=s.subarray(m),this.insert=this._insertReadonly}else{this.d=e+2*i;for(var _=0;_<this.d*this.d;_++)n.push([]);this.keys=[],this.bboxes=[]}this.n=e,this.extent=t,this.padding=i,this.scale=e/t,this.uid=0;var y=i/e*t;this.min=-y,this.max=t+y}ln.prototype.insert=function(t,e,i,n,s){this._forEachCell(e,i,n,s,this._insertCell,this.uid++),this.keys.push(t),this.bboxes.push(e),this.bboxes.push(i),this.bboxes.push(n),this.bboxes.push(s)},ln.prototype._insertReadonly=function(){throw"Cannot insert into a GridIndex created from an ArrayBuffer."},ln.prototype._insertCell=function(t,e,i,n,s,l){this.cells[s].push(l)}
1,ln.prototype.query=function(t,e,i,n,s){var l=this.min,h=this.max;if(t<=l&&e<=l&&h<=i&&h<=n&&!s)return Array.prototype.slice.call(this.keys);var f=[];return this._forEachCell(t,e,i,n,this._queryCell,f,{},s),f},ln.prototype._queryCell=function(t,e,i,n,s,l,h,f){var m=this.cells[s];if(m!==null)for(var _=this.keys,y=this.bboxes,v=0;v<m.length;v++){var w=m[v];if(h[w]===void 0){var E=4*w;(f?f(y[E+0],y[E+1],y[E+2],y[E+3]):t<=y[E+2]&&e<=y[E+3]&&i>=y[E+0]&&n>=y[E+1])?(h[w]=!0,l.push(_[w])):h[w]=!1}}},ln.prototype._forEachCell=function(t,e,i,n,s,l,h,f){for(var m=this._convertToCellCoord(t),_=this._convertToCellCoord(e),y=this._convertToCellCoord(i),v=this._convertToCellCoord(n),w=m;w<=y;w++)for(var E=_;E<=v;E++){var A=this.d*E+w;if((!f||f(this._convertFromCellCoord(w),this._convertFromCellCoord(E),this._convertFromCellCoord(w+1),this._convertFromCellCoord(E+1)))&&s.call(this,t,e,i,n,A,l,h,f))return}},ln.prototype._convertFromCellCoord=function(t){return(t-this.padding)/this.scale},ln.prototype._convertToCellCoord=function(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))},ln.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var t=this.cells,e=an+this.cells.length+1+1,i=0,n=0;n<this.cells.length;n++)i+=this.cells[n].length;var s=new Int32Array(e+i+this.keys.length+this.bboxes.length);s[0]=this.extent,s[1]=this.n,s[2]=this.padding;for(var l=e,h=0;h<t.length;h++){var f=t[h];s[an+h]=l,s.set(f,l),l+=f.length}return s[an+t.length]=l,s.set(this.keys,l),s[an+t.length+1]=l+=this.keys.length,s.set(this.bboxes,l),l+=this.bboxes.length,s.buffer};var Dn=kr(cf);const ha={};function Ke(t,e,i={}){Object.defineProperty(t,"_classRegistryKey",{value:e,writeable:!1}),ha[e]={klass:t,omit:i.omit||[]}}Ke(Object,"Object"),Dn.serialize=function(t,e){const i=t.toArrayBuffer();return e&&e.add(i),{buffer:i}},Dn.deserialize=function(t){return new Dn(t.buffer)},Object.defineProperty(Dn,"name",{value:"Grid"}),Ke(Dn,"Grid"),Ke(ji,"Color"),Ke(Error,"Error"),Ke(lr,"Formatted"),Ke(as,"FormattedSection"),Ke(Zi,"AJAXError"),Ke(ft,"ResolvedImage"),Ke(ca,"StylePropertyFunction"),Ke(dl,"StyleExpression",{omit:["_evaluator"]}),Ke(la,"ZoomDependentExpression"),Ke($c,"ZoomConstantExpression"),Ke(Gt,"CompoundExpression",{omit:["_evaluate"]});for(const t in ws)ha[ws[t]._classRegistryKey]||Ke(ws[t],`Expression${t}`);function Th(t){return t&&typeof ArrayBuffer<"u"&&(t instanceof ArrayBuffer||t.constructor&&t.constructor.name==="ArrayBuffer")}function ml(t){return self.ImageBitmap&&t instanceof ImageBitmap}function ao(t,e){if(t==null||typeof t=="boolean"||typeof t=="number"||typeof t=="string"||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp)return t;if(Th(t)||ml(t))return e&&e.add(t),t;if(ArrayBuffer.isView(t)){const i=t;return e&&e.add(i.buffer),i}if(t instanceof ImageData)return e&&e.add(t.data.buffer),t;if(Array.isArray(t)){const i=[];for(const n of t)i.push(ao(n,e));return i}if(t instanceof Map){const i={$name:"Map"};for(const[n,s]of t.entries())i[n]=ao(s);return i}if(typeof t=="object"){const i=t.constructor,n=i._classRegistryKey;if(!n)throw new Error(`can't serialize object of unregistered class ${n}`);const s=i.serialize?i.serialize(t,e):{};if(!i.serialize){for(const l in t)t.hasOwnProperty(l)&&(ha[n].omit.indexOf(l)>=0||(s[l]=ao(t[l],e)));t instanceof Error&&(s.message=t.message)}if(s.$name)throw new Error("$name property is reserved for worker serialization logic.");return n!=="Object"&&(s.$name=n),s}throw new Error("can't serialize object of type "+typeof t)}function No(t){if(t==null||typeof t=="boolean"||typeof t=="number"||typeof t=="string"||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp||Th(t)||ml(t)||ArrayBuffer.isView(t)||t instanceof ImageData)return t;if(Array.isArray(t))return t.map(No);if(typeof t=="object"){const e=t.$name||"Object";if(e==="Map"){const s=new Map;for(const l of Object.keys(t))l!=="$name"&&s.set(l,No(t[l]));return s}const{klass:i}=ha[e];if(!i)throw new Error(`can't deserialize unregistered class ${e}`);if(i.deserialize)return i.deserialize(t);const n=Object.create(i.prototype);for(const s of Object.keys(t))s!=="$name"&&(n[s]=No(t[s]));return n}throw new Error("can't deserialize object of type "+typeof t)}const it={"Latin-1 Supplement":t=>t>=128&&t<=255,Arabic:t=>t>=1536&&t<=1791,"Arabic Supplement":t=>t>=1872&&t<=1919,"Arabic Extended-A":t=>t>=2208&&t<=2303,"Hangul Jamo":t=>t>=4352&&t<=4607,"Unified Canadian Aboriginal Syllabics":t=>t>=5120&&t<=5759,Khmer:t=>t>=6016&&t<=6143,"Unified Canadian Aboriginal Syllabics Extended":t=>t>=6320&&t<=6399,"General Punctuation":t=>t>=8192&&t<=8303,"Letterlike Symbols":t=>t>=8448&&t<=8527,"Number Forms":t=>t>=8528&&t<=8591,"Miscellaneous Technical":t=>t>=8960&&t<=9215,"Control Pictures":t=>t>=9216&&t<=9279,"Optical Character Recognition":t=>t>=9280&&t<=9311,"Enclosed Alphanumerics":t=>t>=9312&&t<=9471,"Geometric Shapes":t=>t>=9632&&t<=9727,"Miscellaneous Symbols":t=>t>=9728&&t<=9983,"Miscellaneous Symbols and Arrows":t=>t>=11008&&t<=11263,"CJK Radicals Supplement":t=>t>=11904&&t<=12031,"Kangxi Radicals":t=>t>=12032&&t<=12255,"Ideographic Description Characters":t=>t>=12272&&t<=12287,"CJK Symbols and Punctuation":t=>t>=12288&&t<=12351,Hiragana:t=>t>=12352&&t<=12447,Katakana:t=>t>=12448&&t<=12543,Bopomofo:t=>t>=12544&&t<=12591,"Hangul Compatibility Jamo":t=>t>=12592&&t<=12687,Kanbun:t=>t>=12688&&t<=12703,"Bopomofo Extended":t=>t>=12704&&t<=12735,"CJK Strokes":t=>t>
1=12736&&t<=12783,"Katakana Phonetic Extensions":t=>t>=12784&&t<=12799,"Enclosed CJK Letters and Months":t=>t>=12800&&t<=13055,"CJK Compatibility":t=>t>=13056&&t<=13311,"CJK Unified Ideographs Extension A":t=>t>=13312&&t<=19903,"Yijing Hexagram Symbols":t=>t>=19904&&t<=19967,"CJK Unified Ideographs":t=>t>=19968&&t<=40959,"Yi Syllables":t=>t>=40960&&t<=42127,"Yi Radicals":t=>t>=42128&&t<=42191,"Hangul Jamo Extended-A":t=>t>=43360&&t<=43391,"Hangul Syllables":t=>t>=44032&&t<=55215,"Hangul Jamo Extended-B":t=>t>=55216&&t<=55295,"Private Use Area":t=>t>=57344&&t<=63743,"CJK Compatibility Ideographs":t=>t>=63744&&t<=64255,"Arabic Presentation Forms-A":t=>t>=64336&&t<=65023,"Vertical Forms":t=>t>=65040&&t<=65055,"CJK Compatibility Forms":t=>t>=65072&&t<=65103,"Small Form Variants":t=>t>=65104&&t<=65135,"Arabic Presentation Forms-B":t=>t>=65136&&t<=65279,"Halfwidth and Fullwidth Forms":t=>t>=65280&&t<=65519,"CJK Unified Ideographs Extension B":t=>t>=131072&&t<=173791};function lo(t){for(const e of t)if(Wc(e.charCodeAt(0)))return!0;return!1}function uf(t){for(const e of t)if(!hf(e.charCodeAt(0)))return!1;return!0}function hf(t){return!(it.Arabic(t)||it["Arabic Supplement"](t)||it["Arabic Extended-A"](t)||it["Arabic Presentation Forms-A"](t)||it["Arabic Presentation Forms-B"](t))}function Wc(t){return!(t!==746&&t!==747&&(t<4352||!(it["Bopomofo Extended"](t)||it.Bopomofo(t)||it["CJK Compatibility Forms"](t)&&!(t>=65097&&t<=65103)||it["CJK Compatibility Ideographs"](t)||it["CJK Compatibility"](t)||it["CJK Radicals Supplement"](t)||it["CJK Strokes"](t)||!(!it["CJK Symbols and Punctuation"](t)||t>=12296&&t<=12305||t>=12308&&t<=12319||t===12336)||it["CJK Unified Ideographs Extension A"](t)||it["CJK Unified Ideographs"](t)||it["Enclosed CJK Letters and Months"](t)||it["Hangul Compatibility Jamo"](t)||it["Hangul Jamo Extended-A"](t)||it["Hangul Jamo Extended-B"](t)||it["Hangul Jamo"](t)||it["Hangul Syllables"](t)||it.Hiragana(t)||it["Ideographic Description Characters"](t)||it.Kanbun(t)||it["Kangxi Radicals"](t)||it["Katakana Phonetic Extensions"](t)||it.Katakana(t)&&t!==12540||!(!it["Halfwidth and Fullwidth Forms"](t)||t===65288||t===65289||t===65293||t>=65306&&t<=65310||t===65339||t===65341||t===65343||t>=65371&&t<=65503||t===65507||t>=65512&&t<=65519)||!(!it["Small Form Variants"](t)||t>=65112&&t<=65118||t>=65123&&t<=65126)||it["Unified Canadian Aboriginal Syllabics"](t)||it["Unified Canadian Aboriginal Syllabics Extended"](t)||it["Vertical Forms"](t)||it["Yijing Hexagram Symbols"](t)||it["Yi Syllables"](t)||it["Yi Radicals"](t))))}function Mh(t){return!(Wc(t)||function(e){return!!(it["Latin-1 Supplement"](e)&&(e===167||e===169||e===174||e===177||e===188||e===189||e===190||e===215||e===247)||it["General Punctuation"](e)&&(e===8214||e===8224||e===8225||e===8240||e===8241||e===8251||e===8252||e===8258||e===8263||e===8264||e===8265||e===8273)||it["Letterlike Symbols"](e)||it["Number Forms"](e)||it["Miscellaneous Technical"](e)&&(e>=8960&&e<=8967||e>=8972&&e<=8991||e>=8996&&e<=9e3||e===9003||e>=9085&&e<=9114||e>=9150&&e<=9165||e===9167||e>=9169&&e<=9179||e>=9186&&e<=9215)||it["Control Pictures"](e)&&e!==9251||it["Optical Character Recognition"](e)||it["Enclosed Alphanumerics"](e)||it["Geometric Shapes"](e)||it["Miscellaneous Symbols"](e)&&!(e>=9754&&e<=9759)||it["Miscellaneous Symbols and Arrows"](e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||it["CJK Symbols and Punctuation"](e)||it.Katakana(e)||it["Private Use Area"](e)||it["CJK Compatibility Forms"](e)||it["Small Form Variants"](e)||it["Halfwidth and Fullwidth Forms"](e)||e===8734||e===8756||e===8757||e>=9984&&e<=10087||e>=10102&&e<=10131||e===65532||e===65533)}(t))}function Eh(t){return t>=1424&&t<=2303||it["Arabic Presentation Forms-A"](t)||it["Arabic Presentation Forms-B"](t)}function Sh(t,e){return!(!e&&Eh(t)||t>=2304&&t<=3583||t>=3840&&t<=4255||it.Khmer(t))}function Hc(t){for(const e of t)if(Eh(e.charCodeAt(0)))return!0;return!1}const Xc="deferred",Yc="loading",Kc="loaded";let Jc=null,Ir="unavailable",co=null;const Ah=function(t){t&&typeof t=="string"&&t.indexOf("NetworkError")>-1&&(Ir="error"),Jc&&Jc(t)};function Qc(){eu.fire(new Io("pluginStateChange",{pluginStatus:Ir,pluginURL:co}))}const eu=new rs,uo=function(){return Ir},tu=function(){if(Ir!==Xc||!co)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");Ir=Yc,Qc(),co&&ve({url:co},t=>{t?Ah(t):(Ir=Kc,Qc())})},Nr={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>Ir===Kc||Nr.applyArabicShaping!=null,isLoading:()=>Ir===Yc,setState(t){Ir=t.pluginStatus,co=t.pluginURL},isParsed:()=>Nr.applyArabicShaping!=null&&Nr.processBidirectionalText!=null&&Nr.processStyledBidirectionalText!=null,getPluginURL:()=>co};class Ii{constructor(e,i){this.zoom=e,i?(this.now=i.now,this.fadeDuration=i.fadeDuration,this.transition=i.transition,this.pitch=i.pitch,this.brightness=i.brightness):(this.now=0,this.fadeDuration=0,this.transition={},this.pitch=0,this.brightness=0)}isSupportedScript(e){return function(i,n){for(const s of i)if(!Sh(s.charCodeAt(0),n))return!1;return!0}(e,Nr.isLoaded())}}class _l{constructor(e,i,n,s){this.property=e,this.value=i,this.expression=function(l,h,f,m){if(hl(l))return new ca(l,h);if(aa(l)||Array.isArray(l)&&l.length>0){const _=pl(l,h,f,m);if(_.result==="error")throw new Error(_.value.map(y=>`${y.key}: ${y.message}`).join(", "));return _.value}{let _=l;return typeof l=="string"&&h.type==="color"&&(_=ji.parse(l)),{kind:"constant",isConfigDependent:!1,evaluate:()=>_}}}(i===void 0?e.specification.default:i,e.specification,n,s)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(e,i,n){return this.property.possiblyEvaluate(this,e,i,n)}}class iu{constructor(e,i,n){this.property=e,this.value=new _l(e,void 0,i,n)}transitioned(e,i){return new ru(this.property,this.value,i,fr({},e.transition,this.transition),e.now)}
vendor: 4,441 bytes, line 1
1untransitioned(){return new ru(this.property,this.value,null,{},0)}}class Ln{constructor(e,i,n){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues),this._scope=i,this._options=n,this.isConfigDependent=!1}getValue(e){return Or(this._values[e].value.value)}setValue(e,i){this._values.hasOwnProperty(e)||(this._values[e]=new iu(this._values[e].property,this._scope,this._options)),this._values[e].value=new _l(this._values[e].property,i===null?void 0:Or(i),this._scope,this._options),this.isConfigDependent=this.isConfigDependent||this._values[e].value.expression.isConfigDependent}setTransitionOrValue(e,i){i&&(this._options=i);const n=this._properties.properties;if(e)for(const s in e){const l=e[s];if(En(s,"-transition")){const h=s.slice(0,-11);n[h]&&this.setTransition(h,l)}else n[s]&&this.setValue(s,l)}}getTransition(e){return Or(this._values[e].transition)}setTransition(e,i){this._values.hasOwnProperty(e)||(this._values[e]=new iu(this._values[e].property)),this._values[e].transition=Or(i)||void 0}serialize(){const e={};for(const i of Object.keys(this._values)){const n=this.getValue(i);n!==void 0&&(e[i]=n);const s=this.getTransition(i);s!==void 0&&(e[`${i}-transition`]=s)}return e}transitioned(e,i){const n=new Vo(this._properties);for(const s of Object.keys(this._values))n._values[s]=this._values[s].transitioned(e,i._values[s]);return n}untransitioned(){const e=new Vo(this._properties);for(const i of Object.keys(this._values))e._values[i]=this._values[i].untransitioned();return e}}class ru{constructor(e,i,n,s,l){const h=s.delay||0,f=s.duration||0;l=l||0,this.property=e,this.value=i,this.begin=l+h,this.end=this.begin+f,e.specification.transition&&(s.delay||s.duration)&&(this.prior=n)}possiblyEvaluate(e,i,n){const s=e.now||0,l=this.value.possiblyEvaluate(e,i,n),h=this.prior;if(h){if(s>this.end)return this.prior=null,l;if(this.value.isDataDriven())return this.prior=null,l;if(s<this.begin)return h.possiblyEvaluate(e,i,n);{const f=(s-this.begin)/(this.end-this.begin);return this.property.interpolate(h.possiblyEvaluate(e,i,n),l,$e(f))}}return l}}class Vo{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,i,n){const s=new da(this._properties);for(const l of Object.keys(this._values))s._values[l]=this._values[l].possiblyEvaluate(e,i,n);return s}hasTransition(){for(const e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class df{constructor(e,i,n){this._properties=e,this._values=Object.create(e.defaultPropertyValues),this._scope=i,this._options=n,this.isConfigDependent=!1}getValue(e){return Or(this._values[e].value)}setValue(e,i){this._values[e]=new _l(this._values[e].property,i===null?void 0:Or(i),this._scope,this._options),this.isConfigDependent=this.isConfigDependent||this._values[e].expression.isConfigDependent}serialize(){const e={};for(const i of Object.keys(this._values)){const n=this.getValue(i);n!==void 0&&(e[i]=n)}return e}possiblyEvaluate(e,i,n){const s=new da(this._properties);for(const l of Object.keys(this._values))s._values[l]=this._values[l].possiblyEvaluate(e,i,n);return s}}class Ts{constructor(e,i,n){this.property=e,this.value=i,this.parameters=n}isConstant(){return this.value.kind==="constant"}constantOr(e){return this.value.kind==="constant"?this.value.value:e}evaluate(e,i,n,s){return this.property.evaluate(this.value,this.parameters,e,i,n,s)}}class da{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class Oe{constructor(e){this.specification=e}possiblyEvaluate(e,i){return e.expression.evaluate(i)}interpolate(e,i,n){const s=$a[this.specification.type];return s?s(e,i,n):e}}class ut{constructor(e,i){this.specification=e,this.overrides=i}possiblyEvaluate(e,i,n,s){return new Ts(this,e.expression.kind==="constant"||e.expression.kind==="camera"?{kind:"constant",value:e.expression.evaluate(i,null,{},n,s)}:e.expression,i)}interpolate(e,i,n){if(e.value.kind!=="constant"||i.value.kind!=="constant")return e;if(e.value.value===void 0||i.value.value===void 0)return new Ts(this,{kind:"constant",value:void 0},e.parameters);const s=$a[this.specification.type];return s?new Ts(this,{kind:"constant",value:s(e.value.value,i.value.value,n)},e.parameters):e}evaluate(e,i,n,s,l,h){return e.kind==="constant"?e.value:e.evaluate(i,n,s,l,h)}}class Uo{constructor(e){this.specification=e}
vendor: 7,391 bytes, line 1
1possiblyEvaluate(e,i,n,s){return!!e.expression.evaluate(i,null,{},n,s)}interpolate(){return!1}}class Ci{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];const i=new Ii(0,{});for(const n in e){const s=e[n];s.specification.overridable&&this.overridableProperties.push(n);const l=this.defaultPropertyValues[n]=new _l(s,void 0),h=this.defaultTransitionablePropertyValues[n]=new iu(s);this.defaultTransitioningPropertyValues[n]=h.untransitioned(),this.defaultPossiblyEvaluatedValues[n]=l.possiblyEvaluate(i)}}}function fa(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}function pa(t){if(Array.isArray(t))return t.map(pa);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){const e={};for(const i in t)e[i]=pa(t[i]);return e}return fa(t)}Ke(ut,"DataDrivenProperty"),Ke(Oe,"DataConstantProperty"),Ke(Uo,"ColorRampProperty");var le=JSON.parse('{"$version":8,"$root":{"version":{"required":true,"type":"enum","values":[8]},"fragment":{"type":"boolean"},"name":{"type":"string"},"metadata":{"type":"*"},"center":{"type":"array","value":"number"},"zoom":{"type":"number"},"bearing":{"type":"number","default":0,"period":360},"pitch":{"type":"number","default":0},"light":{"type":"light"},"lights":{"required":false,"type":"array","value":"light-3d"},"terrain":{"type":"terrain","optional":true},"fog":{"type":"fog"},"camera":{"type":"camera"},"imports":{"type":"array","value":"import"},"schema":{"type":"schema"},"sources":{"required":true,"type":"sources"},"sprite":{"type":"string"},"glyphs":{"type":"string","default":"mapbox://fonts/mapbox/{fontstack}/{range}.pbf"},"transition":{"type":"transition"},"projection":{"type":"projection"},"layers":{"required":true,"type":"array","value":"layer"},"models":{"type":"models"}},"model":{"type":"string","required":true},"import":{"id":{"type":"string","required":true},"url":{"type":"string","required":true},"config":{"type":"config"},"data":{"type":"$root"}},"config":{"*":{"type":"*"}},"schema":{"*":{"type":"option"}},"option":{"default":{"type":"*","required":true},"type":{"type":"enum","values":{"string":1,"number":1,"boolean":1,"color":1}},"array":{"type":"boolean"},"minValue":{"type":"number"},"maxValue":{"type":"number"},"stepValue":{"type":"number"},"values":{"type":"array","value":"*"},"metadata":{"type":"*"}},"models":{"*":{"type":"model"}},"light-3d":{"id":{"type":"string","required":true},"properties":{"type":"properties"},"type":{"type":"enum","values":{"ambient":{},"directional":{},"flat":{}}}},"properties":["properties_light_directional","properties_light_ambient","properties_light_flat"],"properties_light_directional":{"direction":{"type":"array","default":[210,30],"minimum":[0,0],"maximum":[360,90],"length":2,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"intensity":{"type":"number","property-type":"data-constant","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"cast-shadows":{"type":"boolean","default":false,"expression":{},"property-type":"data-constant"},"shadow-intensity":{"type":"number","property-type":"data-constant","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"properties_light_ambient":{"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"intensity":{"type":"number","property-type":"data-constant","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"properties_light_flat":{"anchor":{"type":"enum","default":"viewport","values":{"map":1,"viewport":1},"property-type":"data-constant","expression":{"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"intensity":{"type":"number","property-type":"data-constant","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"sources":{"*":{"type":"source"}},"source":["source_vector","source_raster","source_raster_dem","source_raster_array","source_geojson","source_video","source_image","source_model"],"source_vector":{"type":{"required":true,"type":"enum","values":{"vector":1}},"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":1,"tms":1},"default":"xyz"},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"attribution":{"type":"string"},"promoteId":{"type":"promoteId"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster":{"type":{"required":true,"type":"enum","values":{"raster":1}},"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},"scheme":{"type":"enum","values":{"xyz":1,"tms":1},"default":"xyz"},"attribution":{"type":"string"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster_dem":{"type":{"required":true,"type":"enum","values":{"raster-dem":1}},"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},"attribution":{"type":"string"},"encoding":{"type":"enum","values":{"terrarium":1,"mapbox":1},"default":"mapbox"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster_array":{"type":{"required":true,"type":"enum","values":{"raster-array":1}},"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},"attribution":{"type":"string"},"rasterLayers":{"type":"*"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_geojson":{"type":{"required":true,"type":"enum","values":{"geojson":1}},"data":{"type":"*"},"maxzoom":{"type":"number","default":18},"attribution":{"type":"string"},"buffer":{"type":"number","default":128,"maximum":512,"minimum":0},"filter":{"type":"*"},"tolerance":{"type":"number","default":0.375},"cluster":{"type":"boolean","default":false},"clusterRadius":{"type":"number","default":50,"minimum":0}
1,"clusterMaxZoom":{"type":"number"},"clusterMinPoints":{"type":"number"},"clusterProperties":{"type":"*"},"lineMetrics":{"type":"boolean","default":false},"generateId":{"type":"boolean","default":false},"promoteId":{"type":"promoteId"}},"source_video":{"type":{"required":true,"type":"enum","values":{"video":1}},"urls":{"required":true,"type":"array","value":"string"},"coordinates":{"required":true,"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"source_image":{"type":{"required":true,"type":"enum","values":{"image":1}},"url":{"required":false,"type":"string"},"coordinates":{"required":true,"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"source_model":{"type":{"required":true,"type":"enum","values":{"model":1,"batched-model":1}},"maxzoom":{"type":"number","default":18},"minzoom":{"type":"number","default":0},"tiles":{"type":"array","value":"string"}},"layer":{"id":{"type":"string","required":true},"type":{"type":"enum","values":{"fill":{},"line":{},"symbol":{},"circle":{},"heatmap":{},"fill-extrusion":{},"raster":{},"raster-particle":{},"hillshade":{},"model":{},"background":{},"sky":{},"slot":{}},"required":true},"metadata":{"type":"*"},"source":{"type":"string"},"source-layer":{"type":"string"},"slot":{"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_raster-particle","layout_hillshade","layout_background","layout_sky","layout_model"],"layout_background":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_sky":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_model":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"},"model-id":{"type":"string","default":"","property-type":"data-driven","expression":{"parameters":["zoom","feature"]}}},"layout_fill":{"fill-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_circle":{"circle-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_heatmap":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_fill-extrusion":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"},"fill-extrusion-edge-radius":{"type":"number","private":true,"default":0,"minimum":0,"maximum":1,"expression":{},"property-type":"constant"}},"layout_line":{"line-cap":{"type":"enum","values":{"butt":1,"round":1,"square":1},"default":"butt","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-join":{"type":"enum","values":{"bevel":1,"round":1,"miter":1},"default":"miter","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{"type":"number","default":2,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-round-limit":{"type":"number","default":1.05,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_symbol":{"symbol-placement":{"type":"enum","values":{"point":1,"line":1,"line-center":1},"default":"point","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"symbol-spacing":{"type":"number","default":250,"minimum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{"type":"enum","values":{"auto":1,"viewport-y":1,"source":1},"default":"auto","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"symbol-z-elevate":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-optional":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-size":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{"type":"enum","values":{"none":1,"width":1,"height":1,"both":1},"default":"none","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit-padding":{"type":"array","value":"number","length":4,"default":[0,0,0,0],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-image":{"type":"resolvedImage","tokens":true,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{"type":"number","default":0,"period":360,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{"type":"number","default":2,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"icon-keep-upright":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-offset":{"type":"array","value":"number","length":2,"default":[0,0],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"}
1,"icon-anchor":{"type":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-field":{"type":"formatted","default":"","tokens":true,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-font":{"type":"array","value":"string","default":["Open Sans Regular","Arial Unicode MS Regular"],"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-size":{"type":"number","default":16,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{"type":"number","default":10,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{"type":"number","default":1.2,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-letter-spacing":{"type":"number","default":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-justify":{"type":"enum","values":{"auto":1,"left":1,"center":1,"right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{"type":"number","default":0,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["zoom","feature"]}},"text-variable-anchor":{"type":"array","value":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-anchor":{"type":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{"type":"number","default":45,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-writing-mode":{"type":"array","value":"enum","values":{"horizontal":1,"vertical":1},"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-rotate":{"type":"number","default":0,"period":360,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-padding":{"type":"number","default":2,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-keep-upright":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-transform":{"type":"enum","values":{"none":1,"uppercase":1,"lowercase":1},"default":"none","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-offset":{"type":"array","value":"number","length":2,"default":[0,0],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-optional":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_raster":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_raster-particle":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_hillshade":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"filter":{"type":"array","value":"*"},"filter_symbol":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature","pitch","distance-from-center"]}},"filter_fill":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_line":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_circle":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_fill-extrusion":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_heatmap":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_operator":{"type":"enum","values":{"==":1,"!=":1,">":1,">=":1,"<":1,"<=":1,"in":1,"!in":1,"all":1,"any":1,"none":1,"has":1,"!has":1}},"geometry_type":{"type":"enum","values":{"Point":1,"LineString":1,"Polygon":1}},"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":1,"exponential":1,"interval":1,"categorical":1},"default":"exponential"},"colorSpace":{"type":"enum","values":{"rgb":1,"lab":1,"hcl":1},"default":"rgb"},"default":{"type":"*","required":false}},"function_stop":{"type":"array","minimum":0,"maximum":24,"value":["number","color"],"length":2},"expression":{"type":"array","value":"*","minimum":1},"fog":{"range":{"type":"array","default":[0.5,10],"minimum":-20,"maximum":20,"length":2,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"high-color":{"type":"color","property-type":"data-constant","default":"#245cdf","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"space-color":{"type":"color","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],4,"#010b19",7,"#367ab9"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"horizon-blend":{"type":"number","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],4,0.2,7,0.1],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"star-intensity":{"type":"number","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],5,0.35,6,0],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vertical-range":{"type":"array","default":[0,0],"minimum":0,"length":2,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}}},"camera":{"camera-projection":{"type":"enum","values":{"perspective":1,"orthographic":1},"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"default":"perspective","property-type":"data-constant"}},"light":{"anchor":{"type":"enum","default":"viewport","values":{"map":1,"viewport":1},"property-type":"data-constant","expression":{"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"intensity":{"type":"number","property-type":"data-constant","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"projection":{"name":{"type":"enum","values":{"albers":1,"equalEarth":1,"equirectangular":1,"lambertConformalConic":1,"mercator":1,"naturalEarth":1,"winkelTripel":1,"globe":1},"default":"mercator","required":true},"center":{"type":"array","length":2,"value":"number","property-type":"data-constant","minimum":[-180,-90],"maximum":[180,90]},"parallels":{"type":"array","length":2,"value":"number","property-type":"data-constant","minimum":[-90,-90],"maximum":[90,90]}},"terrain":{"source":{"type":"string","required":true},"exaggeration":{"type":"number","property-type":"data-constant","default":1,"minimum":0,"maximum":1000,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"paint":["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background","paint_sky","paint_model"],"paint_fill":{"fill-antialias":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"fill-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-outline-color":{"type":"color","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"fill-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-extrusion-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-extrusion-height":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-ambient-occlusion-intensity":{"property-type":"data-constant","type":"number","private":true,"default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-radius":{"property-type":"data-constant","type":"number","private":true,"default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-wall-radius":{"property-type":"data-constant","type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-ground-radius":{"property-type":"data-constant","type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-ground-attenuation":{"property-type":"data-constant","type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-flood-light-color":{"property-type":"data-constant","type":"color","default":"#ffffff","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-flood-light-intensity":{"property-type":"data-constant","type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-flood-light-wall-radius":{"property-type":"data-driven","type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"fill-extrusion-flood-light-ground-radius":{"property-type":"data-driven","type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"fill-extrusion-flood-light-ground-attenuation":{"property-type":"data-constant","type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-vertical-scale":{"property-type":"data-constant","type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-rounded-roof":{"property-type":"data-constant","type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"fill-extrusion-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{},"property-type":"data-constant"},"fill-extrusion-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"}},"paint_line":{"line-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"line-width":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-gap-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-offset":{"type":"number","default":0,"transition":true,"expression":{"
1interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-dasharray":{"type":"array","value":"number","minimum":0,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-gradient":{"type":"color","expression":{"interpolated":true,"parameters":["line-progress"]},"property-type":"color-ramp"},"line-trim-offset":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1],"property-type":"constant"},"line-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"line-border-width":{"type":"number","private":true,"default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-border-color":{"type":"color","private":true,"default":"rgba(0, 0, 0, 0)","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"}},"paint_circle":{"circle-radius":{"type":"number","default":5,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-blur":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1},"default":"viewport","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-stroke-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-stroke-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"}},"paint_heatmap":{"heatmap-radius":{"type":"number","default":30,"minimum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"heatmap-weight":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"heatmap-intensity":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"heatmap-color":{"type":"color","default":["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",0.1,"royalblue",0.3,"cyan",0.5,"lime",0.7,"yellow",1,"red"],"expression":{"interpolated":true,"parameters":["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_symbol":{"icon-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-emissive-strength":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-driven"},"text-emissive-strength":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-driven"},"icon-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-image-cross-fade":{"type":"number","property-type":"data-driven","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"transition":true},"text-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-color":{"type":"color","default":"#000000","transition":true,"overridable":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-color-saturation":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{},"property-type":"data-constant"}},"paint_raster":{"raster-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-color":{"type":"color","expression":{"interpolated":true,"parameters":["raster-value"]},"property-type":"color-ramp"},"raster-color-mix":{"type":"array","default":[0.2126,0.7152,0.0722,0],"length":4,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-color-range":{"type":"array","length":2,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-hue-rotate":{"type":"number","default":0,"period":360,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-resampling":{"type":"enum","values":{"linear":1,"nearest":1},"default":"linear","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{"type":"number","default":300,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"raster-array-band":{"type":"string","required":false,"property-type":"data-constant"},"raster-elevation":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_raster-particle":{"raster-particle-array-band":{"type":"string","required":false,"property-type":"data-constant"},"raster-particle-count":{"type":"number","default":512,"minimum":1,"property-type":"data-constant"},"raster-particle-color":{"type":"color","expression":{"interpolated":true,"parameters":["raster-particle-speed"]},"property-type":"color-ramp"},"raster-particle-max-speed":{"type":"number","default":1,"minimum":1,"property-type":"data-constant"},"raster-particle-speed-factor":{"type":"number","default":0.2,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-particle-fade-opacity-factor":{"type":"number","default":0.98,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-particle-reset-rate-factor":{"type":"number","default":0.8,"minimum":0,"maximum":1,"property-type":"data-constant"}},"paint_hillshade":{"hillshade-illumination-direction":{"type":"number","default":335,"minimum":0,"maximum":359,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"viewport","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{"type":"number","default":0.5,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"hillshade-highlight-color":{"type":"color","default":"#FFFFFF","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"hillshade-accent-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"hillshade-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"}},"paint_background":{"background-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"background-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"background-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"background-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"}},"paint_sky":{"sky-type":{"type":"enum","values":{"gradient":1,"atmosphere":1},"default":"atmosphere","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"sky-atmosphere-sun":{"type":"array","value":"number","length":2,"minimum":[0,0],"maximum":[360,180],"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"sky-atmosphere-sun-intensity":{"type":"number","default":10,"minimum":0,"maximum":100,"property-type":"data-constant"},"sky-gradient-center":{"type":"array","value":"number","default":[0,0],"length":2,"minimum":[0,0],"maximum":[360,180],"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"sky-gradient-radius":{"type":"number","default":90,"minimum":0,"maximum":180,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"sky-gradient":{"type":"color","default":["interpolate",["linear"],["sky-radial-progress"],0.8,"#87ceeb",1,"white"],"expression":{"interpolated":true,"parameters":["sky-radial-progress"]},"property-type":"color-ramp"},"sky-atmosphere-halo-color":{"type":"color","default":"white","property-type":"data-constant"},"sky-atmosphere-color":{"type":"color","default":"white","property-type":"data-constant"},"sky-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_model":{"model-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"model-rotation":{"type":"array","value":"number","length":3,"default":[0,0,0],"period":360,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-scale":{"type":"array","value":"number","length":3,"default":[1,1,1],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-translation":{"type":"array","value":"number","length":3,"default":[0,0,0],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-color":{"type":"color","default":"#ffffff","property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":true},"model-color-mix-intensity":{"type":"number","property-type":"data-driven","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-type":{"type":"enum","values":{"common-3d":1,"location
1-indicator":1},"default":"common-3d","property-type":"data-constant"},"model-cast-shadows":{"type":"boolean","default":true,"expression":{},"property-type":"data-constant"},"model-receive-shadows":{"type":"boolean","default":true,"expression":{},"property-type":"data-constant"},"model-ambient-occlusion-intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant","transition":true},"model-emissive-strength":{"type":"number","property-type":"data-driven","default":0,"minimum":0,"maximum":5,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-roughness":{"type":"number","default":1,"minimum":0,"maximum":1,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state"]},"transition":true},"model-height-based-emissive-strength-multiplier":{"type":"array","default":[1,1,1,1,0],"length":5,"value":"number","property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{},"property-type":"data-constant"}},"transition":{"duration":{"type":"number","default":300,"minimum":0},"delay":{"type":"number","default":0,"minimum":0}},"property-type":{"data-driven":{"type":"property-type"},"color-ramp":{"type":"property-type"},"data-constant":{"type":"property-type"},"constant":{"type":"property-type"}},"promoteId":{"*":{"type":"string"}}}');function nu(t){if(t===!0||t===!1)return!0;if(!Array.isArray(t)||t.length===0)return!1;switch(t[0]){case"has":return t.length>=2&&t[1]!=="$id"&&t[1]!=="$type";case"in":return t.length>=3&&(typeof t[1]!="string"||Array.isArray(t[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return t.length!==3||Array.isArray(t[1])||Array.isArray(t[2]);case"any":case"all":for(const e of t.slice(1))if(!nu(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}function Vr(t,e="fill"){if(t==null)return{filter:()=>!0,needGeometry:!1,needFeature:!1};nu(t)||(t=ma(t));const i=t;let n=!0;try{n=function(_){if(!Ms(_))return _;let y=pa(_);return ou(y),y=Ih(y),y}(i)}catch{console.warn(`Failed to extract static filter. Filter will continue working, but at higher memory usage and slower framerate. 2This is most likely a bug, please report this via https://github.com/mapbox/mapbox-gl-js/issues/new?assignees=&labels=&template=Bug_report.md 3and paste the contents of this message in the report. 4Thank you! 5Filter Expression: 6${JSON.stringify(i,null,2)} 7 `)}const s=le[`filter_${e}`],l=fl(n,s);let h=null;if(l.result==="error")throw new Error(l.value.map(_=>`${_.key}: ${_.message}`).join(", "));h=(_,y,v)=>l.value.evaluate(_,y,{},v);let f=null,m=null;if(n!==i){const _=fl(i,s);if(_.result==="error")throw new Error(_.value.map(y=>`${y.key}: ${y.message}`).join(", "));f=(y,v,w,E,A)=>_.value.evaluate(y,v,{},w,void 0,void 0,E,A),m=!ps(_.value.expression)}return{filter:h,dynamicFilter:f||void 0,needGeometry:Ch(n),needFeature:!!m}}function Ih(t){if(!Array.isArray(t))return t;const e=function(i){if(ff.has(i[0])){for(let n=1;n<i.length;n++)if(Ms(i[n]))return!0}return i}(t);return e===!0?e:e.map(i=>Ih(i))}function ou(t){let e=!1;const i=[];if(t[0]==="case"){for(let n=1;n<t.length-1;n+=2)e=e||Ms(t[n]),i.push(t[n+1]);i.push(t[t.length-1])}else if(t[0]==="match"){e=e||Ms(t[1]);for(let n=2;n<t.length-1;n+=2)i.push(t[n+1]);i.push(t[t.length-1])}else if(t[0]==="step"){e=e||Ms(t[1]);for(let n=1;n<t.length-1;n+=2)i.push(t[n+1])}e&&(t.length=0,t.push("any",...i));for(let n=1;n<t.length;n++)ou(t[n])}function Ms(t){if(!Array.isArray(t))return!1;if((e=t[0])==="pitch"||e==="distance-from-center")return!0;var e;for(let i=1;i<t.length;i++)if(Ms(t[i]))return!0;return!1}const ff=new Set(["in","==","!=",">",">=","<","<=","to-boolean"]);function pf(t,e){return t<e?-1:t>e?1:0}function Ch(t){if(!Array.isArray(t))return!1;if(t[0]==="within"||t[0]==="distance")return!0;for(let e=1;e<t.length;e++)if(Ch(t[e]))return!0;return!1}function ma(t){if(!t)return!0;const e=t[0];return t.length<=1?e!=="any":e==="=="?_a(t[1],t[2],"=="):e==="!="?ga(_a(t[1],t[2],"==")):e==="<"||e===">"||e==="<="||e===">="?_a(t[1],t[2],e):e==="any"?(i=t.slice(1),["any"].concat(i.map(ma))):e==="all"?["all"].concat(t.slice(1).map(ma)):e==="none"?["all"].concat(t.slice(1).map(ma).map(ga)):e==="in"?su(t[1],t.slice(2)):e==="!in"?ga(su(t[1],t.slice(2))):e==="has"?Ph(t[1]):e!=="!has"||ga(Ph(t[1]));var i}
7function _a(t,e,i){switch(t){case"$type":return[`filter-type-${i}`,e];case"$id":return[`filter-id-${i}`,e];default:return[`filter-${i}`,t,e]}}function su(t,e){if(e.length===0)return!1;switch(t){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(i=>typeof i!=typeof e[0])?["filter-in-large",t,["literal",e.sort(pf)]]:["filter-in-small",t,["literal",e]]}}function Ph(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function ga(t){return["!",t]}const gl="�";function au(t,e){return e?`${t}${gl}${e}`:t}const ya="-transition";class Cr extends rs{constructor(e,i,n,s){if(super(),this.id=e.id,this.fqid=au(this.id,n),this.type=e.type,this.scope=n,this.options=s,this._featureFilter={filter:()=>!0,needGeometry:!1,needFeature:!1},this._filterCompiled=!1,this.isConfigDependent=!1,e.type!=="custom"&&(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,e.type!=="background"&&e.type!=="sky"&&e.type!=="slot"&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter),e.slot&&(this.slot=e.slot),i.layout&&(this._unevaluatedLayout=new df(i.layout,this.scope,s),this.isConfigDependent=this.isConfigDependent||this._unevaluatedLayout.isConfigDependent),i.paint)){this._transitionablePaint=new Ln(i.paint,this.scope,s);for(const l in e.paint)this.setPaintProperty(l,e.paint[l]);for(const l in e.layout)this.setLayoutProperty(l,e.layout[l]);this.isConfigDependent=this.isConfigDependent||this._transitionablePaint.isConfigDependent,this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new da(i.paint)}}getLayoutProperty(e){return e==="visibility"?this.visibility:this._unevaluatedLayout.getValue(e)}setLayoutProperty(e,i){if(this.type==="custom"&&e==="visibility")return void(this.visibility=i);const n=this._unevaluatedLayout;n._properties.properties[e]&&(n.setValue(e,i),this.isConfigDependent=this.isConfigDependent||n.isConfigDependent,e==="visibility"&&this.possiblyEvaluateVisibility())}possiblyEvaluateVisibility(){this.visibility=this._unevaluatedLayout._values.visibility.possiblyEvaluate({zoom:0})}getPaintProperty(e){return En(e,ya)?this._transitionablePaint.getTransition(e.slice(0,-11)):this._transitionablePaint.getValue(e)}setPaintProperty(e,i){const n=this._transitionablePaint,s=n._properties.properties;if(En(e,ya)){const v=e.slice(0,-11);return s[v]&&n.setTransition(v,i||void 0),!1}if(!s[e])return!1;const l=n._values[e],h=l.value.isDataDriven(),f=l.value;n.setValue(e,i),this.isConfigDependent=this.isConfigDependent||n.isConfigDependent,this._handleSpecialPaintPropertyUpdate(e);const m=n._values[e].value,_=m.isDataDriven(),y=En(e,"pattern")||e==="line-dasharray";return _||h||y||this._handleOverridablePaintPropertyUpdate(e,f,m)}_handleSpecialPaintPropertyUpdate(e){}getProgramIds(){return null}getDefaultProgramParams(e,i){return null}_handleOverridablePaintPropertyUpdate(e,i,n){return!1}isHidden(e){return!!(this.minzoom&&e<this.minzoom)||!!(this.maxzoom&&e>=this.maxzoom)||this.visibility==="none"}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(e,i){this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,i)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,i)}
vendor: 15,159 bytes, line 7
7serialize(){return jr({id:this.id,type:this.type,slot:this.slot,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()},(e,i)=>!(e===void 0||i==="layout"&&!Object.keys(e).length||i==="paint"&&!Object.keys(e).length))}is3D(){return!1}isSky(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}hasShadowPass(){return!1}canCastShadows(){return!1}hasLightBeamPass(){return!1}cutoffRange(){return 0}tileCoverLift(){return 0}resize(){}isStateDependent(){for(const e in this.paint._values){const i=this.paint.get(e);if(i instanceof Ts&&ul(i.property.specification)&&(i.value.kind==="source"||i.value.kind==="composite")&&i.value.isStateDependent)return!0}return!1}compileFilter(){this._filterCompiled||(this._featureFilter=Vr(this.filter),this._filterCompiled=!0)}invalidateCompiledFilter(){this._filterCompiled=!1}dynamicFilter(){return this._featureFilter.dynamicFilter}dynamicFilterNeedsFeature(){return this._featureFilter.needFeature}getLayerRenderingStats(){return this._stats}resetLayerRenderingStats(e){this._stats&&(e.renderPass==="shadow"?this._stats.numRenderedVerticesInShadowPass=0:this._stats.numRenderedVerticesInTransparentPass=0)}}const mf={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class yl{constructor(e,i){this._structArray=e,this._pos1=i*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class Ti{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(e,i){return e._trim(),i&&(e.isTransferred=!0,i.add(e.arrayBuffer)),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){const i=Object.create(this.prototype);return i.arrayBuffer=e.arrayBuffer,i.length=e.length,i.capacity=e.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(e){this.reserve(e),this.length=e}reserve(e){if(e>this.capacity){this.capacity=Math.max(e,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const i=this.uint8;this._refreshViews(),i&&this.uint8.set(i)}}_refreshViews(){throw new Error("StructArray#_refreshViews() must be implemented by each concrete StructArray layout")}emplace(...e){throw new Error("StructArray#emplace() must be implemented by each concrete StructArray layout")}emplaceBack(...e){throw new Error("StructArray#emplaceBack() must be implemented by each concrete StructArray layout")}destroy(){this.int8=this.uint8=this.int16=this.uint16=this.int32=this.uint32=this.float32=null,this.arrayBuffer=null}}function li(t,e=1){let i=0,n=0;return{members:t.map(s=>{const l=mf[s.type].BYTES_PER_ELEMENT,h=i=xa(i,Math.max(e,l)),f=s.components||1;return n=Math.max(n,l),i+=l*f,{name:s.name,type:s.type,components:f,offset:h}}),size:xa(i,Math.max(n,e)),alignment:e}}function xa(t,e){return Math.ceil(t/e)*e}class cn extends Ti{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i){const n=this.length;return this.resize(n+1),this.emplace(n,e,i)}emplace(e,i,n){const s=2*e;return this.int16[s+0]=i,this.int16[s+1]=n,e}}cn.prototype.bytesPerElement=4,Ke(cn,"StructArrayLayout2i4");class wr extends Ti{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,n){const s=this.length;return this.resize(s+1),this.emplace(s,e,i,n)}emplace(e,i,n,s){const l=3*e;return this.int16[l+0]=i,this.int16[l+1]=n,this.int16[l+2]=s,e}}wr.prototype.bytesPerElement=6,Ke(wr,"StructArrayLayout3i6");class Rn extends Ti{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,n,s){const l=this.length;return this.resize(l+1),this.emplace(l,e,i,n,s)}emplace(e,i,n,s,l){const h=4*e;return this.int16[h+0]=i,this.int16[h+1]=n,this.int16[h+2]=s,this.int16[h+3]=l,e}}Rn.prototype.bytesPerElement=8,Ke(Rn,"StructArrayLayout4i8");class lu extends Ti{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,n,s,l){const h=this.length;return this.resize(h+1),this.emplace(h,e,i,n,s,l)}emplace(e,i,n,s,l,h){const f=5*e;return this.int16[f+0]=i,this.int16[f+1]=n,this.int16[f+2]=s,this.int16[f+3]=l,this.int16[f+4]=h,e}}lu.prototype.bytesPerElement=10,Ke(lu,"StructArrayLayout5i10");class cu extends Ti{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,n,s,l,h,f){const m=this.length;return this.resize(m+1),this.emplace(m,e,i,n,s,l,h,f)}emplace(e,i,n,s,l,h,f,m){const _=6*e,y=12*e,v=3*e;return this.int16[_+0]=i,this.int16[_+1]=n,this.uint8[y+4]=s,this.uint8[y+5]=l,this.uint8[y+6]=h,this.uint8[y+7]=f,this.float32[v+2]=m,e}}cu.prototype.bytesPerElement=12,Ke(cu,"StructArrayLayout2i4ub1f12");class ho extends Ti{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,n,s){const l=this.length;return this.resize(l+1),this.emplace(l,e,i,n,s)}emplace(e,i,n,s,l){const h=4*e;return this.float32[h+0]=i,this.float32[h+1]=n,this.float32[h+2]=s,this.float32[h+3]=l,e}}ho.prototype.bytesPerElement=16,Ke(ho,"StructArrayLayout4f16");class fo extends Ti{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,n,s,l){const h=this.length;return this.resize(h+1),this.emplace(h,e,i,n,s,l)}emplace(e,i,n,s,l,h){const f=6*e,m=3*e;return this.uint16[f+0]=i,this.uint16[f+1]=n,this.uint16[f+2]=s,this.uint16[f+3]=l,this.float32[m+2]=h,e}}fo.prototype.bytesPerElement=12,Ke(fo,"StructArrayLayout4ui1f12");class Es extends Ti{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,n,s){const l=this.length;return this.resize(l+1),this.emplace(l,e,i,n,s)}emplace(e,i,n,s,l){const h=4*e;return this.uint16[h+0]=i,this.uint16[h+1]=n,this.uint16[h+2]=s,this.uint16[h+3]=l,e}}Es.prototype.bytesPerElement=8,Ke(Es,"StructArrayLayout4ui8");class xl extends Ti{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,n,s,l,h){const f=this.length;return this.resize(f+1),this.emplace(f,e,i,n,s,l,h)}emplace(e,i,n,s,l,h,f){const m=6*e;return this.int16[m+0]=i,this.int16[m+1]=n,this.int16[m+2]=s,this.int16[m+3]=l,this.int16[m+4]=h,this.int16[m+5]=f,e}}xl.prototype.bytesPerElement=12,Ke(xl,"StructArrayLayout6i12");class va extends Ti{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,n,s,l,h,f,m,_,y,v,w){const E=this.length;return this.resize(E+1),this.emplace(E,e,i,n,s,l,h,f,m,_,y,v,w)}emplace(e,i,n,s,l,h,f,m,_,y,v,w,E){const A=12*e;return this.int16[A+0]=i,this.int16[A+1]=n,this.int16[A+2]=s,this.int16[A+3]=l,this.uint16[A+4]=h,this.uint16[A+5]=f,this.uint16[A+6]=m,this.uint16[A+7]=_,this.int16[A+8]=y,this.int16[A+9]=v,this.int16[A+10]=w,this.int16[A+11]=E,e}}va.prototype.bytesPerElement=24,Ke(va,"StructArrayLayout4i4ui4i24");class uu extends Ti{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,n,s,l,h){const f=this.length;return this.resize(f+1),this.emplace(f,e,i,n,s,l,h)}emplace(e,i,n,s,l,h,f){const m=10*e,_=5*e;return this.int16[m+0]=i,this.int16[m+1]=n,this.int16[m+2]=s,this.float32[_+2]=l,this.float32[_+3]=h,this.float32[_+4]=f,e}}uu.prototype.bytesPerElement=20,Ke(uu,"StructArrayLayout3i3f20");class hu extends Ti{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.uint32[1*e+0]=i,e}}hu.prototype.bytesPerElement=4,Ke(hu,"StructArrayLayout1ul4");class vn extends Ti{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i){const n=this.length;return this.resize(n+1),this.emplace(n,e,i)}emplace(e,i,n){const s=2*e;return this.uint16[s+0]=i,this.uint16[s+1]=n,e}}vn.prototype.bytesPerElement=4,Ke(vn,"StructArrayLayout2ui4");class du extends Ti{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,n,s,l,h,f,m,_,y,v,w,E){const A=this.length;return this.resize(A+1),this.emplace(A,e,i,n,s,l,h,f,m,_,y,v,w,E)}emplace(e,i,n,s,l,h,f,m,_,y,v,w,E,A){const I=20*e,z=10*e;return this.int16[I+0]=i,this.int16[I+1]=n,this.int16[I+2]=s,this.int16[I+3]=l,this.int16[I+4]=h,this.float32[z+3]=f,this.float32[z+4]=m,this.float32[z+5]=_,this.float32[z+6]=y,this.int16[I+14]=v,this.uint32[z+8]=w,this.uint16[I+18]=E,this.uint16[I+19]=A,e}}du.prototype.bytesPerElement=40,Ke(du,"StructArrayLayout5i4f1i1ul2ui40");class ba extends Ti{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,n,s,l,h,f){const m=this.length;return this.resize(m+1),this.emplace(m,e,i,n,s,l,h,f)}emplace(e,i,n,s,l,h,f,m){const _=8*e;return this.int16[_+0]=i,this.int16[_+1]=n,this.int16[_+2]=s,this.int16[_+4]=l,this.int16[_+5]=h,this.int16[_+6]=f,this.int16[_+7]=m,e}}ba.prototype.bytesPerElement=16,Ke(ba,"StructArrayLayout3i2i2i16");class vl extends Ti{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,n,s,l){const h=this.length;return this.resize(h+1),this.emplace(h,e,i,n,s,l)}emplace(e,i,n,s,l,h){const f=4*e,m=8*e;return this.float32[f+0]=i,this.float32[f+1]=n,this.float32[f+2]=s,this.int16[m+6]=l,this.int16[m+7]=h,e}}vl.prototype.bytesPerElement=16,Ke(vl,"StructArrayLayout2f1f2i16");class fu extends Ti{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,n,s){const l=this.length;return this.resize(l+1),this.emplace(l,e,i,n,s)}emplace(e,i,n,s,l){const h=12*e,f=3*e;return this.uint8[h+0]=i,this.uint8[h+1]=n,this.float32[f+1]=s,this.float32[f+2]=l,e}}fu.prototype.bytesPerElement=12,Ke(fu,"StructArrayLayout2ub2f12");class Ji extends Ti{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,n){const s=this.length;return this.resize(s+1),this.emplace(s,e,i,n)}emplace(e,i,n,s){const l=3*e;return this.uint16[l+0]=i,this.uint16[l+1]=n,this.uint16[l+2]=s,e}}Ji.prototype.bytesPerElement=6,Ke(Ji,"StructArrayLayout3ui6");class Ss extends Ti{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e,i,n,s,l,h,f,m,_,y,v,w,E,A,I,z,L,N,G,j,X){const W=this.length;return this.resize(W+1),this.emplace(W,e,i,n,s,l,h,f,m,_,y,v,w,E,A,I,z,L,N,G,j,X)}emplace(e,i,n,s,l,h,f,m,_,y,v,w,E,A,I,z,L,N,G,j,X,W){const J=30*e,ie=15*e,oe=60*e;return this.int16[J+0]=i,this.int16[J+1]=n,this.int16[J+2]=s,this.float32[ie+2]=l,this.float32[ie+3]=h,this.uint16[J+8]=f,this.uint16[J+9]=m,this.uint32[ie+5]=_,this.uint32[ie+6]=y,this.uint32[ie+7]=v,this.uint16[J+16]=w,this.uint16[J+17]=E,this.uint16[J+18]=A,this.float32[ie+10]=I,this.float32[ie+11]=z,this.uint8[oe+48]=L,this.uint8[oe+49]=N,this.uint8[oe+50]=G,this.uint32[ie+13]=j,this.int16[J+28]=X,this.uint8[oe+58]=W,e}}Ss.prototype.bytesPerElement=60,Ke(Ss,"StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60");class bl extends Ti{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e,i,n,s,l,h,f,m,_,y,v,w,E,A,I,z,L,N,G,j,X,W,J,ie,oe,ue,se,_e,Me,pe,we,de){const be=this.length;return this.resize(be+1),this.emplace(be,e,i,n,s,l,h,f,m,_,y,v,w,E,A,I,z,L,N,G,j,X,W,J,ie,oe,ue,se,_e,Me,pe,we,de)}emplace(e,i,n,s,l,h,f,m,_,y,v,w,E,A,I,z,L,N,G,j,X,W,J,ie,oe,ue,se,_e,Me,pe,we,de,be){const Fe=20*e,Se=40*e,Qe=80*e;return this.float32[Fe+0]=i,this.float32[Fe+1]=n,this.int16[Se+4]=s,this.int16[Se+5]=l,this.int16[Se+6]=h,this.int16[Se+7]=f,this.int16[Se+8]=m,this.int16[Se+9]=_,this.int16[Se+10]=y,this.int16[Se+11]=v,this.int16[Se+12]=w,this.uint16[Se+13]=E,this.uint16[Se+14]=A,this.uint16[Se+15]=I,this.uint16[Se+16]=z,this.uint16[Se+17]=L,this.uint16[Se+18]=N,this.uint16[Se+19]=G,this.uint16[Se+20]=j,this.uint16[Se+21]=X,this.uint16[Se+22]=W,this.uint16[Se+23]=J,this.uint16[Se+24]=ie,this.uint16[Se+25]=oe,this.uint16[Se+26]=ue,this.uint16[Se+27]=se,this.uint32[Fe+14]=_e,this.float32[Fe+15]=Me,this.float32[Fe+16]=pe,this.float32[Fe+17]=we,this.float32[Fe+18]=de,this.uint8[Qe+76]=be,e}}bl.prototype.bytesPerElement=80,Ke(bl,"StructArrayLayout2f9i15ui1ul4f1ub80");class wa extends Ti{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.float32[1*e+0]=i,e}}wa.prototype.bytesPerElement=4,Ke(wa,"StructArrayLayout1f4");class po extends Ti{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,n,s,l){const h=this.length;return this.resize(h+1),this.emplace(h,e,i,n,s,l)}emplace(e,i,n,s,l,h){const f=5*e;return this.float32[f+0]=i,this.float32[f+1]=n,this.float32[f+2]=s,this.float32[f+3]=l,this.float32[f+4]=h,e}}po.prototype.bytesPerElement=20,Ke(po,"StructArrayLayout5f20");class pu extends Ti{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,n,s,l,h,f){const m=this.length;return this.resize(m+1),this.emplace(m,e,i,n,s,l,h,f)}emplace(e,i,n,s,l,h,f,m){const _=7*e;return this.float32[_+0]=i,this.float32[_+1]=n,this.float32[_+2]=s,this.float32[_+3]=l,this.float32[_+4]=h,this.float32[_+5]=f,this.float32[_+6]=m,e}}pu.prototype.bytesPerElement=28,Ke(pu,"StructArrayLayout7f28");class Ta extends Ti{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,n,s){const l=this.length;return this.resize(l+1),this.emplace(l,e,i,n,s)}emplace(e,i,n,s,l){const h=6*e;
vendor: 9,208 bytes, line 7
7return this.uint32[3*e+0]=i,this.uint16[h+2]=n,this.uint16[h+3]=s,this.uint16[h+4]=l,e}}Ta.prototype.bytesPerElement=12,Ke(Ta,"StructArrayLayout1ul3ui12");class mu extends Ti{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.uint16[1*e+0]=i,e}}mu.prototype.bytesPerElement=2,Ke(mu,"StructArrayLayout1ui2");class jo extends Ti{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,n){const s=this.length;return this.resize(s+1),this.emplace(s,e,i,n)}emplace(e,i,n,s){const l=3*e;return this.float32[l+0]=i,this.float32[l+1]=n,this.float32[l+2]=s,e}}jo.prototype.bytesPerElement=12,Ke(jo,"StructArrayLayout3f12");class Ma extends Ti{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i){const n=this.length;return this.resize(n+1),this.emplace(n,e,i)}emplace(e,i,n){const s=2*e;return this.float32[s+0]=i,this.float32[s+1]=n,e}}Ma.prototype.bytesPerElement=8,Ke(Ma,"StructArrayLayout2f8");class _u extends Ti{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,n,s,l,h,f,m,_,y,v,w,E,A,I,z){const L=this.length;return this.resize(L+1),this.emplace(L,e,i,n,s,l,h,f,m,_,y,v,w,E,A,I,z)}emplace(e,i,n,s,l,h,f,m,_,y,v,w,E,A,I,z,L){const N=16*e;return this.float32[N+0]=i,this.float32[N+1]=n,this.float32[N+2]=s,this.float32[N+3]=l,this.float32[N+4]=h,this.float32[N+5]=f,this.float32[N+6]=m,this.float32[N+7]=_,this.float32[N+8]=y,this.float32[N+9]=v,this.float32[N+10]=w,this.float32[N+11]=E,this.float32[N+12]=A,this.float32[N+13]=I,this.float32[N+14]=z,this.float32[N+15]=L,e}}_u.prototype.bytesPerElement=64,Ke(_u,"StructArrayLayout16f64");class Ea extends Ti{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,n,s,l,h,f){const m=this.length;return this.resize(m+1),this.emplace(m,e,i,n,s,l,h,f)}emplace(e,i,n,s,l,h,f,m){const _=10*e,y=5*e;return this.uint16[_+0]=i,this.uint16[_+1]=n,this.uint16[_+2]=s,this.uint16[_+3]=l,this.float32[y+2]=h,this.float32[y+3]=f,this.float32[y+4]=m,e}}Ea.prototype.bytesPerElement=20,Ke(Ea,"StructArrayLayout4ui3f20");class gu extends Ti{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.uint8[1*e+0]=i,e}}gu.prototype.bytesPerElement=1,Ke(gu,"StructArrayLayout1ub1");class zh extends yl{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.int16[this._pos2+3]}get tileAnchorY(){return this._structArray.int16[this._pos2+4]}get x1(){return this._structArray.float32[this._pos4+3]}get y1(){return this._structArray.float32[this._pos4+4]}get x2(){return this._structArray.float32[this._pos4+5]}get y2(){return this._structArray.float32[this._pos4+6]}get padding(){return this._structArray.int16[this._pos2+14]}get featureIndex(){return this._structArray.uint32[this._pos4+8]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+18]}get bucketIndex(){return this._structArray.uint16[this._pos2+19]}}zh.prototype.size=40;class Dh extends du{get(e){return new zh(this,e)}}Ke(Dh,"CollisionBoxArray");class Lh extends yl{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.float32[this._pos4+2]}get tileAnchorY(){return this._structArray.float32[this._pos4+3]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+8]}get numGlyphs(){return this._structArray.uint16[this._pos2+9]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+5]}get lineStartIndex(){return this._structArray.uint32[this._pos4+6]}get lineLength(){return this._structArray.uint32[this._pos4+7]}get segment(){return this._structArray.uint16[this._pos2+16]}get lowerSize(){return this._structArray.uint16[this._pos2+17]}get upperSize(){return this._structArray.uint16[this._pos2+18]}get lineOffsetX(){return this._structArray.float32[this._pos4+10]}get lineOffsetY(){return this._structArray.float32[this._pos4+11]}get writingMode(){return this._structArray.uint8[this._pos1+48]}get placedOrientation(){return this._structArray.uint8[this._pos1+49]}set placedOrientation(e){this._structArray.uint8[this._pos1+49]=e}get hidden(){return this._structArray.uint8[this._pos1+50]}set hidden(e){this._structArray.uint8[this._pos1+50]=e}get crossTileID(){return this._structArray.uint32[this._pos4+13]}set crossTileID(e){this._structArray.uint32[this._pos4+13]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+28]}get flipState(){return this._structArray.uint8[this._pos1+58]}set flipState(e){this._structArray.uint8[this._pos1+58]=e}}Lh.prototype.size=60;class Rh extends Ss{get(e){return new Lh(this,e)}}Ke(Rh,"PlacedSymbolArray");class kh extends yl{get tileAnchorX(){return this._structArray.float32[this._pos4+0]}get tileAnchorY(){return this._structArray.float32[this._pos4+1]}get projectedAnchorX(){return this._structArray.int16[this._pos2+4]}get projectedAnchorY(){return this._structArray.int16[this._pos2+5]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+6]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+7]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+8]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+9]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+10]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+11]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+12]}get key(){return this._structArray.uint16[this._pos2+13]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+14]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+15]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+16]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+17]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+18]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+19]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+20]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+21]}get featureIndex(){return this._structArray.uint16[this._pos2+22]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+23]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+24]}get numIconVertices(){return this._structArray.uint16[this._pos2+25]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+26]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+27]}get crossTileID(){return this._structArray.uint32[this._pos4+14]}set crossTileID(e){this._structArray.uint32[this._pos4+14]=e}get textOffset0(){return this._structArray.float32[this._pos4+15]}get textOffset1(){return this._structArray.float32[this._pos4+16]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+17]}get zOffset(){return this._structArray.float32[this._pos4+18]}set zOffset(e){this._structArray.float32[this._pos4+18]=e}get hasIconTextFit(){return this._structArray.uint8[this._pos1+76]}}kh.prototype.size=80;class Oh extends bl{get(e){return new kh(this,e)}}Ke(Oh,"SymbolInstanceArray");class Bh extends wa{getoffsetX(e){return this.float32[1*e+0]}}Ke(Bh,"GlyphOffsetArray");class Sa extends cn{getx(e){return this.int16[2*e+0]}gety(e){return this.int16[2*e+1]}}Ke(Sa,"SymbolLineVertexArray");class Fh extends yl{get featureIndex(){return this._structArray.uint32[this._pos4+0]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+2]}get bucketIndex(){return this._structArray.uint16[this._pos2+3]}get layoutVertexArrayOffset(){return this._structArray.uint16[this._pos2+4]}}Fh.prototype.size=12;class Nh extends Ta{get(e){return new Fh(this,e)}}Ke(Nh,"FeatureIndexArray");class Aa extends vn{geta_centroid_pos0(e){return this.uint16[2*e+0]}geta_centroid_pos1(e){return this.uint16[2*e+1]}}Ke(Aa,"FillExtrusionCentroidArray");const _f=li([{name:"a_pos",components:2,type:"Int16"}],4),Vh=li([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]);class Oi{constructor(e=[]){this.segments=e}_prepareSegment(e,i,n,s){let l=this.segments[this.segments.length-1];return e>Oi.MAX_VERTEX_ARRAY_LENGTH&&ki(`Max vertices per segment is ${Oi.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),(!l||l.vertexLength+e>Oi.MAX_VERTEX_ARRAY_LENGTH||l.sortKey!==s)&&(l={vertexOffset:i,primitiveOffset:n,vertexLength:0,primitiveLength:0}
7,s!==void 0&&(l.sortKey=s),this.segments.push(l)),l}prepareSegment(e,i,n,s){return this._prepareSegment(e,i.length,n.length,s)}get(){return this.segments}destroy(){for(const e of this.segments)for(const i in e.vaos)e.vaos[i].destroy()}static simpleSegment(e,i,n,s){return new Oi([{vertexOffset:e,primitiveOffset:i,vertexLength:n,primitiveLength:s,vaos:{},sortKey:0}])}}function yu(t,e){return 256*(t=Dt(Math.floor(t),0,255))+Dt(Math.floor(e),0,255)}Oi.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Ke(Oi,"SegmentVector");const Uh=li([{name:"a_pattern",components:4,type:"Uint16"},{name:"a_pixel_ratio",components:1,type:"Float32"}]),jh=li([{name:"a_dash",components:4,type:"Uint16"}]);var Ia={exports:{}},wl={exports:{}};(function(t){t.exports=function(e,i){var n,s,l,h,f,m,_,y;for(s=e.length-(n=3&e.length),l=i,f=3432918353,m=461845907,y=0;y<s;)_=255&e.charCodeAt(y)|(255&e.charCodeAt(++y))<<8|(255&e.charCodeAt(++y))<<16|(255&e.charCodeAt(++y))<<24,++y,l=27492+(65535&(h=5*(65535&(l=(l^=_=(65535&(_=(_=(65535&_)*f+(((_>>>16)*f&65535)<<16)&4294967295)<<15|_>>>17))*m+(((_>>>16)*m&65535)<<16)&4294967295)<<13|l>>>19))+((5*(l>>>16)&65535)<<16)&4294967295))+((58964+(h>>>16)&65535)<<16);switch(_=0,n){case 3:_^=(255&e.charCodeAt(y+2))<<16;case 2:_^=(255&e.charCodeAt(y+1))<<8;case 1:l^=_=(65535&(_=(_=(65535&(_^=255&e.charCodeAt(y)))*f+(((_>>>16)*f&65535)<<16)&4294967295)<<15|_>>>17))*m+(((_>>>16)*m&65535)<<16)&4294967295}return l^=e.length,l=2246822507*(65535&(l^=l>>>16))+((2246822507*(l>>>16)&65535)<<16)&4294967295,l=3266489909*(65535&(l^=l>>>13))+((3266489909*(l>>>16)&65535)<<16)&4294967295,(l^=l>>>16)>>>0}})(wl);var xu=wl.exports,Gh={exports:{}};(function(t){t.exports=function(e,i){for(var n,s=e.length,l=i^s,h=0;s>=4;)n=1540483477*(65535&(n=255&e.charCodeAt(h)|(255&e.charCodeAt(++h))<<8|(255&e.charCodeAt(++h))<<16|(255&e.charCodeAt(++h))<<24))+((1540483477*(n>>>16)&65535)<<16),l=1540483477*(65535&l)+((1540483477*(l>>>16)&65535)<<16)^(n=1540483477*(65535&(n^=n>>>24))+((1540483477*(n>>>16)&65535)<<16)),s-=4,++h;switch(s){case 3:l^=(255&e.charCodeAt(h+2))<<16;case 2:l^=(255&e.charCodeAt(h+1))<<8;case 1:l=1540483477*(65535&(l^=255&e.charCodeAt(h)))+((1540483477*(l>>>16)&65535)<<16)}return l=1540483477*(65535&(l^=l>>>13))+((1540483477*(l>>>16)&65535)<<16),(l^=l>>>15)>>>0}})(Gh);var Zh=xu,qh=Gh.exports;Ia.exports=Zh,Ia.exports.murmur3=Zh,Ia.exports.murmur2=qh;var vu=kr(Ia.exports);class Ca{constructor(){this.ids=[],this.uniqueIds=[],this.positions=[],this.indexed=!1}add(e,i,n,s){this.ids.push($h(e)),this.positions.push(i,n,s)}eachPosition(e,i){const n=$h(e);let s=0,l=this.ids.length-1;for(;s<l;){const h=s+l>>1;this.ids[h]>=n?l=h:s=h+1}for(;this.ids[s]===n;)i(this.positions[3*s],this.positions[3*s+1],this.positions[3*s+2]),s++}static serialize(e,i){const n=new Float64Array(e.ids),s=new Uint32Array(e.positions);return bu(n,s,0,n.length-1),i&&(i.add(n.buffer),i.add(s.buffer)),{ids:n,positions:s}}static deserialize(e){const i=new Ca;let n;i.ids=e.ids,i.positions=e.positions;for(const s of i.ids)s!==n&&i.uniqueIds.push(s),n=s;return i.indexed=!0,i}}function $h(t){const e=+t;return!isNaN(e)&&Number.MIN_SAFE_INTEGER<=e&&e<=Number.MAX_SAFE_INTEGER?e:vu(String(t))}function bu(t,e,i,n){for(;i<n;){const s=t[i+n>>1];let l=i-1,h=n+1;for(;;){do l++;while(t[l]<s);do h--;while(t[h]>s);if(l>=h)break;Tl(t,l,h),Tl(e,3*l,3*h),Tl(e,3*l+1,3*h+1),Tl(e,3*l+2,3*h+2)}h-i<n-h?(bu(t,e,i,h),i=h+1):(bu(t,e,h+1,n),n=h)}}function Tl(t,e,i){const n=t[e];t[e]=t[i],t[i]=n}Ke(Ca,"FeaturePositionMap");class kn{constructor(e){this.gl=e.gl,this.initialized=!1}fetchUniformLocation(e,i){return this.location||this.initialized||(this.location=this.gl.getUniformLocation(e,i),this.initialized=!0),!!this.location}}class Ml extends kn{constructor(e){super(e),this.current=0}set(e,i,n){this.fetchUniformLocation(e,i)&&this.current!==n&&(this.current=n,this.gl.uniform1i(this.location,n))}}class gr extends kn{constructor(e){super(e),this.current=0}set(e,i,n){this.fetchUniformLocation(e,i)&&this.current!==n&&(this.current=n,this.gl.uniform1f(this.location,n))}}class mo extends kn{constructor(e){super(e),this.current=[0,0]}set(e,i,n){this.fetchUniformLocation(e,i)&&(n[0]===this.current[0]&&n[1]===this.current[1]||(this.current=n,this.gl.uniform2f(this.location,n[0],n[1])))}}class Wh extends kn{constructor(e){super(e),this.current=[0,0,0]}set(e,i,n){this.fetchUniformLocation(e,i)&&(n[0]===this.current[0]&&n[1]===this.current[1]&&n[2]===this.current[2]||(this.current=n,this.gl.uniform3f(this.location,n[0],n[1],n[2])))}}class c extends kn{constructor(e){super(e),this.current=[0,0,0,0]}set(e,i,n){this.fetchUniformLocation(e,i)&&(n[0]===this.current[0]&&n[1]===this.current[1]&&n[2]===this.current[2]&&n[3]===this.current[3]||(this.current=n,this.gl.uniform4f(this.location,n[0],n[1],n[2],n[3])))}}class r extends kn{constructor(e){super(e),this.current=ji.transparent}set(e,i,n){this.fetchUniformLocation(e,i)&&(n.r===this.current.r&&n.g===this.current.g&&n.b===this.current.b&&n.a===this.current.a||(this.current=n,this.gl.uniform4f(this.location,n.r,n.g,n.b,n.a)))}}const o=new Float32Array(16);class u extends kn{constructor(e){super(e),this.current=o}set(e,i,n){if(this.fetchUniformLocation(e,i)){if(n[12]!==this.current[12]||n[0]!==this.current[0])return this.current=n,void this.gl.uniformMatrix4fv(this.location,!1,n);for(let s=1;s<16;s++)if(n[s]!==this.current[s]){this.current=n,this.gl.uniformMatrix4fv(this.location,!1,n);break}}}}const d=new Float32Array(9),p=new Float32Array(4);class g extends kn{constructor(e){super(e),this.current=p}set(e,i,n){if(this.fetchUniformLocation(e,i)){for(let s=0;s<4;s++)if(n[s]!==this.current[s]){this.current=n,this.gl.uniformMatrix2fv(this.location,!1,n);break}}}}function x(t){return[yu(255*t.r,255*t.g),yu(255*t.b,255*t.a)]}class b{constructor(e,i,n){this.value=e,this.uniformNames=i.map(s=>`u_${s}`),this.type=n}setUniform(e,i,n,s,l){i.set(e,l,s.constantOr(this.value))}getBinding(e,i){return this.type==="color"?new r(e):new gr(e)}}class T{constructor(e,i){this.uniformNames=i.map(n=>`u_${n}`),this.pattern=null,this.pixelRatio=1}setConstantPatternPositions(e){this.pixelRatio=e.pixelRatio||1,this.pattern=e.tl.concat(e.br)}setUniform(e,i,n,s,l){const h=l==="u_pattern"||l==="u_dash"?this.pattern:l==="u_pixel_ratio"?this.pixelRatio:null;h&&i.set(e,l,h)}getBinding(e,i){return i==="u_pattern"||i==="u_dash"?new c(e):new gr(e)}}class M{constructor(e,i,n,s){this.expression=e,this.type=n,this.maxValue=0,this.paintVertexAttributes=i.map(l=>({name:`a_${l}`,type:"Float32",components:n==="color"?2:1,offset:0})),this.paintVertexArray=new s}populatePaintArray(e,i,n,s,l,h,f){const m=this.paintVertexArray.length,_=this.expression.evaluate(new Ii(0,{brightness:h}),i,{},l,s,f);this.paintVertexArray.resize(e),this._setPaintValue(m,e,_)}updatePaintArray(e,i,n,s,l,h,f){const m=this.expression.evaluate({zoom:0,brightness:f},n,s,void 0,l);this._setPaintValue(e,i,m)}
vendor: 7,897 bytes, line 7
7_setPaintValue(e,i,n){if(this.type==="color"){const s=x(n);for(let l=e;l<i;l++)this.paintVertexArray.emplace(l,s[0],s[1])}else{for(let s=e;s<i;s++)this.paintVertexArray.emplace(s,n);this.maxValue=Math.max(this.maxValue,Math.abs(n))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent||!this.expression.isLightConstant))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class S{constructor(e,i,n,s,l,h){this.expression=e,this.uniformNames=i.map(f=>`u_${f}_t`),this.type=n,this.useIntegerZoom=s,this.zoom=l,this.maxValue=0,this.paintVertexAttributes=i.map(f=>({name:`a_${f}`,type:"Float32",components:n==="color"?4:2,offset:0})),this.paintVertexArray=new h}populatePaintArray(e,i,n,s,l,h,f){const m=this.expression.evaluate(new Ii(this.zoom,{brightness:h}),i,{},l,s,f),_=this.expression.evaluate(new Ii(this.zoom+1,{brightness:h}),i,{},l,s,f),y=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(y,e,m,_)}updatePaintArray(e,i,n,s,l,h,f){const m=this.expression.evaluate({zoom:this.zoom,brightness:f},n,s,void 0,l),_=this.expression.evaluate({zoom:this.zoom+1,brightness:f},n,s,void 0,l);this._setPaintValue(e,i,m,_)}_setPaintValue(e,i,n,s){if(this.type==="color"){const l=x(n),h=x(s);for(let f=e;f<i;f++)this.paintVertexArray.emplace(f,l[0],l[1],h[0],h[1])}else{for(let l=e;l<i;l++)this.paintVertexArray.emplace(l,n,s);this.maxValue=Math.max(this.maxValue,Math.abs(n),Math.abs(s))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent||!this.expression.isLightConstant))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(e,i,n,s,l){const h=this.useIntegerZoom?Math.floor(n.zoom):n.zoom,f=Dt(this.expression.interpolationFactor(h,this.zoom,this.zoom+1),0,1);i.set(e,l,f)}getBinding(e,i){return new gr(e)}}class C{constructor(e,i,n,s,l){this.expression=e,this.layerId=l,this.paintVertexAttributes=(n==="array"?jh:Uh).members;for(let h=0;h<i.length;++h);this.paintVertexArray=new s}populatePaintArray(e,i,n){const s=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValues(s,e,i.patterns&&i.patterns[this.layerId],n)}updatePaintArray(e,i,n,s,l,h,f){this._setPaintValues(e,i,n.patterns&&n.patterns[this.layerId],h)}_setPaintValues(e,i,n,s){if(!s||!n)return;const l=s[n];if(!l)return;const{tl:h,br:f,pixelRatio:m}=l;for(let _=e;_<i;_++)this.paintVertexArray.emplace(_,h[0],h[1],f[0],f[1],m)}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent||!this.expression.isLightConstant))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class P{constructor(e,i,n=()=>!0){this.binders={},this._buffers=[];const s=[];for(const l in e.paint._values){const h=e.paint.get(l);if(!n(l)||!(h instanceof Ts&&ul(h.property.specification)))continue;const f=O(l,e.type),m=h.value,_=h.property.specification.type,y=!!h.property.useIntegerZoom,v=l==="line-dasharray"||l.endsWith("pattern"),w=l==="line-dasharray"&&e.layout.get("line-cap").value.kind!=="constant";if(m.kind!=="constant"||w)if(m.kind==="source"||w||v){const E=Z(l,_,"source");this.binders[l]=v?new C(m,f,_,E,e.id):new M(m,f,_,E),s.push(`/a_${l}`)}else{const E=Z(l,_,"composite");this.binders[l]=new S(m,f,_,y,i,E),s.push(`/z_${l}`)}else this.binders[l]=v?new T(m.value,f):new b(m.value,f,_),s.push(`/u_${l}`)}this.cacheKey=s.sort().join("")}getMaxValue(e){const i=this.binders[e];return i instanceof M||i instanceof S?i.maxValue:0}populatePaintArrays(e,i,n,s,l,h,f){for(const m in this.binders){const _=this.binders[m];(_ instanceof M||_ instanceof S||_ instanceof C)&&_.populatePaintArray(e,i,n,s,l,h,f)}}setConstantPatternPositions(e){for(const i in this.binders){const n=this.binders[i];n instanceof T&&n.setConstantPatternPositions(e)}}updatePaintArrays(e,i,n,s,l,h,f,m){let _=!1;const y=Object.keys(e),v=y.length!==0,w=v?y:i.uniqueIds;for(const E in this.binders){const A=this.binders[E];if((A instanceof M||A instanceof S||A instanceof C)&&(A.expression.isStateDependent===!0||A.expression.isLightConstant===!1)){const I=l.paint.get(E);A.expression=I.value;for(const z of w){const L=e[z.toString()];i.eachPosition(z,(N,G,j)=>{const X=s.feature(N);A.updatePaintArray(G,j,X,L,h,f,m)})}if(!v)for(const z of n.uniqueIds){const L=e[z.toString()];n.eachPosition(z,(N,G,j)=>{const X=s.feature(N);A.updatePaintArray(G,j,X,L,h,f,m)})}_=!0}}return _}defines(){const e=[];for(const i in this.binders){const n=this.binders[i];(n instanceof b||n instanceof T)&&e.push(...n.uniformNames.map(s=>`#define HAS_UNIFORM_${s}`))}return e}getBinderAttributes(){const e=[];for(const i in this.binders){const n=this.binders[i];if(n instanceof M||n instanceof S||n instanceof C)for(let s=0;s<n.paintVertexAttributes.length;s++)e.push(n.paintVertexAttributes[s].name)}return e}getBinderUniforms(){const e=[];for(const i in this.binders){const n=this.binders[i];if(n instanceof b||n instanceof T||n instanceof S)for(const s of n.uniformNames)e.push(s)}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e){const i=[];for(const n in this.binders){const s=this.binders[n];if(s instanceof b||s instanceof T||s instanceof S)for(const l of s.uniformNames)i.push({name:l,property:n,binding:s.getBinding(e,l)})}return i}setUniforms(e,i,n,s,l){for(const{name:h,property:f,binding:m}of n)this.binders[f].setUniform(e,m,l,s.get(f),h)}updatePaintBuffers(){this._buffers=[];for(const e in this.binders){const i=this.binders[e];(i instanceof M||i instanceof S||i instanceof C)&&i.paintVertexBuffer&&this._buffers.push(i.paintVertexBuffer)}}upload(e){for(const i in this.binders){const n=this.binders[i];(n instanceof M||n instanceof S||n instanceof C)&&n.upload(e)}this.updatePaintBuffers()}destroy(){for(const e in this.binders){const i=this.binders[e];(i instanceof M||i instanceof S||i instanceof C)&&i.destroy()}}}class k{constructor(e,i,n=()=>!0){this.programConfigurations={};for(const s of e)this.programConfigurations[s.id]=new P(s,i,n);this.needsUpload=!1,this._featureMap=new Ca,this._featureMapWithoutIds=new Ca,this._bufferOffset=0,this._idlessCounter=0}populatePaintArrays(e,i,n,s,l,h,f,m){for(const _ in this.programConfigurations)this.programConfigurations[_].populatePaintArrays(e,i,s,l,h,f,m);i.id!==void 0?this._featureMap.add(i.id,n,this._bufferOffset,e):(this._featureMapWithoutIds.add(this._idlessCounter,n,this._bufferOffset,e),this._idlessCounter+=1),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,i,n,s,l,h){for(const f of n)this.needsUpload=this.programConfigurations[f.id].updatePaintArrays(e,this._featureMap,this._featureMapWithoutIds,i,f,s,l,h||0)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(const i in this.programConfigurations)this.programConfigurations[i].upload(e);this.needsUpload=!1}}destroy(){for(const e in this.programConfigurations)this.programConfigurations[e].destroy()}}const R={"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-emissive-strength":["emissive_strength"],"icon-emissive-strength":["emissive_strength"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["ga
7pwidth"],"line-pattern":["pattern","pixel_ratio"],"fill-pattern":["pattern","pixel_ratio"],"fill-extrusion-pattern":["pattern","pixel_ratio"],"line-dasharray":["dash"]};function O(t,e){return R[t]||[t.replace(`${e}-`,"").replace(/-/g,"_")]}const D={"line-pattern":{source:fo,composite:fo},"fill-pattern":{source:fo,composite:fo},"fill-extrusion-pattern":{source:fo,composite:fo},"line-dasharray":{source:Es,composite:Es}},F={color:{source:Ma,composite:ho},number:{source:wa,composite:Ma}};function Z(t,e,i){const n=D[t];return n&&n[i]||F[e][i]}Ke(b,"ConstantBinder"),Ke(T,"PatternConstantBinder"),Ke(M,"SourceExpressionBinder"),Ke(C,"PatternCompositeBinder"),Ke(S,"CompositeExpressionBinder"),Ke(P,"ProgramConfiguration",{omit:["_buffers"]}),Ke(k,"ProgramConfigurationSet");const V=qe/Math.PI/2,q=5,B=6,$=16383,Y=64,K=[Y,32,16],ee=-V,ce=V;function re(t,e,i,n=V){return i=qt(i),[t*Math.sin(i)*n,-e*n,t*Math.cos(i)*n]}function me(t,e,i){return re(Math.cos(qt(t)),Math.sin(qt(t)),e,i)}const fe=63710088e-1,Ae=2*Math.PI*fe;class ne{constructor(e,i){if(isNaN(e)||isNaN(i))throw new Error(`Invalid LngLat object: (${e}, ${i})`);if(this.lng=+e,this.lat=+i,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new ne(Hn(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){const i=Math.PI/180,n=this.lat*i,s=e.lat*i,l=Math.sin(n)*Math.sin(s)+Math.cos(n)*Math.cos(s)*Math.cos((e.lng-this.lng)*i);return fe*Math.acos(Math.min(l,1))}
vendor: 15,535 bytes, line 7
7toBounds(e=0){const i=360*e/40075017,n=i/Math.cos(Math.PI/180*this.lat);return new he({lng:this.lng-n,lat:this.lat-i},{lng:this.lng+n,lat:this.lat+i})}toEcef(e){return me(this.lat,this.lng,V+e*V/fe)}static convert(e){if(e instanceof ne)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new ne(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e!==null)return new ne(Number("lng"in e?e.lng:e.lon),Number(e.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}}class he{constructor(e,i){e&&(i?this.setSouthWest(e).setNorthEast(i):e.length===4?this.setSouthWest([e[0],e[1]]).setNorthEast([e[2],e[3]]):this.setSouthWest(e[0]).setNorthEast(e[1]))}setNorthEast(e){return this._ne=e instanceof ne?new ne(e.lng,e.lat):ne.convert(e),this}setSouthWest(e){return this._sw=e instanceof ne?new ne(e.lng,e.lat):ne.convert(e),this}extend(e){const i=this._sw,n=this._ne;let s,l;if(e instanceof ne)s=e,l=e;else{if(!(e instanceof he))return Array.isArray(e)?e.length===4||e.every(Array.isArray)?this.extend(he.convert(e)):this.extend(ne.convert(e)):typeof e=="object"&&e!==null&&e.hasOwnProperty("lat")&&(e.hasOwnProperty("lon")||e.hasOwnProperty("lng"))?this.extend(ne.convert(e)):this;if(s=e._sw,l=e._ne,!s||!l)return this}return i||n?(i.lng=Math.min(s.lng,i.lng),i.lat=Math.min(s.lat,i.lat),n.lng=Math.max(l.lng,n.lng),n.lat=Math.max(l.lat,n.lat)):(this._sw=new ne(s.lng,s.lat),this._ne=new ne(l.lng,l.lat)),this}getCenter(){return new ne((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 ne(this.getWest(),this.getNorth())}getSouthEast(){return new ne(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(e){const{lng:i,lat:n}=ne.convert(e);let s=this._sw.lng<=i&&i<=this._ne.lng;return this._sw.lng>this._ne.lng&&(s=this._sw.lng>=i&&i>=this._ne.lng),this._sw.lat<=n&&n<=this._ne.lat&&s}static convert(e){return!e||e instanceof he?e:new he(e)}}var Q={};(function(t,e){(function(i){function n(l,h,f){var m=s(256*l,256*(h=Math.pow(2,f)-h-1),f),_=s(256*(l+1),256*(h+1),f);return m[0]+","+m[1]+","+_[0]+","+_[1]}function s(l,h,f){var m=2*Math.PI*6378137/256/Math.pow(2,f);return[l*m-2*Math.PI*6378137/2,h*m-2*Math.PI*6378137/2]}i.getURL=function(l,h,f,m,_,y){return y=y||{},l+"?"+["bbox="+n(f,m,_),"format="+(y.format||"image/png"),"service="+(y.service||"WMS"),"version="+(y.version||"1.1.1"),"request="+(y.request||"GetMap"),"srs="+(y.srs||"EPSG:3857"),"width="+(y.width||256),"height="+(y.height||256),"layers="+h].join("&")},i.getTileBBox=n,i.getMercCoords=s,Object.defineProperty(i,"__esModule",{value:!0})})(e)})(0,Q);var ae=Q;class Ie{constructor(e,i,n){this.z=e,this.x=i,this.y=n,this.key=je(0,e,e,i,n)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,i){const n=ae.getTileBBox(this.x,this.y,this.z),s=function(l,h,f){let m,_="";for(let y=l;y>0;y--)m=1<<y-1,_+=(h&m?1:0)+(f&m?2:0);return _}(this.z,this.x,this.y);return e[(this.x+this.y)%e.length].replace("{prefix}",(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String(i==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace("{quadkey}",s).replace("{bbox-epsg-3857}",n)}toString(){return`${this.z}/${this.x}/${this.y}`}}class Re{constructor(e,i){this.wrap=e,this.canonical=i,this.key=je(e,i.z,i.z,i.x,i.y)}}class Le{constructor(e,i,n,s,l){this.overscaledZ=e,this.wrap=i,this.canonical=new Ie(n,+s,+l),this.key=i===0&&e===n?this.canonical.key:je(i,e,n,s,l)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){const i=this.canonical.z-e;return e>this.canonical.z?new Le(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Le(e,this.wrap,e,this.canonical.x>>i,this.canonical.y>>i)}calculateScaledKey(e,i=!0){if(this.overscaledZ===e&&i)return this.key;if(e>this.canonical.z)return je(this.wrap*+i,e,this.canonical.z,this.canonical.x,this.canonical.y);{const n=this.canonical.z-e;return je(this.wrap*+i,e,e,this.canonical.x>>n,this.canonical.y>>n)}}isChildOf(e){if(e.wrap!==this.wrap)return!1;const i=this.canonical.z-e.canonical.z;return e.overscaledZ===0||e.overscaledZ<this.overscaledZ&&e.canonical.z<this.canonical.z&&e.canonical.x===this.canonical.x>>i&&e.canonical.y===this.canonical.y>>i}children(e){if(this.overscaledZ>=e)return[new Le(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const i=this.canonical.z+1,n=2*this.canonical.x,s=2*this.canonical.y;return[new Le(i,this.wrap,i,n,s),new Le(i,this.wrap,i,n+1,s),new Le(i,this.wrap,i,n,s+1),new Le(i,this.wrap,i,n+1,s+1)]}isLessThan(e){return this.wrap<e.wrap||!(this.wrap>e.wrap)&&(this.overscaledZ<e.overscaledZ||!(this.overscaledZ>e.overscaledZ)&&(this.canonical.x<e.canonical.x||!(this.canonical.x>e.canonical.x)&&this.canonical.y<e.canonical.y))}wrapped(){return new Le(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new Le(this.overscaledZ,e,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new Re(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}}function je(t,e,i,n,s){const l=1<<Math.min(i,22);let h=l*(s%l)+n%l;return t&&i<22&&(h+=l*l*((t<0?-2*t-1:2*t)%(1<<2*(22-i)))),16*(32*h+i)+(e-i)}const et=[t=>{let e=t.canonical.x-1,i=t.wrap;return e<0&&(e=(1<<t.canonical.z)-1,i--),new Le(t.overscaledZ,i,t.canonical.z,e,t.canonical.y)},t=>{let e=t.canonical.x+1,i=t.wrap;return e===1<<t.canonical.z&&(e=0,i++),new Le(t.overscaledZ,i,t.canonical.z,e,t.canonical.y)},t=>new Le(t.overscaledZ,t.wrap,t.canonical.z,t.canonical.x,(t.canonical.y===0?1<<t.canonical.z:t.canonical.y)-1),t=>new Le(t.overscaledZ,t.wrap,t.canonical.z,t.canonical.x,t.canonical.y===(1<<t.canonical.z)-1?0:t.canonical.y+1)];Ke(Ie,"CanonicalTileID"),Ke(Le,"OverscaledTileID",{omit:["projMatrix","expandedProjMatrix"]});const ct=0,nt=25.5;function at(t){return Ae*Math.cos(t*Math.PI/180)}function Et(t){return(180+t)/360}function gt(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function bt(t,e){return t/at(e)}function vt(t){return 360*t-180}function Zt(t){return 360/Math.PI*Math.atan(Math.exp((180-360*t)*Math.PI/180))-90}function _i(t,e){return t*at(Zt(e))}const Ot=85.051129;function Pi(t){return Math.cos(qt(Dt(t,-Ot,Ot)))}function Bt(t,e){const i=Dt(e,ct,nt),n=Math.pow(2,i);return Pi(t)*Ae/(512*n)}function Kt(t){return 1/Math.cos(t*Math.PI/180)}function Ft(t,e=0){const i=Math.exp(Math.PI*(1-(t.y+e/qe)/(1<<t.z)*2));return 80150034*i/(i*i+1)/qe/(1<<t.z)}class Yt{constructor(e,i,n=0){this.x=+e,this.y=+i,this.z=+n}static fromLngLat(e,i=0){const n=ne.convert(e);return new Yt(Et(n.lng),gt(n.lat),bt(i,n.lat))}toLngLat(){return new ne(vt(this.x),Zt(this.y))}toAltitude(){return _i(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/Ae*Kt(Zt(this.y))}}function xi(t,e,i,n,s,l,h,f,m){const _=(e+n)/2,y=(i+s)/2,v=new Ue(_,y);f(v),function(w,E,A,I,z,L){const N=A-z,G=I-L;return Math.abs((I-E)*N-(A-w)*G)/Math.hypot(N,G)}(v.x,v.y,l.x,l.y,h.x,h.y)>=m?(xi(t,e,i,_,y,l,v,f,m),xi(t,_,y,n,s,v,h,f,m)):t.push(h)}function ii(t,e,i){let n=t[0],s=n.x,l=n.y;e(n);const h=[n];for(let f=1;f<t.length;f++){const m=t[f],{x:_,y}=m;e(m),xi(h,s,l,_,y,n,m,e,i),s=_,l=y,n=m}return h}function Qi(t,e,i,n){if(n(e,i)){const s=e.add(i)._mult(.5);Qi(t,e,s,n),Qi(t,s,i,n)}else t.push(i)}function ur(t,e){let i=t[0];const n=[i];for(let s=1;s<t.length;s++){const l=t[s];Qi(n,i,l,e),i=l}return n}const Pr=Math.pow(2,14)-1,bn=-Pr-1;function zr(t,e){const i=Math.round(t.x*e),n=Math.round(t.y*e);return t.x=Dt(i,bn,Pr),t.y=Dt(n,bn,Pr),(i<t.x||i>t.x+1||n<t.y||n>t.y+1)&&ki("Geometry exceeds allowed extent, reduce your vector tile buffer size"),t}function er(t,e,i){const n=t.loadGeometry(),s=t.extent,l=qe/s;if(e&&i&&i.projection.isReprojectedInTileSpace){const h=1<<e.z,{scale:f,x:m,y:_,projection:y}=i,v=w=>{const E=vt((e.x+w.x/s)/h),A=Zt((e.y+w.y/s)/h),I=y.project(E,A);w.x=(I.x*f-m)*s,w.y=(I.y*f-_)*s};for(let w=0;w<n.length;w++)if(t.type!==1)n[w]=ii(n[w],v,1);else{const E=[];for(const A of n[w])A.x<0||A.x>=s||A.y<0||A.y>=s||(v(A),E.push(A));n[w]=E}}for(const h of n)for(const f of h)zr(f,l);return n}function Hi(t,e){return{type:t.type,id:t.id,properties:t.properties,geometry:e?er(t):[]}}function yr(t,e,i,n,s){t.emplaceBack(2*e+(n+1)/2,2*i+(s+1)/2)}function Tr(t,e,i){t.emplaceBack(e.x,e.y,e.z,i[0]*16384,i[1]*16384,i[2]*16384)}class Dr{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(i=>i.fqid),this.index=e.index,this.hasPattern=!1,this.projection=e.projection,this.layoutVertexArray=new cn,this.indexArray=new Ji,this.segments=new Oi,this.programConfigurations=new k(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id)}populate(e,i,n,s){const l=this.layers[0],h=[];let f=null;l.type==="circle"&&(f=l.layout.get("circle-sort-key"));for(const{feature:_,id:y,index:v,sourceLayerIndex:w}of e){const E=this.layers[0]._featureFilter.needGeometry,A=Hi(_,E);if(!this.layers[0]._featureFilter.filter(new Ii(this.zoom),A,n))continue;const I=f?f.evaluate(A,{},n):void 0,z={id:y,properties:_.properties,type:_.type,sourceLayerIndex:w,index:v,geometry:E?A.geometry:er(_,n,s),patterns:{},sortKey:I};h.push(z)}f&&h.sort((_,y)=>_.sortKey-y.sortKey);let m=null;s.projection.name==="globe"&&(this.globeExtVertexArray=new xl,m=s.projection);for(const _ of h){const{geometry:y,index:v,sourceLayerIndex:w}=_,E=e[v].feature;this.addFeature(_,y,v,i.availableImages,n,m,i.brightness),i.featureIndex.insert(E,y,v,w,this.index)}}update(e,i,n,s,l){const h=Object.keys(e).length!==0;h&&!this.stateDependentLayers.length||this.programConfigurations.updatePaintArrays(e,i,h?this.stateDependentLayers:this.layers,n,s,l)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,_f.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.globeExtVertexArray&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,Vh.members))),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy())}addFeature(e,i,n,s,l,h,f){for(const m of i)for(const _ of m){const y=_.x,v=_.y;if(y<0||y>=qe||v<0||v>=qe)continue;if(h){const A=h.projectTilePoint(y,v,l),I=h.upVector(l,y,v),z=this.globeExtVertexArray;Tr(z,A,I),Tr(z,A,I),Tr(z,A,I),Tr(z,A,I)}const w=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),E=w.vertexLength;yr(this.layoutVertexArray,y,v,-1,-1),yr(this.layoutVertexArray,y,v,1,-1),yr(this.layoutVertexArray,y,v,1,1),yr(this.layoutVertexArray,y,v,-1,1),this.indexArray.emplaceBack(E,E+1,E+2),this.indexArray.emplaceBack(E,E+2,E+3),w.vertexLength+=4,w.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,{},s,l,f)}}function wn(t,e){for(let i=0;i<t.length;i++)if(On(e,t[i]))return!0;for(let i=0;i<e.length;i++)if(On(t,e[i]))return!0;return!!za(t,e)}function _o(t,e,i){return!!On(t,e)||!!Da(e,t,i)}function Go(t,e){if(t.length===1)return El(e,t[0]);for(let i=0;i<e.length;i++){const n=e[i];for(let s=0;s<n.length;s++)if(On(t,n[s]))return!0}for(let i=0;i<t.length;i++)if(El(e,t[i]))return!0;for(let i=0;i<e.length;i++)if(za(t,e[i]))return!0;return!1}function Pa(t,e,i){if(t.length>1){if(za(t,e))return!0;for(let n=0;n<e.length;n++)if(Da(e[n],t,i))return!0}for(let n=0;n<t.length;n++)if(Da(t[n],e,i))return!0;return!1}function za(t,e){if(t.length===0||e.length===0)return!1;for(let i=0;i<t.length-1;i++){const n=t[i],s=t[i+1];for(let l=0;l<e.length-1;l++)if(wu(n,s,e[l],e[l+1]))return!0}return!1}function wu(t,e,i,n){return Gr(t,i,n)!==Gr(e,i,n)&&Gr(t,e,i)!==Gr(t,e,n)}function Da(t,e,i){const n=i*i;if(e.length===1)return t.distSqr(e[0])<n;for(let s=1;s<e.length;s++)if(As(t,e[s-1],e[s])<n)return!0;return!1}function As(t,e,i){const n=e.distSqr(i);if(n===0)return t.distSqr(e);const s=((t.x-e.x)*(i.x-e.x)+(t.y-e.y)*(i.y-e.y))/n;return t.distSqr(s<0?e:s>1?i:i.sub(e)._mult(s)._add(e))}function El(t,e){let i,n,s,l=!1;for(let h=0;h<t.length;h++){i=t[h];for(let f=0,m=i.length-1;f<i.length;m=f++)n=i[f],s=i[m],n.y>e.y!=s.y>e.y&&e.x<(s.x-n.x)*(e.y-n.y)/(s.y-n.y)+n.x&&(l=!l)}return l}function On(t,e){let i=!1;for(let n=0,s=t.length-1;n<t.length;s=n++){const l=t[n],h=t[s];l.y>e.y!=h.y>e.y&&e.x<(h.x-l.x)*(e.y-l.y)/(h.y-l.y)+l.x&&(i=!i)}return i}function Fp(t,e,i,n,s){for(const h of t)if(e<=h.x&&i<=h.y&&n>=h.x&&s>=h.y)return!0;const l=[new Ue(e,i),new Ue(e,s),new Ue(n,s),new Ue(n,i)];if(t.length>2){for(const h of l)if(On(t,h))return!0}for(let h=0;h<t.length-1;h++)if(Hy(t[h],t[h+1],l))return!0;return!1}function Hy(t,e,i){const n=i[0],s=i[2];if(t.x<n.x&&e.x<n.x||t.x>s.x&&e.x>s.x||t.y<n.y&&e.y<n.y||t.y>s.y&&e.y>s.y)return!1;const l=Gr(t,e,i[0]);return l!==Gr(t,e,i[1])||l!==Gr(t,e,i[2])||l!==Gr(t,e,i[3])}function Sl(t,e,i,n,s,l){let h=e.y-t.y,f=t.x-e.x;if(l=l||0){const m=h*h+f*f;if(m===0)return!0;const _=Math.sqrt(m);h/=_,f/=_}return!((i.x-t.x)*h+(i.y-t.y)*f-l<0||(n.x-t.x)*h+(n.y-t.y)*f-l<0||(s.x-t.x)*h+(s.y-t.y)*f-l<0)}function gf(t,e,i,n,s,l,h){return!(Sl(t,e,n,s,l,h)||Sl(e,i,n,s,l,h)||Sl(i,t,n,s,l,h)||Sl(n,s,t,e,i,h)||Sl(s,l,t,e,i,h)||Sl(l,n,t,e,i,h))}function Al(t,e,i){const n=e.paint.get(t).value;return n.kind==="constant"?n.value:i.programConfigurations.get(e.id).getMaxValue(t)}function Hh(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function Np(t,e,i,n,s){if(!e[0]&&!e[1])return t;const l=Ue.convert(e)._mult(s);i==="viewport"&&l._rotate(-n);const h=[];for(let f=0;f<t.length;f++)h.push(t[f].sub(l));return h}function Vp(t,e,i,n){const s=Ue.convert(t)._mult(n);return e==="viewport"&&s._rotate(-i),s}Ke(Dr,"CircleBucket",{omit:["layers"]});const Xy=new Ci({"circle-sort-key":new ut(le.layout_circle["circle-sort-key"]),visibility:new Oe(le.layout_circle.visibility)});var Yy={paint:new Ci({"circle-radius":new ut(le.paint_circle["circle-radius"]),"circle-color":new ut(le.paint_circle["circle-color"]),"circle-blur":new ut(le.paint_circle["circle-blur"]),"circle-opacity":new ut(le.paint_circle["circle-opacity"]),"circle-translate":new Oe(le.paint_circle["circle-translate"]),"circle-translate-anchor":new Oe(le.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new Oe(le.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new Oe(le.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new ut(le.paint_circle["circle-stroke-width"]),"circle-stroke-color":new ut(le.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new ut(le.paint_circle["circle-stroke-opacity"]),"circle-emissive-strength":new Oe(le.paint_circle["circle-emissive-strength"])}),layout:Xy},tr={},ir={};
7Object.defineProperty(ir,"__esModule",{value:!0}),ir.setMatrixArrayType=function(t){ir.ARRAY_TYPE=jp=t},ir.toRadian=function(t){return t*Jy},ir.equals=function(t,e){return Math.abs(t-e)<=Up*Math.max(1,Math.abs(t),Math.abs(e))},ir.RANDOM=ir.ARRAY_TYPE=ir.EPSILON=void 0;var Up=1e-6;ir.EPSILON=Up;var jp=typeof Float32Array<"u"?Float32Array:Array;ir.ARRAY_TYPE=jp;var Ky=Math.random;ir.RANDOM=Ky;var Jy=Math.PI/180;Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)});var zi={};function yf(t){return yf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},yf(t)}Object.defineProperty(zi,"__esModule",{value:!0}),zi.create=function(){var t=new Is.ARRAY_TYPE(4);return Is.ARRAY_TYPE!=Float32Array&&(t[1]=0,t[2]=0),t[0]=1,t[3]=1,t},zi.clone=function(t){var e=new Is.ARRAY_TYPE(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e},zi.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t},zi.identity=function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t},zi.fromValues=function(t,e,i,n){var s=new Is.ARRAY_TYPE(4);return s[0]=t,s[1]=e,s[2]=i,s[3]=n,s},zi.set=function(t,e,i,n,s){return t[0]=e,t[1]=i,t[2]=n,t[3]=s,t},zi.transpose=function(t,e){if(t===e){var i=e[1];t[1]=e[2],t[2]=i}else t[0]=e[0],t[1]=e[2],t[2]=e[1],t[3]=e[3];return t},zi.invert=function(t,e){var i=e[0],n=e[1],s=e[2],l=e[3],h=i*l-s*n;return h?(t[0]=l*(h=1/h),t[1]=-n*h,t[2]=-s*h,t[3]=i*h,t):null},zi.adjoint=function(t,e){var i=e[0];return t[0]=e[3],t[1]=-e[1],t[2]=-e[2],t[3]=i,t},zi.determinant=function(t){return t[0]*t[3]-t[2]*t[1]},zi.multiply=Zp,zi.rotate=function(t,e,i){var n=e[0],s=e[1],l=e[2],h=e[3],f=Math.sin(i),m=Math.cos(i);return t[0]=n*m+l*f,t[1]=s*m+h*f,t[2]=n*-f+l*m,t[3]=s*-f+h*m,t},zi.scale=function(t,e,i){var n=e[1],s=e[2],l=e[3],h=i[0],f=i[1];return t[0]=e[0]*h,t[1]=n*h,t[2]=s*f,t[3]=l*f,t},zi.fromRotation=function(t,e){var i=Math.sin(e),n=Math.cos(e);return t[0]=n,t[1]=i,t[2]=-i,t[3]=n,t},zi.fromScaling=function(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=e[1],t},zi.str=function(t){return"mat2("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},zi.frob=function(t){return Math.hypot(t[0],t[1],t[2],t[3])},zi.LDU=function(t,e,i,n){return t[2]=n[2]/n[0],i[0]=n[0],i[1]=n[1],i[3]=n[3]-t[2]*i[1],[t,e,i]},zi.add=function(t,e,i){return t[0]=e[0]+i[0],t[1]=e[1]+i[1],t[2]=e[2]+i[2],t[3]=e[3]+i[3],t},zi.subtract=qp,zi.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]},zi.equals=function(t,e){var i=t[0],n=t[1],s=t[2],l=t[3],h=e[0],f=e[1],m=e[2],_=e[3];return Math.abs(i-h)<=Is.EPSILON*Math.max(1,Math.abs(i),Math.abs(h))&&Math.abs(n-f)<=Is.EPSILON*Math.max(1,Math.abs(n),Math.abs(f))&&Math.abs(s-m)<=Is.EPSILON*Math.max(1,Math.abs(s),Math.abs(m))&&Math.abs(l-_)<=Is.EPSILON*Math.max(1,Math.abs(l),Math.abs(_))},zi.multiplyScalar=function(t,e,i){return t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t[3]=e[3]*i,t},zi.multiplyScalarAndAdd=function(t,e,i,n){return t[0]=e[0]+i[0]*n,t[1]=e[1]+i[1]*n,t[2]=e[2]+i[2]*n,t[3]=e[3]+i[3]*n,t},zi.sub=zi.mul=void 0;var Is=function(t,e){if(t&&t.__esModule)return t;if(t===null||yf(t)!=="object"&&typeof t!="function")return{default:t};var i=Gp(void 0);if(i&&i.has(t))return i.get(t);var n={},s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in t)if(l!=="default"&&Object.prototype.hasOwnProperty.call(t,l)){var h=s?Object.getOwnPropertyDescriptor(t,l):null;h&&(h.get||h.set)?Object.defineProperty(n,l,h):n[l]=t[l]}return n.default=t,i&&i.set(t,n),n}(ir);function Gp(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,i=new WeakMap;return(Gp=function(n){return n?i:e})(t)}function Zp(t,e,i){var n=e[0],s=e[1],l=e[2],h=e[3],f=i[0],m=i[1],_=i[2],y=i[3];return t[0]=n*f+l*m,t[1]=s*f+h*m,t[2]=n*_+l*y,t[3]=s*_+h*y,t}function qp(t,e,i){return t[0]=e[0]-i[0],t[1]=e[1]-i[1],t[2]=e[2]-i[2],t[3]=e[3]-i[3],t}zi.mul=Zp,zi.sub=qp;var Li={};function xf(t){return xf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},xf(t)}Object.defineProperty(Li,"__esModule",{value:!0}),Li.create=function(){var t=new go.ARRAY_TYPE(6);return go.ARRAY_TYPE!=Float32Array&&(t[1]=0,t[2]=0,t[4]=0,t[5]=0),t[0]=1,t[3]=1,t},Li.clone=function(t){var e=new go.ARRAY_TYPE(6);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e},Li.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t},Li.identity=function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t}
7,Li.fromValues=function(t,e,i,n,s,l){var h=new go.ARRAY_TYPE(6);return h[0]=t,h[1]=e,h[2]=i,h[3]=n,h[4]=s,h[5]=l,h},Li.set=function(t,e,i,n,s,l,h){return t[0]=e,t[1]=i,t[2]=n,t[3]=s,t[4]=l,t[5]=h,t},Li.invert=function(t,e){var i=e[0],n=e[1],s=e[2],l=e[3],h=e[4],f=e[5],m=i*l-n*s;return m?(t[0]=l*(m=1/m),t[1]=-n*m,t[2]=-s*m,t[3]=i*m,t[4]=(s*f-l*h)*m,t[5]=(n*h-i*f)*m,t):null},Li.determinant=function(t){return t[0]*t[3]-t[1]*t[2]},Li.multiply=Wp,Li.rotate=function(t,e,i){var n=e[0],s=e[1],l=e[2],h=e[3],f=e[4],m=e[5],_=Math.sin(i),y=Math.cos(i);return t[0]=n*y+l*_,t[1]=s*y+h*_,t[2]=n*-_+l*y,t[3]=s*-_+h*y,t[4]=f,t[5]=m,t},Li.scale=function(t,e,i){var n=e[1],s=e[2],l=e[3],h=e[4],f=e[5],m=i[0],_=i[1];return t[0]=e[0]*m,t[1]=n*m,t[2]=s*_,t[3]=l*_,t[4]=h,t[5]=f,t},Li.translate=function(t,e,i){var n=e[0],s=e[1],l=e[2],h=e[3],f=e[4],m=e[5],_=i[0],y=i[1];return t[0]=n,t[1]=s,t[2]=l,t[3]=h,t[4]=n*_+l*y+f,t[5]=s*_+h*y+m,t},Li.fromRotation=function(t,e){var i=Math.sin(e),n=Math.cos(e);return t[0]=n,t[1]=i,t[2]=-i,t[3]=n,t[4]=0,t[5]=0,t},Li.fromScaling=function(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=e[1],t[4]=0,t[5]=0,t},Li.fromTranslation=function(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=e[0],t[5]=e[1],t},Li.str=function(t){return"mat2d("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+")"},Li.frob=function(t){return Math.hypot(t[0],t[1],t[2],t[3],t[4],t[5],1)},Li.add=function(t,e,i){return t[0]=e[0]+i[0],t[1]=e[1]+i[1],t[2]=e[2]+i[2],t[3]=e[3]+i[3],t[4]=e[4]+i[4],t[5]=e[5]+i[5],t},Li.subtract=Hp,Li.multiplyScalar=function(t,e,i){return t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t[3]=e[3]*i,t[4]=e[4]*i,t[5]=e[5]*i,t},Li.multiplyScalarAndAdd=function(t,e,i,n){return t[0]=e[0]+i[0]*n,t[1]=e[1]+i[1]*n,t[2]=e[2]+i[2]*n,t[3]=e[3]+i[3]*n,t[4]=e[4]+i[4]*n,t[5]=e[5]+i[5]*n,t},Li.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]},Li.equals=function(t,e){var i=t[0],n=t[1],s=t[2],l=t[3],h=t[4],f=t[5],m=e[0],_=e[1],y=e[2],v=e[3],w=e[4],E=e[5];return Math.abs(i-m)<=go.EPSILON*Math.max(1,Math.abs(i),Math.abs(m))&&Math.abs(n-_)<=go.EPSILON*Math.max(1,Math.abs(n),Math.abs(_))&&Math.abs(s-y)<=go.EPSILON*Math.max(1,Math.abs(s),Math.abs(y))&&Math.abs(l-v)<=go.EPSILON*Math.max(1,Math.abs(l),Math.abs(v))&&Math.abs(h-w)<=go.EPSILON*Math.max(1,Math.abs(h),Math.abs(w))&&Math.abs(f-E)<=go.EPSILON*Math.max(1,Math.abs(f),Math.abs(E))},Li.sub=Li.mul=void 0;var go=function(t,e){if(t&&t.__esModule)return t;if(t===null||xf(t)!=="object"&&typeof t!="function")return{default:t};var i=$p(void 0);if(i&&i.has(t))return i.get(t);var n={},s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in t)if(l!=="default"&&Object.prototype.hasOwnProperty.call(t,l)){var h=s?Object.getOwnPropertyDescriptor(t,l):null;h&&(h.get||h.set)?Object.defineProperty(n,l,h):n[l]=t[l]}return n.default=t,i&&i.set(t,n),n}(ir);function $p(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,i=new WeakMap;return($p=function(n){return n?i:e})(t)}function Wp(t,e,i){var n=e[0],s=e[1],l=e[2],h=e[3],f=e[4],m=e[5],_=i[0],y=i[1],v=i[2],w=i[3],E=i[4],A=i[5];return t[0]=n*_+l*y,t[1]=s*_+h*y,t[2]=n*v+l*w,t[3]=s*v+h*w,t[4]=n*E+l*A+f,t[5]=s*E+h*A+m,t}function Hp(t,e,i){return t[0]=e[0]-i[0],t[1]=e[1]-i[1],t[2]=e[2]-i[2],t[3]=e[3]-i[3],t[4]=e[4]-i[4],t[5]=e[5]-i[5],t}Li.mul=Wp,Li.sub=Hp;var pi={};function vf(t){return vf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},vf(t)}Object.defineProperty(pi,"__esModule",{value:!0}),pi.create=function(){var t=new un.ARRAY_TYPE(9);return un.ARRAY_TYPE!=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},pi.fromMat4=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[4],t[4]=e[5],t[5]=e[6],t[6]=e[8],t[7]=e[9],t[8]=e[10],t},pi.clone=function(t){var e=new un.ARRAY_TYPE(9);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e},pi.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t}
7,pi.fromValues=function(t,e,i,n,s,l,h,f,m){var _=new un.ARRAY_TYPE(9);return _[0]=t,_[1]=e,_[2]=i,_[3]=n,_[4]=s,_[5]=l,_[6]=h,_[7]=f,_[8]=m,_},pi.set=function(t,e,i,n,s,l,h,f,m,_){return t[0]=e,t[1]=i,t[2]=n,t[3]=s,t[4]=l,t[5]=h,t[6]=f,t[7]=m,t[8]=_,t},pi.identity=function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},pi.transpose=function(t,e){if(t===e){var i=e[1],n=e[2],s=e[5];t[1]=e[3],t[2]=e[6],t[3]=i,t[5]=e[7],t[6]=n,t[7]=s}else t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8];return t},pi.invert=function(t,e){var i=e[0],n=e[1],s=e[2],l=e[3],h=e[4],f=e[5],m=e[6],_=e[7],y=e[8],v=y*h-f*_,w=-y*l+f*m,E=_*l-h*m,A=i*v+n*w+s*E;return A?(t[0]=v*(A=1/A),t[1]=(-y*n+s*_)*A,t[2]=(f*n-s*h)*A,t[3]=w*A,t[4]=(y*i-s*m)*A,t[5]=(-f*i+s*l)*A,t[6]=E*A,t[7]=(-_*i+n*m)*A,t[8]=(h*i-n*l)*A,t):null},pi.adjoint=function(t,e){var i=e[0],n=e[1],s=e[2],l=e[3],h=e[4],f=e[5],m=e[6],_=e[7],y=e[8];return t[0]=h*y-f*_,t[1]=s*_-n*y,t[2]=n*f-s*h,t[3]=f*m-l*y,t[4]=i*y-s*m,t[5]=s*l-i*f,t[6]=l*_-h*m,t[7]=n*m-i*_,t[8]=i*h-n*l,t},pi.determinant=function(t){var e=t[3],i=t[4],n=t[5],s=t[6],l=t[7],h=t[8];return t[0]*(h*i-n*l)+t[1]*(-h*e+n*s)+t[2]*(l*e-i*s)},pi.multiply=Yp,pi.translate=function(t,e,i){var n=e[0],s=e[1],l=e[2],h=e[3],f=e[4],m=e[5],_=e[6],y=e[7],v=e[8],w=i[0],E=i[1];return t[0]=n,t[1]=s,t[2]=l,t[3]=h,t[4]=f,t[5]=m,t[6]=w*n+E*h+_,t[7]=w*s+E*f+y,t[8]=w*l+E*m+v,t},pi.rotate=function(t,e,i){var n=e[0],s=e[1],l=e[2],h=e[3],f=e[4],m=e[5],_=e[6],y=e[7],v=e[8],w=Math.sin(i),E=Math.cos(i);return t[0]=E*n+w*h,t[1]=E*s+w*f,t[2]=E*l+w*m,t[3]=E*h-w*n,t[4]=E*f-w*s,t[5]=E*m-w*l,t[6]=_,t[7]=y,t[8]=v,t},pi.scale=function(t,e,i){var n=i[0],s=i[1];return t[0]=n*e[0],t[1]=n*e[1],t[2]=n*e[2],t[3]=s*e[3],t[4]=s*e[4],t[5]=s*e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t},pi.fromTranslation=function(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=e[0],t[7]=e[1],t[8]=1,t},pi.fromRotation=function(t,e){var i=Math.sin(e),n=Math.cos(e);return t[0]=n,t[1]=i,t[2]=0,t[3]=-i,t[4]=n,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},pi.fromScaling=function(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=e[1],t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},pi.fromMat2d=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=0,t[3]=e[2],t[4]=e[3],t[5]=0,t[6]=e[4],t[7]=e[5],t[8]=1,t},pi.fromQuat=function(t,e){var i=e[0],n=e[1],s=e[2],l=e[3],h=i+i,f=n+n,m=s+s,_=i*h,y=n*h,v=n*f,w=s*h,E=s*f,A=s*m,I=l*h,z=l*f,L=l*m;return t[0]=1-v-A,t[3]=y-L,t[6]=w+z,t[1]=y+L,t[4]=1-_-A,t[7]=E-I,t[2]=w-z,t[5]=E+I,t[8]=1-_-v,t},pi.normalFromMat4=function(t,e){var i=e[0],n=e[1],s=e[2],l=e[3],h=e[4],f=e[5],m=e[6],_=e[7],y=e[8],v=e[9],w=e[10],E=e[11],A=e[12],I=e[13],z=e[14],L=e[15],N=i*f-n*h,G=i*m-s*h,j=i*_-l*h,X=n*m-s*f,W=n*_-l*f,J=s*_-l*m,ie=y*I-v*A,oe=y*z-w*A,ue=y*L-E*A,se=v*z-w*I,_e=v*L-E*I,Me=w*L-E*z,pe=N*Me-G*_e+j*se+X*ue-W*oe+J*ie;return pe?(t[0]=(f*Me-m*_e+_*se)*(pe=1/pe),t[1]=(m*ue-h*Me-_*oe)*pe,t[2]=(h*_e-f*ue+_*ie)*pe,t[3]=(s*_e-n*Me-l*se)*pe,t[4]=(i*Me-s*ue+l*oe)*pe,t[5]=(n*ue-i*_e-l*ie)*pe,t[6]=(I*J-z*W+L*X)*pe,t[7]=(z*j-A*J-L*G)*pe,t[8]=(A*W-I*j+L*N)*pe,t):null},pi.projection=function(t,e,i){return t[0]=2/e,t[1]=0,t[2]=0,t[3]=0,t[4]=-2/i,t[5]=0,t[6]=-1,t[7]=1,t[8]=1,t},pi.str=function(t){return"mat3("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+")"},pi.frob=function(t){return Math.hypot(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8])},pi.add=function(t,e,i){return t[0]=e[0]+i[0],t[1]=e[1]+i[1],t[2]=e[2]+i[2],t[3]=e[3]+i[3],t[4]=e[4]+i[4],t[5]=e[5]+i[5],t[6]=e[6]+i[6],t[7]=e[7]+i[7],t[8]=e[8]+i[8],t},pi.subtract=Kp,pi.multiplyScalar=function(t,e,i){return t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t[3]=e[3]*i,t[4]=e[4]*i,t[5]=e[5]*i,t[6]=e[6]*i,t[7]=e[7]*i,t[8]=e[8]*i,t},pi.multiplyScalarAndAdd=function(t,e,i,n){return t[0]=e[0]+i[0]*n,t[1]=e[1]+i[1]*n,t[2]=e[2]+i[2]*n,t[3]=e[3]+i[3]*n,t[4]=e[4]+i[4]*n,t[5]=e[5]+i[5]*n,t[6]=e[6]+i[6]*n,t[7]=e[7]+i[7]*n,t[8]=e[8]+i[8]*n,t},pi.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]&&t[8]===e[8]},pi.equals=function(t,e){var i=t[0],n=t[1],s=t[2],l=t[3],h=t[4],f=t[5],m=t[6],_=t[7],y=t[8],v=e[0],w=e[1],E=e[2],A=e[3],I=e[4],z=e[5],L=e[6],N=e[7],G=e[8];return Math.abs(i-v)<=un.EPSILON*Math.max(1,Math.abs(i),Math.abs(v))&&Math.abs(n-w)<=un.EPSILON*Math.max(1,Math.abs(n),Math.abs(w))&&Math.abs(s-E)<=un.EPSILON*Math.max(1,Math.abs(s),Math.abs(E))&&Math.abs(l-A)<=un.EPSILON*Math.max(1,Math.abs(l),Math.abs(A))&&Math.abs(h-I)<=un.EPSILON*Math.max(1,Math.abs(h),Math.abs(I))&&Math.abs(f-z)<=un.EPSILON*Math.max(1,Math.abs(f),Math.abs(z))&&Math.abs(m-L)<=un.EPSILON*Math.max(1,Math.abs(m),Math.abs(L))&&Math.abs(_-N)<=un.EPSILON*Math.max(1,Math.abs(_),Math.abs(N))&&Math.abs(y-G)<=un.EPSILON*Math.max(1,Math.abs(y),Math.abs(G))},pi.sub=pi.mul=void 0;var un=function(t,e){if(t&&t.__esModule)return t;if(t===null||vf(t)!=="object"&&typeof t!="function")return{default:t};var i=Xp(void 0);if(i&&i.has(t))return i.get(t);var n={},s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in t)if(l!=="default"&&Object.prototype.hasOwnProperty.call(t,l)){var h=s?Object.getOwnPropertyDescriptor(t,l):null;h&&(h.get||h.set)?Object.defineProperty(n,l,h):n[l]=t[l]}return n.default=t,i&&i.set(t,n),n}(ir);function Xp(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,i=new WeakMap;return(Xp=function(n){return n?i:e})(t)}function Yp(t,e,i){var n=e[0],s=e[1],l=e[2],h=e[3],f=e[4],m=e[5],_=e[6],y=e[7],v=e[8],w=i[0],E=i[1],A=i[2],I=i[3],z=i[4],L=i[5],N=i[6],G=i[7],j=i[8];return t[0]=w*n+E*h+A*_,t[1]=w*s+E*f+A*y,t[2]=w*l+E*m+A*v,t[3]=I*n+z*h+L*_,t[4]=I*s+z*f+L*y,t[5]=I*l+z*m+L*v,t[6]=N*n+G*h+j*_,t[7]=N*s+G*f+j*y,t[8]=N*l+G*m+j*v,t}function Kp(t,e,i){return t[0]=e[0]-i[0],t[1]=e[1]-i[1],t[2]=e[2]-i[2],t[3]=e[3]-i[3],t[4]=e[4]-i[4],t[5]=e[5]-i[5],t[6]=e[6]-i[6],t[7]=e[7]-i[7],t[8]=e[8]-i[8],t}pi.mul=Yp,pi.sub=Kp;var At={};function bf(t){return bf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},bf(t)}
vendor: 4,080 bytes, line 7
7Object.defineProperty(At,"__esModule",{value:!0}),At.create=function(){var t=new Fi.ARRAY_TYPE(16);return Fi.ARRAY_TYPE!=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},At.clone=function(t){var e=new Fi.ARRAY_TYPE(16);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},At.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},At.fromValues=function(t,e,i,n,s,l,h,f,m,_,y,v,w,E,A,I){var z=new Fi.ARRAY_TYPE(16);return z[0]=t,z[1]=e,z[2]=i,z[3]=n,z[4]=s,z[5]=l,z[6]=h,z[7]=f,z[8]=m,z[9]=_,z[10]=y,z[11]=v,z[12]=w,z[13]=E,z[14]=A,z[15]=I,z},At.set=function(t,e,i,n,s,l,h,f,m,_,y,v,w,E,A,I,z){return t[0]=e,t[1]=i,t[2]=n,t[3]=s,t[4]=l,t[5]=h,t[6]=f,t[7]=m,t[8]=_,t[9]=y,t[10]=v,t[11]=w,t[12]=E,t[13]=A,t[14]=I,t[15]=z,t},At.identity=Qp,At.transpose=function(t,e){if(t===e){var i=e[1],n=e[2],s=e[3],l=e[6],h=e[7],f=e[11];t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=i,t[6]=e[9],t[7]=e[13],t[8]=n,t[9]=l,t[11]=e[14],t[12]=s,t[13]=h,t[14]=f}else t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15];return t},At.invert=function(t,e){var i=e[0],n=e[1],s=e[2],l=e[3],h=e[4],f=e[5],m=e[6],_=e[7],y=e[8],v=e[9],w=e[10],E=e[11],A=e[12],I=e[13],z=e[14],L=e[15],N=i*f-n*h,G=i*m-s*h,j=i*_-l*h,X=n*m-s*f,W=n*_-l*f,J=s*_-l*m,ie=y*I-v*A,oe=y*z-w*A,ue=y*L-E*A,se=v*z-w*I,_e=v*L-E*I,Me=w*L-E*z,pe=N*Me-G*_e+j*se+X*ue-W*oe+J*ie;return pe?(t[0]=(f*Me-m*_e+_*se)*(pe=1/pe),t[1]=(s*_e-n*Me-l*se)*pe,t[2]=(I*J-z*W+L*X)*pe,t[3]=(w*W-v*J-E*X)*pe,t[4]=(m*ue-h*Me-_*oe)*pe,t[5]=(i*Me-s*ue+l*oe)*pe,t[6]=(z*j-A*J-L*G)*pe,t[7]=(y*J-w*j+E*G)*pe,t[8]=(h*_e-f*ue+_*ie)*pe,t[9]=(n*ue-i*_e-l*ie)*pe,t[10]=(A*W-I*j+L*N)*pe,t[11]=(v*j-y*W-E*N)*pe,t[12]=(f*oe-h*se-m*ie)*pe,t[13]=(i*se-n*oe+s*ie)*pe,t[14]=(I*G-A*X-z*N)*pe,t[15]=(y*X-v*G+w*N)*pe,t):null},At.adjoint=function(t,e){var i=e[0],n=e[1],s=e[2],l=e[3],h=e[4],f=e[5],m=e[6],_=e[7],y=e[8],v=e[9],w=e[10],E=e[11],A=e[12],I=e[13],z=e[14],L=e[15];return t[0]=f*(w*L-E*z)-v*(m*L-_*z)+I*(m*E-_*w),t[1]=-(n*(w*L-E*z)-v*(s*L-l*z)+I*(s*E-l*w)),t[2]=n*(m*L-_*z)-f*(s*L-l*z)+I*(s*_-l*m),t[3]=-(n*(m*E-_*w)-f*(s*E-l*w)+v*(s*_-l*m)),t[4]=-(h*(w*L-E*z)-y*(m*L-_*z)+A*(m*E-_*w)),t[5]=i*(w*L-E*z)-y*(s*L-l*z)+A*(s*E-l*w),t[6]=-(i*(m*L-_*z)-h*(s*L-l*z)+A*(s*_-l*m)),t[7]=i*(m*E-_*w)-h*(s*E-l*w)+y*(s*_-l*m),t[8]=h*(v*L-E*I)-y*(f*L-_*I)+A*(f*E-_*v),t[9]=-(i*(v*L-E*I)-y*(n*L-l*I)+A*(n*E-l*v)),t[10]=i*(f*L-_*I)-h*(n*L-l*I)+A*(n*_-l*f),t[11]=-(i*(f*E-_*v)-h*(n*E-l*v)+y*(n*_-l*f)),t[12]=-(h*(v*z-w*I)-y*(f*z-m*I)+A*(f*w-m*v)),t[13]=i*(v*z-w*I)-y*(n*z-s*I)+A*(n*w-s*v),t[14]=-(i*(f*z-m*I)-h*(n*z-s*I)+A*(n*m-s*f)),t[15]=i*(f*w-m*v)-h*(n*w-s*v)+y*(n*m-s*f),t},At.determinant=function(t){var e=t[0],i=t[1],n=t[2],s=t[3],l=t[4],h=t[5],f=t[6],m=t[7],_=t[8],y=t[9],v=t[10],w=t[11],E=t[12],A=t[13],I=t[14],z=t[15];return(e*h-i*l)*(v*z-w*I)-(e*f-n*l)*(y*z-w*A)+(e*m-s*l)*(y*I-v*A)+(i*f-n*h)*(_*z-w*E)-(i*m-s*h)*(_*I-v*E)+(n*m-s*f)*(_*A-y*E)},At.multiply=em,At.translate=function(t,e,i){var n,s,l,h,f,m,_,y,v,w,E,A,I=i[0],z=i[1],L=i[2];return e===t?(t[12]=e[0]*I+e[4]*z+e[8]*L+e[12],t[13]=e[1]*I+e[5]*z+e[9]*L+e[13],t[14]=e[2]*I+e[6]*z+e[10]*L+e[14],t[15]=e[3]*I+e[7]*z+e[11]*L+e[15]):(s=e[1],l=e[2],h=e[3],f=e[4],m=e[5],_=e[6],y=e[7],v=e[8],w=e[9],E=e[10],A=e[11],t[0]=n=e[0],t[1]=s,t[2]=l,t[3]=h,t[4]=f,t[5]=m,t[6]=_,t[7]=y,t[8]=v,t[9]=w,t[10]=E,t[11]=A,t[12]=n*I+f*z+v*L+e[12],t[13]=s*I+m*z+w*L+e[13],t[14]=l*I+_*z+E*L+e[14],t[15]=h*I+y*z+A*L+e[15]),t},At.scale=function(t,e,i){var n=i[0],s=i[1],l=i[2];return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*s,t[5]=e[5]*s,t[6]=e[6]*s,t[7]=e[7]*s,t[8]=e[8]*l,t[9]=e[9]*l,t[10]=e[10]*l,t[11]=e[11]*l,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}
7,At.rotate=function(t,e,i,n){var s,l,h,f,m,_,y,v,w,E,A,I,z,L,N,G,j,X,W,J,ie,oe,ue,se,_e=n[0],Me=n[1],pe=n[2],we=Math.hypot(_e,Me,pe);return we<Fi.EPSILON?null:(_e*=we=1/we,Me*=we,pe*=we,s=Math.sin(i),l=Math.cos(i),m=e[1],_=e[2],y=e[3],w=e[5],E=e[6],A=e[7],z=e[9],L=e[10],N=e[11],G=_e*_e*(h=1-l)+l,W=_e*Me*h-pe*s,J=Me*Me*h+l,ie=pe*Me*h+_e*s,oe=_e*pe*h+Me*s,ue=Me*pe*h-_e*s,se=pe*pe*h+l,t[0]=(f=e[0])*G+(v=e[4])*(j=Me*_e*h+pe*s)+(I=e[8])*(X=pe*_e*h-Me*s),t[1]=m*G+w*j+z*X,t[2]=_*G+E*j+L*X,t[3]=y*G+A*j+N*X,t[4]=f*W+v*J+I*ie,t[5]=m*W+w*J+z*ie,t[6]=_*W+E*J+L*ie,t[7]=y*W+A*J+N*ie,t[8]=f*oe+v*ue+I*se,t[9]=m*oe+w*ue+z*se,t[10]=_*oe+E*ue+L*se,t[11]=y*oe+A*ue+N*se,e!==t&&(t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t)},At.rotateX=function(t,e,i){var n=Math.sin(i),s=Math.cos(i),l=e[4],h=e[5],f=e[6],m=e[7],_=e[8],y=e[9],v=e[10],w=e[11];return e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=l*s+_*n,t[5]=h*s+y*n,t[6]=f*s+v*n,t[7]=m*s+w*n,t[8]=_*s-l*n,t[9]=y*s-h*n,t[10]=v*s-f*n,t[11]=w*s-m*n,t},At.rotateY=function(t,e,i){var n=Math.sin(i),s=Math.cos(i),l=e[0],h=e[1],f=e[2],m=e[3],_=e[8],y=e[9],v=e[10],w=e[11];return e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=l*s-_*n,t[1]=h*s-y*n,t[2]=f*s-v*n,t[3]=m*s-w*n,t[8]=l*n+_*s,t[9]=h*n+y*s,t[10]=f*n+v*s,t[11]=m*n+w*s,t},At.rotateZ=function(t,e,i){var n=Math.sin(i),s=Math.cos(i),l=e[0],h=e[1],f=e[2],m=e[3],_=e[4],y=e[5],v=e[6],w=e[7];return e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=l*s+_*n,t[1]=h*s+y*n,t[2]=f*s+v*n,t[3]=m*s+w*n,t[4]=_*s-l*n,t[5]=y*s-h*n,t[6]=v*s-f*n,t[7]=w*s-m*n,t},At.fromTranslation=function(t,e){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]=e[0],t[13]=e[1],t[14]=e[2],t[15]=1,t},At.fromScaling=function(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e[1],t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e[2],t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},At.fromRotation=function(t,e,i){var n,s,l,h=i[0],f=i[1],m=i[2],_=Math.hypot(h,f,m);return _<Fi.EPSILON?null:(h*=_=1/_,f*=_,m*=_,n=Math.sin(e),s=Math.cos(e),t[0]=h*h*(l=1-s)+s,t[1]=f*h*l+m*n,t[2]=m*h*l-f*n,t[3]=0,t[4]=h*f*l-m*n,t[5]=f*f*l+s,t[6]=m*f*l+h*n,t[7]=0,t[8]=h*m*l+f*n,t[9]=f*m*l-h*n,t[10]=m*m*l+s,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t)},At.fromXRotation=function(t,e){var i=Math.sin(e),n=Math.cos(e);return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=n,t[6]=i,t[7]=0,t[8]=0,t[9]=-i,t[10]=n,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},At.fromYRotation=function(t,e){var i=Math.sin(e),n=Math.cos(e);return t[0]=n,t[1]=0,t[2]=-i,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=i,t[9]=0,t[10]=n,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},At.fromZRotation=function(t,e){var i=Math.sin(e),n=Math.cos(e);return t[0]=n,t[1]=i,t[2]=0,t[3]=0,t[4]=-i,t[5]=n,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},At.fromRotationTranslation=tm,At.fromQuat2=function(t,e){var i=new Fi.ARRAY_TYPE(3),n=-e[0],s=-e[1],l=-e[2],h=e[3],f=e[4],m=e[5],_=e[6],y=e[7],v=n*n+s*s+l*l+h*h;return v>0?(i[0]=2*(f*h+y*n+m*l-_*s)/v,i[1]=2*(m*h+y*s+_*n-f*l)/v,i[2]=2*(_*h+y*l+f*s-m*n)/v):(i[0]=2*(f*h+y*n+m*l-_*s),i[1]=2*(m*h+y*s+_*n-f*l),i[2]=2*(_*h+y*l+f*s-m*n)),tm(t,e,i),t},At.getTranslation=function(t,e){return t[0]=e[12],t[1]=e[13],t[2]=e[14],t},At.getScaling=im,At.getRotation=function(t,e){var i=new Fi.ARRAY_TYPE(3);im(i,e);var n=1/i[0],s=1/i[1],l=1/i[2],h=e[0]*n,f=e[1]*s,m=e[2]*l,_=e[4]*n,y=e[5]*s,v=e[6]*l,w=e[8]*n,E=e[9]*s,A=e[10]*l,I=h+y+A,z=0;return I>0?(z=2*Math.sqrt(I+1),t[3]=.25*z,t[0]=(v-E)/z,t[1]=(w-m)/z,t[2]=(f-_)/z):h>y&&h>A?(z=2*Math.sqrt(1+h-y-A),t[3]=(v-E)/z,t[0]=.25*z,t[1]=(f+_)/z,t[2]=(w+m)/z):y>A?(z=2*Math.sqrt(1+y-h-A),t[3]=(w-m)/z,t[0]=(f+_)/z,t[1]=.25*z,t[2]=(v+E)/z):(z=2*Math.sqrt(1+A-h-y),t[3]=(f-_)/z,t[0]=(w+m)/z,t[1]=(v+E)/z,t[2]=.25*z),t},At.fromRotationTranslationScale=function(t,e,i,n){var s=e[0],l=e[1],h=e[2],f=e[3],m=s+s,_=l+l,y=h+h,v=s*m,w=s*_,E=s*y,A=l*_,I=l*y,z=h*y,L=f*m,N=f*_,G=f*y,j=n[0],X=n[1],W=n[2];return t[0]=(1-(A+z))*j,t[1]=(w+G)*j,t[2]=(E-N)*j,t[3]=0,t[4]=(w-G)*X,t[5]=(1-(v+z))*X,t[6]=(I+L)*X,t[7]=0,t[8]=(E+N)*W,t[9]=(I-L)*W,t[10]=(1-(v+A))*W,t[11]=0,t[12]=i[0],t[13]=i[1],t[14]=i[2],t[15]=1,t}
7,At.fromRotationTranslationScaleOrigin=function(t,e,i,n,s){var l=e[0],h=e[1],f=e[2],m=e[3],_=l+l,y=h+h,v=f+f,w=l*_,E=l*y,A=l*v,I=h*y,z=h*v,L=f*v,N=m*_,G=m*y,j=m*v,X=n[0],W=n[1],J=n[2],ie=s[0],oe=s[1],ue=s[2],se=(1-(I+L))*X,_e=(E+j)*X,Me=(A-G)*X,pe=(E-j)*W,we=(1-(w+L))*W,de=(z+N)*W,be=(A+G)*J,Fe=(z-N)*J,Se=(1-(w+I))*J;return t[0]=se,t[1]=_e,t[2]=Me,t[3]=0,t[4]=pe,t[5]=we,t[6]=de,t[7]=0,t[8]=be,t[9]=Fe,t[10]=Se,t[11]=0,t[12]=i[0]+ie-(se*ie+pe*oe+be*ue),t[13]=i[1]+oe-(_e*ie+we*oe+Fe*ue),t[14]=i[2]+ue-(Me*ie+de*oe+Se*ue),t[15]=1,t},At.fromQuat=function(t,e){var i=e[0],n=e[1],s=e[2],l=e[3],h=i+i,f=n+n,m=s+s,_=i*h,y=n*h,v=n*f,w=s*h,E=s*f,A=s*m,I=l*h,z=l*f,L=l*m;return t[0]=1-v-A,t[1]=y+L,t[2]=w-z,t[3]=0,t[4]=y-L,t[5]=1-_-A,t[6]=E+I,t[7]=0,t[8]=w+z,t[9]=E-I,t[10]=1-_-v,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},At.frustum=function(t,e,i,n,s,l,h){var f=1/(i-e),m=1/(s-n),_=1/(l-h);return t[0]=2*l*f,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=2*l*m,t[6]=0,t[7]=0,t[8]=(i+e)*f,t[9]=(s+n)*m,t[10]=(h+l)*_,t[11]=-1,t[12]=0,t[13]=0,t[14]=h*l*2*_,t[15]=0,t},At.perspectiveNO=rm,At.perspectiveZO=function(t,e,i,n,s){var l,h=1/Math.tan(e/2);return t[0]=h/i,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=h,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,s!=null&&s!==1/0?(t[10]=s*(l=1/(n-s)),t[14]=s*n*l):(t[10]=-1,t[14]=-n),t},At.perspectiveFromFieldOfView=function(t,e,i,n){var s=Math.tan(e.upDegrees*Math.PI/180),l=Math.tan(e.downDegrees*Math.PI/180),h=Math.tan(e.leftDegrees*Math.PI/180),f=Math.tan(e.rightDegrees*Math.PI/180),m=2/(h+f),_=2/(s+l);return t[0]=m,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=_,t[6]=0,t[7]=0,t[8]=-(h-f)*m*.5,t[9]=(s-l)*_*.5,t[10]=n/(i-n),t[11]=-1,t[12]=0,t[13]=0,t[14]=n*i/(i-n),t[15]=0,t},At.orthoNO=nm,At.orthoZO=function(t,e,i,n,s,l,h){var f=1/(e-i),m=1/(n-s),_=1/(l-h);return t[0]=-2*f,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*m,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=_,t[11]=0,t[12]=(e+i)*f,t[13]=(s+n)*m,t[14]=l*_,t[15]=1,t},At.lookAt=function(t,e,i,n){var s,l,h,f,m,_,y,v,w,E,A=e[0],I=e[1],z=e[2],L=n[0],N=n[1],G=n[2],j=i[0],X=i[1],W=i[2];return Math.abs(A-j)<Fi.EPSILON&&Math.abs(I-X)<Fi.EPSILON&&Math.abs(z-W)<Fi.EPSILON?Qp(t):(y=A-j,v=I-X,w=z-W,s=N*(w*=E=1/Math.hypot(y,v,w))-G*(v*=E),l=G*(y*=E)-L*w,h=L*v-N*y,(E=Math.hypot(s,l,h))?(s*=E=1/E,l*=E,h*=E):(s=0,l=0,h=0),f=v*h-w*l,m=w*s-y*h,_=y*l-v*s,(E=Math.hypot(f,m,_))?(f*=E=1/E,m*=E,_*=E):(f=0,m=0,_=0),t[0]=s,t[1]=f,t[2]=y,t[3]=0,t[4]=l,t[5]=m,t[6]=v,t[7]=0,t[8]=h,t[9]=_,t[10]=w,t[11]=0,t[12]=-(s*A+l*I+h*z),t[13]=-(f*A+m*I+_*z),t[14]=-(y*A+v*I+w*z),t[15]=1,t)},At.targetTo=function(t,e,i,n){var s=e[0],l=e[1],h=e[2],f=n[0],m=n[1],_=n[2],y=s-i[0],v=l-i[1],w=h-i[2],E=y*y+v*v+w*w;E>0&&(y*=E=1/Math.sqrt(E),v*=E,w*=E);var A=m*w-_*v,I=_*y-f*w,z=f*v-m*y;return(E=A*A+I*I+z*z)>0&&(A*=E=1/Math.sqrt(E),I*=E,z*=E),t[0]=A,t[1]=I,t[2]=z,t[3]=0,t[4]=v*z-w*I,t[5]=w*A-y*z,t[6]=y*I-v*A,t[7]=0,t[8]=y,t[9]=v,t[10]=w,t[11]=0,t[12]=s,t[13]=l,t[14]=h,t[15]=1,t},At.str=function(t){return"mat4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+", "+t[9]+", "+t[10]+", "+t[11]+", "+t[12]+", "+t[13]+", "+t[14]+", "+t[15]+")"},At.frob=function(t){return Math.hypot(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8],t[9],t[10],t[11],t[12],t[13],t[14],t[15])},At.add=function(t,e,i){return t[0]=e[0]+i[0],t[1]=e[1]+i[1],t[2]=e[2]+i[2],t[3]=e[3]+i[3],t[4]=e[4]+i[4],t[5]=e[5]+i[5],t[6]=e[6]+i[6],t[7]=e[7]+i[7],t[8]=e[8]+i[8],t[9]=e[9]+i[9],t[10]=e[10]+i[10],t[11]=e[11]+i[11],t[12]=e[12]+i[12],t[13]=e[13]+i[13],t[14]=e[14]+i[14],t[15]=e[15]+i[15],t},At.subtract=om,At.multiplyScalar=function(t,e,i){return t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t[3]=e[3]*i,t[4]=e[4]*i,t[5]=e[5]*i,t[6]=e[6]*i,t[7]=e[7]*i,t[8]=e[8]*i,t[9]=e[9]*i,t[10]=e[10]*i,t[11]=e[11]*i,t[12]=e[12]*i,t[13]=e[13]*i,t[14]=e[14]*i,t[15]=e[15]*i,t},At.multiplyScalarAndAdd=function(t,e,i,n){return t[0]=e[0]+i[0]*n,t[1]=e[1]+i[1]*n,t[2]=e[2]+i[2]*n,t[3]=e[3]+i[3]*n,t[4]=e[4]+i[4]*n,t[5]=e[5]+i[5]*n,t[6]=e[6]+i[6]*n,t[7]=e[7]+i[7]*n,t[8]=e[8]+i[8]*n,t[9]=e[9]+i[9]*n,t[10]=e[10]+i[10]*n,t[11]=e[11]+i[11]*n,t[12]=e[12]+i[12]*n,t[13]=e[13]+i[13]*n,t[14]=e[14]+i[14]*n,t[15]=e[15]+i[15]*n,t},At.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]&&t[8]===e[8]&&t[9]===e[9]&&t[10]===e[10]&&t[11]===e[11]&&t[12]===e[12]&&t[13]===e[13]&&t[14]===e[14]&&t[15]===e[15]},At.equals=function(t,e){var i=t[0],n=t[1],s=t[2],l=t[3],h=t[4],f=t[5],m=t[6],_=t[7],y=t[8],v=t[9],w=t[10],E=t[11],A=t[12],I=t[13],z=t[14],L=t[15],N=e[0],G=e[1],j=e[2],X=e[3],W=e[4],J=e[5],ie=e[6],oe=e[7],ue=e[8],se=e[9],_e=e[10],Me=e[11],pe=e[12],we=e[13],de=e[14],be=e[15];return Math.abs(i-N)<=Fi.EPSILON*Math.max(1,Math.abs(i),Math.abs(N))&&Math.abs(n-G)<=Fi.EPSILON*Math.max(1,Math.abs(n),Math.abs(G))&&Math.abs(s-j)<=Fi.EPSILON*Math.max(1,Math.abs(s),Math.abs(j))&&Math.abs(l-X)<=Fi.EPSILON*Math.max(1,Math.abs(l),Math.abs(X))&&Math.abs(h-W)<=Fi.EPSILON*Math.max(1,Math.abs(h),Math.abs(W))&&Math.abs(f-J)<=Fi.EPSILON*Math.max(1,Math.abs(f),Math.abs(J))&&Math.abs(m-ie)<=Fi.EPSILON*Math.max(1,Math.abs(m),Math.abs(ie))&&Math.abs(_-oe)<=Fi.EPSILON*Math.max(1,Math.abs(_),Math.abs(oe))&&Math.abs(y-ue)<=Fi.EPSILON*Math.max(1,Math.abs(y),Math.abs(ue))&&Math.abs(v-se)<=Fi.EPSILON*Math.max(1,Math.abs(v),Math.abs(se))&&Math.abs(w-_e)<=Fi.EPSILON*Math.max(1,Math.abs(w),Math.abs(_e))&&Math.abs(E-Me)<=Fi.EPSILON*Math.max(1,Math.abs(E),Math.abs(Me))&&Math.abs(A-pe)<=Fi.EPSILON*Math.max(1,Math.abs(A),Math.abs(pe))&&Math.abs(I-we)<=Fi.EPSILON*Math.max(1,Math.abs(I),Math.abs(we))&&Math.abs(z-de)<=Fi.EPSILON*Math.max(1,Math.abs(z),Math.abs(de))&&Math.abs(L-be)<=Fi.EPSILON*Math.max(1,Math.abs(L),Math.abs(be))},At.sub=At.mul=At.ortho=At.perspective=void 0;var Fi=function(t,e){if(t&&t.__esModule)return t;if(t===null||bf(t)!=="object"&&typeof t!="function")return{default:t};var i=Jp(void 0);if(i&&i.has(t))return i.get(t);var n={},s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in t)if(l!=="default"&&Object.prototype.hasOwnProperty.call(t,l)){var h=s?Object.getOwnPropertyDescriptor(t,l):null;h&&(h.get||h.set)?Object.defineProperty(n,l,h):n[l]=t[l]}return n.default=t,i&&i.set(t,n),n}(ir);function Jp(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,i=new WeakMap;return(Jp=function(n){return n?i:e})(t)}function Qp(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 em(t,e,i){var n=e[0],s=e[1],l=e[2],h=e[3],f=e[4],m=e[5],_=e[6],y=e[7],v=e[8],w=e[9],E=e[10],A=e[11],I=e[12],z=e[13],L=e[14],N=e[15],G=i[0],j=i[1],X=i[2],W=i[3];return t[0]=G*n+j*f+X*v+W*I,t[1]=G*s+j*m+X*w+W*z,t[2]=G*l+j*_+X*E+W*L,t[3]=G*h+j*y+X*A+W*N,t[4]=(G=i[4])*n+(j=i[5])*f+(X=i[6])*v+(W=i[7])*I,t[5]=G*s+j*m+X*w+W*z,t[6]=G*l+j*_+X*E+W*L,t[7]=G*h+j*y+X*A+W*N,t[8]=(G=i[8])*n+(j=i[9])*f+(X=i[10])*v+(W=i[11])*I,t[9]=G*s+j*m+X*w+W*z,t[10]=G*l+j*_+X*E+W*L,t[11]=G*h+j*y+X*A+W*N,t[12]=(G=i[12])*n+(j=i[13])*f+(X=i[14])*v+(W=i[15])*I,t[13]=G*s+j*m+X*w+W*z,t[14]=G*l+j*_+X*E+W*L,t[15]=G*h+j*y+X*A+W*N,t}function tm(t,e,i){var n=e[0],s=e[1],l=e[2],h=e[3],f=n+n,m=s+s,_=l+l,y=n*f,v=n*m,w=n*_,E=s*m,A=s*_,I=l*_,z=h*f,L=h*m,N=h*_;return t[0]=1-(E+I),t[1]=v+N,t[2]=w-L,t[3]=0,t[4]=v-N,t[5]=1-(y+I),t[6]=A+z,t[7]=0,t[8]=w+L,t[9]=A-z,t[10]=1-(y+E),t[11]=0,t[12]=i[0],t[13]=i[1],t[14]=i[2],t[15]=1,t}function im(t,e){var i=e[4],n=e[5],s=e[6],l=e[8],h=e[9],f=e[10];return t[0]=Math.hypot(e[0],e[1],e[2]),t[1]=Math.hypot(i,n,s),t[2]=Math.hypot(l,h,f),t}function rm(t,e,i,n,s){var l,h=1/Math.tan(e/2);return t[0]=h/i,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=h,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,s!=null&&s!==1/0?(t[10]=(s+n)*(l=1/(n-s)),t[14]=2*s*n*l):(t[10]=-1,t[14]=-2*n),t}function nm(t,e,i,n,s,l,h){var f=1/(e-i),m=1/(n-s),_=1/(l-h);return t[0]=-2*f,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*m,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*_,t[11]=0,t[12]=(e+i)*f,t[13]=(s+n)*m,t[14]=(h+l)*_,t[15]=1,t}function om(t,e,i){return t[0]=e[0]-i[0],t[1]=e[1]-i[1],t[2]=e[2]-i[2],t[3]=e[3]-i[3],t[4]=e[4]-i[4],t[5]=e[5]-i[5],t[6]=e[6]-i[6],t[7]=e[7]-i[7],t[8]=e[8]-i[8],t[9]=e[9]-i[9],t[10]=e[10]-i[10],t[11]=e[11]-i[11],t[12]=e[12]-i[12],t[13]=e[13]-i[13],t[14]=e[14]-i[14],t[15]=e[15]-i[15],t}At.perspective=rm,At.ortho=nm,At.mul=em,At.sub=om;var Tt={},St={};function wf(t){return wf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},wf(t)}
vendor: 4,193 bytes, line 7
7Object.defineProperty(St,"__esModule",{value:!0}),St.create=am,St.clone=function(t){var e=new Zo.ARRAY_TYPE(3);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e},St.length=lm,St.fromValues=function(t,e,i){var n=new Zo.ARRAY_TYPE(3);return n[0]=t,n[1]=e,n[2]=i,n},St.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t},St.set=function(t,e,i,n){return t[0]=e,t[1]=i,t[2]=n,t},St.add=function(t,e,i){return t[0]=e[0]+i[0],t[1]=e[1]+i[1],t[2]=e[2]+i[2],t},St.subtract=cm,St.multiply=um,St.divide=hm,St.ceil=function(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t[2]=Math.ceil(e[2]),t},St.floor=function(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t[2]=Math.floor(e[2]),t},St.min=function(t,e,i){return t[0]=Math.min(e[0],i[0]),t[1]=Math.min(e[1],i[1]),t[2]=Math.min(e[2],i[2]),t},St.max=function(t,e,i){return t[0]=Math.max(e[0],i[0]),t[1]=Math.max(e[1],i[1]),t[2]=Math.max(e[2],i[2]),t},St.round=function(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t[2]=Math.round(e[2]),t},St.scale=function(t,e,i){return t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t},St.scaleAndAdd=function(t,e,i,n){return t[0]=e[0]+i[0]*n,t[1]=e[1]+i[1]*n,t[2]=e[2]+i[2]*n,t},St.distance=dm,St.squaredDistance=fm,St.squaredLength=pm,St.negate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t},St.inverse=function(t,e){return t[0]=1/e[0],t[1]=1/e[1],t[2]=1/e[2],t},St.normalize=function(t,e){var i=e[0],n=e[1],s=e[2],l=i*i+n*n+s*s;return l>0&&(l=1/Math.sqrt(l)),t[0]=e[0]*l,t[1]=e[1]*l,t[2]=e[2]*l,t},St.dot=mm,St.cross=function(t,e,i){var n=e[0],s=e[1],l=e[2],h=i[0],f=i[1],m=i[2];return t[0]=s*m-l*f,t[1]=l*h-n*m,t[2]=n*f-s*h,t},St.lerp=function(t,e,i,n){var s=e[0],l=e[1],h=e[2];return t[0]=s+n*(i[0]-s),t[1]=l+n*(i[1]-l),t[2]=h+n*(i[2]-h),t},St.hermite=function(t,e,i,n,s,l){var h=l*l,f=h*(2*l-3)+1,m=h*(l-2)+l,_=h*(l-1),y=h*(3-2*l);return t[0]=e[0]*f+i[0]*m+n[0]*_+s[0]*y,t[1]=e[1]*f+i[1]*m+n[1]*_+s[1]*y,t[2]=e[2]*f+i[2]*m+n[2]*_+s[2]*y,t},St.bezier=function(t,e,i,n,s,l){var h=1-l,f=h*h,m=l*l,_=f*h,y=3*l*f,v=3*m*h,w=m*l;return t[0]=e[0]*_+i[0]*y+n[0]*v+s[0]*w,t[1]=e[1]*_+i[1]*y+n[1]*v+s[1]*w,t[2]=e[2]*_+i[2]*y+n[2]*v+s[2]*w,t},St.random=function(t,e){e=e||1;var i=2*Zo.RANDOM()*Math.PI,n=2*Zo.RANDOM()-1,s=Math.sqrt(1-n*n)*e;return t[0]=Math.cos(i)*s,t[1]=Math.sin(i)*s,t[2]=n*e,t},St.transformMat4=function(t,e,i){var n=e[0],s=e[1],l=e[2],h=i[3]*n+i[7]*s+i[11]*l+i[15];return t[0]=(i[0]*n+i[4]*s+i[8]*l+i[12])/(h=h||1),t[1]=(i[1]*n+i[5]*s+i[9]*l+i[13])/h,t[2]=(i[2]*n+i[6]*s+i[10]*l+i[14])/h,t},St.transformMat3=function(t,e,i){var n=e[0],s=e[1],l=e[2];return t[0]=n*i[0]+s*i[3]+l*i[6],t[1]=n*i[1]+s*i[4]+l*i[7],t[2]=n*i[2]+s*i[5]+l*i[8],t},St.transformQuat=function(t,e,i){var n=i[0],s=i[1],l=i[2],h=e[0],f=e[1],m=e[2],_=s*m-l*f,y=l*h-n*m,v=n*f-s*h,w=s*v-l*y,E=l*_-n*v,A=n*y-s*_,I=2*i[3];return y*=I,v*=I,E*=2,A*=2,t[0]=h+(_*=I)+(w*=2),t[1]=f+y+E,t[2]=m+v+A,t},St.rotateX=function(t,e,i,n){var s=[],l=[];return s[0]=e[0]-i[0],s[1]=e[1]-i[1],s[2]=e[2]-i[2],l[0]=s[0],l[1]=s[1]*Math.cos(n)-s[2]*Math.sin(n),l[2]=s[1]*Math.sin(n)+s[2]*Math.cos(n),t[0]=l[0]+i[0],t[1]=l[1]+i[1],t[2]=l[2]+i[2],t},St.rotateY=function(t,e,i,n){var s=[],l=[];return s[0]=e[0]-i[0],s[1]=e[1]-i[1],s[2]=e[2]-i[2],l[0]=s[2]*Math.sin(n)+s[0]*Math.cos(n),l[1]=s[1],l[2]=s[2]*Math.cos(n)-s[0]*Math.sin(n),t[0]=l[0]+i[0],t[1]=l[1]+i[1],t[2]=l[2]+i[2],t},St.rotateZ=function(t,e,i,n){var s=[],l=[];return s[0]=e[0]-i[0],s[1]=e[1]-i[1],s[2]=e[2]-i[2],l[0]=s[0]*Math.cos(n)-s[1]*Math.sin(n),l[1]=s[0]*Math.sin(n)+s[1]*Math.cos(n),l[2]=s[2],t[0]=l[0]+i[0],t[1]=l[1]+i[1],t[2]=l[2]+i[2],t},St.angle=function(t,e){var i=t[0],n=t[1],s=t[2],l=e[0],h=e[1],f=e[2],m=Math.sqrt(i*i+n*n+s*s)*Math.sqrt(l*l+h*h+f*f),_=m&&mm(t,e)/m;return Math.acos(Math.min(Math.max(_,-1),1))},St.zero=function(t){return t[0]=0,t[1]=0,t[2]=0,t},St.str=function(t){return"vec3("+t[0]+", "+t[1]+", "+t[2]+")"},St.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]},St.equals=function(t,e){var i=t[0],n=t[1],s=t[2],l=e[0],h=e[1],f=e[2];return Math.abs(i-l)<=Zo.EPSILON*Math.max(1,Math.abs(i),Math.abs(l))&&Math.abs(n-h)<=Zo.EPSILON*Math.max(1,Math.abs(n),Math.abs(h))&&Math.abs(s-f)<=Zo.EPSILON*Math.max(1,Math.abs(s),Math.abs(f))}
7,St.forEach=St.sqrLen=St.len=St.sqrDist=St.dist=St.div=St.mul=St.sub=void 0;var Zo=function(t,e){if(t&&t.__esModule)return t;if(t===null||wf(t)!=="object"&&typeof t!="function")return{default:t};var i=sm(void 0);if(i&&i.has(t))return i.get(t);var n={},s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in t)if(l!=="default"&&Object.prototype.hasOwnProperty.call(t,l)){var h=s?Object.getOwnPropertyDescriptor(t,l):null;h&&(h.get||h.set)?Object.defineProperty(n,l,h):n[l]=t[l]}return n.default=t,i&&i.set(t,n),n}(ir);function sm(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,i=new WeakMap;return(sm=function(n){return n?i:e})(t)}function am(){var t=new Zo.ARRAY_TYPE(3);return Zo.ARRAY_TYPE!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function lm(t){return Math.hypot(t[0],t[1],t[2])}function cm(t,e,i){return t[0]=e[0]-i[0],t[1]=e[1]-i[1],t[2]=e[2]-i[2],t}function um(t,e,i){return t[0]=e[0]*i[0],t[1]=e[1]*i[1],t[2]=e[2]*i[2],t}function hm(t,e,i){return t[0]=e[0]/i[0],t[1]=e[1]/i[1],t[2]=e[2]/i[2],t}function dm(t,e){return Math.hypot(e[0]-t[0],e[1]-t[1],e[2]-t[2])}function fm(t,e){var i=e[0]-t[0],n=e[1]-t[1],s=e[2]-t[2];return i*i+n*n+s*s}function pm(t){var e=t[0],i=t[1],n=t[2];return e*e+i*i+n*n}function mm(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}St.sub=cm,St.mul=um,St.div=hm,St.dist=dm,St.sqrDist=fm,St.len=lm,St.sqrLen=pm;var qo,Qy=(qo=am(),function(t,e,i,n,s,l){var h,f;for(e||(e=3),i||(i=0),f=n?Math.min(n*e+i,t.length):t.length,h=i;h<f;h+=e)qo[0]=t[h],qo[1]=t[h+1],qo[2]=t[h+2],s(qo,qo,l),t[h]=qo[0],t[h+1]=qo[1],t[h+2]=qo[2];return t});St.forEach=Qy;var Nt={};function Tf(t){return Tf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Tf(t)}Object.defineProperty(Nt,"__esModule",{value:!0}),Nt.create=gm,Nt.clone=function(t){var e=new Tn.ARRAY_TYPE(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e},Nt.fromValues=function(t,e,i,n){var s=new Tn.ARRAY_TYPE(4);return s[0]=t,s[1]=e,s[2]=i,s[3]=n,s},Nt.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t},Nt.set=function(t,e,i,n,s){return t[0]=e,t[1]=i,t[2]=n,t[3]=s,t},Nt.add=function(t,e,i){return t[0]=e[0]+i[0],t[1]=e[1]+i[1],t[2]=e[2]+i[2],t[3]=e[3]+i[3],t},Nt.subtract=ym,Nt.multiply=xm,Nt.divide=vm,Nt.ceil=function(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t[2]=Math.ceil(e[2]),t[3]=Math.ceil(e[3]),t},Nt.floor=function(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t[2]=Math.floor(e[2]),t[3]=Math.floor(e[3]),t},Nt.min=function(t,e,i){return t[0]=Math.min(e[0],i[0]),t[1]=Math.min(e[1],i[1]),t[2]=Math.min(e[2],i[2]),t[3]=Math.min(e[3],i[3]),t},Nt.max=function(t,e,i){return t[0]=Math.max(e[0],i[0]),t[1]=Math.max(e[1],i[1]),t[2]=Math.max(e[2],i[2]),t[3]=Math.max(e[3],i[3]),t},Nt.round=function(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t[2]=Math.round(e[2]),t[3]=Math.round(e[3]),t},Nt.scale=function(t,e,i){return t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t[3]=e[3]*i,t},Nt.scaleAndAdd=function(t,e,i,n){return t[0]=e[0]+i[0]*n,t[1]=e[1]+i[1]*n,t[2]=e[2]+i[2]*n,t[3]=e[3]+i[3]*n,t},Nt.distance=bm,Nt.squaredDistance=wm,Nt.length=Tm,Nt.squaredLength=Mm,Nt.negate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t},Nt.inverse=function(t,e){return t[0]=1/e[0],t[1]=1/e[1],t[2]=1/e[2],t[3]=1/e[3],t},Nt.normalize=function(t,e){var i=e[0],n=e[1],s=e[2],l=e[3],h=i*i+n*n+s*s+l*l;return h>0&&(h=1/Math.sqrt(h)),t[0]=i*h,t[1]=n*h,t[2]=s*h,t[3]=l*h,t},Nt.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]},Nt.cross=function(t,e,i,n){var s=i[0]*n[1]-i[1]*n[0],l=i[0]*n[2]-i[2]*n[0],h=i[0]*n[3]-i[3]*n[0],f=i[1]*n[2]-i[2]*n[1],m=i[1]*n[3]-i[3]*n[1],_=i[2]*n[3]-i[3]*n[2],y=e[0],v=e[1],w=e[2],E=e[3];return t[0]=v*_-w*m+E*f,t[1]=-y*_+w*h-E*l,t[2]=y*m-v*h+E*s,t[3]=-y*f+v*l-w*s,t},Nt.lerp=function(t,e,i,n){var s=e[0],l=e[1],h=e[2],f=e[3];return t[0]=s+n*(i[0]-s),t[1]=l+n*(i[1]-l),t[2]=h+n*(i[2]-h),t[3]=f+n*(i[3]-f),t},Nt.random=function(t,e){var i,n,s,l,h,f;e=e||1;do h=(i=2*Tn.RANDOM()-1)*i+(n=2*Tn.RANDOM()-1)*n;while(h>=1);do f=(s=2*Tn.RANDOM()-1)*s+(l=2*Tn.RANDOM()-1)*l;while(f>=1);var m=Math.sqrt((1-h)/f);return t[0]=e*i,t[1]=e*n,t[2]=e*s*m,t[3]=e*l*m,t}
7,Nt.transformMat4=function(t,e,i){var n=e[0],s=e[1],l=e[2],h=e[3];return t[0]=i[0]*n+i[4]*s+i[8]*l+i[12]*h,t[1]=i[1]*n+i[5]*s+i[9]*l+i[13]*h,t[2]=i[2]*n+i[6]*s+i[10]*l+i[14]*h,t[3]=i[3]*n+i[7]*s+i[11]*l+i[15]*h,t},Nt.transformQuat=function(t,e,i){var n=e[0],s=e[1],l=e[2],h=i[0],f=i[1],m=i[2],_=i[3],y=_*n+f*l-m*s,v=_*s+m*n-h*l,w=_*l+h*s-f*n,E=-h*n-f*s-m*l;return t[0]=y*_+E*-h+v*-m-w*-f,t[1]=v*_+E*-f+w*-h-y*-m,t[2]=w*_+E*-m+y*-f-v*-h,t[3]=e[3],t},Nt.zero=function(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=0,t},Nt.str=function(t){return"vec4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},Nt.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]},Nt.equals=function(t,e){var i=t[0],n=t[1],s=t[2],l=t[3],h=e[0],f=e[1],m=e[2],_=e[3];return Math.abs(i-h)<=Tn.EPSILON*Math.max(1,Math.abs(i),Math.abs(h))&&Math.abs(n-f)<=Tn.EPSILON*Math.max(1,Math.abs(n),Math.abs(f))&&Math.abs(s-m)<=Tn.EPSILON*Math.max(1,Math.abs(s),Math.abs(m))&&Math.abs(l-_)<=Tn.EPSILON*Math.max(1,Math.abs(l),Math.abs(_))},Nt.forEach=Nt.sqrLen=Nt.len=Nt.sqrDist=Nt.dist=Nt.div=Nt.mul=Nt.sub=void 0;var Tn=function(t,e){if(t&&t.__esModule)return t;if(t===null||Tf(t)!=="object"&&typeof t!="function")return{default:t};var i=_m(void 0);if(i&&i.has(t))return i.get(t);var n={},s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in t)if(l!=="default"&&Object.prototype.hasOwnProperty.call(t,l)){var h=s?Object.getOwnPropertyDescriptor(t,l):null;h&&(h.get||h.set)?Object.defineProperty(n,l,h):n[l]=t[l]}return n.default=t,i&&i.set(t,n),n}(ir);function _m(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,i=new WeakMap;return(_m=function(n){return n?i:e})(t)}function gm(){var t=new Tn.ARRAY_TYPE(4);return Tn.ARRAY_TYPE!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t}function ym(t,e,i){return t[0]=e[0]-i[0],t[1]=e[1]-i[1],t[2]=e[2]-i[2],t[3]=e[3]-i[3],t}function xm(t,e,i){return t[0]=e[0]*i[0],t[1]=e[1]*i[1],t[2]=e[2]*i[2],t[3]=e[3]*i[3],t}function vm(t,e,i){return t[0]=e[0]/i[0],t[1]=e[1]/i[1],t[2]=e[2]/i[2],t[3]=e[3]/i[3],t}function bm(t,e){return Math.hypot(e[0]-t[0],e[1]-t[1],e[2]-t[2],e[3]-t[3])}function wm(t,e){var i=e[0]-t[0],n=e[1]-t[1],s=e[2]-t[2],l=e[3]-t[3];return i*i+n*n+s*s+l*l}function Tm(t){return Math.hypot(t[0],t[1],t[2],t[3])}function Mm(t){var e=t[0],i=t[1],n=t[2],s=t[3];return e*e+i*i+n*n+s*s}Nt.sub=ym,Nt.mul=xm,Nt.div=vm,Nt.dist=bm,Nt.sqrDist=wm,Nt.len=Tm,Nt.sqrLen=Mm;var e0=function(){var t=gm();return function(e,i,n,s,l,h){var f,m;for(i||(i=4),n||(n=0),m=s?Math.min(s*i+n,e.length):e.length,f=n;f<m;f+=i)t[0]=e[f],t[1]=e[f+1],t[2]=e[f+2],t[3]=e[f+3],l(t,t,h),e[f]=t[0],e[f+1]=t[1],e[f+2]=t[2],e[f+3]=t[3];return e}}();function Mf(t){return Mf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Mf(t)}Nt.forEach=e0,Object.defineProperty(Tt,"__esModule",{value:!0}),Tt.create=Ef,Tt.identity=function(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t},Tt.setAxisAngle=Sm,Tt.getAxisAngle=function(t,e){var i=2*Math.acos(e[3]),n=Math.sin(i/2);return n>La.EPSILON?(t[0]=e[0]/n,t[1]=e[1]/n,t[2]=e[2]/n):(t[0]=1,t[1]=0,t[2]=0),i},Tt.getAngle=function(t,e){var i=Dm(t,e);return Math.acos(2*i*i-1)},Tt.multiply=Am,Tt.rotateX=function(t,e,i){i*=.5;var n=e[0],s=e[1],l=e[2],h=e[3],f=Math.sin(i),m=Math.cos(i);return t[0]=n*m+h*f,t[1]=s*m+l*f,t[2]=l*m-s*f,t[3]=h*m-n*f,t},Tt.rotateY=function(t,e,i){i*=.5;var n=e[0],s=e[1],l=e[2],h=e[3],f=Math.sin(i),m=Math.cos(i);return t[0]=n*m-l*f,t[1]=s*m+h*f,t[2]=l*m+n*f,t[3]=h*m-s*f,t},Tt.rotateZ=function(t,e,i){i*=.5;var n=e[0],s=e[1],l=e[2],h=e[3],f=Math.sin(i),m=Math.cos(i);return t[0]=n*m+s*f,t[1]=s*m-n*f,t[2]=l*m+h*f,t[3]=h*m-l*f,t},Tt.calculateW=function(t,e){var i=e[0],n=e[1],s=e[2];return t[0]=i,t[1]=n,t[2]=s,t[3]=Math.sqrt(Math.abs(1-i*i-n*n-s*s)),t},Tt.exp=Im,Tt.ln=Cm,Tt.pow=function(t,e,i){return Cm(t,e),zm(t,t,i),Im(t,t),t},Tt.slerp=Yh,Tt.random=function(t){var e=La.RANDOM(),i=La.RANDOM(),n=La.RANDOM(),s=Math.sqrt(1-e),l=Math.sqrt(e);return t[0]=s*Math.sin(2*Math.PI*i),t[1]=s*Math.cos(2*Math.PI*i),t[2]=l*Math.sin(2*Math.PI*n),t[3]=l*Math.cos(2*Math.PI*n),t},Tt.invert=function(t,e){var i=e[0],n=e[1],s=e[2],l=e[3],h=i*i+n*n+s*s+l*l,f=h?1/h:0;return t[0]=-i*f,t[1]=-n*f,t[2]=-s*f,t[3]=l*f,t},Tt.conjugate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3],t}
7,Tt.fromMat3=Pm,Tt.fromEuler=function(t,e,i,n){var s=.5*Math.PI/180;e*=s,i*=s,n*=s;var l=Math.sin(e),h=Math.cos(e),f=Math.sin(i),m=Math.cos(i),_=Math.sin(n),y=Math.cos(n);return t[0]=l*m*y-h*f*_,t[1]=h*f*y+l*m*_,t[2]=h*m*_-l*f*y,t[3]=h*m*y+l*f*_,t},Tt.str=function(t){return"quat("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},Tt.setAxes=Tt.sqlerp=Tt.rotationTo=Tt.equals=Tt.exactEquals=Tt.normalize=Tt.sqrLen=Tt.squaredLength=Tt.len=Tt.length=Tt.lerp=Tt.dot=Tt.scale=Tt.mul=Tt.add=Tt.set=Tt.copy=Tt.fromValues=Tt.clone=void 0;var La=Xh(ir),t0=Xh(pi),$o=Xh(St),hn=Xh(Nt);function Em(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,i=new WeakMap;return(Em=function(n){return n?i:e})(t)}function Xh(t,e){if(!e&&t&&t.__esModule)return t;if(t===null||Mf(t)!=="object"&&typeof t!="function")return{default:t};var i=Em(e);if(i&&i.has(t))return i.get(t);var n={},s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in t)if(l!=="default"&&Object.prototype.hasOwnProperty.call(t,l)){var h=s?Object.getOwnPropertyDescriptor(t,l):null;h&&(h.get||h.set)?Object.defineProperty(n,l,h):n[l]=t[l]}return n.default=t,i&&i.set(t,n),n}function Ef(){var t=new La.ARRAY_TYPE(4);return La.ARRAY_TYPE!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function Sm(t,e,i){i*=.5;var n=Math.sin(i);return t[0]=n*e[0],t[1]=n*e[1],t[2]=n*e[2],t[3]=Math.cos(i),t}function Am(t,e,i){var n=e[0],s=e[1],l=e[2],h=e[3],f=i[0],m=i[1],_=i[2],y=i[3];return t[0]=n*y+h*f+s*_-l*m,t[1]=s*y+h*m+l*f-n*_,t[2]=l*y+h*_+n*m-s*f,t[3]=h*y-n*f-s*m-l*_,t}function Im(t,e){var i=e[0],n=e[1],s=e[2],l=e[3],h=Math.sqrt(i*i+n*n+s*s),f=Math.exp(l),m=h>0?f*Math.sin(h)/h:0;return t[0]=i*m,t[1]=n*m,t[2]=s*m,t[3]=f*Math.cos(h),t}function Cm(t,e){var i=e[0],n=e[1],s=e[2],l=e[3],h=Math.sqrt(i*i+n*n+s*s),f=h>0?Math.atan2(h,l)/h:0;return t[0]=i*f,t[1]=n*f,t[2]=s*f,t[3]=.5*Math.log(i*i+n*n+s*s+l*l),t}function Yh(t,e,i,n){var s,l,h,f,m,_=e[0],y=e[1],v=e[2],w=e[3],E=i[0],A=i[1],I=i[2],z=i[3];return(l=_*E+y*A+v*I+w*z)<0&&(l=-l,E=-E,A=-A,I=-I,z=-z),1-l>La.EPSILON?(s=Math.acos(l),h=Math.sin(s),f=Math.sin((1-n)*s)/h,m=Math.sin(n*s)/h):(f=1-n,m=n),t[0]=f*_+m*E,t[1]=f*y+m*A,t[2]=f*v+m*I,t[3]=f*w+m*z,t}function Pm(t,e){var i,n=e[0]+e[4]+e[8];if(n>0)i=Math.sqrt(n+1),t[3]=.5*i,t[0]=(e[5]-e[7])*(i=.5/i),t[1]=(e[6]-e[2])*i,t[2]=(e[1]-e[3])*i;else{var s=0;e[4]>e[0]&&(s=1),e[8]>e[3*s+s]&&(s=2);var l=(s+1)%3,h=(s+2)%3;i=Math.sqrt(e[3*s+s]-e[3*l+l]-e[3*h+h]+1),t[s]=.5*i,t[3]=(e[3*l+h]-e[3*h+l])*(i=.5/i),t[l]=(e[3*l+s]+e[3*s+l])*i,t[h]=(e[3*h+s]+e[3*s+h])*i}return t}Tt.clone=hn.clone,Tt.fromValues=hn.fromValues,Tt.copy=hn.copy,Tt.set=hn.set,Tt.add=hn.add,Tt.mul=Am;var zm=hn.scale;Tt.scale=zm;var Dm=hn.dot;Tt.dot=Dm,Tt.lerp=hn.lerp;var Lm=hn.length;Tt.length=Lm,Tt.len=Lm;var Rm=hn.squaredLength;Tt.squaredLength=Rm,Tt.sqrLen=Rm;var Sf=hn.normalize;Tt.normalize=Sf,Tt.exactEquals=hn.exactEquals,Tt.equals=hn.equals;var Bn,km,Om,i0=(Bn=$o.create(),km=$o.fromValues(1,0,0),Om=$o.fromValues(0,1,0),function(t,e,i){var n=$o.dot(e,i);return n<-.999999?($o.cross(Bn,km,e),$o.len(Bn)<1e-6&&$o.cross(Bn,Om,e),$o.normalize(Bn,Bn),Sm(t,Bn,Math.PI),t):n>.999999?(t[0]=0,t[1]=0,t[2]=0,t[3]=1,t):($o.cross(Bn,e,i),t[0]=Bn[0],t[1]=Bn[1],t[2]=Bn[2],t[3]=1+n,Sf(t,t))});Tt.rotationTo=i0;var Af,If,r0=(Af=Ef(),If=Ef(),function(t,e,i,n,s,l){return Yh(Af,e,s,l),Yh(If,i,n,l),Yh(t,Af,If,2*l*(1-l)),t});Tt.sqlerp=r0;var Fn,n0=(Fn=t0.create(),function(t,e,i,n){return Fn[0]=i[0],Fn[3]=i[1],Fn[6]=i[2],Fn[1]=n[0],Fn[4]=n[1],Fn[7]=n[2],Fn[2]=-e[0],Fn[5]=-e[1],Fn[8]=-e[2],Sf(t,Pm(t,Fn))});Tt.setAxes=n0;var $t={};function Cf(t){return Cf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Cf(t)}Object.defineProperty($t,"__esModule",{value:!0}),$t.create=function(){var t=new Ur.ARRAY_TYPE(8);return Ur.ARRAY_TYPE!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[4]=0,t[5]=0,t[6]=0,t[7]=0),t[3]=1,t},$t.clone=function(t){var e=new Ur.ARRAY_TYPE(8);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e}
7,$t.fromValues=function(t,e,i,n,s,l,h,f){var m=new Ur.ARRAY_TYPE(8);return m[0]=t,m[1]=e,m[2]=i,m[3]=n,m[4]=s,m[5]=l,m[6]=h,m[7]=f,m},$t.fromRotationTranslationValues=function(t,e,i,n,s,l,h){var f=new Ur.ARRAY_TYPE(8);f[0]=t,f[1]=e,f[2]=i,f[3]=n;var m=.5*s,_=.5*l,y=.5*h;return f[4]=m*n+_*i-y*e,f[5]=_*n+y*t-m*i,f[6]=y*n+m*e-_*t,f[7]=-m*t-_*e-y*i,f},$t.fromRotationTranslation=Nm,$t.fromTranslation=function(t,e){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t[4]=.5*e[0],t[5]=.5*e[1],t[6]=.5*e[2],t[7]=0,t},$t.fromRotation=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=0,t[5]=0,t[6]=0,t[7]=0,t},$t.fromMat4=function(t,e){var i=Wo.create();Bm.getRotation(i,e);var n=new Ur.ARRAY_TYPE(3);return Bm.getTranslation(n,e),Nm(t,i,n),t},$t.copy=Vm,$t.identity=function(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t[6]=0,t[7]=0,t},$t.set=function(t,e,i,n,s,l,h,f,m){return t[0]=e,t[1]=i,t[2]=n,t[3]=s,t[4]=l,t[5]=h,t[6]=f,t[7]=m,t},$t.getDual=function(t,e){return t[0]=e[4],t[1]=e[5],t[2]=e[6],t[3]=e[7],t},$t.setDual=function(t,e){return t[4]=e[0],t[5]=e[1],t[6]=e[2],t[7]=e[3],t},$t.getTranslation=function(t,e){var i=e[4],n=e[5],s=e[6],l=e[7],h=-e[0],f=-e[1],m=-e[2],_=e[3];return t[0]=2*(i*_+l*h+n*m-s*f),t[1]=2*(n*_+l*f+s*h-i*m),t[2]=2*(s*_+l*m+i*f-n*h),t},$t.translate=function(t,e,i){var n=e[0],s=e[1],l=e[2],h=e[3],f=.5*i[0],m=.5*i[1],_=.5*i[2],y=e[4],v=e[5],w=e[6],E=e[7];return t[0]=n,t[1]=s,t[2]=l,t[3]=h,t[4]=h*f+s*_-l*m+y,t[5]=h*m+l*f-n*_+v,t[6]=h*_+n*m-s*f+w,t[7]=-n*f-s*m-l*_+E,t},$t.rotateX=function(t,e,i){var n=-e[0],s=-e[1],l=-e[2],h=e[3],f=e[4],m=e[5],_=e[6],y=e[7],v=f*h+y*n+m*l-_*s,w=m*h+y*s+_*n-f*l,E=_*h+y*l+f*s-m*n,A=y*h-f*n-m*s-_*l;return Wo.rotateX(t,e,i),t[4]=v*(h=t[3])+A*(n=t[0])+w*(l=t[2])-E*(s=t[1]),t[5]=w*h+A*s+E*n-v*l,t[6]=E*h+A*l+v*s-w*n,t[7]=A*h-v*n-w*s-E*l,t},$t.rotateY=function(t,e,i){var n=-e[0],s=-e[1],l=-e[2],h=e[3],f=e[4],m=e[5],_=e[6],y=e[7],v=f*h+y*n+m*l-_*s,w=m*h+y*s+_*n-f*l,E=_*h+y*l+f*s-m*n,A=y*h-f*n-m*s-_*l;return Wo.rotateY(t,e,i),t[4]=v*(h=t[3])+A*(n=t[0])+w*(l=t[2])-E*(s=t[1]),t[5]=w*h+A*s+E*n-v*l,t[6]=E*h+A*l+v*s-w*n,t[7]=A*h-v*n-w*s-E*l,t},$t.rotateZ=function(t,e,i){var n=-e[0],s=-e[1],l=-e[2],h=e[3],f=e[4],m=e[5],_=e[6],y=e[7],v=f*h+y*n+m*l-_*s,w=m*h+y*s+_*n-f*l,E=_*h+y*l+f*s-m*n,A=y*h-f*n-m*s-_*l;return Wo.rotateZ(t,e,i),t[4]=v*(h=t[3])+A*(n=t[0])+w*(l=t[2])-E*(s=t[1]),t[5]=w*h+A*s+E*n-v*l,t[6]=E*h+A*l+v*s-w*n,t[7]=A*h-v*n-w*s-E*l,t},$t.rotateByQuatAppend=function(t,e,i){var n=i[0],s=i[1],l=i[2],h=i[3],f=e[0],m=e[1],_=e[2],y=e[3];return t[0]=f*h+y*n+m*l-_*s,t[1]=m*h+y*s+_*n-f*l,t[2]=_*h+y*l+f*s-m*n,t[3]=y*h-f*n-m*s-_*l,t[4]=(f=e[4])*h+(y=e[7])*n+(m=e[5])*l-(_=e[6])*s,t[5]=m*h+y*s+_*n-f*l,t[6]=_*h+y*l+f*s-m*n,t[7]=y*h-f*n-m*s-_*l,t},$t.rotateByQuatPrepend=function(t,e,i){var n=e[0],s=e[1],l=e[2],h=e[3],f=i[0],m=i[1],_=i[2],y=i[3];return t[0]=n*y+h*f+s*_-l*m,t[1]=s*y+h*m+l*f-n*_,t[2]=l*y+h*_+n*m-s*f,t[3]=h*y-n*f-s*m-l*_,t[4]=n*(y=i[7])+h*(f=i[4])+s*(_=i[6])-l*(m=i[5]),t[5]=s*y+h*m+l*f-n*_,t[6]=l*y+h*_+n*m-s*f,t[7]=h*y-n*f-s*m-l*_,t},$t.rotateAroundAxis=function(t,e,i,n){if(Math.abs(n)<Ur.EPSILON)return Vm(t,e);var s=Math.hypot(i[0],i[1],i[2]);n*=.5;var l=Math.sin(n),h=l*i[0]/s,f=l*i[1]/s,m=l*i[2]/s,_=Math.cos(n),y=e[0],v=e[1],w=e[2],E=e[3];t[0]=y*_+E*h+v*m-w*f,t[1]=v*_+E*f+w*h-y*m,t[2]=w*_+E*m+y*f-v*h,t[3]=E*_-y*h-v*f-w*m;var A=e[4],I=e[5],z=e[6],L=e[7];return t[4]=A*_+L*h+I*m-z*f,t[5]=I*_+L*f+z*h-A*m,t[6]=z*_+L*m+A*f-I*h,t[7]=L*_-A*h-I*f-z*m,t},$t.add=function(t,e,i){return t[0]=e[0]+i[0],t[1]=e[1]+i[1],t[2]=e[2]+i[2],t[3]=e[3]+i[3],t[4]=e[4]+i[4],t[5]=e[5]+i[5],t[6]=e[6]+i[6],t[7]=e[7]+i[7],t},$t.multiply=Um,$t.scale=function(t,e,i){return t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t[3]=e[3]*i,t[4]=e[4]*i,t[5]=e[5]*i,t[6]=e[6]*i,t[7]=e[7]*i,t},$t.lerp=function(t,e,i,n){var s=1-n;return jm(e,i)<0&&(n=-n),t[0]=e[0]*s+i[0]*n,t[1]=e[1]*s+i[1]*n,t[2]=e[2]*s+i[2]*n,t[3]=e[3]*s+i[3]*n,t[4]=e[4]*s+i[4]*n,t[5]=e[5]*s+i[5]*n,t[6]=e[6]*s+i[6]*n,t[7]=e[7]*s+i[7]*n,t},$t.invert=function(t,e){var i=Kh(e);return t[0]=-e[0]/i,t[1]=-e[1]/i,t[2]=-e[2]/i,t[3]=e[3]/i,t[4]=-e[4]/i,t[5]=-e[5]/i,t[6]=-e[6]/i,t[7]=e[7]/i,t},$t.conjugate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3],t[4]=-e[4],t[5]=-e[5],t[6]=-e[6],t[7]=e[7],t},$t.normalize=function(t,e){var i=Kh(e);if(i>0){i=Math.sqrt(i);var n=e[0]/i,s=e[1]/i,l=e[2]/i,h=e[3]/i,f=e[4],m=e[5],_=e[6],y=e[7],v=n*f+s*m+l*_+h*y;t[0]=n,t[1]=s,t[2]=l,t[3]=h,t[4]=(f-n*v)/i,t[5]=(m-s*v)/i,t[6]=(_-l*v)/i,t[7]=(y-h*v)/i}return t},$t.str=function(t){return"quat2("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+")"},$t.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]},$t.equals=function(t,e){var i=t[0],n=t[1],s=t[2],l=t[3],h=t[4],f=t[5],m=t[6],_=t[7],y=e[0],v=e[1],w=e[2],E=e[3],A=e[4],I=e[5],z=e[6],L=e[7];return Math.abs(i-y)<=Ur.EPSILON*Math.max(1,Math.abs(i),Math.abs(y))&&Math.abs(n-v)<=Ur.EPSILON*Math.max(1,Math.abs(n),Math.abs(v))&&Math.abs(s-w)<=Ur.EPSILON*Math.max(1,Math.abs(s),Math.abs(w))&&Math.abs(l-E)<=Ur.EPSILON*Math.max(1,Math.abs(l),Math.abs(E))&&Math.abs(h-A)<=Ur.EPSILON*Math.max(1,Math.abs(h),Math.abs(A))&&Math.abs(f-I)<=Ur.EPSILON*Math.max(1,Math.abs(f),Math.abs(I))&&Math.abs(m-z)<=Ur.EPSILON*Math.max(1,Math.abs(m),Math.abs(z))&&Math.abs(_-L)<=Ur.EPSILON*Math.max(1,Math.abs(_),Math.abs(L))},$t.sqrLen=$t.squaredLength=$t.len=$t.length=$t.dot=$t.mul=$t.setReal=$t.getReal=void 0;var Ur=Pf(ir),Wo=Pf(Tt),Bm=Pf(At);function Fm(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,i=new WeakMap;return(Fm=function(n){return n?i:e})(t)}function Pf(t,e){if(!e&&t&&t.__esModule)return t;if(t===null||Cf(t)!=="object"&&typeof t!="function")return{default:t};var i=Fm(e);if(i&&i.has(t))return i.get(t);var n={},s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in t)if(l!=="default"&&Object.prototype.hasOwnProperty.call(t,l)){var h=s?Object.getOwnPropertyDescriptor(t,l):null;h&&(h.get||h.set)?Object.defineProperty(n,l,h):n[l]=t[l]}return n.default=t,i&&i.set(t,n),n}function Nm(t,e,i){var n=.5*i[0],s=.5*i[1],l=.5*i[2],h=e[0],f=e[1],m=e[2],_=e[3];return t[0]=h,t[1]=f,t[2]=m,t[3]=_,t[4]=n*_+s*m-l*f,t[5]=s*_+l*h-n*m,t[6]=l*_+n*f-s*h,t[7]=-n*h-s*f-l*m,t}function Vm(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t}function Um(t,e,i){var n=e[0],s=e[1],l=e[2],h=e[3],f=i[4],m=i[5],_=i[6],y=i[7],v=e[4],w=e[5],E=e[6],A=e[7],I=i[0],z=i[1],L=i[2],N=i[3];return t[0]=n*N+h*I+s*L-l*z,t[1]=s*N+h*z+l*I-n*L,t[2]=l*N+h*L+n*z-s*I,t[3]=h*N-n*I-s*z-l*L,t[4]=n*y+h*f+s*_-l*m+v*N+A*I+w*L-E*z,t[5]=s*y+h*m+l*f-n*_+w*N+A*z+E*I-v*L,t[6]=l*y+h*_+n*m-s*f+E*N+A*L+v*z-w*I,t[7]=h*y-n*f-s*m-l*_+A*N-v*I-w*z-E*L,t}$t.getReal=Wo.copy,$t.setReal=Wo.copy,$t.mul=Um;var jm=Wo.dot;$t.dot=jm;var Gm=Wo.length;$t.length=Gm,$t.len=Gm;var Kh=Wo.squaredLength;$t.squaredLength=Kh,$t.sqrLen=Kh;var kt={};function zf(t){return zf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},zf(t)}
7Object.defineProperty(kt,"__esModule",{value:!0}),kt.create=qm,kt.clone=function(t){var e=new Ra.ARRAY_TYPE(2);return e[0]=t[0],e[1]=t[1],e},kt.fromValues=function(t,e){var i=new Ra.ARRAY_TYPE(2);return i[0]=t,i[1]=e,i},kt.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t},kt.set=function(t,e,i){return t[0]=e,t[1]=i,t},kt.add=function(t,e,i){return t[0]=e[0]+i[0],t[1]=e[1]+i[1],t},kt.subtract=$m,kt.multiply=Wm,kt.divide=Hm,kt.ceil=function(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t},kt.floor=function(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t},kt.min=function(t,e,i){return t[0]=Math.min(e[0],i[0]),t[1]=Math.min(e[1],i[1]),t},kt.max=function(t,e,i){return t[0]=Math.max(e[0],i[0]),t[1]=Math.max(e[1],i[1]),t},kt.round=function(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t},kt.scale=function(t,e,i){return t[0]=e[0]*i,t[1]=e[1]*i,t},kt.scaleAndAdd=function(t,e,i,n){return t[0]=e[0]+i[0]*n,t[1]=e[1]+i[1]*n,t},kt.distance=Xm,kt.squaredDistance=Ym,kt.length=Km,kt.squaredLength=Jm,kt.negate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t},kt.inverse=function(t,e){return t[0]=1/e[0],t[1]=1/e[1],t},kt.normalize=function(t,e){var i=e[0],n=e[1],s=i*i+n*n;return s>0&&(s=1/Math.sqrt(s)),t[0]=e[0]*s,t[1]=e[1]*s,t},kt.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]},kt.cross=function(t,e,i){var n=e[0]*i[1]-e[1]*i[0];return t[0]=t[1]=0,t[2]=n,t},kt.lerp=function(t,e,i,n){var s=e[0],l=e[1];return t[0]=s+n*(i[0]-s),t[1]=l+n*(i[1]-l),t},kt.random=function(t,e){e=e||1;var i=2*Ra.RANDOM()*Math.PI;return t[0]=Math.cos(i)*e,t[1]=Math.sin(i)*e,t},kt.transformMat2=function(t,e,i){var n=e[0],s=e[1];return t[0]=i[0]*n+i[2]*s,t[1]=i[1]*n+i[3]*s,t},kt.transformMat2d=function(t,e,i){var n=e[0],s=e[1];return t[0]=i[0]*n+i[2]*s+i[4],t[1]=i[1]*n+i[3]*s+i[5],t},kt.transformMat3=function(t,e,i){var n=e[0],s=e[1];return t[0]=i[0]*n+i[3]*s+i[6],t[1]=i[1]*n+i[4]*s+i[7],t},kt.transformMat4=function(t,e,i){var n=e[0],s=e[1];return t[0]=i[0]*n+i[4]*s+i[12],t[1]=i[1]*n+i[5]*s+i[13],t},kt.rotate=function(t,e,i,n){var s=e[0]-i[0],l=e[1]-i[1],h=Math.sin(n),f=Math.cos(n);return t[0]=s*f-l*h+i[0],t[1]=s*h+l*f+i[1],t},kt.angle=function(t,e){var i=t[0],n=t[1],s=e[0],l=e[1],h=Math.sqrt(i*i+n*n)*Math.sqrt(s*s+l*l);return Math.acos(Math.min(Math.max(h&&(i*s+n*l)/h,-1),1))},kt.zero=function(t){return t[0]=0,t[1]=0,t},kt.str=function(t){return"vec2("+t[0]+", "+t[1]+")"},kt.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]},kt.equals=function(t,e){var i=t[0],n=t[1],s=e[0],l=e[1];return Math.abs(i-s)<=Ra.EPSILON*Math.max(1,Math.abs(i),Math.abs(s))&&Math.abs(n-l)<=Ra.EPSILON*Math.max(1,Math.abs(n),Math.abs(l))},kt.forEach=kt.sqrLen=kt.sqrDist=kt.dist=kt.div=kt.mul=kt.sub=kt.len=void 0;var Ra=function(t,e){if(t&&t.__esModule)return t;if(t===null||zf(t)!=="object"&&typeof t!="function")return{default:t};var i=Zm(void 0);if(i&&i.has(t))return i.get(t);var n={},s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in t)if(l!=="default"&&Object.prototype.hasOwnProperty.call(t,l)){var h=s?Object.getOwnPropertyDescriptor(t,l):null;h&&(h.get||h.set)?Object.defineProperty(n,l,h):n[l]=t[l]}return n.default=t,i&&i.set(t,n),n}(ir);function Zm(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,i=new WeakMap;return(Zm=function(n){return n?i:e})(t)}function qm(){var t=new Ra.ARRAY_TYPE(2);return Ra.ARRAY_TYPE!=Float32Array&&(t[0]=0,t[1]=0),t}function $m(t,e,i){return t[0]=e[0]-i[0],t[1]=e[1]-i[1],t}function Wm(t,e,i){return t[0]=e[0]*i[0],t[1]=e[1]*i[1],t}function Hm(t,e,i){return t[0]=e[0]/i[0],t[1]=e[1]/i[1],t}function Xm(t,e){return Math.hypot(e[0]-t[0],e[1]-t[1])}function Ym(t,e){var i=e[0]-t[0],n=e[1]-t[1];return i*i+n*n}function Km(t){return Math.hypot(t[0],t[1])}function Jm(t){var e=t[0],i=t[1];return e*e+i*i}kt.len=Km,kt.sub=$m,kt.mul=Wm,kt.div=Hm,kt.dist=Xm,kt.sqrDist=Ym,kt.sqrLen=Jm;var o0=function(){var t=qm();return function(e,i,n,s,l,h){var f,m;for(i||(i=2),n||(n=0),m=s?Math.min(s*i+n,e.length):e.length,f=n;f<m;f+=i)t[0]=e[f],t[1]=e[f+1],l(t,t,h),e[f]=t[0],e[f+1]=t[1];return e}}();function Df(t){return Df=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Df(t)}
7kt.forEach=o0,Object.defineProperty(tr,"__esModule",{value:!0}),a.a7=tr.vec4=a.N=tr.vec3=tr.vec2=tr.quat2=a.bi=tr.quat=a.a6=tr.mat4=a.co=tr.mat3=tr.mat2d=a.b4=tr.mat2=tr.glMatrix=void 0;var s0=yo(ir);tr.glMatrix=s0;var a0=yo(zi);a.b4=tr.mat2=a0;var l0=yo(Li);tr.mat2d=l0;var c0=yo(pi);a.co=tr.mat3=c0;var u0=yo(At);a.a6=tr.mat4=u0;var h0=yo(Tt);a.bi=tr.quat=h0;var d0=yo($t);tr.quat2=d0;var f0=yo(kt);tr.vec2=f0;var p0=yo(St);a.N=tr.vec3=p0;var m0=yo(Nt);function Qm(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,i=new WeakMap;return(Qm=function(n){return n?i:e})(t)}function yo(t,e){if(!e&&t&&t.__esModule)return t;if(t===null||Df(t)!=="object"&&typeof t!="function")return{default:t};var i=Qm(e);if(i&&i.has(t))return i.get(t);var n={},s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in t)if(l!=="default"&&Object.prototype.hasOwnProperty.call(t,l)){var h=s?Object.getOwnPropertyDescriptor(t,l):null;h&&(h.get||h.set)?Object.defineProperty(n,l,h):n[l]=t[l]}return n.default=t,i&&i.set(t,n),n}a.a7=tr.vec4=m0;class Lf{constructor(e,i){this.pos=e,this.dir=i}intersectsPlane(e,i,n){const s=a.N.dot(i,this.dir);if(Math.abs(s)<1e-6)return!1;const l=((e[0]-this.pos[0])*i[0]+(e[1]-this.pos[1])*i[1]+(e[2]-this.pos[2])*i[2])/s;return n[0]=this.pos[0]+this.dir[0]*l,n[1]=this.pos[1]+this.dir[1]*l,n[2]=this.pos[2]+this.dir[2]*l,!0}closestPointOnSphere(e,i,n){if(a.N.equals(this.pos,e)||i===0)return n[0]=n[1]=n[2]=0,!1;const[s,l,h]=this.dir,f=this.pos[0]-e[0],m=this.pos[1]-e[1],_=this.pos[2]-e[2],y=s*s+l*l+h*h,v=2*(f*s+m*l+_*h),w=v*v-4*y*(f*f+m*m+_*_-i*i);if(w<0){const E=Math.max(-v/2,0),A=f+s*E,I=m+l*E,z=_+h*E,L=Math.hypot(A,I,z);return n[0]=A*i/L,n[1]=I*i/L,n[2]=z*i/L,!1}{const E=(-v-Math.sqrt(w))/(2*y);if(E<0){const A=Math.hypot(f,m,_);return n[0]=f*i/A,n[1]=m*i/A,n[2]=_*i/A,!1}return n[0]=f+s*E,n[1]=m+l*E,n[2]=_+h*E,!0}}}class Rf{constructor(e,i,n,s,l){this.TL=e,this.TR=i,this.BR=n,this.BL=s,this.horizon=l}static fromInvProjectionMatrix(e,i,n){const s=[-1,1,1],l=[1,1,1],h=[1,-1,1],f=[-1,-1,1],m=a.N.transformMat4(s,s,e),_=a.N.transformMat4(l,l,e),y=a.N.transformMat4(h,h,e),v=a.N.transformMat4(f,f,e);return new Rf(m,_,y,v,i/n)}}function Tu(t,e,i){let n=1/0,s=-1/0;const l=[];for(const h of t){a.N.sub(l,h,e);const f=a.N.dot(l,i);n=Math.min(n,f),s=Math.max(s,f)}return[n,s]}function e_(t,e){let i=!0;for(let n=0;n<t.planes.length;n++){const s=t.planes[n];let l=0;for(let h=0;h<e.length;h++)l+=a.N.dot(s,e[h])+s[3]>=0;if(l===0)return 0;l!==e.length&&(i=!1)}return i?2:1}function t_(t,e){for(const i of t.projections){const n=Tu(e,t.points[0],i.axis);if(i.projection[1]<n[0]||i.projection[0]>n[1])return 0}return 1}function i_(t,e){let i=0;const n=[0,0,0,0];for(let s=0;s<t.length;s++)n[0]=t[s][0],n[1]=t[s][1],n[2]=t[s][2],n[3]=1,a.a7.dot(n,e)>=0&&i++;return i}class kf{constructor(e,i){this.points=e||new Array(8).fill([0,0,0]),this.planes=i||new Array(6).fill([0,0,0,0]),this.bounds=Ri.fromPoints(this.points),this.projections=[],this.frustumEdges=[a.N.sub([],this.points[2],this.points[3]),a.N.sub([],this.points[0],this.points[3]),a.N.sub([],this.points[4],this.points[0]),a.N.sub([],this.points[5],this.points[1]),a.N.sub([],this.points[6],this.points[2]),a.N.sub([],this.points[7],this.points[3])];for(const n of this.frustumEdges){const s=[0,-n[2],n[1]],l=[n[2],0,-n[0]];this.projections.push({axis:s,projection:Tu(this.points,this.points[0],s)}),this.projections.push({axis:l,projection:Tu(this.points,this.points[0],l)})}}static fromInvProjectionMatrix(e,i,n,s){const l=Math.pow(2,n),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(_=>{const y=a.a7.transformMat4([],_,e),v=1/y[3]/i*l;return a.a7.mul(y,y,[v,v,s?1/y[3]:v,v])}),f=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(_=>{const y=a.N.sub([],h[_[0]],h[_[1]]),v=a.N.sub([],h[_[2]],h[_[1]]),w=a.N.normalize([],a.N.cross([],y,v)),E=-a.N.dot(w,h[_[1]]);return w.concat(E)}),m=[];for(let _=0;_<h.length;_++)m.push([h[_][0],h[_][1],h[_][2]]);return new kf(m,f)}intersectsPrecise(e,i,n){for(let s=0;s<i.length;s++)if(!i_(e,i[s]))return 0;for(let s=0;s<this.planes.length;s++)if(!i_(e,this.planes[s]))return 0;for(const s of n)for(const l of this.frustumEdges){const h=a.N.cross([],s,l),f=a.N.length(h);if(f===0)continue;a.N.scale(h,h,1/f);const m=Tu(this.points,this.points[0],h),_=Tu(e,this.points[0],h);if(m[0]>_[1]||_[0]>m[1])return 0}return 1}}class Ri{static fromPoints(e){const i=[1/0,1/0,1/0],n=[-1/0,-1/0,-1/0];for(const s of e)a.N.min(i,i,s),a.N.max(n,n,s);return new Ri(i,n)}static fromTileIdAndHeight(e,i,n){const s=1<<e.canonical.z,l=e.canonical.x,h=e.canonical.y;return new Ri([l/s,h/s,i],[(l+1)/s,(h+1)/s,n])}static applyTransform(e,i){const n=e.getCorners();for(let s=0;s<n.length;++s)a.N.transformMat4(n[s],n[s],i);return Ri.fromPoints(n)}static projectAabbCorners(e,i){const n=e.getCorners();for(let s=0;s<n.length;++s)a.N.transformMat4(n[s],n[s],i);return n}constructor(e,i){this.min=e,this.max=i,this.center=a.N.scale([],a.N.add([],this.min,this.max),.5)}quadrant(e){const i=[e%2==0,e<2],n=a.N.clone(this.min),s=a.N.clone(this.max);for(let l=0;l<i.length;l++)n[l]=i[l]?this.min[l]:this.center[l],s[l]=i[l]?this.center[l]:this.max[l];return s[2]=this.max[2],new Ri(n,s)}distanceX(e){return Math.max(Math.min(this.max[0],e[0]),this.min[0])-e[0]}distanceY(e){return Math.max(Math.min(this.max[1],e[1]),this.min[1])-e[1]}distanceZ(e){return Math.max(Math.min(this.max[2],e[2]),this.min[2])-e[2]}getCorners(){const e=this.min,i=this.max;return[[e[0],e[1],e[2]],[i[0],e[1],e[2]],[i[0],i[1],e[2]],[e[0],i[1],e[2]],[e[0],e[1],i[2]],[i[0],e[1],i[2]],[i[0],i[1],i[2]],[e[0],i[1],i[2]]]}intersects(e){return this.intersectsAabb(e.bounds)?e_(e,this.getCorners()):0}intersectsFlat(e){return this.intersectsAabb(e.bounds)?e_(e,[[this.min[0],this.min[1],0],[this.max[0],this.min[1],0],[this.max[0],this.max[1],0],[this.min[0],this.max[1],0]]):0}intersectsPrecise(e,i){return i||this.intersects(e)?t_(e,this.getCorners()):0}intersectsPreciseFlat(e,i){return i||this.intersectsFlat(e)?t_(e,[[this.min[0],this.min[1],0],[this.max[0],this.min[1],0],[this.max[0],this.max[1],0],[this.min[0],this.max[1],0]]):0}intersectsAabb(e){for(let i=0;i<3;++i)if(this.min[i]>e.max[i]||e.min[i]>this.max[i])return!1;return!0}intersectsAabbXY(e){return!(this.min[0]>e.max[0]||e.min[0]>this.max[0]||this.min[1]>e.max[1]||e.min[1]>this.max[1])}encapsulate(e){for(let i=0;i<3;i++)this.min[i]=Math.min(this.min[i],e.min[i]),this.max[i]=Math.max(this.max[i],e.max[i])}encapsulatePoint(e){for(let i=0;i<3;i++)this.min[i]=Math.min(this.min[i],e[i]),this.max[i]=Math.max(this.max[i],e[i])}closestPoint(e){return[Math.max(Math.min(this.max[0],e[0]),this.min[0]),Math.max(Math.min(this.max[1],e[1]),this.min[1]),Math.max(Math.min(this.max[2],e[2]),this.min[2])]}}Ke(Ri,"Aabb");const _0=li([{type:"Float32",name:"a_globe_pos",components:3},{type:"Float32",name:"a_uv",components:2}]),{members:Jh}=_0,g0=li([{name:"a_pos_3",components:3,type:"Int16"}]);var r_=li([{name:"a_pos",type:"Int16",components:2}]);function Qh(t){return t*V/fe}const y0=[new Ri([ee,ee,ee],[ce,ce,ce]),new Ri([ee,ee,ee],[0,0,ce]),new Ri([0,ee,ee],[ce,0,ce]),new Ri([ee,0,ee],[0,ce,ce]),new Ri([0,0,ee],[ce,ce,ce])];function n_(t,e,i,n=!0){const s=a.N.scale([],t._camera.position,t.worldSize),l=[e,i,1,1];a.a7.transformMat4(l,l,t.pixelMatrixInverse),a.a7.scale(l,l,1/l[3]);const h=a.N.sub([],l,s),f=a.N.normalize([],h),m=t.globeMatrix,_=[m[12],m[13],m[14]],y=a.N.sub([],_,s),v=a.N.length(y),w=a.N.normalize([],y),E=t.worldSize/(2*Math.PI),A=a.N.dot(w,f),I=Math.asin(E/v);if(I<Math.acos(A)){if(!n)return null;const se=[],_e=[];a.N.scale(se,f,v/A),a.N.normalize(_e,a.N.sub(_e,se,y)),a.N.normalize(f,a.N.add(f,y,a.N.scale(f,_e,Math.tan(I)*v)))}const z=[];new Lf(s,f).closestPointOnSphere(_,E,z);const L=a.N.normalize([],H(m,0)),N=a.N.normalize([],H(m,1)),G=a.N.normalize([],H(m,2)),j=a.N.dot(L,z),X=a.N.dot(N,z),W=a.N.dot(G,z),J=dr(Math.asin(-X/E));let ie=dr(Math.atan2(j,W));ie=t.center.lng+function(se,_e){const Me=(_e-se+180)%360-180;return Me<-180?Me+360:Me}(t.center.lng,ie);const oe=Et(ie),ue=Dt(gt(J),0,1);return new Yt(oe,ue)}class x0{constructor(e,i,n){this.a=a.N.sub([],e,n),this.b=a.N.sub([],i,n),this.center=n;const s=a.N.normalize([],this.a),l=a.N.normalize([],this.b);this.angle=Math.acos(a.N.dot(s,l))}}function Of(t,e){if(t.angle===0)return null;let i;return i=t.a[e]===0?1/t.angle*.5*Math.PI:1/t.angle*Math.atan(t.b[e]/t.a[e]/Math.sin(t.angle)-1/Math.tan(t.angle)),i<0||i>1?null:function(n,s,l,h){const f=Math.sin(l);return n*(Math.sin((1-h)*l)/f)+s*(Math.sin(h*l)/f)}
7(t.a[e],t.b[e],t.angle,Dt(i,0,1))+t.center[e]}function xo(t){if(t.z<=1)return y0[t.z+2*t.y+t.x];const e=Bf(ed(t));return Ri.fromPoints(e)}function Ho(t,e,i){return a.N.scale(t,t,1-i),a.N.scaleAndAdd(t,t,e,i)}function o_(t,e,i){for(const n of t)a.N.transformMat4(n,n,e),a.N.scale(n,n,i)}function s_(t,e,i,n){const s=e/t.worldSize,l=t.globeMatrix;if(i.z<=1){const oe=xo(i).getCorners();return o_(oe,l,s),Ri.fromPoints(oe)}const h=ed(i,n),f=Bf(h,V+Qh(t._tileCoverLift));o_(f,l,s);const m=Number.MAX_VALUE,_=[-m,-m,-m],y=[m,m,m];if(h.contains(t.center)){for(const se of f)a.N.min(y,y,se),a.N.max(_,_,se);_[2]=0;const oe=t.point,ue=[oe.x*s,oe.y*s,0];return a.N.min(y,y,ue),a.N.max(_,_,ue),new Ri(y,_)}if(t._tileCoverLift>0){for(const oe of f)a.N.min(y,y,oe),a.N.max(_,_,oe);return new Ri(y,_)}const v=[l[12]*s,l[13]*s,l[14]*s],w=h.getCenter(),E=Dt(t.center.lat,-Ot,Ot),A=Dt(w.lat,-Ot,Ot),I=Et(t.center.lng),z=gt(E);let L=I-Et(w.lng);const N=z-gt(A);L>.5?L-=1:L<-.5&&(L+=1);let G=0;if(Math.abs(L)>Math.abs(N))G=L>=0?1:3;else{G=N>=0?0:2;const oe=[l[4]*s,l[5]*s,l[6]*s],ue=-Math.sin(qt(N>=0?h.getSouth():h.getNorth()))*V;a.N.scaleAndAdd(v,v,oe,ue)}const j=f[G],X=f[(G+1)%4],W=new x0(j,X,v),J=[Of(W,0)||j[0],Of(W,1)||j[1],Of(W,2)||j[2]],ie=Cs(t.zoom);if(ie>0){const oe=function({x:se,y:_e,z:Me},pe,we,de,be){const Fe=1/(1<<Me);let Se=se*Fe,Qe=Se+Fe,He=_e*Fe,Ce=He+Fe,pt=0;const st=(Se+Qe)/2-de;return st>.5?pt=-1:st<-.5&&(pt=1),Se=((Se+pt)*pe-(de*=pe))*we+de,Qe=((Qe+pt)*pe-de)*we+de,He=(He*pe-(be*=pe))*we+be,Ce=(Ce*pe-be)*we+be,[[Se,Ce,0],[Qe,Ce,0],[Qe,He,0],[Se,He,0]]}(i,e,t._pixelsPerMercatorPixel,I,z);for(let se=0;se<f.length;se++)Ho(f[se],oe[se],ie);const ue=a.N.add([],oe[G],oe[(G+1)%4]);a.N.scale(ue,ue,.5),Ho(J,ue,ie)}for(const oe of f)a.N.min(y,y,oe),a.N.max(_,_,oe);return y[2]=Math.min(j[2],X[2]),a.N.min(y,y,J),a.N.max(_,_,J),new Ri(y,_)}function ed({x:t,y:e,z:i},n=!1){const s=1/(1<<i),l=new ne(vt(t*s),e===(1<<i)-1&&n?-90:Zt((e+1)*s)),h=new ne(vt((t+1)*s),e===0&&n?90:Zt(e*s));return new he(l,h)}function Bf(t,e=V){const i=qt(t.getNorth()),n=qt(t.getSouth()),s=Math.cos(i),l=Math.cos(n),h=Math.sin(i),f=Math.sin(n),m=t.getWest(),_=t.getEast();return[re(l,f,m,e),re(l,f,_,e),re(s,h,_,e),re(s,h,m,e)]}function Mu(t,e,i,n){const s=1<<i.z,l=(t/qe+i.x)/s;return me(Zt((e/qe+i.y)/s),vt(l),n)}function td({min:t,max:e}){return $/Math.max(e[0]-t[0],e[1]-t[1],e[2]-t[2])}const a_=new Float64Array(16);function id(t){const e=td(t),i=a.a6.fromScaling(a_,[e,e,e]);return a.a6.translate(i,i,a.N.negate([],t.min))}function Ff(t){const e=a.a6.fromTranslation(a_,t.min),i=1/td(t);return a.a6.scale(e,e,[i,i,i])}function Nf(t){const e=qe/(2*Math.PI);return t/(2*Math.PI)/e}function l_(t,e){return qe/(512*Math.pow(2,t))*td(xo(e))}function c_(t,e,i,n,s){const l=Nf(i),h=[t,e,-i/(2*Math.PI)],f=a.a6.identity(new Float64Array(16));return a.a6.translate(f,f,h),a.a6.scale(f,f,[l,l,l]),a.a6.rotateX(f,f,qt(-s)),a.a6.rotateY(f,f,qt(-n)),f}function Cs(t){return Jo(q,B,t)}function u_(t,e){const i=me(e.lat,e.lng),n=function(l){const h=me(l._center.lat,l._center.lng),f=a.N.fromValues(0,1,0);let m=a.N.cross([],f,h);const _=a.a6.fromRotation([],-l.angle,h);m=a.N.transformMat4(m,m,_),a.a6.fromRotation(_,-l._pitch,m);const y=a.N.normalize([],h);return a.N.scale(y,y,Qh(l.cameraToCenterDistance/l.pixelsPerMeter)),a.N.transformMat4(y,y,_),a.N.add([],h,y)}(t),s=a.N.subtract([],n,i);return a.N.angle(s,i)}function Vf(t,e){return u_(t,e)>Math.PI/2*1.01}const h_=qt(85),v0=Math.cos(h_),b0=Math.sin(h_),w0=a.a6.create(),d_=t=>{const e=[];return t.paint.get("circle-pitch-alignment")==="map"&&e.push("PITCH_WITH_MAP"),t.paint.get("circle-pitch-scale")==="map"&&e.push("SCALE_WITH_MAP"),e};function f_(t,e,i,n,s,l,h,f,m){if(l&&t.queryGeometry.isAboveHorizon)return!1;l&&(m*=t.pixelToTileUnitsFactor);const _=t.tileID.canonical,y=i.projection.upVectorScale(_,i.center.lat,i.worldSize).metersToTile;for(const v of e)for(const w of v){const E=w.add(f),A=s&&i.elevation?i.elevation.exaggeration()*s.getElevationAt(E.x,E.y,!0):0,I=i.projection.projectTilePoint(E.x,E.y,_);if(A>0){const G=i.projection.upVector(_,E.x,E.y);I.x+=G[0]*y*A,I.y+=G[1]*y*A,I.z+=G[2]*y*A}const z=l?E:T0(I.x,I.y,I.z,n),L=l?t.tilespaceRays.map(G=>E0(G,A)):t.queryGeometry.screenGeometry,N=a.a7.transformMat4([],[I.x,I.y,I.z,1],n);if(!h&&l?m*=N[3]/i.cameraToCenterDistance:h&&!l&&(m*=i.cameraToCenterDistance/N[3]),l){const G=Zt((w.y/qe+_.y)/(1<<_.z));m/=i.projection.pixelsPerMeter(G,1)/bt(1,G)}if(_o(L,z,m))return!0}return!1}function T0(t,e,i,n){const s=a.a7.transformMat4([],[t,e,i,1],n);return new Ue(s[0]/s[3],s[1]/s[3])}const p_=a.N.fromValues(0,0,0),M0=a.N.fromValues(0,0,1);function E0(t,e){const i=a.N.create();return p_[2]=e,t.intersectsPlane(p_,M0,i),new Ue(i[0],i[1])}class m_ extends Dr{}function __(t,{width:e,height:i},n,s){if(s){if(s instanceof Uint8ClampedArray)s=new Uint8Array(s.buffer);else if(s.length!==e*i*n)throw new RangeError("mismatched image size")}else s=new Uint8Array(e*i*n);return t.width=e,t.height=i,t.data=s,t}function g_(t,e,i){const{width:n,height:s}=e;n===t.width&&s===t.height||(Uf(t,e,{x:0,y:0},{x:0,y:0},{width:Math.min(t.width,n),height:Math.min(t.height,s)},i),t.width=n,t.height=s,t.data=e.data)}function Uf(t,e,i,n,s,l,h){if(s.width===0||s.height===0)return e;if(s.width>t.width||s.height>t.height||i.x>t.width-s.width||i.y>t.height-s.height)throw new RangeError("out of range source coordinates for image copy");if(s.width>e.width||s.height>e.height||n.x>e.width-s.width||n.y>e.height-s.height)throw new RangeError("out of range destination coordinates for image copy");const f=t.data,m=e.data,_=l===4&&h;for(let y=0;y<s.height;y++){const v=((i.y+y)*t.width+i.x)*l,w=((n.y+y)*e.width+n.x)*l;if(_)for(let E=0;E<s.width;E++){const A=v+E*l+3,I=w+E*l;m[I+0]=255,m[I+1]=255,m[I+2]=255,m[I+3]=f[A]}else for(let E=0;E<s.width*l;E++)m[w+E]=f[v+E]}return e}Ke(m_,"HeatmapBucket",{omit:["layers"]});class Ps{constructor(e,i){__(this,e,1,i)}resize(e){g_(this,new Ps(e),1)}clone(){return new Ps({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,i,n,s,l){Uf(e,i,n,s,l,1)}}class dn{constructor(e,i){__(this,e,4,i)}resize(e){g_(this,new dn(e),4)}replace(e,i){i?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new dn({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,i,n,s,l,h){Uf(e,i,n,s,l,4,h)}}class y_{constructor(e,i){this.width=e.width,this.height=e.height,this.data=i instanceof Uint8Array?new Float32Array(i.buffer):i}}Ke(Ps,"AlphaImage"),Ke(dn,"RGBAImage");const S0=new Ci({visibility:new Oe(le.layout_heatmap.visibility)});var A0={paint:new Ci({"heatmap-radius":new ut(le.paint_heatmap["heatmap-radius"]),"heatmap-weight":new ut(le.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Oe(le.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Uo(le.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Oe(le.paint_heatmap["heatmap-opacity"])}),layout:S0};function Eu(t){const e={},i=t.resolution||256,n=t.clips?t.clips.length:1,s=t.image||new dn({width:i,height:n}),l=(h,f,m)=>{e[t.evaluationKey]=m;const _=t.expression.evaluate(e);_&&(s.data[h+f+0]=Math.floor(255*_.r/_.a),s.data[h+f+1]=Math.floor(255*_.g/_.a),s.data[h+f+2]=Math.floor(255*_.b/_.a),s.data[h+f+3]=Math.floor(255*_.a))};if(t.clips)for(let h=0,f=0;h<n;++h,f+=4*i)for(let m=0,_=0;m<i;m++,_+=4){const y=m/(i-1),{start:v,end:w}=t.clips[h];l(f,_,v*(1-y)+w*y)}else for(let h=0,f=0;h<i;h++,f+=4)l(0,f,h/(i-1));return s}const I0=new Ci({visibility:new Oe(le.layout_hillshade.visibility)});var C0={paint:new Ci({"hillshade-illumination-direction":new Oe(le.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new Oe(le.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new Oe(le.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new Oe(le.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new Oe(le.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new Oe(le.paint_hillshade["hillshade-accent-color"]),"hillshade-emissive-strength":new Oe(le.paint_hillshade["hillshade-emissive-strength"])}),layout:I0};const P0=li([{name:"a_pos",components:2,type:"Int16"}],4),{members:z0}=P0;var jf={exports:{}};function rd(t,e,i){i=i||2;var n,s,l,h,f,m,_,y=e&&e.length,v=y?e[0]*i:t.length,w=x_(t,0,v,i,!0),E=[];if(!w||w.next===w.prev)return E;if(y&&(w=function(I,z,L,N){var G,j,X,W=[];for(G=0,j=z.length;G<j;G++)(X=x_(I,z[G]*N,G<j-1?z[G+1]*N:I.length,N,!1))===X.next&&(X.steiner=!0),W.push(N0(X));for(W.sort(O0),G=0;G<W.length;G++)L=B0(W[G],L);return L}(t,e,w,i)),t.length>80*i){n=l=t[0],s=h=t[1];for(var A=i;A<v;A+=i)(f=t[A])<n&&(n=f),(m=t[A+1])<s&&(s=m),f>l&&(l=f),m>h&&(h=m);_=(_=Math.max(l-n,h-s))!==0?32767/_:0}return Su(w,E,i,n,s,_,0),E}function x_(t,e,i,n,s){var l,h;if(s===qf(t,e,i,n)>0)for(l=e;l<i;l+=n)h=w_(l,t[l],t[l+1],h);else for(l=i-n;l>=e;l-=n)h=w_(l,t[l],t[l+1],h);return h&&nd(h,h.next)&&(Iu(h),h=h.next),h}function ka(t,e){if(!t)return t;e||(e=t);var i,n=t;do if(i=!1,n.steiner||!nd(n,n.next)&&Xi(n.prev,n,n.next)!==0)n=n.next;else{if(Iu(n),(n=e=n.prev)===n.next)break;
vendor: 4,659 bytes, line 7
7i=!0}while(i||n!==e);return e}function Su(t,e,i,n,s,l,h){if(t){!h&&l&&function(y,v,w,E){var A=y;do A.z===0&&(A.z=Gf(A.x,A.y,v,w,E)),A.prevZ=A.prev,A.nextZ=A.next,A=A.next;while(A!==y);A.prevZ.nextZ=null,A.prevZ=null,function(I){var z,L,N,G,j,X,W,J,ie=1;do{for(L=I,I=null,j=null,X=0;L;){for(X++,N=L,W=0,z=0;z<ie&&(W++,N=N.nextZ);z++);for(J=ie;W>0||J>0&&N;)W!==0&&(J===0||!N||L.z<=N.z)?(G=L,L=L.nextZ,W--):(G=N,N=N.nextZ,J--),j?j.nextZ=G:I=G,G.prevZ=j,j=G;L=N}j.nextZ=null,ie*=2}while(X>1)}(A)}(t,n,s,l);for(var f,m,_=t;t.prev!==t.next;)if(f=t.prev,m=t.next,l?L0(t,n,s,l):D0(t))e.push(f.i/i|0),e.push(t.i/i|0),e.push(m.i/i|0),Iu(t),t=m.next,_=m.next;else if((t=m)===_){h?h===1?Su(t=R0(ka(t),e,i),e,i,n,s,l,2):h===2&&k0(t,e,i,n,s,l):Su(ka(t),e,i,n,s,l,1);break}}}function D0(t){var e=t.prev,i=t,n=t.next;if(Xi(e,i,n)>=0)return!1;for(var s=e.x,l=i.x,h=n.x,f=e.y,m=i.y,_=n.y,y=s<l?s<h?s:h:l<h?l:h,v=f<m?f<_?f:_:m<_?m:_,w=s>l?s>h?s:h:l>h?l:h,E=f>m?f>_?f:_:m>_?m:_,A=n.next;A!==e;){if(A.x>=y&&A.x<=w&&A.y>=v&&A.y<=E&&Il(s,f,l,m,h,_,A.x,A.y)&&Xi(A.prev,A,A.next)>=0)return!1;A=A.next}return!0}function L0(t,e,i,n){var s=t.prev,l=t,h=t.next;if(Xi(s,l,h)>=0)return!1;for(var f=s.x,m=l.x,_=h.x,y=s.y,v=l.y,w=h.y,E=f<m?f<_?f:_:m<_?m:_,A=y<v?y<w?y:w:v<w?v:w,I=f>m?f>_?f:_:m>_?m:_,z=y>v?y>w?y:w:v>w?v:w,L=Gf(E,A,e,i,n),N=Gf(I,z,e,i,n),G=t.prevZ,j=t.nextZ;G&&G.z>=L&&j&&j.z<=N;){if(G.x>=E&&G.x<=I&&G.y>=A&&G.y<=z&&G!==s&&G!==h&&Il(f,y,m,v,_,w,G.x,G.y)&&Xi(G.prev,G,G.next)>=0||(G=G.prevZ,j.x>=E&&j.x<=I&&j.y>=A&&j.y<=z&&j!==s&&j!==h&&Il(f,y,m,v,_,w,j.x,j.y)&&Xi(j.prev,j,j.next)>=0))return!1;j=j.nextZ}for(;G&&G.z>=L;){if(G.x>=E&&G.x<=I&&G.y>=A&&G.y<=z&&G!==s&&G!==h&&Il(f,y,m,v,_,w,G.x,G.y)&&Xi(G.prev,G,G.next)>=0)return!1;G=G.prevZ}for(;j&&j.z<=N;){if(j.x>=E&&j.x<=I&&j.y>=A&&j.y<=z&&j!==s&&j!==h&&Il(f,y,m,v,_,w,j.x,j.y)&&Xi(j.prev,j,j.next)>=0)return!1;j=j.nextZ}return!0}function R0(t,e,i){var n=t;do{var s=n.prev,l=n.next.next;!nd(s,l)&&v_(s,n,n.next,l)&&Au(s,l)&&Au(l,s)&&(e.push(s.i/i|0),e.push(n.i/i|0),e.push(l.i/i|0),Iu(n),Iu(n.next),n=t=l),n=n.next}while(n!==t);return ka(n)}function k0(t,e,i,n,s,l){var h=t;do{for(var f=h.next.next;f!==h.prev;){if(h.i!==f.i&&V0(h,f)){var m=b_(h,f);return h=ka(h,h.next),m=ka(m,m.next),Su(h,e,i,n,s,l,0),void Su(m,e,i,n,s,l,0)}f=f.next}h=h.next}while(h!==t)}function O0(t,e){return t.x-e.x}function B0(t,e){var i=function(s,l){var h,f=l,m=s.x,_=s.y,y=-1/0;do{if(_<=f.y&&_>=f.next.y&&f.next.y!==f.y){var v=f.x+(_-f.y)*(f.next.x-f.x)/(f.next.y-f.y);if(v<=m&&v>y&&(y=v,h=f.x<f.next.x?f:f.next,v===m))return h}f=f.next}while(f!==l);if(!h)return null;var w,E=h,A=h.x,I=h.y,z=1/0;f=h;do m>=f.x&&f.x>=A&&m!==f.x&&Il(_<I?m:y,_,A,I,_<I?y:m,_,f.x,f.y)&&(w=Math.abs(_-f.y)/(m-f.x),Au(f,s)&&(w<z||w===z&&(f.x>h.x||f.x===h.x&&F0(h,f)))&&(h=f,z=w)),f=f.next;while(f!==E);return h}(t,e);if(!i)return e;var n=b_(i,t);return ka(n,n.next),ka(i,i.next)}function F0(t,e){return Xi(t.prev,t,e.prev)<0&&Xi(e.next,t,t.next)<0}function Gf(t,e,i,n,s){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-i)*s|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*s|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function N0(t){var e=t,i=t;do(e.x<i.x||e.x===i.x&&e.y<i.y)&&(i=e),e=e.next;while(e!==t);return i}function Il(t,e,i,n,s,l,h,f){return(s-h)*(e-f)>=(t-h)*(l-f)&&(t-h)*(n-f)>=(i-h)*(e-f)&&(i-h)*(l-f)>=(s-h)*(n-f)}function V0(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(i,n){var s=i;do{if(s.i!==i.i&&s.next.i!==i.i&&s.i!==n.i&&s.next.i!==n.i&&v_(s,s.next,i,n))return!0;s=s.next}while(s!==i);return!1}(t,e)&&(Au(t,e)&&Au(e,t)&&function(i,n){var s=i,l=!1,h=(i.x+n.x)/2,f=(i.y+n.y)/2;do s.y>f!=s.next.y>f&&s.next.y!==s.y&&h<(s.next.x-s.x)*(f-s.y)/(s.next.y-s.y)+s.x&&(l=!l),s=s.next;while(s!==i);return l}(t,e)&&(Xi(t.prev,t,e.prev)||Xi(t,e.prev,e))||nd(t,e)&&Xi(t.prev,t,t.next)>0&&Xi(e.prev,e,e.next)>0)}function Xi(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function nd(t,e){return t.x===e.x&&t.y===e.y}function v_(t,e,i,n){var s=sd(Xi(t,e,i)),l=sd(Xi(t,e,n)),h=sd(Xi(i,n,t)),f=sd(Xi(i,n,e));return s!==l&&h!==f||!(s!==0||!od(t,i,e))||!(l!==0||!od(t,n,e))||!(h!==0||!od(i,t,n))||!(f!==0||!od(i,e,n))}function od(t,e,i){return e.x<=Math.max(t.x,i.x)&&e.x>=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function sd(t){return t>0?1:t<0?-1:0}function Au(t,e){return Xi(t.prev,t,t.next)<0?Xi(t,e,t.next)>=0&&Xi(t,t.prev,e)>=0:Xi(t,e,t.prev)<0||Xi(t,t.next,e)<0}function b_(t,e){var i=new Zf(t.i,t.x,t.y),n=new Zf(e.i,e.x,e.y),s=t.next,l=e.prev;return t.next=e,e.prev=t,i.next=s,s.prev=i,n.next=i,i.prev=n,l.next=n,n.prev=l,n}function w_(t,e,i,n){var s=new Zf(t,e,i);
vendor: 5,926 bytes, line 7
7return n?(s.next=n.next,s.prev=n,n.next.prev=s,n.next=s):(s.prev=s,s.next=s),s}function Iu(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 Zf(t,e,i){this.i=t,this.x=e,this.y=i,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function qf(t,e,i,n){for(var s=0,l=e,h=i-n;l<i;l+=n)s+=(t[h]-t[l])*(t[l+1]+t[h+1]),h=l;return s}jf.exports=rd,jf.exports.default=rd,rd.deviation=function(t,e,i,n){var s=e&&e.length,l=Math.abs(qf(t,0,s?e[0]*i:t.length,i));if(s)for(var h=0,f=e.length;h<f;h++)l-=Math.abs(qf(t,e[h]*i,h<f-1?e[h+1]*i:t.length,i));var m=0;for(h=0;h<n.length;h+=3){var _=n[h]*i,y=n[h+1]*i,v=n[h+2]*i;m+=Math.abs((t[_]-t[v])*(t[y+1]-t[_+1])-(t[_]-t[y])*(t[v+1]-t[_+1]))}return l===0&&m===0?0:Math.abs((m-l)/l)},rd.flatten=function(t){for(var e=t[0][0].length,i={vertices:[],holes:[],dimensions:e},n=0,s=0;s<t.length;s++){for(var l=0;l<t[s].length;l++)for(var h=0;h<e;h++)i.vertices.push(t[s][l][h]);s>0&&i.holes.push(n+=t[s-1].length)}return i};var ad=kr(jf.exports);function $f(t,e){const i=t.length;if(i<=1)return[t];const n=[];let s,l;for(let h=0;h<i;h++){const f=So(t[h]);f!==0&&(t[h].area=Math.abs(f),l===void 0&&(l=f<0),l===f<0?(s&&n.push(s),s=[t[h]]):s.push(t[h]))}if(s&&n.push(s),e>1)for(let h=0;h<n.length;h++)n[h].length<=e||(Wd(n[h],e,1,n[h].length-1,U0),n[h]=n[h].slice(0,e));return n}function U0(t,e){return e.area-t.area}function Wf(t,e,i){const n=i.patternDependencies;let s=!1;for(const l of e){const h=l.paint.get(`${t}-pattern`);h.isConstant()||(s=!0);const f=h.constantOr(null);f&&(s=!0,n[f]=!0)}return s}function Hf(t,e,i,n,s){const l=s.patternDependencies;for(const h of e){const f=h.paint.get(`${t}-pattern`).value;if(f.kind!=="constant"){let m=f.evaluate({zoom:n},i,{},s.availableImages);m=m&&m.name?m.name:m,l[m]=!0,i.patterns[h.id]=m}}return i}class Xf{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(i=>i.fqid),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new cn,this.indexArray=new Ji,this.indexArray2=new vn,this.programConfigurations=new k(e.layers,e.zoom),this.segments=new Oi,this.segments2=new Oi,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.projection=e.projection}populate(e,i,n,s){this.hasPattern=Wf("fill",this.layers,i);const l=this.layers[0].layout.get("fill-sort-key"),h=[];for(const{feature:f,id:m,index:_,sourceLayerIndex:y}of e){const v=this.layers[0]._featureFilter.needGeometry,w=Hi(f,v);if(!this.layers[0]._featureFilter.filter(new Ii(this.zoom),w,n))continue;const E=l?l.evaluate(w,{},n,i.availableImages):void 0,A={id:m,properties:f.properties,type:f.type,sourceLayerIndex:y,index:_,geometry:v?w.geometry:er(f,n,s),patterns:{},sortKey:E};h.push(A)}l&&h.sort((f,m)=>f.sortKey-m.sortKey);for(const f of h){const{geometry:m,index:_,sourceLayerIndex:y}=f;if(this.hasPattern){const v=Hf("fill",this.layers,f,this.zoom,i);this.patternFeatures.push(v)}else this.addFeature(f,m,_,n,{},i.availableImages,i.brightness);i.featureIndex.insert(e[_].feature,m,_,y,this.index)}}update(e,i,n,s,l){const h=Object.keys(e).length!==0;h&&!this.stateDependentLayers.length||this.programConfigurations.updatePaintArrays(e,i,h?this.stateDependentLayers:this.layers,n,s,l)}addFeatures(e,i,n,s,l,h){for(const f of this.patternFeatures)this.addFeature(f,f.geometry,f.index,i,n,s,h)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,z0),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.indexBuffer2=e.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(e,i,n,s,l,h=[],f){for(const m of $f(i,500)){let _=0;for(const I of m)_+=I.length;const y=this.segments.prepareSegment(_,this.layoutVertexArray,this.indexArray),v=y.vertexLength,w=[],E=[];for(const I of m){if(I.length===0)continue;I!==m[0]&&E.push(w.length/2);const z=this.segments2.prepareSegment(I.length,this.layoutVertexArray,this.indexArray2),L=z.vertexLength;this.layoutVertexArray.emplaceBack(I[0].x,I[0].y),this.indexArray2.emplaceBack(L+I.length-1,L),w.push(I[0].x),w.push(I[0].y);for(let N=1;N<I.length;N++)this.layoutVertexArray.emplaceBack(I[N].x,I[N].y),this.indexArray2.emplaceBack(L+N-1,L+N),w.push(I[N].x),w.push(I[N].y);z.vertexLength+=I.length,z.primitiveLength+=I.length}const A=ad(w,E);for(let I=0;I<A.length;I+=3)this.indexArray.emplaceBack(v+A[I],v+A[I+1],v+A[I+2]);y.vertexLength+=_,y.primitiveLength+=A.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,l,h,s,f)}}Ke(Xf,"FillBucket",{omit:["layers","patternFeatures"]});const j0=new Ci({"fill-sort-key":new ut(le.layout_fill["fill-sort-key"]),visibility:new Oe(le.layout_fill.visibility)});var G0={paint:new Ci({"fill-antialias":new Oe(le.paint_fill["fill-antialias"]),"fill-opacity":new ut(le.paint_fill["fill-opacity"]),"fill-color":new ut(le.paint_fill["fill-color"]),"fill-outline-color":new ut(le.paint_fill["fill-outline-color"]),"fill-translate":new Oe(le.paint_fill["fill-translate"]),"fill-translate-anchor":new Oe(le.paint_fill["fill-translate-anchor"]),"fill-pattern":new ut(le.paint_fill["fill-pattern"]),"fill-emissive-strength":new Oe(le.paint_fill["fill-emissive-strength"])}),layout:j0};const Z0=li([{name:"a_pos_normal_ed",components:4,type:"Int16"}]),q0=li([{name:"a_pos_end",components:4,type:"Int16"},{name:"a_angular_offset_factor",components:1,type:"Int16"}]),$0=li([{name:"a_centroid_pos",components:2,type:"Uint16"}
7]),W0=li([{name:"a_hidden_by_landmark",components:1,type:"Uint8"}]),H0=li([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]),{members:X0}=Z0;var ld={},Y0=Wn,T_=Cl;function Cl(t,e,i,n,s){this.properties={},this.extent=i,this.type=0,this._pbf=t,this._geometry=-1,this._keys=n,this._values=s,t.readFields(K0,this,e)}function K0(t,e,i){t==1?e.id=i.readVarint():t==2?function(n,s){for(var l=n.readVarint()+n.pos;n.pos<l;){var h=s._keys[n.readVarint()],f=s._values[n.readVarint()];s.properties[h]=f}}(i,e):t==3?e.type=i.readVarint():t==4&&(e._geometry=i.pos)}function J0(t){for(var e,i,n=0,s=0,l=t.length,h=l-1;s<l;h=s++)n+=((i=t[h]).x-(e=t[s]).x)*(e.y+i.y);return n}Cl.types=["Unknown","Point","LineString","Polygon"],Cl.prototype.loadGeometry=function(){var t=this._pbf;t.pos=this._geometry;for(var e,i=t.readVarint()+t.pos,n=1,s=0,l=0,h=0,f=[];t.pos<i;){if(s<=0){var m=t.readVarint();n=7&m,s=m>>3}if(s--,n===1||n===2)l+=t.readSVarint(),h+=t.readSVarint(),n===1&&(e&&f.push(e),e=[]),e.push(new Y0(l,h));else{if(n!==7)throw new Error("unknown command "+n);e&&e.push(e[0].clone())}}return e&&f.push(e),f},Cl.prototype.bbox=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,i=1,n=0,s=0,l=0,h=1/0,f=-1/0,m=1/0,_=-1/0;t.pos<e;){if(n<=0){var y=t.readVarint();i=7&y,n=y>>3}if(n--,i===1||i===2)(s+=t.readSVarint())<h&&(h=s),s>f&&(f=s),(l+=t.readSVarint())<m&&(m=l),l>_&&(_=l);else if(i!==7)throw new Error("unknown command "+i)}return[h,m,f,_]},Cl.prototype.toGeoJSON=function(t,e,i){var n,s,l=this.extent*Math.pow(2,i),h=this.extent*t,f=this.extent*e,m=this.loadGeometry(),_=Cl.types[this.type];function y(E){for(var A=0;A<E.length;A++){var I=E[A];E[A]=[360*(I.x+h)/l-180,360/Math.PI*Math.atan(Math.exp((180-360*(I.y+f)/l)*Math.PI/180))-90]}}switch(this.type){case 1:var v=[];for(n=0;n<m.length;n++)v[n]=m[n][0];y(m=v);break;case 2:for(n=0;n<m.length;n++)y(m[n]);break;case 3:for(m=function(E){var A=E.length;if(A<=1)return[E];for(var I,z,L=[],N=0;N<A;N++){var G=J0(E[N]);G!==0&&(z===void 0&&(z=G<0),z===G<0?(I&&L.push(I),I=[E[N]]):I.push(E[N]))}return I&&L.push(I),L}(m),n=0;n<m.length;n++)for(s=0;s<m[n].length;s++)y(m[n][s])}m.length===1?m=m[0]:_="Multi"+_;var w={type:"Feature",geometry:{type:_,coordinates:m},properties:this.properties};return"id"in this&&(w.id=this.id),w};var Q0=T_,M_=E_;function E_(t,e){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(ex,this,e),this.length=this._features.length}function ex(t,e,i){t===15?e.version=i.readVarint():t===1?e.name=i.readString():t===5?e.extent=i.readVarint():t===2?e._features.push(i.pos):t===3?e._keys.push(i.readString()):t===4&&e._values.push(function(n){for(var s=null,l=n.readVarint()+n.pos;n.pos<l;){var h=n.readVarint()>>3;s=h===1?n.readString():h===2?n.readFloat():h===3?n.readDouble():h===4?n.readVarint64():h===5?n.readVarint():h===6?n.readSVarint():h===7?n.readBoolean():null}return s}(i))}E_.prototype.feature=function(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];var e=this._pbf.readVarint()+this._pbf.pos;return new Q0(this._pbf,e,this.extent,this._keys,this._values)};var tx=M_;function ix(t,e,i){if(t===3){var n=new tx(i,i.readVarint()+i.pos);n.length&&(e[n.name]=n)}}var Yf=ld.VectorTile=function(t,e){this.layers=t.readFields(ix,{},e)},cd=ld.VectorTileFeature=T_;function ud(t,e,i,n){const s=[],l=n===0?(h,f,m,_,y,v)=>{h.push(new Ue(v,m+(v-f)/(_-f)*(y-m)))}:(h,f,m,_,y,v)=>{h.push(new Ue(f+(v-m)/(y-m)*(_-f),v))};for(const h of t){const f=[];for(const m of h){if(m.length<=2)continue;const _=[];for(let w=0;w<m.length-1;w++){const E=m[w].x,A=m[w].y,I=m[w+1].x,z=m[w+1].y,L=n===0?E:A,N=n===0?I:z;L<e?N>e&&l(_,E,A,I,z,e):L>i?N<i&&l(_,E,A,I,z,i):_.push(m[w]),N<e&&L>=e&&l(_,E,A,I,z,e),N>i&&L<=i&&l(_,E,A,I,z,i)}let y=m[m.length-1];const v=n===0?y.x:y.y;v>=e&&v<=i&&_.push(y),_.length&&(y=_[_.length-1],_[0].x===y.x&&_[0].y===y.y||_.push(_[0]),f.push(_))}f.length&&s.push(f)}return s}function hd(t,e){return t.x-e.x||t.y-e.y}function S_(t,e){return hd(t.min,e.min)===0&&hd(t.max,e.max)===0}function A_(t,e){return!(t.min.x>e.max.x||t.max.x<e.min.x||t.min.y>e.max.y||t.max.y<e.min.y)}function I_(t,e,i){const n=1/qe,s=1/(1<<i.canonical.z),l=(e.x*n+i.canonical.x)*s+i.wrap,h=(e.y*n+i.canonical.y)*s;return{min:new Ue((t.x*n+i.canonical.x)*s+i.wrap,(t.y*n+i.canonical.y)*s),max:new Ue(l,h)}}function rx(t,e,i){const n=1<<i.canonical.z,s=((e.x-i.wrap)*n-i.canonical.x)*qe,l=(e.y*n-i.canonical.y)*qe;return{min:new Ue(((t.x-i.wrap)*n-i.canonical.x)*qe,(t.y*n-i.canonical.y)*qe),max:new Ue(s,l)}}function C_(t,e,i,n,s,l,h){const f=t.indices,m=t.vertices,_=[];for(let y=n;y<n+s;y+=3){const v=e[i[y+0]+l],w=e[i[y+1]+l],E=e[i[y+2]+l],A=Math.min(v.x,w.x,E.x),I=Math.max(v.x,w.x,E.x),z=Math.min(v.y,w.y,E.y),L=Math.max(v.y,w.y,E.y);_.length=0,t.grid.query(new Ue(A,z),new Ue(I,L),_);for(let N=0;N<_.length;N++){const G=_[N];if(gf(m[f[3*G+0]],m[f[3*G+1]],m[f[3*G+2]],v,w,E,h))return!0}}return!1}function P_(t,e,i,n){if(!t||!i)return!1;let s=t.vertices;if(!e.canonical.equals(n.canonical)||e.wrap!==n.wrap){if(i.vertices.length<t.vertices.length)return P_(i,n,t,e);const l=e.canonical,h=n.canonical,f=Math.pow(2,h.z-l.z);s=t.vertices.map(m=>
vendor: 2,709 bytes, line 7
7new Ue(m.x*l.x*qe*f-h.x*qe,m.y*l.y*qe*f-h.y*qe))}return C_(i,s,t.indices,0,t.indices.length,0,0)}ld.VectorTileLayer=M_;class z_{constructor(e){this.size=e,this.minimums=[],this.maximums=[],this.leaves=[]}getElevation(e,i){const n=this.toIdx(e,i);return{min:this.minimums[n],max:this.maximums[n]}}isLeaf(e,i){return this.leaves[this.toIdx(e,i)]}toIdx(e,i){return i*this.size+e}}function D_(t,e,i,n){let s=0,l=Number.MAX_VALUE;for(let h=0;h<3;h++)if(Math.abs(n[h])<1e-15){if(i[h]<t[h]||i[h]>e[h])return null}else{const f=1/n[h];let m=(t[h]-i[h])*f,_=(e[h]-i[h])*f;if(m>_){const y=m;m=_,_=y}if(m>s&&(s=m),_<l&&(l=_),s>l)return null}return s}function L_(t,e,i,n,s,l,h,f,m,_,y){const v=n-t,w=s-e,E=l-i,A=h-t,I=f-e,z=m-i,L=y[1]*z-y[2]*I,N=y[2]*A-y[0]*z,G=y[0]*I-y[1]*A,j=v*L+w*N+E*G;if(Math.abs(j)<1e-15)return null;const X=1/j,W=_[0]-t,J=_[1]-e,ie=_[2]-i,oe=(W*L+J*N+ie*G)*X;if(oe<0||oe>1)return null;const ue=J*E-ie*w,se=ie*v-W*E,_e=W*w-J*v,Me=(y[0]*ue+y[1]*se+y[2]*_e)*X;return Me<0||oe+Me>1?null:(A*ue+I*se+z*_e)*X}function R_(t,e,i){return(t-e)/(i-e)}function k_(t,e,i,n,s,l,h,f,m){const _=1<<i,y=l-n,v=h-s,w=(t+1)/_*y+n,E=(e+0)/_*v+s,A=(e+1)/_*v+s;f[0]=(t+0)/_*y+n,f[1]=E,m[0]=w,m[1]=A}class O_{constructor(e){if(this.maximums=[],this.minimums=[],this.leaves=[],this.childOffsets=[],this.nodeCount=0,this.dem=e,this._siblingOffset=[[0,0],[1,0],[0,1],[1,1]],!this.dem)return;const i=function(l){const h=Math.ceil(Math.log2(l.dim/8)),f=[];let m=Math.ceil(Math.pow(2,h));const _=1/m,y=(E,A,I,z,L)=>{const N=z?1:0,G=(E+1)*I-N,j=A*I,X=(A+1)*I-N;L[0]=E*I,L[1]=j,L[2]=G,L[3]=X};let v=new z_(m);const w=[];for(let E=0;E<m*m;E++){y(E%m,Math.floor(E/m),_,!1,w);const A=zs(w[0],w[1],l),I=zs(w[2],w[1],l),z=zs(w[2],w[3],l),L=zs(w[0],w[3],l);v.minimums.push(Math.min(A,I,z,L)),v.maximums.push(Math.max(A,I,z,L)),v.leaves.push(1)}for(f.push(v),m/=2;m>=1;m/=2){const E=f[f.length-1];v=new z_(m);for(let A=0;A<m*m;A++){y(A%m,Math.floor(A/m),2,!0,w);const I=E.getElevation(w[0],w[1]),z=E.getElevation(w[2],w[1]),L=E.getElevation(w[2],w[3]),N=E.getElevation(w[0],w[3]),G=E.isLeaf(w[0],w[1]),j=E.isLeaf(w[2],w[1]),X=E.isLeaf(w[2],w[3]),W=E.isLeaf(w[0],w[3]),J=Math.min(I.min,z.min,L.min,N.min),ie=Math.max(I.max,z.max,L.max,N.max),oe=G&&j&&X&&W;v.maximums.push(ie),v.minimums.push(J),v.leaves.push(ie-J<=5&&oe?1:0)}f.push(v)}return f}(this.dem),n=i.length-1,s=i[n];this._addNode(s.minimums[0],s.maximums[0],s.leaves[0]),this._construct(i,0,0,n,0)}raycastRoot(e,i,n,s,l,h,f=1){return D_([e,i,-100],[n,s,this.maximums[0]*f],l,h)}raycast(e,i,n,s,l,h,f=1){if(!this.nodeCount)return null;const m=this.raycastRoot(e,i,n,s,l,h,f);if(m==null)return null;const _=[],y=[],v=[],w=[],E=[{idx:0,t:m,nodex:0,nodey:0,depth:0}];for(;E.length>0;
vendor: 39,467 bytes, line 7
7){const{idx:A,t:I,nodex:z,nodey:L,depth:N}=E.pop();if(this.leaves[A]){k_(z,L,N,e,i,n,s,v,w);const j=1<<N,X=(z+0)/j,W=(z+1)/j,J=(L+0)/j,ie=(L+1)/j,oe=zs(X,J,this.dem)*f,ue=zs(W,J,this.dem)*f,se=zs(W,ie,this.dem)*f,_e=zs(X,ie,this.dem)*f,Me=L_(v[0],v[1],oe,w[0],v[1],ue,w[0],w[1],se,l,h),pe=L_(w[0],w[1],se,v[0],w[1],_e,v[0],v[1],oe,l,h),we=Math.min(Me!==null?Me:Number.MAX_VALUE,pe!==null?pe:Number.MAX_VALUE);if(we!==Number.MAX_VALUE)return we;{const de=a.N.scaleAndAdd([],l,h,I);if(B_(oe,ue,_e,se,R_(de[0],v[0],w[0]),R_(de[1],v[1],w[1]))>=de[2])return I}continue}let G=0;for(let j=0;j<this._siblingOffset.length;j++){k_((z<<1)+this._siblingOffset[j][0],(L<<1)+this._siblingOffset[j][1],N+1,e,i,n,s,v,w),v[2]=-100,w[2]=this.maximums[this.childOffsets[A]+j]*f;const X=D_(v,w,l,h);if(X!=null){const W=X;_[j]=W;let J=!1;for(let ie=0;ie<G&&!J;ie++)W>=_[y[ie]]&&(y.splice(ie,0,j),J=!0);J||(y[G]=j),G++}}for(let j=0;j<G;j++){const X=y[j];E.push({idx:this.childOffsets[A]+X,t:_[X],nodex:(z<<1)+this._siblingOffset[X][0],nodey:(L<<1)+this._siblingOffset[X][1],depth:N+1})}}return null}_addNode(e,i,n){return this.minimums.push(e),this.maximums.push(i),this.leaves.push(n),this.childOffsets.push(0),this.nodeCount++}_construct(e,i,n,s,l){if(e[s].isLeaf(i,n)===1)return;this.childOffsets[l]||(this.childOffsets[l]=this.nodeCount);const h=s-1,f=e[h];let m=0,_=0;for(let y=0;y<this._siblingOffset.length;y++){const v=2*i+this._siblingOffset[y][0],w=2*n+this._siblingOffset[y][1],E=f.getElevation(v,w),A=f.isLeaf(v,w),I=this._addNode(E.min,E.max,A);A&&(m|=1<<y),_||(_=I)}for(let y=0;y<this._siblingOffset.length;y++)m&1<<y||this._construct(e,2*i+this._siblingOffset[y][0],2*n+this._siblingOffset[y][1],h,_+y)}}function B_(t,e,i,n,s,l){return Ut(Ut(t,i,l),Ut(e,n,l),s)}function zs(t,e,i){const n=i.dim,s=Dt(t*n-.5,0,n-1),l=Dt(e*n-.5,0,n-1),h=Math.floor(s),f=Math.floor(l),m=Math.min(h+1,n-1),_=Math.min(f+1,n-1);return B_(i.get(h,f),i.get(m,f),i.get(h,_),i.get(m,_),s-h,l-f)}const nx={mapbox:[6553.6,25.6,.1,1e4],terrarium:[256,1,1/256,32768]};function ox(t,e,i){return(256*t*256+256*e+i)/10-1e4}function sx(t,e,i){return 256*t+e+i/256-32768}class dd{get tree(){return this._tree||this._buildQuadTree(),this._tree}constructor(e,i,n,s=!1){if(this.uid=e,i.height!==i.width)throw new RangeError("DEM tiles must be square");if(n&&n!=="mapbox"&&n!=="terrarium")return ki(`"${n}" is not a valid encoding type. Valid types include "mapbox" and "terrarium".`);this.stride=i.height;const l=this.dim=i.height-2,h=new Uint32Array(i.data.buffer);if(this.pixels=new Uint8Array(i.data.buffer),this.floatView=new Float32Array(i.data.buffer),this.borderReady=s,this._modifiedForSources={},!s){for(let m=0;m<l;m++)h[this._idx(-1,m)]=h[this._idx(0,m)],h[this._idx(l,m)]=h[this._idx(l-1,m)],h[this._idx(m,-1)]=h[this._idx(m,0)],h[this._idx(m,l)]=h[this._idx(m,l-1)];h[this._idx(-1,-1)]=h[this._idx(0,0)],h[this._idx(l,-1)]=h[this._idx(l-1,0)],h[this._idx(-1,l)]=h[this._idx(0,l-1)],h[this._idx(l,l)]=h[this._idx(l-1,l-1)]}const f=n==="terrarium"?sx:ox;for(let m=0;m<h.length;++m){const _=4*m;this.floatView[m]=f(this.pixels[_],this.pixels[_+1],this.pixels[_+2])}this._timestamp=ze.now()}_buildQuadTree(){this._tree=new O_(this)}get(e,i,n=!1){n&&(e=Dt(e,-1,this.dim),i=Dt(i,-1,this.dim));const s=this._idx(e,i);return this.floatView[s]}set(e,i,n){const s=this._idx(e,i),l=this.floatView[s];return this.floatView[s]=n,n-l}static getUnpackVector(e){return nx[e]}_idx(e,i){if(e<-1||e>=this.dim+1||i<-1||i>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(i+1)*this.stride+(e+1)}static pack(e,i){const n=[0,0,0,0],s=dd.getUnpackVector(i);let l=Math.floor((e+s[3])/s[2]);return n[2]=l%256,l=Math.floor(l/256),n[1]=l%256,l=Math.floor(l/256),n[0]=l,n}getPixels(){return new y_({width:this.stride,height:this.stride},this.pixels)}backfillBorder(e,i,n){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let s=i*this.dim,l=i*this.dim+this.dim,h=n*this.dim,f=n*this.dim+this.dim;switch(i){case-1:s=l-1;break;case 1:l=s+1}switch(n){case-1:h=f-1;break;case 1:f=h+1}const m=-i*this.dim,_=-n*this.dim;for(let y=h;y<f;y++)for(let v=s;v<l;v++){const w=4*this._idx(v,y),E=4*this._idx(v+m,y+_);this.pixels[w+0]=e.pixels[E+0],this.pixels[w+1]=e.pixels[E+1],this.pixels[w+2]=e.pixels[E+2],this.pixels[w+3]=e.pixels[E+3]}}onDeserialize(){this._tree&&(this._tree.dem=this)}}Ke(dd,"DEMData"),Ke(O_,"DemMinMaxQuadTree",{omit:["dem"]});class Pl{constructor(e,i,n){this._demTile=e,this._dem=this._demTile.dem,this._scale=i,this._offset=n}static create(e,i,n){const s=n||e.findDEMTileFor(i);if(!s||!s.dem)return;const l=s.dem,h=s.tileID,f=1<<i.canonical.z-h.canonical.z;return new Pl(s,l.dim/qe/f,[(i.canonical.x/f-h.canonical.x)*l.dim,(i.canonical.y/f-h.canonical.y)*l.dim])}tileCoordToPixel(e,i){const n=i*this._scale+this._offset[1],s=Math.floor(e*this._scale+this._offset[0]),l=Math.floor(n);return new Ue(s,l)}getElevationAt(e,i,n,s){const l=e*this._scale+this._offset[0],h=i*this._scale+this._offset[1],f=Math.floor(l),m=Math.floor(h),_=this._dem;return s=!!s,n?Ut(Ut(_.get(f,m,s),_.get(f,m+1,s),h-m),Ut(_.get(f+1,m,s),_.get(f+1,m+1,s),h-m),l-f):_.get(f,m,s)}getElevationAtPixel(e,i,n){return this._dem.get(e,i,!!n)}getMeterToDEM(e){return(1<<this._demTile.tileID.canonical.z)*bt(1,e)*this._dem.stride}}const ax=cd.types,lx=["fill-extrusion-base","fill-extrusion-height","fill-extrusion-color","fill-extrusion-pattern","fill-extrusion-flood-light-wall-radius"],cx=["fill-extrusion-flood-light-ground-radius"],ux=Math.pow(2,13),hx=Math.pow(2,15)-1,F_=new Ue(0,1),Ds=2147483648;function Cu(t,e,i,n,s,l,h,f){t.emplaceBack((e<<1)+h,(i<<1)+l,(Math.floor(n*ux)<<1)+s,Math.round(f))}function fd(t,e,i,n,s,l){t.emplaceBack(e.x,e.y,(i.x<<1)+n,(i.y<<1)+s,l)}function Pu(t,e,i){t.emplaceBack(e.x,e.y,e.z,i[0]*16384,i[1]*16384,i[2]*16384)}class N_{constructor(){this.vertexOffset=0,this.vertexCount=0,this.indexOffset=0,this.indexCount=0}}class V_{constructor(){this.centroidXY=new Ue(0,0),this.vertexArrayOffset=0,this.vertexCount=0,this.groundVertexArrayOffset=0,this.groundVertexCount=0,this.flags=0,this.footprintSegIdx=-1,this.footprintSegLen=0,this.polygonSegIdx=-1,this.polygonSegLen=0,this.min=new Ue(Number.MAX_VALUE,Number.MAX_VALUE),this.max=new Ue(-Number.MAX_VALUE,-Number.MAX_VALUE),this.height=0}span(){return new Ue(this.max.x-this.min.x,this.max.y-this.min.y)}}class U_{constructor(){this.acc=new Ue(0,0),this.accCount=0,this.centroidDataIndex=0}startRing(e,i){e.min.x===Number.MAX_VALUE&&(e.min.x=e.max.x=i.x,e.min.y=e.max.y=i.y)}appendEdge(e,i,n){this.accCount++,this.acc._add(i);let s=!!this.borders;i.x<e.min.x?(e.min.x=i.x,s=!0):i.x>e.max.x&&(e.max.x=i.x,s=!0),i.y<e.min.y?(e.min.y=i.y,s=!0):i.y>e.max.y&&(e.max.y=i.y,s=!0),((i.x===0||i.x===qe)&&i.x===n.x)!=((i.y===0||i.y===qe)&&i.y===n.y)&&this.processBorderOverlap(i,n),s&&this.checkBorderIntersection(i,n)}checkBorderIntersection(e,i){i.x<0!=e.x<0&&this.addBorderIntersection(0,Ut(i.y,e.y,(0-i.x)/(e.x-i.x))),i.x>qe!=e.x>qe&&this.addBorderIntersection(1,Ut(i.y,e.y,(qe-i.x)/(e.x-i.x))),i.y<0!=e.y<0&&this.addBorderIntersection(2,Ut(i.x,e.x,(0-i.y)/(e.y-i.y))),i.y>qe!=e.y>qe&&this.addBorderIntersection(3,Ut(i.x,e.x,(qe-i.y)/(e.y-i.y)))}addBorderIntersection(e,i){this.borders||(this.borders=[[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE]]);const n=this.borders[e];i<n[0]&&(n[0]=i),i>n[1]&&(n[1]=i)}processBorderOverlap(e,i){if(e.x===i.x){if(e.y===i.y)return;const n=e.x===0?0:1;this.addBorderIntersection(n,i.y),this.addBorderIntersection(n,e.y)}else{const n=e.y===0?2:3;this.addBorderIntersection(n,i.x),this.addBorderIntersection(n,e.x)}}centroid(){return this.accCount===0?new Ue(0,0):new Ue(Math.floor(Math.max(0,this.acc.x)/this.accCount),Math.floor(Math.max(0,this.acc.y)/this.accCount))}intersectsCount(){return this.borders?this.borders.reduce((e,i)=>e+ +(i[0]!==Number.MAX_VALUE),0):0}}function j_(t,e){const i=t.add(e)._unit(),n=Dt(t.x*i.x+t.y*i.y,-1,1);var s,l,h;return s=Math.acos(n),Math.min(4,Math.max(-4,Math.tan(s)))/4*hx*((l=t).x*(h=e).y-l.y*h.x<0?-1:1)}const dx=[t=>t.x<0,t=>t.x>qe,t=>t.y<0,t=>t.y>qe];function fx(t,e,i,n){const s=[4];if(n===0)return s;i._mult(n);const l=t.sub(i),h=e.sub(i),f=[t,e,l,h];for(let m=0;m<4;m++)for(const _ of f)if(dx[m](_)){s.push(m);break}return s}class G_{constructor(e){this.vertexArray=new lu,this.indexArray=new Ji,this.programConfigurations=new k(e.layers,e.zoom,i=>cx.includes(i)),this._segments=new Oi,this.hiddenByLandmarkVertexArray=new gu,this._segmentToGroundQuads={},this._segmentToGroundQuads[0]=[],this._segmentToRegionTriCounts={},this._segmentToRegionTriCounts[0]=[0,0,0,0,0],this.regionSegments={},this.regionSegments[4]=new Oi}getDefaultSegment(){return this.regionSegments[4]}hasData(){return this.vertexArray.length!==0}addData(e,i,n,s=!1){const l=e.length;if(l>2){let h=Math.max(0,this._segments.get().length-1);const f=this._segments._prepareSegment(4*l,this.vertexArray.length,2*this._segmentToGroundQuads[h].length);let m;h!==this._segments.get().length-1&&(h++,this._segmentToGroundQuads[h]=[],this._segmentToRegionTriCounts[h]=[0,0,0,0,0]);{const _=e[0],y=e[1];m=j_(_.sub(e[l-1])._perp()._unit(),y.sub(_)._perp()._unit())}for(let _=0;_<l;_++){const y=_===l-1?0:_+1,v=e[_],w=e[y],E=e[y===l-1?0:y+1],A=w.sub(v)._perp()._unit(),I=j_(A,E.sub(w)._perp()._unit()),z=m,L=I;if(Kf(v,w,i)||s&&$_(v,i)&&$_(w,i)){m=I;continue}const N=f.vertexLength;fd(this.vertexArray,v,w,1,1,z),fd(this.vertexArray,v,w,1,0,z),fd(this.vertexArray,v,w,0,1,L),fd(this.vertexArray,v,w,0,0,L),f.vertexLength+=4;const G=fx(v,w,A,n);for(const j of G)this._segmentToGroundQuads[h].push({id:N,region:j}),this._segmentToRegionTriCounts[h][j]+=2,f.primitiveLength+=2;m=I}}}prepareBorderSegments(){if(!this.hasData())return;const e=this._segments.get(),i=e.length;for(let n=0;n<i;n++)this._segmentToGroundQuads[n].sort((s,l)=>s.region-l.region);for(let n=0;n<i;n++){const s=this._segmentToGroundQuads[n],l=e[n],h=this._segmentToRegionTriCounts[n];h.reduce((m,_)=>m+_,0);let f=0;for(let m=0;m<=4;m++){const _=h[m];if(_!==0){let y=this.regionSegments[m];y||(y=this.regionSegments[m]=new Oi);const v={vertexOffset:l.vertexOffset,primitiveOffset:l.primitiveOffset+f,vertexLength:l.vertexLength,primitiveLength:_};y.get().push(v)}f+=_}for(let m=0;m<s.length;m++){const _=s[m].id;this.indexArray.emplaceBack(_,_+1,_+3),this.indexArray.emplaceBack(_,_+3,_+2)}}this._segmentToGroundQuads=null,this._segmentToRegionTriCounts=null,this._segments.destroy(),this._segments=null}addPaintPropertiesData(e,i,n,s,l,h){this.hasData()&&this.programConfigurations.populatePaintArrays(this.vertexArray.length,e,i,n,s,l,h)}upload(e){this.hasData()&&(this.vertexBuffer=e.createVertexBuffer(this.vertexArray,q0.members),this.indexBuffer=e.createIndexBuffer(this.indexArray))}uploadPaintProperties(e){this.hasData()&&this.programConfigurations.upload(e)}update(e,i,n,s,l,h){this.hasData()&&this.programConfigurations.updatePaintArrays(e,i,n,s,l,h)}updateHiddenByLandmark(e){if(!this.hasData())return;const i=e.groundVertexCount+e.groundVertexArrayOffset;if(e.groundVertexCount===0)return;const n=e.flags&Ds?1:0;for(let s=e.groundVertexArrayOffset;s<i;++s)this.hiddenByLandmarkVertexArray.emplace(s,n);this._needsHiddenByLandmarkUpdate=!0}uploadHiddenByLandmark(e){this.hasData()&&this._needsHiddenByLandmarkUpdate&&(!this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexArray.length>0?this.hiddenByLandmarkVertexBuffer=e.createVertexBuffer(this.hiddenByLandmarkVertexArray,W0.members,!0):this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexBuffer.updateData(this.hiddenByLandmarkVertexArray),this._needsHiddenByLandmarkUpdate=!1)}destroy(){if(this.vertexBuffer){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexBuffer.destroy(),this._segments&&this._segments.destroy(),this.programConfigurations.destroy();for(let e=0;e<=4;e++){const i=this.regionSegments[e];i&&i.destroy()}}}}class pd{constructor(e){this.zoom=e.zoom,this.canonical=e.canonical,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(i=>i.fqid),this.index=e.index,this.hasPattern=!1,this.edgeRadius=0,this.projection=e.projection,this.activeReplacements=[],this.replacementUpdateTime=0,this.centroidData=[],this.footprintIndices=new Ji,this.footprintVertices=new cn,this.footprintSegments=[],this.layoutVertexArray=new Rn,this.centroidVertexArray=new Aa,this.indexArray=new Ji,this.programConfigurations=new k(e.layers,e.zoom,i=>lx.includes(i)),this.segments=new Oi,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.groundEffect=new G_(e),this.maxHeight=0,this.partLookup={},this.triangleSubSegments=[],this.polygonSegments=[]}populate(e,i,n,s){this.features=[],this.hasPattern=Wf("fill-extrusion",this.layers,i),this.featuresOnBorder=[],this.borderFeatureIndices=[[],[],[],[]],this.borderDoneWithNeighborZ=[-1,-1,-1,-1],this.tileToMeter=Ft(n),this.edgeRadius=this.layers[0].layout.get("fill-extrusion-edge-radius")/this.tileToMeter;for(const{feature:l,id:h,index:f,sourceLayerIndex:m}of e){const _=this.layers[0]._featureFilter.needGeometry,y=Hi(l,_);if(!this.layers[0]._featureFilter.filter(new Ii(this.zoom),y,n))continue;const v={id:h,sourceLayerIndex:m,index:f,geometry:_?y.geometry:er(l,n,s),properties:l.properties,type:l.type,patterns:{}},w=this.layoutVertexArray.length;this.hasPattern?this.features.push(Hf("fill-extrusion",this.layers,v,this.zoom,i)):this.addFeature(v,v.geometry,f,n,{},i.availableImages,s,i.brightness),i.featureIndex.insert(l,v.geometry,f,m,this.index,w)}this.sortBorders(),this.projection.name==="mercator"&&this.splitToSubtiles(),this.groundEffect.prepareBorderSegments(),this.polygonSegments.length=0}addFeatures(e,i,n,s,l,h){for(const f of this.features){const{geometry:m}=f;this.addFeature(f,m,f.index,i,n,s,l,h)}this.sortBorders(),this.projection.name==="mercator"&&this.splitToSubtiles()}update(e,i,n,s,l){const h=Object.keys(e).length!==0;if(h&&!this.stateDependentLayers.length)return;const f=h?this.stateDependentLayers:this.layers;this.programConfigurations.updatePaintArrays(e,i,f,n,s,l),this.groundEffect.update(e,i,f,n,s,l)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload||this.groundEffect.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,X0),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.layoutVertexExtArray&&(this.layoutVertexExtBuffer=e.createVertexBuffer(this.layoutVertexExtArray,H0.members,!0)),this.groundEffect.upload(e)),this.groundEffect.uploadPaintProperties(e),this.programConfigurations.upload(e),this.uploaded=!0}uploadCentroid(e){this.groundEffect.uploadHiddenByLandmark(e),this.needsCentroidUpdate&&(!this.centroidVertexBuffer&&this.centroidVertexArray.length>0?this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,$0.members,!0):this.centroidVertexBuffer&&this.centroidVertexBuffer.updateData(this.centroidVertexArray),this.needsCentroidUpdate=!1)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.centroidVertexBuffer&&this.centroidVertexBuffer.destroy(),this.layoutVertexExtBuffer&&this.layoutVertexExtBuffer.destroy(),this.groundEffect.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(e,i,n,s,l,h,f,m){const _=this.layers[0].paint.get("fill-extrusion-flood-light-ground-radius").evaluate(e,{})/this.tileToMeter,y=[new Ue(0,0),new Ue(qe,qe)],v=f.projection,w=v.name==="globe",E=ax[e.type]==="Polygon",A=new U_;A.centroidDataIndex=this.centroidData.length;const I=new V_,z=this.layers[0].paint.get("fill-extrusion-base").evaluate(e,{},s)<=0,L=this.layers[0].paint.get("fill-extrusion-height").evaluate(e,{},s);I.height=L,I.vertexArrayOffset=this.layoutVertexArray.length,I.groundVertexArrayOffset=this.groundEffect.vertexArray.length,w&&!this.layoutVertexExtArray&&(this.layoutVertexExtArray=new xl);const N=$f(i,500);for(let ie=N.length-1;ie>=0;ie--){const oe=N[ie];(oe.length===0||(G=oe[0]).every(ue=>ue.x<=0)||G.every(ue=>ue.x>=qe)||G.every(ue=>ue.y<=0)||G.every(ue=>ue.y>=qe))&&N.splice(ie,1)}var G;let j;if(w)j=Y_(N,y,s);else{j=[];for(const ie of N)j.push({polygon:ie,bounds:y})}const X=E?this.edgeRadius:0,W=X>0&&this.zoom<17,J=(ie,oe)=>{if(ie.length===0)return!1;const ue=ie[ie.length-1];return oe.x===ue.x&&oe.y===ue.y};for(const{polygon:ie,bounds:oe}of j){let ue=0,se=0;for(const we of ie)E&&!we[0].equals(we[we.length-1])&&we.push(we[0]),se+=E?we.length-1:we.length;const _e=this.segments.prepareSegment((E?5:4)*se,this.layoutVertexArray,this.indexArray);I.footprintSegIdx<0&&(I.footprintSegIdx=this.footprintSegments.length),I.polygonSegIdx<0&&(I.polygonSegIdx=this.polygonSegments.length);const Me={triangleArrayOffset:this.indexArray.length,triangleCount:0,triangleSegIdx:this.segments.segments.length-1},pe=new N_;if(pe.vertexOffset=this.footprintVertices.length,pe.indexOffset=3*this.footprintIndices.length,pe.ringIndices=[],E){const we=[],de=[];ue=_e.vertexLength;for(let Fe=0;Fe<ie.length;Fe++){const Se=ie[Fe];Se.length&&Fe!==0&&de.push(we.length/2);const Qe=[];let He,Ce;He=Se[1].sub(Se[0])._perp()._unit(),pe.ringIndices.push(Se.length-1);for(let pt=1;pt<Se.length;pt++){const st=Se[pt],Je=Se[pt===Se.length-1?1:pt+1],Pe=st.clone();if(X){Ce=Je.sub(st)._perp()._unit();const ht=He.add(Ce)._unit(),It=X*Math.min(4,1/(He.x*ht.x+He.y*ht.y));Pe.x+=It*ht.x,Pe.y+=It*ht.y,Pe.x=Math.round(Pe.x),Pe.y=Math.round(Pe.y),He=Ce}!z||X!==0&&!W||J(Qe,Pe)||Qe.push(Pe),Cu(this.layoutVertexArray,Pe.x,Pe.y,0,0,1,1,0),_e.vertexLength++,this.footprintVertices.emplaceBack(st.x,st.y),we.push(st.x,st.y),w&&Pu(this.layoutVertexExtArray,v.projectTilePoint(Pe.x,Pe.y,s),v.upVector(s,Pe.x,Pe.y))}z&&(X===0||W)&&(Qe.length!==0&&J(Qe,Qe[0])&&Qe.pop(),this.groundEffect.addData(Qe,oe,_))}const be=ad(we,de);for(let Fe=0;Fe<be.length;Fe+=3)this.footprintIndices.emplaceBack(pe.vertexOffset+be[Fe+0],pe.vertexOffset+be[Fe+1],pe.vertexOffset+be[Fe+2]),this.indexArray.emplaceBack(ue+be[Fe],ue+be[Fe+2],ue+be[Fe+1]),_e.primitiveLength++;pe.indexCount+=be.length,pe.vertexCount+=this.footprintVertices.length-pe.vertexOffset}for(let we=0;we<ie.length;we++){const de=ie[we];A.startRing(I,de[0]);let be=de.length>4&&W_(de[de.length-2],de[0],de[1]),Fe=X?px(de[de.length-2],de[0],de[1],X):0;const Se=[];let Qe,He,Ce;He=de[1].sub(de[0])._perp()._unit();let pt=!0;for(let st=1,Je=0;st<de.length;st++){let Pe=de[st-1],ht=de[st];const It=de[st===de.length-1?1:st+1];if(A.appendEdge(I,ht,Pe),Kf(ht,Pe,oe)){X&&(He=It.sub(ht)._perp()._unit(),pt=!pt);continue}const mt=ht.sub(Pe)._perp(),Ct=mt.x/(Math.abs(mt.x)+Math.abs(mt.y)),xt=mt.y>0?1:0,jt=Pe.dist(ht);if(Je+jt>32768&&(Je=0),X){Ce=It.sub(ht)._perp()._unit();let ei=q_(Pe,ht,It,Z_(He,Ce),X);isNaN(ei)&&(ei=0);const si=ht.sub(Pe)._unit();Pe=Pe.add(si.mult(Fe))._round(),ht=ht.add(si.mult(-ei))._round(),Fe=ei,He=Ce,z&&this.zoom>=17&&(J(Se,Pe)||Se.push(Pe),J(Se,ht)||Se.push(ht))}const wt=_e.vertexLength,mi=de.length>4&&W_(Pe,ht,It);let Jt=H_(Je,be,pt);if(Cu(this.layoutVertexArray,Pe.x,Pe.y,Ct,xt,0,0,Jt),Cu(this.layoutVertexArray,Pe.x,Pe.y,Ct,xt,0,1,Jt),Je+=jt,Jt=H_(Je,mi,!pt),be=mi,Cu(this.layoutVertexArray,ht.x,ht.y,Ct,xt,0,0,Jt),Cu(this.layoutVertexArray,ht.x,ht.y,Ct,xt,0,1,Jt),_e.vertexLength+=4,this.indexArray.emplaceBack(wt+0,wt+1,wt+2),this.indexArray.emplaceBack(wt+1,wt+3,wt+2),_e.primitiveLength+=2,X){const ei=ue+(st===1?de.length-2:st-2),si=st===1?ue:ei+1;if(this.indexArray.emplaceBack(wt+1,ei,wt+3),this.indexArray.emplaceBack(ei,si,wt+3),_e.primitiveLength+=2,Qe===void 0&&(Qe=wt),!Kf(It,de[st],oe)){const Qt=st===de.length-1?Qe:_e.vertexLength;this.indexArray.emplaceBack(wt+2,wt+3,Qt),this.indexArray.emplaceBack(wt+3,Qt+1,Qt),this.indexArray.emplaceBack(wt+3,si,Qt+1),_e.primitiveLength+=3}pt=!pt}if(w){const ei=this.layoutVertexExtArray,si=v.projectTilePoint(Pe.x,Pe.y,s),Qt=v.projectTilePoint(ht.x,ht.y,s),Ai=v.upVector(s,Pe.x,Pe.y),ui=v.upVector(s,ht.x,ht.y);Pu(ei,si,Ai),Pu(ei,si,Ai),Pu(ei,Qt,ui),Pu(ei,Qt,ui)}}E&&(ue+=de.length-1),z&&X&&this.zoom>=17&&(Se.length!==0&&J(Se,Se[0])&&Se.pop(),this.groundEffect.addData(Se,oe,_,X>0))}this.footprintSegments.push(pe),Me.triangleCount=this.indexArray.length-Me.triangleArrayOffset,this.polygonSegments.push(Me),++I.footprintSegLen,++I.polygonSegLen}if(I.vertexCount=this.layoutVertexArray.length-I.vertexArrayOffset,I.groundVertexCount=this.groundEffect.vertexArray.length-I.groundVertexArrayOffset,I.vertexCount!==0){if(I.centroidXY=A.borders?F_:this.encodeCentroid(A,I),this.centroidData.push(I),A.borders){this.featuresOnBorder.push(A);const ie=this.featuresOnBorder.length-1;for(let oe=0;oe<A.borders.length;oe++)A.borders[oe][0]!==Number.MAX_VALUE&&this.borderFeatureIndices[oe].push(ie)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,l,h,s,m),this.groundEffect.addPaintPropertiesData(e,n,l,h,s,m),this.maxHeight=Math.max(this.maxHeight,L)}}sortBorders(){for(let e=0;e<this.borderFeatureIndices.length;e++)this.borderFeatureIndices[e].sort((i,n)=>this.featuresOnBorder[i].borders[e][0]-this.featuresOnBorder[n].borders[e][0])}splitToSubtiles(){const e=[];for(let f=0;f<this.centroidData.length;f++){const m=this.centroidData[f],_=+(m.min.y+m.max.y>qe),y=2*_+(+(m.min.x+m.max.x>qe)^_);for(let v=0;v<m.polygonSegLen;v++){const w=m.polygonSegIdx+v;e.push({centroidIdx:f,subtile:y,polygonSegmentIdx:w,triangleSegmentIdx:this.polygonSegments[w].triangleSegIdx})}}const i=new Ji;e.sort((f,m)=>f.triangleSegmentIdx===m.triangleSegmentIdx?f.subtile-m.subtile:f.triangleSegmentIdx-m.triangleSegmentIdx);let n=0,s=0,l=0;for(const f of e){if(f.triangleSegmentIdx!==n)break;l++}const h=e.length;for(;s!==e.length;){n=e[s].triangleSegmentIdx;let f=0,m=s,_=s;for(let y=m;y<l&&e[y].subtile===f;y++)_++;for(;m!==l;){const y=e[m];f=y.subtile;const v=this.centroidData[y.centroidIdx].min.clone(),w=this.centroidData[y.centroidIdx].max.clone(),E={vertexOffset:this.segments.segments[n].vertexOffset,primitiveOffset:i.length,vertexLength:this.segments.segments[n].vertexLength,primitiveLength:0,sortKey:void 0,vaos:{}};for(let A=m;A<_;A++){const I=e[A],z=this.polygonSegments[I.polygonSegmentIdx],L=this.centroidData[I.centroidIdx].min,N=this.centroidData[I.centroidIdx].max,G=this.indexArray.uint16;for(let j=z.triangleArrayOffset;j<z.triangleArrayOffset+z.triangleCount;j++)i.emplaceBack(G[3*j],G[3*j+1],G[3*j+2]);E.primitiveLength+=z.triangleCount,v.x=Math.min(v.x,L.x),v.y=Math.min(v.y,L.y),w.x=Math.max(w.x,N.x),w.y=Math.max(w.y,N.y)}E.primitiveLength>0&&this.triangleSubSegments.push({segment:E,min:v,max:w}),m=_;for(let A=m;A<l&&e[A].subtile===e[m].subtile;A++)_++}s=l;for(let y=s;y<h&&e[y].triangleSegmentIdx===e[s].triangleSegmentIdx;y++)l++}i._trim(),this.indexArray=i}getVisibleSegments(e,i,n){let s=0,l=0;const h=1<<e.canonical.z;if(i){const I=i.getMinMaxForTile(e);I&&(s=I.min,l=I.max)}l+=this.maxHeight;const f=e.toUnwrapped();let m;const _=[f.canonical.x/h+f.wrap,f.canonical.y/h],y=[(f.canonical.x+1)/h+f.wrap,(f.canonical.y+1)/h],v=new Oi,w=(I,z,L)=>[I[0]*(1-L[0])+z[0]*L[0],I[1]*(1-L[1])+z[1]*L[1]],E=[],A=[];for(const I of this.triangleSubSegments){E[0]=I.min.x/qe,E[1]=I.min.y/qe,A[0]=I.max.x/qe,A[1]=I.max.y/qe;const z=w(_,y,E),L=w(_,y,A);if(new Ri([z[0],z[1],s],[L[0],L[1],l]).intersectsPrecise(n)===0){m&&(v.segments.push(m),m=void 0);continue}const N=I.segment;m&&m.vertexOffset!==N.vertexOffset&&(v.segments.push(m),m=void 0),m?(m.vertexLength+=N.vertexLength,m.primitiveLength+=N.primitiveLength):m={vertexOffset:N.vertexOffset,primitiveLength:N.primitiveLength,vertexLength:N.vertexLength,primitiveOffset:N.primitiveOffset,sortKey:void 0,vaos:{}}}return m&&v.segments.push(m),v}encodeCentroid(e,i){const n=e.centroid(),s=i.span(),l=Math.min(7,Math.round(s.x*this.tileToMeter/10)),h=Math.min(7,Math.round(s.y*this.tileToMeter/10));return new Ue(Dt(n.x,1,qe-1)<<3|l,Dt(n.y,1,qe-1)<<3|h)}encodeBorderCentroid(e){if(!e.borders)return new Ue(0,0);const i=e.borders,n=Number.MAX_VALUE;if(i[0][0]!==n||i[1][0]!==n){const s=i[0][0]!==n?0:1;return new Ue(6|(i[0][0]!==n?0:65528),(i[s][0]+i[s][1])/2<<3|6)}{const s=i[2][0]!==n?2:3;return new Ue((i[s][0]+i[s][1])/2<<3|6,6|(i[2][0]!==n?0:65528))}}showCentroid(e){const i=this.centroidData[e.centroidDataIndex];i.flags&=Ds,i.centroidXY.x=0,i.centroidXY.y=0,this.writeCentroidToBuffer(i)}writeCentroidToBuffer(e){this.groundEffect.updateHiddenByLandmark(e);const i=e.vertexArrayOffset,n=e.vertexCount+e.vertexArrayOffset,s=e.flags&Ds?F_:e.centroidXY,l=this.centroidVertexArray.geta_centroid_pos0(i);if(this.centroidVertexArray.geta_centroid_pos1(i)!==s.y||l!==s.x){for(let h=i;h<n;++h)this.centroidVertexArray.emplace(h,s.x,s.y);this.needsCentroidUpdate=!0}}createCentroidsBuffer(){this.centroidVertexArray.resize(this.layoutVertexArray.length),this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length);for(const e of this.centroidData)this.writeCentroidToBuffer(e)}updateReplacement(e,i){if(i.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=i.updateTime;const n=i.getReplacementRegionsForTile(e.toUnwrapped());if(function(l,h){if(l.length!==h.length)return!1;for(let f=0;f<l.length;f++)if(l[f].sourceId!==h[f].sourceId||!S_(l[f],h[f]))return!1;return!0}(this.activeReplacements,n))return;if(this.activeReplacements=n,this.centroidVertexArray.length===0)this.createCentroidsBuffer();else for(const l of this.centroidData)l.flags&=2147483647;const s=[];for(const l of this.activeReplacements){const h=Math.pow(2,l.footprintTileId.canonical.z-e.canonical.z);for(const f of this.centroidData)if(!(f.flags&Ds||l.min.x>f.max.x||f.min.x>l.max.x||l.min.y>f.max.y||f.min.y>l.max.y))for(let m=0;m<f.footprintSegLen;m++){const _=this.footprintSegments[f.footprintSegIdx+m];if(s.length=0,mx(this.footprintVertices,_.vertexOffset,_.vertexCount,l.footprintTileId.canonical,e.canonical,s),C_(l.footprint,s,this.footprintIndices.uint16,_.indexOffset,_.indexCount,-_.vertexOffset,-h)){f.flags|=Ds;break}}}for(const l of this.centroidData)this.writeCentroidToBuffer(l);this.borderDoneWithNeighborZ=[-1,-1,-1,-1]}footprintContainsPoint(e,i,n){let s=!1;for(let l=0;l<n.footprintSegLen;l++){const h=this.footprintSegments[n.footprintSegIdx+l];let f=0;for(const m of h.ringIndices){for(let _=f,y=m+f-1;_<m+f;y=_++){const v=this.footprintVertices.int16[2*(_+h.vertexOffset)+0],w=this.footprintVertices.int16[2*(_+h.vertexOffset)+1],E=this.footprintVertices.int16[2*(y+h.vertexOffset)+1];w>i!=E>i&&e<(this.footprintVertices.int16[2*(y+h.vertexOffset)+0]-v)*(i-w)/(E-w)+v&&(s=!s)}f=m}}return s}getHeightAtTileCoord(e,i){let n=Number.NEGATIVE_INFINITY,s=!0;const l=4*(e+qe)*qe+(i+qe);if(this.partLookup.hasOwnProperty(l)){const h=this.partLookup[l];return h?{height:h.height,hidden:!!(h.flags&Ds)}:void 0}for(const h of this.centroidData)e>h.max.x||h.min.x>e||i>h.max.y||h.min.y>i||this.footprintContainsPoint(e,i,h)&&h&&h.height>n&&(n=h.height,this.partLookup[l]=h,s=!!(h.flags&Ds));if(n!==Number.NEGATIVE_INFINITY)return{height:n,hidden:s};this.partLookup[l]=void 0}}function Z_(t,e){const i=t.add(e)._unit();return t.x*i.x+t.y*i.y}function px(t,e,i,n){const s=e.sub(t)._perp()._unit(),l=i.sub(e)._perp()._unit();return q_(t,e,i,Z_(s,l),n)}function q_(t,e,i,n,s){const l=Math.sqrt(1-n*n);return Math.min(t.dist(e)/3,e.dist(i)/3,s*l/n)}function Kf(t,e,i){return t.x<i[0].x&&e.x<i[0].x||t.x>i[1].x&&e.x>i[1].x||t.y<i[0].y&&e.y<i[0].y||t.y>i[1].y&&e.y>i[1].y}function $_(t,e){return t.x<e[0].x||t.x>e[1].x||t.y<e[0].y||t.y>e[1].y}function W_(t,e,i){if(t.x<0||t.x>=qe||e.x<0||e.x>=qe||i.x<0||i.x>=qe)return!1;const n=i.sub(e),s=n.perp(),l=t.sub(e);return(n.x*l.x+n.y*l.y)/Math.sqrt((n.x*n.x+n.y*n.y)*(l.x*l.x+l.y*l.y))>-.866&&s.x*l.x+s.y*l.y<0}function H_(t,e,i){const n=e?2|t:-3&t;return i?1|n:-2&n}function X_(){const t=Math.PI/32,e=Math.tan(t),i=fe;return i*Math.sqrt(1+2*e*e)-i}function Y_(t,e,i){const n=1<<i.z,s=vt(i.x/n),l=vt((i.x+1)/n),h=Zt(i.y/n),f=Zt((i.y+1)/n);return function(m,_,y,v,w=0,E){const A=[];if(!m.length||!y||!v)return A;const I=(W,J)=>{for(const ie of W)A.push({polygon:ie,bounds:J})},z=Math.ceil(Math.log2(y)),L=Math.ceil(Math.log2(v)),N=z-L,G=[];for(let W=0;W<Math.abs(N);W++)G.push(N>0?0:1);for(let W=0;W<Math.min(z,L);W++)G.push(0),G.push(1);let j=m;if(j=ud(j,_[0].y-w,_[1].y+w,1),j=ud(j,_[0].x-w,_[1].x+w,0),!j.length)return A;const X=[];for(G.length?X.push({polygons:j,bounds:_,depth:0}):I(j,_);X.length;){const W=X.pop(),J=W.depth,ie=G[J],oe=W.bounds[0],ue=W.bounds[1],se=ie===0?oe.x:oe.y,_e=ie===0?ue.x:ue.y,Me=E?E(ie,se,_e):.5*(se+_e),pe=ud(W.polygons,se-w,Me+w,ie),we=ud(W.polygons,Me-w,_e+w,ie);if(pe.length){const de=[oe,new Ue(ie===0?Me:ue.x,ie===1?Me:ue.y)];G.length>J+1?X.push({polygons:pe,bounds:de,depth:J+1}):I(pe,de)}if(we.length){const de=[new Ue(ie===0?Me:oe.x,ie===1?Me:oe.y),ue];G.length>J+1?X.push({polygons:we,bounds:de,depth:J+1}):I(we,de)}}return A}(t,e,Math.ceil((l-s)/11.25),Math.ceil((h-f)/11.25),1,(m,_,y)=>{if(m===0)return .5*(_+y);{const v=Zt((i.y+_/qe)/n);return(gt(.5*(Zt((i.y+y/qe)/n)+v))*n-i.y)*qe}})}function mx(t,e,i,n,s,l){const h=Math.pow(2,n.z-s.z);for(let f=0;f<i;f++){let m=t.int16[2*(f+e)+0],_=t.int16[2*(f+e)+1];m=(m+s.x*qe)*h-n.x*qe,_=(_+s.y*qe)*h-n.y*qe,l.push(new Ue(m,_))}}Ke(pd,"FillExtrusionBucket",{omit:["layers","features"]}),Ke(V_,"PartData"),Ke(N_,"FootprintSegment"),Ke(U_,"BorderCentroidData"),Ke(G_,"GroundEffect");const _x=new Ci({visibility:new Oe(le["layout_fill-extrusion"].visibility),"fill-extrusion-edge-radius":new Oe(le["layout_fill-extrusion"]["fill-extrusion-edge-radius"])});var gx={paint:new Ci({"fill-extrusion-opacity":new Oe(le["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new ut(le["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Oe(le["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Oe(le["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new ut(le["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new ut(le["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new ut(le["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Oe(le["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"]),"fill-extrusion-ambient-occlusion-intensity":new Oe(le["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-intensity"]),"fill-extrusion-ambient-occlusion-radius":new Oe(le["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-radius"]),"fill-extrusion-ambient-occlusion-wall-radius":new Oe(le["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-wall-radius"]),"fill-extrusion-ambient-occlusion-ground-radius":new Oe(le["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-ground-radius"]),"fill-extrusion-ambient-occlusion-ground-attenuation":new Oe(le["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-ground-attenuation"]),"fill-extrusion-flood-light-color":new Oe(le["paint_fill-extrusion"]["fill-extrusion-flood-light-color"]),"fill-extrusion-flood-light-intensity":new Oe(le["paint_fill-extrusion"]["fill-extrusion-flood-light-intensity"]),"fill-extrusion-flood-light-wall-radius":new ut(le["paint_fill-extrusion"]["fill-extrusion-flood-light-wall-radius"]),"fill-extrusion-flood-light-ground-radius":new ut(le["paint_fill-extrusion"]["fill-extrusion-flood-light-ground-radius"]),"fill-extrusion-flood-light-ground-attenuation":new Oe(le["paint_fill-extrusion"]["fill-extrusion-flood-light-ground-attenuation"]),"fill-extrusion-vertical-scale":new Oe(le["paint_fill-extrusion"]["fill-extrusion-vertical-scale"]),"fill-extrusion-rounded-roof":new Oe(le["paint_fill-extrusion"]["fill-extrusion-rounded-roof"]),"fill-extrusion-cutoff-fade-range":new Oe(le["paint_fill-extrusion"]["fill-extrusion-cutoff-fade-range"]),"fill-extrusion-emissive-strength":new Oe(le["paint_fill-extrusion"]["fill-extrusion-emissive-strength"])}),layout:_x};class zl extends Ue{constructor(e,i,n){super(e,i),this.z=n}}function zu(t,e){return t.x*e.x+t.y*e.y}function K_(t,e){if(t.length===1){let i=0;const n=e[i++];let s;for(;!s||n.equals(s);)if(s=e[i++],!s)return 1/0;for(;i<e.length;i++){const l=e[i],h=t[0],f=s.sub(n),m=l.sub(n),_=h.sub(n),y=zu(f,f),v=zu(f,m),w=zu(m,m),E=zu(_,f),A=zu(_,m),I=y*w-v*v,z=(w*E-v*A)/I,L=(y*A-v*E)/I,N=n.z*(1-z-L)+s.z*z+l.z*L;if(isFinite(N))return N}return 1/0}{let i=1/0;for(const n of e)i=Math.min(i,n.z);return i}}function J_(t,e,i,n,s,l,h,f){const m=h*s.getElevationAt(t,e,!0,!0),_=l[0]!==0,y=_?l[1]===0?h*(l[0]/7-450):h*function(v,w,E){const A=Math.floor(w[0]/8),I=Math.floor(w[1]/8),z=10*(w[0]-8*A),L=10*(w[1]-8*I),N=v.getElevationAt(A,I,!0,!0),G=v.getMeterToDEM(E),j=Math.floor(.5*(z*G-1)),X=Math.floor(.5*(L*G-1)),W=v.tileCoordToPixel(A,I),J=2*j+1,ie=2*X+1,oe=function(we,de,be,Fe,Se){return[we.getElevationAtPixel(de,be,!0),we.getElevationAtPixel(de+Se,be,!0),we.getElevationAtPixel(de,be+Se,!0),we.getElevationAtPixel(de+Fe,be+Se,!0)]}(v,W.x-j,W.y-X,J,ie),ue=Math.abs(oe[0]-oe[1]),se=Math.abs(oe[2]-oe[3]),_e=Math.abs(oe[0]-oe[2])+Math.abs(oe[1]-oe[3]),Me=Math.min(.25,.5*G*(ue+se)/J),pe=Math.min(.25,.5*G*_e/ie);return N+Math.max(Me*z,pe*L)}(s,l,f):m;return{base:m+(i===0)?-1:i,top:_?Math.max(y+n,m+i+2):m+n}}const yx=li([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"},{name:"a_linesofar",components:1,type:"Float32"}],4),{members:xx}=yx,vx=li([{name:"a_packed",components:4,type:"Float32"}]),{members:bx}=vx;class Q_{constructor(e,i){this.width=e,this.height=i,this.nextRow=0,this.image=new Ps({width:e,height:i}),this.positions={},this.uploaded=!1}getDash(e,i){const n=this.getKey(e,i);return this.positions[n]}trim(){const e=this.width,i=this.height=Gs(this.nextRow);this.image.resize({width:e,height:i})}getKey(e,i){return e.join(",")+i}getDashRanges(e,i,n){const s=[];let l=e.length%2==1?-e[e.length-1]*n:0,h=e[0]*n,f=!0;s.push({left:l,right:h,isDash:f,zeroLength:e[0]===0});let m=e[0];for(let _=1;_<e.length;_++){f=!f;const y=e[_];l=m*n,m+=y,h=m*n,s.push({left:l,right:h,isDash:f,zeroLength:y===0})}return s}addRoundDash(e,i,n){const s=i/2;for(let l=-n;l<=n;l++){const h=this.width*(this.nextRow+n+l);let f=0,m=e[f];for(let _=0;_<this.width;_++){_/m.right>1&&(m=e[++f]);const y=Math.abs(_-m.left),v=Math.abs(_-m.right),w=Math.min(y,v);let E;const A=l/n*(s+1);if(m.isDash){const I=s-Math.abs(A);E=Math.sqrt(w*w+I*I)}else E=s-Math.sqrt(w*w+A*A);this.image.data[h+_]=Math.max(0,Math.min(255,E+128))}}}addRegularDash(e,i){for(let m=e.length-1;m>=0;--m){const _=e[m],y=e[m+1];_.zeroLength?e.splice(m,1):y&&y.isDash===_.isDash&&(y.left=_.left,e.splice(m,1))}const n=e[0],s=e[e.length-1];n.isDash===s.isDash&&(n.left=s.left-this.width,s.right=n.right+this.width);const l=this.width*this.nextRow;let h=0,f=e[h];for(let m=0;m<this.width;m++){m/f.right>1&&(f=e[++h]);const _=Math.abs(m-f.left),y=Math.abs(m-f.right),v=Math.min(_,y);this.image.data[l+m]=Math.max(0,Math.min(255,(f.isDash?v:-v)+i+128))}}addDash(e,i){const n=this.getKey(e,i);if(this.positions[n])return this.positions[n];const s=i==="round",l=s?7:0,h=2*l+1;if(this.nextRow+h>this.height)return ki("LineAtlas out of space"),null;e.length===0&&e.push(1);let f=0;for(let y=0;y<e.length;y++)e[y]<0&&(ki("Negative value is found in line dasharray, replacing values with 0"),e[y]=0),f+=e[y];if(f!==0){const y=this.width/f,v=this.getDashRanges(e,this.width,y);s?this.addRoundDash(v,y,l):this.addRegularDash(v,i==="square"?.5*y:0)}const m=this.nextRow+l;this.nextRow+=h;const _={tl:[m,l],br:[f,0]};return this.positions[n]=_,_}}Ke(Q_,"LineAtlas");const wx=cd.types,Tx=Math.cos(Math.PI/180*37.5);class Jf{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(i=>i.fqid),this.index=e.index,this.projection=e.projection,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(i=>{this.gradients[i.id]={}}),this.layoutVertexArray=new cu,this.layoutVertexArray2=new ho,this.indexArray=new Ji,this.programConfigurations=new k(e.layers,e.zoom),this.segments=new Oi,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id)}populate(e,i,n,s){this.hasPattern=Wf("line",this.layers,i);const l=this.layers[0].layout.get("line-sort-key"),h=[];for(const{feature:y,id:v,index:w,sourceLayerIndex:E}of e){const A=this.layers[0]._featureFilter.needGeometry,I=Hi(y,A);if(!this.layers[0]._featureFilter.filter(new Ii(this.zoom),I,n))continue;const z=l?l.evaluate(I,{},n):void 0,L={id:v,properties:y.properties,type:y.type,sourceLayerIndex:E,index:w,geometry:A?I.geometry:er(y,n,s),patterns:{},sortKey:z};h.push(L)}l&&h.sort((y,v)=>y.sortKey-v.sortKey);const{lineAtlas:f,featureIndex:m}=i,_=this.addConstantDashes(f);for(const y of h){const{geometry:v,index:w,sourceLayerIndex:E}=y;if(_&&this.addFeatureDashes(y,f),this.hasPattern){const A=Hf("line",this.layers,y,this.zoom,i);this.patternFeatures.push(A)}else this.addFeature(y,v,w,n,f.positions,i.availableImages,i.brightness);m.insert(e[w].feature,v,w,E,this.index)}}addConstantDashes(e){let i=!1;for(const n of this.layers){const s=n.paint.get("line-dasharray").value,l=n.layout.get("line-cap").value;if(s.kind!=="constant"||l.kind!=="constant")i=!0;else{const h=l.value,f=s.value;if(!f)continue;e.addDash(f,h)}}return i}addFeatureDashes(e,i){const n=this.zoom;for(const s of this.layers){const l=s.paint.get("line-dasharray").value,h=s.layout.get("line-cap").value;if(l.kind==="constant"&&h.kind==="constant")continue;let f,m;if(l.kind==="constant"){if(f=l.value,!f)continue}else f=l.evaluate({zoom:n},e);m=h.kind==="constant"?h.value:h.evaluate({zoom:n},e),i.addDash(f,m),e.patterns[s.id]=i.getKey(f,m)}}update(e,i,n,s,l){const h=Object.keys(e).length!==0;h&&!this.stateDependentLayers.length||this.programConfigurations.updatePaintArrays(e,i,h?this.stateDependentLayers:this.layers,n,s,l)}addFeatures(e,i,n,s,l,h){for(const f of this.patternFeatures)this.addFeature(f,f.geometry,f.index,i,n,s,h)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,bx)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,xx),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e){if(e.properties&&e.properties.hasOwnProperty("mapbox_clip_start")&&e.properties.hasOwnProperty("mapbox_clip_end"))return{start:+e.properties.mapbox_clip_start,end:+e.properties.mapbox_clip_end}}addFeature(e,i,n,s,l,h,f){const m=this.layers[0].layout,_=m.get("line-join").evaluate(e,{}),y=m.get("line-cap").evaluate(e,{}),v=m.get("line-miter-limit"),w=m.get("line-round-limit");this.lineClips=this.lineFeatureClips(e);for(const E of i)this.addLine(E,e,_,y,v,w);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,l,h,s,f)}addLine(e,i,n,s,l,h){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineS
vendor: 1,760 bytes, line 7
7oFar=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let L=0;L<e.length-1;L++)this.totalDistance+=e[L].dist(e[L+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const f=wx[i.type]==="Polygon";let m=e.length;for(;m>=2&&e[m-1].equals(e[m-2]);)m--;let _=0;for(;_<m-1&&e[_].equals(e[_+1]);)_++;if(m<(f?3:2))return;n==="bevel"&&(l=1.05);const y=this.overscaling<=16?15*qe/(512*this.overscaling):0,v=this.segments.prepareSegment(10*m,this.layoutVertexArray,this.indexArray);let w,E,A,I,z;this.e1=this.e2=-1,f&&(w=e[m-2],z=e[_].sub(w)._unit()._perp());for(let L=_;L<m;L++){if(A=L===m-1?f?e[_+1]:void 0:e[L+1],A&&e[L].equals(A))continue;z&&(I=z),w&&(E=w),w=e[L],z=A?A.sub(w)._unit()._perp():I,I=I||z;let N=I.add(z);N.x===0&&N.y===0||N._unit();const G=I.x*z.x+I.y*z.y,j=N.x*z.x+N.y*z.y,X=j!==0?1/j:1/0,W=2*Math.sqrt(2-2*j),J=j<Tx&&E&&A,ie=I.x*z.y-I.y*z.x>0;if(J&&L>_){const se=w.dist(E);if(se>2*y){const _e=w.sub(w.sub(E)._mult(y/se)._round());this.updateDistance(E,_e),this.addCurrentVertex(_e,I,0,0,v),E=_e}}const oe=E&&A;let ue=oe?n:f?"butt":s;if(oe&&ue==="round"&&(X<h?ue="miter":X<=2&&(ue="fakeround")),ue==="miter"&&X>l&&(ue="bevel"),ue==="bevel"&&(X>2&&(ue="flipbevel"),X<l&&(ue="miter")),E&&this.updateDistance(E,w),ue==="miter")N._mult(X),this.addCurrentVertex(w,N,0,0,v);else if(ue==="flipbevel"){if(X>100)N=z.mult(-1);else{const se=X*I.add(z).mag()/I.sub(z).mag();N._perp()._mult(se*(ie?-1:1))}this.addCurrentVertex(w,N,0,0,v),this.addCurrentVertex(w,N.mult(-1),0,0,v)}else if(ue==="bevel"||ue==="fakeround"){const se=-Math.sqrt(X*X-1),_e=ie?se:0,Me=ie?0:se;if(E&&this.addCurrentVertex(w,I,_e,Me,v),ue==="fakeround"){const pe=Math.round(180*W/Math.PI/20);for(let we=1;we<pe;we++){let de=we/pe;
vendor: 8,955 bytes, line 7
7if(de!==.5){const Fe=de-.5;de+=de*Fe*(de-1)*((1.0904+G*(G*(3.55645-1.43519*G)-3.2452))*Fe*Fe+(.848013+G*(.215638*G-1.06021)))}const be=z.sub(I)._mult(de)._add(I)._unit()._mult(ie?-1:1);this.addHalfVertex(w,be.x,be.y,!1,ie,0,v)}}A&&this.addCurrentVertex(w,z,-_e,-Me,v)}else if(ue==="butt")this.addCurrentVertex(w,N,0,0,v);else if(ue==="square"){const se=E?1:-1;E||this.addCurrentVertex(w,N,se,se,v),this.addCurrentVertex(w,N,0,0,v),E&&this.addCurrentVertex(w,N,se,se,v)}else ue==="round"&&(E&&(this.addCurrentVertex(w,I,0,0,v),this.addCurrentVertex(w,I,1,1,v,!0)),A&&(this.addCurrentVertex(w,z,-1,-1,v,!0),this.addCurrentVertex(w,z,0,0,v)));if(J&&L<m-1){const se=w.dist(A);if(se>2*y){const _e=w.add(A.sub(w)._mult(y/se)._round());this.updateDistance(w,_e),this.addCurrentVertex(_e,z,0,0,v),w=_e}}}}addCurrentVertex(e,i,n,s,l,h=!1){const f=i.y*s-i.x,m=-i.y-i.x*s;this.addHalfVertex(e,i.x+i.y*n,i.y-i.x*n,h,!1,n,l),this.addHalfVertex(e,f,m,h,!0,-s,l)}addHalfVertex({x:e,y:i},n,s,l,h,f,m){this.layoutVertexArray.emplaceBack((e<<1)+(l?1:0),(i<<1)+(h?1:0),Math.round(63*n)+128,Math.round(63*s)+128,1+(f===0?0:f<0?-1:1),0,this.lineSoFar),this.lineClips&&this.layoutVertexArray2.emplaceBack(this.scaledDistance,this.lineClipsArray.length,this.lineClips.start,this.lineClips.end);const _=m.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,_),m.primitiveLength++),h?this.e2=_:this.e1=_}updateScaledDistance(){if(this.lineClips){const e=this.totalDistance/(this.lineClips.end-this.lineClips.start);this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=e*this.lineClips.start+this.distance}else this.lineSoFar=this.distance}updateDistance(e,i){this.distance+=e.dist(i),this.updateScaledDistance()}}Ke(Jf,"LineBucket",{omit:["layers","patternFeatures"]});const Mx=new Ci({"line-cap":new ut(le.layout_line["line-cap"]),"line-join":new ut(le.layout_line["line-join"]),"line-miter-limit":new Oe(le.layout_line["line-miter-limit"]),"line-round-limit":new Oe(le.layout_line["line-round-limit"]),"line-sort-key":new ut(le.layout_line["line-sort-key"]),visibility:new Oe(le.layout_line.visibility)});var eg={paint:new Ci({"line-opacity":new ut(le.paint_line["line-opacity"]),"line-color":new ut(le.paint_line["line-color"]),"line-translate":new Oe(le.paint_line["line-translate"]),"line-translate-anchor":new Oe(le.paint_line["line-translate-anchor"]),"line-width":new ut(le.paint_line["line-width"]),"line-gap-width":new ut(le.paint_line["line-gap-width"]),"line-offset":new ut(le.paint_line["line-offset"]),"line-blur":new ut(le.paint_line["line-blur"]),"line-dasharray":new ut(le.paint_line["line-dasharray"]),"line-pattern":new ut(le.paint_line["line-pattern"]),"line-gradient":new Uo(le.paint_line["line-gradient"]),"line-trim-offset":new Oe(le.paint_line["line-trim-offset"]),"line-emissive-strength":new Oe(le.paint_line["line-emissive-strength"]),"line-border-width":new ut(le.paint_line["line-border-width"]),"line-border-color":new ut(le.paint_line["line-border-color"])}),layout:Mx};function tg(t,e,i){return e*(qe/(t.tileSize*Math.pow(2,i-t.tileID.overscaledZ)))}function ig(t,e){return 1/tg(t,1,e.tileZoom)}function rg(t,e,i,n){return t.translatePosMatrix(n||e.tileID.projMatrix,e,i.paint.get("line-translate"),i.paint.get("line-translate-anchor"))}const ng=t=>{const e=[];og(t)&&e.push("RENDER_LINE_DASH"),t.paint.get("line-gradient")&&e.push("RENDER_LINE_GRADIENT");const i=t.paint.get("line-trim-offset");return i[0]===0&&i[1]===0||e.push("RENDER_LINE_TRIM_OFFSET"),t.paint.get("line-border-width").constantOr(1)!==0&&e.push("RENDER_LINE_BORDER"),e};function og(t){const e=t.paint.get("line-dasharray").value;return e.value||e.kind!=="constant"}const sg=new class extends ut{possiblyEvaluate(t,e){return e=new Ii(Math.floor(e.zoom),{now:e.now,fadeDuration:e.fadeDuration,transition:e.transition}),super.possiblyEvaluate(t,e)}evaluate(t,e,i,n){return e=fr({},e,{zoom:Math.floor(e.zoom)}),super.evaluate(t,e,i,n)}}(eg.paint.properties["line-width"].specification);function ag(t,e){return e>0?e+2*t:t}sg.useIntegerZoom=!0;const Ex=li([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_tex_size",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Sx=li([{name:"a_globe_anchor",components:3,type:"Int16"},{name:"a_globe_normal",components:3,type:"Float32"}],4),Ax=li([{name:"a_projected_pos",components:4,type:"Float32"}],4);li([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const Ix=li([{name:"a_z_offset",components:1,type:"Float32"}],4),Cx=li([{name:"a_texb",components:2,type:"Uint16"}]),Px=li([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]),zx=li([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"},{name:"a_z_offset",components:1,type:"Float32"}]);li([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Int16",name:"tileAnchorX"},{type:"Int16",name:"tileAnchorY"},{type:"Float32",name:"x1"},{type:"Float32",name:"y1"},{type:"Float32",name:"x2"},{type:"Float32",name:"y2"},{type:"Int16",name:"padding"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);const lg=li([{name:"a_pos",components:3,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),Dx=li([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);li([{name:"triangle",components:3,type:"Uint16"}]),li([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Float32",name:"tileAnchorX"},{type:"Float32",name:"tileAnchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"},{type:"Uint8",name:"flipState"}]),li([{type:"Float32",name:"tileAnchorX"},{type:"Float32",name:"tileAnchorY"},{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",components:2,name:"textOffset"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Float32",name:"zOffset"},{type:"Uint8",name:"hasIconTextFit"}]),li([{type:"Float32",name:"offsetX"}]),li([{type:"Int16",name:"x"},{type:"Int16",name:"y"}]);var mr=24;const Nn=128;function Qf(t,e){const{expression:i}=e;if(i.kind==="constant")return{kind:"constant",layoutSize:i.evaluate(new Ii(t+1))};if(i.kind==="source")return{kind:"source"};{const{zoomStops:n,interpolationType:s}=i;let l=0;for(;l<n.length&&n[l]<=t;)l++;l=Math.max(0,l-1);let h=l;for(;h<n.length&&n[h]<t+1;)h++;h=Math.min(n.length-1,h);const f=n[l],m=n[h];return i.kind==="composite"?{kind:"composite",minZoom:f,maxZoom:m,interpolationType:s}:{kind:"camera",minZoom:f,maxZoom:m,minSize:i.evaluate(new Ii(f)),maxSize:i.evaluate(new Ii(m)),interpolationType:s}}}function md(t,{uSize:e,uSizeT:i},{lowerSize:n,upperSize:s}){return t.kind==="source"?n/Nn:t.kind==="composite"?Ut(n/Nn,s/Nn,i):e}function Dl(t,e){let i=0,n=0;if(t.kind==="constant")n=t.layoutSize;else if(t.kind!=="source"){const{interpolationType:s,minZoom:l,maxZoom:h}=t,f=s?Dt(Fr.interpolationFactor(s,e,l,h),0,1):0;t.kind==="camera"?n=Ut(t.minSize,t.maxSize,f):i=f}return{uSizeT:i,uSize:n}}var Lx=Object.freeze({__proto__:null,SIZE_PACK_FACTOR:Nn,evaluateSizeForFeature:md,evaluateSizeForZoom:Dl,getSizeData:Qf});function Rx(t,e,i){return t.sections.forEach(n=>
vendor: 5,691 bytes, line 7
7{n.text=function(s,l,h){const f=l.layout.get("text-transform").evaluate(h,{});return f==="uppercase"?s=s.toLocaleUpperCase():f==="lowercase"&&(s=s.toLocaleLowerCase()),Nr.applyArabicShaping&&(s=Nr.applyArabicShaping(s)),s}(n.text,e,i)}),t}const Du={"!":"ï¸","#":"ï¼",$:"ï¼","%":"ï¼
","&":"ï¼","(":"︵",")":"︶","*":"ï¼","+":"ï¼",",":"ï¸","-":"︲",".":"ã»","/":"ï¼",":":"ï¸",";":"ï¸","<":"︿","=":"ï¼",">":"ï¹","?":"ï¸","@":"ï¼ ","[":"ï¹","\\":"ï¼¼","]":"ï¹","^":"ï¼¾",_:"︳","`":"ï½","{":"︷","|":"â","}":"︸","~":"ï½","¢":"ï¿ ","£":"ï¿¡","Â¥":"ï¿¥","¦":"¦","¬":"ï¿¢","¯":"ï¿£","â":"︲","â":"︱","â":"ï¹","â":"ï¹","â":"ï¹","â":"ï¹","â¦":"ï¸","â§":"ã»","â©":"₩","ã":"ï¸","ã":"ï¸","ã":"︿","ã":"ï¹","ã":"︽","ã":"︾","ã":"ï¹","ã":"ï¹","ã":"ï¹","ã":"ï¹","ã":"︻","ã":"︼","ã":"︹","ã":"︺","ã":"ï¸","ã":"ï¸","ï¼":"ï¸","ï¼":"︵","ï¼":"︶","ï¼":"ï¸","ï¼":"︲","ï¼":"ã»","ï¼":"ï¸","ï¼":"ï¸","ï¼":"︿","ï¼":"ï¹","ï¼":"ï¸","ï¼»":"ï¹","ï¼½":"ï¹","_":"︳","ï½":"︷","ï½":"â","ï½":"︸","ï½":"︵","ï½ ":"︶","。":"ï¸","ï½¢":"ï¹","ï½£":"ï¹","â":"â","â":"â"};function kx(t){return t==="︶"||t==="ï¹"||t==="︸"||t==="ï¹"||t==="ï¹"||t==="︾"||t==="︼"||t==="︺"||t==="ï¸"||t==="ï¹"||t==="ï¸"||t==="ï¸"||t==="ï¸"||t==="ï½"||t==="ï¿£"||t==="ï¸"||t==="ï¸"}function Ox(t){return t==="︵"||t==="ï¹"||t==="︷"||t==="ï¹"||t==="ï¹"||t==="︽"||t==="︻"||t==="︹"||t==="ï¸"||t==="︿"}var Bx={read:function(t,e,i,n,s){var l,h,f=8*s-n-1,m=(1<<f)-1,_=m>>1,y=-7,v=i?s-1:0,w=i?-1:1,E=t[e+v];for(v+=w,l=E&(1<<-y)-1,E>>=-y,y+=f;y>0;l=256*l+t[e+v],v+=w,y-=8);for(h=l&(1<<-y)-1,l>>=-y,y+=n;y>0;h=256*h+t[e+v],v+=w,y-=8);if(l===0)l=1-_;else{if(l===m)return h?NaN:1/0*(E?-1:1);h+=Math.pow(2,n),l-=_}return(E?-1:1)*h*Math.pow(2,l-n)},write:function(t,e,i,n,s,l){var h,f,m,_=8*l-s-1,y=(1<<_)-1,v=y>>1,w=s===23?Math.pow(2,-24)-Math.pow(2,-77):0,E=n?0:l-1,A=n?1:-1,I=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(f=isNaN(e)?1:0,h=y):(h=Math.floor(Math.log(e)/Math.LN2),e*(m=Math.pow(2,-h))<1&&(h--,m*=2),(e+=h+v>=1?w/m:w*Math.pow(2,1-v))*m>=2&&(h++,m/=2),h+v>=y?(f=0,h=y):h+v>=1?(f=(e*m-1)*Math.pow(2,s),h+=v):(f=e*Math.pow(2,v-1)*Math.pow(2,s),h=0));s>=8;t[i+E]=255&f,E+=A,f/=256,s-=8);for(h=h<<s|f,_+=s;_>0;t[i+E]=255&h,E+=A,h/=256,_-=8);t[i+E-A]|=128*I}},cg=Si,_d=Bx;function Si(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}Si.Varint=0,Si.Fixed64=1,Si.Bytes=2,Si.Fixed32=5;var ep=4294967296,ug=1/ep,hg=typeof TextDecoder>"u"?null:new TextDecoder("utf8");function Xo(t){return t.type===Si.Bytes?t.readVarint()+t.pos:t.pos+1}function Ll(t,e,i){return i?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function dg(t,e,i){var n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));i.realloc(n);for(var s=i.pos-1;s>=t;s--)i.buf[s+n]=i.buf[s]}function Fx(t,e){for(var i=0;i<t.length;i++)e.writeVarint(t[i])}function Nx(t,e){for(var i=0;i<t.length;i++)e.writeSVarint(t[i])}function Vx(t,e){for(var i=0;i<t.length;i++)e.writeFloat(t[i])}function Ux(t,e){for(var i=0;i<t.length;i++)e.writeDouble(t[i])}function jx(t,e){for(var i=0;i<t.length;i++)e.writeBoolean(t[i])}function Gx(t,e){for(var i=0;i<t.length;i++)e.writeFixed32(t[i])}function Zx(t,e){for(var i=0;i<t.length;i++)e.writeSFixed32(t[i])}function qx(t,e){for(var i=0;i<t.length;i++)e.writeFixed64(t[i])}function $x(t,e){for(var i=0;i<t.length;i++)e.writeSFixed64(t[i])}function gd(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+16777216*t[e+3]}function Rl(t,e,i){t[i]=e,t[i+1]=e>>>8,t[i+2]=e>>>16,t[i+3]=e>>>24}function fg(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}Si.prototype={destroy:function(){this.buf=null},readFields:function(t,e,i){for(i=i||this.length;this.pos<i;){var n=this.readVarint(),s=n>>3,l=this.pos;this.type=7&n,t(s,e,this),this.pos===l&&this.skip(n)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=gd(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=fg(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=gd(this.buf,this.pos)+gd(this.buf,this.pos+4)*ep;return this.pos+=8,t},readSFixed64:function(){var t=gd(this.buf,this.pos)+fg(this.buf,this.pos+4)*ep;return this.pos+=8,t},readFloat:function(){var t=_d.read(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=_d.read(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e,i,n=this.buf;return e=127&(i=n[this.pos++]),i<128?e:(e|=(127&(i=n[this.pos++]))<<7,i<128?e:(e|=(127&(i=n[this.pos++]))<<14,i<128?e:(e|=(127&(i=n[this.pos++]))<<21,i<128?e:function(s,l,h){var f,m,_=h.buf;if(f=(112&(m=_[h.pos++]))>>4,m<128||(f|=(127&(m=_[h.pos++]))<<3,m<128)||(f|=(127&(m=_[h.pos++]))<<10,m<128)||(f|=(127&(m=_[h.pos++]))<<17,m<128)||(f|=(127&(m=_[h.pos++]))<<24,m<128)||(f|=(1&(m=_[h.pos++]))<<31,m<128))return Ll(s,f,l);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(i=n[this.pos]))<<28,t,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2==1?(t+1)/-2:t/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&hg?function(i,n,s){return hg.decode(i.subarray(n,s))}(this.buf,e,t):function(i,n,s){for(var l="",h=n;h<s;){var f,m,_,y=i[h],v=null,w=y>239?4:y>223?3:y>191?2:1;if(h+w>s)break;w===1?y<128&&(v=y):w===2?(192&(f=i[h+1]))==128&&(v=(31&y)<<6|63&f)<=127&&(v=null):w===3?
vendor: 10,633 bytes, line 7
7(m=i[h+2],(192&(f=i[h+1]))==128&&(192&m)==128&&((v=(15&y)<<12|(63&f)<<6|63&m)<=2047||v>=55296&&v<=57343)&&(v=null)):w===4&&(m=i[h+2],_=i[h+3],(192&(f=i[h+1]))==128&&(192&m)==128&&(192&_)==128&&((v=(15&y)<<18|(63&f)<<12|(63&m)<<6|63&_)<=65535||v>=1114112)&&(v=null)),v===null?(v=65533,w=1):v>65535&&(v-=65536,l+=String.fromCharCode(v>>>10&1023|55296),v=56320|1023&v),l+=String.fromCharCode(v),h+=w}return l}(this.buf,e,t)},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,e){if(this.type!==Si.Bytes)return t.push(this.readVarint(e));var i=Xo(this);for(t=t||[];this.pos<i;)t.push(this.readVarint(e));return t},readPackedSVarint:function(t){if(this.type!==Si.Bytes)return t.push(this.readSVarint());var e=Xo(this);for(t=t||[];this.pos<e;)t.push(this.readSVarint());return t},readPackedBoolean:function(t){if(this.type!==Si.Bytes)return t.push(this.readBoolean());var e=Xo(this);for(t=t||[];this.pos<e;)t.push(this.readBoolean());return t},readPackedFloat:function(t){if(this.type!==Si.Bytes)return t.push(this.readFloat());var e=Xo(this);for(t=t||[];this.pos<e;)t.push(this.readFloat());return t},readPackedDouble:function(t){if(this.type!==Si.Bytes)return t.push(this.readDouble());var e=Xo(this);for(t=t||[];this.pos<e;)t.push(this.readDouble());return t},readPackedFixed32:function(t){if(this.type!==Si.Bytes)return t.push(this.readFixed32());var e=Xo(this);for(t=t||[];this.pos<e;)t.push(this.readFixed32());return t},readPackedSFixed32:function(t){if(this.type!==Si.Bytes)return t.push(this.readSFixed32());var e=Xo(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed32());return t},readPackedFixed64:function(t){if(this.type!==Si.Bytes)return t.push(this.readFixed64());var e=Xo(this);for(t=t||[];this.pos<e;)t.push(this.readFixed64());return t},readPackedSFixed64:function(t){if(this.type!==Si.Bytes)return t.push(this.readSFixed64());var e=Xo(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed64());return t},skip:function(t){var e=7&t;if(e===Si.Varint)for(;this.buf[this.pos++]>127;);else if(e===Si.Bytes)this.pos=this.readVarint()+this.pos;else if(e===Si.Fixed32)this.pos+=4;else{if(e!==Si.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e<this.pos+t;)e*=2;if(e!==this.length){var i=new Uint8Array(e);i.set(this.buf),this.buf=i,this.length=e}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(t){this.realloc(4),Rl(this.buf,t,this.pos),this.pos+=4},writeSFixed32:function(t){this.realloc(4),Rl(this.buf,t,this.pos),this.pos+=4},writeFixed64:function(t){this.realloc(8),Rl(this.buf,-1&t,this.pos),Rl(this.buf,Math.floor(t*ug),this.pos+4),this.pos+=8},writeSFixed64:function(t){this.realloc(8),Rl(this.buf,-1&t,this.pos),Rl(this.buf,Math.floor(t*ug),this.pos+4),this.pos+=8},writeVarint:function(t){(t=+t||0)>268435455||t<0?function(e,i){var n,s;if(e>=0?(n=e%4294967296|0,s=e/4294967296|0):(s=~(-e/4294967296),4294967295^(n=~(-e%4294967296))?n=n+1|0:(n=0,s=s+1|0)),e>=18446744073709552e3||e<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");i.realloc(10),function(l,h,f){f.buf[f.pos++]=127&l|128,l>>>=7,f.buf[f.pos++]=127&l|128,l>>>=7,f.buf[f.pos++]=127&l|128,l>>>=7,f.buf[f.pos++]=127&l|128,f.buf[f.pos]=127&(l>>>=7)}(n,0,i),function(l,h){var f=(7&l)<<4;h.buf[h.pos++]|=f|((l>>>=3)?128:0),l&&(h.buf[h.pos++]=127&l|((l>>>=7)?128:0),l&&(h.buf[h.pos++]=127&l|((l>>>=7)?128:0),l&&(h.buf[h.pos++]=127&l|((l>>>=7)?128:0),l&&(h.buf[h.pos++]=127&l|((l>>>=7)?128:0),l&&(h.buf[h.pos++]=127&l)))))}(s,i)}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))},writeSVarint:function(t){this.writeVarint(t<0?2*-t-1:2*t)},writeBoolean:function(t){this.writeVarint(!!t)},writeString:function(t){t=String(t),this.realloc(4*t.length),this.pos++;var e=this.pos;this.pos=function(n,s,l){for(var h,f,m=0;m<s.length;m++){if((h=s.charCodeAt(m))>55295&&h<57344){if(!f){h>56319||m+1===s.length?(n[l++]=239,n[l++]=191,n[l++]=189):f=h;continue}if(h<56320){n[l++]=239,n[l++]=191,n[l++]=189,f=h;continue}h=f-55296<<10|h-56320|65536,f=null}else f&&(n[l++]=239,n[l++]=191,n[l++]=189,f=null);h<128?n[l++]=h:(h<2048?n[l++]=h>>6|192:(h<65536?n[l++]=h>>12|224:(n[l++]=h>>18|240,n[l++]=h>>12&63|128),n[l++]=h>>6&63|128),n[l++]=63&h|128)}return l}(this.buf,t,this.pos);var i=this.pos-e;i>=128&&dg(e,i,this),this.pos=e-1,this.writeVarint(i),this.pos+=i},writeFloat:function(t){this.realloc(4),_d.write(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),_d.write(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var i=0;i<e;i++)this.buf[this.pos++]=t[i]},writeRawMessage:function(t,e){this.pos++;var i=this.pos;t(e,this);var n=this.pos-i;n>=128&&dg(i,n,this),this.pos=i-1,this.writeVarint(n),this.pos+=n},writeMessage:function(t,e,i){this.writeTag(t,Si.Bytes),this.writeRawMessage(e,i)},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,Fx,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,Nx,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,jx,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,Vx,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,Ux,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,Gx,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,Zx,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,qx,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,$x,e)},writeBytesField:function(t,e){this.writeTag(t,Si.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,Si.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,Si.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,Si.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,Si.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,Si.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,Si.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,Si.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,Si.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,Si.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,!!e)}};var kl=kr(cg);const tp=3;function Wx(t,e,i){e.glyphs=[],t===1&&i.readMessage(Hx,e)}function Hx(t,e,i){if(t===3){const{id:n,bitmap:s,width:l,height:h,left:f,top:m,advance:_}=i.readMessage(Xx,{});e.glyphs.push({id:n,bitmap:new Ps({width:l+2*tp,height:h+2*tp},s),metrics:{width:l,height:h,left:f,top:m,advance:_}})}else t===4?e.ascender=i.readSVarint():t===5&&(e.descender=i.readSVarint())}function Xx(t,e,i){t===1?e.id=i.readVarint():t===2?e.bitmap=i.readBytes():t===3?e.width=i.readVarint():t===4?e.height=i.readVarint():t===5?e.left=i.readSVarint():t===6?e.top=i.readSVarint():t===7&&(e.advance=i.readVarint())}const pg=tp,fn={horizontal:1,vertical:2,horizontalOnly:3};class Lu{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(e,i){const n=new Lu;return n.scale=e||1,n.fontStack=i,n}static forImage(e){const i=new Lu;return i.imageName=e,i}}class Ol{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(e,i){const n=new Ol;for(let s=0;s<e.sections.length;s++){const l=e.sections[s];l.image?n.addImageSection(l):n.addTextSection(l,i)}return n}length(){return this.text.length}getSection(e){return this.sections[this.sectionIndex[e]]}getSections(){return this.sections}getSectionIndex(e){return this.sectionIndex[e]}getCodePoint(e){return this.text.codePointAt(e)}verticalizePunctuation(e){this.text=function(i,n){let s="";for(let l=0;l<i.length;l++){const h=i.charCodeAt(l+1)||null,f=i.charCodeAt(l-1)||null;s+=!n&&(h&&Mh(h)&&!Du[i[l+1]]||f&&Mh(f)&&!Du[i[l-1]])||!Du[i[l]]?i[l]:Du[i[l]]}return s}(this.text,e)}trim(){let e=0;for(let n=0;n<this.text.length&&yd[this.text.charCodeAt(n)];n++)e++;let i=this.text.length;for(let n=this.text.length-1;n>=0&&n>=e&&yd[this.text.charCodeAt(n)];n--)i--;this.text=this.text.substring(e,i),this.sectionIndex=this.sectionIndex.slice(e,i)}substring(e,i){const n=new Ol;return n.text=this.text.substring(e,i),n.sectionIndex=this.sectionIndex.slice(e,i),n.sections=this.sections,n}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((e,i)=>Math.max(e,this.sections[i].scale),0)}addTextSection(e,i){this.text+=e.text,this.sections.push(Lu.forText(e.scale,e.fontStack||i));const n=this.sections.length-1;for(let s=0;s<e.text.length;++s)this.sectionIndex.push(n)}addImageSection(e){const i=e.image?e.image.namePrimary:"";if(i.length===0)return void ki("Can't add FormattedSection with an empty image.");const n=this.getNextImageSectionCharCode();n?(this.text+=String.fromCodePoint(n),this.sections.push(Lu.forImage(i)),this.sectionIndex.push(this.sections.length-1)):ki("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function ip(t,e,i,n,s,l,h,f,m,_,y,v,w,E,A){const I=Ol.fromFeature(t,s);v===fn.vertical&&I.verticalizePunctuation(w);let z=[];const L=function(W,J,ie,oe,ue,se){if(!W)return[];const _e=[],Me=function(be,Fe,Se,Qe,He,Ce){let pt=0;for(let st=0;st<be.length();st++){const Je=be.getSection(st);pt+=mg(be.getCodePoint(st),Je,Qe,He,Fe,Ce)}return pt/Math.max(1,Math.ceil(pt/Se))}(W,J,ie,oe,ue,se),pe=W.text.indexOf("â")>=0;let we=0;for(let be=0;be<W.length();be++){const Fe=W.getSection(be),Se=W.getCodePoint(be);if(yd[Se]||(we+=mg(Se,Fe,oe,ue,J,se)),be<W.length()-1){const Qe=!((de=Se)<11904||!(it["Bopomofo Extended"](de)||it.Bopomofo(de)||it["CJK Compatibility Forms"](de)||it["CJK Compatibility Ideographs"](de)||it["CJK Compatibility"](de)||it["CJK Radicals Supplement"](de)||it["CJK Strokes"](de)||it["CJK Symbols and Punctuation"](de)||it["CJK Unified Ideographs Extension A"](de)||it["CJK Unified Ideographs"](de)||it["Enclosed CJK Letters and Months"](de)||it["Halfwidth and Fullwidth Forms"](de)||it.Hiragana(de)||it["Ideographic Description Characters"](de)||it["Kangxi Radicals"](de)||it["Katakana Phonet
7ic Extensions"](de)||it.Katakana(de)||it["Vertical Forms"](de)||it["Yi Radicals"](de)||it["Yi Syllables"](de)));(Yx[Se]||Qe||Fe.imageName)&&_e.push(gg(be+1,we,Me,_e,Kx(Se,W.getCodePoint(be+1),Qe&&pe),!1))}}var de;return yg(gg(W.length(),we,Me,_e,0,!0))}(I,_,l,e,n,E),{processBidirectionalText:N,processStyledBidirectionalText:G}=Nr;if(N&&I.sections.length===1){const W=N(I.toString(),L);for(const J of W){const ie=new Ol;ie.text=J,ie.sections=I.sections;for(let oe=0;oe<J.length;oe++)ie.sectionIndex.push(0);z.push(ie)}}else if(G){const W=G(I.text,I.sectionIndex,L);for(const J of W){const ie=new Ol;ie.text=J[0],ie.sectionIndex=J[1],ie.sections=I.sections,z.push(ie)}}else z=function(W,J){const ie=[],oe=W.text;let ue=0;for(const se of J)ie.push(W.substring(ue,se)),ue=se;return ue<oe.length&&ie.push(W.substring(ue,oe.length)),ie}(I,L);const j=[],X={positionedLines:j,text:I.toString(),top:y[1],bottom:y[1],left:y[0],right:y[0],writingMode:v,iconsInText:!1,verticalizable:!1,hasBaseline:!1};return function(W,J,ie,oe,ue,se,_e,Me,pe,we,de,be){let Fe=0,Se=0,Qe=0;const He=Me==="right"?1:Me==="left"?0:.5;let Ce=!1;for(const It of ue){const mt=It.getSections();for(const Ct of mt){if(Ct.imageName)continue;const xt=J[Ct.fontStack];if(xt&&(Ce=xt.ascender!==void 0&&xt.descender!==void 0,!Ce))break}if(!Ce)break}let pt=0;for(const It of ue){It.trim();const mt=It.getMaxScale(),Ct=(mt-1)*mr,xt={positionedGlyphs:[],lineOffset:0};W.positionedLines[pt]=xt;const jt=xt.positionedGlyphs;let wt=0;if(!It.length()){Se+=se,++pt;continue}let mi=0,Jt=0;for(let si=0;si<It.length();si++){const Qt=It.getSection(si),Ai=It.getSectionIndex(si),ui=It.getCodePoint(si);let Bi=Qt.scale,Yi=null,hr=null,Mi=null,Di=mr,rr=0;const nr=!(pe===fn.horizontal||!de&&!Wc(ui)||de&&(yd[ui]||(st=ui,it.Arabic(st)||it["Arabic Supplement"](st)||it["Arabic Extended-A"](st)||it["Arabic Presentation Forms-A"](st)||it["Arabic Presentation Forms-B"](st))));if(Qt.imageName){const or=oe[Qt.imageName];if(!or)continue;Mi=Qt.imageName,W.iconsInText=W.iconsInText||!0,hr=or.paddedRect;const vi=or.displaySize;Bi=Bi*mr/be,Yi={width:vi[0],height:vi[1],left:0,top:-pg,advance:nr?vi[1]:vi[0],localGlyph:!1},rr=Ce?-Yi.height*Bi:mt*mr-17-vi[1]*Bi,Di=Yi.advance;const Yr=(nr?vi[0]:vi[1])*Bi-mr*mt;Yr>0&&Yr>wt&&(wt=Yr)}else{const or=ie[Qt.fontStack];if(!or)continue;or[ui]&&(hr=or[ui]);const vi=J[Qt.fontStack];if(!vi)continue;const Yr=vi.glyphs[ui];if(!Yr)continue;if(Yi=Yr.metrics,Di=ui!==8203?mr:0,Ce){const Ns=vi.ascender!==void 0?Math.abs(vi.ascender):0,Lr=vi.descender!==void 0?Math.abs(vi.descender):0,Mr=(Ns+Lr)*Bi;mi<Mr&&(mi=Mr,Jt=(Ns-Lr)/2*Bi),rr=-Ns*Bi}else rr=(mt-Bi)*mr-17}nr?(W.verticalizable=!0,jt.push({glyph:ui,imageName:Mi,x:Fe,y:Se+rr,vertical:nr,scale:Bi,localGlyph:Yi.localGlyph,fontStack:Qt.fontStack,sectionIndex:Ai,metrics:Yi,rect:hr}),Fe+=Di*Bi+we):(jt.push({glyph:ui,imageName:Mi,x:Fe,y:Se+rr,vertical:nr,scale:Bi,localGlyph:Yi.localGlyph,fontStack:Qt.fontStack,sectionIndex:Ai,metrics:Yi,rect:hr}),Fe+=Yi.advance*Bi+we)}jt.length!==0&&(Qe=Math.max(Fe-we,Qe),Ce?xg(jt,He,wt,Jt,se*mt/2):xg(jt,He,wt,0,se/2)),Fe=0;const ei=se*mt+wt;xt.lineOffset=Math.max(wt,Ct),Se+=ei,++pt}var st;const Je=Se,{horizontalAlign:Pe,verticalAlign:ht}=rp(_e);(function(It,mt,Ct,xt,jt,wt){const mi=(mt-Ct)*jt,Jt=-wt*xt;for(const ei of It)for(const si of ei.positionedGlyphs)si.x+=mi,si.y+=Jt})(W.positionedLines,He,Pe,ht,Qe,Je),W.top+=-ht*Je,W.bottom=W.top+Je,W.left+=-Pe*Qe,W.right=W.left+Qe,W.hasBaseline=Ce}(X,e,i,n,z,h,f,m,v,_,w,A),!function(W){for(const J of W)if(J.positionedGlyphs.length!==0)return!1;return!0}(j)&&X}const yd={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Yx={10:!0,32:!0,38:!0,40:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0};function mg(t,e,i,n,s,l){if(e.imageName){const h=n[e.imageName];return h?h.displaySize[0]*e.scale*mr/l+s:0}{const h=i[e.fontStack],f=h&&h.glyphs[t];return f?f.metrics.advance*e.scale+s:0}}function _g(t,e,i,n){const s=Math.pow(t-e,2);return n?t<e?s/2:2*s:s+Math.abs(i)*i}function Kx(t,e,i){let n=0;return t===10&&(n-=1e4),i&&(n+=150),t!==40&&t!==65288||(n+=50),e!==41&&e!==65289||(n+=50),n}function gg(t,e,i,n,s,l){let h=null,f=_g(e,i,s,l);for(const m of n){const _=_g(e-m.x,i,s,l)+m.badness;_<=f&&(h=m,f=_)}return{index:t,x:e,priorBreak:h,badness:f}}function yg(t){return t?yg(t.priorBreak).concat(t.index):[]}function rp(t){let e=.5,i=.5;
vendor: 7,417 bytes, line 7
7switch(t){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0}switch(t){case"bottom":case"bottom-right":case"bottom-left":i=1;break;case"top":case"top-right":case"top-left":i=0}return{horizontalAlign:e,verticalAlign:i}}function xg(t,e,i,n,s){if(!(e||i||n||s))return;const l=t.length-1,h=t[l],f=(h.x+h.metrics.advance*h.scale)*e;for(let m=0;m<=l;m++)t[m].x-=f,t[m].y+=i+n+s}function Jx(t,e,i,n){const{horizontalAlign:s,verticalAlign:l}=rp(n),h=i[0]-t.displaySize[0]*s,f=i[1]-t.displaySize[1]*l;return{imagePrimary:t,imageSecondary:e,top:f,bottom:f+t.displaySize[1],left:h,right:h+t.displaySize[0]}}function vg(t,e,i,n,s,l){const h=t.imagePrimary;let f;if(h.content){const z=h.content,L=h.pixelRatio||1;f=[z[0]/L,z[1]/L,h.displaySize[0]-z[2]/L,h.displaySize[1]-z[3]/L]}const m=e.left*l,_=e.right*l;let y,v,w,E;i==="width"||i==="both"?(E=s[0]+m-n[3],v=s[0]+_+n[1]):(E=s[0]+(m+_-h.displaySize[0])/2,v=E+h.displaySize[0]);const A=e.top*l,I=e.bottom*l;return i==="height"||i==="both"?(y=s[1]+A-n[0],w=s[1]+I+n[2]):(y=s[1]+(A+I-h.displaySize[1])/2,w=y+h.displaySize[1]),{imagePrimary:h,imageSecondary:void 0,top:y,right:v,bottom:w,left:E,collisionPadding:f}}class Yo extends Ue{constructor(e,i,n,s,l){super(e,i),this.angle=s,this.z=n,l!==void 0&&(this.segment=l)}clone(){return new Yo(this.x,this.y,this.z,this.angle,this.segment)}}function bg(t,e,i,n,s){if(e.segment===void 0)return!0;let l=e,h=e.segment+1,f=0;for(;f>-i/2;){if(h--,h<0)return!1;f-=t[h].dist(l),l=t[h]}f+=t[h].dist(t[h+1]),h++;const m=[];let _=0;for(;f<i/2;){const y=t[h],v=t[h+1];if(!v)return!1;let w=t[h-1].angleTo(y)-y.angleTo(v);for(w=Math.abs((w+3*Math.PI)%(2*Math.PI)-Math.PI),m.push({distance:f,angleDelta:w}),_+=w;f-m[0].distance>n;)_-=m.shift().angleDelta;if(_>s)return!1;h++,f+=y.dist(v)}return!0}function wg(t){let e=0;for(let i=0;i<t.length-1;i++)e+=t[i].dist(t[i+1]);return e}function Tg(t,e,i){return t?.6*e*i:0}function Mg(t,e){return Math.max(t?t.right-t.left:0,e?e.right-e.left:0)}function Qx(t,e,i,n,s,l){const h=Tg(i,s,l),f=Mg(i,n)*l;let m=0;const _=wg(t)/2;for(let y=0;y<t.length-1;y++){const v=t[y],w=t[y+1],E=v.dist(w);if(m+E>_){const A=(_-m)/E,I=Ut(v.x,w.x,A),z=Ut(v.y,w.y,A),L=new Yo(I,z,0,w.angleTo(v),y);return!h||bg(t,L,f,h,e)?L:void 0}m+=E}}function ev(t,e,i,n,s,l,h,f,m){const _=Tg(n,l,h),y=Mg(n,s),v=y*h,w=t[0].x===0||t[0].x===m||t[0].y===0||t[0].y===m;return e-v<e/4&&(e=v+e/4),Eg(t,w?e/2*f%e:(y/2+2*l)*h*f%e,e,_,i,v,w,!1,m)}function Eg(t,e,i,n,s,l,h,f,m){const _=l/2,y=wg(t);let v=0,w=e-i,E=[];for(let A=0;A<t.length-1;A++){const I=t[A],z=t[A+1],L=I.dist(z),N=z.angleTo(I);for(;w+i<v+L;){w+=i;const G=(w-v)/L,j=Ut(I.x,z.x,G),X=Ut(I.y,z.y,G);if(j>=0&&j<m&&X>=0&&X<m&&w-_>=0&&w+_<=y){const W=new Yo(j,X,0,N,A);n&&!bg(t,W,l,n,s)||E.push(W)}}v+=L}return f||E.length||h||(E=Eg(t,v/2,i,n,s,l,h,!0,m)),E}function Sg(t,e,i,n,s){const l=[];for(let h=0;h<t.length;h++){const f=t[h];let m;for(let _=0;_<f.length-1;_++){let y=f[_],v=f[_+1];y.x<e&&v.x<e||(y.x<e?y=new Ue(e,y.y+(e-y.x)/(v.x-y.x)*(v.y-y.y))._round():v.x<e&&(v=new Ue(e,y.y+(e-y.x)/(v.x-y.x)*(v.y-y.y))._round()),y.y<i&&v.y<i||(y.y<i?y=new Ue(y.x+(i-y.y)/(v.y-y.y)*(v.x-y.x),i)._round():v.y<i&&(v=new Ue(y.x+(i-y.y)/(v.y-y.y)*(v.x-y.x),i)._round()),y.x>=n&&v.x>=n||(y.x>=n?y=new Ue(n,y.y+(n-y.x)/(v.x-y.x)*(v.y-y.y))._round():v.x>=n&&(v=new Ue(n,y.y+(n-y.x)/(v.x-y.x)*(v.y-y.y))._round()),y.y>=s&&v.y>=s||(y.y>=s?y=new Ue(y.x+(s-y.y)/(v.y-y.y)*(v.x-y.x),s)._round():v.y>=s&&(v=new Ue(y.x+(s-y.y)/(v.y-y.y)*(v.x-y.x),s)._round()),m&&y.equals(m[m.length-1])||(m=[y],l.push(m)),m.push(v)))))}}return l}function Ag(t){let e=0,i=0;for(const h of t)e+=h.w*h.h,i=Math.max(i,h.w);t.sort((h,f)=>f.h-h.h);const n=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),i),h:1/0}];let s=0,l=0;for(const h of t)for(let f=n.length-1;f>=0;f--){const m=n[f];if(!(h.w>m.w||h.h>m.h)){if(h.x=m.x,h.y=m.y,l=Math.max(l,h.y+h.h),s=Math.max(s,h.x+h.w),h.w===m.w&&h.h===m.h){const _=n.pop();f<n.length&&(n[f]=_)}else h.h===m.h?(m.x+=h.w,m.w-=h.w):h.w===m.w?(m.y+=h.h,m.h-=h.h):(n.push({x:m.x+h.w,y:m.y,w:m.w-h.w,h:h.h}),m.y+=h.h,m.h-=h.h);break}}return{w:s,h:l,fill:e/(s*l)||0}}Ke(Yo,"Anchor");const Xr=1;class np{constructor(e,{pixelRatio:i,version:n,stretchX:s,stretchY:l,content:h}){this.paddedRect=e,this.pixelRatio=i,this.stretchX=s,this.stretchY=l,this.content=h,this.version=n}get tl(){return[this.paddedRect.x+Xr,this.paddedRect.y+Xr]}get br(){return[this.paddedRect.x+this.paddedRect.w-Xr,this.paddedRect.y+this.paddedRect.h-Xr]}get displaySize(){return[(this.paddedRect.w-2*Xr)/this.pixelRatio,(this.paddedRect.h-2*Xr)/this.pixelRatio]}}class Ig{constructor(e,i){const n={},s={};this.haveRenderCallbacks=[];const l=[];this.addImages(e,n,l),this.addImages(i,s,l);const{w:h,h:f}=Ag(l),m=new dn({width:h||1,height:f||1});for(const _ in e){const y=e[_],v=n[_].paddedRect;dn.copy(y.data,m,{x:0,y:0},{x:v.x+Xr,y:v.y+Xr},y.data,y.sdf)}for(const _ in i){const y=i[_],v=s[_].paddedRect,w=v.x+Xr,E=v.y+Xr,A=y.data.width,I=y.data.height;dn.copy(y.data,m,{x:0,y:0},{x:w,y:E},y.data),dn.copy(y.data,m,{x:0,y:I-1},{x:w,y:E-1},{width:A,height:1}),dn.copy(y.data,m,{x:0,y:0},{x:w,y:E+I},{width:A,height:1}),dn.copy(y.data,m,{x:A-1,y:0},{x:w-1,y:E},{width:1,height:I}),dn.copy(y.data,m,{x:0,y:0},{x:w+A,y:E},{width:1,height:I})}this.image=m,this.iconPositions=n,this.patternPositions=s}addImages(e,i,n){for(const s in e){const l=e[s],h={x:0,y:0,w:l.data.width+2*Xr,h:l.data.height+2*Xr};n.push(h),i[s]=new np(h,l),l.hasRenderCallback&&this.haveRenderCallbacks.push(s)}}patchUpdatedImages(e,i,n){this.haveRenderCallbacks=this.haveRenderCallbacks.filter(s=>e.hasImage(s,n)),e.dispatchRenderCallbacks(this.haveRenderCallbacks,n);for(const s in e.getUpdatedImages(n))this.patchUpdatedImage(this.iconPositions[s],e.getImage(s,n),i),this.patchUpdatedImage(this.patternPositions[s],e.getImage(s,n),i)}patchUpdatedImage(e,i,n){if(!e||!i||e.version===i.version)return;e.version=i.version;const[s,l]=e.tl,h=!!Object.keys(this.patternPositions).length;n.update(i.data,{useMipmap:h},{x:s,y:l})}}Ke(np,"ImagePosition"),Ke(Ig,"ImageAtlas");const Ru=1e20;function Cg(t,e,i,n,s,l,h,f,m){for(let _=e;_<e+n;_++)Pg(t,i*l+_,l,s,h,f,m);for(let _=i;_<i+s;_++)Pg(t,_*l+e,1,n,h,f,m)}function Pg(t,e,i,n,s,l,h){l[0]=0,h[0]=-Ru,h[1]=Ru,s[0]=t[e];for(let f=1,m=0,_=0;f<n;f++){s[f]=t[e+f*i];const y=f*f;do{const v=l[m];_=(s[f]-s[v]+y-v*v)/(f-v)/2}while(_<=h[m]&&--m>-1);m++,l[m]=f,h[m]=_,h[m+1]=Ru}for(let f=0,m=0;f<n;f++){for(;h[m+1]<f;)m++;const _=l[m],y=f-_;t[e+f*i]=s[_]+y*y}}const Vn=2,op={none:0,ideographs:1,all:2};class Bl{constructor(e,i,n){this.requestManager=e,this.localGlyphMode=i,this.localFontFamily=n,this.urls={},this.entries={},this.localGlyphs={200:{},400:{},500:{},900:{}}}setURL(e,i){this.urls[i]=e}getGlyphs(e,i,n){const s=[],l=this.urls[i]||zt.GLYPHS_URL;for(const h in e)for(const f of e[h])s.push({stack:h,id:f});tn(s,({stack:h,id:f},m)=>{let _=this.entries[h];_||(_=this.entries[h]={glyphs:{},requests:{},ranges:{},ascender:void 0,descender:void 0});let y=_.glyphs[f];if(y!==void 0)return void m(null,{stack:h,id:f,glyph:y});if(y=this._tinySDF(_,h,f),y)return _.glyphs[f]=y,void m(null,{stack:h,id:f,glyph:y});const v=Math.floor(f/256);if(256*v>65535)return void m(new Error("glyphs > 65535 not supported"));if(_.ranges[v])return void m(null,{stack:h,id:f,glyph:y});let w=_.requests[v];w||(w=_.requests[v]=[],Bl.loadGlyphRange(h,v,l,this.requestManager,(E,A)=>
7{if(A){_.ascender=A.ascender,_.descender=A.descender;for(const I in A.glyphs)this._doesCharSupportLocalGlyph(+I)||(_.glyphs[+I]=A.glyphs[+I]);_.ranges[v]=!0}for(const I of w)I(E,A);delete _.requests[v]})),w.push((E,A)=>{E?m(E):A&&m(null,{stack:h,id:f,glyph:A.glyphs[f]||null})})},(h,f)=>{if(h)n(h);else if(f){const m={};for(const{stack:_,id:y,glyph:v}of f)m[_]===void 0&&(m[_]={}),m[_].glyphs===void 0&&(m[_].glyphs={}),m[_].glyphs[y]=v&&{id:v.id,bitmap:v.bitmap.clone(),metrics:v.metrics},m[_].ascender=this.entries[_].ascender,m[_].descender=this.entries[_].descender;n(null,m)}})}_doesCharSupportLocalGlyph(e){return this.localGlyphMode!==op.none&&(this.localGlyphMode===op.all?!!this.localFontFamily:!!this.localFontFamily&&(it["CJK Unified Ideographs"](e)||it["Hangul Syllables"](e)||it.Hiragana(e)||it.Katakana(e)||it["CJK Symbols and Punctuation"](e)||it["CJK Unified Ideographs Extension A"](e)||it["CJK Unified Ideographs Extension B"](e)))}_tinySDF(e,i,n){const s=this.localFontFamily;if(!s||!this._doesCharSupportLocalGlyph(n))return;let l=e.tinySDF;if(!l){let I="400";/bold/i.test(i)?I="900":/medium/i.test(i)?I="500":/light/i.test(i)&&(I="200"),l=e.tinySDF=new Bl.TinySDF({fontFamily:s,fontWeight:I,fontSize:24*Vn,buffer:3*Vn,radius:8*Vn}),l.fontWeight=I}if(this.localGlyphs[l.fontWeight][n])return this.localGlyphs[l.fontWeight][n];const h=String.fromCodePoint(n),{data:f,width:m,height:_,glyphWidth:y,glyphHeight:v,glyphLeft:w,glyphTop:E,glyphAdvance:A}=l.draw(h);return this.localGlyphs[l.fontWeight][n]={id:n,bitmap:new Ps({width:m,height:_},f),metrics:{width:y/Vn,height:v/Vn,left:w/Vn,top:E/Vn-27,advance:A/Vn,localGlyph:!0}}}}Bl.loadGlyphRange=function(t,e,i,n,s){const l=256*e,h=l+255,f=n.transformRequest(n.normalizeGlyphsURL(i).replace("{fontstack}",t).replace("{range}",`${l}-${h}`),Er.Glyphs);ve(f,(m,_)=>{if(m)s(m);else if(_){const y={},v=function(w){return new kl(w).readFields(Wx,{})}(_);for(const w of v.glyphs)y[w.id]=w;s(null,{glyphs:y,ascender:v.ascender,descender:v.descender})}})},Bl.TinySDF=class{constructor({fontSize:t=24,buffer:e=3,radius:i=8,cutoff:n=.25,fontFamily:s="sans-serif",fontWeight:l="normal",fontStyle:h="normal"}={}){this.buffer=e,this.cutoff=n,this.radius=i;const f=this.size=t+4*e,m=this._createCanvas(f),_=this.ctx=m.getContext("2d",{willReadFrequently:!0});_.font=`${h} ${l} ${t}px ${s}`,_.textBaseline="alphabetic",_.textAlign="left",_.fillStyle="black",this.gridOuter=new Float64Array(f*f),this.gridInner=new Float64Array(f*f),this.f=new Float64Array(f),this.z=new Float64Array(f+1),this.v=new Uint16Array(f)}_createCanvas(t){const e=document.createElement("canvas");return e.width=e.height=t,e}draw(t){const{width:e,actualBoundingBoxAscent:i,actualBoundingBoxDescent:n,actualBoundingBoxLeft:s,actualBoundingBoxRight:l}=this.ctx.measureText(t),h=Math.ceil(i),f=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(l-s))),m=Math.min(this.size-this.buffer,h+Math.ceil(n)),_=f+2*this.buffer,y=m+2*this.buffer,v=Math.max(_*y,0),w=new Uint8ClampedArray(v),E={data:w,width:_,height:y,glyphWidth:f,glyphHeight:m,glyphTop:h,glyphLeft:0,glyphAdvance:e};if(f===0||m===0)return E;const{ctx:A,buffer:I,gridInner:z,gridOuter:L}=this;A.clearRect(I,I,f,m),A.fillText(t,I,I+h);const N=A.getImageData(I,I,f,m);L.fill(Ru,0,v),z.fill(0,0,v);for(let G=0;G<m;G++)for(let j=0;j<f;j++){const X=N.data[4*(G*f+j)+3]/255;if(X===0)continue;const W=(G+I)*_+j+I;if(X===1)L[W]=0,z[W]=Ru;else{const J=.5-X;L[W]=J>0?J*J:0,z[W]=J<0?J*J:0}}Cg(L,0,0,_,y,_,this.f,this.v,this.z),Cg(z,I,I,f,m,_,this.f,this.v,this.z);for(let G=0;G<v;G++){const j=Math.sqrt(L[G])-Math.sqrt(z[G]);w[G]=Math.round(255-255*(j/this.radius+this.cutoff))}return E}};const Ls=Xr;function zg(t,e,i,n){const s=[],l=t.imagePrimary,h=l.pixelRatio,f=l.paddedRect.w-2*Ls,m=l.paddedRect.h-2*Ls,_=t.right-t.left,y=t.bottom-t.top,v=l.stretchX||[[0,f]],w=l.stretchY||[[0,m]],E=(se,_e)=>se+_e[1]-_e[0],A=v.reduce(E,0),I=w.reduce(E,0),z=f-A,L=m-I;let N=0,G=A,j=0,X=I,W=0,J=z,ie=0,oe=L;if(l.content&&n){const se=l.content;N=xd(v,0,se[0]),j=xd(w,0,se[1]),G=xd(v,se[0],se[2]),X=xd(w,se[1],se[3]),W=se[0]-N,ie=se[1]-j,J=se[2]-se[0]-G,oe=se[3]-se[1]-X}const ue=(se,_e,Me,pe)=>{const we=vd(se.stretch-N,G,_,t.left),de=bd(se.fixed-W,J,se.stretch,A),be=vd(_e.stretch-j,X,y,t.top),Fe=bd(_e.fixed-ie,oe,_e.stretch,I),Se=vd(Me.stretch-N,G,_,t.left),Qe=bd(Me.fixed-W,J,Me.stretch,A),He=vd(pe.stretch-j,X,y,t.top),Ce=bd(pe.fixed-ie,oe,pe.stretch,I),pt=new Ue(we,be),st=ne
7w Ue(Se,be),Je=new Ue(Se,He),Pe=new Ue(we,He),ht=new Ue(de/h,Fe/h),It=new Ue(Qe/h,Ce/h),mt=e*Math.PI/180;if(mt){const Jt=Math.sin(mt),ei=Math.cos(mt),si=[ei,-Jt,Jt,ei];pt._matMult(si),st._matMult(si),Pe._matMult(si),Je._matMult(si)}const Ct=se.stretch+se.fixed,xt=Me.stretch+Me.fixed,jt=_e.stretch+_e.fixed,wt=pe.stretch+pe.fixed,mi=t.imageSecondary;return{tl:pt,tr:st,bl:Pe,br:Je,texPrimary:{x:l.paddedRect.x+Ls+Ct,y:l.paddedRect.y+Ls+jt,w:xt-Ct,h:wt-jt},texSecondary:mi?{x:mi.paddedRect.x+Ls+Ct,y:mi.paddedRect.y+Ls+jt,w:xt-Ct,h:wt-jt}:void 0,writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:ht,pixelOffsetBR:It,minFontScaleX:J/h/_,minFontScaleY:oe/h/y,isSDF:i}};if(n&&(l.stretchX||l.stretchY)){const se=Dg(v,z,A),_e=Dg(w,L,I);for(let Me=0;Me<se.length-1;Me++){const pe=se[Me],we=se[Me+1];for(let de=0;de<_e.length-1;de++)s.push(ue(pe,_e[de],we,_e[de+1]))}}else s.push(ue({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:f+1},{fixed:0,stretch:m+1}));return s}function xd(t,e,i){let n=0;for(const s of t)n+=Math.max(e,Math.min(i,s[1]))-Math.max(e,Math.min(i,s[0]));return n}function Dg(t,e,i){const n=[{fixed:-Ls,stretch:0}];for(const[s,l]of t){const h=n[n.length-1];n.push({fixed:s-h.stretch,stretch:h.stretch}),n.push({fixed:s-h.stretch,stretch:h.stretch+(l-s)})}return n.push({fixed:e+Ls,stretch:i}),n}function vd(t,e,i,n){return t/e*i+n}function bd(t,e,i,n){return t-e*i/n}function tv(t,e,i,n){const s=e+t.positionedLines[n].lineOffset;return n===0?i+s/2:i+(s+(e+t.positionedLines[n-1].lineOffset))/2}function iv(t,e=1,i=!1){let n=1/0,s=1/0,l=-1/0,h=-1/0;const f=t[0];for(let E=0;E<f.length;E++){const A=f[E];(!E||A.x<n)&&(n=A.x),(!E||A.y<s)&&(s=A.y),(!E||A.x>l)&&(l=A.x),(!E||A.y>h)&&(h=A.y)}const m=Math.min(l-n,h-s);let _=m/2;const y=new Hr([],rv);if(m===0)return new Ue(n,s);for(let E=n;E<l;E+=m)for(let A=s;A<h;A+=m)y.push(new Fl(E+_,A+_,_,t));let v=function(E){let A=0,I=0,z=0;const L=E[0];for(let N=0,G=L.length,j=G-1;N<G;j=N++){const X=L[N],W=L[j],J=X.x*W.y-W.x*X.y;I+=(X.x+W.x)*J,z+=(X.y+W.y)*J,A+=3*J}return new Fl(I/A,z/A,0,E)}(t),w=y.length;for(;y.length;){const E=y.pop();(E.d>v.d||!v.d)&&(v=E,i&&console.log("found best %d after %d probes",Math.round(1e4*E.d)/1e4,w)),E.max-v.d<=e||(_=E.h/2,y.push(new Fl(E.p.x-_,E.p.y-_,_,t)),y.push(new Fl(E.p.x+_,E.p.y-_,_,t)),y.push(new Fl(E.p.x-_,E.p.y+_,_,t)),y.push(new Fl(E.p.x+_,E.p.y+_,_,t)),w+=4)}return i&&(console.log(`num probes: ${w}`),console.log(`best distance: ${v.d}`)),v.p}function rv(t,e){return e.max-t.max}class Fl{constructor(e,i,n,s){this.p=new Ue(e,i),this.h=n,this.d=function(l,h){let f=!1,m=1/0;for(let _=0;_<h.length;_++){const y=h[_];for(let v=0,w=y.length,E=w-1;v<w;E=v++){const A=y[v],I=y[E];A.y>l.y!=I.y>l.y&&l.x<(I.x-A.x)*(l.y-A.y)/(I.y-A.y)+A.x&&(f=!f),m=Math.min(m,As(l,A,I))}}return(f?1:-1)*Math.sqrt(m)}(this.p,s),this.max=this.d+this.h*Math.SQRT2}}const sp=Number.POSITIVE_INFINITY,nv=Math.sqrt(2);function Lg(t,[e,i]){let n=0,s=0;if(i===sp){e<0&&(e=0);const l=e/nv;switch(t){case"top-right":case"top-left":s=l-7;break;case"bottom-right":case"bottom-left":s=7-l;break;case"bottom":s=7-e;break;case"top":s=e-7}switch(t){case"top-right":case"bottom-right":n=-l;break;case"top-left":case"bottom-left":n=l;break;case"left":n=e;break;case"right":n=-e}}else{switch(e=Math.abs(e),i=Math.abs(i),t){case"top-right":case"top-left":case"top":s=i-7;break;case"bottom-right":case"bottom-left":case"bottom":s=7-i}switch(t){case"top-right":case"bottom-right":case"right":n=-e;break;case"top-left":case"bottom-left":case"left":n=e}}return[n,s]}function ap(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 ov(t,e,i,n,s,l,h,f,m,_,y,v,w,E,A){let I=l.textMaxSize.evaluate(e,{},v);I===void 0&&(I=h);const z=t.layers[0].layout,L=z.get("icon-offset").evaluate(e,{},v),N=kg(i.horizontal)||i.vertical,G=w.name==="globe",j=mr,X=h/j,W=t.tilePixelRatio*I/j,J=(we=t.overscaling,t.zoom>18&&we>2&&(we>>=1),Math.max(qe/(512*we),1)*z.get("symbol-spacing")),ie=z.get("text-padding")*t.tilePixelRatio,oe=z.get("icon-padding")*t.tilePixelRatio,ue=qt(z.get("text-max-angle")),se=z.get("text-rotation-alignment")==="map"&&z.get("symbol-placement")!=="point",_e=z.get("icon-rotation-alignment")==="map"&&z.get("symbol-placement")!=="point",Me=z.get("symbol-placement"),pe=J/2;var we;const de=z.get("icon-text-fit").evaluate(e,{},v),be=z.get("icon-text-fit-padding").evaluate(e,{},v),Fe=de!=="none";let Se;t.hasAnyIconTextFit===!1&&Fe&&(t.hasAnyIconTextFit=!0),n&&Fe&&(t.allowVerticalPlacement&&i.vertical&&(Se=vg(n,i.vertical,de,be,L,X)),N&&(n=vg(n,N,de,be,L,X)));const Qe=(He,Ce,pt)=>{if(Ce.x<0||Ce.x>=qe||Ce.y<0||Ce.y>=qe)return;let st=null;if(G){const{x:Je,y:Pe,z:ht}=w.projectTilePoint(Ce.x,Ce.y,pt);st={anchor:new Yo(Je,Pe,ht,0,void 0),up:w.upVector(pt,Ce.x,Ce.y)}}(function(Je,Pe,ht,It,mt,Ct,xt,jt,wt,mi,Jt,ei,si,Qt,Ai,ui,Bi,Yi,hr,Mi,Di,rr,nr,or,vi,Yr,Ns){const Lr=Je.addToLineVertexArray(Pe,It);let Mr,mn,Yu,jd,ky,Oy,By,Fy=0,Ny=0,Vy=0,Uy=0,zp=-1,Dp=-1;const vo={};let jy=vu("");const Na=ht?ht.anchor:Pe,Lp=wt.layout.get("icon-text-fit").evaluate(Di,{},vi)!=="none";let Rp=0,kp=0;if(wt._unevaluatedLayout.getValue("text-radial-offset")===void 0?[Rp,kp]=wt.layout.get("text-offset").evaluate(Di,{},vi).map(Kr=>Kr*mr):(Rp=wt.layout.get("text-radial-offset").evaluate(Di,{},vi)*mr,kp=sp),Je.allowVerticalPlacement&&mt.vertical){const Kr=mt.vertical;if(Ai)Oy=lp(Kr),jt&&(By=lp(jt));else{const Jr=wt.layout.get("text-rotate").evaluate(Di,{},vi)+90;Yu=wd(mi,Na,Pe,Jt,ei,si,Kr,Qt,Jr,ui),jt&&(jd=wd(mi,Na,Pe,Jt,ei,si,jt,Yi,Jr))}}if(Ct){const Kr=wt.layout.get("icon-rotate").evaluate(Di,{},vi),Jr=zg(Ct,Kr,nr,Lp),$l=jt?zg(jt,Kr,nr,Lp):void 0;mn=wd(mi,Na,Pe,Jt,ei,si,Ct,Yi,Kr),Fy=4*Jr.length;const Gy=Je.iconSizeData;let Va=null;Gy.kind==="source"?(Va=[Nn*wt.layout.get("icon-size").evaluate(Di,{},vi)],Va[0]>Rs&&ki(`${Je.layerIds[0]}: Value for "icon-size" is >= ${ku}. Reduce your "icon-size".`)):Gy.kind==="composite"&&(Va=[Nn*rr.compositeIconSizes[0].evaluate(Di,{},vi),Nn*rr.compositeIconSizes[1].evaluate(Di,{},vi)],(Va[0]>Rs||Va[1]>Rs)&&ki(`${Je.layerIds[0]}: Value for "icon-size" is >= ${ku}. Reduce your "icon-size".`)),Je.addSymbols(Je.icon,Jr,Va,Mi,hr,Di,!1,ht,Pe,Lr.lineStartIndex,Lr.lineLength,-1,or,vi,Yr,Ns),zp=Je.icon.placedSymbolArray.length-1,$l&&(Ny=4*$l.length,Je.addSymbols(Je.icon,$l,Va,Mi,hr,Di,fn.vertical,ht,Pe,Lr.lineStartIndex,Lr.lineLength,-1,or,vi,Yr,Ns),Dp=Je.icon.placedSymbolArray.length-1)}for(const Kr in mt.horizontal){const Jr=mt.horizontal[Kr];Mr||(jy=vu(Jr.text),Ai?ky=lp(Jr):Mr=wd(mi,Na,Pe,Jt,ei,si,Jr,Qt,wt.layout.get("text-rotate").evaluate(Di,{},vi),ui));const $l=Jr.positionedLines.length===1;if(Vy+=Rg(Je,ht,Pe,Jr,xt,wt,Ai,Di,ui,Lr,mt.vertical?fn.horizontal:fn.horizontalOnly,$l?Object.keys(mt.horizontal):[Kr],vo,zp,rr,or,vi,Yr),$l)break}mt.vertical&&(Uy+=Rg(Je,ht,Pe,mt.vertical,xt,wt,Ai,Di,ui,Lr,fn.vertical,["vertical"],vo,Dp,rr,or,vi,Yr));let Vs=-1;const Op=(Kr,Jr)=>Kr?Math.max(Kr,Jr):Jr;Vs=Op(ky,Vs),Vs=Op(Oy,Vs),Vs=Op(By,Vs);const T1=Vs>-1?1:0;Je.glyphOffsetArray.length>=65535&&ki("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),Di.sortKey!==void 0&&Je.addToSortKey
7Ranges(Je.symbolInstances.length,Di.sortKey),Je.symbolInstances.emplaceBack(Pe.x,Pe.y,Na.x,Na.y,Na.z,vo.right>=0?vo.right:-1,vo.center>=0?vo.center:-1,vo.left>=0?vo.left:-1,vo.vertical>=0?vo.vertical:-1,zp,Dp,jy,Mr!==void 0?Mr:Je.collisionBoxArray.length,Mr!==void 0?Mr+1:Je.collisionBoxArray.length,Yu!==void 0?Yu:Je.collisionBoxArray.length,Yu!==void 0?Yu+1:Je.collisionBoxArray.length,mn!==void 0?mn:Je.collisionBoxArray.length,mn!==void 0?mn+1:Je.collisionBoxArray.length,jd||Je.collisionBoxArray.length,jd?jd+1:Je.collisionBoxArray.length,Jt,Vy,Uy,Fy,Ny,T1,0,Rp,kp,Vs,0,Lp?1:0)})(t,Ce,st,He,i,n,s,Se,t.layers[0],t.collisionBoxArray,e.index,e.sourceLayerIndex,t.index,ie,se,m,0,oe,_e,L,e,l,_,y,v,E,A)};if(Me==="line")for(const He of Sg(e.geometry,0,0,qe,qe)){const Ce=ev(He,J,ue,i.vertical||N,n,j,W,t.overscaling,qe);for(const pt of Ce)N&&sv(t,N.text,pe,pt)||Qe(He,pt,v)}else if(Me==="line-center"){for(const He of e.geometry)if(He.length>1){const Ce=Qx(He,ue,i.vertical||N,n,j,W);Ce&&Qe(He,Ce,v)}}else if(e.type==="Polygon")for(const He of $f(e.geometry,0)){const Ce=iv(He,16);Qe(He[0],new Yo(Ce.x,Ce.y,0,0,void 0),v)}else if(e.type==="LineString")for(const He of e.geometry)Qe(He,new Yo(He[0].x,He[0].y,0,0,void 0),v);else if(e.type==="Point")for(const He of e.geometry)for(const Ce of He)Qe([Ce],new Yo(Ce.x,Ce.y,0,0,void 0),v)}const ku=255,Rs=ku*Nn;function Rg(t,e,i,n,s,l,h,f,m,_,y,v,w,E,A,I,z,L){const N=function(X,W,J,ie,oe,ue,se,_e){const Me=[];if(W.positionedLines.length===0)return Me;const pe=ie.layout.get("text-rotate").evaluate(ue,{})*Math.PI/180,we=function(Qe){const He=Qe[0],Ce=Qe[1],pt=He*Ce;return pt>0?[He,-Ce]:pt<0?[-He,Ce]:He===0?[Ce,He]:[Ce,-He]}(J);let de=Math.abs(W.top-W.bottom);for(const Qe of W.positionedLines)de-=Qe.lineOffset;const be=W.positionedLines.length,Fe=de/be;let Se=W.top-J[1];for(let Qe=0;Qe<be;++Qe){const He=W.positionedLines[Qe];Se=tv(W,Fe,Se,Qe);for(const Ce of He.positionedGlyphs){if(!Ce.rect)continue;const pt=Ce.rect||{};let st=pg+1,Je=!0,Pe=1,ht=0;if(Ce.imageName){const Mi=se[Ce.imageName];if(!Mi)continue;if(Mi.sdf){ki("SDF images are not supported in formatted text and will be ignored.");continue}Je=!1,Pe=Mi.pixelRatio,st=Xr/Pe}const It=(oe||_e)&&Ce.vertical,mt=Ce.metrics.advance*Ce.scale/2,Ct=Ce.metrics,xt=Ce.rect;if(xt===null)continue;_e&&W.verticalizable&&(ht=Ce.imageName?mt-Ce.metrics.width*Ce.scale/2:0);const jt=oe?[Ce.x+mt,Ce.y]:[0,0];let wt=[0,0],mi=[0,0],Jt=!1;oe||(It?(mi=[Ce.x+mt+we[0],Ce.y+we[1]-ht],Jt=!0):wt=[Ce.x+mt+J[0],Ce.y+J[1]-ht]);const ei=xt.w*Ce.scale/(Pe*(Ce.localGlyph?Vn:1)),si=xt.h*Ce.scale/(Pe*(Ce.localGlyph?Vn:1));let Qt,Ai,ui,Bi;if(It){const Mi=Ce.y-Se,Di=new Ue(-mt,mt-Mi),rr=-Math.PI/2,nr=new Ue(...mi);Qt=new Ue(-mt+wt[0],wt[1]),Qt._rotateAround(rr,Di)._add(nr),Qt.x+=-Mi+mt,Qt.y-=(Ct.left-st)*Ce.scale;const or=Ce.imageName?Ct.advance*Ce.scale:mr*Ce.scale,vi=String.fromCodePoint(Ce.glyph);kx(vi)?Qt.x+=(1-st)*Ce.scale:Ox(vi)?Qt.x+=or-Ct.height*Ce.scale+(-st-1)*Ce.scale:Qt.x+=Ce.imageName||Ct.width+2*st===xt.w&&Ct.height+2*st===xt.h?(or-si)/2:(or-(Ct.height+2*st)*Ce.scale)/2,Ai=new Ue(Qt.x,Qt.y-ei),ui=new Ue(Qt.x+si,Qt.y),Bi=new Ue(Qt.x+si,Qt.y-ei)}else{const Mi=(Ct.left-st)*Ce.scale-mt+wt[0],Di=(-Ct.top-st)*Ce.scale+wt[1],rr=Mi+ei,nr=Di+si;Qt=new Ue(Mi,Di),Ai=new Ue(rr,Di),ui=new Ue(Mi,nr),Bi=new Ue(rr,nr)}if(pe){let Mi;Mi=oe?new Ue(0,0):Jt?new Ue(we[0],we[1]):new Ue(J[0],J[1]),Qt._rotateAround(pe,Mi),Ai._rotateAround(pe,Mi),ui._rotateAround(pe,Mi),Bi._rotateAround(pe,Mi)}const Yi=new Ue(0,0),hr=new Ue(0,0);Me.push({tl:Qt,tr:Ai,bl:ui,br:Bi,texPrimary:pt,texSecondary:void 0,writingMode:W.writingMode,glyphOffset:jt,sectionIndex:Ce.sectionIndex,isSDF:Je,pixelOffsetTL:Yi,pixelOffsetBR:hr,minFontScaleX:0,minFontScaleY:0})}}return Me}(0,n,m,l,h,f,s,t.allowVerticalPlacement),G=t.textSizeData;let j=null;G.kind==="source"?(j=[Nn*l.layout.get("text-size").evaluate(f,{},z)],j[0]>Rs&&ki(`${t.layerIds[0]}: Value for "text-size" is >= ${ku}. Reduce your "text-size".`)):G.kind==="composite"&&(j=[Nn*A.compositeTextSizes[0].evaluate(f,{},z),Nn*A.compositeTextSizes[1].evaluate(f,{},z)],(j[0]>Rs||j[1]>Rs)&&ki(`${t.layerIds[0]}: Value for "text-size" is >= ${ku}. Reduce your "text-size".`)),t.addSymbols(t.text,N,j,m,h,f,y,e,i,_.lineStartIndex,_.lineLength,E,I,z,L,!1);for(const X of v)w[X]=t.text.placedSymbolArray.length-1;return 4*N.length}function kg(t){for(const e in t)return t[e];return null}function wd(t,e,i,n,s,l,h,f,m,_){let y=h.top,v=h.bottom,w=h.left,E=h.right;const A=h.collisionPadding;if(A&&(w-=A[0],y-=A[1],E+=A[2],v+=A[3]),m){const I=new Ue(w,y),z=new Ue(E,y),L=new Ue(w,v),N=new Ue(E,v),G=qt(m);let j=new Ue(0,0);
vendor: 4,297 bytes, line 7
7_&&(j=new Ue(_[0],_[1])),I._rotateAround(G,j),z._rotateAround(G,j),L._rotateAround(G,j),N._rotateAround(G,j),w=Math.min(I.x,z.x,L.x,N.x),E=Math.max(I.x,z.x,L.x,N.x),y=Math.min(I.y,z.y,L.y,N.y),v=Math.max(I.y,z.y,L.y,N.y)}return t.emplaceBack(e.x,e.y,e.z,i.x,i.y,w,y,E,v,f,n,s,l),t.length-1}function lp(t){t.collisionPadding&&(t.top-=t.collisionPadding[1],t.bottom+=t.collisionPadding[3]);const e=t.bottom-t.top;return e>0?Math.max(10,e):null}function sv(t,e,i,n){const s=t.compareText;if(e in s){const l=s[e];for(let h=l.length-1;h>=0;h--)if(n.dist(l[h])<i)return!0}else s[e]=[];return s[e].push(n),!1}function Og(t,e){const i=t.fovAboveCenter,n=t.elevation?t.elevation.getMinElevationBelowMSL()*e:0,s=(t._camera.position[2]*t.worldSize-n)/Math.cos(t._pitch),l=Math.sin(i)*s/Math.sin(Math.max(Math.PI/2-t._pitch-i,.01)),h=Math.sin(t._pitch)*l+s;return Math.min(1.01*h,s*(1/t._horizonShift))}function Ou(t,e){if(!e.isReprojectedInTileSpace)return{scale:1<<t.z,x:t.x,y:t.y,x2:t.x+1,y2:t.y+1,projection:e};const i=Math.pow(2,-t.z),n=t.x*i,s=(t.x+1)*i,l=t.y*i,h=(t.y+1)*i,f=vt(n),m=vt(s),_=Zt(l),y=Zt(h),v=e.project(f,_),w=e.project(m,_),E=e.project(m,y),A=e.project(f,y);let I=Math.min(v.x,w.x,E.x,A.x),z=Math.min(v.y,w.y,E.y,A.y),L=Math.max(v.x,w.x,E.x,A.x),N=Math.max(v.y,w.y,E.y,A.y);const G=i/16;function j(W,J,ie,oe,ue,se){const _e=(ie+ue)/2,Me=(oe+se)/2,pe=e.project(vt(_e),Zt(Me)),we=Math.max(0,I-pe.x,z-pe.y,pe.x-L,pe.y-N);I=Math.min(I,pe.x),L=Math.max(L,pe.x),z=Math.min(z,pe.y),N=Math.max(N,pe.y),we>G&&(j(W,pe,ie,oe,_e,Me),j(pe,J,_e,Me,ue,se))}j(v,w,n,l,s,l),j(w,E,s,l,s,h),j(E,A,s,h,n,h),j(A,v,n,h,n,l),I-=G,z-=G,L+=G,N+=G;const X=1/Math.max(L-I,N-z);return{scale:X,x:I*X,y:z*X,x2:L*X,y2:N*X,projection:e}}function Bg(t,{x:e,y:i},n=0){return new Ue(((e-n)*t.scale-t.x)*qe,(i*t.scale-t.y)*qe)}const av=a.a6.identity(new Float32Array(16));class ks{constructor(e){this.spec=e,this.name=e.name,this.wrap=!1,this.requiresDraping=!1,this.supportsWorldCopies=!1,this.supportsTerrain=!1,this.supportsFog=!1,this.supportsFreeCamera=!1,this.zAxisUnit="meters",this.isReprojectedInTileSpace=!0,this.unsupportedLayers=["custom"],this.center=[0,0],this.range=[3.5,7]}project(e,i){return{x:0,y:0,z:0}}unproject(e,i){return new ne(0,0)}projectTilePoint(e,i,n){return{x:e,y:i,z:0}}locationPoint(e,i,n=!0){return e._coordinatePoint(e.locationCoordinate(i),n)}pixelsPerMeter(e,i){return bt(1,e)*i}pixelSpaceConversion(e,i,n){return 1}farthestPixelDistance(e){return Og(e,e.pixelsPerMeter)}pointCoordinate(e,i,n,s){const l=e.horizonLineFromTop(!1),h=new Ue(i,Math.max(l,n));return e.rayIntersectionCoordinate(e.pointRayIntersection(h,s))}pointCoordinate3D(e,i,n){const s=new Ue(i,n);if(e.elevation)return e.elevation.pointCoordinate(s);{const l=this.pointCoordinate(e,s.x,s.y,0);return[l.x,l.y,l.z]}}isPointAboveHorizon(e,i){if(e.elevation)return!this.pointCoordinate3D(e,i.x,i.y);const n=e.horizonLineFromTop();return i.y<n}createInversionMatrix(e,i){return av}createTileMatrix(e,i,n){let s,l,h;const f=n.canonical,m=a.a6.identity(new Float64Array(16));if(this.isReprojectedInTileSpace){const _=Ou(f,this);s=1,l=_.x+n.wrap*_.scale,h=_.y,a.a6.scale(m,m,[s/_.scale,s/_.scale,e.pixelsPerMeter/i])}else s=i/e.zoomScale(f.z),l=(f.x+Math.pow(2,f.z)*n.wrap)*s,h=f.y*s;return a.a6.translate(m,m,[l,h,0]),a.a6.scale(m,m,[s/qe,s/qe,1]),m}upVector(e,i,n){return[0,0,1]}upVectorScale(e,i,n){return{metersToTile:1}}}class lv extends ks{constructor(e){super(e),this.range=[4,7],this.center=e.center||[-96,37.5];const[i,n]=this.parallels=e.parallels||[29.5,45.5],s=Math.sin(qt(i));this.n=(s+Math.sin(qt(n)))/2,this.c=1+s*(2*this.n-s),this.r0=Math.sqrt(this.c)/this.n}project(e,i){const{n,c:s,r0:l}=this,h=qt(e-this.center[0]),f=qt(i),m=Math.sqrt(s-2*n*Math.sin(f))/n;return{x:m*Math.sin(h*n),y:m*Math.cos(h*n)-l,z:0}}unproject(e,i){const{n,c:s,r0:l}=this,h=l+i;let f=Math.atan2(e,Math.abs(h))*Math.sign(h);h*n<0&&(f-=Math.PI*Math.sign(e)*Math.sign(h));const m=qt(this.center[0])*n;f=Hn(f,-Math.PI-m,Math.PI-m);const _=Dt(dr(f/n)+this.center[0],-180,180),y=Math.asin(Dt((s-(e*e+h*h)*n*n)/(2*n),-1,1)),v=Dt(dr(y),-Ot,Ot);return new ne(_,v)}}const Bu=1.340264,Fu=-.081106,Nu=893e-6,Vu=.003796,Td=Math.sqrt(3)/2;class cv extends ks{project(e,i){i=i/180*Math.PI,e=e/180*Math.PI;const n=Math.asin(Td*Math.sin(i)),s=n*n,l=s*s*s;
vendor: 9,989 bytes, line 7
7return{x:.5*(e*Math.cos(n)/(Td*(Bu+3*Fu*s+l*(7*Nu+9*Vu*s)))/Math.PI+.5),y:1-.5*(n*(Bu+Fu*s+l*(Nu+Vu*s))/Math.PI+1),z:0}}unproject(e,i){e=(2*e-.5)*Math.PI;let n=i=(2*(1-i)-1)*Math.PI,s=n*n,l=s*s*s;for(let y,v,w,E=0;E<12&&(v=n*(Bu+Fu*s+l*(Nu+Vu*s))-i,w=Bu+3*Fu*s+l*(7*Nu+9*Vu*s),y=v/w,n=Dt(n-y,-Math.PI/3,Math.PI/3),s=n*n,l=s*s*s,!(Math.abs(y)<1e-12));++E);const h=Td*e*(Bu+3*Fu*s+l*(7*Nu+9*Vu*s))/Math.cos(n),f=Math.asin(Math.sin(n)/Td),m=Dt(180*h/Math.PI,-180,180),_=Dt(180*f/Math.PI,-Ot,Ot);return new ne(m,_)}}class uv extends ks{constructor(e){super(e),this.wrap=!0,this.supportsWorldCopies=!0}project(e,i){return{x:.5+e/360,y:.5-i/360,z:0}}unproject(e,i){const n=360*(e-.5),s=Dt(360*(.5-i),-Ot,Ot);return new ne(n,s)}}const Nl=Math.PI/2;function Md(t){return Math.tan((Nl+t)/2)}class hv extends ks{constructor(e){super(e),this.center=e.center||[0,30];const[i,n]=this.parallels=e.parallels||[30,30];let s=qt(i),l=qt(n);this.southernCenter=s+l<0,this.southernCenter&&(s=-s,l=-l);const h=Math.cos(s),f=Md(s);this.n=s===l?Math.sin(s):Math.log(h/Math.cos(l))/Math.log(Md(l)/f),this.f=h*Math.pow(Md(s),this.n)/this.n}project(e,i){i=qt(i),this.southernCenter&&(i=-i),e=qt(e-this.center[0]);const n=1e-6,{n:s,f:l}=this;l>0?i<-Nl+n&&(i=-Nl+n):i>Nl-n&&(i=Nl-n);const h=l/Math.pow(Md(i),s);let f=h*Math.sin(s*e),m=l-h*Math.cos(s*e);return f=.5*(f/Math.PI+.5),m=.5*(m/Math.PI+.5),{x:f,y:this.southernCenter?m:1-m,z:0}}unproject(e,i){e=(2*e-.5)*Math.PI,this.southernCenter&&(i=1-i),i=(2*(1-i)-.5)*Math.PI;const{n,f:s}=this,l=s-i,h=Math.sign(l),f=Math.sign(n)*Math.sqrt(e*e+l*l);let m=Math.atan2(e,Math.abs(l))*h;l*n<0&&(m-=Math.PI*Math.sign(e)*h);const _=Dt(dr(m/n)+this.center[0],-180,180),y=Dt(dr(2*Math.atan(Math.pow(s/f,1/n))-Nl),-Ot,Ot);return new ne(_,this.southernCenter?-y:y)}}class Fg extends ks{constructor(e){super(e),this.wrap=!0,this.supportsWorldCopies=!0,this.supportsTerrain=!0,this.supportsFog=!0,this.supportsFreeCamera=!0,this.isReprojectedInTileSpace=!1,this.unsupportedLayers=[],this.range=null}project(e,i){return{x:Et(e),y:gt(i),z:0}}unproject(e,i){const n=vt(e),s=Zt(i);return new ne(n,s)}}const Ng=qt(Ot);class dv extends ks{project(e,i){const n=(i=qt(i))*i,s=n*n;return{x:.5*((e=qt(e))*(.8707-.131979*n+s*(s*(.003971*n-.001529*s)-.013791))/Math.PI+.5),y:1-.5*(i*(1.007226+n*(.015085+s*(.028874*n-.044475-.005916*s)))/Math.PI+1),z:0}}unproject(e,i){e=(2*e-.5)*Math.PI;let n=i=(2*(1-i)-1)*Math.PI,s=25,l=0,h=n*n;do{h=n*n;const _=h*h;l=(n*(1.007226+h*(.015085+_*(.028874*h-.044475-.005916*_)))-i)/(1.007226+h*(.045255+_*(.259866*h-.311325-.005916*11*_))),n=Dt(n-l,-Ng,Ng)}while(Math.abs(l)>1e-6&&--s>0);h=n*n;const f=Dt(dr(e/(.8707+h*(h*(h*h*h*(.003971-.001529*h)-.013791)-.131979))),-180,180),m=dr(n);return new ne(f,m)}}const Vg=qt(Ot);class fv extends ks{project(e,i){i=qt(i),e=qt(e);const n=Math.cos(i),s=2/Math.PI,l=Math.acos(n*Math.cos(e/2)),h=Math.sin(l)/l,f=.5*(e*s+2*n*Math.sin(e/2)/h)||0,m=.5*(i+Math.sin(i)/h)||0;return{x:.5*(f/Math.PI+.5),y:1-.5*(m/Math.PI+1),z:0}}unproject(e,i){let n=e=(2*e-.5)*Math.PI,s=i=(2*(1-i)-1)*Math.PI,l=25;const h=1e-6;let f=0,m=0;do{const _=Math.cos(s),y=Math.sin(s),v=2*y*_,w=y*y,E=_*_,A=Math.cos(n/2),I=Math.sin(n/2),z=2*A*I,L=I*I,N=1-E*A*A,G=N?1/N:0,j=N?Math.acos(_*A)*Math.sqrt(1/N):0,X=.5*(2*j*_*I+2*n/Math.PI)-e,W=.5*(j*y+s)-i,J=.5*G*(E*L+j*_*A*w)+1/Math.PI,ie=G*(z*v/4-j*y*I),oe=.125*G*(v*I-j*y*E*z),ue=.5*G*(w*A+j*L*_)+.5,se=ie*oe-ue*J;f=(W*ie-X*ue)/se,m=(X*oe-W*J)/se,n=Dt(n-f,-Math.PI,Math.PI),s=Dt(s-m,-Vg,Vg)}while((Math.abs(f)>h||Math.abs(m)>h)&&--l>0);return new ne(dr(n),dr(s))}}class Ug extends ks{constructor(e){super(e),this.center=e.center||[0,0],this.parallels=e.parallels||[0,0],this.cosPhi=Math.max(.01,Math.cos(qt(this.parallels[0]))),this.scale=1/(2*Math.max(Math.PI*this.cosPhi,1/this.cosPhi)),this.wrap=!0,this.supportsWorldCopies=!0}project(e,i){const{scale:n,cosPhi:s}=this;return{x:qt(e)*s*n+.5,y:-Math.sin(qt(i))/s*n+.5,z:0}}unproject(e,i){const{scale:n,cosPhi:s}=this,l=-(i-.5)/n,h=Dt(dr((e-.5)/n)/s,-180,180),f=Math.asin(Dt(l*s,-1,1)),m=Dt(dr(f),-Ot,Ot);return new ne(h,m)}}class pv extends Fg{constructor(e){super(e),this.requiresDraping=!0,this.supportsWorldCopies=!1,this.supportsFog=!0,this.zAxisUnit="pixels",this.unsupportedLayers=["debug"],this.range=[3,5]}projectTilePoint(e,i,n){const s=Mu(e,i,n),l=id(xo(n));return a.N.transformMat4(s,s,l),{x:s[0],y:s[1],z:s[2]}}locationPoint(e,i){const n=me(i.lat,i.lng),s=a.N.normalize([],n),l=e.elevation?e.elevation.getAtPointOrZero(e.locationCoordinate(i),e._centerAltitude):e._centerAltitude,h=bt(1,0)*qe*l;a.N.scaleAndAdd(n,n,s,h);const f=a.a6.identity(new Float64Array(16));return a.a6.multiply(f,e.pixelMatrix,e.globeMatrix),a.N.transformMat4(n,n,f),new Ue(n[0],n[1])}pixelsPerMeter(e,i){return bt(1,0)*i}pixelSpaceConversion(e,i,n){const s=bt(1,e)*i,l=Ut(bt(1,45)*i,s,n);return this.pixelsPerMeter(e,i)/l}createTileMatrix(e,i,n){const s=Ff(xo(n.canonical));return a.a6.multiply(new Float64Array(16),e.globeMatrix,s)}createInversionMatrix(e,i){const{center:n}=e,s=id(xo(i));return a.a6.rotateY(s,s,qt(n.lng)),a.a6.rotateX(s,s,qt(n.lat)),a.a6.scale(s,s,[e._pixelsPerMercatorPixel,e._pixelsPerMercatorPixel,1]),Float32Array.from(s)}pointCoordinate(e,i,n,s){return n_(e,i,n,!0)||new Yt(0,0)}pointCoordinate3D(e,i,n){const s=this.pointCoordinate(e,i,n,0);return[s.x,s.y,s.z]}isPointAboveHorizon(e,i){return!n_(e,i.x,i.y,!1)}farthestPixelDistance(e){const i=function(s,l){const h=s.cameraToCenterDistance,f=s._centerAltitude*l,m=s._camera,_=s._camera.forward(),y=a.N.add([],a.N.scale([],_,-h),[0,0,f]),v=s.worldSize/(2*Math.PI),w=[0,0,-v],E=s.width/s.height,A=Math.tan(s.fovAboveCenter),I=a.N.scale([],m.up(),A),z=a.N.scale([],m.right(),A*E),L=a.N.normalize([],a.N.add([],a.N.add([],_,I),z)),N=[];let G;if(new Lf(y,L).closestPointOnSphere(w,v,N)){const j=a.N.add([],N,w),X=a.N.sub([],j,y);G=Math.cos(s.fovAboveCenter)*a.N.length(X)}else{const j=a.N.sub([],y,w),X=a.N.sub([],w,y);a.N.normalize(X,X);const W=a.N.length(j)-v;G=Math.sqrt(W*(W+2*v));const J=Math.acos(G/(v+W))-Math.acos(a.N.dot(_,X));G*=Math.cos(J)}return 1.01*G}(e,this.pixelsPerMeter(e.center.lat,e.worldSize)),n=Cs(e.zoom);if(n>0){const s=Og(e,bt(1,e.center.lat)*e.worldSize),l=e.worldSize/(2*Math.PI),h=Math.max(e.width,e.height)/e.worldSize*Math.PI;return Ut(i,s+l*(1-Math.cos(h)),Math.pow(n,10))}return i}upVector(e,i,n){return Mu(i,n,e,1)}upVectorScale(e){return{metersToTile:Qh(td(xo(e)))}}}function jg(t){const e=t.parallels,i=!!e&&Math.abs(e[0]+e[1])<.01;switch(t.name){case"mercator":return new Fg(t);case"equirectangular":return new uv(t);case"naturalEarth":return new dv(t);case"equalEarth":return new cv(t);case"winkelTripel":return new fv(t);case"albers":return i?new Ug(t):new lv(t);case"lambertConformalConic":return i?new Ug(t):new hv(t);case"globe":return new pv(t)}throw new Error(`Invalid projection name: ${t.name}`)}const mv=cd.types,_v=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function Ed(t,e,i,n,s,l,h,f,m,_,y,v,w){const E=f?Math.min(Rs,Math.round(f[0])):0,A=f?Math.min(Rs,Math.round(f[1])):0;t.emplaceBack(e,i,Math.round(32*n),Math.round(32*s),l,h,(E<<1)+(m?1:0),A,16*_,16*y,256*v,256*w)}function Sd(t,e,i){t.emplaceBack(e,i)}function Ad(t,e,i,n,s,l,h){t.emplaceBack(e,i,n,s,l,h)}function Id(t,e,i,n,s){t.emplaceBack(e,i,n,s),t.emplaceBack(e,i,n,s),t.emplaceBack(e,i,n,s),t.emplaceBack(e,i,n,s)}function gv(t){for(const e of t.sections)if(Hc(e.text))return!0;return!1}class cp{constructor(e){this.layoutVertexArray=new va,this.indexArray=new Ji,this.programConfigurations=e,this.segments=new Oi,this.dynamicLayoutVertexArray=new ho,this.opacityVertexArray=new hu,this.placedSymbolArray=new Rh,this.iconTransitioningVertexArray=new vn,this.globeExtVertexArray=new uu,this.zOffsetVertexArray=new wa}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0&&this.iconTransitioningVertexArray.length===0}upload(e,i,n,s,l){this.isEmpty()||(n&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Ex.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,i),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,Ax.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,_v,!0),this.iconTransitioningVertexArray.length>0&&(this.iconTransitioningVertexBuffer=e.createVertexBuffer(this.iconTransitioningVertexArray,Cx.members,!0)),this.globeExtVertexArray.length>0&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,Sx.members,!0)),!this.zOffsetVertexBuffer&&(this.zOffsetVertexArray.length>0||l)&&(this.zOffsetVertexBuffer=e.createVertexBuffer(this.zOffsetVertexArray,Ix.members,!0)),this.opacityVertexBuffer.itemSize=1),(n||s)&&this.programConfigurations.upload(e))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy(),this.iconTransitioningVertexBuffer&&this.iconTransitioningVertexBuffer.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy(),this.zOffsetVertexBuffer&&this.zOffsetVertexBuffer.destroy())}}Ke(cp,"SymbolBuffers");class up{constructor(e,i,n){this.layoutVertexArray=new e,this.layoutAttributes=i,this.indexArray=new n,this.segments=new Oi,this.collisionVertexArray=new fu,this.collisionVertexArrayExt=new ho}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,Px.members,!0),this.collisionVertexBufferExt=e.createVertexBuffer(this.collisionVertexArrayExt,zx.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy(),this.collisionVertexBufferExt.de
7stroy())}}Ke(up,"CollisionBuffers");class Cd{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(h=>h.fqid),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.fullyClipped=!1,this.hasAnyIconTextFit=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=a.a6.identity([]),this.placementViewportMatrix=a.a6.identity([]);const i=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Qf(this.zoom,i["text-size"]),this.iconSizeData=Qf(this.zoom,i["icon-size"]);const n=this.layers[0].layout,s=n.get("symbol-sort-key"),l=n.get("symbol-z-order");this.canOverlap=n.get("text-allow-overlap")||n.get("icon-allow-overlap")||n.get("text-ignore-placement")||n.get("icon-ignore-placement"),this.sortFeaturesByKey=l!=="viewport-y"&&s.constantOr(1)!==void 0,this.sortFeaturesByY=(l==="viewport-y"||l==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,this.writingModes=n.get("text-writing-mode").map(h=>fn[h]),this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id),this.sourceID=e.sourceID,this.projection=e.projection,this.hasAnyZOffset=!1,this.zOffsetSortDirty=!1,this.zOffsetBuffersNeedUpload=n.get("symbol-z-elevate")}createArrays(){this.text=new cp(new k(this.layers,this.zoom,e=>/^text/.test(e))),this.icon=new cp(new k(this.layers,this.zoom,e=>/^icon/.test(e))),this.glyphOffsetArray=new Bh,this.lineVertexArray=new Sa,this.symbolInstances=new Oh}calculateGlyphDependencies(e,i,n,s,l){for(let h=0;h<e.length;h++){const f=e.codePointAt(h);if(f===void 0)break;if(i[f]=!0,s&&l&&f<=65535){const m=Du[e.charAt(h)];m&&(i[m.charCodeAt(0)]=!0)}}}populate(e,i,n,s){const l=this.layers[0],h=l.layout,f=this.projection.name==="globe",m=h.get("text-font"),_=h.get("text-field"),y=h.get("icon-image"),v=(_.value.kind!=="constant"||_.value.value instanceof lr&&!_.value.value.isEmpty()||_.value.value.toString().length>0)&&(m.value.kind!=="constant"||m.value.value.length>0),w=y.value.kind!=="constant"||!!y.value.value||Object.keys(y.parameters).length>0,E=h.get("symbol-sort-key");if(this.features=[],!v&&!w)return;const A=i.iconDependencies,I=i.glyphDependencies,z=i.availableImages,L=new Ii(this.zoom);for(const{feature:N,id:G,index:j,sourceLayerIndex:X}of e){const W=l._featureFilter.needGeometry,J=Hi(N,W);if(!l._featureFilter.filter(L,J,n))continue;if(W||(J.geometry=er(N,n,s)),f&&N.type!==1&&n.z<=5){const se=J.geometry,_e=.98078528056,Me=(pe,we)=>{const de=Mu(pe.x,pe.y,n,1),be=Mu(we.x,we.y,n,1);return a.N.dot(de,be)<_e};for(let pe=0;pe<se.length;pe++)se[pe]=ur(se[pe],Me)}let ie,oe;if(v){const se=l.getValueAndResolveTokens("text-field",J,n,z),_e=lr.factory(se);gv(_e)&&(this.hasRTLText=!0),(!this.hasRTLText||uo()==="unavailable"||this.hasRTLText&&Nr.isParsed())&&(ie=Rx(_e,l,J))}if(w){const se=l.getValueAndResolveTokens("icon-image",J,n,z);oe=se instanceof ft?se:ft.fromString(se)}if(!ie&&!oe)continue;const ue=this.sortFeaturesByKey?E.evaluate(J,{},n):void 0;if(this.features.push({id:G,text:ie,icon:oe,index:j,sourceLayerIndex:X,geometry:J.geometry,properties:N.properties,type:mv[N.type],sortKey:ue}),oe&&(A[oe.namePrimary]=!0,oe.nameSecondary&&(A[oe.nameSecondary]=!0)),ie){const se=m.evaluate(J,{},n).join(","),_e=h.get("text-rotation-alignment")==="map"&&h.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(fn.vertical)>=0;for(const Me of ie.sections)if(Me.image)A[Me.image.namePrimary]=!0;else{const pe=lo(ie.toString()),we=Me.fontStack||se,de=I[we]=I[we]||{};this.calculateGlyphDependencies(Me.text,de,_e,this.allowVerticalPlacement,pe)}}}h.get("symbol-placement")==="line"&&(this.features=function(N){const G={},j={},X=[];let W=0;function J(se){X.push(N[se]),W++}function ie(se,_e,Me){const pe=j[se];return delete j[se],j[_e]=pe,X[pe].geometry[0].pop(),X[pe].geometry[0]=X[pe].geometry[0].concat(Me[0]),pe}function oe(se,_e,Me){const pe=G[_e];return delete G[_e],G[se]=pe,X[pe].geometry[0].shift(),X[pe].geometry[0]=Me[0].concat(X[pe].geometry[0]),pe}function ue(se,_e,Me){const pe=Me?_e[0][_e[0].length-1]:_e[0][0];return`${se}:${pe.x}:${pe.y}`}for(let se=0;se<N.length;se++){const _e=N[se],Me=_e.geometry,pe=_e.text?_e.text.toString():null;if(!pe){J(se);continue}const we=ue(pe,Me),de=ue(pe,Me,!0);if(we in j&&de in G&&j[we]!==G[de]){const be=oe(we,de,Me),Fe=ie(we,de,X[be].geometry);delete G[we],delete j[de],j[ue(pe,X[Fe].geometry,!0)]=Fe,X[be].geometry=null}else we in j?ie(we,de,Me):de in G?oe(we,de,Me):(J(se),G[we]=W-1,j[de]=W-1)}return X.filter(se=>se.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((N,G)=>N.sortKey-G.sortKey)}update(e,i,n,s,l){const h=Object.keys(e).length!==0;if(h&&!this.stateDependentLayers.length)return;const f=h?this.stateDependentLayers:this.layers;this.text.programConfigurations.updatePaintArrays(e,i,f,n,s,l),this.icon.programConfigurations.updatePaintArrays(e,i,f,n,s,l)}updateZOffset(){const e=(l,h,f)=>{n+=h,n>l.length&&l.resize(n);for(let m=-h;m<0;m++)l.emplace(m+n,f)},i=(l,h,f)=>{s+=h,s>l.length&&l.resize(s);for(let m=-h;m<0;m++)l.emplace(m+s,f)};if(!this.zOffsetBuffersNeedUpload)return;this.zOffsetBuffersNeedUpload=!1;let n=0,s=0;for(let l=0;l<this.symbolInstances.length;l++){const h=this.symbolInstances.get(l),{numHorizontalGlyphVertices:f,numVerticalGlyphVertices:m,numIconVertices:_}=h,y=h.zOffset,v=_>0;if((f>0||m>0)&&(e(this.text.zOffsetVertexArray,f,y),e(this.text.zOffsetVertexArray,m,y
vendor: 19,861 bytes, line 7
7)),v){const{placedIconSymbolIndex:w,verticalPlacedIconSymbolIndex:E}=h;w>=0&&i(this.icon.zOffsetVertexArray,_,y),E>=0&&i(this.icon.zOffsetVertexArray,h.numVerticalIconVertices,y)}}this.text.zOffsetVertexBuffer&&this.text.zOffsetVertexBuffer.updateData(this.text.zOffsetVertexArray),this.icon.zOffsetVertexBuffer&&this.icon.zOffsetVertexBuffer.updateData(this.icon.zOffsetVertexArray)}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload),this.icon.upload(e,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}getProjection(){return this.projectionInstance||(this.projectionInstance=jg(this.projection)),this.projectionInstance}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(e,i){const n=this.lineVertexArray.length;if(e.segment!==void 0)for(const{x:s,y:l}of i)this.lineVertexArray.emplaceBack(s,l);return{lineStartIndex:n,lineLength:this.lineVertexArray.length-n}}addSymbols(e,i,n,s,l,h,f,m,_,y,v,w,E,A,I,z){const L=e.indexArray,N=e.layoutVertexArray,G=e.globeExtVertexArray,j=e.segments.prepareSegment(4*i.length,N,L,this.canOverlap?h.sortKey:void 0),X=this.glyphOffsetArray.length,W=j.vertexLength,J=this.allowVerticalPlacement&&f===fn.vertical?Math.PI/2:0,ie=h.text&&h.text.sections;for(let ue=0;ue<i.length;ue++){const{tl:se,tr:_e,bl:Me,br:pe,texPrimary:we,texSecondary:de,pixelOffsetTL:be,pixelOffsetBR:Fe,minFontScaleX:Se,minFontScaleY:Qe,glyphOffset:He,isSDF:Ce,sectionIndex:pt}=i[ue],st=j.vertexLength,Je=He[1];if(Ed(N,_.x,_.y,se.x,Je+se.y,we.x,we.y,n,Ce,be.x,be.y,Se,Qe),Ed(N,_.x,_.y,_e.x,Je+_e.y,we.x+we.w,we.y,n,Ce,Fe.x,be.y,Se,Qe),Ed(N,_.x,_.y,Me.x,Je+Me.y,we.x,we.y+we.h,n,Ce,be.x,Fe.y,Se,Qe),Ed(N,_.x,_.y,pe.x,Je+pe.y,we.x+we.w,we.y+we.h,n,Ce,Fe.x,Fe.y,Se,Qe),m){const{x:Pe,y:ht,z:It}=m.anchor,[mt,Ct,xt]=m.up;Ad(G,Pe,ht,It,mt,Ct,xt),Ad(G,Pe,ht,It,mt,Ct,xt),Ad(G,Pe,ht,It,mt,Ct,xt),Ad(G,Pe,ht,It,mt,Ct,xt),Id(e.dynamicLayoutVertexArray,Pe,ht,It,J)}else Id(e.dynamicLayoutVertexArray,_.x,_.y,_.z,J);if(z){const Pe=de||we;Sd(e.iconTransitioningVertexArray,Pe.x,Pe.y),Sd(e.iconTransitioningVertexArray,Pe.x+Pe.w,Pe.y),Sd(e.iconTransitioningVertexArray,Pe.x,Pe.y+Pe.h),Sd(e.iconTransitioningVertexArray,Pe.x+Pe.w,Pe.y+Pe.h)}L.emplaceBack(st,st+1,st+2),L.emplaceBack(st+1,st+2,st+3),j.vertexLength+=4,j.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(He[0]),ue!==i.length-1&&pt===i[ue+1].sectionIndex||e.programConfigurations.populatePaintArrays(N.length,h,h.index,{},E,A,I,ie&&ie[pt])}const oe=m?m.anchor:_;e.placedSymbolArray.emplaceBack(oe.x,oe.y,oe.z,_.x,_.y,X,this.glyphOffsetArray.length-X,W,y,v,_.segment,n?n[0]:0,n?n[1]:0,s[0],s[1],f,0,!1,0,w,0)}_commitLayoutVertex(e,i,n,s,l,h,f){e.emplaceBack(i,n,s,l,h,Math.round(f.x),Math.round(f.y))}_addCollisionDebugVertices(e,i,n,s,l,h,f){const m=n.segments.prepareSegment(4,n.layoutVertexArray,n.indexArray),_=m.vertexLength,y=f.tileAnchorX,v=f.tileAnchorY;for(let E=0;E<4;E++)n.collisionVertexArray.emplaceBack(0,0,0,0);this._commitDebugCollisionVertexUpdate(n.collisionVertexArrayExt,i,e.padding,f.zOffset),this._commitLayoutVertex(n.layoutVertexArray,s,l,h,y,v,new Ue(e.x1,e.y1)),this._commitLayoutVertex(n.layoutVertexArray,s,l,h,y,v,new Ue(e.x2,e.y1)),this._commitLayoutVertex(n.layoutVertexArray,s,l,h,y,v,new Ue(e.x2,e.y2)),this._commitLayoutVertex(n.layoutVertexArray,s,l,h,y,v,new Ue(e.x1,e.y2)),m.vertexLength+=4;const w=n.indexArray;w.emplaceBack(_,_+1),w.emplaceBack(_+1,_+2),w.emplaceBack(_+2,_+3),w.emplaceBack(_+3,_),m.primitiveLength+=4}_addTextDebugCollisionBoxes(e,i,n,s,l,h){for(let f=s;f<l;f++){const m=n.get(f),_=this.getSymbolInstanceTextSize(e,h,i,f);this._addCollisionDebugVertices(m,_,this.textCollisionBox,m.projectedAnchorX,m.projectedAnchorY,m.projectedAnchorZ,h)}}_addIconDebugCollisionBoxes(e,i,n,s,l,h){for(let f=s;f<l;f++){const m=n.get(f),_=this.getSymbolInstanceIconSize(e,i,h.placedIconSymbolIndex);this._addCollisionDebugVertices(m,_,this.iconCollisionBox,m.projectedAnchorX,m.projectedAnchorY,m.projectedAnchorZ,h)}}generateCollisionDebugBuffers(e,i){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new up(ba,lg.members,vn),this.iconCollisionBox=new up(ba,lg.members,vn);const n=Dl(this.iconSizeData,e),s=Dl(this.textSizeData,e);for(let l=0;l<this.symbolInstances.length;l++){const h=this.symbolInstances.get(l);this._addTextDebugCollisionBoxes(s,e,i,h.textBoxStartIndex,h.textBoxEndIndex,h),this._addTextDebugCollisionBoxes(s,e,i,h.verticalTextBoxStartIndex,h.verticalTextBoxEndIndex,h),this._addIconDebugCollisionBoxes(n,e,i,h.iconBoxStartIndex,h.iconBoxEndIndex,h),this._addIconDebugCollisionBoxes(n,e,i,h.verticalIconBoxStartIndex,h.verticalIconBoxEndIndex,h)}}getSymbolInstanceTextSize(e,i,n,s){const l=this.text.placedSymbolArray.get(i.rightJustifiedTextSymbolIndex>=0?i.rightJustifiedTextSymbolIndex:i.centerJustifiedTextSymbolIndex>=0?i.centerJustifiedTextSymbolIndex:i.leftJustifiedTextSymbolIndex>=0?i.leftJustifiedTextSymbolIndex:i.verticalPlacedTextSymbolIndex>=0?i.verticalPlacedTextSymbolIndex:s),h=md(this.textSizeData,e,l)/mr;return this.tilePixelRatio*h}getSymbolInstanceIconSize(e,i,n){const s=this.icon.placedSymbolArray.get(n),l=md(this.iconSizeData,e,s);return this.tilePixelRatio*l}_commitDebugCollisionVertexUpdate(e,i,n,s){e.emplaceBack(i,-n,-n,s),e.emplaceBack(i,n,-n,s),e.emplaceBack(i,n,n,s),e.emplaceBack(i,-n,n,s)}_updateTextDebugCollisionBoxes(e,i,n,s,l,h){for(let f=s;f<l;f++){const m=n.get(f),_=this.getSymbolInstanceTextSize(e,h,i,f);this._commitDebugCollisionVertexUpdate(this.textCollisionBox.collisionVertexArrayExt,_,m.padding,h.zOffset)}}_updateIconDebugCollisionBoxes(e,i,n,s,l,h){for(let f=s;f<l;f++){const m=n.get(f),_=this.getSymbolInstanceIconSize(e,i,h.placedIconSymbolIndex);this._commitDebugCollisionVertexUpdate(this.iconCollisionBox.collisionVertexArrayExt,_,m.padding,h.zOffset)}}updateCollisionDebugBuffers(e,i){if(!this.hasDebugData())return;this.hasTextCollisionBoxData()&&this.textCollisionBox.collisionVertexArrayExt.clear(),this.hasIconCollisionBoxData()&&this.iconCollisionBox.collisionVertexArrayExt.clear();const n=Dl(this.iconSizeData,e),s=Dl(this.textSizeData,e);for(let l=0;l<this.symbolInstances.length;l++){const h=this.symbolInstances.get(l);this._updateTextDebugCollisionBoxes(s,e,i,h.textBoxStartIndex,h.textBoxEndIndex,h),this._updateTextDebugCollisionBoxes(s,e,i,h.verticalTextBoxStartIndex,h.verticalTextBoxEndIndex,h),this._updateIconDebugCollisionBoxes(n,e,i,h.iconBoxStartIndex,h.iconBoxEndIndex,h),this._updateIconDebugCollisionBoxes(n,e,i,h.verticalIconBoxStartIndex,h.verticalIconBoxEndIndex,h)}this.hasTextCollisionBoxData()&&this.textCollisionBox.collisionVertexBufferExt&&this.textCollisionBox.collisionVertexBufferExt.updateData(this.textCollisionBox.collisionVertexArrayExt),this.hasIconCollisionBoxData()&&this.iconCollisionBox.collisionVertexBufferExt&&this.iconCollisionBox.collisionVertexBufferExt.updateData(this.iconCollisionBox.collisionVertexArrayExt)}_deserializeCollisionBoxesForSymbol(e,i,n,s,l,h,f,m,_){const y={};if(i<n){const{x1:v,y1:w,x2:E,y2:A,padding:I,projectedAnchorX:z,projectedAnchorY:L,projectedAnchorZ:N,tileAnchorX:G,tileAnchorY:j,featureIndex:X}=e.get(i);y.textBox={x1:v,y1:w,x2:E,y2:A,padding:I,projectedAnchorX:z,projectedAnchorY:L,projectedAnchorZ:N,tileAnchorX:G,tileAnchorY:j},y.textFeatureIndex=X}if(s<l){const{x1:v,y1:w,x2:E,y2:A,padding:I,projectedAnchorX:z,projectedAnchorY:L,projectedAnchorZ:N,tileAnchorX:G,tileAnchorY:j,featureIndex:X}=e.get(s);y.verticalTextBox={x1:v,y1:w,x2:E,y2:A,padding:I,projectedAnchorX:z,projectedAnchorY:L,projectedAnchorZ:N,tileAnchorX:G,tileAnchorY:j},y.verticalTextFeatureIndex=X}if(h<f){const{x1:v,y1:w,x2:E,y2:A,padding:I,projectedAnchorX:z,projectedAnchorY:L,projectedAnchorZ:N,tileAnchorX:G,tileAnchorY:j,featureIndex:X}=e.get(h);y.iconBox={x1:v,y1:w,x2:E,y2:A,padding:I,projectedAnchorX:z,projectedAnchorY:L,projectedAnchorZ:N,tileAnchorX:G,tileAnchorY:j},y.iconFeatureIndex=X}if(m<_){const{x1:v,y1:w,x2:E,y2:A,padding:I,projectedAnchorX:z,projectedAnchorY:L,projectedAnchorZ:N,tileAnchorX:G,tileAnchorY:j,featureIndex:X}=e.get(m);y.verticalIconBox={x1:v,y1:w,x2:E,y2:A,padding:I,projectedAnchorX:z,projectedAnchorY:L,projectedAnchorZ:N,tileAnchorX:G,tileAnchorY:j},y.verticalIconFeatureIndex=X}return y}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let i=0;i<this.symbolInstances.length;i++){const n=this.symbolInstances.get(i);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,n.textBoxStartIndex,n.textBoxEndIndex,n.verticalTextBoxStartIndex,n.verticalTextBoxEndIndex,n.iconBoxStartIndex,n.iconBoxEndIndex,n.verticalIconBoxStartIndex,n.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}hasIconTextFit(){return this.hasAnyIconTextFit}addIndicesForPlacedSymbol(e,i){const n=e.placedSymbolArray.get(i),s=n.vertexStartIndex+4*n.numGlyphs;for(let l=n.vertexStartIndex;l<s;l+=4)e.indexArray.emplaceBack(l,l+1,l+2),e.indexArray.emplaceBack(l+1,l+2,l+3)}getSortedSymbolIndexes(e){if(this.sortedAngle===e&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const i=Math.sin(e),n=Math.cos(e),s=[],l=[],h=[];for(let f=0;f<this.symbolInstances.length;++f){h.push(f);const m=this.symbolInstances.get(f);s.push(0|Math.round(i*m.tileAnchorX+n*m.tileAnchorY)),l.push(m.featureIndex)}return h.sort((f,m)=>s[f]-s[m]||l[m]-l[f]),h}getSortedIndexesByZOffset(){if(!this.zOffsetSortDirty)return this.symbolInstanceIndexesSortedZOffset;if(!this.symbolInstanceIndexesSortedZOffset){this.symbolInstanceIndexesSortedZOffset=[];for(let e=0;e<this.symbolInstances.length;++e)this.symbolInstanceIndexesSortedZOffset.push(e)}return this.zOffsetSortDirty=!1,this.symbolInstanceIndexesSortedZOffset.sort((e,i)=>this.symbolInstances.get(i).zOffset-this.symbolInstances.get(e).zOffset)}addToSortKeyRanges(e,i){const n=this.sortKeyRanges[this.sortKeyRanges.length-1];n&&n.sortKey===i?n.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:i,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const i of this.symbolInstanceIndexes){const n=this.symbolInstances.get(i);this.featureSortOrder.push(n.featureIndex);const{rightJustifiedTextSymbolIndex:s,centerJustifiedTextSymbolIndex:l,leftJustifiedTextSymbolIndex:h,verticalPlacedTextSymbolIndex:f,placedIconSymbolIndex:m,verticalPlacedIconSymbolIndex:_}=n;s>=0&&this.addIndicesForPlacedSymbol(this.text,s),l>=0&&l!==s&&this.addIndicesForPlacedSymbol(this.text,l),h>=0&&h!==l&&h!==s&&this.addIndicesForPlacedSymbol(this.text,h),f>=0&&this.addIndicesForPlacedSymbol(this.text,f),m>=0&&this.addIndicesForPlacedSymbol(this.icon,m),_>=0&&this.addIndicesForPlacedSymbol(this.icon,_)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}Ke(Cd,"SymbolBucket",{omit:["layers","collisionBoxArray","features","compareText"]}),Cd.addDynamicAttributes=Id;const yv=new Ci({"symbol-placement":new Oe(le.layout_symbol["symbol-placement"]),"symbol-spacing":new Oe(le.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Oe(le.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new ut(le.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Oe(le.layout_symbol["symbol-z-order"]),"symbol-z-elevate":new Oe(le.layout_symbol["symbol-z-elevate"]),"icon-allow-overlap":new Oe(le.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new Oe(le.layout_symbol["icon-ignore-placement"]),"icon-optional":new Oe(le.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Oe(le.layout_symbol["icon-rotation-alignment"]),"icon-size":new ut(le.layout_symbol["icon-size"]),"icon-text-fit":new ut(le.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new ut(le.layout_symbol["icon-text-fit-padding"]),"icon-image":new ut(le.layout_symbol["icon-image"]),"icon-rotate":new ut(le.layout_symbol["icon-rotate"]),"icon-padding":new Oe(le.layout_symbol["icon-padding"]),"icon-keep-upright":new Oe(le.layout_symbol["icon-keep-upright"]),"icon-offset":new ut(le.layout_symbol["icon-offset"]),"icon-anchor":new ut(le.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Oe(le.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Oe(le.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Oe(le.layout_symbol["text-rotation-alignment"]),"text-field":new ut(le.layout_symbol["text-field"]),"text-font":new ut(le.layout_symbol["text-font"]),"text-size":new ut(le.layout_symbol["text-size"]),"text-max-width":new ut(le.layout_symbol["text-max-width"]),"text-line-height":new ut(le.layout_symbol["text-line-height"]),"text-letter-spacing":new ut(le.layout_symbol["text-letter-spacing"]),"text-justify":new ut(le.layout_symbol["text-justify"]),"text-radial-offset":new ut(le.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Oe(le.layout_symbol["text-variable-anchor"]),"text-anchor":new ut(le.layout_symbol["text-anchor"]),"text-max-angle":new Oe(le.layout_symbol["text-max-angle"]),"text-writing-mode":new Oe(le.layout_symbol["text-writing-mode"]),"text-rotate":new ut(le.layout_symbol["text-rotate"]),"text-padding":new Oe(le.layout_symbol["text-padding"]),"text-keep-upright":new Oe(le.layout_symbol["text-keep-upright"]),"text-transform":new ut(le.layout_symbol["text-transform"]),"text-offset":new ut(le.layout_symbol["text-offset"]),"text-allow-overlap":new Oe(le.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new Oe(le.layout_symbol["text-ignore-placement"]),"text-optional":new Oe(le.layout_symbol["text-optional"]),visibility:new Oe(le.layout_symbol.visibility)});var hp={paint:new Ci({"icon-opacity":new ut(le.paint_symbol["icon-opacity"]),"icon-emissive-strength":new ut(le.paint_symbol["icon-emissive-strength"]),"text-emissive-strength":new ut(le.paint_symbol["text-emissive-strength"]),"icon-color":new ut(le.paint_symbol["icon-color"]),"icon-halo-color":new ut(le.paint_symbol["icon-halo-color"]),"icon-halo-width":new ut(le.paint_symbol["icon-halo-width"]),"icon-halo-blur":new ut(le.paint_symbol["icon-halo-blur"]),"icon-translate":new Oe(le.paint_symbol["icon-translate"]),"icon-translate-anchor":new Oe(le.paint_symbol["icon-translate-anchor"]),"icon-image-cross-fade":new ut(le.paint_symbol["icon-image-cross-fade"]),"text-opacity":new ut(le.paint_symbol["text-opacity"]),"text-color":new ut(le.paint_symbol["text-color"],{runtimeType:qr,getOverride:t=>t.textColor,hasOverride:t=>!!t.textColor}),"text-halo-color":new ut(le.paint_symbol["text-halo-color"]),"text-halo-width":new ut(le.paint_symbol["text-halo-width"]),"text-halo-blur":new ut(le.paint_symbol["text-halo-blur"]),"text-translate":new Oe(le.paint_symbol["text-translate"]),"text-translate-anchor":new Oe(le.paint_symbol["text-translate-anchor"]),"icon-color-saturation":new Oe(le.paint_symbol["icon-color-saturation"])}),layout:yv};class Gg{constructor(e){this.type=e.property.overrides?e.property.overrides.runtimeType:ns,this.defaultValue=e}evaluate(e){if(e.formattedSection){const i=this.defaultValue.property.overrides;if(i&&i.hasOverride(e.formattedSection))return i.getOverride(e.formattedSection)}return e.feature&&e.featureState?this.defaultValue.evaluate(e.feature,e.featureState):this.defaultValue.property.specification.default}eachChild(e){this.defaultValue.isConstant()||e(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}Ke(Gg,"FormatSectionOverride",{omit:["defaultValue"]});class Pd extends Cr{constructor(e,i,n){super(e,hp,i,n)}recalculate(e,i){super.recalculate(e,i),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout._values["icon-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout._values["text-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment"));const n=this.layout.get("text-writing-mode");if(n){const s=[];for(const l of n)s.indexOf(l)<0&&s.push(l);this.layout._values["text-writing-mode"]=s}else this.layout._values["text-writing-mode"]=this.layout.get("symbol-placement")==="point"?["horizontal"]:["horizontal","vertical"];this._setPaintOverrides()}getValueAndResolveTokens(e,i,n,s){const l=this.layout.get(e).evaluate(i,{},n,s),h=this._unevaluatedLayout._values[e];return h.isDataDriven()||aa(h.value)||!l?l:function(f,m){return m.replace(/{([^{}]+)}/g,(_,y)=>y in f?String(f[y]):"")}(i.properties,l)}createBucket(e){return new Cd(e)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(const e of hp.paint.overridableProperties){if(!Pd.hasPaintOverride(this.layout,e))continue;const i=this.paint.get(e),n=new Gg(i),s=new dl(n,i.property.specification,this.scope,this.options);let l=null;l=i.value.kind==="constant"||i.value.kind==="source"?new $c("source",s):new la("composite",s,i.value.zoomStops,i.value._interpolationType),this.paint._values[e]=new Ts(i.property,l,i.parameters)}}_handleOverridablePaintPropertyUpdate(e,i,n){return!(!this.layout||i.isDataDriven()||n.isDataDriven())&&Pd.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,i){const n=e.get("text-field"),s=hp.paint.properties[i];let l=!1;const h=f=>{for(const m of f)if(s.overrides&&s.overrides.hasOverride(m))return void(l=!0)};if(n.value.kind==="constant"&&n.value.value instanceof lr)h(n.value.value.sections);else if(n.value.kind==="source"){const f=_=>{l||(_ instanceof In&&$i(_.value)===ss?h(_.value.sections):_ instanceof ls?h(_.sections):_.eachChild(f))},m=n.value;m._styleExpression&&f(m._styleExpression.expression)}return l}getProgramIds(){const e=this.paint.get("icon-opacity").constantOr(1)!==0,i=this.paint.get("text-opacity").constantOr(1)!==0,n=[];return e&&n.push("symbolIcon"),i&&n.push("symbolSDF"),n}getDefaultProgramParams(e,i){return{config:new P(this,i),overrideFog:!1}}}const xv=new Ci({visibility:new Oe(le.layout_background.visibility)});var vv={paint:new Ci({"background-color":new Oe(le.paint_background["background-color"]),"background-pattern":new Oe(le.paint_background["background-pattern"]),"background-opacity":new Oe(le.paint_background["background-opacity"]),"background-emissive-strength":new Oe(le.paint_background["background-emissive-strength"])}),layout:xv};const bv=new Ci({visibility:new Oe(le.layout_raster.visibility)});var wv={paint:new Ci({"raster-opacity":new Oe(le.paint_raster["raster-opacity"]),"raster-color":new Uo(le.paint_raster["raster-color"]),"raster-color-mix":ne
7w Oe(le.paint_raster["raster-color-mix"]),"raster-color-range":new Oe(le.paint_raster["raster-color-range"]),"raster-hue-rotate":new Oe(le.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Oe(le.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Oe(le.paint_raster["raster-brightness-max"]),"raster-saturation":new Oe(le.paint_raster["raster-saturation"]),"raster-contrast":new Oe(le.paint_raster["raster-contrast"]),"raster-resampling":new Oe(le.paint_raster["raster-resampling"]),"raster-fade-duration":new Oe(le.paint_raster["raster-fade-duration"]),"raster-emissive-strength":new Oe(le.paint_raster["raster-emissive-strength"]),"raster-array-band":new Oe(le.paint_raster["raster-array-band"]),"raster-elevation":new Oe(le.paint_raster["raster-elevation"])}),layout:bv},dp=li([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class fp{constructor(e,i,n,s){this.context=e,this.format=n,this.texture=e.gl.createTexture(),this.update(i,s)}update(e,i,n){const{width:s,height:l}=e,{context:h}=this,{gl:f}=h;if(f.bindTexture(f.TEXTURE_2D,this.texture),h.pixelStoreUnpackFlipY.set(!1),h.pixelStoreUnpack.set(1),h.pixelStoreUnpackPremultiplyAlpha.set(this.format===f.RGBA&&(!i||i.premultiply!==!1)),n||this.size&&this.size[0]===s&&this.size[1]===l){const{x:m,y:_}=n||{x:0,y:0};if(e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||ImageBitmap&&e instanceof ImageBitmap)f.texSubImage2D(f.TEXTURE_2D,0,m,_,f.RGBA,f.UNSIGNED_BYTE,e);else{let y=this.format,v=f.UNSIGNED_BYTE;this.format===f.R32F&&(y=f.RED,v=f.FLOAT),f.texSubImage2D(f.TEXTURE_2D,0,m,_,s,l,y,v,e.data)}}else if(this.size=[s,l],e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||ImageBitmap&&e instanceof ImageBitmap){let m=this.format;this.format===f.R8&&(m=f.RED),f.texImage2D(f.TEXTURE_2D,0,this.format,m,f.UNSIGNED_BYTE,e)}else{let m=this.format,_=this.format,y=f.UNSIGNED_BYTE;this.format===f.DEPTH_COMPONENT&&(m=f.DEPTH_COMPONENT16,y=f.UNSIGNED_SHORT),this.format===f.R8&&(_=f.RED),this.format===f.R32F&&(y=f.FLOAT,_=f.RED),f.texImage2D(f.TEXTURE_2D,0,m,s,l,0,_,y,e.data)}this.useMipmap=!!(i&&i.useMipmap),this.useMipmap&&f.generateMipmap(f.TEXTURE_2D)}bind(e,i,n=!1){const{context:s}=this,{gl:l}=s;l.bindTexture(l.TEXTURE_2D,this.texture),e!==this.minFilter&&(l.texParameteri(l.TEXTURE_2D,l.TEXTURE_MAG_FILTER,e),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_MIN_FILTER,this.useMipmap&&!n?e===l.NEAREST?l.NEAREST_MIPMAP_NEAREST:l.LINEAR_MIPMAP_LINEAR:e),this.minFilter=e),i!==this.wrapS&&(l.texParameteri(l.TEXTURE_2D,l.TEXTURE_WRAP_S,i),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_WRAP_T,i),this.wrapS=i)}bindExtraParam(e,i,n,s){const{context:l}=this,{gl:h}=l;h.bindTexture(h.TEXTURE_2D,this.texture),i!==this.magFilter&&(h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MAG_FILTER,i),this.magFilter=i),e!==this.minFilter&&(h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MIN_FILTER,this.useMipmap?e===h.NEAREST?h.NEAREST_MIPMAP_NEAREST:h.LINEAR_MIPMAP_LINEAR:e),this.minFilter=e),n!==this.wrapS&&(h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_S,n),this.wrapS=n),s!==this.wrapT&&(h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_T,s),this.wrapT=s)}destroy(){const{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}}class zd{constructor(e,i){this.context=e,this.texture=i}bind(e,i){const{context:n}=this,{gl:s}=n;s.bindTexture(s.TEXTURE_2D,this.texture),e!==this.minFilter&&(s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,e),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,e),this.minFilter=e),i!==this.wrapS&&(s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,i),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,i),this.wrapS=i)}}function Dd(t,e,i,n,s,l,h,f){const m=[t,e,1,i,n,1,s,l,1],_=[h,f,1],y=a.co.adjoint([],m),[v,w,E]=a.N.transformMat3(_,_,y);return a.co.multiply(m,m,[v,0,0,0,w,0,0,0,E])}function Zg(t,e,i,n,s,l,h,f){const m=function(_,y,v,w,E,A,I,z){const L=Dd(0,0,1,0,1,1,0,1),N=Dd(_,y,v,w,E,A,I,z),G=a.co.adjoint([],L);return a.co.multiply(N,N,G)}(t,e,i,n,s,l,h,f);return[m[2]/m[8]/qe,m[5]/m[8]/qe]}function Ld(t){return[t[0],Math.min(Math.max(t[1],-Ot),Ot)]}class qg extends rs{constructor(e,i,n,s){super(),this.id=e,this.dispatcher=n,this.coordinates=i.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.onNorthPole=!1,this.onSouthPole=!1,this.setEventedParent(s),this.options=i,this._dirty=!1}load(e,i){if(this._loaded=i||!1,this.fire(new Io("dataloading",{dataType:"source"})),this.url=this.options.url,!this.url)return e&&(this.coordinates=e),this._loaded=!0,void this._finishLoading();this._imageRequest=Ze(this.map._requestManager.transformRequest(this.url,Er.Image),(n,s)=>{this._imageRequest=null,this._loaded=!0,n?this.fire(new Yl(n)):s&&(this.image=s instanceof HTMLImageElement?ze.getImageData(s):s,this._dirty=!0,this.width=this.image.width,this.height=this.image.height,e&&(this.coordinates=e),this._finishLoading())})}loaded(){return this._loaded}updateImage(e){return e.url?(this._imageRequest&&e.url!==this.options.url&&(this._imageRequest.cancel(),this._imageRequest=null),this.options.url=e.url,this.load(e.coordinates,this._loaded),this):this}setTexture(e){if(!(e.handle instanceof WebGLTexture))throw new Error("The provided handle is not a WebGLTexture instance");return this.texture=new zd(this.map.painter.context,e.handle),this.width=e.dimensions[0],this.height=e.dimensions[1],this._dirty=!1,this._loaded=!0,this._finishLoading(),this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new Io("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(e){this.map=e,this.load()}onRemove(){this._imageRequest&&(this._imageRequest.cancel(),this._imageRequest=null),!this.texture||this.texture instanceof zd||this.texture.destroy(),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy())}setCoordinates(e){if(this.coordinates=e,this._boundsArray=void 0,this._unsupportedCoords=!1,!e.length)return this;this.onNorthPole=!1,this.onSouthPole=!1;let i=e[0][1],n=e[0][1];for(const l of e)l[1]>n&&(n=l[1]),l[1]<i&&(i=l[1]);const s=(n+i)/2;if(s>Ot?this.onNorthPole=!0:s<-Ot&&(this.onSouthPole=!0),!this.onNorthPole&&!this.onSouthPole){const l=e.map(Yt.fromLngLat);this.tileID=function(h){let f=1/0,m=1/0,_=-1/0,y=-1/0;for(const I of h)f=Math.min(f,I.x),m=Math.min(m,I.y),_=Math.max(_,I.x),y=Math.max(y,I.y);const v=Math.max(_-f,y-m),w=Math.max(0,Math.floor(-Math.log(v)/Math.LN2)),E=Math.pow(2,w);let A=Math.floor((f+_)/2*E);return A>1&&(A-=1),new Ie(w,A,Math.floor((m+y)/2*E))}(l),this.minzoom=this.maxzoom=this.tileID.z}return this.fire(new Io("data",{dataType:"source",sourceDataType:"content"})),this}_clear(){this._boundsArray=void 0,this._unsupportedCoords=!1}_prepareData(e){for(const L in this.tiles){const N=this.tiles[L];N.state!=="loaded"&&(N.state="loaded",N.texture=this.texture)}if(this._boundsArray||this.onNorthPole||this.onSouthPole||this._unsupportedCoords)return;const i=Ou(new Ie(0,0,0),this.map.transform.projection),n=[i.projection.project(this.coordinates[0][0],this.coordinates[0][1]),i.projection.project(this.coordinates[1][0],this.coordinates[1][1]),i.projection.project(this.coordinates[2][0],this.coordinates[2][1]),i.projection.project(this.coordinates[3][0],this.coordinates[3][1])];if(!function(L){const N=L[1].x-L[0].x,G=L[1].y-L[0].y,j=L[2].x-L[1].x,
vendor: 5,235 bytes, line 7
7X=L[2].y-L[1].y,W=L[3].x-L[2].x,J=L[3].y-L[2].y,ie=L[0].x-L[3].x,oe=L[0].y-L[3].y,ue=N*X-j*G,se=j*J-W*X,_e=W*oe-ie*J,Me=ie*G-N*oe;return ue>0&&se>0&&_e>0&&Me>0||ue<0&&se<0&&_e<0&&Me<0}(n))return console.warn("Image source coordinates are defining non-convex area in the Mercator projection"),void(this._unsupportedCoords=!0);const s=Ou(this.tileID,this.map.transform.projection),[l,h,f,m]=this.coordinates.map(L=>{const N=s.projection.project(L[0],L[1]);return Bg(s,N)._round()});this.perspectiveTransform=Zg(l.x,l.y,h.x,h.y,f.x,f.y,m.x,m.y);const _=this._boundsArray=new Rn;_.emplaceBack(l.x,l.y,0,0),_.emplaceBack(h.x,h.y,qe,0),_.emplaceBack(m.x,m.y,0,qe),_.emplaceBack(f.x,f.y,qe,qe),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy()),this.boundsBuffer=e.createVertexBuffer(_,dp.members),this.boundsSegments=Oi.simpleSegment(0,0,4,2);const y=[],v=[Ld((w=this.coordinates)[0]),Ld(w[1]),Ld(w[2]),Ld(w[3])];var w;const[E,A,I,z]=function(L){let N=L[0][0],G=N,j=L[0][1],X=j;for(let W=1;W<L.length;W++)L[W][0]<N?N=L[W][0]:L[W][0]>G&&(G=L[W][0]),L[W][1]<j?j=L[W][1]:L[W][1]>X&&(X=L[W][1]);return[N,j,G-N,X-j]}(v);{const L=new Rn,[N,G,j,X]=function(be){let Fe=be[0].x,Se=Fe,Qe=be[0].y,He=Qe;for(let Ce=1;Ce<be.length;Ce++)be[Ce].x<Fe?Fe=be[Ce].x:be[Ce].x>Se&&(Se=be[Ce].x),be[Ce].y<Qe?Qe=be[Ce].y:be[Ce].y>He&&(He=be[Ce].y);return[Fe,Qe,Se-Fe,He-Qe]}(n),W=be=>[(be.x-N)/j,(be.y-G)/X],[J,ie,oe,ue]=n.map(W),se=function(be,Fe,Se,Qe,He,Ce,pt,st){const Je=Dd(0,0,1,0,1,1,0,1),Pe=Dd(be,Fe,Se,Qe,He,Ce,pt,st),ht=a.co.adjoint([],Pe);return a.co.multiply(Je,Je,ht)}(J[0],J[1],ie[0],ie[1],oe[0],oe[1],ue[0],ue[1]);this.elevatedGlobePerspectiveTransform=Zg(J[0],J[1],ie[0],ie[1],oe[0],oe[1],ue[0],ue[1]);const _e=(be,Fe)=>{y.push(be.lng);const Se=Math.round((be.lng-E)/I*qe),Qe=Math.round((be.lat-A)/z*qe),He=W(Fe),Ce=a.N.transformMat3([],[He[0],He[1],1],se),pt=Math.round(Ce[0]/Ce[2]*qe),st=Math.round(Ce[1]/Ce[2]*qe);L.emplaceBack(Se,Qe,pt,st)},Me=n[3].x-n[0].x,pe=n[3].y-n[0].y,we=n[2].x-n[1].x,de=n[2].y-n[1].y;for(let be=0;be<65;be++){const Fe=be/64,Se=[n[0].x+Fe*Me,n[0].y+Fe*pe],Qe=[n[1].x+Fe*we,n[1].y+Fe*de],He=Qe[0]-Se[0],Ce=Qe[1]-Se[1];for(let pt=0;pt<65;pt++){const st=pt/64,Je={x:Se[0]+He*st,y:Se[1]+Ce*st,z:0};_e(i.projection.unproject(Je.x,Je.y),Je)}}this.elevatedGlobeVertexBuffer=e.createVertexBuffer(L,dp.members)}{this.maxLongitudeTriangleSize=0;let L=[],N=new Ji;const G=(j,X,W)=>{N.emplaceBack(j,X,W);const J=y[j],ie=y[X],oe=y[W],ue=Math.min(Math.min(J,ie),oe),se=Math.max(Math.max(J,ie),oe)-ue;se>this.maxLongitudeTriangleSize&&(this.maxLongitudeTriangleSize=se),L.push(ue+se/2)};for(let j=0;j<64;j++)for(let X=0;X<64;X++){const W=65*j+X,J=W+1,ie=W+65,oe=ie+1;G(W,ie,J),G(J,ie,oe)}[L,N]=function(j,X){const W=Array.from({length:j.length},(oe,ue)=>ue);W.sort((oe,ue)=>j[oe]-j[ue]);const J=[],ie=new Ji;for(let oe=0;oe<W.length;oe++){const ue=W[oe];J.push(j[ue]);const se=3*ue,_e=se+1;ie.emplaceBack(X.uint16[se],X.uint16[_e],X.uint16[_e+1])}return[J,ie]}(L,N),this.elevatedGlobeTrianglesCenterLongitudes=L,this.elevatedGlobeIndexBuffer=e.createIndexBuffer(N)}this.elevatedGlobeSegments=Oi.simpleSegment(0,0,4225,8192),this.elevatedGlobeGridMatrix=new Float32Array([0,I/qe,0,z/qe,0,0,A,E,0])}prepare(){const e=Object.keys(this.tiles).length!==0;if(this.tileID&&!e)return;const i=this.map.painter.context,n=i.gl;!this._dirty||this.texture instanceof zd||(this.texture?this.texture.update(this.image):(this.texture=new fp(i,this.image,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE)),this._dirty=!1),e&&this._prepareData(i)}loadTile(e,i){this.tileID&&this.tileID.equals(e.tileID.canonical)?(this.tiles[String(e.tileID.wrap)]=e,e.buckets={},i(null)):(e.state="errored",i(null))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}getSegmentsForLongitude(e){const i=this.elevatedGlobeSegments;if(!this.elevatedGlobeTrianglesCenterLongitudes||!i)return null;const n=this.elevatedGlobeTrianglesCenterLongitudes;let s=((y,v)=>y+360*Math.round((v-y)/360))(e+180,n[0]);const l=new Oi,h=(y,v)=>{l.segments.push({vertexOffset:0,primitiveOffset:y,vertexLength:i.segments[0].vertexLength,primitiveLength:v,sortKey:void 0,vaos:{}})},f=.51*this.maxLongitudeTriangleSize;if(Math.abs(n[0]-s)<=f){const y=ye(n,0,n.length,s+f);return y===n.length||h(y,te(n,y+1,n.length,s+360-f)-y),l}s<n[0]&&(s+=360);const m=te(n,0,n.length,s-f);if(m===n.length)return h(0,n.length),l;h(0,m-0);const _=ye(n,m+1,n.length,s+f);return _!==n.length&&h(_,n.length-_),l}}const Tv=(Math.pow(256,2)-1)/16907520;class $g extends Cr{constructor(e,i,n){super(e,wv,i,n),this.updateColorRamp(),this._curRampRange=[NaN,NaN]}getProgramIds(){return["raster"]}hasColorMap(){return!!this._transitionablePaint._values["raster-color"].value.value}tileCoverLift(){return this.paint.get("raster-elevation")}isLayerDraped(e){return!(e&&e._source instanceof qg&&(e._source.onNorthPole||e._source.onSouthPole))&&this.paint.get("raster-elevation")===0}_handleSpecialPaintPropertyUpdate(e){e!=="raster-color"&&e!=="raster-color-range"||(this._curRampRange=[NaN,NaN],this.updateColorRamp())}
7updateColorRamp(e){if(!this.hasColorMap()||!this._curRampRange)return;const i=this._transitionablePaint._values["raster-color"].value.expression,[n,s]=e||this._transitionablePaint._values["raster-color-range"].value.expression.evaluate({zoom:0})||[NaN,NaN];isNaN(n)&&isNaN(s)||n===this._curRampRange[0]&&s===this._curRampRange[1]||(this.colorRamp=Eu({expression:i,evaluationKey:"rasterValue",image:this.colorRamp,clips:[{start:n,end:s}],resolution:256}),this.colorRampTexture=null,this._curRampRange=[n,s])}}const Mv=new Ci({visibility:new Oe(le["layout_raster-particle"].visibility)});var Ev={paint:new Ci({"raster-particle-array-band":new Oe(le["paint_raster-particle"]["raster-particle-array-band"]),"raster-particle-count":new Oe(le["paint_raster-particle"]["raster-particle-count"]),"raster-particle-color":new Uo(le["paint_raster-particle"]["raster-particle-color"]),"raster-particle-max-speed":new Oe(le["paint_raster-particle"]["raster-particle-max-speed"]),"raster-particle-speed-factor":new Oe(le["paint_raster-particle"]["raster-particle-speed-factor"]),"raster-particle-fade-opacity-factor":new Oe(le["paint_raster-particle"]["raster-particle-fade-opacity-factor"]),"raster-particle-reset-rate-factor":new Oe(le["paint_raster-particle"]["raster-particle-reset-rate-factor"])}),layout:Mv};class Wg extends Cr{constructor(e,i,n){super(e,Ev,i,n),this._updateColorRamp(),this.onRemove=s=>{this.colorRampTexture&&this.colorRampTexture.destroy(),this.transformFeedbackObject&&s.painter.context.gl.deleteTransformFeedback(this.transformFeedbackObject),this.tileFramebuffer&&this.tileFramebuffer.destroy()},this.lastInvalidatedAt=ze.now()}hasColorMap(){return!!this._transitionablePaint._values["raster-particle-color"].value.value}getProgramIds(){return["rasterParticle"]}hasOffscreenPass(){return this.visibility!=="none"}isLayerDraped(e){return!1}_handleSpecialPaintPropertyUpdate(e){e!=="raster-particle-color"&&e!=="raster-particle-max-speed"||(this._updateColorRamp(),this._invalidateAnimationState()),e==="raster-particle-count"&&this._invalidateAnimationState()}_updateColorRamp(){if(!this.hasColorMap())return;const e=this._transitionablePaint._values["raster-particle-color"].value.expression,i=this._transitionablePaint._values["raster-particle-max-speed"].value.expression.evaluate({zoom:0});this.colorRamp=Eu({expression:e,evaluationKey:"rasterParticleSpeed",image:this.colorRamp,clips:[{start:0,end:i}],resolution:256}),this.colorRampTexture=null}_invalidateAnimationState(){this.lastInvalidatedAt=ze.now()}}class Sv extends Cr{constructor(e,i){super(e,{},i),this.implementation=e,e.slot&&(this.slot=e.slot)}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}isLayerDraped(e){return this.implementation.renderToTile!==void 0}shouldRedrape(){return!!this.implementation.shouldRerenderTiles&&this.implementation.shouldRerenderTiles()}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){}onAdd(e){this.implementation.onAdd&&this.implementation.onAdd(e,e.painter.context.gl)}onRemove(e){this.implementation.onRemove&&this.implementation.onRemove(e,e.painter.context.gl)}}const Av=new Ci({visibility:new Oe(le.layout_sky.visibility)});var Iv={paint:new Ci({"sky-type":new Oe(le.paint_sky["sky-type"]),"sky-atmosphere-sun":new Oe(le.paint_sky["sky-atmosphere-sun"]),"sky-atmosphere-sun-intensity":new Oe(le.paint_sky["sky-atmosphere-sun-intensity"]),"sky-gradient-center":new Oe(le.paint_sky["sky-gradient-center"]),"sky-gradient-radius":new Oe(le.paint_sky["sky-gradient-radius"]),"sky-gradient":new Uo(le.paint_sky["sky-gradient"]),"sky-atmosphere-halo-color":new Oe(le.paint_sky["sky-atmosphere-halo-color"]),"sky-atmosphere-color":new Oe(le.paint_sky["sky-atmosphere-color"]),"sky-opacity":new Oe(le.paint_sky["sky-opacity"])}),layout:Av};function pp(t,e,i){const n=[0,0,1],s=a.bi.identity([]);return a.bi.rotateY(s,s,i?-qt(t)+Math.PI:qt(t)),a.bi.rotateX(s,s,-qt(e)),a.N.transformQuat(n,n,s),a.N.normalize(n,n)}var Cv={paint:new Ci({})};function Hg(t,e){const i=Rd(t.projection,t.zoom,t.width,t.height),n=function(l,h,f,m,_){const y=new ne(f.lng-180*Os,f.lat),v=new ne(f.lng+180*Os,f.lat),w=l.project(y.lng,y.lat),E=l.project(v.lng,v.lat),A=-Math.atan2(E.y-w.y,E.x-w.x),I=Yt.fromLngLat(f);I.y=Dt(I.y,-1+Os,1-Os);const z=I.toLngLat(),L=l.project(z.lng,z.lat),N=Yt.fromLngLat(z);N.x+=Os;const G=N.toLngLat(),j=l.project(G.lng,G.lat),X=Kg(j.x-L.x,j.y-L.y,A),W=Yt.fromLngLat(z);W.y+=Os;const J=W.toLngLat(),ie=l.project(J.lng,J.lat),oe=Kg(ie.x-L.x,ie.y-L.y,A),ue=Math.abs(X.x)/Math.abs(oe.y),se=a.a6.identity([]);a.a6.rotateZ(se,se,-A*(1-(_?0:m)));const _e=a.a6.identity([]);return a.a6.scale(_e,_e,[1,1-(1-ue)*m,1]),_e[4]=-oe.x/oe.y*m,a.a6.rotateZ(_e,_e,A),a.a6.multiply(_e,se,_e),_e}
7(t.projection,0,t.center,i,e),s=Xg(t);return a.a6.scale(n,n,[s,s,1]),n}function Xg(t){const e=t.projection,i=Rd(t.projection,t.zoom,t.width,t.height),n=Yg(e,t.center),s=Yg(e,ne.convert(e.center));return Math.pow(2,n*i+(1-i)*s)}function Rd(t,e,i,n,s=1/0){const l=t.range;if(!l)return 0;const h=Math.min(s,Math.max(i,n)),f=Math.log(h/1024)/Math.LN2;return Jo(l[0]+f,l[1]+f,e)}const Os=1/4e4;function Yg(t,e){const i=Dt(e.lat,-Ot,Ot),n=new ne(e.lng-180*Os,i),s=new ne(e.lng+180*Os,i),l=t.project(n.lng,i),h=t.project(s.lng,i),f=Yt.fromLngLat(n),m=Yt.fromLngLat(s),_=h.x-l.x,y=h.y-l.y,v=m.x-f.x,w=m.y-f.y,E=Math.sqrt((v*v+w*w)/(_*_+y*y));return Math.log(E)/Math.LN2}function Kg(t,e,i){const n=Math.cos(i),s=Math.sin(i);return{x:t*n-e*s,y:t*s+e*n}}function Jg(t,e,i){a.a6.identity(t),a.a6.rotateZ(t,t,qt(e[2])),a.a6.rotateX(t,t,qt(e[0])),a.a6.rotateY(t,t,qt(e[1])),a.a6.scale(t,t,i),a.a6.multiply(t,t,[1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,1])}function kd(t,e,i,n,s,l,h,f){const m=[i[0]-e[0],i[1]-e[1],0],_=[n[0]-e[0],n[1]-e[1],0];if(a.N.length(m)<1e-12||a.N.length(_)<1e-12)return a.bi.identity(t);const y=a.N.cross([],m,_);a.N.normalize(y,y),a.N.subtract(_,n,e),m[2]=(l-s)*f,_[2]=(h-s)*f;const v=m;return a.N.cross(v,m,_),a.N.normalize(v,v),a.bi.rotationTo(t,y,v)}function mp(t,e,i=!1){const n=Cs(e.zoom),s=function(l,h,f){const m=h.worldSize,_=[l[12],l[13],l[14]],y=Zt(_[1]/m),v=vt(_[0]/m),w=a.a6.identity([]),E=bt(1,y)*m,A=bt(1,0)*m*Bt(y,h.zoom),I=1/Nf(m);let z=A*I;if(f){const j=Rd(h.projection,h.zoom,h.width,h.height,1024);z=I*h.projection.pixelSpaceConversion(h.center.lat,m,j)}const L=me(y,v);a.N.add(L,L,a.N.scale([],a.N.normalize([],L),E*z*_[2]));const N=function(j){const X=[j[0],j[1],j[2]];let W=[0,1,0];const J=a.N.cross([],W,X);return a.N.cross(W,X,J),a.N.squaredLength(W)===0&&(W=[0,1,0],a.N.cross(J,X,W)),a.N.normalize(J,J),a.N.normalize(W,W),a.N.normalize(X,X),[J[0],J[1],J[2],0,W[0],W[1],W[2],0,X[0],X[1],X[2],0,j[0],j[1],j[2],1]}(L);a.a6.scale(w,w,[z,z,z*E]),a.a6.translate(w,w,[-_[0],-_[1],-_[2]]);const G=a.a6.multiply([],h.globeMatrix,N);return a.a6.multiply(G,G,w),a.a6.multiply(G,G,l),G}(t,e,i);if(n>0){const l=function(h,f){const m=f.worldSize,_=bt(1,0)*m*Bt(f.center.lat,f.zoom)/Nf(m),y=bt(1,f.center.lat)*m,v=a.a6.identity([]);return a.a6.rotateY(v,v,qt(f.center.lng)),a.a6.rotateX(v,v,qt(f.center.lat)),a.a6.translate(v,v,[0,0,V]),a.a6.scale(v,v,[_,_,_*y]),a.a6.translate(v,v,[f.point.x-.5*m,f.point.y-.5*m,0]),a.a6.multiply(v,v,h),a.a6.multiply(v,f.globeMatrix,v)}(t,e);return function(h,f,m){const _=(A,I,z)=>{const L=a.N.length(A),N=a.N.length(I),G=Ho(A,I,z);return a.N.scale(G,G,1/a.N.length(G)*Ut(L,N,z))},y=_([h[0],h[1],h[2]],[f[0],f[1],f[2]],m),v=_([h[4],h[5],h[6]],[f[4],f[5],f[6]],m),w=_([h[8],h[9],h[10]],[f[8],f[9],f[10]],m),E=Ho([h[12],h[13],h[14]],[f[12],f[13],f[14]],m);return[y[0],y[1],y[2],0,v[0],v[1],v[2],0,w[0],w[1],w[2],0,E[0],E[1],E[2],1]}(s,l,n)}return s}function Qg(t,e,i,n){const s=Ri.projectAabbCorners(n,i);let l=Number.MAX_VALUE,h=-1;for(let _=0;_<s.length;++_){const y=s[_];y[0]=(.5*y[0]+.5)*e.width,y[1]=(.5-.5*y[1])*e.height,y[2]<l&&(h=_,l=y[2])}const f=_=>new Ue(s[_][0],s[_][1]);let m;switch(h){case 0:case 6:m=[f(1),f(5),f(4),f(7),f(3),f(2),f(1)];break;case 1:case 7:m=[f(0),f(4),f(5),f(6),f(2),f(3),f(0)];break;case 3:case 5:m=[f(1),f(0),f(4),f(7),f(6),f(2),f(1)];break;default:m=[f(1),f(5),f(6),f(7),f(3),f(0),f(1)]}if(wn(t,m))return l}const Pv=li([{name:"a_pos_3f",components:3,type:"Float32"}]),zv=li([{name:"a_color_3f",components:3,type:"Float32"}]),Dv=li([{name:"a_color_4f",components:4,type:"Float32"}]),Lv=li([{name:"a_uv_2f",components:2,type:"Float32"}]),Rv=li([{name:"a_normal_3f",components:3,type:"Float32"}]),kv=li([{name:"a_normal_matrix0",components:4,type:"Float32"},{name:"a_normal_matrix1",components:4,type:"Float32"},{name:"a_normal_matrix2",components:4,type:"Float32"},{name:"a_normal_matrix3",components:4,type:"Float32"}]),Ov=li([{name:"a_pbr",components:4,type:"Uint16"},{name:"a_heightBasedEmissiveStrength",components:3,type:"Float32"}]);class ey{constructor(e,i){this.feature=e,this.instancedDataOffset=i,this.instancedDataCount=0,this.rotation=[0,0,0],this.scale=[1,1,1],this.translation=[0,0,0]}}class ty{constructor(){this.instancedDataArray=new _u,this.instancesEvaluatedElevation=[],this.features=[],this.idToFeaturesIndex={}}}class _p{constructor(e){this.zoom=e.zoom,this.canonical=e.canonical,this.layers=e.layers,this.layerIds=this.layers.map(i=>i.fqid),this.projection=e.projection,this.index=e.index,this.hasZoomDependentProperties=this.layers[0].isZoomDependent(),this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.hasPattern=!1,this.instancesPerModel={},this.validForExaggeration=0,this.maxVerticalOffset=0,this.maxScale=0,this.maxHeight=0,this.lookupDim=this.zoom>this.canonical.z?256:this.zoom>15?75:100,this.instanceCount=0,this.terrainElevationMin=0,this.terrainElevationMax=0,this.validForDEMTile={id:null,timestamp:0}}
7populate(e,i,n,s){this.tileToMeter=Ft(n);const l=this.layers[0]._featureFilter.needGeometry;this.lookup=new Uint8Array(this.lookupDim*this.lookupDim);for(const{feature:h,id:f,index:m,sourceLayerIndex:_}of e){const y=Hi(h,l);if(!this.layers[0]._featureFilter.filter(new Ii(this.zoom),y,n))continue;const v={id:f,sourceLayerIndex:_,index:m,geometry:l?y.geometry:er(h,n,s),properties:h.properties,type:h.type,patterns:{}},w=this.addFeature(v,v.geometry,y);w&&i.featureIndex.insert(h,v.geometry,m,_,this.index,this.instancesPerModel[w].instancedDataArray.length,qe/32)}this.lookup=null}update(e,i,n,s){for(const l in this.instancesPerModel){const h=this.instancesPerModel[l];for(const f in e)h.idToFeaturesIndex.hasOwnProperty(f)&&this.evaluate(h.features[h.idToFeaturesIndex[f]],e[f],h,!0)}this.maxHeight=0}updateZoomBasedPaintProperties(){if(!this.hasZoomDependentProperties)return!1;let e=!1;for(const i in this.instancesPerModel){const n=this.instancesPerModel[i];for(const s of n.features){const l=this.layers[0],h=s.feature,f=this.canonical,m=l.paint.get("model-rotation").evaluate(h,{},f),_=l.paint.get("model-scale").evaluate(h,{},f),y=l.paint.get("model-translation").evaluate(h,{},f);a.N.exactEquals(s.rotation,m)&&a.N.exactEquals(s.scale,_)&&a.N.exactEquals(s.translation,y)||(this.evaluate(s,s.featureStates,n,!0),e=!0)}}return e}isEmpty(){for(const e in this.instancesPerModel)if(this.instancesPerModel[e].instancedDataArray.length!==0)return!1;return!0}uploadPending(){return!this.uploaded}upload(e){if(!this.uploaded)for(const i in this.instancesPerModel){const n=this.instancesPerModel[i];n.instancedDataArray.length<0||n.instancedDataArray.length===0||(n.instancedDataBuffer?n.instancedDataBuffer.updateData(n.instancedDataArray):n.instancedDataBuffer=e.createVertexBuffer(n.instancedDataArray,kv.members,!0,void 0,this.instanceCount))}this.uploaded=!0}destroy(){for(const e in this.instancesPerModel){const i=this.instancesPerModel[e];i.instancedDataArray.length!==0&&i.instancedDataBuffer&&i.instancedDataBuffer.destroy()}}addFeature(e,i,n){const s=this.layers[0],l=s.layout.get("model-id").evaluate(n,{},this.canonical);if(!l)return ki(`modelId is not evaluated for layer ${s.id} and it is not going to get rendered.`),l;this.instancesPerModel[l]||(this.instancesPerModel[l]=new ty);const h=this.instancesPerModel[l],f=h.instancedDataArray,m=new ey(n,f.length);for(const _ of i)for(const y of _){if(y.x<0||y.x>=qe||y.y<0||y.y>=qe)continue;const v=(this.lookupDim-1)/qe,w=this.lookupDim*(y.y*v|0)+y.x*v|0;if(this.lookup){if(this.lookup[w]!==0)continue;this.lookup[w]=1}this.instanceCount++;const E=f.length;f.resize(E+1),h.instancesEvaluatedElevation.push(0),f.float32[16*E]=y.x,f.float32[16*E+1]=y.y}return m.instancedDataCount=h.instancedDataArray.length-m.instancedDataOffset,m.instancedDataCount>0&&(e.id&&(h.idToFeaturesIndex[e.id]=h.features.length),h.features.push(m),this.evaluate(m,{},h,!1)),l}evaluate(e,i,n,s){const l=this.layers[0],h=e.feature,f=this.canonical,m=e.rotation=l.paint.get("model-rotation").evaluate(h,i,f),_=e.scale=l.paint.get("model-scale").evaluate(h,i,f),y=e.translation=l.paint.get("model-translation").evaluate(h,i,f),v=l.paint.get("model-color").evaluate(h,i,f);v.a=l.paint.get("model-color-mix-intensity").evaluate(h,i,f);const w=[];this.maxVerticalOffset<y[2]&&(this.maxVerticalOffset=y[2]),this.maxScale=Math.max(Math.max(this.maxScale,_[0]),Math.max(_[1],_[2])),Jg(w,m,_);const E=Math.round(100*v.a)+v.b/1.05;for(let A=0;A<e.instancedDataCount;++A){const I=e.instancedDataOffset+A,z=16*I,L=n.instancedDataArray.float32;let N=0;s&&(N=L[z+6]-n.instancesEvaluatedElevation[I]);const G=0|L[z+1];L[z]=(0|L[z])+v.r/1.05,L[z+1]=G+v.g/1.05,L[z+2]=E,L[z+3]=1/(f.z>10?this.tileToMeter:Ft(f,G)),L[z+4]=y[0],L[z+5]=y[1],L[z+6]=y[2]+N,L[z+7]=w[0],L[z+8]=w[1],L[z+9]=w[2],L[z+10]=w[4],L[z+11]=w[5],L[z+12]=w[6],L[z+13]=w[8],L[z+14]=w[9],L[z+15]=w[10],n.instancesEvaluatedElevation[I]=y[2]}}}Ke(_p,"ModelBucket",{omit:["layers"]}),Ke(ty,"PerModelAttributes"),Ke(ey,"ModelFeature");const Bv=new Ci({visibility:new Oe(le.layout_model.visibility),"model-id":new ut(le.layout_model["model-id"])});var Fv={paint:new Ci({"model-opacity":new Oe(le.paint_model["model-opacity"]),"model-rotation":new ut(le.paint_model["model-rotation"]),"model-scale":new ut(le.paint_model["model-scale"]),"model-translation":new ut(le.paint_model["model-translation"]),"model-color":new ut(le.paint_model["model-color"]),"model-color-mix-intensity":new ut(le.paint_model["model-color-mix-intensity"]),"model-type":new Oe(le.paint_model["model-type"]),"model-cast-shadows":new Oe(le.paint_model["model-cast-shadows"]),"model-receive-shadows":new Oe(le.paint_model["model-receive-shadows"]),"model-ambient-occlusion-intensity":new Oe(le.paint_model["model-ambient-occlusion-intensity"]),"model-emissive-strength":new ut(le.paint_model["model-emissive-strength"]),"model-roughness":new ut(le.paint_model["model-roughness"]),"model-height-based-emissive-strength-multiplier":new ut(le.paint_model["model-height-based-emissive-strength-multiplier"]),"model-cutoff-fade-range":new Oe(le.paint_model["model-cutoff-fade-range"])}),layout:Bv};const Oa=64,Vl={CoordinateSpaceTile:1,CoordinateSpaceYUp:2,HasMapbox
7MeshFeatures:4,HasMeshoptCompression:8};function iy(t,e,i,n,s,l,h,f,m,_=!1){const y=i.zoom,v=i.project(n),w=Bt(n.lat,y),E=1/w;a.a6.identity(t),a.a6.translate(t,t,[v.x+h[0]*E,v.y+h[1]*E,h[2]]);let A=1,I=1;const z=i.worldSize;if(_){if(i.projection.name==="mercator"){let j=0;i.elevation&&(j=i.elevation.getAtPointOrZero(new Yt(v.x/z,v.y/z),0));const X=a.a7.transformMat4([],[v.x,v.y,j,1],i.projMatrix)[3]/i.cameraToCenterDistance;A=X,I=X*Bt(i.center.lat,y)}else if(i.projection.name==="globe"){const j=mp(t,i),X=a.a6.multiply([],i.projMatrix,j),W=[0,0,0,1];a.a7.transformMat4(W,W,X);const J=W[3]/i.cameraToCenterDistance,ie=Cs(y),oe=i.projection.pixelsPerMeter(n.lat,z)*Bt(n.lat,y),ue=i.projection.pixelsPerMeter(i.center.lat,z)*Bt(i.center.lat,y);A=J/Ut(oe,Pi(i.center.lat),ie),I=J*w/oe,A*=ue,I*=ue}}else A=E;a.a6.scale(t,t,[A,A,I]);const L=[...t],N=e.orientation,G=[];if(Jg(G,[N[0]+s[0],N[1]+s[1],N[2]+s[2]],l),a.a6.multiply(t,L,G),f&&i.elevation){let j=0;const X=[];if(m&&i.elevation){j=function(ie,oe,ue,se,_e){const Me=oe.elevation;if(!Me)return 0;const pe=Ri.projectAabbCorners(ue,se),we=bt(1,_e.lat)*oe.worldSize,de=function(ht,It){const mt=[0,0,1],Ct=[{corners:[0,1,3,2],dotProductWithUp:0},{corners:[1,5,2,6],dotProductWithUp:0},{corners:[0,4,1,5],dotProductWithUp:0},{corners:[2,6,3,7],dotProductWithUp:0},{corners:[4,7,5,6],dotProductWithUp:0},{corners:[0,3,4,7],dotProductWithUp:0}];for(const xt of Ct){const jt=ht[xt.corners[0]],wt=ht[xt.corners[1]],mi=ht[xt.corners[2]],Jt=[wt[0]-jt[0],wt[1]-jt[1],It*(wt[2]-jt[2])],ei=a.N.cross(Jt,Jt,[mi[0]-jt[0],mi[1]-jt[1],It*(mi[2]-jt[2])]);a.N.normalize(ei,ei),xt.dotProductWithUp=a.N.dot(ei,mt)}return Ct.sort((xt,jt)=>xt.dotProductWithUp-jt.dotProductWithUp),Ct[0].corners}(pe,we),be=pe[de[0]],Fe=pe[de[1]],Se=pe[de[2]],Qe=pe[de[3]],He=Me.getAtPointOrZero(new Yt(be[0]/oe.worldSize,be[1]/oe.worldSize),0),Ce=Me.getAtPointOrZero(new Yt(Fe[0]/oe.worldSize,Fe[1]/oe.worldSize),0),pt=Me.getAtPointOrZero(new Yt(Se[0]/oe.worldSize,Se[1]/oe.worldSize),0),st=Me.getAtPointOrZero(new Yt(Qe[0]/oe.worldSize,Qe[1]/oe.worldSize),0),Je=(He+st)/2,Pe=(Ce+pt)/2;return Je>Pe?Ce<pt?kd(ie,Fe,Qe,be,Ce,st,He,we):kd(ie,Se,be,Qe,pt,He,st,we):He<st?kd(ie,be,Fe,Se,He,Ce,pt,we):kd(ie,Qe,Se,Fe,st,pt,Ce,we),Math.max(Je,Pe)}(X,i,e.aabb,t,n);const W=a.a6.fromQuat([],X),J=a.a6.multiply([],W,G);a.a6.multiply(t,L,J)}else j=i.elevation.getAtPointOrZero(new Yt(v.x/z,v.y/z),0);j!==0&&(t[14]+=j)}}function Uu(t,e,i=!1){t.uploaded||(t.gfxTexture=new fp(e,t.image,i?e.gl.R8:e.gl.RGBA,{useMipmap:t.sampler.minFilter>=e.gl.NEAREST_MIPMAP_NEAREST}),t.uploaded=!0,t.image=null)}function Nv(t,e,i){t.indexBuffer=e.createIndexBuffer(t.indexArray,!1,!0),t.vertexBuffer=e.createVertexBuffer(t.vertexArray,Pv.members,!1,!0),t.normalArray&&(t.normalBuffer=e.createVertexBuffer(t.normalArray,Rv.members,!1,!0)),t.texcoordArray&&(t.texcoordBuffer=e.createVertexBuffer(t.texcoordArray,Lv.members,!1,!0)),t.colorArray&&(t.colorBuffer=e.createVertexBuffer(t.colorArray,(t.colorArray.bytesPerElement===12?zv:Dv).members,!1,!0)),t.featureArray&&(t.pbrBuffer=e.createVertexBuffer(t.featureArray,Ov.members,!0)),t.segments=Oi.simpleSegment(0,0,t.vertexArray.length,t.indexArray.length);const n=t.material;n.pbrMetallicRoughness.baseColorTexture&&Uu(n.pbrMetallicRoughness.baseColorTexture,e),n.pbrMetallicRoughness.metallicRoughnessTexture&&Uu(n.pbrMetallicRoughness.metallicRoughnessTexture,e),n.normalTexture&&Uu(n.normalTexture,e),n.occlusionTexture&&Uu(n.occlusionTexture,e,i),n.emissionTexture&&Uu(n.emissionTexture,e)}
7function gp(t,e,i){if(t.meshes)for(const n of t.meshes)Nv(n,e,i);if(t.children)for(const n of t.children)gp(n,e,i)}function Od(t){if(t.meshes)for(const e of t.meshes)e.indexArray.destroy(),e.vertexArray.destroy(),e.colorArray&&e.colorArray.destroy(),e.normalArray&&e.normalArray.destroy(),e.texcoordArray&&e.texcoordArray.destroy(),e.featureArray&&e.featureArray.destroy();if(t.children)for(const e of t.children)Od(e)}function yp(t){if(t.meshes)for(const i of t.meshes)i.vertexBuffer&&(i.vertexBuffer.destroy(),i.indexBuffer.destroy(),i.normalBuffer&&i.normalBuffer.destroy(),i.texcoordBuffer&&i.texcoordBuffer.destroy(),i.colorBuffer&&i.colorBuffer.destroy(),i.pbrBuffer&&i.pbrBuffer.destroy(),i.segments.destroy(),i.material&&((e=i.material).pbrMetallicRoughness.baseColorTexture&&e.pbrMetallicRoughness.baseColorTexture.gfxTexture&&e.pbrMetallicRoughness.baseColorTexture.gfxTexture.destroy(),e.pbrMetallicRoughness.metallicRoughnessTexture&&e.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture&&e.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture.destroy(),e.normalTexture&&e.normalTexture.gfxTexture&&e.normalTexture.gfxTexture.destroy(),e.emissionTexture&&e.emissionTexture.gfxTexture&&e.emissionTexture.gfxTexture.destroy(),e.occlusionTexture&&e.occlusionTexture.gfxTexture&&e.occlusionTexture.gfxTexture.destroy()));var e;if(t.children)for(const i of t.children)yp(i)}class Vv{constructor(e){this._callback=e,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._callback()},0))}remove(){this._channel=void 0,this._callback=()=>{}}}class Uv{constructor(){this.tasks={},this.taskQueue=[],Eo(["process"],this),this.invoker=new Vv(this.process),this.nextId=0}add(e,i){const n=this.nextId++,s=function({type:l,isSymbolTile:h,zoom:f}){return f=f||0,l==="message"?0:l!=="maybePrepare"||h?l!=="parseTile"||h?l==="parseTile"&&h?300-f:l==="maybePrepare"&&h?400-f:500:200-f:100-f}(i);if(s===0){yn();try{e()}finally{}return null}return this.tasks[n]={fn:e,metadata:i,priority:s,id:n},this.taskQueue.push(n),this.invoker.trigger(),{cancel:()=>{delete this.tasks[n]}}}process(){yn();try{if(this.taskQueue=this.taskQueue.filter(n=>!!this.tasks[n]),!this.taskQueue.length)return;const e=this.pick();if(e===null)return;const i=this.tasks[e];if(delete this.tasks[e],this.taskQueue.length&&this.invoker.trigger(),!i)return;i.fn()}finally{}}pick(){let e=null,i=1/0;for(let s=0;s<this.taskQueue.length;s++){const l=this.tasks[this.taskQueue[s]];l.priority<i&&(i=l.priority,e=s)}if(e===null)return null;const n=this.taskQueue[e];return this.taskQueue.splice(e,1),n}remove(){this.invoker.remove()}}class ry{constructor(e,i,n){this.target=e,this.parent=i,this.mapId=n,this.callbacks={},this.cancelCallbacks={},Eo(["receive"],this),this.target.addEventListener("message",this.receive,!1),this.scheduler=new Uv}send(e,i,n,s,l=!1,h){const f=Math.round(1e18*Math.random()).toString(36).substring(0,10);n&&(n.metadata=h,this.callbacks[f]=n);const m=new Set;return this.target.postMessage({id:f,type:e,hasCallback:!!n,targetMapId:s,mustQueue:l,sourceMapId:this.mapId,data:ao(i,m)},m),{cancel:()=>{n&&delete this.callbacks[f],this.target.postMessage({id:f,type:"<cancel>",targetMapId:s,sourceMapId:this.mapId})}}}receive(e){const i=e.data,n=i.id;if(n&&(!i.targetMapId||this.mapId===i.targetMapId))if(i.type==="<cancel>"){const s=this.cancelCallbacks[n];delete this.cancelCallbacks[n],s&&s.cancel()}else if(i.mustQueue||yn()){const s=this.callbacks[n],l=this.scheduler.add(()=>this.processTask(n,i),s&&s.metadata||{type:"message"});l&&(this.cancelCallbacks[n]=l)}else this.processTask(n,i)}processTask(e,i){if(delete this.cancelCallbacks[e],i.type==="<response>"){const n=this.callbacks[e];delete this.callbacks[e],n&&(i.error?n(No(i.error)):n(null,No(i.data)))}else{const n=new Set,s=i.hasCallback?(h,f)=>{this.target.postMessage({id:e,type:"<response>",sourceMapId:this.mapId,error:h?ao(h):null,data:ao(f,n)},n)}:h=>{},l=No(i.data);if(this.parent[i.type])this.parent[i.type](i.sourceMapId,l,s);else if(this.parent.getWorkerSource){const h=i.type.split(".");this.parent.getWorkerSource(i.sourceMapId,h[0],l.source,l.scope)[h[1]](l,s)}else s(new Error(`Could not find function ${i.type}`))}}remove(){this.scheduler.remove(),this.target.removeEventListener("message",this.receive,!1)}}class Ul{constructor(e,i){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=Qo();
7const n=this.workerPool.acquire(this.id);for(let s=0;s<n.length;s++){const l=new Ul.Actor(n[s],i,this.id);l.name=`Worker ${s}`,this.actors.push(l)}this.ready=!1,this.broadcast("checkIfReady",null,()=>{this.ready=!0})}broadcast(e,i,n){tn(this.actors,(s,l)=>{s.send(e,i,l)},n=n||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(){this.actors.forEach(e=>{e.remove()}),this.actors=[],this.workerPool.release(this.id)}}Ul.Actor=ry;var ju={workerUrl:"",workerClass:null,workerParams:void 0};function jv(){return ju.workerClass!=null?new ju.workerClass:new self.Worker(ju.workerUrl,ju.workerParams)}const xp="mapboxgl_preloaded_worker_pool";class Gu{constructor(){this.active={}}acquire(e){if(!this.workers)for(this.workers=[];this.workers.length<Gu.workerCount;)this.workers.push(new jv);return this.active[e]=!0,this.workers.slice()}release(e){delete this.active[e],this.workers&&this.numActive()===0&&(this.workers.forEach(i=>{i.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[xp]}numActive(){return Object.keys(this.active).length}}let Zu;function Bd(){return Zu||(Zu=new Gu),Zu}Gu.workerCount=2;let Fd,vp,Un,jl,bp,Gl=null;function ny(){return yn()&&self.worker&&self.worker.dracoUrl?self.worker.dracoUrl:vp||zt.DRACO_URL}function oy(){if(yn()&&self.worker&&self.worker.meshoptUrl)return self.worker.meshoptUrl;if(jl)return jl;const t=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]);if(typeof WebAssembly!="object")throw new Error("WebAssembly not supported, cannot instantiate meshoptimizer");return jl=WebAssembly.validate(t)?zt.MESHOPT_SIMD_URL:zt.MESHOPT_URL,jl}const Nd={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},Gv={5120:"DT_INT8",5121:"DT_UINT8",5122:"DT_INT16",5123:"DT_UINT16",5125:"DT_UINT32",5126:"DT_FLOAT32"},qu={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16};function sy(t,e,i){const n=i.json.bufferViews.length,s=i.buffers.length;e.bufferView=n,i.json.bufferViews[n]={buffer:s,byteLength:t.byteLength},i.buffers[s]=t}const wp="KHR_draco_mesh_compression";function Zv(t,e){const i=t.extensions&&t.extensions[wp];if(!i)return;const n=new Un.Decoder,s=uy(e,i.bufferView),l=new Un.Mesh;if(!n.DecodeArrayToMesh(s,s.byteLength,l))throw new Error("Failed to decode Draco mesh");const h=e.json.accessors[t.indices],f=Nd[h.componentType],m=h.count*f.BYTES_PER_ELEMENT,_=Un._malloc(m);f===Uint16Array?n.GetTrianglesUInt16Array(l,m,_):n.GetTrianglesUInt32Array(l,m,_),sy(Un.memory.buffer.slice(_,_+m),h,e),Un._free(_);for(const y of Object.keys(i.attributes)){const v=n.GetAttributeByUniqueId(l,i.attributes[y]),w=e.json.accessors[t.attributes[y]],E=Gv[w.componentType],A=w.count*qu[w.type]*Nd[w.componentType].BYTES_PER_ELEMENT,I=Un._malloc(A);n.GetAttributeDataArrayForAllPoints(l,v,Un[E],A,I),sy(Un.memory.buffer.slice(I,I+A),w,e),Un._free(I)}n.destroy(),l.destroy(),delete t.extensions[wp]}const Vd="EXT_meshopt_compression";function qv(t,e){if(!t.extensions||!t.extensions[Vd])return;const i=t.extensions[Vd],n=new Uint8Array(e.buffers[i.buffer],i.byteOffset||0,i.byteLength||0),s=new Uint8Array(i.count*i.byteStride);bp.decodeGltfBuffer(s,i.count,i.byteStride,n,i.mode,i.filter),t.buffer=e.buffers.length,t.byteOffset=0,e.buffers[t.buffer]=s.buffer,delete t.extensions[Vd]}const ay=1179937895,ly=new TextDecoder("utf8");function cy(t,e){return new URL(t,e).href}function $v(t,e,i,n){return fetch(cy(t.uri,n)).then(s=>s.arrayBuffer()).then(s=>{e.buffers[i]=s})}function uy(t,e){const i=t.json.bufferViews[e];return new Uint8Array(t.buffers[i.buffer],i.byteOffset||0,i.byteLength)}function Wv(t,e,i,n){if(t.uri){const s=cy(t.uri,n);return fetch(s).then(l=>l.blob()).then(l=>createImageBitmap(l)).then(l=>{e.images[i]=l})}if(t.bufferView!==void 0){const s=uy(e,t.bufferView),l=new Blob([s],{type:t.mimeType});return createImageBitmap(l).then(h=>{e.images[i]=h})}}function hy(t,e=0,i){const n={json:null,images:[],buffers:[]};if(new Uint32Array(t,e,1)[0]===ay){const y=new Uint32Array(t,e);let v=2;const w=(y[v++]>>2)-3,E=y[v++]>>2;if(v++,n.json=JSON.parse(ly.decode(y.subarray(v,v+E))),v+=E,v<w){const A=y[v++];v++;const I=e+(v<<2);n.buffers[0]=t.slice(I,I+A)}}else n.json=JSON.parse(ly.decode(new Uint8Array(t,e)));const{buffers:s,images:l,meshes:h,extensionsUsed:f,bufferViews:m}=n.json;let _=Promise.resolve();if(s){const y=[];for(let v=0;v<s.length;v++){const w=s[v];w.uri?y.push($v(w,n,v,i)):n.buffers[v]||(n.buffers[v]=null)}_=Promise.all(y)}return _.then(()=>{const y=[],v=f&&f.includes(wp),w=f&&f.includes(Vd);if(v&&y.push(function(){if(!Un)return Fd||(Fd=function(E){let A,I=null;function z(){A=new Uint8Array(I.buffer)}function L(){throw new Error("Unexpected Draco error.")}const N={a:{a:L,d:function(G,j,X){return A.copyWithin(G,j,j+X)},c:function(G){const j=A.length,X=Math.max(G>>>0,Math.ceil(1.2*j)),W=Math.ceil((X-j)/65536);try{return I.grow(W),z(),!0}catch{return!1}},b:L}};return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(E,N):E.then(G=>G.arrayBuffer()).then(G=>WebAssembly.instantiate(G,N))).then(G=>{const{Rb:j,Qb:X,P:W,T:J,X:ie,Ja:oe,La:ue,Qa:se,Va:_e,Wa:Me,eb:pe,jb:we,f:
7de,e:be,yb:Fe,zb:Se,Ab:Qe,Bb:He,Db:Ce,Gb:pt}=G.instance.exports;I=be;const st=(()=>{let Je=0,Pe=0,ht=0,It=0;return mt=>{ht&&(j(It),j(Je),Pe+=ht,ht=Je=0),Je||(Pe+=128,Je=X(Pe));const Ct=mt.length+7&-8;let xt=Je;Ct>=Pe&&(ht=Ct,xt=It=X(Ct));for(let jt=0;jt<mt.length;jt++)A[xt+jt]=mt[jt];return xt}})();return z(),de(),{memory:be,_free:j,_malloc:X,Mesh:class{constructor(){this.ptr=W()}destroy(){J(this.ptr)}},Decoder:class{constructor(){this.ptr=oe()}destroy(){we(this.ptr)}DecodeArrayToMesh(Je,Pe,ht){const It=st(Je),mt=ue(this.ptr,It,Pe,ht.ptr);return!!ie(mt)}GetAttributeByUniqueId(Je,Pe){return{ptr:se(this.ptr,Je.ptr,Pe)}}GetTrianglesUInt16Array(Je,Pe,ht){_e(this.ptr,Je.ptr,Pe,ht)}GetTrianglesUInt32Array(Je,Pe,ht){Me(this.ptr,Je.ptr,Pe,ht)}GetAttributeDataArrayForAllPoints(Je,Pe,ht,It,mt){pe(this.ptr,Je.ptr,Pe.ptr,ht,It,mt)}},DT_INT8:Fe(),DT_UINT8:Se(),DT_INT16:Qe(),DT_UINT16:He(),DT_UINT32:Ce(),DT_FLOAT32:pt()}})}(fetch(ny())),Fd.then(E=>{Un=E,Fd=void 0}))}()),w&&y.push(function(){if(bp)return;const E=function(A){let I;const z=WebAssembly.instantiateStreaming(A,{}).then(G=>{I=G.instance,I.exports.__wasm_call_ctors()}),L={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},N={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};return{ready:z,supported:!0,decodeGltfBuffer(G,j,X,W,J,ie){(function(oe,ue,se,_e,Me,pe,we){const de=oe.exports.sbrk,be=_e+3&-4,Fe=de(be*Me),Se=de(pe.length),Qe=new Uint8Array(oe.exports.memory.buffer);Qe.set(pe,Se);const He=ue(Fe,_e,Me,Se,pe.length);if(He===0&&we&&we(Fe,be,Me),se.set(Qe.subarray(Fe,Fe+_e*Me)),de(Fe-de(0)),He!==0)throw new Error(`Malformed buffer data: ${He}`)})(I,I.exports[N[J]],G,j,X,W,I.exports[L[ie]])}}}(fetch(oy()));return E.ready.then(()=>{bp=E})}()),l)for(let E=0;E<l.length;E++)y.push(Wv(l[E],n,E,i));return(y.length?Promise.all(y):Promise.resolve()).then(()=>{if(v&&h)for(const{primitives:E}of h)for(const A of E)Zv(A,n);if(w&&h&&m)for(const E of m)qv(E,n);return n})})}class dy{constructor(e,i,n){if(this.triangleCount=i.length/3,this.min=new Ue(0,0),this.max=new Ue(0,0),this.xScale=0,this.yScale=0,this.cellsX=0,this.cellsY=0,this.cells=[],this.payload=[],this.triangleCount===0||e.length===0||n===0)return;const s=e.map(y=>y.x),l=e.map(y=>y.y);this.min=new Ue(Math.min(...s),Math.min(...l)),this.max=new Ue(Math.max(...s),Math.max(...l));const h=this.max.sub(this.min);h.x=Math.max(h.x,1),h.y=Math.max(h.y,1);const f=Math.max(h.x,h.y)/n;this.cellsX=Math.max(1,Math.ceil(h.x/f)),this.cellsY=Math.max(1,Math.ceil(h.y/f)),this.xScale=1/f,this.yScale=1/f;const m=[];for(let y=0;y<this.triangleCount;y++){const v=e[i[3*y+0]].sub(this.min),w=e[i[3*y+1]].sub(this.min),E=e[i[3*y+2]].sub(this.min),A=Bs(Math.floor(Math.min(v.x,w.x,E.x)),this.xScale,this.cellsX),I=Bs(Math.floor(Math.max(v.x,w.x,E.x)),this.xScale,this.cellsX),z=Bs(Math.floor(Math.min(v.y,w.y,E.y)),this.yScale,this.cellsY),L=Bs(Math.floor(Math.max(v.y,w.y,E.y)),this.yScale,this.cellsY),N=new Ue(0,0),G=new Ue(0,0),j=new Ue(0,0),X=new Ue(0,0);for(let W=z;W<=L;++W){N.y=G.y=W*f,j.y=X.y=(W+1)*f;for(let J=A;J<=I;++J)N.x=j.x=J*f,G.x=X.x=(J+1)*f,(gf(v,w,E,N,G,X)||gf(v,w,E,N,X,j))&&m.push({cellIdx:W*this.cellsX+J,triIdx:y})}}if(m.length===0)return;m.sort((y,v)=>y.cellIdx-v.cellIdx||y.triIdx-v.triIdx);let _=0;for(;_<m.length;){const y=m[_].cellIdx,v={start:this.payload.length,len:0};for(;_<m.length&&m[_].cellIdx===y;)++v.len,this.payload.push(m[_++].triIdx);this.cells[y]=v}}query(e,i,n){if(this.triangleCount===0||this.cells.length===0||e.x>this.max.x||this.min.x>i.x||e.y>this.max.y||this.min.y>i.y)return;this.lookup||(this.lookup=new Uint8Array(Math.ceil(this.triangleCount/8)));for(let m=0;m<this.lookup.length;m++)this.lookup[m]=0;const s=Bs(e.x-this.min.x,this.xScale,this.cellsX),l=Bs(i.x-this.min.x,this.xScale,this.cellsX),h=Bs(e.y-this.min.y,this.yScale,this.cellsY),f=Bs(i.y-this.min.y,this.yScale,this.cellsY);for(let m=h;m<=f;m++)for(let _=s;_<=l;_++){const y=this.cells[m*this.cellsX+_];if(y)for(let v=0;v<y.len;v++){const w=this.payload[y.start+v],E=Math.floor(w/8),A=1<<w%8;if(!(this.lookup[E]&A)&&(this.lookup[E]|=A,n.push(w),n.length===this.triangleCount))return}}}}function Bs(t,e,i){return Math.max(0,Math.min(i-1,Math.floor(t*e)))}function Ba(t,e){const i=t.json.bufferViews[e.bufferView],n=Nd[e.componentType];return new n(t.buffers[i.buffer],(e.byteOffset||0)+(i.byteOffset||0),e.count*(i.byteStride&&i.byteStride!==qu[e.type]*n.BYTES_PER_ELEMENT?i.byteStride/n.BYTES_PER_ELEMENT:qu[e.type]))}function Tp(t,e,i,n){const s=Nd[e.componentType],l=function(y){switch(y){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:return 1}}(s),h=t.json.bufferViews[e.bufferView],f=h.byteStride?h.byteStride/s.BYTES_PER_ELEMENT:qu[e.type],m=i.float32,_=m.length/i.capacity;for(let y=0,v=0;y<e.count*f;y+=f,v+=_)for(let w=0;w<_;w++)m[v+w]=n[y+w]*l;i._trim()}function Hv(t,e,i){const n=t.indices,s=t.attributes,l={};l.indexArray=new Ji;const h=e.json.accessors[n],f=h.count/3;l.indexArray.reserve(f);
7const m=Ba(e,h);for(let w=0;w<f;w++)l.indexArray.emplaceBack(m[3*w],m[3*w+1],m[3*w+2]);l.indexArray._trim(),l.vertexArray=new jo;const _=e.json.accessors[s.POSITION];l.vertexArray.reserve(_.count);const y=Ba(e,_);for(let w=0;w<_.count;w++)l.vertexArray.emplaceBack(y[3*w],y[3*w+1],y[3*w+2]);if(l.vertexArray._trim(),l.aabb=new Ri(_.min,_.max),l.centroid=function(w,E){const A=[0,0,0],I=w.length;if(I>0){for(let z=0;z<I;z++){const L=3*w[z];A[0]+=E[L],A[1]+=E[L+1],A[2]+=E[L+2]}A[0]/=I,A[1]/=I,A[2]/=I}return A}(m,y),s.COLOR_0!==void 0){const w=e.json.accessors[s.COLOR_0],E=qu[w.type],A=Ba(e,w);l.colorArray=E===3?new jo:new ho,l.colorArray.resize(w.count),Tp(e,w,l.colorArray,A)}if(s.NORMAL!==void 0){l.normalArray=new jo;const w=e.json.accessors[s.NORMAL];l.normalArray.resize(w.count);const E=Ba(e,w);Tp(e,w,l.normalArray,E)}if(s.TEXCOORD_0!==void 0&&i.length>0){l.texcoordArray=new Ma;const w=e.json.accessors[s.TEXCOORD_0];l.texcoordArray.resize(w.count);const E=Ba(e,w);Tp(e,w,l.texcoordArray,E)}if(s._FEATURE_ID_RGBA4444!==void 0){const w=e.json.accessors[s._FEATURE_ID_RGBA4444];e.json.extensionsUsed&&e.json.extensionsUsed.includes("EXT_meshopt_compression")&&(l.featureData=Ba(e,w))}s._FEATURE_RGBA4444!==void 0&&(l.featureData=new Uint32Array(Ba(e,e.json.accessors[s._FEATURE_RGBA4444]).buffer));const v=t.material;return l.material=function(w,E){const{emissiveFactor:A=[0,0,0],alphaMode:I="OPAQUE",alphaCutoff:z=.5,normalTexture:L,occlusionTexture:N,emissiveTexture:G,doubleSided:j}=w,{baseColorFactor:X=[1,1,1,1],metallicFactor:W=1,roughnessFactor:J=1,baseColorTexture:ie,metallicRoughnessTexture:oe}=w.pbrMetallicRoughness||{},ue=N?E[N.index]:void 0;if(N&&N.extensions&&N.extensions.KHR_texture_transform&&ue){const se=N.extensions.KHR_texture_transform;ue.offsetScale=[se.offset[0],se.offset[1],se.scale[0],se.scale[1]]}return{pbrMetallicRoughness:{baseColorFactor:new ji(...X),metallicFactor:W,roughnessFactor:J,baseColorTexture:ie?E[ie.index]:void 0,metallicRoughnessTexture:oe?E[oe.index]:void 0},doubleSided:j,emissiveFactor:A,alphaMode:I,alphaCutoff:z,normalTexture:L?E[L.index]:void 0,occlusionTexture:ue,emissionTexture:G?E[G.index]:void 0,defined:w.defined===void 0}}(v!==void 0?e.json.materials[v]:{defined:!1},i),l}function fy(t,e,i){const{matrix:n,rotation:s,translation:l,scale:h,mesh:f,extras:m,children:_}=t,y={};if(y.matrix=n||a.a6.fromRotationTranslationScale([],s||[0,0,0,1],l||[0,0,0],h||[1,1,1]),f!==void 0){y.meshes=i[f];const v=y.anchor=[0,0];for(const w of y.meshes){const{min:E,max:A}=w.aabb;v[0]+=E[0]+A[0],v[1]+=E[1]+A[1]}v[0]=Math.floor(v[0]/y.meshes.length/2),v[1]=Math.floor(v[1]/y.meshes.length/2)}if(m&&(m.id&&(y.id=m.id),m.lights&&(y.lights=function(v){if(!v.length)return[];const w=function(L){const N=atob(L),G=new Uint8Array(N.length);for(let j=0;j<N.length;j++)G[j]=N.codePointAt(j);return G}(v),E=[],A=w.length/24,I=new Uint16Array(w.buffer),z=new Float32Array(w.buffer);for(let L=0;L<A;L++){const N=I[2*L*6]/30,G=I[2*L*6+1]/30,j=I[2*L*6+10]/100,X=z[6*L+1],W=z[6*L+2],J=z[6*L+3],ie=z[6*L+4],oe=J-X,ue=ie-W,se=Math.hypot(oe,ue);E.push({pos:[X+.5*oe,W+.5*ue,G],normal:[ue/se,-oe/se,0],width:se,height:N,depth:j,points:[X,W,J,ie]})}return E}(m.lights))),_){const v=[];for(const w of _)v.push(fy(e.json.nodes[w],e,i));y.children=v}return y}function Xv(t){if(t.vertices.length===0||t.indices.length===0)return null;const[e,i]=[t.vertices[0].clone(),t.vertices[0].clone()];for(let h=1;h<t.vertices.length;++h){const f=t.vertices[h];e.x=Math.min(e.x,f.x),e.y=Math.min(e.y,f.y),i.x=Math.max(i.x,f.x),i.y=Math.max(i.y,f.y)}const n=Math.ceil(Math.max(i.x-e.x,i.y-e.y)/256),s=Math.max(8,n),l=new dy(t.vertices,t.indices,s);return{vertices:t.vertices,indices:t.indices,grid:l,min:e,max:i}}function Yv(t){if(!t.extras||!t.extras.ground)return null;const e=t.extras.ground;if(!e||!Array.isArray(e)||e.length===0)return null;const i=e[0];if(!i||!Array.isArray(i)||i.length===0)return null;const n=[];for(const h of i){if(!Array.isArray(h)||h.length!==2)continue;const f=h[0],m=h[1];typeof f=="number"&&typeof m=="number"&&n.push(new Ue(f,m))}if(n.length<3)return null;n.length>1&&n[n.length-1].equals(n[0])&&n.pop();let s=0;for(let h=0;h<n.length;h++){const f=n[h],m=n[(h+1)%n.length],_=n[(h+2)%n.length];
7s+=(f.x-m.x)*(_.y-m.y)-(_.x-m.x)*(f.y-m.y)}s>0&&n.reverse();const l=ad(n.flatMap(h=>[h.x,h.y]),[]);return l.length===0?null:{vertices:n,indices:l}}function Kv(t){const e=[],i=[];let n=0;for(const s of t){n=e.length;const l=s.vertexArray.float32,h=s.indexArray.uint16;for(let f=0;f<s.vertexArray.length;f++)e.push(new Ue(l[3*f+0],l[3*f+1]));for(let f=0;f<3*s.indexArray.length;f++)i.push(h[f]+n)}if(i.length%3!=0)return null;for(let s=0;s<i.length;s+=3){const l=e[i[s+0]],h=e[i[s+1]],f=e[i[s+2]];(l.x-h.x)*(f.y-h.y)-(f.x-h.x)*(l.y-h.y)>0&&([i[s+1],i[s+2]]=[i[s+2],i[s+1]])}return{vertices:e,indices:i}}function py(t){const e=function(m,_){const y=[],v=WebGL2RenderingContext;if(m.json.textures)for(const w of m.json.textures){const E={magFilter:v.LINEAR,minFilter:v.NEAREST,wrapS:v.REPEAT,wrapT:v.REPEAT};w.sampler!==void 0&&Object.assign(E,m.json.samplers[w.sampler]),y.push({image:_[w.source],sampler:E,uploaded:!1})}return y}(t,t.images),i=function(m,_){const y=[];for(const v of m.json.meshes){const w=[];for(const E of v.primitives)w.push(Hv(E,m,_));y.push(w)}return y}(t,e),{scenes:n,scene:s,nodes:l}=t.json,h=n?n[s||0].nodes:l,f=[];for(const m of h)f.push(fy(l[m],t,i));return function(m,_,y){const v={},w=new Set;for(let E=0;E<m.length;E++){const A=y[_[E]];if(!A.extras)continue;const I=A.extras["mapbox:footprint:version"],z=A.extras["mapbox:footprint:id"];(I||z)&&w.add(E),I==="1.0.0"&&z&&(v[z]=E)}for(let E=0;E<m.length;E++){if(w.has(E))continue;const A=m[E],I=y[_[E]];if(!I.extras)continue;let z=null;A.id in v&&(z=Kv(m[v[A.id]].meshes)),z||(z=Yv(I)),z&&(A.footprint=Xv(z))}if(w.size>0){const E=Array.from(w.values()).sort((A,I)=>A-I);for(let A=E.length-1;A>=0;A--)m.splice(E[A],1)}}(f,h,t.json.nodes),f}function Jv(t){t.heightmap=new Float32Array(4096),t.heightmap.fill(-1);const e=t.vertexArray.float32,i=t.aabb.min[0]-1,n=t.aabb.min[1]-1,s=Oa/(t.aabb.max[0]-i+2),l=Oa/(t.aabb.max[1]-n+2);for(let h=0;h<e.length;h+=3){const f=e[h+2],m=(e[h+0]-i)*s|0,_=(e[h+1]-n)*l|0;f>t.heightmap[_*Oa+m]&&(t.heightmap[_*Oa+m]=f)}}function Qv(t,e){const i={};i.indexArray=new Ji,i.indexArray.reserve(4*t.length),i.vertexArray=new jo,i.vertexArray.reserve(10*t.length),i.colorArray=new ho,i.vertexArray.reserve(10*t.length);let n=0;for(const h of t){const f=Math.min(10,Math.max(4,1.3*h.height))*e,m=[-h.normal[1],h.normal[0],0],_=Math.min(.29,.1*h.width/h.depth),y=h.width-2*h.depth*e*(_+.01),v=a.N.scaleAndAdd([],h.pos,m,y/2),w=a.N.scaleAndAdd([],h.pos,m,-y/2),E=[v[0],v[1],v[2]+h.height],A=[w[0],w[1],w[2]+h.height],I=a.N.scaleAndAdd([],h.normal,m,_);a.N.scale(I,I,f);const z=a.N.scaleAndAdd([],h.normal,m,-_);a.N.scale(z,z,f),a.N.add(I,v,I),a.N.add(z,w,z),v[2]+=.1,w[2]+=.1,i.vertexArray.emplaceBack(I[0],I[1],I[2]),i.vertexArray.emplaceBack(z[0],z[1],z[2]),i.vertexArray.emplaceBack(v[0],v[1],v[2]),i.vertexArray.emplaceBack(w[0],w[1],w[2]),i.vertexArray.emplaceBack(E[0],E[1],E[2]),i.vertexArray.emplaceBack(A[0],A[1],A[2]),i.vertexArray.emplaceBack(v[0],v[1],v[2]),i.vertexArray.emplaceBack(w[0],w[1],w[2]),i.vertexArray.emplaceBack(I[0],I[1],I[2]),i.vertexArray.emplaceBack(z[0],z[1],z[2]);const L=y/f/2;i.colorArray.emplaceBack(-L-_,-1,L,.8),i.colorArray.emplaceBack(L+_,-1,L,.8),i.colorArray.emplaceBack(-L,0,L,1.3),i.colorArray.emplaceBack(L,0,L,1.3),i.colorArray.emplaceBack(L+_,-.8,L,.7),i.colorArray.emplaceBack(L+_,-.8,L,.7),i.colorArray.emplaceBack(0,0,L,1.3),i.colorArray.emplaceBack(0,0,L,1.3),i.colorArray.emplaceBack(L+_,-1.2,L,.8),i.colorArray.emplaceBack(L+_,-1.2,L,.8),i.indexArray.emplaceBack(6+n,4+n,8+n),i.indexArray.emplaceBack(7+n,9+n,5+n),i.indexArray.emplaceBack(0+n,1+n,2+n),i.indexArray.emplaceBack(1+n,3+n,2+n),n+=10}const s={defined:!0,emissiveFactor:[0,0,0]},l={};return l.baseColorFactor=ji.white,s.pbrMetallicRoughness=l,i.material=s,i.aabb=new Ri([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),i}Ke(dy,"TriangleGridIndex");class my{constructor(e){this._stringToNumber={},this._numberToString=[];for(let i=0;i<e.length;i++){const n=e[i];this._stringToNumber[n]=i,this._numberToString[i]=n}}encode(e){return this._stringToNumber[e]}decode(e){return this._numberToString[e]}}const e1=["tile","layer","source","sourceLayer","state"];class _y{constructor(e,i,n,s,l){this.type="Feature",this._vectorTileFeature=e,this._z=i,this._x=n,this._y=s,this.properties=e.properties,this.id=l}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._x,this._y,this._z).geometry),this._geometry}set geometry(e){this._geometry=e}toJSON(){const e={type:"Feature",state:void 0,geometry:this.geometry,properties:this.properties};this.id!==void 0&&(e.id=this.id);for(const i of e1)this[i]!==void 0&&(e[i]=this[i]);return e}}class gy{constructor(e,i){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new Dn(qe,16,0),this.featureIndexArray=new Nh,this.promoteId=i,this.is3DTile=!1}insert(e,i,n,s,l,h=0,f=0){const m=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(n,s,l,h);const _=this.grid;for(let y=0;y<i.length;y++){const v=i[y],w=[1/0,1/0,-1/0,-1/0];for(let E=0;E<v.length;E++){const A=v[E];w[0]=Math.min(w[0],A.x),w[1]=Math.min(w[1],A.y),w[2]=Math.max(w[2],A.x),w[3]=Math.max(w[3],A.y)}f!==0&&(w[0]-=f,w[1]-=f,w[2]+=f,w[3]+=f),w[0]<qe&&w[1]<qe&&w[2]>=0&&w[3]>=0&&_.insert(m,w[0],w[1],w[2],w[3])}}loadVTLayers(){if(!this.vtLayers){this.vtLayers=new Yf(new kl(this.rawTileData)).layers,this.sourceLayerCoder=new my(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"]),this.vtFeatures={};for(const e in this.vtLayers)this.vtFeatures[e]=[]}return this.vtLayers}query(e,i,n,s){this.loadVTLayers();const l=e.params||{},h=Vr(l.filter),f=e.tileResult,m=e.transform,_=f.bufferedTilespaceBounds,y=this.grid.query(_.min.x,_.min.y,_.max.x,_.max.y,(A,I,z,L)=>Fp(f.bufferedTilespaceGeometry,A,I,z,L));y.sort(t1);let v=null;m.elevation&&y.length>0&&(v=Pl.create(m.elevation,this.tileID));const w={};let E;for(let A=0;A<y.length;A++){const I=y[A];if(I===E)continue;E=I;const z=this.featureIndexArray.get(I);let L=null;if(this.is3DTile){const N=this.bucketLayerIDs[0][0],G=i[N];if(G.type!=="model")continue;const{queryFeature:j,intersectionZ:X}
7=G.queryIntersectsMatchingFeature(f,z.featureIndex,h,m);j&&this.appendToResult(w,N,z.featureIndex,j,X)}else this.loadMatchingFeature(w,z,h,l.layers,l.availableImages,i,n,s,(N,G,j,X=0)=>(L||(L=er(N,this.tileID.canonical,e.tileTransform)),G.queryIntersectsFeature(f,N,j,L,this.z,e.transform,e.pixelPosMatrix,v,X)))}return w}loadMatchingFeature(e,i,n,s,l,h,f,m,_){const{featureIndex:y,bucketIndex:v,sourceLayerIndex:w,layoutVertexArrayOffset:E}=i,A=this.bucketLayerIDs[v];if(s&&!function(N,G){for(let j=0;j<N.length;j++)if(G.indexOf(N[j])>=0)return!0;return!1}(s,A))return;const I=this.sourceLayerCoder.decode(w),z=this.vtLayers[I].feature(y);if(n.needGeometry){const N=Hi(z,!0);if(!n.filter(new Ii(this.tileID.overscaledZ),N,this.tileID.canonical))return}else if(!n.filter(new Ii(this.tileID.overscaledZ),z))return;const L=this.getId(z,I);for(let N=0;N<A.length;N++){const G=A[N];if(s&&s.indexOf(G)<0)continue;const j=h[G];if(!j)continue;let X={};L!==void 0&&m&&(X=m.getState(j.sourceLayer||"_geojsonTileLayer",L));const W=!_||_(z,j,X,E);if(!W)continue;const J=new _y(z,this.z,this.x,this.y,L),ie=fr({},f[G]);ie.paint=yy(ie.paint,j.paint,z,X,l),ie.layout=yy(ie.layout,j.layout,z,X,l),J.layer=ie,this.appendToResult(e,G,y,J,W)}}appendToResult(e,i,n,s,l){let h=e[i];h===void 0&&(h=e[i]=[]),h.push({featureIndex:n,feature:s,intersectionZ:l})}lookupSymbolFeatures(e,i,n,s,l,h,f,m){const _={};this.loadVTLayers();const y=Vr(l);for(const v of e)this.loadMatchingFeature(_,{bucketIndex:n,sourceLayerIndex:s,featureIndex:v,layoutVertexArrayOffset:0},y,h,f,m,i);return _}loadFeature(e){const{featureIndex:i,sourceLayerIndex:n}=e;this.loadVTLayers();const s=this.sourceLayerCoder.decode(n),l=this.vtFeatures[s];if(l[i])return l[i];const h=this.vtLayers[s].feature(i);return l[i]=h,h}hasLayer(e){for(const i of this.bucketLayerIDs)for(const n of i)if(e===n)return!0;return!1}getId(e,i){let n=e.id;if(this.promoteId){const s=typeof this.promoteId=="string"?this.promoteId:this.promoteId[i];s!=null&&(n=e.properties[s]),typeof n=="boolean"&&(n=Number(n))}return n}}function yy(t,e,i,n,s){return pr(t,(l,h)=>{const f=e instanceof da?e.get(h):null;return f&&f.evaluate?f.evaluate(i,n,s):f})}function t1(t,e){return e-t}Ke(gy,"FeatureIndex",{omit:["rawTileData","sourceLayerCoder"]});const Mp=new Float32Array(262144),Fa=new Uint8Array(262144);function xy(t){let e=0;if(t.meshes)for(const i of t.meshes)e=Math.max(e,i.aabb.max[2]);if(t.children)for(const i of t.children)e=Math.max(e,xy(i));return e}function vy(t,e,i){if(t.meshes)for(const n of t.meshes)n.aabb.min[0]!==1/0&&i.insert(e,n.aabb.min[0],n.aabb.min[1],n.aabb.max[0],n.aabb.max[1]);if(t.children)for(const n of t.children)vy(n,e,i)}const by=["","wall","door","roof","window","lamp","logo"];class wy{constructor(e){this.node=e,this.evaluatedRMEA=[[1,0,0,1],[1,0,0,1],[1,0,0,1],[1,0,0,1],[.4,1,0,1],[1,0,0,1],[1,0,0,1]],this.hiddenByReplacement=!1,this.evaluatedScale=[1,1,1],this.evaluatedColor=[],this.emissionHeightBasedParams=[],this.feature={type:"Point",id:e.id,geometry:[],properties:{height:xy(e)}}}getLocalBounds(){if(!this.node.meshes)return new Ri([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);if(!this.aabb){let e=0;const i=new Ri([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);for(const n of this.node.meshes)this.node.lightMeshIndex!==e&&i.encapsulate(n.aabb),e++;this.aabb=i}return this.aabb}}class Ud{constructor(e,i,n,s,l,h){this.id=i,this.modelTraits|=Vl.CoordinateSpaceTile,this.uploaded=!1,this.hasPattern=!1,n&&(this.modelTraits|=Vl.HasMapboxMeshFeatures),s&&(this.modelTraits|=Vl.HasMeshoptCompression),this.zoom=-1,this.terrainExaggeration=1,this.projection={name:"mercator"},this.replacementUpdateTime=0,this.elevationReadFromZ=255,this.brightness=l,this.dirty=!0,this.needsUpload=!1,this.nodesInfo=[];for(const f of e)this.nodesInfo.push(new wy(f)),vy(f,h.featureIndexArray.length,h.grid),h.featureIndexArray.emplaceBack(this.nodesInfo.length-1,0,h.bucketLayerIDs.length-1,0)}update(){console.log("Update 3D model bucket")}populate(){console.log("populate 3D model bucket")}uploadPending(){return!this.uploaded||this.needsUpload}upload(e){if(!this.needsUpload)return;const i=this.getNodesInfo();for(const n of i){const s=n.node;this.uploaded?this.updatePbrBuffer(s):gp(s,e,!0)}for(const n of i)Od(n.node);this.uploaded=!0,this.needsUpload=!1}updatePbrBuffer(e){let i=!1;if(!e.meshes)return i;for(const n of e.meshes)n.pbrBuffer&&(n.pbrBuffer.updateData(n.featureArray),i=!0);return i}needsReEvaluation(e,i,n){const s=e.transform.projectionOptions,l=e.style.getBrightness(),h=this.brightness!==l;return!!(!this.uploaded||this.dirty||s.name!==this.projection.name||$u(n.paint.get("model-color").value,h)||$u(n.paint.get("model-color-mix-intensity").value,h)||$u(n.paint.get("model-roughness").value,h)||$u(n.paint.get("model-emissive-strength").value,h)||$u(n.paint.get("model-height-based-emissive-strength-multiplier").value,h))&&(this.projection=s,this.brightness=l,!0)}evaluateScale(e,i){if(e.transform.zoom===this.zoom)return;this.zoom=e.transform.zoom;const n=this.getNodesInfo(),s=this.id.canonical;for(const l of n){const h=l.feature;l.evaluatedScale=i.paint.get("model-scale").evaluate(h,{},s)}}evaluate(e){const i=this.getNodesInfo();for(const n of i){if(!n.node.meshes)continue;const s=n.feature,l=n.node.meshes&&n.node.meshes[0].featureData,h=n.evaluatedColor[2],f=n.evaluatedRMEA[2],m=this.id.canonical;if(n.hasTranslucentParts=!1,l){for(let _=0;_<by.length;_++){const y=by[_];y.length&&(s.properties.part=y);const v=e.paint.get("model-color").evaluate(s,{},m),w=e.paint.get("model-color-mix-intensity").evaluate(s,{},m);n.evaluatedColor[_]=[v.r,v.g,v.b,w],n.evaluatedRMEA[_][0]=e.paint.get("model-roughness").evaluate(s,{},m),n.evaluatedRMEA[_][2]=e.paint.get("model-emissive-strength").evaluate(s,{},m),n.evaluatedRMEA[_][3]=v.a,n.emissionHeightBasedParams[_]=e.paint.get("model-height-based-emissive-strength-multiplier").evaluate(s,{},m),!n.hasTranslucentParts&&v.a<1&&(n.hasTranslucentParts=!0)}delete s.properties.part,r1(n,h!==n.evaluatedColor[2]||f!==n.evaluatedRMEA[2],this.modelTraits)}else n.evaluatedRMEA[0][2]=e.paint.get("model-emissive-strength").evaluate(s,{},m);n.evaluatedScale=e.paint.get("model-scale").evaluate(s,{},m),this.updatePbrBuffer(n.node)||(this.needsUpload=!0)}this.dirty=!1}elevationUpdate(e,i,n,s){const l=e.findDEMTileFor(n);if(l&&(l.tileID.canonical!==this.terrainTile||i!==this.terrainExaggeration)){if
7(l.dem&&l.tileID.overscaledZ!==this.elevationReadFromZ){this.elevationReadFromZ=l.tileID.overscaledZ;const h=Pl.create(e,n,l);if(!h)return;this.modelTraits&Vl.HasMapboxMeshFeatures&&this.updateDEM(e,h,n,s);for(const f of this.getNodesInfo()){const m=f.node;if(!m.footprint||!m.footprint.vertices||!m.footprint.vertices.length)continue;const _=m.footprint.vertices;let y=h.getElevationAt(_[0].x,_[0].y,!0,!0);for(let v=1;v<_.length;v++)y=Math.min(y,h.getElevationAt(_[v].x,_[v].y,!0,!0));m.elevation=y}}this.terrainTile=l.tileID.canonical,this.terrainExaggeration=i}}updateDEM(e,i,n,s){let l=i._dem._modifiedForSources[s];if(l===void 0&&(i._dem._modifiedForSources[s]=[],l=i._dem._modifiedForSources[s]),l.includes(n.canonical))return;const h=i._dem.dim;l.push(n.canonical);let f=!1;for(const m of this.getNodesInfo()){const _=m.node;if(!_.footprint||!_.footprint.grid)continue;const y=_.footprint.grid,v=i.tileCoordToPixel(y.min.x,y.min.y),w=i.tileCoordToPixel(y.max.x,y.max.y),E=Math.min(Math.min(h-w.y,v.x),Math.min(v.y,h-w.x));if(E<0)continue;const A=Dt(E,2,5);let I=Math.max(0,v.x-A),z=Math.max(0,v.y-A),L=Math.min(w.x+A,h-1),N=Math.min(w.y+A,h-1);for(let W=z;W<=N;++W)for(let J=I;J<=L;++J)Fa[W*h+J]=255;let G=0,j=0;for(let W=0;W<y.cellsY;++W)for(let J=0;J<y.cellsX;++J){if(!y.cells[W*y.cellsX+J])continue;const ie=i.tileCoordToPixel(y.min.x+J/y.xScale,y.min.y+W/y.yScale),oe=i.tileCoordToPixel(y.min.x+(J+1)/y.xScale,y.min.y+(W+1)/y.yScale);for(let ue=ie.y;ue<=Math.min(oe.y+1,h-1);++ue)for(let se=ie.x;se<=Math.min(oe.x+1,h-1);++se)Fa[ue*h+se]===255&&(Fa[ue*h+se]=0,G+=i.getElevationAtPixel(se,ue),j++)}const X=G/j;I=Math.max(1,v.x-A),z=Math.max(1,v.y-A),L=Math.min(w.x+A,h-2),N=Math.min(w.y+A,h-2),f=!0;for(let W=z;W<=N;++W)for(let J=I;J<=L;++J)Fa[W*h+J]===0&&(Mp[W*h+J]=i._dem.set(J,W,X));for(let W=1;W<A;++W){I=Math.max(1,v.x-W),z=Math.max(1,v.y-W),L=Math.min(w.x+W,h-2),N=Math.min(w.y+W,h-2);for(let J=z;J<=N;++J)for(let ie=I;ie<=L;++ie){const oe=J*h+ie;if(Fa[oe]===255){let ue=0,se=0,_e=-1,Me=-1;for(let pe=-1;pe<=1;++pe)for(let we=-1;we<=1;++we){const de=(J+pe)*h+ie+we;if(Fa[de]>=W)continue;const be=Mp[de],Fe=Math.abs(be);Fe>se&&(ue=be,se=Fe,_e=we,Me=pe)}if(se>.1){const pe=1-(W+.5*Math.abs(_e*Me))/A;let we=i._dem.get(ie,J)+ue*pe;const de=i._dem.get(ie+_e,J+Me),be=i._dem.get(ie-_e,J-Me,!0);(we-de)*(we-be)>0&&(we=(de+be)/2),Mp[oe]=i._dem.set(ie,J,we),Fa[oe]=W}}}}}f&&(i._demTile.needsDEMTextureUpload=!0,i._dem._timestamp=ze.now())}getNodesInfo(){return this.nodesInfo}destroy(){const e=this.getNodesInfo();for(const i of e)Od(i.node),yp(i.node)}isEmpty(){return!this.nodesInfo.length}updateReplacement(e,i){if(i.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=i.updateTime;const n=i.getReplacementRegionsForTile(e.toUnwrapped()),s=this.getNodesInfo();for(let l=0;l<this.nodesInfo.length;l++){const h=s[l].node;s[l].hiddenByReplacement=!!h.footprint&&!n.find(f=>f.footprint===h.footprint)}}getHeightAtTileCoord(e,i){const n=this.getNodesInfo(),s=[];for(let l=0;l<this.nodesInfo.length;l++){const h=n[l],f=h.node.meshes[0];if(e<f.aabb.min[0]||i<f.aabb.min[1]||e>f.aabb.max[0]||i>f.aabb.max[1])continue;const m=(e-f.aabb.min[0])/(f.aabb.max[0]-f.aabb.min[0])*Oa|0,_=Math.min(63,(i-f.aabb.min[1])/(f.aabb.max[1]-f.aabb.min[1])*Oa|0)*Oa+Math.min(63,m);if(!(f.heightmap[_]<0&&h.node.footprint))return h.hiddenByReplacement?void 0:{height:f.heightmap[_],maxHeight:h.feature.properties.height,hidden:!1,verticalScale:h.evaluatedScale[2]};if(h.node.footprint.grid.query(new Ue(e,i),new Ue(e,i),s),s.length>0)return{height:void 0,maxHeight:h.feature.properties.height,hidden:h.hiddenByReplacement,verticalScale:h.evaluatedScale[2]}}}}function $u(t,e){return!t.isLightConstant&&e}function i1(t,e,i,n,s,l,h,f){let m=(61440&e|(61440&e)>>4)>>8,_=(3840&e|(3840&e)>>4)>>4,y=240&e|(240&e)>>4;i[3]>0&&(m=Ut(m,255*i[0],i[3]),_=Ut(_,255*i[1],i[3]),y=Ut(y,255*i[2],i[3]));const v=m<<8|_,w=y<<8|Math.floor(255*n[3]),E=function(W){const J=Dt(W,0,2);return Math.min(Math.round(.5*J*255),255)}(n[2])<<8|15*n[0]<<4|15*n[1],A=Dt(s[0],0,1),I=Dt(s[1],0,1),z=Dt(s[2],0,1),L=Dt(s[3],0,1);let N,G,j,X;if(A!==I&&h!==l&&I!==A){const W=h-l;G=1/(W*(I-A)),j=-(l+W*A)/(W*(I-A));const J=Dt(s[4],-1,1);X=Math.pow(10,J),N=255*z<<8|255*L}else N=65535,G=0,j=1,X=1;if(t.emplaceBack(v,w,E,N,G,j,X),f){const W=f.length;f.clear();for(let J=0;J<W;J++)f.emplaceBack(v,w,E,N,G,j,X)}}function r1(t,e,i){const n=t.node;let s=0;const l=i&Vl.HasMeshoptCompression;for(const h of n.meshes){if(n.lights&&n.lightMeshIndex===s||!h.featureData)continue;h.featureArray=new Ea,h.featureArray.reserve(h.featureData.length);let f=e;for(const m of h.featureData){const _=l?65535&m:m>>16&65535,y=l?m>>16&65535:65535&m,v=(15&y)<8?15&y:0,w=t.evaluatedRMEA[v],E=t.evaluatedColor[v],A=t.emissionHeightBasedParams[v];let I;if(f&&v===2&&n.lights&&(I=new Ea,I.resize(10*n.lights.length)),i1(h.featureArray,_,E,w,A,h.aabb.min[2],h.aabb.max[2],I),I&&f){f=!1;const z=n.meshes[n.lightMeshIndex];z.featureArray=I,z.featureArray._trim()}}h.featureArray._trim(),s++}}function Ty(t,e,i,n){const s=1<<t.z;e.lat=Zt((n/qe+t.y)/s),e.lng=vt((i/qe+t.x)/s)}Ke(Ud,"Tiled3dModelBucket",{omit:["layers"]}),Ke(wy,"Tiled3dModelFeature");const n1={circle:class extends Cr{constructor(t,e,i){super(t,Yy,e,i)}createBucket(t){return new Dr(t)}queryRadius(t){const e=t;return Al("circle-radius",this,e)+Al("circle-stroke-width",this,e)+Hh(this.paint.get("circle-translate"))}queryIntersectsFeature(t,e,i,n,s,l,h,f){const m=Vp(this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),l.angle,t.pixelToTileUnitsFactor),_=this.paint.get("circle-radius").evaluate(e,i)+this.paint.get("circle-stroke-width").evaluate(e,i);return f_(t,n,l,h,f,this.paint.get("circle-pitch-alignment")==="map",this.paint.get("circle-pitch-scale")==="map",m,_)}getProgramIds(){return["circle"]}getDefaultProgramParams(t,e){const i=d_(this);return{config:new P(this,e),defines:i,overrideFog:!1}}},heatmap:class extends Cr{createBucket(t){return new m_(t)}constructor(t,e,i){super(t,A0,e,i),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(t){t==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=Eu({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)}queryRadius(t){return Al("heatmap-radius",this,t)}queryIntersectsFeature(t,e,i,n,s,l,h,f){const m=this.paint.get("heatmap-radius").evaluate(e,i);return f_(t,n,l,h,f,!0,!0,new Ue(0,0),m)}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}getProgramIds(){return["heatmap","heatmapTexture"]}getDefaultProgramParams(t,e){return t==="heatmap"?{config:new P(this,e),overrideFog:!1}:{}}},hillshade:class extends Cr{constructor(t,e,i){super(t,C0,e,i)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}getProgramIds(){return["hillshade","hillshadePrepare"]}getDefaultProgramParams(t,e){return{overrideFog:!1}}},fill:class extends Cr{constructor(t,e,i){super(t,G0,e,i)}getProgramIds(){const t=this.paint.get("fill-pattern"),e=t&&t.constantOr(1),i=[e?"fillPattern":"fill"];return this.paint.get("fill-antialias")&&i.push(e&&!this.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline"),i}getDefaultProgramParams(t,e){return{config:new P(this,e),overrideFog:!1}}recalculate(t,e){super.recalculate(t,e);const i=this.paint._values["fill-outline-color"];i.value.kind==="constant"&&i.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(t){return new Xf(t)}queryRadius(){return Hh(this.paint.get("fill-translate"))}queryIntersectsFeature(t,e,i,n,s,l){return!t.queryGeometry.isAboveHorizon&&Go(Np(t.tilespaceGeometry,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),l.angle,t.pixelToTileUnitsFactor),n)}isTileClipped(){return!0}},"fill-extrusion":class extends Cr{constructor(t,e,i){super(t,gx,e,i),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(t){return new pd(t)}queryRadius(){return Hh(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}hasShadowPass(){return!0}cutoffRange(){return this.paint.get("fill-extrusion-cutoff-fade-range")}canCastShadows(){return!0}getProgramIds(){return[this.paint.get("fill-extrusion-pattern").constantOr(1)?"fillExtrusionPattern":"fillExtrusion"]}queryIntersectsFeature(t,e,i,n,s,l,h,f,m){const _=Vp(this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),l.angle,t.pixelToTileUnitsFactor),y=this.paint.get("fill-extrusion-height").evaluate(e,i),v=this.paint.get("fill-extrusion-base").evaluate(e,i),w=[0,0],E=f&&l.elevation,A=l.elevation?l.elevation.exaggeration():1,I=t.tile.getBucket(this);if(E&&I instanceof pd){const j=I.centroidVertexArray,X=m+1;X<j.length&&(w[0]=j.geta_centroid_pos0(X),w[1]=j.geta_centroid_pos1(X))}if(w[0]===0&&w[1]===1)return!1;l.projection.name==="globe"&&(n=Y_([n],[new Ue(0,0),new Ue(qe,qe)],t.tileID.canonical).map(j=>j.polygon).flat());const z=E?f:null,[L,N]=function(j,X,W,J,ie,oe,ue,se,_e,Me,pe){return j.projection.name==="globe"?function(we,de,be,Fe,Se,Qe,He,Ce,pt,st,Je){const Pe=[],ht=[],It=we.projection.upVectorScale(Je,we.center.lat,we.worldSize).metersToTile,mt=[0,0,0,1],Ct=[0,0,0,1],xt=(wt,mi,Jt,ei)=>{wt[0]=mi,wt[1]=Jt,wt[2]=ei,wt[3]=1},jt=X_();be>0&&(be+=jt),Fe+=jt;for(const wt of de){const mi=[],Jt=[];for(const ei of wt){const si=ei.x+Se.x,Qt=ei.y+Se.y,Ai=we.projection.projectTilePoint(si,Qt,Je),ui=we.projection.upVector(Je,ei.x,ei.y);let Bi=be,Yi=Fe;if(He){const hr=J_(si,Qt,be,Fe,He,Ce,pt,st);Bi+=hr.base,Yi+=hr.top}
7be!==0?xt(mt,Ai.x+ui[0]*It*Bi,Ai.y+ui[1]*It*Bi,Ai.z+ui[2]*It*Bi):xt(mt,Ai.x,Ai.y,Ai.z),xt(Ct,Ai.x+ui[0]*It*Yi,Ai.y+ui[1]*It*Yi,Ai.z+ui[2]*It*Yi),a.N.transformMat4(mt,mt,Qe),a.N.transformMat4(Ct,Ct,Qe),mi.push(new zl(mt[0],mt[1],mt[2])),Jt.push(new zl(Ct[0],Ct[1],Ct[2]))}Pe.push(mi),ht.push(Jt)}return[Pe,ht]}(j,X,W,J,ie,oe,ue,se,_e,Me,pe):ue?function(we,de,be,Fe,Se,Qe,He,Ce,pt){const st=[],Je=[],Pe=[0,0,0,1];for(const ht of we){const It=[],mt=[];for(const Ct of ht){const xt=Ct.x+Fe.x,jt=Ct.y+Fe.y,wt=J_(xt,jt,de,be,Qe,He,Ce,pt);Pe[0]=xt,Pe[1]=jt,Pe[2]=wt.base,Pe[3]=1,a.a7.transformMat4(Pe,Pe,Se),Pe[3]=Math.max(Pe[3],1e-5);const mi=new zl(Pe[0]/Pe[3],Pe[1]/Pe[3],Pe[2]/Pe[3]);Pe[0]=xt,Pe[1]=jt,Pe[2]=wt.top,Pe[3]=1,a.a7.transformMat4(Pe,Pe,Se),Pe[3]=Math.max(Pe[3],1e-5);const Jt=new zl(Pe[0]/Pe[3],Pe[1]/Pe[3],Pe[2]/Pe[3]);It.push(mi),mt.push(Jt)}st.push(It),Je.push(mt)}return[st,Je]}(X,W,J,ie,oe,ue,se,_e,Me):function(we,de,be,Fe,Se){const Qe=[],He=[],Ce=Se[8]*de,pt=Se[9]*de,st=Se[10]*de,Je=Se[11]*de,Pe=Se[8]*be,ht=Se[9]*be,It=Se[10]*be,mt=Se[11]*be;for(const Ct of we){const xt=[],jt=[];for(const wt of Ct){const mi=wt.x+Fe.x,Jt=wt.y+Fe.y,ei=Se[0]*mi+Se[4]*Jt+Se[12],si=Se[1]*mi+Se[5]*Jt+Se[13],Qt=Se[2]*mi+Se[6]*Jt+Se[14],Ai=Se[3]*mi+Se[7]*Jt+Se[15],ui=ei+Ce,Bi=si+pt,Yi=Qt+st,hr=Math.max(Ai+Je,1e-5),Mi=ei+Pe,Di=si+ht,rr=Qt+It,nr=Math.max(Ai+mt,1e-5);xt.push(new zl(ui/hr,Bi/hr,Yi/hr)),jt.push(new zl(Mi/nr,Di/nr,rr/nr))}Qe.push(xt),He.push(jt)}return[Qe,He]}(X,W,J,ie,oe)}(l,n,v,y,_,h,z,w,A,l.center.lat,t.tileID.canonical),G=t.queryGeometry;return function(j,X,W){let J=1/0;Go(W,X)&&(J=K_(W,X[0]));for(let ie=0;ie<X.length;ie++){const oe=X[ie],ue=j[ie];for(let se=0;se<oe.length-1;se++){const _e=oe[se],Me=[_e,oe[se+1],ue[se+1],ue[se],_e];wn(W,Me)&&(J=Math.min(J,K_(W,Me)))}}return J!==1/0&&J}(L,N,G.isPointQuery()?G.screenBounds:G.screenGeometry)}},line:class extends Cr{constructor(t,e,i){super(t,eg,e,i),this.gradientVersion=0}_handleSpecialPaintPropertyUpdate(t){if(t==="line-gradient"){const e=this._transitionablePaint._values["line-gradient"].value.expression;this.stepInterpolant=e._styleExpression&&e._styleExpression.expression instanceof ra,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}widthExpression(){return this._transitionablePaint._values["line-width"].value.expression}recalculate(t,e){super.recalculate(t,e),this.paint._values["line-floorwidth"]=sg.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,t)}createBucket(t){return new Jf(t)}getProgramIds(){return[this.paint.get("line-pattern").constantOr(1)?"linePattern":"line"]}getDefaultProgramParams(t,e){const i=ng(this);return{config:new P(this,e),defines:i,overrideFog:!1}}queryRadius(t){const e=t,i=ag(Al("line-width",this,e),Al("line-gap-width",this,e)),n=Al("line-offset",this,e);return i/2+Math.abs(n)+Hh(this.paint.get("line-translate"))}queryIntersectsFeature(t,e,i,n,s,l){if(t.queryGeometry.isAboveHorizon)return!1;const h=Np(t.tilespaceGeometry,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),l.angle,t.pixelToTileUnitsFactor),f=t.pixelToTileUnitsFactor/2*ag(this.paint.get("line-width").evaluate(e,i),this.paint.get("line-gap-width").evaluate(e,i)),m=this.paint.get("line-offset").evaluate(e,i);return m&&(n=function(_,y){const v=[],w=new Ue(0,0);for(let E=0;E<_.length;E++){const A=_[E],I=[];for(let z=0;z<A.length;z++){const L=A[z],N=A[z+1],G=z===0?w:L.sub(A[z-1])._unit()._perp(),j=z===A.length-1?w:N.sub(L)._unit()._perp(),X=G._add(j)._unit();X._mult(1/(X.x*j.x+X.y*j.y)),I.push(X._mult(y)._add(L))}v.push(I)}return v}(n,m*t.pixelToTileUnitsFactor)),function(_,y,v){for(let w=0;w<y.length;w++){const E=y[w];if(_.length>=3){for(let A=0;A<E.length;A++)if(On(_,E[A]))return!0}if(Pa(_,E,v))return!0}return!1}(h,n,f)}isTileClipped(){return!0}},symbol:Pd,background:class extends Cr{constructor(t,e,i){super(t,vv,e,i)}getProgramIds(){return[this.paint.get("background-pattern")?"backgroundPattern":"background"]}getDefaultProgramParams(t,e){return{overrideFog:!1}}},raster:$g,"raster-particle":Wg,sky:class extends Cr{constructor(t,e,i){super(t,Iv,e,i),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(t){t==="sky-gradient"?this._updateColorRamp():t!=="sky-atmosphere-sun"&&t!=="sky-atmosphere-halo-color"&&t!=="sky-atmosphere-color"&&t!=="sky-atmosphere-sun-intensity"||(this._skyboxInvali
7dated=!0)}_updateColorRamp(){this.colorRamp=Eu({expression:this._transitionablePaint._values["sky-gradient"].value.expression,evaluationKey:"skyRadialProgress"}),this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null)}needsSkyboxCapture(t){if(this._skyboxInvalidated||!this.skyboxTexture||!this.skyboxGeometry)return!0;if(!this.paint.get("sky-atmosphere-sun")){const e=t.style.light.properties.get("position");return this._lightPosition.azimuthal!==e.azimuthal||this._lightPosition.polar!==e.polar}return!1}getCenter(t,e){if(this.paint.get("sky-type")==="atmosphere"){const n=this.paint.get("sky-atmosphere-sun"),s=!n,l=t.style.light,h=l.properties.get("position");return s&&l.properties.get("anchor")==="viewport"&&ki("The sun direction is attached to a light with viewport anchor, lighting may behave unexpectedly."),s?pp(h.azimuthal,90-h.polar,e):pp(n[0],90-n[1],e)}const i=this.paint.get("sky-gradient-center");return pp(i[0],90-i[1],e)}isSky(){return!0}markSkyboxValid(t){this._skyboxInvalidated=!1,this._lightPosition=t.style.light.properties.get("position")}hasOffscreenPass(){return!0}getProgramIds(){const t=this.paint.get("sky-type");return t==="atmosphere"?["skyboxCapture","skybox"]:t==="gradient"?["skyboxGradient"]:null}},slot:class extends Cr{constructor(t,e,i){super(t,Cv,e)}},model:class extends Cr{constructor(t,e,i){super(t,Fv,e,i),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(t){return new _p(t)}getProgramIds(){return["model"]}is3D(){return!0}hasShadowPass(){return!0}canCastShadows(){return!0}hasLightBeamPass(){return!0}cutoffRange(){return this.paint.get("model-cutoff-fade-range")}queryRadius(t){return t instanceof Ud?qe-1:0}queryIntersectsFeature(t,e,i,n,s,l){if(!this.modelManager)return!1;const h=this.modelManager,f=t.tile.getBucket(this);if(!(f&&f instanceof _p))return!1;const m=f;for(const _ in m.instancesPerModel){const y=m.instancesPerModel[_];if(y.idToFeaturesIndex.hasOwnProperty(e.id)){const v=y.features[y.idToFeaturesIndex[e.id]],w=h.getModel(_,this.scope);if(!w)return!1;let E=a.a6.create();const A=new ne(0,0),I=m.canonical;let z=Number.MAX_VALUE;for(let L=0;L<v.instancedDataCount;++L){const N=16*(v.instancedDataOffset+L),G=y.instancedDataArray.float32,j=[G[N+4],G[N+5],G[N+6]];Ty(I,A,G[N],0|G[N+1]),iy(E,w,l,A,v.rotation,v.scale,j,!1,!1,!1),l.projection.name==="globe"&&(E=mp(E,l));const X=a.a6.multiply([],l.projMatrix,E),W=t.queryGeometry,J=Qg(W.isPointQuery()?W.screenBounds:W.screenGeometry,l,X,w.aabb);J!=null&&(z=Math.min(J,z))}return z!==Number.MAX_VALUE&&z}}return!1}_handleOverridablePaintPropertyUpdate(t,e,i){return!(!this.layout||e.isDataDriven()||i.isDataDriven()||t!=="model-color"&&t!=="model-color-mix-intensity"&&t!=="model-rotation"&&t!=="model-scale"&&t!=="model-translation"&&t!=="model-emissive-strength")}_isPropertyZoomDependent(t){const e=this._transitionablePaint._values[t];return e!=null&&e.value!=null&&e.value.expression!=null&&e.value.expression instanceof la}isZoomDependent(){return this._isPropertyZoomDependent("model-scale")||this._isPropertyZoomDependent("model-rotation")||this._isPropertyZoomDependent("model-translation")}queryIntersectsMatchingFeature(t,e,i,n){const s=t.tile,l=s.getBucket(this);let h=null,f=Number.MAX_VALUE;if(!(l&&l instanceof Ud))return{queryFeature:h,intersectionZ:f};const m=l.getNodesInfo()[e];if(m.hiddenByReplacement||!m.node.meshes||!i.filter(new Ii(s.tileID.overscaledZ),m.feature,s.tileID.canonical))return{queryFeature:h,intersectionZ:f};const _=m.node,y=n.calculatePosMatrix(s.tileID.toUnwrapped(),n.worldSize),v=m.evaluatedScale;let w=0;n.elevation&&_.elevation&&(w=_.elevation*n.elevation.exaggeration()),a.a6.translate(y,y,[(_.anchor?_.anchor[0]:0)*(v[0]-1),(_.anchor?_.anchor[1]:0)*(v[1]-1),w]),a.a6.scale(y,y,v),a.a6.multiply(y,y,_.matrix);const E=t.queryGeometry,A=E.isPointQuery()?E.screenBounds:E.screenGeometry,I=function(L){const N=a.a6.multiply([],y,L.matrix),G=a.a6.multiply(N,n.expandedFarZProjMatrix,N);for(let j=0;j<L.meshes.length;++j){const X=L.meshes[j];if(j===L.lightMeshIndex)continue;const W=Qg(A,n,G,X.aabb);W!=null&&(f=Math.min(W,f))}if(L.children)for(const j of L.children)I(j)};if(I(_),f===Number.MAX_VALUE)return{queryFeature:h,intersectionZ:f};const z=new ne(0,0);return Ty(s.tileID.canonical,z,m.node.anchor[0],m.node.anchor[1]),h={type:"Feature",geometry:{type:"Point",coordinates:[z.lng,z.lat]},properties:m.feature.properties,id:m.feature.id,state:{},layer:this.serialize()},{queryFeature:h,intersectionZ:f}}}},Mt={read:function(t,e){return t.readFields(Mt._readField,{header_length:0,x:0,y:0,z:0,layers:[]},e)}
7,_readField:function(t,e,i){t===1?e.header_length=i.readFixed32():t===2?e.x=i.readVarint():t===3?e.y=i.readVarint():t===4?e.z=i.readVarint():t===5&&e.layers.push(Mt.Layer.read(i,i.readVarint()+i.pos))},PixelFormat:{PIXEL_FORMAT_UNKNOWN:{value:0,options:{}},PIXEL_FORMAT_UINT32:{value:1,options:{}},PIXEL_FORMAT_UINT16:{value:2,options:{}},PIXEL_FORMAT_UINT8:{value:3,options:{}}},Filter:{}};Mt.Filter.read=function(t,e){return t.readFields(Mt.Filter._readField,{delta_filter:null,filter:null,zigzag_filter:null,bitshuffle_filter:null,byteshuffle_filter:null},e)},Mt.Filter._readField=function(t,e,i){t===1?(e.delta_filter=Mt.Filter.Delta.read(i,i.readVarint()+i.pos),e.filter="delta_filter"):t===2?(e.zigzag_filter=Mt.Filter.Zigzag.read(i,i.readVarint()+i.pos),e.filter="zigzag_filter"):t===3?(e.bitshuffle_filter=Mt.Filter.BitShuffle.read(i,i.readVarint()+i.pos),e.filter="bitshuffle_filter"):t===4&&(e.byteshuffle_filter=Mt.Filter.ByteShuffle.read(i,i.readVarint()+i.pos),e.filter="byteshuffle_filter")},Mt.Filter.Delta={},Mt.Filter.Delta.read=function(t,e){return t.readFields(Mt.Filter.Delta._readField,{block_size:0},e)},Mt.Filter.Delta._readField=function(t,e,i){t===1&&(e.block_size=i.readVarint())},Mt.Filter.Zigzag={},Mt.Filter.Zigzag.read=function(t,e){return t.readFields(Mt.Filter.Zigzag._readField,{},e)},Mt.Filter.Zigzag._readField=function(t,e,i){},Mt.Filter.BitShuffle={},Mt.Filter.BitShuffle.read=function(t,e){return t.readFields(Mt.Filter.BitShuffle._readField,{},e)},Mt.Filter.BitShuffle._readField=function(t,e,i){},Mt.Filter.ByteShuffle={},Mt.Filter.ByteShuffle.read=function(t,e){return t.readFields(Mt.Filter.ByteShuffle._readField,{},e)},Mt.Filter.ByteShuffle._readField=function(t,e,i){},Mt.Codec={},Mt.Codec.read=function(t,e){return t.readFields(Mt.Codec._readField,{gzip_data:null,codec:null,jpeg_image:null,webp_image:null,png_image:null},e)},Mt.Codec._readField=function(t,e,i){t===1?(e.gzip_data=Mt.Codec.GzipData.read(i,i.readVarint()+i.pos),e.codec="gzip_data"):t===2?(e.jpeg_image=Mt.Codec.JpegImage.read(i,i.readVarint()+i.pos),e.codec="jpeg_image"):t===3?(e.webp_image=Mt.Codec.WebpImage.read(i,i.readVarint()+i.pos),e.codec="webp_image"):t===4&&(e.png_image=Mt.Codec.PngImage.read(i,i.readVarint()+i.pos),e.codec="png_image")},Mt.Codec.GzipData={},Mt.Codec.GzipData.read=function(t,e){return t.readFields(Mt.Codec.GzipData._readField,{},e)},Mt.Codec.GzipData._readField=function(t,e,i){},Mt.Codec.JpegImage={},Mt.Codec.JpegImage.read=function(t,e){return t.readFields(Mt.Codec.JpegImage._readField,{},e)},Mt.Codec.JpegImage._readField=function(t,e,i){},Mt.Codec.WebpImage={},Mt.Codec.WebpImage.read=function(t,e){return t.readFields(Mt.Codec.WebpImage._readField,{},e)},Mt.Codec.WebpImage._readField=function(t,e,i){},Mt.Codec.PngImage={},Mt.Codec.PngImage.read=function(t,e){return t.readFields(Mt.Codec.PngImage._readField,{},e)},Mt.Codec.PngImage._readField=function(t,e,i){},Mt.DataIndexEntry={},Mt.DataIndexEntry.read=function(t,e){return t.readFields(Mt.DataIndexEntry._readField,{first_byte:0,last_byte:0,filters:[],codec:null,offset:0,scale:0,bands:[]},e)},Mt.DataIndexEntry._readField=function(t,e,i){t===1?e.first_byte=i.readFixed64():t===2?e.last_byte=i.readFixed64():t===3?e.filters.push(Mt.Filter.read(i,i.readVarint()+i.pos)):t===4?e.codec=Mt.Codec.read(i,i.readVarint()+i.pos):t===5?e.offset=i.readFloat():t===6?e.scale=i.readFloat():t===7&&e.bands.push(i.readString())},Mt.Layer={},Mt.Layer.read=function(t,e){return t.readFields(Mt.Layer._readField,{version:0,name:"",units:"",tilesize:0,buffer:0,pixel_format:0,data_index:[]},e)},Mt.Layer._readField=function(t,e,i){t===1?e.version=i.readVarint():t===2?e.name=i.readString():t===3?e.units=i.readString():t===4?e.tilesize=i.readVarint():t===5?e.buffer=i.readVarint():t===6?e.pixel_format=i.readVarint():t===7&&e.data_index.push(Mt.DataIndexEntry.read(i,i.readVarint()+i.pos))};const jn={read:function(t,e){return t.readFields(jn._readField,{uint32_values:null,values:null,fixed32_values:null},e)},_readField:function(t,e,i){t===2?(e.uint32_values=jn.Uint32Values.read(i,i.readVarint()+i.pos),e.values="uint32_values"):t===3&&(e.fixed32_values=jn.Fixed32Values.read(i,i.readVarint()+i.pos),e.values="fixed32_values")},Uint32Values:{}};jn.Uint32Values.read=function(t,e){return t.readFields(jn.Uint32Values._readField,{values:[]},e)}
7,jn.Uint32Values._readField=function(t,e,i){t===1&&(e.readValuesInto=function(n){if(n.type!==2)throw new Error(`Unsupported pbf type "${n.type}"`);const s=function(h){return h.type===2?h.readVarint()+h.pos:h.pos+1}(n),l=n.pos;return n.pos=s,function(h){n.pos=l;let f=0;for(;n.pos<s;){const m=n.readVarint();h[f++]=m}return h}}(i))},jn.Fixed32Values={},jn.Fixed32Values.read=function(t,e){return t.readFields(jn.Fixed32Values._readField,{values:[]},e)},jn.Fixed32Values._readField=function(t,e,i){throw new Error("Not implemented")};/** 8 * tiny-lru 9 * 10 * @copyright 2023 Jason Mulligan <[email protected]> 11 * @license BSD-3-Clause 12 * @version 11.2.5 13 */class o1{constructor(e=0,i=0,n=!1){this.first=null,this.items=Object.create(null),this.last=null,this.max=e,this.resetTtl=n,this.size=0,this.ttl=i}clear(){return this.first=null,this.items=Object.create(null),this.last=null,this.size=0,this}delete(e){if(this.has(e)){const i=this.items[e];delete this.items[e],this.size--,i.prev!==null&&(i.prev.next=i.next),i.next!==null&&(i.next.prev=i.prev),this.first===i&&(this.first=i.next),this.last===i&&(this.last=i.prev)}return this}entries(e=this.keys()){return e.map(i=>[i,this.get(i)])}evict(e=!1){if(e||this.size>0){const i=this.first;delete this.items[i.key],--this.size==0?(this.first=null,this.last=null):(this.first=i.next,this.first.prev=null)}return this}expiresAt(e){let i;return this.has(e)&&(i=this.items[e].expiry),i}get(e){let i;if(this.has(e)){const n=this.items[e];this.ttl>0&&n.expiry<=Date.now()?this.delete(e):(i=n.value,this.set(e,i,!0))}return i}has(e){return e in this.items}keys(){const e=[];let i=this.first;for(;i!==null;)e.push(i.key),i=i.next;return e}set(e,i,n=!1,s=this.resetTtl){let l;if(n||this.has(e)){if(l=this.items[e],l.value=i,n===!1&&s&&(l.expiry=this.ttl>0?Date.now()+this.ttl:this.ttl),this.last!==l){const h=this.last,f=l.next,m=l.prev;this.first===l&&(this.first=l.next),l.next=null,l.prev=this.last,h.next=l,m!==null&&(m.next=f),f!==null&&(f.prev=m)}}else this.max>0&&this.size===this.max&&this.evict(!0),l=this.items[e]={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:e,prev:this.last,next:null,value:i},++this.size==1?this.first=l:this.last.next=l;return this.last=l,this}values(e=this.keys()){return e.map(i=>this.get(i))}}function s1(t,e){if(e.length!==4)throw new Error(`Expected data of dimension 4 but got ${e.length}.`);let i=e[3];for(let n=2;n>=1;n--){const s=n===1?1:0,l=n===2?1:0;for(let h=0;h<e[0];h++){const f=e[1]*h;for(let m=s;m<e[1];m++){const _=e[2]*(m+f);for(let y=l;y<e[2];y++){const v=e[3]*(y+_);for(let w=0;w<e[3];w++){const E=v+w;t[E]+=t[E-i]}}}}i*=e[n]}return t}function a1(t){for(let e=0,i=t.length;e<i;e++)t[e]=t[e]>>>1^-(1&t[e]);return t}function l1(t,e){switch(e){case"uint32":return t;case"uint16":for(let i=0;i<t.length;i+=2){const n=t[i],s=t[i+1];t[i]=(240&n)>>4|(61440&n)>>8|(240&s)<<4|61440&s,t[i+1]=15&n|(3840&n)>>4|(15&s)<<8|(3840&s)<<4}return t;case"uint8":for(let i=0;i<t.length;i+=4){const n=t[i],s=t[i+1],l=t[i+2],h=t[i+3];t[i+0]=(192&n)>>6|(192&s)>>4|(192&l)>>2|192&h,t[i+1]=(48&n)>>4|(48&s)>>2|48&l|(48&h)<<2,t[i+2]=(12&n)>>2|12&s|(12&l)<<2|(12&h)<<4,t[i+3]=3&n|(3&s)<<2|(3&l)<<4|(3&h)<<6}return t;default:throw new Error(`Invalid pixel format, "${e}"`)}}class Fs extends Error{constructor(e){super(e),this.name="MRTError"}}var pn=Uint8Array,Zl=Uint16Array,c1=Int32Array,My=new pn([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Ey=new pn([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),u1=new pn([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Sy=function(t,e){for(var i=new Zl(31),n=0;n<31;++n)i[n]=e+=1<<t[n-1];var s=new c1(i[30]);for(n=1;n<30;++n)for(var l=i[n];l<i[n+1];++l)s[l]=l-i[n]<<5|n;return{b:i,r:s}},Ay=Sy(My,2),Iy=Ay.b,h1=Ay.r;Iy[28]=258,h1[258]=28;for(var d1=Sy(Ey,0).b,Ep=new Zl(32768),Gi=0;Gi<32768;++Gi){var ql=(43690&Gi)>>1|(21845&Gi)<<1;Ep[Gi]=((65280&(ql=(61680&(ql=(52428&ql)>>2|(13107&ql)<<2))>>4|(3855&ql)<<4))>>8|(255&ql)<<8)>>1}var Wu=function(t,e,i){for(var n=t.length,s=0,l=new Zl(e);s<n;++s)t[s]&&++l[t[s]-1];var h,f=new Zl(e);for(s=1;s<e;++s)f[s]=f[s-1]+l[s-1]<<1;if(i){h=new Zl(1<<e);var m=15-e;for(s=0;s<n;++s)if(t[s])for(var _=s<<4|t[s],y=e-t[s],v=f[t[s]-1]++<<y,w=v|(1<<y)-1;v<=w;++v)h[Ep[v]>
vendor: 17,031 bytes, line 13
13>m]=_}else for(h=new Zl(n),s=0;s<n;++s)t[s]&&(h[s]=Ep[f[t[s]-1]++]>>15-t[s]);return h},Hu=new pn(288);for(Gi=0;Gi<144;++Gi)Hu[Gi]=8;for(Gi=144;Gi<256;++Gi)Hu[Gi]=9;for(Gi=256;Gi<280;++Gi)Hu[Gi]=7;for(Gi=280;Gi<288;++Gi)Hu[Gi]=8;var Cy=new pn(32);for(Gi=0;Gi<32;++Gi)Cy[Gi]=5;var f1=Wu(Hu,9,1),p1=Wu(Cy,5,1),Sp=function(t){for(var e=t[0],i=1;i<t.length;++i)t[i]>e&&(e=t[i]);return e},Gn=function(t,e,i){var n=e/8|0;return(t[n]|t[n+1]<<8)>>(7&e)&i},Ap=function(t,e){var i=e/8|0;return(t[i]|t[i+1]<<8|t[i+2]<<16)>>(7&e)},m1=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],Zn=function(t,e,i){var n=new Error(e||m1[t]);if(n.code=t,Error.captureStackTrace&&Error.captureStackTrace(n,Zn),!i)throw n;return n},_1=new pn(0),g1=typeof TextDecoder<"u"&&new TextDecoder;try{g1.decode(_1,{stream:!0})}catch{}const y1={gzip_data:"gzip"},x1={0:"uint32",1:"uint32",2:"uint16",3:"uint8"},v1={uint32:1,uint16:2,uint8:4},b1={uint32:Uint32Array,uint16:Uint16Array,uint8:Uint8Array};class Py{constructor(e=1){this.x=NaN,this.y=NaN,this.z=NaN,this.layers={},this._cacheSize=e}getLayer(e){return this.layers[e]}getHeaderLength(e){const i=new Uint8Array(e),n=new DataView(e);if(i[0]!==13)throw new Fs("File is not a valid MRT.");return n.getUint32(1,!0)}parseHeader(e){const i=new Uint8Array(e),n=this.getHeaderLength(e);if(i.length<n)throw new Fs(`Expected header with length >= ${n} but got buffer of length ${i.length}`);const s=new kl(i.subarray(0,n)),l=Mt.read(s);if(!isNaN(this.x)&&(this.x!==l.x||this.y!==l.y||this.z!==l.z))throw new Fs(`Invalid attempt to parse header ${l.z}/${l.x}/${l.y} for tile ${this.z}/${this.x}/${this.y}`);this.x=l.x,this.y=l.y,this.z=l.z;for(const h of l.layers)this.layers[h.name]=new w1(h,{cacheSize:this._cacheSize});return this}createDecodingTask(e){const i=[],n=this.getLayer(e.layerName);for(let s=0;s<n.dataIndex.length;s++){const l=n.dataIndex[s],h=l.first_byte-e.firstByte,f=l.last_byte+1-e.firstByte;if(s<e.firstBlock||s>e.lastBlock||n._blocksInProgress.has(s))continue;const m={layerName:n.name,firstByte:h,lastByte:f,pixelFormat:n.pixelFormat,blockIndex:s,blockShape:[l.bands.length].concat(n.bandShape),buffer:n.buffer,codec:l.codec.codec,filters:l.filters.map(_=>_.filter)};n._blocksInProgress.add(s),i.push(m)}return new zy(i,()=>{i.forEach(s=>n._blocksInProgress.delete(s.blockIndex))},(s,l)=>{if(i.forEach(h=>n._blocksInProgress.delete(h.blockIndex)),s)throw s;l.forEach(h=>{this.getLayer(h.layerName).processDecodedData(h)})})}}class w1{constructor({version:e,name:i,units:n,tilesize:s,pixel_format:l,buffer:h,data_index:f},m){if(this.version=e,this.version!==1)throw new Fs(`Cannot parse raster layer encoded with MRT version ${e}`);this.name=i,this.units=n,this.tileSize=s,this.buffer=h,this.pixelFormat=x1[l],this.dataIndex=f,this.bandShape=[s+2*h,s+2*h,v1[this.pixelFormat]],this._decodedBlocks=function(_=1e3,y=0,v=!1){if(isNaN(_)||_<0)throw new TypeError("Invalid max value");if(isNaN(y)||y<0)throw new TypeError("Invalid ttl value");if(typeof v!="boolean")throw new TypeError("Invalid resetTtl value");return new o1(_,y,v)}(m?m.cacheSize:5),this._blocksInProgress=new Set}processDecodedData(e){const i=e.blockIndex.toString();this._decodedBlocks.get(i)||this._decodedBlocks.set(i,e.data)}getBlockForBand(e){let i=0;switch(typeof e){case"string":for(const[n,s]of this.dataIndex.entries()){for(const[l,h]of s.bands.entries())if(h===e)return{bandIndex:i+l,blockIndex:n,blockBandIndex:l};i+=s.bands.length}break;case"number":for(const[n,s]of this.dataIndex.entries()){if(e>=i&&e<i+s.bands.length)return{bandIndex:e,blockIndex:n,blockBandIndex:e-i};i+=s.bands.length}break;default:throw new Fs(`Invalid band \`${JSON.stringify(e)}\`. Expected string or integer.`)}throw new Fs(`Band not found: ${JSON.stringify(e)}`)}getDataRange(e){let i=1/0,n=-1/0,s=1/0,l=-1/0;for(const h of e){const{blockIndex:f}=this.getBlockForBand(h);if(f<0)throw new Fs(`Invalid band: ${JSON.stringify(h)}`);const m=this.dataIndex[f];s=Math.min(s,f),l=Math.max(l,f),i=Math.min(i,m.first_byte),n=Math.max(n,m.last_byte)}return{layerName:this.name,firstByte:i,lastByte:n,firstBlock:s,lastBlock:l}}hasBand(e){const{blockIndex:i}=this.getBlockForBand(e);return i>=0}hasDataForBand(e){const{blockIndex:i}=this.getBlockForBand(e);return i>=0&&!!this._decodedBlocks.get(i.toString())}getBandView(e){const{blockIndex:i,blockBandIndex:n}=this.getBlockForBand(e),s=this._decodedBlocks.get(i.toString());if(!s)throw new Fs(`Data for band ${JSON.stringify(e)} of layer "${this.name}" not decoded.`);const l=this.dataIndex[i],h=this.bandShape.reduce((_,y)=>_*y,1),f=n*h,m=s.subarray(f,f+h);return{data:m,bytes:new Uint8Array(m.buffer).subarray(m.byteOffset,m.byteOffset+m.byteLength),tileSize:this.tileSize,buffer:this.buffer,offset:l.offset,scale:l.scale}}}class zy{constructor(e,i,n){this.tasks=e,this._onCancel=i,this._onComplete=n,this._finalized=!1}cancel(){this._finalized||(this._onCancel(),this._finalized=!0)}complete(e,i){this._finalized||(this._onComplete(e,i),this._finalized=!0)}}Py.performDecoding=function(t,e){return Promise.all(e.tasks.map(i=>{const{layerName:n,firstByte:s,lastByte:l,pixelFormat:h,blockShape:f,blockIndex:m,filters:_,codec:y}=i,v=new Uint8Array(t).subarray(s,l+1),w=new Uint32Array(f[0]*f[1]*f[2]);let E;if(y!=="gzip_data")throw new Error(`Unhandled codec: ${y}`);return E=function(A,I){if(!globalThis.DecompressionStream&&I==="gzip_data")return Promise.resolve(((G=function(W){W[0]==31&&W[1]==139&&W[2]==8||Zn(6,"invalid gzip data");var J=W[3],ie=10;4&J&&(ie+=2+(W[10]|W[11]<<8));for(var oe=(J>>3&1)+(J>>4&1);oe>0;oe-=!W[ie++]);return ie+(2&J)}(N=A))+8>N.length&&Zn(6,"invalid gzip data"),function(W,J,ie,oe){var ue=W.length;if(!ue||J.f&&!J.l)return ie||new pn(0);var se=!ie,_e=se||J.i!=2,Me=J.i;se&&(ie=new pn(3*ue));var pe=function(Lr){var Mr=ie.length;if(Lr>Mr){var mn=new pn(Math.max(2*Mr,Lr));mn.set(ie),ie=mn}},we=J.f||0,de=J.p||0,be=J.b||0,Fe=J.l,Se=J.d,Qe=J.m,He=J.n,Ce=8*ue;do{if(!Fe){we=Gn(W,de,1);var pt=Gn(W,de+1,3);if(de+=3,!pt){var st=W[(Jt=4+((de+7)/8|0))-4]|W[Jt-3]<<8,Je=Jt+st;if(Je>ue){Me&&Zn(0);break}_e&&pe(be+st),ie.set(W.subarray(Jt,Je),be),J.b=be+=st,J.p=de=8*Je,J.f=we;continue}if(pt==1)Fe=f1,Se=p1,Qe=9,He=5;else if(pt==2){var Pe=Gn(W,de,31)+257,ht=Gn(W,de+10,15)+4,It=Pe+Gn(W,de+5,31)+1;de+=14;for(var mt=new pn(It),Ct=new pn(19),xt=0;xt<ht;++xt)Ct[u1[xt]]=Gn(W,de+3*xt,7);de+=3*ht;var jt=Sp(Ct),wt=(1<<jt)-1,mi=Wu(Ct,jt,1);for(xt=0;xt<It;){var Jt,ei=mi[Gn(W,de,wt)];if(de+=15&ei,(Jt=ei>>4)<16)mt[xt++]=Jt;else{var si=0,Qt=0;for(Jt==16?(Qt=3+Gn(W,de,3),de+=2,si=mt[xt-1]):Jt==17?(Qt=3+Gn(W,de,7),de+=3):Jt==18&&(Qt=11+Gn(W,de,127),de+=7);Qt--;)mt[xt++]=si}}var Ai=mt.subarray(0,Pe),ui=mt.subarray(Pe);Qe=Sp(Ai),He=Sp(ui),Fe=Wu(Ai,Qe,1),Se=Wu(ui,He,1)}else Zn(1);if(de>Ce){Me&&Zn(0);break}}_e&&pe(be+131072);for(var Bi=(1<<Qe)-1,Yi=(1<<He)-1,hr=de;;hr=de){var Mi=(si=Fe[Ap(W,de)&Bi])>>4;if((de+=15&si)>Ce){Me&&Zn(0);break}if(si||Zn(2),Mi<256)ie[be++]=Mi;else{if(Mi==256){hr=de,Fe=null;break}var Di=Mi-254;Mi>264&&(Di=Gn(W,de,(1<<(or=My[xt=Mi-257]))-1)+Iy[xt],de+=or);var rr=Se[Ap(W,de)&Yi],nr=rr>>4;if(rr||Zn(3),de+=15&rr,ui=d1[nr],nr>3){var or=Ey[nr];ui+=Ap(W,de)&(1<<or)-1,de+=or}if(de>Ce){Me&&Zn(0);break}_e&&pe(be+131072);var vi=be+Di;if(be<ui){var Yr=0-ui,Ns=Math.min(ui,vi);for(Yr+be<0&&Zn(3);be<Ns;++be)ie[be]=oe[Yr+be]}for(;be<vi;++be)ie[be]=ie[be-ui]}}J.l=Fe,J.p=hr,J.b=be,J.f=we,Fe&&(we=1,J.m=Qe,J.d=Se,J.n=He)}while(!we);return be!=ie.length&&se?function(Lr,Mr,mn){return(Mr==null||Mr<0)&&(Mr=0),(mn==null||mn>Lr.length)&&(mn=Lr.length),new pn(Lr.subarray(Mr,mn))}(ie,0,be):ie.subarray(0,be)}(N.subarray(G,-8),{i:2},new pn(((z=N)[(L=z.length)-4]|z[L-3]<<8|z[L-2]<<16|z[L-1]<<24)>>>0),void 0)));var z,L,N,G;const j=y1[I];if(!j)throw new Error(`Unhandled codec: ${I}`);const X=new globalThis.DecompressionStream(j);return new Response(new Blob([A]).stream().pipeThrough(X)).arrayBuffer().then(W=>new Uint8Array(W))}(v,y).then(A=>{const I=jn.read(new kl(A));if(I.values==="uint32_values")return I.uint32_values.readValuesInto(w),new b1[h](w.buffer);throw new Error(`Unhandled numeric data "${I.values}"`)}),E.then(A=>{for(let I=_.length-1;I>=0;I--)switch(_[I]){case"delta_filter":s1(A,f);break;case"zigzag_filter":a1(A);break;case"bitshuffle_filter":l1(A,h);break;default:throw new Error(`Unhandled filter "${_[I]}"`)}return{layerName:n,blockIndex:m,data:A}}).catch(A=>{throw A})}))},Ke(zy,"MRTDecodingBatch",{omit:["_onCancel","_onComplete"]});const Dy=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class Ip{static from(e){if(!(e instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[i,n]=new Uint8Array(e,0,2);if(i!==219)throw new Error("Data does not appear to be in a KDBush format.");const s=n>>4;if(s!==1)throw new Error(`Got v${s} data when expected v1.`);const l=Dy[15&n];if(!l)throw new Error("Unrecognized array type.");const[h]=new Uint16Array(e,2,1),[f]=new Uint32Array(e,4,1);return new Ip(f,h,l,e)}constructor(e,i=64,n=Float64Array,s){if(isNaN(e)||e<0)throw new Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+i,2),65535),this.ArrayType=n,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;const l=Dy.indexOf(this.ArrayType),h=2*e*this.ArrayType.BYTES_PER_ELEMENT,f=e*this.IndexArrayType.BYTES_PER_ELEMENT,m=(8-f%8)%8;if(l<0)throw new Error(`Unexpected typed array class: ${n}.`);s&&s instanceof ArrayBuffer?(this.data=s,this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+f+m,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+h+f+m),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+f+m,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+l]),new Uint16Array(this.data,2,1)[0]=i,new Uint32Array(this.data,4,1)[0]=e)}add(e,i){const n=this._pos>>1;return this.ids[n]=n,this.coords[this._pos++]=e,this.coords[this._pos++]=i,n}finish(){const e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return Cp(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,i,n,s){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:l,coords:h,nodeSize:f}=this,m=[0,l.length-1,0],_=[];for(;m.length;){const y=m.pop()||0,v=m.pop()||0,w=m.pop()||0;if(v-w<=f){for(let z=w;z<=v;z++){const L=h[2*z],N=h[2*z+1];L>=e&&L<=n&&N>=i&&N<=s&&_.push(l[z])}continue}const E=w+v>>1,A=h[2*E],I=h[2*E+1];A>=e&&A<=n&&I>=i&&I<=s&&_.push(l[E]),(y===0?e<=A:i<=I)&&(m.push(w),m.push(E-1),m.push(1-y)),(y===0?n>=A:s>=I)&&(m.push(E+1),m.push(v),m.push(1-y))}return _}within(e,i,n){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:s,coords:l,nodeSize:h}=this,f=[0,s.length-1,0],m=[],_=n*n;for(;f.length;){const y=f.pop()||0,v=f.pop()||0,w=f.pop()||0;if(v-w<=h){for(let z=w;z<=v;z++)Ry(l[2*z],l[2*z+1],e,i)<=_&&m.push(s[z]);continue}const E=w+v>>1,A=l[2*E],I=l[2*E+1];Ry(A,I,e,i)<=_&&m.push(s[E]),(y===0?e-n<=A:i-n<=I)&&(f.push(w),f.push(E-1),f.push(1-y)),(y===0?e+n>=A:i+n>=I)&&(f.push(E+1),f.push(v),f.push(1-y))}return m}}function Cp(t,e,i,n,s,l){if(s-n<=i)return;const h=n+s>>1;Ly(t,e,h,n,s,l),Cp(t,e,i,n,h-1,1-l),Cp(t,e,i,h+1,s,1-l)}function Ly(t,e,i,n,s,l){for(;s>n;){if(s-n>600){const _=s-n+1,y=i-n+1,v=Math.log(_),w=.5*Math.exp(2*v/3),E=.5*Math.sqrt(v*w*(_-w)/_)*(y-_/2<0?-1:1);Ly(t,e,i,Math.max(n,Math.floor(i-y*w/_+E)),Math.min(s,Math.floor(i+(_-y)*w/_+E)),l)}const h=e[2*i+l];let f=n,m=s;for(Xu(t,e,n,i),e[2*s+l]>h&&Xu(t,e,n,s);f<m;){for(Xu(t,e,f,m),f++,m--;e[2*f+l]<h;)f++;for(;e[2*m+l]>h;)m--}e[2*n+l]===h?Xu(t,e,n,m):(m++,Xu(t,e,m,s)),m<=i&&(n=m+1),i<=m&&(s=m-1)}}function Xu(t,e,i,n){Pp(t,i,n),Pp(e,2*i,2*n),Pp(e,2*i+1,2*n+1)}function Pp(t,e,i){const n=t[e];t[e]=t[i],t[i]=n}function Ry(t,e,i,n){const s=t-i,l=e-n;return s*s+l*l}a.$=Bg,a.A=hl,a.B=Gc,a.C=Gt,a.D=le,a.E=rs,a.F=Ci,a.G=Oe,a.H=class{constructor(t){this.specification=t}possiblyEvaluate(t,e){return Sn(t.expression.evaluate(e))}interpolate(t,e,i){return{x:Ut(t.x,e.x,i),y:Ut(t.y,e.y,i),z:Ut(t.z,e.z,i),azimuthal:Ut(t.azimuthal,e.azimuthal,i),polar:Ut(t.polar,e.polar,i)}}},a.I=np,a.J=Ln,a.K=Ii,a.L=Yt,a.M=class{constructor(t,e,i,n){this.id=t,this.position=e!=null?new ne(e[0],e[1]):new ne(0,0),this.orientation=i??[0,0,0],this.nodes=n,this.uploaded=!1,this.aabb=new Ri([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),this.matrix=[]}_applyTransformations(t,e){if(a.a6.multiply(t.matrix,e,t.matrix),t.meshes)for(const i of t.meshes){const n=Ri.applyTransform(i.aabb,t.matrix);this.aabb.encapsulate(n)}if(t.children)for(const i of t.children)this._applyTransformations(i,t.matrix)}computeBoundsAndApplyParent(){const t=a.a6.identity([]);for(const e of this.nodes)this._applyTransformations(e,t)}computeModelMatrix(t,e,i,n,s,l,h=!1){iy(this.matrix,this,t.transform,this.position,e,i,n,s,l,h)}upload(t){if(!this.uploaded){for(const e of this.nodes)gp(e,t);for(const e of this.nodes)Od(e);this.uploaded=!0}}destroy(){for(const t of this.nodes)yp(t)}},a.O=Jo,a.P=Ue,a.Q=da,a.R=Er,a.S=Cs,a.T=fp,a.U=Ut,a.V=qe,a.W=Ju,a.X=class{constructor(t){this.specification=t}possiblyEvaluate(t,e){return function([i,n]){const s=Sn([1,i,n]);return{x:s.x,y:s.y,z:s.z}}(t.expression.evaluate(e))}interpolate(t,e,i){return{x:Ut(t.x,e.x,i),y:Ut(t.y,e.y,i),z:Ut(t.z,e.z,i)}}},a.Y=function(t,e,i=0,n=!0){const s=new Ue(i,i),l=t.sub(s),h=e.add(s),f=[l,new Ue(h.x,l.y),h,new Ue(l.x,h.y)];return n&&f.push(l.clone()),f},a.Z=la,a._=function(t,e){const i=[];for(let n=0;n<t.length;n++){const s=Hn(n-1,-1,t.length-1),l=Hn(n+1,-1,t.length-1),h=t[n],f=t[l],m=t[s].sub(h).unit(),_=f.sub(h).unit(),y=_.angleWithSep(m.x,m.y),v=m.add(_).unit().mult(-1*e/Math.sin(y/2));i.push(h.add(v))}return i},a.a=Yl,a.a$=function(t){const e=[];for(const i in t)e.push(t[i]);return e},a.a0=Fp,a.a1=function(t,e,i=0){return a.N.fromValues(((e.x-i)*t.scale-t.x)*qe,(e.y*t.scale-t.y)*qe,_i(e.z,e.y))},a.a2=Lf,a.a3=tg,a.a4=function(t){let e=1/0,i=1/0,n=-1/0,s=-1/0;for(const l of t)e=Math.min(e,l.x),i=Math.min(i,l.y),n=Math.max(n,l.x),s=Math.max(s,l.y);return{min:new Ue(e,i),max:new Ue(n,s)}},a.a5=Et,a.a8=On,a.a9=ii,a.aA=_h,a.aB=Oi,a.aC=Qo,a.aD=Dh,a.aE=Cd,a.aF=function(){Nr.isLoading()||Nr.isLoaded()||uo()!=="deferred"||tu()},a.aG=Vr,a.aH=Hi,a.aI=_y,a.aJ=Ao,a.aK=Jf,a.aL=Xf,a.aM=er,a.aN=cn,a.aO=mu,a.aP=r_,a.aQ=ad,a.aR=dp,a.aS=function(t,e){const i=Cs(e.zoom);if(i===0)return xo(t);const n=ed(t),s=Bf(n),l=Et(n.getWest())*e.worldSize,h=Et(n.getEast())*e.worldSize,f=gt(n.getNorth())*e.worldSize,m=gt(n.getSouth())*e.worldSize,_=[l,f,0],y=[h,f,0],v=[l,m,0],w=[h,m,0],E=a.a6.invert([],e.globeMatrix);return a.N.transformMat4(_,_,E),a.N.transformMat4(y,y,E),a.N.transformMat4(v,v,E),a.N.transformMat4(w,w,E),s[0]=Ho(s[0],v,i),s[1]=Ho(s[1],w,i),s[2]=Ho(s[2],y,i),s[3]=Ho(s[3],_,i),Ri.fromPoints(s)},a.aT=id,a.aU=Mu,a.aV=Ho,a.aW=wr,a.aX=g0,a.aY=Eo,a.aZ=Py,a.a_=ve,a.aa=Dt,a.ab=V,a.ac=function(t,e){const i={};for(let n=0;n<e.length;n++){const s=e[n];s in t&&(i[s]=t[s])}return i},a.ad=he,a.ae=gt,a.af=class{constructor(t){this.entries={},this.scheduler=t}request(t,e,i,n){const s=this.entries[t]=this.entries[t]||{callbacks:[]};if(s.result){const[l,h]=s.result;return this.scheduler?this.scheduler.add(()=>{n(l,h)},e):n(l,h),()=>{}}return s.callbacks.push(n),s.cancel||(s.cancel=i((l,h)=>{s.result=[l,h];for(const f of s.callbacks)this.scheduler?this.scheduler.add(()=>{f(l,h)},e):f(l,h);setTimeout(()=>delete this.entries[t],3e3)})),()=>{s.result||(s.callbacks=s.callbacks.filter(l=>l!==n),s.callbacks.length||(s.cancel(),delete this.entries[t]))}}},a.ag=au,a.ah=function(t,e,i){const n=JSON.stringify(t.request);return t.data&&(this.deduped.entries[n]={result:[null,t.data]}),this.deduped.request(n,{type:"parseTile",isSymbolTile:t.isSymbolTile,zoom:t.tileZoom},s=>{const l=ve(t.request,(h,f,m,_)=>{h?s(h):f&&s(null,{vectorTile:i?void 0:new Yf(new kl(f)),rawData:f,cacheControl:m,expires:_})});return()=>{l.cancel(),s()}},e)},a.ai=function(t){ai++,ai>rt&&(t.getActor().send("enforceCacheSizeLimit",xe),ai=0)},a.aj=qi,a.ak=Ee,a.al=function(t){return t<=1?1:Math.pow(2,Math.floor(Math.log(t)/Math.LN2))},a.am=Le,a.an=$g,a.ao=Wg,a.ap=qg,a.aq=function(t,e){const i=document.createElement("video");i.muted=!0,i.onloadstart=function(){e(null,i)};for(let n=0;n<t.length;n++){const s=document.createElement("source");De(t[n])||(i.crossOrigin="Anonymous"),s.src=t[n],i.appendChild(s)}return{cancel:()=>{}}},a.ar=zd,a.as=Ou,a.at=vt,a.au=Zt,a.av=Rn,a.aw=Ji,a.ax=ji,a.ay=li,a.az=jo,a.b=Io,a.b$=Ah,a.b0=function(t,e){const i=[];for(const n in t)n in e||i.push(n);return i},a.b1=tn,a.b2=["type","source","source-layer","minzoom","maxzoom","filter","layout"],a.b3=function(t,e){const{x:i,y:n}=t.point,s=c_(i,n,t.worldSize/t._pixelsPerMercatorPixel,0,0);
13return a.a6.multiply(s,s,Ff(xo(e)))},a.b5=Dl,a.b6=fn,a.b7=md,a.b8=function(t,e,i,n,s){const l=5*e+2;t.float32[l+0]=i,t.float32[l+1]=n,t.float32[l+2]=s},a.b9=Id,a.bA=Rd,a.bB=Hg,a.bC=function(t){const e=Hg(t,!0);return a.b4.invert([],[e[0],e[1],e[4],e[5]])},a.bD=Rf,a.bE=function(t){const{x:e,y:i}=t.point,{lng:n,lat:s}=t._center;return c_(e,i,t.worldSize,n,s)},a.bF=dr,a.bG=q,a.bH=function(t){const e=Math.round((t+45+360)%360/90)%4;return ja[e]},a.bI=45,a.bJ=at,a.bK=u,a.bL=mo,a.bM=Wh,a.bN=gr,a.bO=Ml,a.bP=c,a.bQ=function(t,e,i){const n=Math.sqrt(t*t+e*e+i*i),s=n>0?Math.acos(i/n)*Us:0;let l=t!==0||e!==0?Math.atan2(-e,-t)*Us+90:0;return l<0&&(l+=360),[n,l,s]},a.bR=Ft,a.bS=Ri,a.bT=Sn,a.bU=function(t){return[Math.pow(t[0],1/2.2),Math.pow(t[1],1/2.2),Math.pow(t[2],1/2.2)]},a.bV=function(t){return t({pluginStatus:Ir,pluginURL:co}),eu.on("pluginStateChange",t),t},a.bW=Ul,a.bX=Bd,a.bY=Bl,a.bZ=op,a.b_=Ui,a.ba=Sg,a.bb=wn,a.bc=mr,a.bd=Lg,a.be=ap,a.bf=rp,a.bg=Ip,a.bh=Hn,a.bj=qt,a.bk=H,a.bl=bt,a.bm=function(t,e,i){t[4*e+0]=i[0],t[4*e+1]=i[1],t[4*e+2]=i[2],t[4*e+3]=i[3]},a.bn=ne,a.bo=jg,a.bp=Re,a.bq=kf,a.br=Xg,a.bs=Ie,a.bt=s_,a.bu=function(t,e,i,n,s,l,h,f,m){if(m.name==="globe")return s_(t,e,new Ie(i,n,s),!1);const _=Ou({z:i,x:n,y:s},m);return new Ri([(l+_.x/_.scale)*e,e*(_.y/_.scale),h],[(l+_.x2/_.scale)*e,e*(_.y2/_.scale),f])},a.bv=function(t,e,i){let n=0;for(let s=0;s<2;++s){const l=i?i[s]:0;t[s]>l&&(n+=(t[s]-l)*(t[s]-l)),e[s]<l&&(n+=(l-e[s])*(l-e[s]))}return n},a.bw=Ot,a.bx=B,a.by=function(t){const e=a.a6.identity(new Float64Array(16));a.a6.multiply(e,t.pixelMatrix,t.globeMatrix);const i=[0,ee,0],n=[0,ce,0];return a.N.transformMat4(i,i,e),a.N.transformMat4(n,n,e),[i[0]>0&&i[0]<=t.width&&i[1]>0&&i[1]<=t.height&&!Vf(t,new ne(t.center.lat,90)),n[0]>0&&n[0]<=t.width&&n[1]>0&&n[1]<=t.height&&!Vf(t,new ne(t.center.lat,-90))]},a.bz=function(t,e){const{scale:i}=t.tileTransform,n=i*qe/(t.tileSize*Math.pow(2,e.zoom-t.tileID.overscaledZ+t.tileID.canonical.z));return a.b4.scale(new Float32Array(4),e.inverseAdjustmentMatrix,[n,n])},a.c=py,a.c$=function(){return!!document.fullscreenElement||!!document.webkitFullscreenElement},a.c0=Wt,a.c1=Or,a.c2=function(t,e,i){return t.type==="custom"?new Sv(t,e):new n1[t.type](t,e,i)},a.c3=function(t){const e=t.indexOf(gl);return e>=0?t.slice(0,e):t},a.c4=function(t){return t.indexOf(gl)>=0},a.c5=function(t){const e=t.indexOf(gl);return e>=0?t.slice(e+1):""},a.c6=function(t){const e=[],i=t.id;return i===void 0&&e.push({message:`layers.${i}: missing required property "id"`}),t.render===void 0&&e.push({message:`layers.${i}: missing required method "render"`}),t.renderingMode&&t.renderingMode!=="2d"&&t.renderingMode!=="3d"&&e.push({message:`layers.${i}: property "renderingMode" must be either "2d" or "3d"`}),e},a.c7=jr,a.c8=eu,a.c9=ge,a.cA=ng,a.cB=(t,e,i,n,s,l)=>{const h=t.transform;return{u_matrix:rg(t,e,i,n),u_texsize:e.imageAtlasTexture?e.imageAtlasTexture.size:[0,0],u_pixels_to_tile_units:h.calculatePixelsToTileUnitsMatrix(e),u_device_pixel_ratio:s,u_image:0,u_tile_units_to_pixels:ig(e,h),u_units_to_pixels:[1/h.pixelsToGLUnits[0],1/h.pixelsToGLUnits[1]],u_alpha_discard_threshold:0,u_trim_offset:l}},a.cC=(t,e,i,n,s,l,h)=>{const f=t.transform,m=f.calculatePixelsToTileUnitsMatrix(e);return{u_matrix:rg(t,e,i,n),u_pixels_to_tile_units:m,u_device_pixel_ratio:l,u_units_to_pixels:[1/f.pixelsToGLUnits[0],1/f.pixelsToGLUnits[1]],u_dash_image:0,u_gradient_image:1,u_image_height:s,u_texsize:og(i)&&e.lineAtlasTexture?e.lineAtlasTexture.size:[0,0],u_tile_units_to_pixels:ig(e,t.transform),u_alpha_discard_threshold:0,u_trim_offset:h,u_emissive_strength:i.paint.get("line-emissive-strength")}},a.cD=Gs,a.cE=Eu,a.cF=X_,a.cG=et,a.cH=pd,a.cI=Ds,a.cJ=450,a.cK=7,a.cL=Tv,a.cM=256,a.cN=Ff,a.cO=po,a.cP=pu,a.cQ=function(t,e,i,n,s){return Dt((t-e)/(i-e)*(s-n)+n,n,s)},a.cR=Bt,a.cS=mp,a.cT=[1,1,1],a.cU=Pl,a.cV=Vl,a.cW=vn,a.cX=class{constructor(){this._updateTime=0,this._sourceIds=[],this._activeRegions=[],this._prevRegions=[]}clear(){this._activeRegions.length>0&&++this._updateTime,this._activeRegions=[],this._prevRegions=[]}get updateTime(){return this._updateTime}getReplacementRegionsForTile(t){const e=I_(new Ue(0,0),new Ue(qe,qe),t),i=[];for(const n of this._activeRegions){if(n.hiddenByOverlap||!A_(e,n))continue;const s=rx(n.min,n.max,t);i.push({min:s.min,max:s.max,sourceId:this._sourceIds[n.priority],footprint:n.footprint,footprintTileId:n.tileId})}return i}
vendor: 4,684 bytes, line 13
13setSources(t){this._setSources(t.map(e=>({getSourceId:()=>e.cache.id,getFootprints:()=>{const i=[];for(const n of e.cache.getVisibleCoordinates()){const s=e.cache.getTile(n).buckets[e.layer];if(s)for(const l of s.getNodesInfo()){const h=l.node;h.footprint&&i.push({footprint:h.footprint,id:n.toUnwrapped()})}}return i}})))}_addSource(t){const e=t.getFootprints();if(e.length!==0){for(const i of e){if(!i.footprint)continue;const n=I_(i.footprint.min,i.footprint.max,i.id);this._activeRegions.push({min:n.min,max:n.max,hiddenByOverlap:!1,priority:this._sourceIds.length,tileId:i.id,footprint:i.footprint})}this._sourceIds.push(t.getSourceId())}}_computeReplacement(){this._activeRegions.sort((e,i)=>e.priority-i.priority||hd(e.min,i.min)||hd(e.max,i.max));let t=this._activeRegions.length!==this._prevRegions.length;if(!t){let e=0,i=0;for(;!t&&e!==this._activeRegions.length;){const n=this._activeRegions[e],s=this._prevRegions[i];t=n.priority!==s.priority||!S_(n,s),++e,++i}}if(t){++this._updateTime;const e=i=>{const n=this._activeRegions;if(i>=n.length)return i;const s=n[i].priority;for(;i<n.length&&n[i].priority===s;)++i;return i};if(this._sourceIds.length>1){let i=0,n=e(i);for(;i!==n;){let s=i;const l=i;for(;s!==n;){const h=this._activeRegions[s];h.hiddenByOverlap=!1;for(let f=0;f<l;f++){const m=this._activeRegions[f];if(!m.hiddenByOverlap&&A_(h,m)&&(h.hiddenByOverlap=P_(h.footprint,h.tileId,m.footprint,m.tileId),h.hiddenByOverlap))break}++s}i=n,n=e(i)}}}}_setSources(t){[this._prevRegions,this._activeRegions]=[this._activeRegions,[]],this._sourceIds=[];for(let e=t.length-1;e>=0;e--)this._addSource(t[e]);this._computeReplacement()}},a.cY=class{constructor(t){this._createGrid(t),this._createPoles(t)}destroy(){this._poleIndexBuffer.destroy(),this._gridBuffer.destroy(),this._gridIndexBuffer.destroy(),this._poleNorthVertexBuffer.destroy(),this._poleSouthVertexBuffer.destroy();for(const t of this._poleSegments)t.destroy();for(const t of this._gridSegments)t.withSkirts.destroy(),t.withoutSkirts.destroy()}_fillGridMeshWithLods(t,e){const i=new cn,n=new Ji,s=[],l=t+1+2,h=e[0]+1,f=e[0]+1+(1+e.length),m=(_,y,v)=>{let w=_===l-1?_-2:_===0?_:_-1;return w+=v?24575:0,[w,y]};for(let _=0;_<l;++_)i.emplaceBack(...m(_,0,!0));for(let _=0;_<h;++_)for(let y=0;y<l;++y)i.emplaceBack(...m(y,_,(y===0||y===l-1)&&!0));for(let _=0;_<e.length;++_){const y=e[_];for(let v=0;v<l;++v)i.emplaceBack(...m(v,y,!0))}for(let _=0;_<e.length;++_){const y=n.length,v=e[_]+1+2,w=new Ji;for(let I=0;I<v-1;I++){const z=I===v-2,L=z?l*(f-e.length+_-I):l;for(let N=0;N<l-1;N++){const G=I*l+N;I===0||z||N===0||N===l-2?(w.emplaceBack(G+1,G,G+L),w.emplaceBack(G+L,G+L+1,G+1)):(n.emplaceBack(G+1,G,G+L),n.emplaceBack(G+L,G+L+1,G+1))}}const E=Oi.simpleSegment(0,y,i.length,n.length-y);for(let I=0;I<w.uint16.length;I+=3)n.emplaceBack(w.uint16[I],w.uint16[I+1],w.uint16[I+2]);const A=Oi.simpleSegment(0,y,i.length,n.length-y);s.push({withoutSkirts:E,withSkirts:A})}return{vertices:i,indices:n,segments:s}}_createGrid(t){const e=this._fillGridMeshWithLods(Y,K);this._gridSegments=e.segments,this._gridBuffer=t.createVertexBuffer(e.vertices,r_.members),this._gridIndexBuffer=t.createIndexBuffer(e.indices,!0)}_createPoles(t){const e=new Ji;for(let h=0;h<=Y;h++)e.emplaceBack(0,h+1,h+2);this._poleIndexBuffer=t.createIndexBuffer(e,!0);const i=new po,n=new po,s=new po,l=new po;this._poleSegments=[];for(let h=0,f=0;h<q;h++){const m=360/(1<<h);i.emplaceBack(0,-V,0,.5,0),n.emplaceBack(0,-V,0,.5,1),s.emplaceBack(0,-V,0,.5,.5),l.emplaceBack(0,-V,0,.5,.5);for(let _=0;_<=Y;_++){let y=_/Y,v=0;const w=Ut(0,m,y),[E,A,I]=re(v0,b0,w,V);i.emplaceBack(E,A,I,y,v),n.emplaceBack(E,A,I,y,1-v);const z=qt(w);y=.5+.5*Math.sin(z),v=.5+.5*Math.cos(z),s.emplaceBack(E,A,I,y,v),l.emplaceBack(E,A,I,y,1-v)}this._poleSegments.push(Oi.simpleSegment(f,0,66,64)),f+=66}this._poleNorthVertexBuffer=t.createVertexBuffer(i,Jh,!1),this._poleSouthVertexBuffer=t.createVertexBuffer(n,Jh,!1),this._texturedPoleNorthVertexBuffer=t.createVertexBuffer(s,Jh,!1),this._texturedPoleSouthVertexBuffer=t.createVertexBuffer(l,Jh,!1)}getGridBuffers(t,e){return[this._gridBuffer,this._gridIndexBuffer,e?this._gridSegments[t].withSkirts:this._gridSegments[t].withoutSkirts]}getPoleBuffers(t,e){return[e?this._texturedPoleNorthVertexBuffer:this._poleNorthVertexBuffer,e?this._texturedPoleSouthVertexBuffer:this._poleSouthVertexBuffer,this._poleIndexBuffer,this._poleSegments[t]]}},a.cZ=function(t){return Yn.has(t)},a.c_=en,a.ca=r,a.cb=class extends kn{constructor(t){super(t),this.current=d}set(t,e,i){if(this.fetchUniformLocation(t,e)){for(let n=0;n<9;n++)if(i[n]!==this.current[n]){this.current=i,this.gl.uniformMatrix3fv(this.location,!1,i);break}}}}
13,a.cc=$e,a.cd=function(t,e,i){const n=Cs(i.zoom),s=t.style.map._antialias,l=e.options.extStandardDerivativesForceOff||t.terrain&&t.terrain.exaggeration()>0;return n===0&&!s&&!l},a.ce=function(t){const e=t.pixelsPerMeter,i=e/bt(1,t.center.lat),n=a.a6.identity(new Float64Array(16));return a.a6.translate(n,n,[t.point.x,t.point.y,0]),a.a6.scale(n,n,[i,i,e]),Float32Array.from(n)},a.cf=ed,a.cg=function(t){const e=Ot-5;t=Dt(t,-e,e)/e*90;const i=Math.pow(Math.abs(Math.sin(qt(t))),3);return Math.round(i*(K.length-1))},a.ch=function(t,e,i,n){const s=e.getNorth(),l=e.getSouth(),h=e.getWest(),f=e.getEast(),m=1<<t.z,_=f-h,y=s-l,v=_/Y,w=-y/K[i],E=[0,v,0,w,0,0,s,h,0];if(t.z>0){const A=180/n;a.co.multiply(E,E,[A/_+1,0,0,0,A/y+1,0,-.5*A/v,.5*A/w,1])}return E[2]=m,E[5]=t.x,E[8]=t.y,E},a.ci=xo,a.cj=function(t,e,i){const n=a.a6.identity(new Float64Array(16)),s=(e/(1<<t)-.5)*Math.PI*2;return a.a6.rotateY(n,i.globeMatrix,s),Float32Array.from(n)},a.ck=class{isDataAvailableAtPoint(t){const e=this._source();if(this.isUsingMockSource()||!e||t.y<0||t.y>1)return!1;const i=e.getSource().maxzoom,n=1<<i,s=Math.floor(t.x),l=Math.floor((t.x-s)*n),h=Math.floor(t.y*n),f=this.findDEMTileFor(new Le(i,s,i,l,h));return!(!f||!f.dem)}getAtPointOrZero(t,e=0){return this.getAtPoint(t,e)||0}getAtPoint(t,e,i=!0){if(this.isUsingMockSource())return null;e==null&&(e=null);const n=this._source();if(!n||t.y<0||t.y>1)return e;const s=n.getSource().maxzoom,l=1<<s,h=Math.floor(t.x),f=t.x-h,m=new Le(s,h,s,Math.floor(f*l),Math.floor(t.y*l)),_=this.findDEMTileFor(m);if(!_||!_.dem)return e;const y=_.dem,v=1<<_.tileID.canonical.z,w=(f*v-_.tileID.canonical.x)*y.dim,E=(t.y*v-_.tileID.canonical.y)*y.dim,A=Math.floor(w),I=Math.floor(E);return(i?this.exaggeration():1)*Ut(Ut(y.get(A,I),y.get(A,I+1),E-I),Ut(y.get(A+1,I),y.get(A+1,I+1),E-I),w-A)}getAtTileOffset(t,e,i){const n=1<<t.canonical.z;return this.getAtPointOrZero(new Yt(t.wrap+(t.canonical.x+e/qe)/n,(t.canonical.y+i/qe)/n))}getAtTileOffsetFunc(t,e,i,n){return s=>{const l=this.getAtTileOffset(t,s.x,s.y),h=n.upVector(t.canonical,s.x,s.y),f=n.upVectorScale(t.canonical,e,i).metersToTile;return a.N.scale(h,h,l*f),h}}getForTilePoints(t,e,i,n){if(this.isUsingMockSource())return!1;const s=Pl.create(this,t,n);return!!s&&(e.forEach(l=>{l[2]=this.exaggeration()*s.getElevationAt(l[0],l[1],i)}),!0)}getMinMaxForTile(t){if(this.isUsingMockSource())return null;const e=this.findDEMTileFor(t);if(!e||!e.dem)return null;const i=e.dem.tree,n=e.tileID,s=1<<t.canonical.z-n.canonical.z;let l=t.canonical.x/s-n.canonical.x,h=t.canonical.y/s-n.canonical.y,f=0;for(let m=0;m<t.canonical.z-n.canonical.z&&!i.leaves[f];m++){l*=2,h*=2;const _=2*Math.floor(h)+Math.floor(l);f=i.childOffsets[f]+_,l%=1,h%=1}return{min:this.exaggeration()*i.minimums[f],max:this.exaggeration()*i.maximums[f]}}getMinElevationBelowMSL(){throw new Error("Pure virtual method called.")}raycast(t,e,i){throw new Error("Pure virtual method called.")}pointCoordinate(t){throw new Error("Pure virtual method called.")}_source(){throw new Error("Pure virtual method called.")}isUsingMockSource(){throw new Error("Pure virtual method called.")}exaggeration(){throw new Error("Pure virtual method called.")}findDEMTileFor(t){throw new Error("Pure virtual method called.")}get visibleDemTiles(){throw new Error("Getter must be implemented in subclass.")}getMinMaxForVisibleTiles(){const t=this.visibleDemTiles;if(t.length===0)return null;let e=!1,i=Number.MAX_VALUE,n=Number.MIN_VALUE;for(const s of t){const l=this.getMinMaxForTile(s.tileID);l&&(i=Math.min(i,l.min),n=Math.max(n,l.max),e=!0)}return e?{min:i,max:n}:null}},a.cl=Qh,a.cm=y_,a.cn=function(t,e){return[Math.pow(t[0],2.2)*e,Math.pow(t[1],2.2)*e,Math.pow(t[2],2.2)*e]},a.cp=l_,a.cq=256,a.cr=function(t,e){const i=[0,0,0],n=id(xo(e.canonical));return a.N.transformMat4(i,i,n),a.N.transformMat4(i,i,t),i},a.cs=t=>({u_camera_to_center_distance:new gr(t),u_extrude_scale:new g(t),u_device_pixel_ratio:new gr(t),u_matrix:new u(t),u_inv_rot_matrix:new u(t),u_merc_center:new mo(t),u_tile_id:new Wh(t),u_zoom_transition:new gr(t),u_up_dir:new Wh(t),u_emissive_strength:new gr(t)}),a.ct=t=>({u_matrix:new u(t),u_pixels_to_tile_units:new g(t),u_device_pixel_ratio:new gr(t),u_units_to_pixels:new mo(t),u_dash_image:new Ml(t),u_gradient_image:new Ml(t),u_image_height:new gr(t),u_texsize:new mo(t),u_tile_units_to_pixels:new gr(t),u_alpha_discard_threshold:new gr(t),u_trim_offset:new mo(t),u_emissive_strength:new gr(t)}),a.cu=t=>({u_matrix:new u(t),u_texsize:new mo(t),u_pixels_to_tile_units:new g(t),u_device_pixel_ratio:new gr(t),u_image:new Ml(t),u_units_to_pixels:new mo(t),u_tile_units_to_pixels:new gr(t),u_alpha_discard_threshold:new gr(t),u_trim_offset:new mo(t)}
13),a.cv=vl,a.cw=Dx,a.cx=Lx,a.cy=d_,a.cz=(t,e,i,n,s,l)=>{const h=t.transform,f=h.projection.name==="globe";let m;if(l.paint.get("circle-pitch-alignment")==="map")if(f){const y=l_(h.zoom,e.canonical)*h._pixelsPerMercatorPixel;m=Float32Array.from([y,0,0,y])}else m=h.calculatePixelsToTileUnitsMatrix(i);else m=new Float32Array([h.pixelsToGLUnits[0],0,0,h.pixelsToGLUnits[1]]);const _={u_camera_to_center_distance:t.transform.getCameraToCenterDistance(h.projection),u_matrix:t.translatePosMatrix(e.projMatrix,i,l.paint.get("circle-translate"),l.paint.get("circle-translate-anchor")),u_device_pixel_ratio:ze.devicePixelRatio,u_extrude_scale:m,u_inv_rot_matrix:w0,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0],u_emissive_strength:l.paint.get("circle-emissive-strength")};if(f){_.u_inv_rot_matrix=n,_.u_merc_center=s,_.u_tile_id=[e.canonical.x,e.canonical.y,1<<e.canonical.z],_.u_zoom_transition=Cs(h.zoom);const y=s[0]*qe,v=s[1]*qe;_.u_up_dir=h.projection.upVector(new Ie(0,0,0),y,v)}return _},a.d=Ze,a.d0=xr,a.d1=Kt,a.d2=me,a.d3=function([t,e,i]){const n=Math.hypot(t,e,i),s=Math.atan2(t,i),l=.5*Math.PI-Math.acos(-e/n);return new ne(dr(s),dr(l))},a.d4=fe,a.d5=zt,a.d6=Vf,a.d7=u_,a.d8=function(t){const e=[0,0,0],i=a.a6.identity(new Float64Array(16));return a.a6.multiply(i,t.pixelMatrix,t.globeMatrix),a.N.transformMat4(e,e,i),new Ue(e[0],e[1])},a.d9=function(t){const e=t.navigator?t.navigator.userAgent:null;return!!function(i){if(Te==null){const n=i.navigator?i.navigator.userAgent:null;Te=!!i.safari||!(!n||!(/\b(iPad|iPhone|iPod)\b/.test(n)||n.match("Safari")&&!n.match("Chrome")))}return Te}(t)&&e&&(e.match("Version/15.4")||e.match("Version/15.5")||e.match(/CPU (OS|iPhone OS) (15_4|15_5) like Mac OS X/))},a.dA=Vn,a.dB=my,a.dC=gy,a.dD=Q_,a.dE=pr,a.dF=Ig,a.dG=function(t,e,i,n,s,l,h,f,m,_,y){t.createArrays(),t.tilePixelRatio=qe/(512*t.overscaling),t.compareText={},t.iconsNeedLinear=!1;const v=t.layers[0].layout,w=t.layers[0]._unevaluatedLayout._values,E={};if(t.textSizeData.kind==="composite"){const{minZoom:L,maxZoom:N}=t.textSizeData;E.compositeTextSizes=[w["text-size"].possiblyEvaluate(new Ii(L),f),w["text-size"].possiblyEvaluate(new Ii(N),f)]}if(t.iconSizeData.kind==="composite"){const{minZoom:L,maxZoom:N}=t.iconSizeData;E.compositeIconSizes=[w["icon-size"].possiblyEvaluate(new Ii(L),f),w["icon-size"].possiblyEvaluate(new Ii(N),f)]}E.layoutTextSize=w["text-size"].possiblyEvaluate(new Ii(m+1),f),E.layoutIconSize=w["icon-size"].possiblyEvaluate(new Ii(m+1),f),E.textMaxSize=w["text-size"].possiblyEvaluate(new Ii(18),f);const A=v.get("text-rotation-alignment")==="map"&&v.get("symbol-placement")!=="point",I=v.get("text-size");let z=!1;for(const L of t.features)if(L.icon&&L.icon.nameSecondary){z=!0;break}for(const L of t.features){const N=v.get("text-font").evaluate(L,{},f).join(","),G=I.evaluate(L,{},f),j=E.layoutTextSize.evaluate(L,{},f),X=(E.layoutIconSize.evaluate(L,{},f),{horizontal:{},vertical:void 0}),W=L.text;let J,ie=[0,0];if(W){const se=W.toString(),_e=v.get("text-letter-spacing").evaluate(L,{},f)*mr,Me=v.get("text-line-height").evaluate(L,{},f)*mr,pe=uf(se)?_e:0,we=v.get("text-anchor").evaluate(L,{},f),de=v.get("text-variable-anchor");if(!de){const He=v.get("text-radial-offset").evaluate(L,{},f);ie=He?Lg(we,[He*mr,sp]):v.get("text-offset").evaluate(L,{},f).map(Ce=>Ce*mr)}let be=A?"center":v.get("text-justify").evaluate(L,{},f);const Fe=v.get("symbol-placement")==="point",Se=Fe?v.get("text-max-width").evaluate(L,{},f)*mr:1/0,Qe=He=>{t.allowVerticalPlacement&&lo(se)&&(X.vertical=ip(W,e,i,s,N,Se,Me,we,He,pe,ie,fn.vertical,!0,j,G))};if(!A&&de){const He=be==="auto"?de.map(pt=>ap(pt)):[be];let Ce=!1;for(let pt=0;pt<He.length;pt++){const st=He[pt];if(!X.horizontal[st])if(Ce)X.horizontal[st]=X.horizontal[0];else{const Je=ip(W,e,i,s,N,Se,Me,"center",st,pe,ie,fn.horizontal,!1,j,G);Je&&(X.horizontal[st]=Je,Ce=Je.positionedLines.length===1)}}Qe("left")}else{if(be==="auto"&&(be=ap(we)),Fe||v.get("text-writing-mode").indexOf("horizontal")>=0||!lo(se)){const He=ip(W,e,i,s,N,Se,Me,we,be,pe,ie,fn.horizontal,!1,j,G);He&&(X.horizontal[be]=He)}
13Qe(Fe?"left":be)}}let oe=!1;if(L.icon&&L.icon.namePrimary){const se=n[L.icon.namePrimary];se&&(J=Jx(s[L.icon.namePrimary],L.icon.nameSecondary?s[L.icon.nameSecondary]:void 0,v.get("icon-offset").evaluate(L,{},f),v.get("icon-anchor").evaluate(L,{},f)),oe=se.sdf,t.sdfIcons===void 0?t.sdfIcons=se.sdf:t.sdfIcons!==se.sdf&&ki("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(se.pixelRatio!==t.pixelRatio||v.get("icon-rotate").constantOr(1)!==0)&&(t.iconsNeedLinear=!0))}const ue=kg(X.horizontal)||X.vertical;t.iconsInText||(t.iconsInText=!!ue&&ue.iconsInText),(ue||J)&&ov(t,L,X,J,n,E,j,0,ie,oe,h,f,_,y,z)}l&&t.generateCollisionDebugBuffers(m,t.collisionBoxArray)},a.dH=Yf,a.dI=kl,a.dJ=dd,a.dK=kr,a.dL=cd,a.dM=ld,a.dN=Wn,a.dO=cg,a.dP=function(t){let e=0;if(new Uint32Array(t,0,1)[0]!==ay){const i=new Uint32Array(t,0,7),[,,n,s,l,h]=i;e=i.byteLength+s+l+h+l,(n!==t.byteLength||e>=t.byteLength)&&ki("Invalid b3dm header information.")}return hy(t,e)},a.dQ=function(t,e){const i=py(t);for(const n of i){for(const s of n.meshes)Jv(s);n.lights&&(n.lightMeshIndex=n.meshes.length,n.meshes.push(Qv(n.lights,e)))}return i},a.dR=Ud,a.dS=ry,a.dT=Nr,a.dU=function(t){hi(),Ye&&Ye.then(e=>{e.keys().then(i=>{for(let n=0;n<i.length-t;n++)e.delete(i[n])})})},a.da=class{constructor(t,e,i){this._transformRequestFn=t,this._customAccessToken=e,this._silenceAuthErrors=!!i,this._createSkuToken()}_createSkuToken(){const t=function(){let e="";for(let i=0;i<10;i++)e+="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[Math.floor(62*Math.random())];return{token:["1",Be,e].join(""),tokenExpiresAt:Date.now()+432e5}}();this._skuToken=t.token,this._skuTokenExpiresAt=t.tokenExpiresAt}_isSkuTokenExpired(){return Date.now()>this._skuTokenExpiresAt}transformRequest(t,e){return this._transformRequestFn&&this._transformRequestFn(t,e)||{url:t}}normalizeStyleURL(t,e){if(!Wt(t))return t;const i=_t(t);return i.params.push(`sdk=js-${Pt}`),i.path=`/styles/v1${i.path}`,this._makeAPIURL(i,this._customAccessToken||e)}normalizeGlyphsURL(t,e){if(!Wt(t))return t;const i=_t(t);return i.path=`/fonts/v1${i.path}`,this._makeAPIURL(i,this._customAccessToken||e)}normalizeModelURL(t,e){if(!Wt(t))return t;const i=_t(t);return i.path=`/models/v1${i.path}`,this._makeAPIURL(i,this._customAccessToken||e)}normalizeSourceURL(t,e,i,n){if(!Wt(t))return t;const s=_t(t);return s.path=`/v4/${s.authority}.json`,s.params.push("secure"),i&&s.params.push(`language=${i}`),n&&s.params.push(`worldview=${n}`),this._makeAPIURL(s,this._customAccessToken||e)}normalizeSpriteURL(t,e,i,n){const s=_t(t);return Wt(t)?(s.path=`/styles/v1${s.path}/sprite${e}${i}`,this._makeAPIURL(s,this._customAccessToken||n)):(s.path+=`${e}${i}`,Vt(s))}normalizeTileURL(t,e,i){if(this._isSkuTokenExpired()&&this._createSkuToken(),t&&!Wt(t))return t;const n=_t(t);n.path=n.path.replace(/(\.(png|jpg)\d*)(?=$)/,`${e||i&&n.authority!=="raster"&&i===512?"@2x":""}${ri.supported?".webp":"$1"}`),n.authority==="raster"?n.path=`/${zt.RASTER_URL_PREFIX}${n.path}`:n.authority==="rasterarrays"?n.path=`/${zt.RASTERARRAYS_URL_PREFIX}${n.path}`:(n.path=n.path.replace(/^.+\/v4\//,"/"),n.path=`/${zt.TILE_URL_VERSION}${n.path}`);const s=this._customAccessToken||function(l){for(const h of l){const f=h.match(/^access_token=(.*)$/);if(f)return f[1]}return null}(n.params)||zt.ACCESS_TOKEN;return zt.REQUIRE_ACCESS_TOKEN&&s&&this._skuToken&&n.params.push(`sku=${this._skuToken}`),this._makeAPIURL(n,s)}canonicalizeTileURL(t,e){const i=_t(t);if(!i.path.match(/^(\/v4\/|\/(raster|rasterarrays)\/v1\/)/)||!i.path.match(/\.[\w]+$/))return t;let n="mapbox://";i.path.match(/^\/raster\/v1\//)?n+=`raster/${i.path.replace(`/${zt.RASTER_URL_PREFIX}/`,"")}`:i.path.match(/^\/rasterarrays\/v1\//)?n+=`rasterarrays/${i.path.replace(`/${zt.RASTERARRAYS_URL_PREFIX}/`,"")}`:n+=`tiles/${i.path.replace(`/${zt.TILE_URL_VERSION}/`,"")}`;let s=i.params;return e&&(s=s.filter(l=>!l.match(/^access_token=/))),s.length&&(n+=`?${s.join("&")}`),n}canonicalizeTileset(t,e){const i=!!e&&Wt(e),n=[];for(const s of t.tiles||[])qn(s)?n.push(this.canonicalizeTileURL(s,i)):n.push(s);return n}_makeAPIURL(t,e){const i="See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes",n=_t(zt.API_URL);if(t.protocol=n.protocol,t.authority=n.authority,t.protocol==="http"){const s=t.params.indexOf("secure");s>=0&&t.params.splice(s,1)}if(n.path!=="/"&&(t.path=`${n.path}${t.path}`),!zt.REQUIRE_ACCESS_TOKEN)return Vt(t);if(e=e||zt.ACCESS_TOKEN,!this._silenceAuthErrors){if(!e)throw new Error(`An API access token is required to use Mapbox GL. ${i}`);if(e[0]==="s")throw new Error(`Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). ${i}`)}return t.params=t.params.filter(s=>s.indexOf("access_token")===-1),t.params.push(`access_token=${e||""}`),Vt(t)}},a.db=function(t,e){e?Yn.add(t):Yn.delete(t)},a.dc=ri,a.dd=rn,a.de=qs,a.df=We,a.dg=ti,a.dh=function(t){Yn.delete(t)},a.di=ar,a.dj=sr,a.dk=Pt,a.dl=function(t,e){xe=t,rt=e}
13,a.dm=function(t,e,i=!1){if(Ir===Xc||Ir===Yc||Ir===Kc)throw new Error("setRTLTextPlugin cannot be called multiple times.");co=ze.resolveURL(t),Ir=Xc,Jc=e,Qc(),i||tu()},a.dn=uo,a.dp=function(){Bd().acquire(xp)},a.dq=function(){const t=Zu;t&&(t.isPreloaded()&&t.numActive()===1?(t.release(xp),Zu=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()"))},a.dr=Gu,a.ds=function(t){const e=Lt();if(!e)return;const i=e.delete(tt);t&&i.catch(t).then(()=>t())},a.dt=ju,a.du=ny,a.dv=function(t){vp=ze.resolveURL(t),Gl||(Gl=new Ul(Bd(),new rs)),Gl.broadcast("setDracoUrl",vp)},a.dw=oy,a.dx=function(t){jl=ze.resolveURL(t),Gl||(Gl=new Ul(Bd(),new rs)),Gl.broadcast("setMeshoptUrl",jl)},a.dy=Ke,a.dz=Ps,a.e=fr,a.f=ze,a.g=function(t,e){return ge(fr(t,{type:"json"}),e)},a.h=dn,a.i=cs,a.j=Ql,a.k=ul,a.l=function(t){return fetch(t).then(e=>e.arrayBuffer()).then(e=>hy(e,0,t))},a.m=xh,a.n=aa,a.o=pa,a.p=Ag,a.q=pl,a.r=fl,a.s=Zc,a.t=ta,a.u=fa,a.v=cr,a.w=ki,a.x=ps,a.z=nu}),Zd(["./shared"],function(a){function Pt(Te){const U=Te?Te.url.toString():void 0;return U?performance.getEntriesByName(U):[]}function Qr(Te){if(typeof Te=="number"||typeof Te=="boolean"||typeof Te=="string"||Te==null)return JSON.stringify(Te);if(Array.isArray(Te)){let H="[";for(const te of Te)H+=`${Qr(te)},`;return`${H}]`}let U="{";for(const H of Object.keys(Te).sort())U+=`${H}:${Qr(Te[H])},`;return`${U}}`}function zt(Te){let U="";for(const H of a.b2)U+=`/${Qr(Te[H])}`;return U}class qn{constructor(U){this.keyCache={},this._layers={},this._layerConfigs={},U&&this.replace(U)}replace(U,H){this._layerConfigs={},this._layers={},this.update(U,[],H)}update(U,H,te){this._options=te;for(const Ee of U)this._layerConfigs[Ee.id]=Ee,(this._layers[Ee.id]=a.c2(Ee,this.scope,this._options)).compileFilter(),this.keyCache[Ee.id]&&delete this.keyCache[Ee.id];for(const Ee of H)delete this.keyCache[Ee],delete this._layerConfigs[Ee],delete this._layers[Ee];this.familiesBySource={};const ye=function(Ee,ze){const tt={};for(let rt=0;rt<Ee.length;rt++){const Ye=ze&&ze[Ee[rt].id]||zt(Ee[rt]);ze&&(ze[Ee[rt].id]=Ye);let ot=tt[Ye];ot||(ot=tt[Ye]=[]),ot.push(Ee[rt])}const xe=[];for(const rt in tt)xe.push(tt[rt]);return xe}(a.a$(this._layerConfigs),this.keyCache);for(const Ee of ye){const ze=Ee.map(Lt=>this._layers[Lt.id]),tt=ze[0];if(tt.visibility==="none")continue;const xe=tt.source||"";let rt=this.familiesBySource[xe];rt||(rt=this.familiesBySource[xe]={});const Ye=tt.sourceLayer||"_geojsonTileLayer";let ot=rt[Ye];ot||(ot=rt[Ye]=[]),ot.push(ze)}}}const Wt=1*a.dA;class Rr{constructor(U){const H={},te=[];for(const tt in U){const xe=U[tt],rt=H[tt]={};for(const Ye in xe.glyphs){const ot=xe.glyphs[+Ye];if(!ot||ot.bitmap.width===0||ot.bitmap.height===0)continue;const Lt=ot.metrics.localGlyph?Wt:1,hi={x:0,y:0,w:ot.bitmap.width+2*Lt,h:ot.bitmap.height+2*Lt};te.push(hi),rt[Ye]=hi}}const{w:ye,h:Ee}=a.p(te),ze=new a.dz({width:ye||1,height:Ee||1});for(const tt in U){const xe=U[tt];for(const rt in xe.glyphs){const Ye=xe.glyphs[+rt];if(!Ye||Ye.bitmap.width===0||Ye.bitmap.height===0)continue;const ot=H[tt][rt],Lt=Ye.metrics.localGlyph?Wt:1;a.dz.copy(Ye.bitmap,ze,{x:0,y:0},{x:ot.x+Lt,y:ot.y+Lt},Ye.bitmap)}}this.image=ze,this.positions=H}}a.dy(Rr,"GlyphAtlas");class _n{constructor(U){this.tileID=new a.am(U.tileID.overscaledZ,U.tileID.wrap,U.tileID.canonical.z,U.tileID.canonical.x,U.tileID.canonical.y),this.tileZoom=U.tileZoom,this.uid=U.uid,this.zoom=U.zoom,this.canonical=U.tileID.canonical,this.pixelRatio=U.pixelRatio,this.tileSize=U.tileSize,this.source=U.source,this.scope=U.scope,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=U.showCollisionBoxes,this.collectResourceTiming=!!U.collectResourceTiming,this.promoteId=U.promoteId,this.isSymbolTile=U.isSymbolTile,this.tileTransform=a.as(U.tileID.canonical,U.projection),this.projection=U.projection,this.brightness=U.brightness,this.extraShadowCaster=!!U.extraShadowCaster}parse(U,H,te,ye,Ee){this.status="parsing",this.data=U,this.collisionBoxArray=new a.aD;const ze=new a.dB(Object.keys(U.layers).sort()),tt=new a.dC(this.tileID,this.promoteId);tt.bucketLayerIDs=[];const xe={},rt=new a.dD(256,256),Ye={featureIndex:tt,iconDependencies:{},patternDependencies:{},glyphDependencies:{},lineAtlas:rt,availableImages:te,brightness:this.brightness},ot=H.familiesBySource[this.source];for(const ci in ot){const yi=U.layers[ci];if(!yi)continue;let Ki=!1,bi=!1,vr=!1;for(const Zi of ot[ci])Zi[0].type==="symbol"?Ki=!0:bi=!0,Zi[0].is3D()&&Zi[0].type!=="model"&&(vr=!0);if(this.extraShadowCaster&&!vr||this.isSymbolTile===!0&&!Ki||this.isSymbolTile===!1&&!bi)continue;yi.version===1&&a.w(`Vector tile source "${this.source}" layer "${ci}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const _r=ze.encode(ci),Er=[];for(let Zi=0;Zi<yi.length;Zi++){const Ui=yi.feature(Zi),ge=tt.getId(Ui,ci);Er.push({feature:Ui,id:ge,index:Zi,sourceLayerIndex:_r})}for(const Zi of ot[ci]){const Ui=Zi[0];(!this.extraShadowCaster||Ui.is3D()&&Ui.type!=="model")&&(this.isSymbolTile!==void 0&&Ui.type==="symbol"!==this.isSymbolTile||Ui.minzoom&&this.zoom<Math.floor(Ui.minzoom)||Ui.maxzoom&&this.zoom>=Ui.maxzoom||Ui.visibility!=="none"&&(gn(Zi,this.zoom,Ye.brightness,te),(xe[Ui.id]=Ui.createBucket({index:tt.bucketLayerIDs.length,layers:Zi,zoom:this.zoom,canonical:this.canonical,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:_r,sourceID:this.source,projection:this.projection.spec})).populate(Er,Ye,this.tileID.canonical,this.tileTransform),tt.bucketLayerIDs.push(Zi.map(ge=>ge.id))))}}let Lt,hi,wi,di;rt.trim();const ai={type:"maybePrepare",isSymbolTile:this.isSymbolTile,zoom:this.zoom},ri=()=>
13{if(Lt)return this.status="done",Ee(Lt);if(this.extraShadowCaster)this.status="done",Ee(null,{buckets:a.a$(xe).filter(ci=>!ci.isEmpty()),featureIndex:tt,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:Ye.brightness,glyphMap:null,iconMap:null,glyphPositions:null});else if(hi&&wi&&di){const ci=new Rr(hi),yi=new a.dF(wi,di);for(const Ki in xe){const bi=xe[Ki];bi instanceof a.aE?(gn(bi.layers,this.zoom,Ye.brightness,te),a.dG(bi,hi,ci.positions,wi,yi.iconPositions,this.showCollisionBoxes,te,this.tileID.canonical,this.tileZoom,this.projection,this.brightness)):bi.hasPattern&&(bi instanceof a.aK||bi instanceof a.aL||bi instanceof a.cH)&&(gn(bi.layers,this.zoom,Ye.brightness,te),bi.addFeatures(Ye,this.tileID.canonical,yi.patternPositions,te,this.tileTransform,this.brightness))}this.status="done",Ee(null,{buckets:a.a$(xe).filter(Ki=>!Ki.isEmpty()),featureIndex:tt,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:ci.image,lineAtlas:rt,imageAtlas:yi,brightness:Ye.brightness})}};if(!this.extraShadowCaster){const ci=a.dE(Ye.glyphDependencies,bi=>Object.keys(bi).map(Number));Object.keys(ci).length?ye.send("getGlyphs",{uid:this.uid,stacks:ci,scope:this.scope},(bi,vr)=>{Lt||(Lt=bi,hi=vr,ri())},void 0,!1,ai):hi={};const yi=Object.keys(Ye.iconDependencies);yi.length?ye.send("getImages",{icons:yi,source:this.source,scope:this.scope,tileID:this.tileID,type:"icons"},(bi,vr)=>{Lt||(Lt=bi,wi=vr,ri())},void 0,!1,ai):wi={};const Ki=Object.keys(Ye.patternDependencies);Ki.length?ye.send("getImages",{icons:Ki,source:this.source,scope:this.scope,tileID:this.tileID,type:"patterns"},(bi,vr)=>{Lt||(Lt=bi,di=vr,ri())},void 0,!1,ai):di={}}ri()}}function gn(Te,U,H,te){const ye=new a.K(U,{brightness:H});for(const Ee of Te)Ee.recalculate(ye,te)}class bo extends a.E{constructor(U,H,te,ye,Ee,ze){super(),this.actor=U,this.layerIndex=H,this.availableImages=te,this.loadVectorData=Ee||a.ah,this.loading={},this.loaded={},this.deduped=new a.af(U.scheduler),this.isSpriteLoaded=ye,this.scheduler=U.scheduler,this.brightness=ze}loadTile(U,H){const te=U.uid,ye=U&&U.request,Ee=ye&&ye.collectResourceTiming,ze=this.loading[te]=new _n(U);ze.abort=this.loadVectorData(U,(tt,xe)=>{const rt=!this.loading[te];if(delete this.loading[te],rt||tt||!xe)return ze.status="done",rt||(this.loaded[te]=ze),H(tt);const Ye=xe.rawData,ot={};xe.expires&&(ot.expires=xe.expires),xe.cacheControl&&(ot.cacheControl=xe.cacheControl),ze.vectorTile=xe.vectorTile||new a.dH(new a.dI(Ye));const Lt=()=>{ze.parse(ze.vectorTile,this.layerIndex,this.availableImages,this.actor,(hi,wi)=>{if(hi||!wi)return H(hi);const di={};if(Ee){const ai=Pt(ye);ai.length>0&&(di.resourceTiming=JSON.parse(JSON.stringify(ai)))}H(null,a.e({rawTileData:Ye.slice(0)},wi,ot,di))})};this.isSpriteLoaded?Lt():this.once("isSpriteLoaded",()=>{this.scheduler?this.scheduler.add(Lt,{type:"parseTile",isSymbolTile:U.isSymbolTile,zoom:U.tileZoom}):Lt()}),this.loaded=this.loaded||{},this.loaded[te]=ze})}reloadTile(U,H){const te=this.loaded,ye=U.uid,Ee=this;if(te&&te[ye]){const ze=te[ye];ze.showCollisionBoxes=U.showCollisionBoxes,ze.projection=U.projection,ze.brightness=U.brightness,ze.tileTransform=a.as(U.tileID.canonical,U.projection),ze.extraShadowCaster=U.extraShadowCaster;const tt=(xe,rt)=>{const Ye=ze.reloadCallback;Ye&&(delete ze.reloadCallback,ze.parse(ze.vectorTile,Ee.layerIndex,this.availableImages,Ee.actor,Ye)),H(xe,rt)};ze.status==="parsing"?ze.reloadCallback=tt:ze.status==="done"&&(ze.vectorTile?ze.parse(ze.vectorTile,this.layerIndex,this.availableImages,this.actor,tt):tt())}else H(null,void 0)}abortTile(U,H){const te=U.uid,ye=this.loading[te];ye&&(ye.abort&&ye.abort(),delete this.loading[te]),H()}removeTile(U,H){const te=this.loaded,ye=U.uid;te&&te[ye]&&delete te[ye],H()}}class Ua{loadTile(U,H){const{uid:te,encoding:ye,rawImageData:Ee,padding:ze}=U,tt=ImageBitmap&&Ee instanceof ImageBitmap?this.getImageData(Ee,ze):Ee;H(null,new a.dJ(te,tt,ye,ze<1))}getImageData(U,H){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(U.width,U.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d",{willReadFrequently:!0})),this.offscreenCanvas.width=U.width,this.offscreenCanvas.height=U.height,this.offscreenCanvasContext.drawImage(U,0,0,U.width,U.height);const te=this.offscreenCanvasContext.getImageData(-H,-H,U.width+2*H,U.height+2*H);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),te}}class kr{decodeRasterArray({task:U,buffer:H},te){a.aZ.performDecoding(H,U).then(ye=>{te(null,ye)},ye=>{te(ye)})}}function Ko(Te,U){if(Te.length!==0){wo(Te[0],U);for(var H=1;H<Te.length;H++)wo(Te[H],!U)}}function wo(Te,U){for(var H=0,te=0,ye=0,Ee=Te.length,ze=Ee-1;ye<Ee;ze=ye++){var tt=(Te[ye][0]-Te[ze][0])*(Te[ze][1]+Te[ye][1]),xe=H+tt;te+=Math.abs(H)>=Math.abs(tt)?H-xe+tt:tt-xe+H,H=xe}H+te>=0!=!!U&&Te.reverse()}var $n=a.dK(function Te(U,H){var te,ye=U&&U.type;if(ye==="FeatureCollection")for(te=0;te<U.features.length;te++)Te(U.features[te],H);else if(ye==="GeometryCollection")for(te=0;te<U.geometries.length;te++)Te(U.geometries[te],H);else if(ye==="Feature")Te(U.geometry,H);else if(ye==="Polygon")Ko(U.coordinates,H);else if(ye==="MultiPolygon")for(te=0;te<U.coordinates.length;
vendor: 10,077 bytes, line 13
13te++)Ko(U.coordinates[te],H);return U});const Wn=a.dL.prototype.toGeoJSON;let Mn=class{constructor(Te){this._feature=Te,this.extent=a.V,this.type=Te.type,this.properties=Te.tags,"id"in Te&&!isNaN(Te.id)&&(this.id=parseInt(Te.id,10))}loadGeometry(){if(this._feature.type===1){const Te=[];for(const U of this._feature.geometry)Te.push([new a.P(U[0],U[1])]);return Te}{const Te=[];for(const U of this._feature.geometry){const H=[];for(const te of U)H.push(new a.P(te[0],te[1]));Te.push(H)}return Te}}toGeoJSON(Te,U,H){return Wn.call(this,Te,U,H)}},Ue=class{constructor(Te){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=a.V,this.length=Te.length,this._features=Te}feature(Te){return new Mn(this._features[Te])}};var To={exports:{}},Us=a.dN,qt=a.dM.VectorTileFeature,dr=ja;function ja(Te,U){this.options=U||{},this.features=Te,this.length=Te.length}function $e(Te,U){this.id=typeof Te.id=="number"?Te.id:void 0,this.type=Te.type,this.rawGeometry=Te.type===1?[Te.geometry]:Te.geometry,this.properties=Te.tags,this.extent=U||4096}ja.prototype.feature=function(Te){return new $e(this.features[Te],this.options.extent)},$e.prototype.loadGeometry=function(){var Te=this.rawGeometry;this.geometry=[];for(var U=0;U<Te.length;U++){for(var H=Te[U],te=[],ye=0;ye<H.length;ye++)te.push(new Us(H[ye][0],H[ye][1]));this.geometry.push(te)}return this.geometry},$e.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var Te=this.geometry,U=1/0,H=-1/0,te=1/0,ye=-1/0,Ee=0;Ee<Te.length;Ee++)for(var ze=Te[Ee],tt=0;tt<ze.length;tt++){var xe=ze[tt];U=Math.min(U,xe.x),H=Math.max(H,xe.x),te=Math.min(te,xe.y),ye=Math.max(ye,xe.y)}return[U,te,H,ye]},$e.prototype.toGeoJSON=qt.prototype.toGeoJSON;var en=a.dO,xr=dr;function Dt(Te){var U=new en;return function(H,te){for(var ye in H.layers)te.writeMessage(3,Jo,H.layers[ye])}(Te,U),U.finish()}function Jo(Te,U){var H;U.writeVarintField(15,Te.version||1),U.writeStringField(1,Te.name||""),U.writeVarintField(5,Te.extent||4096);var te={keys:[],values:[],keycache:{},valuecache:{}};for(H=0;H<Te.length;H++)te.feature=Te.feature(H),U.writeMessage(2,Hn,te);var ye=te.keys;for(H=0;H<ye.length;H++)U.writeStringField(3,ye[H]);var Ee=te.values;for(H=0;H<Ee.length;H++)U.writeMessage(4,js,Ee[H])}function Hn(Te,U){var H=Te.feature;H.id!==void 0&&U.writeVarintField(1,H.id),U.writeMessage(2,tn,Te),U.writeVarintField(3,H.type),U.writeMessage(4,Qo,H)}function tn(Te,U){var H=Te.feature,te=Te.keys,ye=Te.values,Ee=Te.keycache,ze=Te.valuecache;for(var tt in H.properties){var xe=H.properties[tt],rt=Ee[tt];if(xe!==null){rt===void 0&&(te.push(tt),Ee[tt]=rt=te.length-1),U.writeVarint(rt);var Ye=typeof xe;Ye!=="string"&&Ye!=="boolean"&&Ye!=="number"&&(xe=JSON.stringify(xe));var ot=Ye+":"+xe,Lt=ze[ot];Lt===void 0&&(ye.push(xe),ze[ot]=Lt=ye.length-1),U.writeVarint(Lt)}}}function fr(Te,U){return(U<<3)+(7&Te)}function Mo(Te){return Te<<1^Te>>31}function Qo(Te,U){for(var H=Te.loadGeometry(),te=Te.type,ye=0,Ee=0,ze=H.length,tt=0;tt<ze;tt++){var xe=H[tt],rt=1;te===1&&(rt=xe.length),U.writeVarint(fr(1,rt));for(var Ye=te===3?xe.length-1:xe.length,ot=0;ot<Ye;ot++){ot===1&&te!==1&&U.writeVarint(fr(2,Ye-1));var Lt=xe[ot].x-ye,hi=xe[ot].y-Ee;U.writeVarint(Mo(Lt)),U.writeVarint(Mo(hi)),ye+=Lt,Ee+=hi}te===3&&U.writeVarint(fr(7,1))}}function js(Te,U){var H=typeof Te;H==="string"?U.writeStringField(1,Te):H==="boolean"?U.writeBooleanField(7,Te):H==="number"&&(Te%1!=0?U.writeDoubleField(3,Te):Te<0?U.writeSVarintField(6,Te):U.writeVarintField(5,Te))}To.exports=Dt,To.exports.fromVectorTileJs=Dt,To.exports.fromGeojsonVt=function(Te,U){U=U||{};var H={};for(var te in Te)H[te]=new xr(Te[te].features,U),H[te].name=te,H[te].version=U.version,H[te].extent=U.extent;return Dt({layers:H})},To.exports.GeoJSONWrapper=xr;var Gs=a.dK(To.exports);const Zs={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:Te=>Te},Eo=Math.fround||(En=new Float32Array(1),Te=>(En[0]=+Te,En[0]));var En;const pr=3,jr=5,Or=6;class Ga{constructor(U){this.options=Object.assign(Object.create(Zs),U),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(U){const{log:H,minZoom:te,maxZoom:ye}=this.options;H&&console.time("total time");const Ee=`prepare ${U.length} points`;H&&console.time(Ee),this.points=U;const ze=[];for(let xe=0;xe<U.length;xe++){const rt=U[xe];if(!rt.geometry)continue;const[Ye,ot]=rt.geometry.coordinates,Lt=Eo(So(Ye)),hi=Eo(Sn(ot));ze.push(Lt,hi,1/0,xe,-1,1),this.options.reduce&&ze.push(0)}let tt=this.trees[ye+1]=this._createTree(ze);H&&console.timeEnd(Ee);for(let xe=ye;xe>=te;xe--){const rt=+Date.now();tt=this.trees[xe]=this._createTree(this._cluster(tt,xe)),H&&console.log("z%d: %d clusters in %dms",xe,tt.numItems,+Date.now()-rt)}return H&&console.timeEnd("total time"),this}getClusters(U,H){let te=((U[0]+180)%360+360)%360-180;const ye=Math.max(-90,Math.min(90,U[1]));let Ee=U[2]===180?180:((U[2]+180)%360+360)%360-180;const ze=Math.max(-90,Math.min(90,U[3]));if(U[2]-U[0]>=360)te=-180,Ee=180;else if(te>Ee){const ot=this.getClusters([te,ye,180,ze],H),Lt=this.getClusters([-180,ye,Ee,ze],H);return ot.concat(Lt)}const tt=this.trees[this._limitZoom(H)],xe=tt.range(So(te),Sn(ze),So(Ee),Sn(ye)),rt=tt.data,Ye=[];for(const ot of xe){const Lt=this.stride*ot;Ye.push(rt[Lt+jr]>1?ki(rt,Lt,this.clusterProps):this.points[rt[Lt+pr]])}return Ye}getChildren(U){const H=this._getOriginId(U),te=this._getOriginZoom(U),ye="No cluster with the specified id.",Ee=this.trees[te];if(!Ee)throw new Error(ye);const ze=Ee.data;if(H*this.stride>=ze.length)throw new Error(ye);const tt=this.options.radius/(this.options.extent*Math.pow(2,te-1)),xe=Ee.within(ze[H*this.stride],ze[H*this.stride+1],tt),rt=[];for(const Ye of xe){const ot=Ye*this.stride;ze[ot+4]===U&&rt.push(ze[ot+jr]>1?ki(ze,ot,this.clusterProps):this.points[ze[ot+pr]])}if(rt.length===0)throw new Error(ye);return rt}getLeaves(U,H,te){const ye=[];return this._appendLeaves(ye,U,H=H||10,te=te||0,0),ye}getTile(U,H,te){const ye=this.trees[this._limitZoom(U)],Ee=Math.pow(2,U),{extent:ze,radius:tt}=this.options,xe=tt/ze,rt=(te-xe)/Ee,Ye=(te+1+xe)/Ee,ot={features:[]};return this._addTileFeatures(ye.range((H-xe)/Ee,rt,(H+1+xe)/Ee,Ye),ye.data,H,te,Ee,ot),H===0&&this._addTileFeatures(ye.range(1-xe/Ee,rt,1,Ye),ye.data,Ee,te,Ee,ot),H===Ee-1&&this._addTileFeatures(ye.range(0,rt,xe/Ee,Ye),ye.data,-1,te,Ee,ot),ot.features.length?ot:null}getClusterExpansionZoom(U){let H=this._getOriginZoom(U)-1;for(;H<=this.options.maxZoom;){const te=this.getChildren(U);if(H++,te.length!==1)break;U=te[0].properties.cluster_id}return H}_appendLeaves(U,H,te,ye,Ee){const ze=this.getChildren(H);for(const tt of ze){const xe=tt.properties;if(xe&&xe.cluster?Ee+xe.point_count<=ye?Ee+=xe.point_count:Ee=this._appendLeaves(U,xe.cluster_id,te,ye,Ee):Ee<ye?Ee++:U.push(tt),U.length===te)break}return Ee}_createTree(U){const H=new a.bg(U.length/this.stride|0,this.options.nodeSize,Float32Array);for(let te=0;te<U.length;te+=this.stride)H.add(U[te],U[te+1]);return H.finish(),H.data=U,H}_addTileFeatures(U,H,te,ye,Ee,ze){for(const tt of U){const xe=tt*this.stride,rt=H[xe+jr]>1;let Ye,ot,Lt;if(rt)Ye=Gr(H,xe,this.clusterProps),ot=H[xe],Lt=H[xe+1];else{const di=this.points[H[xe+pr]];Ye=di.properties;const[ai,ri]=di.geometry.coordinates;ot=So(ai),Lt=Sn(ri)}const hi={type:1,geometry:[[Math.round(this.options.extent*(ot*Ee-te)),Math.round(this.options.extent*(Lt*Ee-ye))]],tags:Ye};let wi;wi=rt||this.options.generateId?H[xe+pr]:this.points[H[xe+pr]].id,wi!==void 0&&(hi.id=wi),ze.features.push(hi)}}_limitZoom(U){return Math.max(this.options.minZoom,Math.min(Math.floor(+U),this.options.maxZoom+1))}_cluster(U,H){const{radius:te,extent:ye,reduce:Ee,minPoints:ze}=this.options,tt=te/(ye*Math.pow(2,H)),xe=U.data,rt=[],Ye=this.stride;for(let ot=0;ot<xe.length;ot+=Ye){if(xe[ot+2]<=H)continue;xe[ot+2]=H;const Lt=xe[ot],hi=xe[ot+1],wi=U.within(xe[ot],xe[ot+1],tt),di=xe[ot+jr];let ai=di;for(const ri of wi){const ci=ri*Ye;xe[ci+2]>H&&(ai+=xe[ci+jr])}if(ai>di&&ai>=ze){let ri,ci=Lt*di,yi=hi*di,Ki=-1;const bi=(ot/Ye<<5)+(H+1)+this.points.length;for(const vr of wi){const _r=vr*Ye;if(xe[_r+2]<=H)continue;xe[_r+2]=H;const Er=xe[_r+jr];ci+=xe[_r]*Er,yi+=xe[_r+1]*Er,xe[_r+4]=bi,Ee&&(ri||(ri=this._map(xe,ot,!0),Ki=this.clusterProps.length,this.clusterProps.push(ri)),Ee(ri,this._map(xe,_r)))}xe[ot+4]=bi,rt.push(ci/ai,yi/ai,1/0,bi,-1,ai),Ee&&rt.push(Ki)}else{for(let ri=0;ri<Ye;ri++)rt.push(xe[ot+ri]);if(ai>1)for(const ri of wi){const ci=ri*Ye;if(!(xe[ci+2]<=H)){xe[ci+2]=H;for(let yi=0;yi<Ye;yi++)rt.push(xe[ci+yi])}}}}return rt}_getOriginId(U){return U-this.points.length>>5}_getOriginZoom(U){return(U-this.points.length)%32}_map(U,H,te){if(U[H+jr]>1){const ze=this.clusterProps[U[H+Or]];return te?Object.assign({},ze):ze}const ye=this.points[U[H+pr]].properties,Ee=this.options.map(ye);return te&&Ee===ye?Object.assign({},Ee):Ee}}function ki(Te,U,H){return{type:"Feature",id:Te[U+pr],properties:Gr(Te,U,H),geometry:{type:"Point",coordinates:[(te=Te[U],360*(te-.5)),yn(Te[U+1])]}};var te}function Gr(Te,U,H){const te=Te[U+jr],ye=te>=1e4?`${Math.round(te/1e3)}k`:te>=1e3?Math.round(te/100)/10+"k":te,Ee=Te[U+Or],ze=Ee===-1?{}:Object.assign({},H[Ee]);return Object.assign(ze,{cluster:!0,cluster_id:Te[U+pr],point_count:te,point_count_abbreviated:ye})}function So(Te){return Te/360+.5}function Sn(Te){const U=Math.sin(Te*Math.PI/180),H=.5-.25*Math.log((1+U)/(1-U))/Math.PI;return H<0?0:H>1?1:H}function yn(Te){const U=(180-360*Te)*Math.PI/180;return 360*Math.atan(Math.exp(U))/Math.PI-90}var Ao={exports:{}};Ao.exports=function(){function Te(ge,ve,De,Ne){for(var ke,Ge=Ne,Ze=De-ve>>1,Be=De-ve,We=ge[ve],Ve=ge[ve+1],_t=ge[De],Vt=ge[De+1],lt=ve+3;lt<De;lt+=3){var fi=U(ge[lt],ge[lt+1],We,Ve,_t,Vt);if(fi>Ge)ke=lt,Ge=fi;else if(fi===Ge){var Ei=Math.abs(lt-Ze);Ei<Be&&(ke=lt,Be=Ei)}}Ge>Ne&&(ke-ve>3&&Te(ge,ve,ke,Ne),ge[ke+2]=Ge,De-ke>3&&Te(ge,ke,De,Ne))}function U(ge,ve,De,Ne,ke,Ge){var Ze=ke-De,Be=Ge-Ne;if(Ze!==0||Be!==0){var We=((ge-De)*Ze+(ve-Ne)*Be)/(Ze*Ze+Be*Be);We>1?(De=ke,Ne=Ge):We>0&&(De+=Ze*We,Ne+=Be*We)}
vendor: 11,225 bytes, line 13
13return(Ze=ge-De)*Ze+(Be=ve-Ne)*Be}function H(ge,ve,De,Ne){var ke={id:ge===void 0?null:ge,type:ve,geometry:De,tags:Ne,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(Ge){var Ze=Ge.geometry,Be=Ge.type;if(Be==="Point"||Be==="MultiPoint"||Be==="LineString")te(Ge,Ze);else if(Be==="Polygon"||Be==="MultiLineString")for(var We=0;We<Ze.length;We++)te(Ge,Ze[We]);else if(Be==="MultiPolygon")for(We=0;We<Ze.length;We++)for(var Ve=0;Ve<Ze[We].length;Ve++)te(Ge,Ze[We][Ve])}(ke),ke}function te(ge,ve){for(var De=0;De<ve.length;De+=3)ge.minX=Math.min(ge.minX,ve[De]),ge.minY=Math.min(ge.minY,ve[De+1]),ge.maxX=Math.max(ge.maxX,ve[De]),ge.maxY=Math.max(ge.maxY,ve[De+1])}function ye(ge,ve,De,Ne){if(ve.geometry){var ke=ve.geometry.coordinates,Ge=ve.geometry.type,Ze=Math.pow(De.tolerance/((1<<De.maxZoom)*De.extent),2),Be=[],We=ve.id;if(De.promoteId?We=ve.properties[De.promoteId]:De.generateId&&(We=Ne||0),Ge==="Point")Ee(ke,Be);else if(Ge==="MultiPoint")for(var Ve=0;Ve<ke.length;Ve++)Ee(ke[Ve],Be);else if(Ge==="LineString")ze(ke,Be,Ze,!1);else if(Ge==="MultiLineString"){if(De.lineMetrics){for(Ve=0;Ve<ke.length;Ve++)ze(ke[Ve],Be=[],Ze,!1),ge.push(H(We,"LineString",Be,ve.properties));return}tt(ke,Be,Ze,!1)}else if(Ge==="Polygon")tt(ke,Be,Ze,!0);else{if(Ge!=="MultiPolygon"){if(Ge==="GeometryCollection"){for(Ve=0;Ve<ve.geometry.geometries.length;Ve++)ye(ge,{id:We,geometry:ve.geometry.geometries[Ve],properties:ve.properties},De,Ne);return}throw new Error("Input data is not a valid GeoJSON object.")}for(Ve=0;Ve<ke.length;Ve++){var _t=[];tt(ke[Ve],_t,Ze,!0),Be.push(_t)}}ge.push(H(We,Ge,Be,ve.properties))}}function Ee(ge,ve){ve.push(xe(ge[0])),ve.push(rt(ge[1])),ve.push(0)}function ze(ge,ve,De,Ne){for(var ke,Ge,Ze=0,Be=0;Be<ge.length;Be++){var We=xe(ge[Be][0]),Ve=rt(ge[Be][1]);ve.push(We),ve.push(Ve),ve.push(0),Be>0&&(Ze+=Ne?(ke*Ve-We*Ge)/2:Math.sqrt(Math.pow(We-ke,2)+Math.pow(Ve-Ge,2))),ke=We,Ge=Ve}var _t=ve.length-3;ve[2]=1,Te(ve,0,_t,De),ve[_t+2]=1,ve.size=Math.abs(Ze),ve.start=0,ve.end=ve.size}function tt(ge,ve,De,Ne){for(var ke=0;ke<ge.length;ke++){var Ge=[];ze(ge[ke],Ge,De,Ne),ve.push(Ge)}}function xe(ge){return ge/360+.5}function rt(ge){var ve=Math.sin(ge*Math.PI/180),De=.5-.25*Math.log((1+ve)/(1-ve))/Math.PI;return De<0?0:De>1?1:De}function Ye(ge,ve,De,Ne,ke,Ge,Ze,Be){if(Ne/=ve,Ge>=(De/=ve)&&Ze<Ne)return ge;if(Ze<De||Ge>=Ne)return null;for(var We=[],Ve=0;Ve<ge.length;Ve++){var _t=ge[Ve],Vt=_t.geometry,lt=_t.type,fi=ke===0?_t.minX:_t.minY,Ei=ke===0?_t.maxX:_t.maxY;if(fi>=De&&Ei<Ne)We.push(_t);else if(!(Ei<De||fi>=Ne)){var gi=[];if(lt==="Point"||lt==="MultiPoint")ot(Vt,gi,De,Ne,ke);else if(lt==="LineString")Lt(Vt,gi,De,Ne,ke,!1,Be.lineMetrics);else if(lt==="MultiLineString")wi(Vt,gi,De,Ne,ke,!1);else if(lt==="Polygon")wi(Vt,gi,De,Ne,ke,!0);else if(lt==="MultiPolygon")for(var qi=0;qi<Vt.length;qi++){var sr=[];wi(Vt[qi],sr,De,Ne,ke,!0),sr.length&&gi.push(sr)}if(gi.length){if(Be.lineMetrics&<==="LineString"){for(qi=0;qi<gi.length;qi++)We.push(H(_t.id,lt,gi[qi],_t.tags));continue}lt!=="LineString"&<!=="MultiLineString"||(gi.length===1?(lt="LineString",gi=gi[0]):lt="MultiLineString"),lt!=="Point"&<!=="MultiPoint"||(lt=gi.length===3?"Point":"MultiPoint"),We.push(H(_t.id,lt,gi,_t.tags))}}}return We.length?We:null}function ot(ge,ve,De,Ne,ke){for(var Ge=0;Ge<ge.length;Ge+=3){var Ze=ge[Ge+ke];Ze>=De&&Ze<=Ne&&(ve.push(ge[Ge]),ve.push(ge[Ge+1]),ve.push(ge[Ge+2]))}}function Lt(ge,ve,De,Ne,ke,Ge,Ze){for(var Be,We,Ve=hi(ge),_t=ke===0?ai:ri,Vt=ge.start,lt=0;lt<ge.length-3;lt+=3){var fi=ge[lt],Ei=ge[lt+1],gi=ge[lt+2],qi=ge[lt+3],sr=ge[lt+4],ti=ke===0?fi:Ei,Br=ke===0?qi:sr,rn=!1;Ze&&(Be=Math.sqrt(Math.pow(fi-qi,2)+Math.pow(Ei-sr,2))),ti<De?Br>De&&(We=_t(Ve,fi,Ei,qi,sr,De),Ze&&(Ve.start=Vt+Be*We)):ti>Ne?Br<Ne&&(We=_t(Ve,fi,Ei,qi,sr,Ne),Ze&&(Ve.start=Vt+Be*We)):di(Ve,fi,Ei,gi),Br<De&&ti>=De&&(We=_t(Ve,fi,Ei,qi,sr,De),rn=!0),Br>Ne&&ti<=Ne&&(We=_t(Ve,fi,Ei,qi,sr,Ne),rn=!0),!Ge&&rn&&(Ze&&(Ve.end=Vt+Be*We),ve.push(Ve),Ve=hi(ge)),Ze&&(Vt+=Be)}var ar=ge.length-3;fi=ge[ar],Ei=ge[ar+1],gi=ge[ar+2],(ti=ke===0?fi:Ei)>=De&&ti<=Ne&&di(Ve,fi,Ei,gi),ar=Ve.length-3,Ge&&ar>=3&&(Ve[ar]!==Ve[0]||Ve[ar+1]!==Ve[1])&&di(Ve,Ve[0],Ve[1],Ve[2]),Ve.length&&ve.push(Ve)}function hi(ge){var ve=[];return ve.size=ge.size,ve.start=ge.start,ve.end=ge.end,ve}function wi(ge,ve,De,Ne,ke,Ge){for(var Ze=0;Ze<ge.length;Ze++)Lt(ge[Ze],ve,De,Ne,ke,Ge,!1)}function di(ge,ve,De,Ne){ge.push(ve),ge.push(De),ge.push(Ne)}function ai(ge,ve,De,Ne,ke,Ge){var Ze=(Ge-ve)/(Ne-ve);return ge.push(Ge),ge.push(De+(ke-De)*Ze),ge.push(1),Ze}function ri(ge,ve,De,Ne,ke,Ge){var Ze=(Ge-De)/(ke-De);return ge.push(ve+(Ne-ve)*Ze),ge.push(Ge),ge.push(1),Ze}function ci(ge,ve){for(var De=[],Ne=0;Ne<ge.length;Ne++){var ke,Ge=ge[Ne],Ze=Ge.type;if(Ze==="Point"||Ze==="MultiPoint"||Ze==="LineString")ke=yi(Ge.geometry,ve);else if(Ze==="MultiLineString"||Ze==="Polygon"){ke=[];for(var Be=0;Be<Ge.geometry.length;Be++)ke.push(yi(Ge.geometry[Be],ve))}else if(Ze==="MultiPolygon")for(ke=[],Be=0;Be<Ge.geometry.length;Be++){for(var We=[],Ve=0;Ve<Ge.geometry[Be].length;Ve++)We.push(yi(Ge.geometry[Be][Ve],ve));ke.push(We)}De.push(H(Ge.id,Ze,ke,Ge.tags))}return De}function yi(ge,ve){var De=[];De.size=ge.size,ge.start!==void 0&&(De.start=ge.start,De.end=ge.end);for(var Ne=0;Ne<ge.length;Ne+=3)De.push(ge[Ne]+ve,ge[Ne+1],ge[Ne+2]);return De}function Ki(ge,ve){if(ge.transformed)return ge;var De,Ne,ke,Ge=1<<ge.z,Ze=ge.x,Be=ge.y;for(De=0;De<ge.features.length;De++){var We=ge.features[De],Ve=We.geometry,_t=We.type;if(We.geometry=[],_t===1)for(Ne=0;Ne<Ve.length;Ne+=2)We.geometry.push(bi(Ve[Ne],Ve[Ne+1],ve,Ge,Ze,Be));else for(Ne=0;Ne<Ve.length;Ne++){var Vt=[];for(ke=0;ke<Ve[Ne].length;ke+=2)Vt.push(bi(Ve[Ne][ke],Ve[Ne][ke+1],ve,Ge,Ze,Be));We.geometry.push(Vt)}}return ge.transformed=!0,ge}function bi(ge,ve,De,Ne,ke,Ge){return[Math.round(De*(ge*Ne-ke)),Math.round(De*(ve*Ne-Ge))]}function vr(ge,ve,De,Ne,ke){for(var Ge=ve===ke.maxZoom?0:ke.tolerance/((1<<ve)*ke.extent),Ze={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:De,y:Ne,z:ve,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0},Be=0;Be<ge.length;Be++){Ze.numFeatures++,_r(Ze,ge[Be],Ge,ke);var We=ge[Be].minX,Ve=ge[Be].minY,_t=ge[Be].maxX,Vt=ge[Be].maxY;We<Ze.minX&&(Ze.minX=We),Ve<Ze.minY&&(Ze.minY=Ve),_t>Ze.maxX&&(Ze.maxX=_t),Vt>Ze.maxY&&(Ze.maxY=Vt)}return Ze}function _r(ge,ve,De,Ne){var ke=ve.geometry,Ge=ve.type,Ze=[];if(Ge==="Point"||Ge==="MultiPoint")for(var Be=0;Be<ke.length;Be+=3)Ze.push(ke[Be]),Ze.push(ke[Be+1]),ge.numPoints++,ge.numSimplified++;else if(Ge==="LineString")Er(Ze,ke,ge,De,!1,!1);else if(Ge==="MultiLineString"||Ge==="Polygon")for(Be=0;Be<ke.length;Be++)Er(Ze,ke[Be],ge,De,Ge==="Polygon",Be===0);else if(Ge==="MultiPolygon")for(var We=0;We<ke.length;We++){var Ve=ke[We];for(Be=0;Be<Ve.length;Be++)Er(Ze,Ve[Be],ge,De,!0,Be===0)}if(Ze.length){var _t=ve.tags||null;if(Ge==="LineString"&&Ne.lineMetrics){for(var Vt in _t={},ve.tags)_t[Vt]=ve.tags[Vt];_t.mapbox_clip_start=ke.start/ke.size,_t.mapbox_clip_end=ke.end/ke.size}var lt={geometry:Ze,type:Ge==="Polygon"||Ge==="MultiPolygon"?3:Ge==="LineString"||Ge==="MultiLineString"?2:1,tags:_t};ve.id!==null&&(lt.id=ve.id),ge.features.push(lt)}}function Er(ge,ve,De,Ne,ke,Ge){var Ze=Ne*Ne;if(Ne>0&&ve.size<(ke?Ze:Ne))De.numPoints+=ve.length/3;else{for(var Be=[],We=0;We<ve.length;We+=3)(Ne===0||ve[We+2]>Ze)&&(De.numSimplified++,Be.push(ve[We]),Be.push(ve[We+1])),De.numPoints++;ke&&function(Ve,_t){for(var Vt=0,lt=0,fi=Ve.length,Ei=fi-2;lt<fi;Ei=lt,lt+=2)Vt+=(Ve[lt]-Ve[Ei])*(Ve[lt+1]+Ve[Ei+1]);if(Vt>0===_t)for(lt=0,fi=Ve.length;lt<fi/2;lt+=2){var gi=Ve[lt],qi=Ve[lt+1];Ve[lt]=Ve[fi-2-lt],Ve[lt+1]=Ve[fi-1-lt],Ve[fi-2-lt]=gi,Ve[fi-1-lt]=qi}}(Be,Ge),ge.push(Be)}}function Zi(ge,ve){var De=(ve=this.options=function(ke,Ge){for(var Ze in Ge)ke[Ze]=Ge[Ze];return ke}(Object.create(this.options),ve)).debug;if(De&&console.time("preprocess data"),ve.maxZoom<0||ve.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(ve.promoteId&&ve.generateId)throw new Error("promoteId and generateId cannot be used together.");var Ne=function(ke,Ge){var Ze=[];if(ke.type==="FeatureCollection")for(var Be=0;Be<ke.features.length;Be++)ye(Ze,ke.features[Be],Ge,Be);else ye(Ze,ke.type==="Feature"?ke:{geometry:ke},Ge);return Ze}(ge,ve);this.tiles={},this.tileCoords=[],De&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",ve.indexMaxZoom,ve.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),(Ne=function(ke,Ge){var Ze=Ge.buffer/Ge.extent,Be=ke,We=Ye(ke,1,-1-Ze,Ze,0,-1,2,Ge),Ve=Ye(ke,1,1-Ze,2+Ze,0,-1,2,Ge);return(We||Ve)&&(Be=Ye(ke,1,-Ze,1+Ze,0,-1,2,Ge)||[],We&&(Be=ci(We,1).concat(Be)),Ve&&(Be=Be.concat(ci(Ve,-1)))),Be}(Ne,ve)).length&&this.splitTile(Ne,0,0,0),De&&(Ne.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}function Ui(ge,ve,De){return 32*((1<<ge)*De+ve)+ge}return Zi.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},Zi.prototype.splitTile=function(ge,ve,De,Ne,ke,Ge,Ze){for(var Be=[ge,ve,De,Ne],We=this.options,Ve=We.debug;Be.length;){Ne=Be.pop(),De=Be.pop(),ve=Be.pop(),ge=Be.pop();var _t=1<<ve,Vt=Ui(ve,De,Ne),lt=this.tiles[Vt];if(!lt&&(Ve>1&&console.time("creation"),lt=this.tiles[Vt]=vr(ge,ve,De,Ne,We),this.tileCoords.push({z:ve,x:De,y:Ne}),Ve)){Ve>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",ve,De,Ne,lt.numFeatures,lt.numPoints,lt.numSimplified),console.timeEnd("creation"));var fi="z"+ve;this.stats[fi]=(this.stats[fi]||0)+1,this.total++}if(lt.source=ge,ke){if(ve===We.maxZoom||ve===ke)continue;var Ei=1<<ke-ve;if(De!==Math.floor(Ge/Ei)||Ne!==Math.floor(Ze/Ei))continue}else if(ve===We.indexMaxZoom||lt.numPoints<=We.indexMaxPoints)continue;if(lt.source=null,ge.length!==0){Ve>1&&console.time("clipping");var gi,qi,sr,ti,Br,rn,ar=.5*We.buffer/We.extent,qs=.5-ar,Yn=.5+ar,is=1+ar;gi=qi=sr=ti=null,Br=Ye(ge,_t,De-ar,De+Yn,0,lt.minX,lt.maxX,We),rn=Ye(ge,_t,De+qs,De+is,0,lt.minX,lt.maxX,We),ge=null,Br&&(gi=Ye(Br,_t,Ne-ar,Ne+Yn,1,lt.minY,lt.maxY,We),qi=Ye(Br,_t,Ne+qs,Ne+is,1,lt.minY,lt.maxY,We),Br=null),rn&&(sr=Ye(rn,_t,Ne-ar,Ne+Yn,1,lt.minY,lt.maxY,We),ti=Ye(rn,_t,Ne+qs,Ne+is,1,lt.minY,lt.maxY,We),rn=null),Ve>1&&console.timeEnd("clipping"),Be.push(gi||[],ve+1,2*De,2*Ne),Be.push(qi||[],ve+1,2*De,2*Ne+1),Be.push(sr||[],ve+1,2*De+1,2*Ne),Be.push(ti||[],ve+1,2*De+1,2*Ne+1)}}},Zi.prototype.getTile=function(ge,ve,De){var Ne=this.options,ke=Ne.extent,Ge=Ne.debug;if(ge<0||ge>24)return null;var Ze=1<<ge,Be=Ui(ge,ve=(ve%Ze+Ze)%Ze,De);if(this.tiles[Be])return Ki(this.tiles[Be],ke);Ge>1&&console.log("drilling down to z%d-%d-%d",ge,ve,De);for(var We,Ve=ge,_t=ve,Vt=De;!We&&Ve>0;)Ve--,_t=Math.floor(_t/2),Vt=Math.floor(Vt/2),We=this.tiles[Ui(Ve,_t,Vt)];return We&&We.source?(Ge>1&&console.log("found parent tile z%d-%d-%d",Ve,_t,Vt),Ge>1&&console.time("drilling down"),this.splitTile(We.source,Ve,_t,Vt,ge,ve,De),Ge>1&&console.timeEnd("drilling down"),this.tiles[Be]?Ki(this.tiles[Be],ke):null):null},function(ge,ve){return new Zi(ge,ve)}}();
13var Vi=a.dK(Ao.exports);function es(Te,U){const H=Te.tileID.canonical;if(!this._geoJSONIndex)return U(null,null);const te=this._geoJSONIndex.getTile(H.z,H.x,H.y);if(!te)return U(null,null);const ye=new Ue(te.features);let Ee=Gs(ye);Ee.byteOffset===0&&Ee.byteLength===Ee.buffer.byteLength||(Ee=new Uint8Array(Ee)),U(null,{vectorTile:ye,rawData:Ee.buffer})}class ts extends bo{constructor(U,H,te,ye,Ee,ze){super(U,H,te,ye,es,ze),Ee&&(this.loadGeoJSON=Ee)}loadData(U,H){const te=U&&U.request,ye=te&&te.collectResourceTiming;this.loadGeoJSON(U,(Ee,ze)=>{if(Ee||!ze)return H(Ee);if(typeof ze!="object")return H(new Error(`Input data given to '${U.source}' is not a valid GeoJSON object.`));{$n(ze,!0);try{if(U.filter){const xe=a.r(U.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(xe.result==="error")throw new Error(xe.value.map(Ye=>`${Ye.key}: ${Ye.message}`).join(", "));ze={type:"FeatureCollection",features:ze.features.filter(Ye=>xe.value.evaluate({zoom:0},Ye))}}this._geoJSONIndex=U.cluster?new Ga(function({superclusterOptions:xe,clusterProperties:rt}){if(!rt||!xe)return xe;const Ye={},ot={},Lt={accumulated:null,zoom:0},hi={properties:null},wi=Object.keys(rt);for(const di of wi){const[ai,ri]=rt[di],ci=a.r(ri),yi=a.r(typeof ai=="string"?[ai,["accumulated"],["get",di]]:ai);Ye[di]=ci.value,ot[di]=yi.value}return xe.map=di=>{hi.properties=di;const ai={};for(const ri of wi)ai[ri]=Ye[ri].evaluate(Lt,hi);return ai},xe.reduce=(di,ai)=>{hi.properties=ai;for(const ri of wi)Lt.accumulated=di[ri],di[ri]=ot[ri].evaluate(Lt,hi)},xe}(U)).load(ze.features):Vi(ze,U.geojsonVtOptions)}catch(xe){return H(xe)}this.loaded={};const tt={};if(ye){const xe=Pt(te);xe&&(tt.resourceTiming={},tt.resourceTiming[U.source]=JSON.parse(JSON.stringify(xe)))}H(null,tt)}})}reloadTile(U,H){const te=this.loaded;return te&&te[U.uid]?super.reloadTile(U,H):this.loadTile(U,H)}loadGeoJSON(U,H){if(U.request)a.g(U.request,H);else{if(typeof U.data!="string")return H(new Error(`Input data given to '${U.source}' is not a valid GeoJSON object.`));try{return H(null,JSON.parse(U.data))}catch{return H(new Error(`Input data given to '${U.source}' is not a valid GeoJSON object.`))}}}getClusterExpansionZoom(U,H){try{H(null,this._geoJSONIndex.getClusterExpansionZoom(U.clusterId))}catch(te){H(te)}}getClusterChildren(U,H){try{H(null,this._geoJSONIndex.getChildren(U.clusterId))}catch(te){H(te)}}getClusterLeaves(U,H){try{H(null,this._geoJSONIndex.getLeaves(U.clusterId,U.limit,U.offset))}catch(te){H(te)}}}class Zr{constructor(U,H){this.tileID=new a.am(U.tileID.overscaledZ,U.tileID.wrap,U.tileID.canonical.z,U.tileID.canonical.x,U.tileID.canonical.y),this.tileZoom=U.tileZoom,this.uid=U.uid,this.zoom=U.zoom,this.canonical=U.tileID.canonical,this.pixelRatio=U.pixelRatio,this.tileSize=U.tileSize,this.source=U.source,this.overscaling=this.tileID.overscaleFactor(),this.projection=U.projection,this.brightness=H}parse(U,H,te,ye){this.status="parsing";const Ee=new a.am(te.tileID.overscaledZ,te.tileID.wrap,te.tileID.canonical.z,te.tileID.canonical.x,te.tileID.canonical.y),ze={},tt=H.familiesBySource[te.source],xe=new a.dC(Ee,te.promoteId);return xe.bucketLayerIDs=[],xe.is3DTile=!0,a.dP(U).then(rt=>{if(!rt)return ye(new Error("Could not parse tile"));const Ye=a.dQ(rt,1/a.bR(te.tileID.canonical)),ot=rt.json.extensionsUsed&&rt.json.extensionsUsed.includes("MAPBOX_mesh_features")||rt.json.asset.extras&&rt.json.asset.extras.MAPBOX_mesh_features,Lt=rt.json.extensionsUsed&&rt.json.extensionsUsed.includes("EXT_meshopt_compression"),hi=new a.K(this.zoom,{brightness:this.brightness});for(const wi in tt)for(const di of tt[wi]){const ai=di[0];xe.bucketLayerIDs.push(di.map(ci=>ci.id)),ai.recalculate(hi,[]);const ri=new a.dR(Ye,Ee,ot,Lt,this.brightness,xe);ot||(ri.needsUpload=!0),ze[ai.fqid]=ri,ri.evaluate(ai)}this.status="done",ye(null,{buckets:ze,featureIndex:xe})}).catch(rt=>ye(new Error(rt.message)))}}class An{constructor(U,H,te,ye,Ee,ze){this.actor=U,this.layerIndex=H,this.brightness=ze,this.loading={},this.loaded={}}loadTile(U,H){const te=U.uid,ye=this.loading[te]=new Zr(U,this.brightness);a.a_(U.request,(Ee,ze)=>{const tt=!this.loading[te];return delete this.loading[te],tt||Ee?(ye.status="done",tt||(this.loaded[te]=ye),H(Ee)):ze&&ze.byteLength!==0?void
13ye.parse(ze,this.layerIndex,U,(xe,rt)=>{ye.status="done",this.loaded=this.loaded||{},this.loaded[te]=ye,xe||!rt?H(xe):H(null,rt)}):(ye.status="done",this.loaded[te]=ye,H())})}reloadTile(U,H){const te=this.loaded,ye=U.uid;if(te&&te[ye]){const Ee=te[ye];Ee.projection=U.projection,Ee.brightness=U.brightness;const ze=(tt,xe)=>{Ee.reloadCallback&&(delete Ee.reloadCallback,this.loadTile(U,H)),H(tt,xe)};Ee.status==="parsing"?Ee.reloadCallback=ze:Ee.status==="done"&&this.loadTile(U,H)}}abortTile(U,H){const te=U.uid;this.loading[te]&&delete this.loading[te],H()}removeTile(U,H){const te=this.loaded,ye=U.uid;te&&te[ye]&&delete te[ye],H()}}class Xn{constructor(U){this.self=U,this.actor=new a.dS(U,this),this.layerIndexes={},this.availableImages={},this.isSpriteLoaded={},this.projections={},this.defaultProjection=a.bo({name:"mercator"}),this.workerSourceTypes={vector:bo,geojson:ts,"batched-model":An},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(H,te)=>{if(this.workerSourceTypes[H])throw new Error(`Worker source with name "${H}" already registered.`);this.workerSourceTypes[H]=te},this.self.registerRTLTextPlugin=H=>{if(a.dT.isParsed())throw new Error("RTL text plugin already registered.");a.dT.applyArabicShaping=H.applyArabicShaping,a.dT.processBidirectionalText=H.processBidirectionalText,a.dT.processStyledBidirectionalText=H.processStyledBidirectionalText}}clearCaches(U,H,te){delete this.layerIndexes[U],delete this.availableImages[U],delete this.workerSources[U],delete this.demWorkerSources[U],delete this.rasterArrayWorkerSource,te()}checkIfReady(U,H,te){te()}setReferrer(U,H){this.referrer=H}spriteLoaded(U,{scope:H,isLoaded:te}){if(this.isSpriteLoaded[U]||(this.isSpriteLoaded[U]={}),this.isSpriteLoaded[U][H]=te,this.workerSources[U]&&this.workerSources[U][H])for(const ye in this.workerSources[U][H]){const Ee=this.workerSources[U][H][ye];for(const ze in Ee)Ee[ze]instanceof bo&&(Ee[ze].isSpriteLoaded=te,Ee[ze].fire(new a.b("isSpriteLoaded")))}}setImages(U,{scope:H,images:te},ye){if(this.availableImages[U]||(this.availableImages[U]={}),this.availableImages[U][H]=te,this.workerSources[U]&&this.workerSources[U][H]){for(const Ee in this.workerSources[U][H]){const ze=this.workerSources[U][H][Ee];for(const tt in ze)ze[tt].availableImages=te}ye()}else ye()}setProjection(U,H){this.projections[U]=a.bo(H)}setBrightness(U,H,te){this.brightness=H,te()}setLayers(U,H,te){this.getLayerIndex(U,H.scope).replace(H.layers,H.options),te()}updateLayers(U,H,te){this.getLayerIndex(U,H.scope).update(H.layers,H.removedIds,H.options),te()}loadTile(U,H,te){H.projection=this.projections[U]||this.defaultProjection,this.getWorkerSource(U,H.type,H.source,H.scope).loadTile(H,te)}loadDEMTile(U,H,te){this.getDEMWorkerSource(U,H.source,H.scope).loadTile(H,te)}decodeRasterArray(U,H,te){this.getRasterArrayWorkerSource().decodeRasterArray(H,te)}reloadTile(U,H,te){H.projection=this.projections[U]||this.defaultProjection,this.getWorkerSource(U,H.type,H.source,H.scope).reloadTile(H,te)}abortTile(U,H,te){this.getWorkerSource(U,H.type,H.source,H.scope).abortTile(H,te)}removeTile(U,H,te){this.getWorkerSource(U,H.type,H.source,H.scope).removeTile(H,te)}removeSource(U,H,te){if(!(this.workerSources[U]&&this.workerSources[U][H.scope]&&this.workerSources[U][H.scope][H.type]&&this.workerSources[U][H.scope][H.type][H.source]))return;const ye=this.workerSources[U][H.scope][H.type][H.source];delete this.workerSources[U][H.scope][H.type][H.source],ye.removeSource!==void 0?ye.removeSource(H,te):te()}loadWorkerSource(U,H,te){try{this.self.importScripts(H.url),te()}catch(ye){te(ye.toString())}}syncRTLPluginState(U,H,te){try{a.dT.setState(H);const ye=a.dT.getPluginURL();if(a.dT.isLoaded()&&!a.dT.isParsed()&&ye!=null){this.self.importScripts(ye);const Ee=a.dT.isParsed();te(Ee?void 0:new Error(`RTL Text Plugin failed to import scripts from ${ye}`),Ee)}}catch(ye){te(ye.toString())}}setDracoUrl(U,H){this.dracoUrl=H}getAvailableImages(U,H){this.availableImages[U]||(this.availableImages[U]={});let te=this.availableImages[U][H];return te||(te=[]),te}getLayerIndex(U,H){this.layerIndexes[U]||(this.layerIndexes[U]={});let te=this.layerIndexes[U][H];return te||(te=this.layerIndexes[U][H]=new qn,te.scope=H),te}getWorkerSource(U,H,te,ye){if(this.workerSources[U]||(this.workerSources[U]={}),this.workerSources[U][ye]||(this.workerSources[U][ye]={}),this.workerSources[U][ye][H]||(this.workerSources[U][ye][H]={}),this.isSpriteLoaded[U]||(this.isSpriteLoaded[U]={}),!this.workerSources[U][ye][H][te]){const Ee={send:(ze,tt,xe,rt,Ye,ot)=>{this.actor.send(ze,tt,xe,U,Ye,ot)},scheduler:this.actor.scheduler};this.workerSources[U][ye][H][te]=new this.workerSourceTypes[H](Ee,this.getLayerIndex(U,ye),this.getAvailableImages(U,ye),this.isSpriteLoaded[U][ye],void 0,this.brightness)}return this.workerSources[U][ye][H][te]}getDEMWorkerSource(U,H,te){return this.demWorkerSources[U]||(this.demWorkerSources[U]={}),this.demWorkerSources[U][te]||(this.demWorkerSources[U][te]={}),this.demWorkerSources[U][te][H]||(this.demWorkerSources[U][te][H]=new Ua),this.demWorkerSources[U][te][H]}getRasterArrayWorkerSource(){return this.rasterArrayWorkerSource||(this.rasterArrayWorkerSource=new kr),this.rasterArrayWorkerSource}enforceCacheSizeLimit(U,H){a.dU(H)}getWorkerPerformanceMetrics(U,H,te){te(void 0,void 0)}}return typeof WorkerGlobalScope<"u"&&typeof self<"u"&&self instanceof WorkerGlobalScope&&(self.worker=new Xn(self)),Xn}),Zd(["./shared"],function(a){function Pt(c,r){if(Array.isArray(c)){if
13(!Array.isArray(r)||c.length!==r.length)return!1;for(let o=0;o<c.length;o++)if(!Pt(c[o],r[o]))return!1;return!0}if(typeof c=="object"&&c!==null&&r!==null){if(typeof r!="object"||Object.keys(c).length!==Object.keys(r).length)return!1;for(const o in c)if(!Pt(c[o],r[o]))return!1;return!0}return c===r}var Qr=zt;function zt(c){return!function(r){return typeof window>"u"||typeof document>"u"?"not a browser":function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var u,d,p=new Blob([""],{type:"text/javascript"}),g=URL.createObjectURL(p);try{d=new Worker(g),u=!0}catch{u=!1}return d&&d.terminate(),URL.revokeObjectURL(g),u}()?function(){var u=document.createElement("canvas");u.width=u.height=1;var d=u.getContext("2d");if(!d)return!1;var p=d.getImageData(0,0,1,1);return p&&p.width===u.width}()?(qn[o=r&&r.failIfMajorPerformanceCaveat]===void 0&&(qn[o]=function(u){var d,p=function(g){var x=document.createElement("canvas"),b=Object.create(zt.webGLContextAttributes);return b.failIfMajorPerformanceCaveat=g,x.getContext("webgl2",b)}(u);if(!p)return!1;try{d=p.createShader(p.VERTEX_SHADER)}catch{return!1}return!(!d||p.isContextLost())&&(p.shaderSource(d,"void main() {}"),p.compileShader(d),p.getShaderParameter(d,p.COMPILE_STATUS)===!0)}(o)),qn[o]?document.documentMode?"insufficient ECMAScript 6 support":void 0:"insufficient WebGL2 support"):"insufficient Canvas/getImageData support":"insufficient worker support";var o}(c)}var qn={};function Wt(c,r,o){const u=document.createElement(c);return r!=null&&(u.className=r),o&&o.appendChild(u),u}function Rr(c,r,o){const u=document.createElementNS("http://www.w3.org/2000/svg",c);for(const d of Object.keys(r))u.setAttributeNS(null,d,String(r[d]));return o&&o.appendChild(u),u}zt.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0};const _n=typeof document<"u"?document.documentElement&&document.documentElement.style:null,gn=_n&&_n.userSelect!==void 0?"userSelect":"WebkitUserSelect";let bo;function Ua(){_n&&gn&&(bo=_n[gn],_n[gn]="none")}function kr(){_n&&gn&&(_n[gn]=bo)}function Ko(c){c.preventDefault(),c.stopPropagation(),window.removeEventListener("click",Ko,!0)}function wo(){window.addEventListener("click",Ko,!0),window.setTimeout(()=>{window.removeEventListener("click",Ko,!0)},0)}function $n(c,r){const o=c.getBoundingClientRect();return Ue(c,o,r)}function Wn(c,r){const o=c.getBoundingClientRect(),u=[];for(let d=0;d<r.length;d++)u.push(Ue(c,o,r[d]));return u}function Mn(c){return window.InstallTrigger!==void 0&&c.button===2&&c.ctrlKey&&window.navigator.platform.toUpperCase().indexOf("MAC")>=0?0:c.button}function Ue(c,r,o){const u=c.offsetWidth===r.width?1:c.offsetWidth/r.width;return new a.P((o.clientX-r.left)*u,(o.clientY-r.top)*u)}class To{constructor(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSourceCaches={},this._updatedPaintProps=new Set,this._updatedImages=new Set}isDirty(){return this._changed}setDirty(){this._changed=!0}getUpdatedSourceCaches(){return this._updatedSourceCaches}updateSourceCache(r,o){this._updatedSourceCaches[r]=o,this.setDirty()}discardSourceCacheUpdate(r){delete this._updatedSourceCaches[r]}updateLayer(r){const o=r.scope;this._updatedLayers[o]=this._updatedLayers[o]||new Set,this._updatedLayers[o].add(r.id),this.setDirty()}removeLayer(r){const o=r.scope;this._removedLayers[o]=this._removedLayers[o]||{},this._updatedLayers[o]=this._updatedLayers[o]||new Set,this._removedLayers[o][r.id]=r,this._updatedLayers[o].delete(r.id),this._updatedPaintProps.delete(r.fqid),this.setDirty()}getRemovedLayer(r){return this._removedLayers[r.scope]?this._removedLayers[r.scope][r.id]:null}discardLayerRemoval(r){this._removedLayers[r.scope]&&delete this._removedLayers[r.scope][r.id]}getLayerUpdatesByScope(){const r={};for(const o in this._updatedLayers)r[o]=r[o]||{},r[o].updatedIds=Array.from(this._updatedLayers[o].values());for(const o in this._removedLayers)r[o]=r[o]||{},r[o].removedIds=Object.keys(this._removedLayers[o]);return r}getUpdatedPaintProperties(){return this._updatedPaintProps}updatePaintProperties(r){this._updatedPaintProps.add(r.fqid),this.setDirty()}getUpdatedImages(){return Array.from(this._updatedImages.values())}updateImage(r){this._updatedImages.add(r),this.setDirty()}resetUpdatedImages(){this._updatedImages.clear()}reset(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSourceCaches={},this._updatedPaintProps.clear(),this._updatedImages.clear()}}class Us extends a.E{constructor(r){super(),this.requestManager=r,this.models={"":{}},this.numModelsLoading={}}loadModel(r,o){return a.l(this.requestManager.transformRequest(o,a.R.Model).url).then(u=>{if(!u)return;const d=a.c(u),p=new a.M(r,void 0,void 0,d);return p.computeBoundsAndApplyParent(),p}).catch(u=>{this.fire(new a.a(new Error(`Could not load model ${r} from ${o}: ${u.message}`)))})}load(r,o){this.models[o]||(this.models[o]={});const u=Object.keys(r);this.numModelsLoading[o]=(this.numModelsLoading[o]||0)+u.length;const d=[];for(const p of u)d.push(this.loadModel(p,r[p]));Promise.allSettled(d).then(p=>{for(let g=0;g<p.length;g++){const{status:x,value:b}=p[g];x==="fulfilled"&&b&&(this.models[o][u[g]]=b)}this.numModelsLoading[o]-=u.length,this.fire(new a.b("data",{dataType:"style"}))}).catch(p=>{this.fire(new a.a(new Error(`Could not load models: ${p.message}`)))})}isLoaded(){for(const r in this.numModelsLoading)if(this.numModelsLoading[r]>0)return!1;return!0}hasModel(r,o){return!!this.getModel(r,o)}getModel(r,o){return this.models[o]||(this.models[o]={}),this.models[o][r]}
13addModel(r,o,u){this.models[u]||(this.models[u]={}),this.hasModel(r,u)&&this.removeModel(r,u),this.load({[r]:this.requestManager.normalizeModelURL(o)},u)}addModels(r,o){const u={};for(const d in r)u[d]=this.requestManager.normalizeModelURL(r[d]);this.load(u,o)}removeModel(r,o){this.models[o]||(this.models[o]={});const u=this.models[o][r];delete this.models[o][r],u.destroy()}listModels(r){return this.models[r]||(this.models[r]={}),Object.keys(this.models[r])}upload(r,o){this.models[o]||(this.models[o]={});for(const u in this.models[o])this.models[o][u].upload(r.context)}}class qt{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(r,o,u){const d=String(o);if(this.stateChanges[r]=this.stateChanges[r]||{},this.stateChanges[r][d]=this.stateChanges[r][d]||{},a.e(this.stateChanges[r][d],u),this.deletedStates[r]===null){this.deletedStates[r]={};for(const p in this.state[r])p!==d&&(this.deletedStates[r][p]=null)}else if(this.deletedStates[r]&&this.deletedStates[r][d]===null){this.deletedStates[r][d]={};for(const p in this.state[r][d])u[p]||(this.deletedStates[r][d][p]=null)}else for(const p in u)this.deletedStates[r]&&this.deletedStates[r][d]&&this.deletedStates[r][d][p]===null&&delete this.deletedStates[r][d][p]}removeFeatureState(r,o,u){if(this.deletedStates[r]===null)return;const d=String(o);if(this.deletedStates[r]=this.deletedStates[r]||{},u&&o!==void 0)this.deletedStates[r][d]!==null&&(this.deletedStates[r][d]=this.deletedStates[r][d]||{},this.deletedStates[r][d][u]=null);else if(o!==void 0)if(this.stateChanges[r]&&this.stateChanges[r][d])for(u in this.deletedStates[r][d]={},this.stateChanges[r][d])this.deletedStates[r][d][u]=null;else this.deletedStates[r][d]=null;else this.deletedStates[r]=null}getState(r,o){const u=String(o),d=a.e({},(this.state[r]||{})[u],(this.stateChanges[r]||{})[u]);if(this.deletedStates[r]===null)return{};if(this.deletedStates[r]){const p=this.deletedStates[r][o];if(p===null)return{};for(const g in p)delete d[g]}return d}initializeTileState(r,o){r.setFeatureState(this.state,o)}coalesceChanges(r,o){const u={};for(const d in this.stateChanges){this.state[d]=this.state[d]||{};const p={};for(const g in this.stateChanges[d])this.state[d][g]||(this.state[d][g]={}),a.e(this.state[d][g],this.stateChanges[d][g]),p[g]=this.state[d][g];u[d]=p}for(const d in this.deletedStates){this.state[d]=this.state[d]||{};const p={};if(this.deletedStates[d]===null)for(const g in this.state[d])p[g]={},this.state[d][g]={};else for(const g in this.deletedStates[d]){if(this.deletedStates[d][g]===null)this.state[d][g]={};else if(this.state[d][g])for(const x of Object.keys(this.deletedStates[d][g]))delete this.state[d][g][x];p[g]=this.state[d][g]}u[d]=u[d]||{},a.e(u[d],p)}if(this.stateChanges={},this.deletedStates={},Object.keys(u).length!==0)for(const d in r)r[d].setFeatureState(u,o)}}function dr(c){const{userImage:r}=c;return!!(r&&r.render&&r.render())&&(c.data.replace(new Uint8Array(r.data.buffer)),!0)}class ja extends a.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded={},this.requestors=[],this.patterns={},this.atlasImage={},this.atlasTexture={},this.dirty=!0}createScope(r){this.images[r]={},this.loaded[r]=!1,this.updatedImages[r]={},this.patterns[r]={},this.callbackDispatchedThisFrame[r]={},this.atlasImage[r]=new a.h({width:1,height:1})}isLoaded(){for(const r in this.loaded)if(!this.loaded[r])return!1;return!0}setLoaded(r,o){if(this.loaded[o]!==r&&(this.loaded[o]=r,r)){for(const{ids:u,callback:d}of this.requestors)this._notify(u,o,d);this.requestors=[]}}hasImage(r,o){return!!this.getImage(r,o)}getImage(r,o){return this.images[o][r]}addImage(r,o,u){this._validate(r,u)&&(this.images[o][r]=u)}_validate(r,o){let u=!0;return this._validateStretch(o.stretchX,o.data&&o.data.width)||(this.fire(new a.a(new Error(`Image "${r}" has invalid "stretchX" value`))),u=!1),this._validateStretch(o.stretchY,o.data&&o.data.height)||(this.fire(new a.a(new Error(`Image "${r}" has invalid "stretchY" value`))),u=!1),this._validateContent(o.content,o)||(this.fire(new a.a(new Error(`Image "${r}
13" has invalid "content" value`))),u=!1),u}_validateStretch(r,o){if(!r)return!0;let u=0;for(const d of r){if(d[0]<u||d[1]<d[0]||o<d[1])return!1;u=d[1]}return!0}_validateContent(r,o){return!(r&&(r.length!==4||r[0]<0||o.data.width<r[0]||r[1]<0||o.data.height<r[1]||r[2]<0||o.data.width<r[2]||r[3]<0||o.data.height<r[3]||r[2]<r[0]||r[3]<r[1]))}updateImage(r,o,u){u.version=this.images[o][r].version+1,this.images[o][r]=u,this.updatedImages[o][r]=!0}removeImage(r,o){const u=this.images[o][r];delete this.images[o][r],delete this.patterns[o][r],u.userImage&&u.userImage.onRemove&&u.userImage.onRemove()}listImages(r){return Object.keys(this.images[r])}getImages(r,o,u){let d=!0;const p=!!this.loaded[o];if(!p)for(const g of r)this.images[o][g]||(d=!1);p||d?this._notify(r,o,u):this.requestors.push({ids:r,scope:o,callback:u})}getUpdatedImages(r){return this.updatedImages[r]}_notify(r,o,u){const d={};for(const p of r){this.images[o][p]||this.fire(new a.b("styleimagemissing",{id:p}));const g=this.images[o][p];g?d[p]={data:g.data.clone(),pixelRatio:g.pixelRatio,sdf:g.sdf,version:g.version,stretchX:g.stretchX,stretchY:g.stretchY,content:g.content,hasRenderCallback:!!(g.userImage&&g.userImage.render)}:a.w(`Image "${p}" 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.`)}u(null,d)}getPixelSize(r){const{width:o,height:u}=this.atlasImage[r];return{width:o,height:u}}getPattern(r,o){const u=this.patterns[o][r],d=this.getImage(r,o);if(!d)return null;if(u&&u.position.version===d.version)return u.position;if(u)u.position.version=d.version;else{const p={w:d.data.width+2,h:d.data.height+2,x:0,y:0},g=new a.I(p,d);this.patterns[o][r]={bin:p,position:g}}return this._updatePatternAtlas(o),this.patterns[o][r].position}bind(r,o){const u=r.gl;let d=this.atlasTexture[o];d?this.dirty&&(d.update(this.atlasImage[o]),this.dirty=!1):(d=new a.T(r,this.atlasImage[o],u.RGBA),this.atlasTexture[o]=d),d.bind(u.LINEAR,u.CLAMP_TO_EDGE)}_updatePatternAtlas(r){const o=[];for(const g in this.patterns[r])o.push(this.patterns[r][g].bin);const{w:u,h:d}=a.p(o),p=this.atlasImage[r];p.resize({width:u||1,height:d||1});for(const g in this.patterns[r]){const{bin:x}=this.patterns[r][g],b=x.x+1,T=x.y+1,M=this.images[r][g].data,S=M.width,C=M.height;a.h.copy(M,p,{x:0,y:0},{x:b,y:T},{width:S,height:C}),a.h.copy(M,p,{x:0,y:C-1},{x:b,y:T-1},{width:S,height:1}),a.h.copy(M,p,{x:0,y:0},{x:b,y:T+C},{width:S,height:1}),a.h.copy(M,p,{x:S-1,y:0},{x:b-1,y:T},{width:1,height:C}),a.h.copy(M,p,{x:0,y:0},{x:b+S,y:T},{width:1,height:C})}this.dirty=!0}beginFrame(){for(const r in this.images)this.callbackDispatchedThisFrame[r]={}}dispatchRenderCallbacks(r,o){for(const u of r){if(this.callbackDispatchedThisFrame[o][u])continue;this.callbackDispatchedThisFrame[o][u]=!0;const d=this.images[o][u];dr(d)&&this.updateImage(u,o,d)}}}class $e{constructor(r,o,u,d){this.message=(r?`${r}: `:"")+u,d&&(this.identifier=d),o!=null&&o.__line__&&(this.line=o.__line__)}}class en extends $e{}function xr(c){const r=c.key,o=c.value,u=c.valueSpec||{},d=c.objectElementValidators||{},p=c.style,g=c.styleSpec;let x=[];const b=a.i(o);if(b!=="object")return[new $e(r,o,`object expected, ${b} found`)];for(const T in o){const M=T.split(".")[0];let S;d[M]?S=d[M]:u[M]?S=Vi:d["*"]?S=d["*"]:u["*"]&&(S=Vi),S?x=x.concat(S({key:(r&&`${r}.`)+T,value:o[T],valueSpec:u[M]||u["*"],style:p,styleSpec:g,object:o,objectKey:T},o)):x.push(new en(r,o[T],`unknown property "${T}"`))}for(const T in u)d[T]||u[T].required&&u[T].default===void 0&&o[T]===void 0&&x.push(new $e(r,o,`missing required property "${T}"`));return x}function Dt(c){const r=c.value,o=c.valueSpec,u=c.style,d=c.styleSpec,p=c.key,g=c.arrayElementValidator||Vi;if(a.i(r)!=="array")return[new $e(p,r,`array expected, ${a.i(r)} found`)];if(o.length&&r.length!==o.length)return[new $e(p,r,`array length ${o.length} expected, length ${r.length} found`)];if(o["min-length"]&&r.length<o["min-length"])return[new $e(p,r,`array length at least ${o["min-length"]} expected, length ${r.length} found`)];let x={type:o.value,values:o.values,minimum:o.minimum,maximum:o.maximum,function:void 0};d.$version<7&&(x.function=o.function),a.i(o.value)==="object"&&(x=o.value);let b=[];for(let T=0;T<r.length;T++)b=b.concat(g({array:r,arrayIndex:T,value:r[T],valueSpec:x,style:u,styleSpec:d,key:`${p}[${T}]`},!0));return b}function Jo(c){const r=c.key,o=c.value,u=c.valueSpec;let d=a.i(o);if(d==="number"&&o!=o&&(d="NaN"),d!=="number")return[new $e(r,o,`number expected, ${d} found`)];if("minimum"in u){let p=u.minimum;if(a.i(u.minimum)==="array"&&(p=u.minimum[c.arrayIndex]),o<p)return[new $e(r,o,`${o} is less than the minimum value ${p}`)]}if("maximum"in u){let p=u.maximum;if(a.i(u.maximum)==="array"&&(p=u.maximum[c.arrayIndex]),o>p)return[new $e(r,o,`${o} is greater than the maximum value ${p}`)]}return[]}function Hn(c){const r=c.valueSpec,o=a.u(c.value.type);let u,d,p,g={};
13const x=o!=="categorical"&&c.value.property===void 0,b=!x,T=a.i(c.value.stops)==="array"&&a.i(c.value.stops[0])==="array"&&a.i(c.value.stops[0][0])==="object",M=xr({key:c.key,value:c.value,valueSpec:c.styleSpec.function,style:c.style,styleSpec:c.styleSpec,objectElementValidators:{stops:function(P){if(o==="identity")return[new $e(P.key,P.value,'identity function may not have a "stops" property')];let k=[];const R=P.value;return k=k.concat(Dt({key:P.key,value:R,valueSpec:P.valueSpec,style:P.style,styleSpec:P.styleSpec,arrayElementValidator:S})),a.i(R)==="array"&&R.length===0&&k.push(new $e(P.key,R,"array must have at least one stop")),k},default:function(P){return Vi({key:P.key,value:P.value,valueSpec:r,style:P.style,styleSpec:P.styleSpec})}}});return o==="identity"&&x&&M.push(new $e(c.key,c.value,'missing required property "property"')),o==="identity"||c.value.stops||M.push(new $e(c.key,c.value,'missing required property "stops"')),o==="exponential"&&c.valueSpec.expression&&!a.s(c.valueSpec)&&M.push(new $e(c.key,c.value,"exponential functions not supported")),c.styleSpec.$version>=8&&(b&&!a.k(c.valueSpec)?M.push(new $e(c.key,c.value,"property functions not supported")):x&&!a.m(c.valueSpec)&&M.push(new $e(c.key,c.value,"zoom functions not supported"))),o!=="categorical"&&!T||c.value.property!==void 0||M.push(new $e(c.key,c.value,'"property" property is required')),M;function S(P){let k=[];const R=P.value,O=P.key;if(a.i(R)!=="array")return[new $e(O,R,`array expected, ${a.i(R)} found`)];if(R.length!==2)return[new $e(O,R,`array length 2 expected, length ${R.length} found`)];if(T){if(a.i(R[0])!=="object")return[new $e(O,R,`object expected, ${a.i(R[0])} found`)];if(R[0].zoom===void 0)return[new $e(O,R,"object stop key must have zoom")];if(R[0].value===void 0)return[new $e(O,R,"object stop key must have value")];const D=a.u(R[0].zoom);if(typeof D!="number")return[new $e(O,R[0].zoom,"stop zoom values must be numbers")];if(p&&p>D)return[new $e(O,R[0].zoom,"stop zoom values must appear in ascending order")];D!==p&&(p=D,d=void 0,g={}),k=k.concat(xr({key:`${O}[0]`,value:R[0],valueSpec:{zoom:{}},style:P.style,styleSpec:P.styleSpec,objectElementValidators:{zoom:Jo,value:C}}))}else k=k.concat(C({key:`${O}[0]`,value:R[0],valueSpec:{},style:P.style,styleSpec:P.styleSpec},R));return a.n(a.o(R[1]))?k.concat([new $e(`${O}[1]`,R[1],"expressions are not allowed in function stops.")]):k.concat(Vi({key:`${O}[1]`,value:R[1],valueSpec:r,style:P.style,styleSpec:P.styleSpec}))}function C(P,k){const R=a.i(P.value),O=a.u(P.value),D=P.value!==null?P.value:k;if(u){if(R!==u)return[new $e(P.key,D,`${R} stop domain type must match previous stop domain type ${u}`)]}else u=R;if(R!=="number"&&R!=="string"&&R!=="boolean"&&typeof O!="number"&&typeof O!="string"&&typeof O!="boolean")return[new $e(P.key,D,"stop domain value must be a number, string, or boolean")];if(R!=="number"&&o!=="categorical"){let F=`number expected, ${R} found`;return a.k(r)&&o===void 0&&(F+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new $e(P.key,D,F)]}return o!=="categorical"||R!=="number"||typeof O=="number"&&isFinite(O)&&Math.floor(O)===O?o!=="categorical"&&R==="number"&&typeof O=="number"&&typeof d=="number"&&d!==void 0&&O<d?[new $e(P.key,D,"stop domain values must appear in ascending order")]:(d=O,o==="categorical"&&O in g?[new $e(P.key,D,"stop domain values must be unique")]:(g[O]=!0,[])):[new $e(P.key,D,`integer expected, found ${String(O)}`)]}}function tn(c){const r=(c.expressionContext==="property"?a.q:a.r)(a.o(c.value),c.valueSpec);if(r.result==="error")return r.value.map(u=>new $e(`${c.key}${u.key}`,c.value,u.message));const o=r.value.expression||r.value._styleExpression.expression;if(c.expressionContext==="property"&&c.propertyKey==="text-font"&&!o.outputDefined())return[new $e(c.key,c.value,`Invalid data expression for "${c.propertyKey}". Output values must be contained as literals within the expression.`)];if(c.expressionContext==="property"&&c.propertyType==="layout"&&!a.t(o))return[new $e(c.key,c.value,'"feature-state" data expressions are not supported with layout properties.')];if(c.expressionContext==="filter")return fr(o,c);if(c.expressionContext&&c.expressionContext.indexOf("cluster")===0){if(!a.v(o,["zoom","feature-state"]))return[new $e(c.key,c.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(c.expressionContext==="cluster-initial"&&!a.x(o))return[new $e(c.key,c.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function fr(c,r){const o=new Set(["zoom","feature-state","pitch","distance-from-center"]);if(r.valueSpec&&r.valueSpec.expression)for(const d of r.valueSpec.expression.parameters)o.delete(
13d);if(o.size===0)return[];const u=[];return c instanceof a.C&&o.has(c.name)?[new $e(r.key,r.value,`["${c.name}"] expression is not supported in a filter for a ${r.object.type} layer with id: ${r.object.id}`)]:(c.eachChild(d=>{u.push(...fr(d,r))}),u)}function Mo(c){const r=c.key,o=c.value,u=c.valueSpec,d=[];return Array.isArray(u.values)?u.values.indexOf(a.u(o))===-1&&d.push(new $e(r,o,`expected one of [${u.values.join(", ")}], ${JSON.stringify(o)} found`)):Object.keys(u.values).indexOf(a.u(o))===-1&&d.push(new $e(r,o,`expected one of [${Object.keys(u.values).join(", ")}], ${JSON.stringify(o)} found`)),d}function Qo(c){return a.z(a.o(c.value))?tn(a.j({},c,{expressionContext:"filter",valueSpec:c.styleSpec[`filter_${c.layerType||"fill"}`]})):js(c)}function js(c){const r=c.value,o=c.key;if(a.i(r)!=="array")return[new $e(o,r,`array expected, ${a.i(r)} found`)];const u=c.styleSpec;let d,p=[];if(r.length<1)return[new $e(o,r,"filter array must have at least 1 element")];switch(p=p.concat(Mo({key:`${o}[0]`,value:r[0],valueSpec:u.filter_operator,style:c.style,styleSpec:c.styleSpec})),a.u(r[0])){case"<":case"<=":case">":case">=":r.length>=2&&a.u(r[1])==="$type"&&p.push(new $e(o,r,`"$type" cannot be use with operator "${r[0]}"`));case"==":case"!=":r.length!==3&&p.push(new $e(o,r,`filter array for operator "${r[0]}" must have 3 elements`));case"in":case"!in":r.length>=2&&(d=a.i(r[1]),d!=="string"&&p.push(new $e(`${o}[1]`,r[1],`string expected, ${d} found`)));for(let g=2;g<r.length;g++)d=a.i(r[g]),a.u(r[1])==="$type"?p=p.concat(Mo({key:`${o}[${g}]`,value:r[g],valueSpec:u.geometry_type,style:c.style,styleSpec:c.styleSpec})):d!=="string"&&d!=="number"&&d!=="boolean"&&p.push(new $e(`${o}[${g}]`,r[g],`string, number, or boolean expected, ${d} found`));break;case"any":case"all":case"none":for(let g=1;g<r.length;g++)p=p.concat(js({key:`${o}[${g}]`,value:r[g],style:c.style,styleSpec:c.styleSpec}));break;case"has":case"!has":d=a.i(r[1]),r.length!==2?p.push(new $e(o,r,`filter array for "${r[0]}" operator must have 2 elements`)):d!=="string"&&p.push(new $e(`${o}[1]`,r[1],`string expected, ${d} found`))}return p}function Gs(c,r){const o=c.key,u=c.style,d=c.layer,p=c.styleSpec,g=c.value,x=c.objectKey,b=p[`${r}_${c.layerType}`];if(!b)return[];const T=x.match(/^(.*)-transition$/);if(r==="paint"&&T&&b[T[1]]&&b[T[1]].transition)return Vi({key:o,value:g,valueSpec:p.transition,style:u,styleSpec:p});const M=c.valueSpec||b[x];if(!M)return[new en(o,g,`unknown property "${x}"`)];let S;if(a.i(g)==="string"&&a.k(M)&&!M.tokens&&(S=/^{([^}]+)}$/.exec(g))){const P=`\`{ "type": "identity", "property": ${S?JSON.stringify(S[1]):'"_"'} }\``;return[new $e(o,g,`"${x}" does not support interpolation syntax 14Use an identity property function instead: ${P}.`)]}const C=[];if(c.layerType==="symbol")x!=="text-field"||!u||u.glyphs||u.imports||C.push(new $e(o,g,'use of "text-field" requires a style "glyphs" property')),x==="text-font"&&a.A(a.o(g))&&a.u(g.type)==="identity"&&C.push(new $e(o,g,'"text-font" does not support identity functions'));else if(c.layerType==="model"&&r==="paint"&&d&&d.layout&&d.layout.hasOwnProperty("model-id")&&a.k(M)&&(a.B(M)||a.m(M))){const P=a.q(a.o(g),M),k=P.value.expression||P.value._styleExpression.expression;k&&!a.v(k,["measure-light"])&&(x==="model-emissive-strength"&&a.x(k)&&a.t(k)||C.push(new $e(o,g,`${x} does not support measure-light expressions when the model layer source is vector tile or GeoJSON.`)))}return C.concat(Vi({key:c.key,value:g,valueSpec:M,style:u,styleSpec:p,expressionContext:"property",propertyType:r,propertyKey:x}))}function Zs(c){return Gs(c,"paint")}function Eo(c){return Gs(c,"layout")}function En(c){let r=[];const o=c.value,u=c.key,d=c.style,p=c.styleSpec;o.type||o.ref||r.push(new $e(u,o,'either "type" or "ref" is required'));let g=a.u(o.type);const x=a.u(o.ref);if(o.id){const b=a.u(o.id);for(let T=0;T<c.arrayIndex;T++){const M=d.layers[T];a.u(M.id)===b&&r.push(new $e(u,o.id,`duplicate layer id "${o.id}", previously used at line ${M.id.__line__}`))}}if("ref"in o){let b;["type","source","source-layer","filter","layout"].forEach(T=>{T in o&&r.push(new $e(u,o[T],`"${T}" is prohibited for ref layers`))}
14),d.layers.forEach(T=>{a.u(T.id)===x&&(b=T)}),b?b.ref?r.push(new $e(u,o.ref,"ref cannot reference another ref layer")):g=a.u(b.type):typeof x=="string"&&r.push(new $e(u,o.ref,`ref layer "${x}" not found`))}else if(g!=="background"&&g!=="sky"&&g!=="slot")if(o.source){const b=d.sources&&d.sources[o.source],T=b&&a.u(b.type);b?T==="vector"&&g==="raster"?r.push(new $e(u,o.source,`layer "${o.id}" requires a raster source`)):T==="raster"&&g!=="raster"?r.push(new $e(u,o.source,`layer "${o.id}" requires a vector source`)):T!=="vector"||o["source-layer"]?T==="raster-dem"&&g!=="hillshade"?r.push(new $e(u,o.source,"raster-dem source can only be used with layer type 'hillshade'.")):T!=="raster-array"||["raster","raster-particle"].includes(g)?g!=="line"||!o.paint||!o.paint["line-gradient"]&&!o.paint["line-trim-offset"]||T==="geojson"&&b.lineMetrics?g==="raster-particle"&&T!=="raster-array"&&r.push(new $e(u,o.source,`layer "${o.id}" requires a 'raster-array' source.`)):r.push(new $e(u,o,`layer "${o.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):r.push(new $e(u,o.source,"raster-array source can only be used with layer type 'raster'.")):r.push(new $e(u,o,`layer "${o.id}" must specify a "source-layer"`)):r.push(new $e(u,o.source,`source "${o.source}" not found`))}else r.push(new $e(u,o,'missing required property "source"'));return r=r.concat(xr({key:u,value:o,valueSpec:p.layer,style:c.style,styleSpec:c.styleSpec,objectElementValidators:{"*":()=>[],type:()=>Vi({key:`${u}.type`,value:o.type,valueSpec:p.layer.type,style:c.style,styleSpec:c.styleSpec,object:o,objectKey:"type"}),filter:b=>Qo(a.j({layerType:g},b)),layout:b=>xr({layer:o,key:b.key,value:b.value,valueSpec:{},style:b.style,styleSpec:b.styleSpec,objectElementValidators:{"*":T=>Eo(a.j({layerType:g},T))}}),paint:b=>xr({layer:o,key:b.key,value:b.value,valueSpec:{},style:b.style,styleSpec:b.styleSpec,objectElementValidators:{"*":T=>Zs(a.j({layerType:g,layer:o},T))}})}})),r}function pr(c){const r=c.value,o=c.key,u=a.i(r);return u!=="string"?[new $e(o,r,`string expected, ${u} found`)]:[]}const jr={promoteId:function({key:c,value:r}){if(a.i(r)==="string")return pr({key:c,value:r});{const o=[];for(const u in r)o.push(...pr({key:`${c}.${u}`,value:r[u]}));return o}}};function Or(c){const r=c.value,o=c.key,u=c.styleSpec,d=c.style;if(!r.type)return[new $e(o,r,'"type" is required')];const p=a.u(r.type);let g=[];switch(["vector","raster","raster-dem","raster-array"].includes(p)&&(r.url||r.tiles||g.push(new en(o,r,'Either "url" or "tiles" is required.'))),p){case"vector":case"raster":case"raster-dem":case"raster-array":return g=g.concat(xr({key:o,value:r,valueSpec:u[`source_${p.replace("-","_")}`],style:c.style,styleSpec:u,objectElementValidators:jr})),g;case"geojson":if(g=xr({key:o,value:r,valueSpec:u.source_geojson,style:d,styleSpec:u,objectElementValidators:jr}),r.cluster)for(const x in r.clusterProperties){const[b,T]=r.clusterProperties[x],M=typeof b=="string"?[b,["accumulated"],["get",x]]:b;g.push(...tn({key:`${o}.${x}.map`,value:T,expressionContext:"cluster-map"})),g.push(...tn({key:`${o}.${x}.reduce`,value:M,expressionContext:"cluster-reduce"}))}return g;case"video":return xr({key:o,value:r,valueSpec:u.source_video,style:d,styleSpec:u});case"image":return xr({key:o,value:r,valueSpec:u.source_image,style:d,styleSpec:u});case"canvas":return[new $e(o,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Mo({key:`${o}.type`,value:r.type,valueSpec:{values:Ga(u)},style:d,styleSpec:u})}}function Ga(c){return c.source.reduce((r,o)=>{const u=c[o];return u.type.type==="enum"&&(r=r.concat(Object.keys(u.type.values))),r},[])}function ki(c){const r=c.value;let o=[];if(!r)return o;const u=a.i(r);return u!=="string"?(o=o.concat([new $e(c.key,r,`string expected, "${u}" found`)]),o):(function(d){const p=d.indexOf("://")===-1;try{return new URL(d,p?"http://example.com":void 0),!0}catch{return!1}}(r)||(o=o.concat([new $e(c.key,r,`invalid url "${r}"`)])),o)}function Gr(c){const r=c.value,o=c.styleSpec,u=o.light,d=c.style;let p=[];const g=a.i(r);if(r===void 0)return p;if(g!=="object")return p=p.concat([new $e("light",r,`object expected, ${g} found`)]),p;for(const x in r){const b=x.match(/^(.*)-transition$/);p=p.concat(b&&u[b[1]]&&u[b[1]].transition?Vi({key:x,value:r[x],valueSpec:o.transition,style:d,styleSpec:o}):u[x]?Vi({key:x,value:r[x],valueSpec:u[x],style:d,styleSpec:o}):[new $e(x,r[x],`unknown property "${x}"`)])}return p}function So(c){const r=c.value;let o=[];if(!r)return o;const u=a.i(r);if(u!=="object")return o=o.concat([new $e("light-3d",r,`object expected, ${u}
14 found`)]),o;const d=c.styleSpec,p=d["light-3d"],g=c.key,x=c.style,b=c.style.lights;for(const S of["type","id"])if(!(S in r))return o=o.concat([new $e("light-3d",r,`missing property ${S} on light`)]),o;if(r.type&&b)for(let S=0;S<c.arrayIndex;S++){const C=a.u(r.type),P=b[S];a.u(P.type)===C&&o.push(new $e(g,r.id,`duplicate light type "${r.type}", previously defined at line ${P.id.__line__}`))}const T=`properties_light_${r.type}`;if(!(T in d))return o=o.concat([new $e("light-3d",r,`Invalid light type ${r.type}`)]),o;const M=d[T];for(const S in r)if(S==="properties"){const C=r[S],P=a.i(C);if(P!=="object")return o=o.concat([new $e("properties",C,`object expected, ${P} found`)]),o;for(const k in C)o=o.concat(M[k]?Vi({key:k,value:C[k],valueSpec:M[k],style:x,styleSpec:d}):[new en(c.key,C[k],`unknown property "${k}"`)])}else{const C=S.match(/^(.*)-transition$/);o=o.concat(C&&p[C[1]]&&p[C[1]].transition?Vi({key:S,value:r[S],valueSpec:d.transition,style:x,styleSpec:d}):p[S]?Vi({key:S,value:r[S],valueSpec:p[S],style:x,styleSpec:d}):[new en(S,r[S],`unknown property "${S}"`)])}return o}function Sn(c){const r=c.value,o=c.key,u=c.style,d=c.styleSpec,p=d.terrain;let g=[];const x=a.i(r);if(r===void 0||x==="null")return g;if(x!=="object")return g=g.concat([new $e("terrain",r,`object expected, ${x} found`)]),g;for(const b in r){const T=b.match(/^(.*)-transition$/);g=g.concat(T&&p[T[1]]&&p[T[1]].transition?Vi({key:b,value:r[b],valueSpec:d.transition,style:u,styleSpec:d}):p[b]?Vi({key:b,value:r[b],valueSpec:p[b],style:u,styleSpec:d}):[new en(b,r[b],`unknown property "${b}"`)])}if(r.source){const b=u.sources&&u.sources[r.source],T=b&&a.u(b.type);b?T!=="raster-dem"&&g.push(new $e(o,r.source,`terrain cannot be used with a source of type ${String(T)}, it only be used with a "raster-dem" source type`)):g.push(new $e(o,r.source,`source "${r.source}" not found`))}else g.push(new $e(o,r,'terrain is missing required property "source"'));return g}function yn(c){const r=c.value,o=c.style,u=c.styleSpec,d=u.fog;let p=[];const g=a.i(r);if(r===void 0)return p;if(g!=="object")return p=p.concat([new $e("fog",r,`object expected, ${g} found`)]),p;for(const x in r){const b=x.match(/^(.*)-transition$/);p=p.concat(b&&d[b[1]]&&d[b[1]].transition?Vi({key:x,value:r[x],valueSpec:u.transition,style:o,styleSpec:u}):d[x]?Vi({key:x,value:r[x],valueSpec:d[x],style:o,styleSpec:u}):[new en(x,r[x],`unknown property "${x}"`)])}return p}const Ao={"*":()=>[],array:Dt,boolean:function(c){const r=c.value,o=c.key,u=a.i(r);return u!=="boolean"?[new $e(o,r,`boolean expected, ${u} found`)]:[]},number:Jo,color:function(c){const r=c.key,o=c.value,u=a.i(o);return u!=="string"?[new $e(r,o,`color expected, ${u} found`)]:a.y(o)===null?[new $e(r,o,`color expected, "${o}" found`)]:[]},enum:Mo,filter:Qo,function:Hn,layer:En,object:xr,source:Or,model:ki,light:Gr,"light-3d":So,terrain:Sn,fog:yn,string:pr,formatted:function(c){return pr(c).length===0?[]:tn(c)},resolvedImage:function(c){return pr(c).length===0?[]:tn(c)},projection:function(c){const r=c.value,o=c.styleSpec,u=o.projection,d=c.style;let p=[];const g=a.i(r);if(g==="object")for(const x in r)p=p.concat(Vi({key:x,value:r[x],valueSpec:u[x],style:d,styleSpec:o}));else g!=="string"&&(p=p.concat([new $e("projection",r,`object or string expected, ${g} found`)]));return p},import:function(c){const{value:r,styleSpec:o}=c,{data:u,...d}=r;Object.defineProperty(d,"__line__",{value:r.__line__,enumerable:!1});let p=xr(a.j({},c,{value:d,valueSpec:o.import}));return a.u(d.id)===""&&p.push(new $e(`${c.key}.id`,d,"import id can't be an empty string")),u&&(p=p.concat(ts(u,o,{key:`${c.key}.data`}))),p}};function Vi(c,r=!1){const o=c.value,u=c.valueSpec,d=c.styleSpec;if(u.expression&&a.A(a.u(o)))return Hn(c);if(u.expression&&a.n(a.o(o)))return tn(c);if(u.type&&Ao[u.type]){const p=Ao[u.type](c);return r===!0&&p.length>0&&a.i(c.value)==="array"?tn(c):p}return xr(a.j({},c,{valueSpec:u.type?d[u.type]:u}))}function es(c){const r=c.value,o=c.key,u=pr(c);return u.length||(r.indexOf("{fontstack}")===-1&&u.push(new $e(o,r,'"glyphs" url must include a "{fontstack}" token')),r.indexOf("{range}")===-1&&u.push(new $e(o,r,'"glyphs" url must include a "{range}" token'))),u}function ts(c,r=a.D,o={}){return Vi({key:o.key||"",value:c,valueSpec:r.$root,styleSpec:r,style:c,objectElementValidators:{glyphs:es,"*":()=>[]}})}function Zr(c,r=a.D){return xe(ts(c,r))}const An=c=>xe(Or(c)),Xn=c=>xe(Gr(c)),Te=c=>xe(So(c)),U=c=>xe(Sn(c)),H=c=>xe(yn(c)),te=c=>xe(En(c)),ye=c=>xe(Qo(c)),Ee=c=>xe(Zs(c)),ze=c=>xe(Eo(c)),tt=c=>xe(ki(c));function xe(c){return c.slice().sort((r,o)=>r.line&&o.line?r.line-o.line:0)}function rt(c,r){let o=!1;if(r&&r.length)for(const u of r)u instanceof en?a.w(u.message):(c.fire(new a.a(new Error(u.message))),o=!0);return o}const Ye=new a.F({anchor:new a.G(a.D.light.anchor),position:new a.H(a.D.light.position),color:new a.G(a.D.light.color),intensity:new a.G(a.D.light.intensity)});class ot extends a.E{constructor(r,o="flat"){super(),this._transitionable=new a.J(Ye),this.setLight(r,o),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(r,o,u={}
14){this._validate(Xn,r,u)||(this._transitionable.setTransitionOrValue(r),this.id=o)}updateTransitions(r){this._transitioning=this._transitionable.transitioned(r,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(r){this.properties=this._transitioning.possiblyEvaluate(r)}_validate(r,o,u){return(!u||u.validate!==!1)&&rt(this,r.call(Zr,a.e({value:o,style:{glyphs:!0,sprite:!0},styleSpec:a.D})))}}const Lt=new a.F({source:new a.G(a.D.terrain.source),exaggeration:new a.G(a.D.terrain.exaggeration)});let hi=class extends a.E{constructor(c,r,o,u){super(),this.scope=o,this._transitionable=new a.J(Lt,o,u),this._transitionable.setTransitionOrValue(c,u),this._transitioning=this._transitionable.untransitioned(),this.drapeRenderMode=r}get(){return this._transitionable.serialize()}set(c,r){this._transitionable.setTransitionOrValue(c,r)}updateTransitions(c){this._transitioning=this._transitionable.transitioned(c,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(c){this.properties=this._transitioning.possiblyEvaluate(c)}getExaggeration(c){return this._transitioning.possiblyEvaluate(new a.K(c)).get("exaggeration")}isZoomDependent(){const c=this._transitionable._values.exaggeration;return c!=null&&c.value!=null&&c.value.expression!=null&&c.value.expression instanceof a.Z}};const wi=45,di=65,ai=.05;function ri(c,r,o,u){const d=a.O(wi,di,o),[p,g]=ci(c,u);let x=1-Math.min(1,Math.exp((r-p)/(g-p)*-6));return x*=x*x,x=Math.min(1,1.00747*x),x*d*c.alpha}function ci(c,r){const o=.5/Math.tan(.5*r);return[c.range[0]+o,c.range[1]+o]}function yi(c,r,o,u,d){const p=a.N.transformMat4([],[r,o,u],d.mercatorFogMatrix);return ri(c,a.N.length(p),d.pitch,d._fov)}function Ki(c,r,o,u,d,p,g){const x=[[o,u,0],[d,u,0],[d,p,0],[o,p,0]];let b=Number.MAX_VALUE,T=-Number.MAX_VALUE;for(const M of x){const S=a.N.transformMat4([],M,r),C=a.N.length(S);b=Math.min(b,C),T=Math.max(T,C)}return[ri(c,b,g.pitch,g._fov),ri(c,T,g.pitch,g._fov)]}const bi=new a.F({range:new a.G(a.D.fog.range),color:new a.G(a.D.fog.color),"high-color":new a.G(a.D.fog["high-color"]),"space-color":new a.G(a.D.fog["space-color"]),"horizon-blend":new a.G(a.D.fog["horizon-blend"]),"star-intensity":new a.G(a.D.fog["star-intensity"]),"vertical-range":new a.G(a.D.fog["vertical-range"])});class vr extends a.E{constructor(r,o,u,d){super(),this._transitionable=new a.J(bi,u,new Map(d)),this.set(r,d),this._transitioning=this._transitionable.untransitioned(),this._transform=o,this.properties=new a.Q(bi)}get state(){const r=this._transform,o=r.projection.name==="globe",u=a.S(r.zoom),d=this.properties.get("range"),p=[.5,3];return{range:o?[a.U(p[0],d[0],u),a.U(p[1],d[1],u)]:d,horizonBlend:this.properties.get("horizon-blend"),alpha:this.properties.get("color").a}}get(){return this._transitionable.serialize()}set(r,o,u={}){if(this._validate(H,r,u))return;const d=a.e({},r);for(const p of Object.keys(a.D.fog))d[p]===void 0&&(d[p]=a.D.fog[p].default);this._options=d,this._transitionable.setTransitionOrValue(this._options,o)}getOpacity(r){if(!this._transform.projection.supportsFog)return 0;const o=this.properties&&this.properties.get("color")||1;return(this._transform.projection.name==="globe"?1:a.O(wi,di,r))*o.a}getOpacityAtLatLng(r,o){return this._transform.projection.supportsFog?function(u,d,p){const g=a.L.fromLngLat(d),x=p.elevation?p.elevation.getAtPointOrZero(g):0;return yi(u,g.x,g.y,x,p)}(this.state,r,o):0}getOpacityForTile(r){if(!this._transform.projection.supportsFog)return[1,1];const o=this._transform.calculateFogTileMatrix(r.toUnwrapped());return Ki(this.state,o,0,0,a.V,a.V,this._transform)}getOpacityForBounds(r,o,u,d,p){return this._transform.projection.supportsFog?Ki(this.state,r,o,u,d,p,this._transform):[1,1]}getFovAdjustedRange(r){return this._transform.projection.supportsFog?ci(this.state,r):[0,1]}isVisibleOnFrustum(r){if(!this._transform.projection.supportsFog)return!1;const o=[4,5,6,7];for(const u of o){const d=r.points[u];let p;if(d[2]>=0)p=d;else{const g=r.points[u-4];p=a.W(g,d,g[2]/(g[2]-d[2]))}if(yi(this.state,p[0],p[1],0,this._transform)>=ai)return!0}return!1}updateConfig(r){this._transitionable.setTransitionOrValue(this._options,new Map(r))}updateTransitions(r){this._transitioning=this._transitionable.transitioned(r,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(r){this.properties=this._transitioning.possiblyEvaluate(r)}_validate(r,o,u){return(!u||u.validate!==!1)&&rt(this,r.call(Zr,a.e({value:o,style:{glyphs:!0,sprite:!0},styleSpec:a.D}
vendor: 9,545 bytes, line 14
14)))}}class _r extends a.E{constructor(r,o,u,d){super(),this.scope=u,this._options=r,this.properties=new a.Q(o),this._transitionable=new a.J(o,u,new Map(d)),this._transitionable.setTransitionOrValue(r.properties),this._transitioning=this._transitionable.untransitioned()}updateConfig(r){this._transitionable.setTransitionOrValue(this._options.properties,new Map(r))}updateTransitions(r){this._transitioning=this._transitionable.transitioned(r,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(r){this.properties=this._transitioning.possiblyEvaluate(r)}get(){return this._options.properties=this._transitionable.serialize(),this._options}set(r,o){this._options=r,this._transitionable.setTransitionOrValue(r.properties,o)}shadowsEnabled(){return!!this.properties&&this.properties.get("cast-shadows")===!0}}const Er=new a.F({color:new a.G(a.D.properties_light_ambient.color),intensity:new a.G(a.D.properties_light_ambient.intensity)}),Zi=new a.F({direction:new a.X(a.D.properties_light_directional.direction),color:new a.G(a.D.properties_light_directional.color),intensity:new a.G(a.D.properties_light_directional.intensity),"cast-shadows":new a.G(a.D.properties_light_directional["cast-shadows"]),"shadow-intensity":new a.G(a.D.properties_light_directional["shadow-intensity"])});class Ui{constructor(r,o,u,d){this.screenBounds=r,this.cameraPoint=o,this._screenRaycastCache={},this._cameraRaycastCache={},this.isAboveHorizon=u,this.screenGeometry=this.bufferedScreenGeometry(0),this.screenGeometryMercator=this._bufferedScreenMercator(0,d)}static createFromScreenPoints(r,o){let u,d;if(r instanceof a.P||typeof r[0]=="number"){const p=a.P.convert(r);u=[p],d=o.isPointAboveHorizon(p)}else{const p=a.P.convert(r[0]),g=a.P.convert(r[1]);u=[p,g],d=a.Y(p,g).every(x=>o.isPointAboveHorizon(x))}return new Ui(u,o.getCameraPoint(),d,o)}isPointQuery(){return this.screenBounds.length===1}bufferedScreenGeometry(r){return a.Y(this.screenBounds[0],this.screenBounds.length===1?this.screenBounds[0]:this.screenBounds[1],r)}bufferedCameraGeometry(r){const o=this.screenBounds[0],u=this.screenBounds.length===1?this.screenBounds[0].add(new a.P(1,1)):this.screenBounds[1],d=a.Y(o,u,0,!1);return this.cameraPoint.y>u.y&&(this.cameraPoint.x>o.x&&this.cameraPoint.x<u.x?d.splice(3,0,this.cameraPoint):this.cameraPoint.x>=u.x?d[2]=this.cameraPoint:this.cameraPoint.x<=o.x&&(d[3]=this.cameraPoint)),a._(d,r)}bufferedCameraGeometryGlobe(r){const o=this.screenBounds[0],u=this.screenBounds.length===1?this.screenBounds[0].add(new a.P(1,1)):this.screenBounds[1],d=a.Y(o,u,r),p=this.cameraPoint.clone();switch(3*((p.y>o.y)+(p.y>u.y))+((p.x>o.x)+(p.x>u.x))){case 0:d[0]=p,d[4]=p.clone();break;case 1:d.splice(1,0,p);break;case 2:d[1]=p;break;case 3:d.splice(4,0,p);break;case 5:d.splice(2,0,p);break;case 6:d[3]=p;break;case 7:d.splice(3,0,p);break;case 8:d[2]=p}return d}containsTile(r,o,u,d=0){const p=r.queryPadding/o._pixelsPerMercatorPixel+1,g=u?this._bufferedCameraMercator(p,o):this._bufferedScreenMercator(p,o);let x=r.tileID.wrap+(g.unwrapped?d:0);const b=g.polygon.map(O=>a.$(r.tileTransform,O,x));if(!a.a0(b,0,0,a.V,a.V))return;x=r.tileID.wrap+(this.screenGeometryMercator.unwrapped?d:0);const T=this.screenGeometryMercator.polygon.map(O=>a.a1(r.tileTransform,O,x)),M=T.map(O=>new a.P(O[0],O[1])),S=o.getFreeCameraOptions().position||new a.L(0,0,0),C=a.a1(r.tileTransform,S,x),P=T.map(O=>{const D=a.N.sub(O,O,C);return a.N.normalize(D,D),new a.a2(C,D)}),k=a.a3(r,1,o.zoom)*o._pixelsPerMercatorPixel;return{queryGeometry:this,tilespaceGeometry:M,tilespaceRays:P,bufferedTilespaceGeometry:b,bufferedTilespaceBounds:(R=a.a4(b),R.min.x=a.aa(R.min.x,0,a.V),R.min.y=a.aa(R.min.y,0,a.V),R.max.x=a.aa(R.max.x,0,a.V),R.max.y=a.aa(R.max.y,0,a.V),R),tile:r,tileID:r.tileID,pixelToTileUnitsFactor:k};var R}_bufferedScreenMercator(r,o){const u=De(r);if(this._screenRaycastCache[u])return this._screenRaycastCache[u];{let d;return d=o.projection.name==="globe"?this._projectAndResample(this.bufferedScreenGeometry(r),o):{polygon:this.bufferedScreenGeometry(r).map(p=>o.pointCoordinate3D(p)),unwrapped:!0},this._screenRaycastCache[u]=d,d}}_bufferedCameraMercator(r,o){const u=De(r);if(this._cameraRaycastCache[u])return this._cameraRaycastCache[u];{let d;return d=o.projection.name==="globe"?this._projectAndResample(this.bufferedCameraGeometryGlobe(r),o):{polygon:this.bufferedCameraGeometry(r).map(p=>o.pointCoordinate3D(p)),unwrapped:!0},this._cameraRaycastCache[u]=d,d}}_projectAndResample(r,o){const u=function(p,g){const x=a.a6.multiply([],g.pixelMatrix,g.globeMatrix),b=[0,-a.ab,0,1],T=[0,a.ab,0,1],M=[0,0,0,1];a.a7.transformMat4(b,b,x),a.a7.transformMat4(T,T,x),a.a7.transformMat4(M,M,x);const S=new a.P(b[0]/b[3],b[1]/b[3]),C=new a.P(T[0]/T[3],T[1]/T[3]),P=a.a8(p,S)&&b[3]<M[3],k=a.a8(p,C)&&T[3]<M[3];if(!P&&!k)return null;const R=function($,Y,K){for(let ee=1;ee<$.length;ee++){const ce=ve(Y.pointCoordinate3D($[ee-1]).x),re=ve(Y.pointCoordinate3D($[ee]).x);if(K<0){if(ce<re)return{idx:ee,t:-ce/(re-1-ce)}}else if(re<ce)return{idx:ee,t:(1-ce)/(re+1-ce)}}return null}(p,g,P?-1:1);if(!R)return null;const{idx:O,t:D}=R;let F=O>1?ge(p.slice(0,O),g):[],Z=O<p.length?ge(p.slice(O),g):[];F=F.map($=>new a.P(ve($.x),$.y)),Z=Z.map($=>new a.P(ve($.x),$.y));const V=[...F];V.length===0&&V.push(Z[Z.length-1]);const q=a.U(V[V.length-1].y,(Z.length===0?F[0]:Z[0]).y,D);let B;return B=P?[new a.P(0,q),new a.P(0,0),new a.P(1,0),new a.P(1,q)]:[new a.P(1,q),new a.P(1,1),new a.P(0,1),new a.P(0,q)],V.push(...B),Z.length===0?V.push(F[0]):V.push(...Z),{polygon:V.map($=>new a.L($.x,$.y)),unwrapped:!1}}(r,o);if(u)return u;const d=function(p,g){let x=!1,b=-1/0,T=0;for(let S=0;S<p.length-1;S++)p[S].x>b&&(b=p[S].x,T=S);for(let S=0;S<p.length-1;S++){const C=(T+S)%(p.length-1),P=p[C],k=p[C+1];Math.abs(P.x-k.x)>.5&&(P.x<k.x?(P.x+=1,C===0&&(p[p.length-1].x+=1)):(k.x+=1,C+1===p.length-1&&(p[0].x+=1)),x=!0)}const M=a.a5(g.center.lng);return x&&M<Math.abs(M-1)&&p.forEach(S=>{S.x-=1}),{polygon:p,unwrapped:x}}(ge(r,o).map(p=>new a.P(ve(p.x),p.y)),o);return{polygon:d.polygon.map(p=>new a.L(p.x,p.y)),unwrapped:d.unwrapped}}}function ge(c,r){return a.a9(c,o=>{const u=r.pointCoordinate3D(o);o.x=u.x,o.y=u.y},1/256)}function ve(c){return c<0?1+c%1:c%1}function De(c){return 100*c|0}function Ne(c,r,o,u,d){const p=function(g,x){if(g)return d(g);if(x){c.url&&x.tiles&&c.tiles&&delete c.tiles;const b=a.ac(a.e(x,c),["tiles","minzoom","maxzoom","attribution","mapbox_logo","bounds","scheme","tileSize","encoding"]);x.vector_layers&&(b.vectorLayers=x.vector_layers,b.vectorLayerIds=b.vectorLayers.map(T=>T.id)),x.raster_layers&&(b.rasterLayers=x.raster_layers,b.rasterLayerIds=b.rasterLayers.map(T=>T.id)),b.tiles=r.canonicalizeTileset(b,c.url),d(null,b)}};return c.url?a.g(r.transformRequest(r.normalizeSourceURL(c.url,null,o,u),a.R.Source),p):a.f.frame(()=>p(null,c))}class ke{constructor(r,o,u){this.bounds=a.ad.convert(this.validateBounds(r)),this.minzoom=o||0,this.maxzoom=u||24}validateBounds(r){return Array.isArray(r)&&r.length===4?[Math.max(-180,r[0]),Math.max(-90,r[1]),Math.min(180,r[2]),Math.min(90,r[3])]:[-180,-90,180,90]}contains(r){const o=Math.pow(2,r.z),u=Math.floor(a.a5(this.bounds.getWest())*o),d=Math.floor(a.ae(this.bounds.getNorth())*o),p=Math.ceil(a.a5(this.bounds.getEast())*o),g=Math.ceil(a.ae(this.bounds.getSouth())*o);return r.x>=u&&r.x<p&&r.y>=d&&r.y<g}}class Ge extends a.E{constructor(r,o,u,d){if(super(),this.id=r,this.dispatcher=u,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,a.e(this,a.ac(o,["url","scheme","tileSize","promoteId"])),this._options=a.e({type:"vector"},o),this._collectResourceTiming=!!o.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(d),this._tileWorkers={},this._deduped=new a.af}load(r){this._loaded=!1,this.fire(new a.b("dataloading",{dataType:"source"}));const o=Array.isArray(this.map._language)?this.map._language.join():this.map._language,u=this.map._worldview;this._tileJSONRequest=Ne(this._options,this.map._requestManager,o,u,(d,p)=>{this._tileJSONRequest=null,this._loaded=!0,d?(o&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${o}`),u&&u.length!==2&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${u}`),this.fire(new a.a(d))):p&&(a.e(this,p),p.bounds&&(this.tileBounds=new ke(p.bounds,this.minzoom,this.maxzoom)),a.aj(p.tiles,this.map._requestManager._customAccessToken),this.fire(new a.b("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new a.b("data",{dataType:"source",sourceDataType:"content"}))),r&&r(d)})}loaded(){return this._loaded}hasTile(r){return!this.tileBounds||this.tileBounds.contains(r.canonical)}onAdd(r){this.map=r,this.load()}reload(){this.cancelTileJSONRequest();const r=a.ag(this.id,this.scope);this.load(()=>this.map.style.clearSource(r))}setTiles(r){return this._options.tiles=r,this.reload(),this}setUrl(r){return this.url=r,this._options.url=r,this.reload(),this}onRemove(){this.cancelTileJSONRequest()}serialize(){return a.e({},this._options)}loadTile(r,o){const u=this.map._requestManager.normalizeTileURL(r.tileID.canonical.url(this.tiles,this.scheme)),d={request:this.map._requestManager.transformRequest(u,a.R.Tile),data:void 0,uid:r.uid,tileID:r.tileID,tileZoom:r.tileZoom,zoom:r.tileID.overscaledZ,tileSize:this.tileSize*r.tileID.overscaleFactor(),type:this.t
14ype,source:this.id,scope:this.scope,pixelRatio:a.f.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,isSymbolTile:r.isSymbolTile,brightness:this.map.style&&this.map.style.getBrightness()||0,extraShadowCaster:r.isExtraShadowCaster};if(d.request.collectResourceTiming=this._collectResourceTiming,r.actor&&r.state!=="expired")r.state==="loading"?r.reloadCallback=o:r.request=r.actor.send("reloadTile",d,p.bind(this));else if(r.actor=this._tileWorkers[u]=this._tileWorkers[u]||this.dispatcher.getActor(),this.dispatcher.ready)r.request=r.actor.send("loadTile",d,p.bind(this),void 0,!0);else{const g=a.ah.call({deduped:this._deduped},d,(x,b)=>{x||!b?p.call(this,x):(d.data={cacheControl:b.cacheControl,expires:b.expires,rawData:b.rawData.slice(0)},r.actor&&r.actor.send("loadTile",d,p.bind(this),void 0,!0))},!0);r.request={cancel:g}}function p(g,x){return delete r.request,r.aborted?o(null):g&&g.status!==404?o(g):(x&&x.resourceTiming&&(r.resourceTiming=x.resourceTiming),this.map._refreshExpiredTiles&&x&&r.setExpiryData(x),r.loadVectorData(x,this.map.painter),a.ai(this.dispatcher),o(null),void(r.reloadCallback&&(this.loadTile(r,r.reloadCallback),r.reloadCallback=null)))}}abortTile(r){r.request&&(r.request.cancel(),delete r.request),r.actor&&r.actor.send("abortTile",{uid:r.uid,type:this.t
14ype,source:this.id,scope:this.scope})}unloadTile(r){r.actor&&r.actor.send("removeTile",{uid:r.uid,type:this.type,source:this.id,scope:this.scope}),r.destroy()}hasTransition(){return!1}afterUpdate(){this._tileWorkers={}}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}class Ze extends a.E{constructor(r,o,u,d){super(),this.id=r,this.dispatcher=u,this.setEventedParent(d),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=a.e({type:"raster"},o),a.e(this,a.ac(o,["url","scheme","tileSize"]))}load(r){this._loaded=!1,this.fire(new a.b("dataloading",{dataType:"source"})),this._tileJSONRequest=Ne(this._options,this.map._requestManager,null,null,(o,u)=>{this._tileJSONRequest=null,this._loaded=!0,o?this.fire(new a.a(o)):u&&(a.e(this,u),u.bounds&&(this.tileBounds=new ke(u.bounds,this.minzoom,this.maxzoom)),a.aj(u.tiles),this.fire(new a.b("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new a.b("data",{dataType:"source",sourceDataType:"content"}))),r&&r(o)})}loaded(){return this._loaded}onAdd(r){this.map=r,this.load()}reload(){this.cancelTileJSONRequest();const r=a.ag(this.id,this.scope);this.load(()=>this.map.style.clearSource(r))}setTiles(r){return this._options.tiles=r,this.reload(),this}setUrl(r){return this.url=r,this._options.url=r,this.reload(),this}onRemove(){this.cancelTileJSONRequest()}serialize(){return a.e({},this._options)}hasTile(r){return!this.tileBounds||this.tileBounds.contains(r.canonical)}loadTile(r,o){const u=a.f.devicePixelRatio>=2,d=this.map._requestManager.normalizeTileURL(r.tileID.canonical.url(this.tiles,this.scheme),u,this.tileSize);r.request=a.d(this.map._requestManager.transformRequest(d,a.R.Tile),(p,g,x,b)=>(delete r.request,r.aborted?(r.state="unloaded",o(null)):p?(r.state="errored",o(p)):g?(this.map._refreshExpiredTiles&&r.setExpiryData({cacheControl:x,expires:b}),r.setTexture(g,this.map.painter),r.state="loaded",a.ai(this.dispatcher),void o(null)):o(null)))}abortTile(r,o){r.request&&(r.request.cancel(),delete r.request),o()}unloadTile(r,o){r.texture&&r.texture instanceof a.T?(r.destroy(!0),r.texture&&r.texture instanceof a.T&&this.map.painter.saveTileTexture(r.texture)):r.destroy(),o()}hasTransition(){return!1}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}class Be extends Ze{constructor(r,o,u,d){super(r,o,u,d),this.type="raster-array",this.maxzoom=22,this._options=a.e({type:"raster-array"},o)}triggerRepaint(r){const o=this.map.painter._terrain,u=this.map.style.getSourceCache(this.id);o&&o.enabled&&u&&o._clearRenderCacheForTile(u.id,r.tileID),this.map.triggerRepaint()}loadTile(r,o){const u=this.map._requestManager.normalizeTileURL(r.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize),d=this.map._requestManager.transformRequest(u,a.R.Tile);r.requestParams=d,r.actor||(r.actor=this.dispatcher.getActor()),r.request=r.fetchHeader(void 0,(p,g,x,b)=>{if(delete r.request,r.aborted)return r.state="unloaded",o(null);if(p)return p.code===20?void 0:(r.state="errored",o(p));this.map._refreshExpiredTiles&&r.setExpiryData({cacheControl:x,expires:b}),r.state="empty",o(null)})}unloadTile(r){const o=r.texture;o&&o instanceof a.T?(r.destroy(!0),this.map.painter.saveTileTexture(o)):(r.destroy(),r.flushQueues(),r._isHeaderLoaded=!1,delete r._mrt,delete r.textureDescriptor),r.fbo&&(r.fbo.destroy(),delete r.fbo),delete r.request,delete r.requestParams,delete r.neighboringTiles,r.state="unloaded"}prepareTile(r,o,u){r._isHeaderLoaded&&(r.state!=="empty"&&(r.state="reloading"),r.fetchBand(o,u,(d,p)=>{if(d)return r.state="errored",this.fire(new a.a(d)),void this.triggerRepaint(r);p&&(r.setTexture(p,this.map.painter),r.state="loaded",this.triggerRepaint(r))}))}getInitialBand(r){if(!this.rasterLayers)return 0;const o=this.rasterLayers.find(({id:p})=>p===r),u=o&&o.fields,d=u&&u.bands&&u.bands;return d?d[0]:0}getTextureDescriptor(r,o,u){if(!r)return;const d=o.sourceLayer||this.rasterLayerIds&&this.rasterLayerIds[0];if(!d)return;let p=null;o instanceof a.an?p=o.paint.get("raster-array-band"):o instanceof a.ao&&(p=o.paint.get("raster-particle-array-band"));const g=p||this.getInitialBand(d);if(g!=null)if(r.textureDescriptor){if(!r.updateNeeded(d,g)||u)return Object.assign({},r.textureDescriptor,{texture:r.texture})}else this.prepareTile(r,d,g)}}const We=32,Ve=33,_t=new Uint16Array(8184);for(let c=0;c<2046;c++){let r=c+2,o=0,u=0,d=0,p=0,g=0,x=0;for(1&r?d=p=g=We:o=u=x=We;(r>>=1)>1;){const T=o+d>>1,M=u+p>>1;1&r?(d=o,p=u,o=g,u=x):(o=d,u=p,d=g,p=x),g=T,x=M}const b=4*c;_t[b+0]=o,_t[b+1]=u,_t[b+2]=d,_t[b+3]=p}const Vt=new Uint16Array(2178),lt=new Uint8Array(1089),fi=new Uint16Array(1089);function Ei(c){return c===0?-.03125:c===32?.03125:0}class gi{constructor(r,o,u,d){this.id=gi.uniqueIdxCounter,gi.uniqueIdxCounter++,this.context=r;const p=r.gl;this.buffer=p.createBuffer(),this.dynamicDraw=!!u,this.context.unbindVAO(),r.bindElementBuffer.set(this.buffer),p.bufferData(p.ELEMENT_ARRAY_BUFFER,o.arrayBuffer,this.dynamicDraw?p.DYNAMIC_DRAW:p.STATIC_DRAW),this.dynamicDraw||d||o.destroy()}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(r){this.id=gi.uniqueIdxCounter,gi.uniqueIdxCounter++;const o=this.context.gl;this.context.unbindVAO(),this.bind(),o.bufferSubData(o.ELEMENT_ARRAY_BUFFER,0,r.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}gi.uniqueIdxCounter=0;const qi={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class sr{constructor(r,o,u,d,p,g){this.length=o.length,this.attributes=u,this.itemSize=o.bytesPerElement,this.dynamicDraw=d,this.instanceCount=g,this.context=r;const x=r.gl;this.buffer=x.createBuffer(),r.bindVertexBuffer.set(this.buffer),x.bufferData(x.ARRAY_BUFFER,o.arrayBuffer,this.dynamicDraw?x.DYNAMIC_DRAW:x.STATIC_DRAW),this.dynamicDraw||p||o.destroy()}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(r){const o=this.context.gl;this.bind(),o.bufferSubData(o.ARRAY_BUFFER,0,r.arrayBuffer)}
vendor: 14,569 bytes, line 14
14enableAttributes(r,o){for(let u=0;u<this.attributes.length;u++){const d=o.attributes[this.attributes[u].name];d!==void 0&&r.enableVertexAttribArray(d)}}setVertexAttribPointers(r,o,u){for(let d=0;d<this.attributes.length;d++){const p=this.attributes[d],g=o.attributes[p.name];g!==void 0&&r.vertexAttribPointer(g,p.components,r[qi[p.type]],!1,this.itemSize,p.offset+this.itemSize*(u||0))}}setVertexAttribDivisor(r,o,u){for(let d=0;d<this.attributes.length;d++){const p=o.attributes[this.attributes[d].name];p!==void 0&&this.instanceCount&&this.instanceCount>0&&r.vertexAttribDivisor(p,u)}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class ti{constructor(r){this.gl=r.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(r){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class Br extends ti{getDefault(){return a.ax.transparent}set(r){const o=this.current;(r.r!==o.r||r.g!==o.g||r.b!==o.b||r.a!==o.a||this.dirty)&&(this.gl.clearColor(r.r,r.g,r.b,r.a),this.current=r,this.dirty=!1)}}class rn extends ti{getDefault(){return 1}set(r){(r!==this.current||this.dirty)&&(this.gl.clearDepth(r),this.current=r,this.dirty=!1)}}class ar extends ti{getDefault(){return 0}set(r){(r!==this.current||this.dirty)&&(this.gl.clearStencil(r),this.current=r,this.dirty=!1)}}class qs extends ti{getDefault(){return[!0,!0,!0,!0]}set(r){const o=this.current;(r[0]!==o[0]||r[1]!==o[1]||r[2]!==o[2]||r[3]!==o[3]||this.dirty)&&(this.gl.colorMask(r[0],r[1],r[2],r[3]),this.current=r,this.dirty=!1)}}class Yn extends ti{getDefault(){return!0}set(r){(r!==this.current||this.dirty)&&(this.gl.depthMask(r),this.current=r,this.dirty=!1)}}class is extends ti{getDefault(){return 255}set(r){(r!==this.current||this.dirty)&&(this.gl.stencilMask(r),this.current=r,this.dirty=!1)}}class Xl extends ti{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(r){const o=this.current;(r.func!==o.func||r.ref!==o.ref||r.mask!==o.mask||this.dirty)&&(this.gl.stencilFunc(r.func,r.ref,r.mask),this.current=r,this.dirty=!1)}}class Io extends ti{getDefault(){const r=this.gl;return[r.KEEP,r.KEEP,r.KEEP]}set(r){const o=this.current;(r[0]!==o[0]||r[1]!==o[1]||r[2]!==o[2]||this.dirty)&&(this.gl.stencilOp(r[0],r[1],r[2]),this.current=r,this.dirty=!1)}}class Yl extends ti{getDefault(){return!1}set(r){if(r===this.current&&!this.dirty)return;const o=this.gl;r?o.enable(o.STENCIL_TEST):o.disable(o.STENCIL_TEST),this.current=r,this.dirty=!1}}class rs extends ti{getDefault(){return[0,1]}set(r){const o=this.current;(r[0]!==o[0]||r[1]!==o[1]||this.dirty)&&(this.gl.depthRange(r[0],r[1]),this.current=r,this.dirty=!1)}}class Ku extends ti{getDefault(){return!1}set(r){if(r===this.current&&!this.dirty)return;const o=this.gl;r?o.enable(o.DEPTH_TEST):o.disable(o.DEPTH_TEST),this.current=r,this.dirty=!1}}class Za extends ti{getDefault(){return this.gl.LESS}set(r){(r!==this.current||this.dirty)&&(this.gl.depthFunc(r),this.current=r,this.dirty=!1)}}class Kl extends ti{getDefault(){return!1}set(r){if(r===this.current&&!this.dirty)return;const o=this.gl;r?o.enable(o.BLEND):o.disable(o.BLEND),this.current=r,this.dirty=!1}}class qa extends ti{getDefault(){const r=this.gl;return[r.ONE,r.ZERO,r.ONE,r.ZERO]}set(r){const o=this.current;(r[0]!==o[0]||r[1]!==o[1]||r[2]!==o[2]||r[3]!==o[3]||this.dirty)&&(this.gl.blendFuncSeparate(r[0],r[1],r[2],r[3]),this.current=r,this.dirty=!1)}}class Jl extends ti{getDefault(){return a.ax.transparent}set(r){const o=this.current;(r.r!==o.r||r.g!==o.g||r.b!==o.b||r.a!==o.a||this.dirty)&&(this.gl.blendColor(r.r,r.g,r.b,r.a),this.current=r,this.dirty=!1)}}class Sr extends ti{getDefault(){return this.gl.FUNC_ADD}set(r){(r!==this.current||this.dirty)&&(this.gl.blendEquationSeparate(r,r),this.current=r,this.dirty=!1)}}class ji extends ti{getDefault(){return!1}set(r){if(r===this.current&&!this.dirty)return;const o=this.gl;r?o.enable(o.CULL_FACE):o.disable(o.CULL_FACE),this.current=r,this.dirty=!1}}class Ut extends ti{getDefault(){return this.gl.BACK}set(r){(r!==this.current||this.dirty)&&(this.gl.cullFace(r),this.current=r,this.dirty=!1)}}class Ju extends ti{getDefault(){return this.gl.CCW}set(r){(r!==this.current||this.dirty)&&(this.gl.frontFace(r),this.current=r,this.dirty=!1)}}let $a=class extends ti{getDefault(){return null}set(c){(c!==this.current||this.dirty)&&(this.gl.useProgram(c),this.current=c,this.dirty=!1)}};class Ql extends ti{getDefault(){return this.gl.TEXTURE0}set(r){(r!==this.current||this.dirty)&&(this.gl.activeTexture(r),this.current=r,this.dirty=!1)}}class qd extends ti{getDefault(){const r=this.gl;return[0,0,r.drawingBufferWidth,r.drawingBufferHeight]}set(r){const o=this.current;(r[0]!==o[0]||r[1]!==o[1]||r[2]!==o[2]||r[3]!==o[3]||this.dirty)&&(this.gl.viewport(r[0],r[1],r[2],r[3]),this.current=r,this.dirty=!1)}}class xn extends ti{getDefault(){return null}set(r){if(r===this.current&&!this.dirty)return;const o=this.gl;o.bindFramebuffer(o.FRAMEBUFFER,r),this.current=r,this.dirty=!1}}class ec extends ti{getDefault(){return null}set(r){if(r===this.current&&!this.dirty)return;const o=this.gl;o.bindRenderbuffer(o.RENDERBUFFER,r),this.current=r,this.dirty=!1}}class $d extends ti{getDefault(){return null}set(r){if(r===this.current&&!this.dirty)return;const o=this.gl;o.bindTexture(o.TEXTURE_2D,r),this.current=r,this.dirty=!1}}class ns extends ti{getDefault(){return null}set(r){if(r===this.current&&!this.dirty)return;const o=this.gl;o.bindBuffer(o.ARRAY_BUFFER,r),this.current=r,this.dirty=!1}}class Xe extends ti{getDefault(){return null}set(r){const o=this.gl;o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,r),this.current=r,this.dirty=!1}}class ni extends ti{getDefault(){return null}set(r){this.gl&&(r!==this.current||this.dirty)&&(this.gl.bindVertexArray(r),this.current=r,this.dirty=!1)}}class oi extends ti{getDefault(){return 4}set(r){if(r===this.current&&!this.dirty)return;const o=this.gl;o.pixelStorei(o.UNPACK_ALIGNMENT,r),this.current=r,this.dirty=!1}}class qr extends ti{getDefault(){return!1}set(r){if(r===this.current&&!this.dirty)return;const o=this.gl;o.pixelStorei(o.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r),this.current=r,this.dirty=!1}}class os extends ti{getDefault(){return!1}set(r){if(r===this.current&&!this.dirty)return;const o=this.gl;o.pixelStorei(o.UNPACK_FLIP_Y_WEBGL,r),this.current=r,this.dirty=!1}}class Ht extends ti{constructor(r,o){super(r),this.context=r,this.parent=o}getDefault(){return null}}class Wa extends Ht{setDirty(){this.dirty=!0}set(r){if(r===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const o=this.gl;o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,o.TEXTURE_2D,r,0),this.current=r,this.dirty=!1}}class ss extends Ht{attachment(){return this.gl.DEPTH_ATTACHMENT}set(r){if(r===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const o=this.gl;o.framebufferRenderbuffer(o.FRAMEBUFFER,this.attachment(),o.RENDERBUFFER,r),this.current=r,this.dirty=!1}}class $s extends Ht{attachment(){return this.gl.DEPTH_ATTACHMENT}set(r){if(r===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const o=this.gl;o.framebufferTexture2D(o.FRAMEBUFFER,this.attachment(),o.TEXTURE_2D,r,0),this.current=r,this.dirty=!1}}class Ar extends ss{attachment(){return this.gl.DEPTH_STENCIL_ATTACHMENT}}class Ni{constructor(r,o,u,d,p){this.context=r,this.width=o,this.height=u;const g=this.framebuffer=r.gl.createFramebuffer();d&&(this.colorAttachment=new Wa(r,g)),p&&(this.depthAttachmentType=p,this.depthAttachment=p==="renderbuffer"?new ss(r,g):new $s(r,g))}destroy(){const r=this.context.gl;if(this.colorAttachment){const o=this.colorAttachment.get();o&&r.deleteTexture(o)}if(this.depthAttachment&&this.depthAttachmentType)if(this.depthAttachmentType==="renderbuffer"){const o=this.depthAttachment.get();o&&r.deleteRenderbuffer(o)}else{const o=this.depthAttachment.get();o&&r.deleteTexture(o)}r.deleteFramebuffer(this.framebuffer)}}class dt{constructor(r,o,u){this.func=r,this.mask=o,this.range=u}}dt.ReadOnly=!1,dt.ReadWrite=!0,dt.disabled=new dt(519,dt.ReadOnly,[0,1]);const Co=7680;class yt{constructor(r,o,u,d,p,g){this.test=r,this.ref=o,this.mask=u,this.fail=d,this.depthFail=p,this.pass=g}}yt.disabled=new yt({func:519,mask:0},0,0,Co,Co,Co);const Kn=771;class Rt{constructor(r,o,u,d){this.blendFunction=r,this.blendColor=o,this.mask=u,this.blendEquation=d}}Rt.Replace=[1,0,1,0],Rt.disabled=new Rt(Rt.Replace,a.ax.transparent,[!1,!1,!1,!1]),Rt.unblended=new Rt(Rt.Replace,a.ax.transparent,[!0,!0,!0,!0]),Rt.alphaBlended=new Rt([1,Kn,1,Kn],a.ax.transparent,[!0,!0,!0,!0]),Rt.multiply=new Rt([774,0,774,0],a.ax.transparent,[!0,!0,!0,!0]);const as=1029,lr=2305;class ft{constructor(r,o,u){this.enable=r,this.mode=o,this.frontFace=u}}ft.disabled=new ft(!1,as,lr),ft.backCCW=new ft(!0,as,lr),ft.backCW=new ft(!0,as,2304),ft.frontCW=new ft(!0,1028,2304),ft.frontCCW=new ft(!0,1028,lr);class Qu{constructor(r,o){this.gl=r,this.clearColor=new Br(this),this.clearDepth=new rn(this),this.clearStencil=new ar(this),this.colorMask=new qs(this),this.depthMask=new Yn(this),this.stencilMask=new is(this),this.stencilFunc=new Xl(this),this.stencilOp=new Io(this),this.stencilTest=new Yl(this),this.depthRange=new rs(this),this.depthTest=new Ku(this),this.depthFunc=new Za(this),this.blend=new Kl(this),this.blendFunc=new qa(this),this.blendColor=new Jl(this),this.blendEquation=new Sr(this),this.cullFace=new ji(this),this.cullFaceSide=new Ut(this),this.frontFace=new Ju(this),this.program=new $a(this),this.activeTexture=new Ql(this),this.viewport=new qd(this),this.bindFramebuffer=new xn(this),this.bindRenderbuffer=new ec(this),this.bindTexture=new $d(this),this.bindVertexBuffer=new ns(this),this.bindElementBuffer=new Xe(this),this.bindVertexArrayOES=new ni(this),this.pixelStoreUnpack=new oi(this),this.pixelStoreUnpackPremultiplyAlpha=new qr(this),this.pixelStoreUnpackFlipY=new os(this),this.options=o?{...o}:{},this.options.extTextureFilterAnisotropicForceOff||(this.extTextureFilterAnisotropic=r.getExtension("EXT_texture_filter_anisotropic")||r.getExtension("MOZ_EXT_texture_filter_anisotropic")||r.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=r.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT))),this.extDebugRendererInfo=r.getExtension("WEBGL_debug_renderer_info"),this.extDebugRendererInfo&&(this.renderer=r.getParameter(this.extDebugRendererInfo.UNMASKED_RENDERER_WEBGL),this.vendor=r.getParameter(this.extDebugRendererInfo.UNMASKED_VENDOR_WEBGL)),this.options.extTextureFloatLinearForceOff||(this.extTextureFloatLinear=r.getExtension("OES_texture_float_linear")),this.extRenderToTextureHalfFloat=r.getExtension("EXT_color_buffer_half_float"),this.extTimerQuery=r.getExtension("EXT_disjoint_timer_query_webgl2"),this.maxTextureSize=r.getParameter(r.MAX_TEXTURE_SIZE),this.maxPointSize=r.getParameter(r.ALIASED_POINT_SIZE_RANGE)[1]}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.bindVertexArrayOES.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(r,o,u){return new gi(this,r,o,u)}createVertexBuffer(r,o,u,d,p){return new sr(this,r,o,u,d,p)}createRenderbuffer(r,o,u){const d=this.gl,p=d.createRenderbuffer();return this.bindRenderbuffer.set(p),d.renderbufferStorage(d.RENDERBUFFER,r,o,u),this.bindRenderbuffer.set(null),p}createFramebuffer(r,o,u,d){return new Ni(this,r,o,u,d)}clear({color:r,depth:o,stencil:u,colorMask:d}){const p=this.gl;let g=0;r&&(g|=p.COLOR_BUFFER_BIT,this.clearColor.set(r),this.colorMask.set(d||[!0,!0,!0,!0])),o!==void 0&&(g|=p.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(o),this.depthMask.set(!0)),u!==void 0&&(g|=p.STENCIL_BUFFER_BIT,this.clearStencil.set(u),this.stencilMask.set(255)),p.clear(g)}setCullFace(r){r.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(r.mode),this.frontFace.set(r.frontFace))}setDepthMode(r){r.func!==this.gl.ALWAYS||r.mask?(this.depthTest.set(!0),this.depthFunc.set(r.func),this.depthMask.set(r.mask),this.depthRange.set(r.range)):this.depthTest.set(!1)}setStencilMode(r){r.test.func!==this.gl.ALWAYS||r.mask?(this.stencilTest.set(!0),this.stencilMask.set(r.mask),this.stencilOp.set([r.fail,r.depthFail,r.pass]),this.stencilFunc.set({func:r.test.func,ref:r.ref,mask:r.test.mask})):this.stencilTest.set(!1)}setColorMode(r){Pt(r.blendFunction,Rt.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(r.blendFunction),this.blendColor.set(r.blendColor),r.blendEquation?this.blendEquation.set(r.blendEquation):this.blendEquation.setDefault()),this.colorMask.set(r.mask)}unbindVAO(){this.bindVertexArrayOES.set(null)}}var Po=a.ay([{name:"a_pos",type:"Float32",components:3}]);class $i{constructor(r,o,u,d){const p={width:u[0],height:u[1],data:null},g=r.gl;this.targetColorTexture=new a.T(r,p,g.RGBA,{useMipmap:!1}),this.backgroundColorTexture=new a.T(r,p,g.RGBA,{useMipmap:!1}),this.context=r,this.setNumParticles(o,d),this.lastInvalidatedAt=0}
14setNumParticles(r,o){if(this.numParticles===o)return;(this.particleVertices0||this.particleVertices1||this.particleSegment)&&(this.particleVertices0.destroy(),this.particleVertices1.destroy(),this.particleSegment.destroy());const u=new a.az;u.reserve(Math.round(o));const d=a.aA(r.key);for(let p=0;p<o;p++)u.emplaceBack(d(),d(),d());this.particleVertices0=this.context.createVertexBuffer(u,Po.members,!0),this.particleVertices1=this.context.createVertexBuffer(u,Po.members,!0),this.particleSegment=a.aB.simpleSegment(0,0,this.particleVertices0.length,0),this.numParticles=o}update(r){return!(this.lastInvalidatedAt<r&&(this.lastInvalidatedAt=a.f.now(),1))}destroy(){this.targetColorTexture.destroy(),this.backgroundColorTexture.destroy(),this.particleVertices0.destroy(),this.particleVertices1.destroy(),this.particleSegment.destroy()}}const $r={type:2,extent:a.V,loadGeometry:()=>[[new a.P(0,0),new a.P(a.V+1,0),new a.P(a.V+1,a.V+1),new a.P(0,a.V+1),new a.P(0,0)]]};class Jn{constructor(r,o,u,d,p){this.tileID=r,this.uid=a.aC(),this.uses=0,this.tileSize=o,this.tileZoom=u,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.isRaster=p,d&&d.style&&(this._lastUpdatedBrightness=d.style.getBrightness()),this.expiredRequestCount=0,this.state="loading",d&&d.transform&&(this.projection=d.transform.projection)}registerFadeDuration(r){const o=r+this.timeAdded;o<a.f.now()||this.fadeEndTime&&o<this.fadeEndTime||(this.fadeEndTime=o)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}get tileTransform(){return this._tileTransform||(this._tileTransform=a.as(this.tileID.canonical,this.projection)),this._tileTransform}loadVectorData(r,o,u){if(this.unloadVectorData(),this.state="loaded",r){r.featureIndex&&(this.latestFeatureIndex=r.featureIndex,r.rawTileData?(this.latestRawTileData=r.rawTileData,this.latestFeatureIndex.rawTileData=r.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=r.collisionBoxArray,this.buckets=function(d,p){const g={};if(!p)return g;for(const x of d){const b=x.layerIds.map(T=>p.getLayer(T)).filter(Boolean);if(b.length!==0){x.layers=b,x.stateDependentLayerIds&&(x.stateDependentLayers=x.stateDependentLayerIds.map(T=>b.filter(M=>M.id===T)[0]));for(const T of b)g[T.fqid]=x}}return g}(r.buckets,o.style),this.hasSymbolBuckets=!1;for(const d in this.buckets){const p=this.buckets[d];if(p instanceof a.aE){if(this.hasSymbolBuckets=!0,!u)break;p.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const d in this.buckets){const p=this.buckets[d];if(p instanceof a.aE&&p.hasRTLText){this.hasRTLText=!0,a.aF();break}}this.queryPadding=0;for(const d in this.buckets){const p=this.buckets[d],g=o.style.getOwnLayer(d);if(!g)continue;
14const x=g.queryRadius(p);this.queryPadding=Math.max(this.queryPadding,x)}r.imageAtlas&&(this.imageAtlas=r.imageAtlas),r.glyphAtlasImage&&(this.glyphAtlasImage=r.glyphAtlasImage),r.lineAtlas&&(this.lineAtlas=r.lineAtlas),this._lastUpdatedBrightness=r.brightness}else this.collisionBoxArray=new a.aD}unloadVectorData(){if(this.hasData()){for(const r in this.buckets)this.buckets[r].destroy();this.buckets={},this.imageAtlas&&(this.imageAtlas=null),this.lineAtlas&&(this.lineAtlas=null),this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.lineAtlasTexture&&this.lineAtlasTexture.destroy(),this._tileBoundsBuffer&&(this._tileBoundsBuffer.destroy(),this._tileBoundsIndexBuffer.destroy(),this._tileBoundsSegments.destroy(),this._tileBoundsBuffer=null),this._tileDebugBuffer&&(this._tileDebugBuffer.destroy(),this._tileDebugSegments.destroy(),this._tileDebugBuffer=null),this._tileDebugIndexBuffer&&(this._tileDebugIndexBuffer.destroy(),this._tileDebugIndexBuffer=null),this._globeTileDebugBorderBuffer&&(this._globeTileDebugBorderBuffer.destroy(),this._globeTileDebugBorderBuffer=null),this._tileDebugTextBuffer&&(this._tileDebugTextBuffer.destroy(),this._tileDebugTextSegments.destroy(),this._tileDebugTextIndexBuffer.destroy(),this._tileDebugTextBuffer=null),this._globeTileDebugTextBuffer&&(this._globeTileDebugTextBuffer.destroy(),this._globeTileDebugTextBuffer=null),this.latestFeatureIndex=null,this.state="unloaded"}}getBucket(r){return this.buckets[r.fqid]}upload(r){for(const d in this.buckets){const p=this.buckets[d];p.uploadPending()&&p.upload(r)}const o=r.gl,u=this.imageAtlas;if(u&&!u.uploaded){const d=!!Object.keys(u.patternPositions).length;this.imageAtlasTexture=new a.T(r,u.image,o.RGBA,{useMipmap:d}),this.imageAtlas.uploaded=!0}this.glyphAtlasImage&&(this.glyphAtlasTexture=new a.T(r,this.glyphAtlasImage,o.R8),this.glyphAtlasImage=null),this.lineAtlas&&!this.lineAtlas.uploaded&&(this.lineAtlasTexture=new a.T(r,this.lineAtlas.image,o.R8),this.lineAtlas.uploaded=!0)}prepare(r,o,u){if(this.imageAtlas&&this.imageAtlasTexture&&this.imageAtlas.patchUpdatedImages(r,this.imageAtlasTexture,u),!o||!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData)return;const d=o.style.getBrightness();(this._lastUpdatedBrightness||d)&&(this._lastUpdatedBrightness&&d&&Math.abs(this._lastUpdatedBrightness-d)<.001||(this._lastUpdatedBrightness=d,this.updateBuckets(void 0,o)))}queryRenderedFeatures(r,o,u,d,p,g,x,b){return this.latestFeatureIndex&&(this.latestFeatureIndex.rawTileData||this.latestFeatureIndex.is3DTile)?this.latestFeatureIndex.query({tileResult:d,pixelPosMatrix:x,transform:g,params:p,tileTransform:this.tileTransform},r,o,u):{}}querySourceFeatures(r,o){const u=this.latestFeatureIndex;if(!u||!u.rawTileData)return;const d=u.loadVTLayers(),p=o?o.sourceLayer:"",g=d._geojsonTileLayer||d[p];if(!g)return;const x=a.aG(o&&o.filter),{z:b,x:T,y:M}=this.tileID.canonical,S={z:b,x:T,y:M};for(let C=0;C<g.length;C++){const P=g.feature(C);if(x.needGeometry){const O=a.aH(P,!0);if(!x.filter(new a.K(this.tileID.overscaledZ),O,this.tileID.canonical))continue}else if(!x.filter(new a.K(this.tileID.overscaledZ),P))continue;const k=u.getId(P,p),R=new a.aI(P,b,T,M,k);R.tile=S,r.push(R)}}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}bucketsLoaded(){for(const r in this.buckets)if(this.buckets[r].uploadPending())return!1;return!0}patternsLoaded(){return!!this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(r){const o=this.expirationTime;if(r.cacheControl){const u=a.aJ(r.cacheControl);u["max-age"]&&(this.expirationTime=Date.now()+1e3*u["max-age"])}else r.expires&&(this.expirationTime=new Date(r.expires).getTime());if(this.expirationTime){const u=Date.now();let d=!1;if(this.expirationTime>u)d=!1;else if(o)if(this.expirationTime<o)d=!0;else{const p=this.expirationTime-o;p?this.expirationTime=u+Math.max(p,3e4):d=!0}else d=!0;d?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-new Date().getTime(),Math.pow(2,31)-1)}setFeatureState(r,o){this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData&&Object.keys(r).length!==0&&o&&this.updateBuckets(r,o)}updateBuckets(r,o){if(!this.latestFeatureIndex)return;const u=this.latestFeatureIndex.loadVTLayers(),d=o.style.listImages(),p=o.style.getBrightness();for(const g in this.buckets){if(!o.style.hasLayer(g))continue;const x=this.buckets[g],b=x.layers[0].sourceLayer||"_geojsonTileLayer",T=u[b];let M={};if(r&&(M=r[b],!T||!M||Object.keys(M).length===0))continue;if(x.update(M,T,d,this.imageAtlas&&this.imageAtlas.patternPositions||{},p),x instanceof a.aK||x instanceof a.aL){const C=o.style.getOwnSourceCache(x.layers[0].source);o._terrain&&o._terrain.enabled&&C&&x.programConfigurations.needsUpload&&o._terrain._clearRenderCacheForTile(C.id,this.tileID)}const S=o&&o.style&&o.style.getOwnLayer(g);S&&(this.queryPadding=Math.max(this.queryPadding,S.queryRadius(x)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<a.f.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(r){this.symbolFadeHoldUntil=a.f.now()+r}setTexture(r,o){const u=o.context,d=u.gl;this.texture=this.texture||o.getTileTexture(r.width),this.texture&&this.texture instanceof a.T?this.texture.update(r,{useMipmap:!0}):(this.texture=new a.T(u,r,d.RGBA,{useMipmap:!0}),this.texture.bind(d.LINEAR,d.CLAMP_TO_EDGE))}
vendor: 6,525 bytes, line 14
14setDependencies(r,o){const u={};for(const d of o)u[d]=!0;this.dependencies[r]=u}hasDependency(r,o){for(const u of r){const d=this.dependencies[u];if(d){for(const p of o)if(d[p])return!0}}return!1}clearQueryDebugViz(){}_makeDebugTileBoundsBuffers(r,o){if(!o||o.name==="mercator"||this._tileDebugBuffer)return;const u=a.aM($r,this.tileID.canonical,this.tileTransform)[0],d=new a.aN,p=new a.aO;for(let g=0;g<u.length;g++){const{x,y:b}=u[g];d.emplaceBack(x,b),p.emplaceBack(g)}p.emplaceBack(0),this._tileDebugIndexBuffer=r.createIndexBuffer(p),this._tileDebugBuffer=r.createVertexBuffer(d,a.aP.members),this._tileDebugSegments=a.aB.simpleSegment(0,0,d.length,p.length)}_makeTileBoundsBuffers(r,o){if(this._tileBoundsBuffer||!o||o.name==="mercator")return;const u=a.aM($r,this.tileID.canonical,this.tileTransform)[0];let d,p;if(this.isRaster){const g=function(x,b){const T=a.as(x,b),M=Math.pow(2,x.z);for(let O=0;O<Ve;O++)for(let D=0;D<Ve;D++){const F=a.at((x.x+(D+Ei(D))/We)/M),Z=a.au((x.y+(O+Ei(O))/We)/M),V=b.project(F,Z),q=O*Ve+D;Vt[2*q+0]=Math.round((V.x*T.scale-T.x)*a.V),Vt[2*q+1]=Math.round((V.y*T.scale-T.y)*a.V)}lt.fill(0),fi.fill(0);for(let O=2045;O>=0;O--){const D=4*O,F=_t[D+0],Z=_t[D+1],V=_t[D+2],q=_t[D+3],B=F+V>>1,$=Z+q>>1,Y=B+$-Z,K=$+F-B,ee=Z*Ve+F,ce=q*Ve+V,re=$*Ve+B,me=Math.hypot((Vt[2*ee+0]+Vt[2*ce+0])/2-Vt[2*re+0],(Vt[2*ee+1]+Vt[2*ce+1])/2-Vt[2*re+1])>=16;lt[re]=lt[re]||(me?1:0),O<1022&&(lt[re]=lt[re]||lt[(Z+K>>1)*Ve+(F+Y>>1)]||lt[(q+K>>1)*Ve+(V+Y>>1)])}const S=new a.av,C=new a.aw;let P=0;function k(O,D){const F=D*Ve+O;return fi[F]===0&&(S.emplaceBack(Vt[2*F+0],Vt[2*F+1],O*a.V/We,D*a.V/We),fi[F]=++P),fi[F]-1}function R(O,D,F,Z,V,q){const B=O+F>>1,$=D+Z>>1;if(Math.abs(O-V)+Math.abs(D-q)>1&<[$*Ve+B])R(V,q,O,D,B,$),R(F,Z,V,q,B,$);else{const Y=k(O,D),K=k(F,Z),ee=k(V,q);C.emplaceBack(Y,K,ee)}}return R(0,0,We,We,We,0),R(We,We,0,0,0,We),{vertices:S,indices:C}}(this.tileID.canonical,o);d=g.vertices,p=g.indices}else{d=new a.av,p=new a.aw;for(const{x,y:b}of u)d.emplaceBack(x,b,0,0);const g=a.aQ(d.int16,void 0,4);for(let x=0;x<g.length;x+=3)p.emplaceBack(g[x],g[x+1],g[x+2])}this._tileBoundsBuffer=r.createVertexBuffer(d,a.aR.members),this._tileBoundsIndexBuffer=r.createIndexBuffer(p),this._tileBoundsSegments=a.aB.simpleSegment(0,0,d.length,p.length)}_makeGlobeTileDebugBuffers(r,o){const u=o.projection;if(!u||u.name!=="globe"||o.freezeTileCoverage)return;const d=this.tileID.canonical,p=a.aS(d,o),g=a.aT(p),x=a.S(o.zoom);let b;x>0&&(b=a.a6.invert(new Float64Array(16),o.globeMatrix)),this._makeGlobeTileDebugBorderBuffer(r,d,o,g,b,x),this._makeGlobeTileDebugTextBuffer(r,d,o,g,b,x)}_globePoint(r,o,u,d,p,g,x){let b=a.aU(r,o,u);if(g){const T=1<<u.z,M=a.a5(d.center.lng),S=a.ae(d.center.lat),C=(u.x+.5)/T-M;let P=0;C>.5?P=-1:C<-.5&&(P=1);let k=(r/a.V+u.x)/T+P,R=(o/a.V+u.y)/T;k=(k-M)*d._pixelsPerMercatorPixel+M,R=(R-S)*d._pixelsPerMercatorPixel+S;const O=[k*d.worldSize,R*d.worldSize,0];a.N.transformMat4(O,O,g),b=a.aV(b,O,x)}return a.N.transformMat4(b,b,p)}_makeGlobeTileDebugBorderBuffer(r,o,u,d,p,g){const x=new a.aN,b=new a.aO,T=new a.aW,M=(C,P,k,R,O)=>{const D=(k-C)/(O-1),F=(R-P)/(O-1),Z=x.length;for(let V=0;V<O;V++){const q=C+V*D,B=P+V*F;x.emplaceBack(q,B);const $=this._globePoint(q,B,o,u,d,p,g);T.emplaceBack($[0],$[1],$[2]),b.emplaceBack(Z+V)}},S=a.V;M(0,0,S,0,16),M(S,0,S,S,16),M(S,S,0,S,16),M(0,S,0,0,16),this._tileDebugIndexBuffer=r.createIndexBuffer(b),this._tileDebugBuffer=r.createVertexBuffer(x,a.aP.members),this._globeTileDebugBorderBuffer=r.createVertexBuffer(T,a.aX.members),this._tileDebugSegments=a.aB.simpleSegment(0,0,x.length,b.length)}_makeGlobeTileDebugTextBuffer(r,o,u,d,p,g){const x=a.V/4,b=new a.aN,T=new a.aw,M=new a.aW,S=25;T.reserve(32),b.reserve(S),M.reserve(S);const C=(P,k)=>S*P+k;for(let P=0;P<S;P++){const k=P*x;for(let R=0;R<S;R++){const O=R*x;b.emplaceBack(O,k);const D=this._globePoint(O,k,o,u,d,p,g);M.emplaceBack(D[0],D[1],D[2])}}for(let P=0;P<4;P++)for(let k=0;k<4;k++){const R=C(P,k),O=C(P,k+1),D=C(P+1,k),F=C(P+1,k+1);T.emplaceBack(R,O,D),T.emplaceBack(D,O,F)}this._tileDebugTextIndexBuffer=r.createIndexBuffer(T),this._tileDebugTextBuffer=r.createVertexBuffer(b,a.aP.members),this._globeTileDebugTextBuffer=r.createVertexBuffer(M,a.aX.members),this._tileDebugTextSegments=a.aB.simpleSegment(0,0,S,32)}destroy(r=!1){for(const o in this.buckets)this.buckets[o].destroy();this.buckets={},this.imageAtlas&&(this.imageAtlas=null),this.lineAtlas&&(this.lineAtlas=null),this.imageAtlasTexture&&(this.imageAtlasTexture.destroy(),delete this.imageAtlasTexture),this.glyphAtlasTexture&&(this.glyphAtlasTexture.destroy(),delete this.glyphAtlasTexture),this.lineAtlasTexture&&(this.lineAtlasTexture.destroy(),delete this.lineAtlasTexture),this._tileBoundsBuffer&&(this._tileBoundsBuffer.destroy(),this._tileBoundsIndexBuffer.destroy(),this._tileBoundsSegments.destroy(),this._tileBoundsBuffer=null),this._tileDebugBuffer&&(this._tileDebugBuffer.destroy(),this._tileDebugSegments.destroy(),this._tileDebugBuffer=null),this._tileDebugIndexBuffer&&(this._tileDebugIndexBuffer.destroy(),this._tileDebugIndexBuffer=null),this._globeTileDebugBorderBuffer&&(this._globeTileDebugBorderBuffer.destroy(),this._globeTileDebugBorderBuffer=null),this._tileDebugTextBuffer&&(this._tileDebugTextBuffer.destroy(),this._tileDebugTextSegments.destroy(),this._tileDebugTextIndexBuffer.destroy(),this._tileDebugTextBuffer=null),this._globeTileDebugTextBuffer&&(this._globeTileDebugTextBuffer.destroy(),this._globeTileDebugTextBuffer=null),!r&&this.texture&&this.texture instanceof a.T&&(this.texture.destroy(),delete this.texture),this.hillshadeFBO&&(this.hillshadeFBO.destroy(),delete this.hillshadeFBO),this.dem&&delete this.dem,this.neighboringTiles&&delete this.neighboringTiles,this.demTexture&&(this.demTexture.destroy(),delete this.demTexture),this.rasterParticleState&&(this.rasterParticleState.destroy(),delete this.rasterParticleState),this.latestFeatureIndex=null,this.state="unloaded"}}const In={vector:Ge,raster:Ze,"raster-dem":class extends Ze{constructor(c,r,o,u){super(c,r,o,u),this.type="raster-dem",this.maxzoom=22,this._options=a.e({type:"raster-dem"},r),this.encoding=r.encoding||"mapbox"}loadTile(c,r){const o=this.map._requestManager.normalizeTileURL(c.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize);function u(d,p){d&&(c.state="errored",r(d)),p&&(c.dem=p,c.dem.onDeserialize(),c.needsHillshadePrepare=!0,c.needsDEMTextureUpload=!0,c.state="loaded",r(null))}c.request=a.d(this.map._requestManager.transformRequest(o,a.R.Tile),(function(d,p,g,x){
14if(delete c.request,c.aborted)c.state="unloaded",r(null);else if(d)c.state="errored",r(d);else if(p){this.map._refreshExpiredTiles&&c.setExpiryData({cacheControl:g,expires:x});const b=ImageBitmap&&p instanceof ImageBitmap&&a.ak(),T=1-(p.width-a.al(p.width))/2;T<1||c.neighboringTiles||(c.neighboringTiles=this._getNeighboringTiles(c.tileID));const M=b?p:a.f.getImageData(p,T),S={uid:c.uid,coord:c.tileID,source:this.id,scope:this.scope,rawImageData:M,encoding:this.encoding,padding:T};c.actor&&c.state!=="expired"||(c.actor=this.dispatcher.getActor(),c.actor.send("loadDEMTile",S,u.bind(this),void 0,!0))}}).bind(this))}_getNeighboringTiles(c){const r=c.canonical,o=Math.pow(2,r.z),u=(r.x-1+o)%o,d=r.x===0?c.wrap-1:c.wrap,p=(r.x+1+o)%o,g=r.x+1===o?c.wrap+1:c.wrap,x={};return x[new a.am(c.overscaledZ,d,r.z,u,r.y).key]={backfilled:!1},x[new a.am(c.overscaledZ,g,r.z,p,r.y).key]={backfilled:!1},r.y>0&&(x[new a.am(c.overscaledZ,d,r.z,u,r.y-1).key]={backfilled:!1},x[new a.am(c.overscaledZ,c.wrap,r.z,r.x,r.y-1).key]={backfilled:!1},x[new a.am(c.overscaledZ,g,r.z,p,r.y-1).key]={backfilled:!1}),r.y+1<o&&(x[new a.am(c.overscaledZ,d,r.z,u,r.y+1).key]={backfilled:!1},x[new a.am(c.overscaledZ,c.wrap,r.z,r.x,r.y+1).key]={backfilled:!1},x[new a.am(c.overscaledZ,g,r.z,p,r.y+1).key]={backfilled:!1}),x}},"raster-array":Be,geojson:class extends a.E{constructor(c,r,o,u){super(),this.id=c,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._loaded=!1,this.actor=o.getActor(),this.setEventedParent(u),this._data=r.data,this._options=a.e({},r),this._collectResourceTiming=r.collectResourceTiming,r.maxzoom!==void 0&&(this.maxzoom=r.maxzoom),r.type&&(this.type=r.type),r.attribution&&(this.attribution=r.attribution),this.promoteId=r.promoteId;const d=a.V/this.tileSize;this.workerOptions=a.e({source:this.id,scope:this.scope,cluster:r.cluster||!1,geojsonVtOptions:{buffer:(r.buffer!==void 0?r.buffer:128)*d,tolerance:(r.tolerance!==void 0?r.tolerance:.375)*d,extent:a.V,maxZoom:this.maxzoom,lineMetrics:r.lineMetrics||!1,generateId:r.generateId||!1},superclusterOptions:{maxZoom:r.clusterMaxZoom!==void 0?r.clusterMa
14xZoom:this.maxzoom-1,minPoints:Math.max(2,r.clusterMinPoints||2),extent:a.V,radius:(r.clusterRadius!==void 0?r.clusterRadius:50)*d,log:!1,generateId:r.generateId||!1},clusterProperties:r.clusterProperties,filter:r.filter},r.workerOptions)}onAdd(c){this.map=c,this.setData(this._data)}setData(c){return this._data=c,this._updateWorkerData(),this}getClusterExpansionZoom(c,r){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:c,source:this.id,scope:this.scope},r),this}getClusterChildren(c,r){return this.actor.send("geojson.getClusterChildren",{clusterId:c,source:this.id,scope:this.scope},r),this}getClusterLeaves(c,r,o,u){return this.actor.send("geojson.getClusterLeaves",{source:this.id,scope:this.scope,clusterId:c,limit:r,offset:o},u),this}_updateWorkerData(){if(this._pendingLoad)return void(this._coalesce=!0);this.fire(new a.b("dataloading",{dataType:"source"})),this._loaded=!1;const c=a.e({},this.workerOptions);c.scope=this.scope;const r=this._data;typeof r=="string"?(c.request=this.map._requestManager.transformRequest(a.f.resolveURL(r),a.R.Source),c.request.collectResourceTiming=this._collectResourceTiming):c.data=JSON.stringify(r),this._pendingLoad=this.actor.send(`${this.type}.loadData`,c,(o,u)=>{if(this._loaded=!0,this._pendingLoad=null,o)this.fire(new a.a(o));else{const d={dataType:"source",sourceDataType:this._metadataFired?"content":"metadata"};this._collectResourceTiming&&u&&u.resourceTiming&&u.resourceTiming[this.id]&&(d.resourceTiming=u.resourceTiming[this.id]),this.fire(new a.b("data",d)),this._metadataFired=!0}this._coalesce&&(this._updateWorkerData(),this._coalesce=!1)})}loaded(){return this._loaded}loadTile(c,r){const o=c.actor?"reloadTile":"loadTile";c.actor=this.actor;const u={type:this.type,uid:c.uid,tileID:c.tileID,tileZoom:c.tileZoom,zoom:c.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,scope:this.scope,pixelRatio:a.f.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,brightness:this.map.style&&this.map.style.getBrightness()||0};c.request=this.actor.send(o,u,(d,p)=>(delete c.request,c.destroy(),c.aborted?r(null):d?r(d):(c.loadVectorData(p,this.map.painter,o==="reloadTile"),r(null))),void 0,o==="loadTile")}abortTile(c){c.request&&(c.request.cancel(),delete c.request),c.aborted=!0}unloadTile(c){this.actor.send("removeTile",{uid:c.uid,type:this.t
14ype,source:this.id,scope:this.scope}),c.destroy()}onRemove(){this._pendingLoad&&this._pendingLoad.cancel()}serialize(){return a.e({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}},video:class extends a.ap{constructor(c,r,o,u){super(c,r,o,u),this.roundZoom=!0,this.type="video",this.options=r}load(){this._loaded=!1;const c=this.options;this.urls=[];for(const r of c.urls)this.urls.push(this.map._requestManager.transformRequest(r,a.R.Source).url);a.aq(this.urls,(r,o)=>{this._loaded=!0,r?this.fire(new a.a(r)):o&&(this.video=o,this.video.loop=!0,this.video.setAttribute("playsinline",""),this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading())})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(c){if(this.video){const r=this.video.seekable;c<r.start(0)||c>r.end(0)?this.fire(new a.a(new $e(`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=c}}getVideo(){return this.video}
14onAdd(c){this.map||(this.map=c,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const c=this.map.painter.context,r=c.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 a.T(c,this.video,r.RGBA),this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE),this.width=this.video.videoWidth,this.height=this.video.videoHeight),this._prepareData(c)}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}},image:a.ap,model:class extends a.E{constructor(c,r,o,u){super(),this.id=c,this.type="model",this.models=[],this._loaded=!1,this._options=r}load(){const c=[];for(const r in this._options.models){const o=this._options.models[r],u=a.l(this.map._requestManager.transformRequest(o.uri,a.R.Model).url).then(d=>{if(!d)return;const p=a.c(d),g=new a.M(r,o.position,o.orientation,p);g.computeBoundsAndApplyParent(),this.models.push(g)}).catch(d=>{this.fire(new a.a(new Error(`Could not load model ${r} from ${o.uri}: ${d.message}`)))});c.push(u)}return Promise.allSettled(c).then(()=>{this._loaded=!0,this.fire(new a.b("data",{dataType:"source",sourceDataType:"metadata"}))}).catch(r=>{this.fire(new a.a(new Error(`Could not load models: ${r.message}`)))})}onAdd(c){this.map=c,this.load()}hasTransition(){return!1}loaded(){return this._loaded}getModels(){return this.models}loadTile(c,r){}serialize(){return{type:"model"}}},"batched-model":class extends a.E{constructor(c,r,o,u){super(),this.type="batched-model",this.id=c,this.tileSize=512,this._options=r,this.tiles=this._options.tiles,this.maxzoom=r.maxzoom||19,this.minzoom=r.minzoom||0,this.roundZoom=!0,this.usedInConflation=!0,this.dispatcher=o,this.reparseOverscaled=!1,this.scheme="xyz",this._loaded=!1,this.setEventedParent(u)}onAdd(c){this.map=c,this.load()}load(c){this._loaded=!1,this.fire(new a.b("dataloading",{dataType:"source"}));const r=Array.isArray(this.map._language)?this.map._language.join():this.map._language,o=this.map._worldview;this._tileJSONRequest=Ne(this._options,this.map._requestManager,r,o,(u,d)=>{this._tileJSONRequest=null,this._loaded=!0,u?(r&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${r}`),o&&o.length!==2&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${o}`),this.fire(new a.a(u))):d&&(a.e(this,d),d.bounds&&(this.tileBounds=new ke(d.bounds,this.minzoom,this.maxzoom)),a.aj(d.tiles,this.map._requestManager._customAccessToken),this.fire(new a.b("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new a.b("data",{dataType:"source",sourceDataType:"content"}))),c&&c(u)})}hasTransition(){return!1}hasTile(c){return!this.tileBounds||this.tileBounds.contains(c.canonical)}loaded(){return this._loaded}loadTile(c,r){const o=this.map._requestManager.normalizeTileURL(c.tileID.canonical.url(this.tiles,this.scheme)),u={request:this.map._requestManager.transformRequest(o,a.R.Tile),data:void 0,uid:c.uid,tileID:c.tileID,tileZoom:c.tileZoom,zoom:c.tileID.overscaledZ,tileSize:this.tileSize*c.tileID.overscaleFactor(),type:this.t
14ype,source:this.id,scope:this.scope,showCollisionBoxes:this.map.showCollisionBoxes,isSymbolTile:c.isSymbolTile,brightness:this.map.style&&this.map.style.getBrightness()||0};if(c.actor&&c.state!=="expired")if(c.state==="loading")c.reloadCallback=r;else{if(c.buckets){const p=Object.values(c.buckets);for(const g of p)g.dirty=!0;return void(c.state="loaded")}c.request=c.actor.send("reloadTile",u,d.bind(this))}else c.actor=this.dispatcher.getActor(),c.request=c.actor.send("loadTile",u,d.bind(this),void 0,!0);function d(p,g){return c.aborted?r(null):p&&p.status!==404?r(p):(g&&(g.resourceTiming&&(c.resourceTiming=g.resourceTiming),this.map._refreshExpiredTiles&&c.setExpiryData(g),c.buckets={...c.buckets,...g.buckets},g.featureIndex&&(c.latestFeatureIndex=g.featureIndex)),c.state="loaded",void r(null))}}serialize(){return a.e({},this._options)}},canvas:class extends a.ap{constructor(c,r,o,u){super(c,r,o,u),r.coordinates?Array.isArray(r.coordinates)&&r.coordinates.length===4&&!r.coordinates.some(d=>!Array.isArray(d)||d.length!==2||d.some(p=>typeof p!="number"))||this.fire(new a.a(new $e(`sources.${c}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new a.a(new $e(`sources.${c}`,null,'missing required property "coordinates"'))),r.animate&&typeof r.animate!="boolean"&&this.fire(new a.a(new $e(`sources.${c}`,null,'optional "animate" property must be a boolean value'))),r.canvas?typeof r.canvas=="string"||r.canvas instanceof HTMLCanvasElement||this.fire(new a.a(new $e(`sources.${c}`,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 a.a(new $e(`sources.${c}`,null,'missing required property "canvas"'))),this.options=r,this.animate=r.animate===void 0||r.animate}load(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new a.a(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())}getCanvas(){return this.canvas}onAdd(c){this.map=c,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let c=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,c=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,c=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const r=this.map.painter.context;this.texture?!c&&!this._playing||this.texture instanceof a.ar||this.texture.update(this.canvas,{premultiply:!0}):this.texture=new a.T(r,this.canvas,r.gl.RGBA,{premultiply:!0}),this._prepareData(r)}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const c of[this.canvas.width,this.canvas.height])if(isNaN(c)||c<=0)return!0;return!1}},custom:class extends a.E{constructor(c,r,o,u){super(),this.id=c,this.type="custom",this._dataType="raster",this._dispatcher=o,this._implementation=r,this.setEventedParent(u),this.scheme="xyz",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this._loaded=!1,this.roundZoom=!0,this._implementation||this.fire(new a.a(new Error(`Missing implementation for ${this.id} custom source`))),this._implementation.loadTile||this.fire(new a.a(new Error(`Missing loadTile implementation for ${this.id} custom source`))),this._implementation.bounds&&(this.tileBounds=new ke(this._implementation.bounds,this.minzoom,this.maxzoom)),r.update=this._update.bind(this),r.clearTiles=this._clearTiles.bind(this),r.coveringTiles=this._coveringTiles.bind(this),a.e(this,a.ac(r,["dataType","scheme","minzoom","maxzoom","tileSize","attribution","minTileCacheSize","maxTileCacheSize"]))}serialize(){return a.ac(this,["type","scheme","minzoom","maxzoom","tileSize","attribution"])}load(){this._loaded=!0,this.fire(new a.b("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new a.b("data",{dataType:"source",sourceDataType:"content"}))}loaded(){return this._loaded}onAdd(c){this._map=c,this._loaded=!1,this.fire(new a.b("dataloading",{dataType:"source"})),this._implementation.onAdd&&this._implementation.onAdd(c),this.load()}onRemove(c){this._implementation.onRemove&&this._implementation.onRemove(c)}hasTile(c){if(this._implementation.hasTile){const{x:r,y:o,z:u}=c.canonical;return this._implementation.hasTile({x:r,y:o,z:u})}return!this.tileBounds||this.tileBounds.contains(c.canonical)}loadTile(c,r){const{x:o,y:u,z:d}=c.tileID.canonical,p=new AbortController;c.request=Promise.resolve(this._implementation.loadTile({x:o,y:u,z:d},{signal:p.signal})).then((function(g){return delete c.request,c.aborted?(c.state="unloaded",r(null)):g===void 0?(c.state="errored",r(null)):g===null?(this.loadTileData(c,{width:this.tileSize,height:this.tileSize,data:null}),c.state="loaded",r(null)):function(x){return x instanceof ImageData||x instanceof HTMLCanvasElement||x instanceof ImageBitmap||x
14instanceof HTMLImageElement}(g)?(this.loadTileData(c,g),c.state="loaded",void r(null)):(c.state="errored",r(new Error(`Can't infer data type for ${this.id}, only raster data supported at the moment`)))}).bind(this)).catch(g=>{g.code!==20&&(c.state="errored",r(g))}),c.request.cancel=()=>p.abort()}loadTileData(c,r){c.setTexture(r,this._map.painter)}unloadTile(c,r){if(c.texture&&c.texture instanceof a.T?(c.destroy(!0),c.texture&&c.texture instanceof a.T&&this._map.painter.saveTileTexture(c.texture)):c.destroy(),this._implementation.unloadTile){const{x:o,y:u,z:d}=c.tileID.canonical;this._implementation.unloadTile({x:o,y:u,z:d})}r()}abortTile(c,r){c.request&&c.request.cancel&&(c.request.cancel(),delete c.request),r()}hasTransition(){return!1}_coveringTiles(){return this._map.transform.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,roundZoom:this.roundZoom}).map(c=>({x:c.canonical.x,y:c.canonical.y,z:c.canonical.z}))}_clearTiles(){const c=a.ag(this.id,this.scope);this._map.style.clearSource(c)}
14_update(){this.fire(new a.b("data",{dataType:"source",sourceDataType:"content"}))}}},Wi=function(c,r,o,u){const d=new In[r.type](c,r,o,u);if(d.id!==c)throw new Error(`Expected Source id to be ${c} instead of ${d.id}`);return a.aY(["load","abort","unload","serialize","prepare"],d),d};function tc(c,r){const o=a.a6.identity([]);return a.a6.scale(o,o,[.5*c.width,.5*-c.height,1]),a.a6.translate(o,o,[1,-1,0]),a.a6.multiply(o,o,c.calculateProjMatrix(r.toUnwrapped())),Float32Array.from(o)}function ic(c,r,o,u,d,p,g,x=!1){const b=c.tilesIn(u,g,x);b.sort(ls);const T=[];for(const S of b)T.push({wrappedTileID:S.tile.tileID.wrapped().key,queryResults:S.tile.queryRenderedFeatures(r,o,c._state,S,d,p,tc(c.transform,S.tile.tileID),x)});const M=function(S){const C={},P={};for(const k of S){const R=k.queryResults,O=k.wrappedTileID,D=P[O]=P[O]||{};for(const F in R){const Z=R[F],V=D[F]=D[F]||{},q=C[F]=C[F]||[];for(const B of Z)V[B.featureIndex]||(V[B.featureIndex]=!0,q.push(B))}}return C}(T);for(const S in M)M[S].forEach(C=>{const P=C.feature,k=P.layer;k&&k.type!=="background"&&k.type!=="sky"&&k.type!=="slot"&&(P.source=k.source,k["source-layer"]&&(P.sourceLayer=k["source-layer"]),P.state=P.id!==void 0?c.getFeatureState(k["source-layer"],P.id):{})});return M}function Cn(c,r){const o=c.getRenderableIds().map(p=>c.getTileByID(p)),u=[],d={};for(let p=0;p<o.length;p++){const g=o[p],x=g.tileID.canonical.key;d[x]||(d[x]=!0,g.querySourceFeatures(u,r))}return u}function ls(c,r){const o=c.tileID,u=r.tileID;return o.overscaledZ-u.overscaledZ||o.canonical.y-u.canonical.y||o.wrap-u.wrap||o.canonical.x-u.canonical.x}class zo extends Jn{constructor(r,o,u,d,p){super(r,o,u,d,p),this._workQueue=[],this._fetchQueue=[],this._isHeaderLoaded=!1}setTexture(r,o){const u=o.context,d=u.gl;this.texture=this.texture||o.getTileTexture(r.width),this.texture&&this.texture instanceof a.T?this.texture.update(r,{useMipmap:!1,premultiply:!1}):this.texture=new a.T(u,r,d.RGBA,{useMipmap:!1,premultiply:!1})}flushQueues(){for(;this._workQueue.length;)this._workQueue.pop()();for(;this._fetchQueue.length;)this._fetchQueue.pop()()}fetchHeader(r=16384,o){const u=this._mrt=new a.aZ(30),d=Object.assign({},this.requestParams,{headers:{Range:"bytes=0-"+(r-1)}});return this.entireBuffer=null,this.request=a.a_(d,(p,g,x,b)=>{if(p)o(p);else try{const T=u.getHeaderLength(g);if(T>r)return void(this.request=this.fetchHeader(T,o));u.parseHeader(g),this._isHeaderLoaded=!0;let M=0;for(const S of Object.values(u.layers))M=Math.max(M,S.dataIndex[S.dataIndex.length-1].last_byte);g.byteLength>=M&&(this.entireBuffer=g),o(null,this.entireBuffer||g,x,b)}catch(T){o(T)}}),this.request}fetchBand(r,o,u){const d=this._mrt;if(!this._isHeaderLoaded||!d)return void u(new Error("Tile header is not ready"));const p=this.actor;if(!p)return void u(new Error("Can't fetch tile band without an actor"));let g;const x=(S,C)=>{g.complete(S,C),S?u(S):(this.updateTextureDescriptor(r,o),u(null,this.textureDescriptor&&this.textureDescriptor.img))},b=(S,C)=>{if(S)return u(S);const P=p.send("decodeRasterArray",{buffer:C,task:g},x,void 0,!0);this._workQueue.push(()=>{P&&P.cancel(),g.cancel()})},T=d.getLayer(r);if(!T)return void u(new Error(`Unknown sourceLayer "${r}"`));if(T.hasDataForBand(o))return this.updateTextureDescriptor(r,o),void u(null,this.textureDescriptor?this.textureDescriptor.img:null);const M=T.getDataRange([o]);if(g=d.createDecodingTask(M),!g||g.tasks.length)if(this.flushQueues(),this.entireBuffer)b(null,this.entireBuffer.slice(M.firstByte,M.lastByte+1));else{const S=Object.assign({},this.requestParams,{headers:{Range:`bytes=${M.firstByte}-${M.lastByte}`}}),C=a.a_(S,b);this._fetchQueue.push(()=>{C.cancel(),g.cancel()})}else u(null)}updateNeeded(r,o){return(!this.textureDescriptor||this.textureDescriptor.band!==o||this.textureDescriptor.layer!==r)&&this.state!=="errored"}updateTextureDescriptor(r,o){if(!this._mrt)return;const u=this._mrt.getLayer(r);if(!u||!u.hasBand(o)||!u.hasDataForBand(o))return;const{bytes:d,tileSize:p,buffer:g,offset:x,scale:b}=u.getBandView(o),T=p+2*g,M={data:d,width:T,height:T},S=this.texture;S&&S instanceof a.T&&S.update(M,{useMipmap:!1,premultiply:!1}),this.textureDescriptor={layer:r,band:o,img:M,buffer:g,offset:x,tileSize:p,format:u.pixelFormat,mix:[b,256*b,65536*b,16777216*b]}}}class cs{constructor(r,o){this.max=r,this.onRemove=o,this.reset()}reset(){for(const r in this.data)for(const o of this.data[r])o.timeout&&clearTimeout(o.timeout),this.onRemove(o.value);return this.data={},this.order=[],this}add(r,o,u){const d=r.wrapped().key;this.data[d]===void 0&&(this.data[d]=[]);const p={value:o,timeout:void 0};if(u!==void 0&&(p.timeout=setTimeout(()=>{this.remove(r,p)},u)),this.data[d].push(p),this.order.push(d),this.order.length>this.max){const g=this._getAndRemoveByKey(this.order[0]);g&&this.onRemove(g)}return this}has(r){return r.wrapped().key in this.data}getAndRemove(r){return this.has(r)?this._getAndRemoveByKey(r.wrapped().key):null}_getAndRemoveByKey(r){const o=this.data[r].shift();return o.timeout&&clearTimeout(o.timeout),this.data[r].length===0&&delete this.data[r],this.order.splice(this.order.indexOf(r),1),o.value}getByKey(r){const o=this.data[r];return o?o[0].value:null}get(r){return this.has(r)?this.data[r.wrapped().key][0].value:null}remove(r,o){if(!this.has(r))return this;const u=r.wrapped().key,d=o===void 0?0:this.data[u].indexOf(o),p=this.data[u][d];return this.data[u].splice(d,1),p.timeout&&clearTimeout(p.timeout),this.data[u].length===0&&delete this.data[u],this.onRemove(p.value),this.order.splice(this.order.indexOf(u),1),this}setMaxSize(r){for(this.max=r;this.order.length>this.max;){const o=this._getAndRemoveByKey(this.order[0]);o&&this.onRemove(o)}return this}filter(r){const o=[];for(const u in this.data)for(const d of this.data[u])r(d.value)||o.push(d);for(const u of o)this.remove(u.value.tileID,u)}}class nn extends a.E{constructor(r,o,u){super(),this.id=r,this._onlySymbols=u,o.on("data",d=>{d.dataType==="source"&&d.sourceDataType==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&d.dataType==="source"&&d.sourceDataType==="content"&&(this.reload(),this.transform&&this.update(this.transform))}),o.on("error",()=>{this._sourceErrored=!0}),this._source=o,this._tiles={},this._cache=new cs(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={}
vendor: 19,948 bytes, line 14
14,this._minTileCacheSize=o.minTileCacheSize,this._maxTileCacheSize=o.maxTileCacheSize,this._loadedParentTiles={},this.castsShadows=!1,this.tileCoverLift=0,this._coveredTiles={},this._shadowCasterTiles={},this._state=new qt,this._isRaster=this._source.type==="raster"||this._source.type==="raster-dem"||this._source.type==="raster-array"||this._source.type==="custom"&&this._source._dataType==="raster"}onAdd(r){this.map=r,this._minTileCacheSize=this._minTileCacheSize===void 0&&r?r._minTileCacheSize:this._minTileCacheSize,this._maxTileCacheSize=this._maxTileCacheSize===void 0&&r?r._maxTileCacheSize:this._maxTileCacheSize}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;for(const r in this._tiles){const o=this._tiles[r];if(o.state!=="errored"&&(o.state!=="loaded"||!o.bucketsLoaded()))return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const r=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,r&&this.reload(),this.transform&&this.update(this.transform)}_loadTile(r,o){return r.isSymbolTile=this._onlySymbols,r.isExtraShadowCaster=this._shadowCasterTiles[r.tileID.key],this._source.loadTile(r,o)}_unloadTile(r){if(this._source.unloadTile)return this._source.unloadTile(r,()=>{})}_abortTile(r){if(this._source.abortTile)return this._source.abortTile(r,()=>{})}serialize(){return this._source.serialize()}prepare(r){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const o in this._tiles){const u=this._tiles[o];u.upload(r),u.prepare(this.map.style.imageManager,this.map?this.map.painter:null,this._source.scope)}}getIds(){return a.a$(this._tiles).map(r=>r.tileID).sort(Ha).map(r=>r.key)}getRenderableIds(r,o){const u=[];for(const d in this._tiles)this._isIdRenderable(+d,r,o)&&u.push(this._tiles[d]);return r?u.sort((d,p)=>{const g=d.tileID,x=p.tileID,b=new a.P(g.canonical.x,g.canonical.y)._rotate(this.transform.angle),T=new a.P(x.canonical.x,x.canonical.y)._rotate(this.transform.angle);return g.overscaledZ-x.overscaledZ||T.y-b.y||T.x-b.x}).map(d=>d.tileID.key):u.map(d=>d.tileID).sort(Ha).map(d=>d.key)}hasRenderableParent(r){const o=this.findLoadedParent(r,0);return!!o&&this._isIdRenderable(o.tileID.key)}_isIdRenderable(r,o,u){return this._tiles[r]&&this._tiles[r].hasData()&&!this._coveredTiles[r]&&(o||!this._tiles[r].holdingForFade())&&(u||!this._shadowCasterTiles[r])}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const r in this._tiles)this._tiles[r].state!=="errored"&&this._reloadTile(+r,"reloading")}}_reloadTile(r,o){const u=this._tiles[r];u&&(u.state!=="loading"&&(u.state=o),this._loadTile(u,this._tileLoaded.bind(this,u,r,o)))}_tileLoaded(r,o,u,d){if(d)if(r.state="errored",d.status!==404)this._source.fire(new a.a(d,{tile:r}));else{if(!(r.tileID.key in this._loadedParentTiles))return void this._source.fire(new a.b("data",{dataType:"source",sourceDataType:"error",sourceId:this._source.id}));if(this._source.type==="raster-dem"&&this.usedForTerrain&&this.map.painter.terrain){const p=this.map.painter.terrain;this.update(this.transform,p.getScaledDemTileSize(),!0),p.resetTileLookupCache(this.id)}else this.update(this.transform)}else r.timeAdded=a.f.now(),u==="expired"&&(r.refreshedUponExpiration=!0),this._setTileReloadTimer(o,r),this._source.type==="raster-dem"&&r.dem&&this._backfillDEM(r),this._state.initializeTileState(r,this.map?this.map.painter:null),this._source.fire(new a.b("data",{dataType:"source",tile:r,coord:r.tileID,sourceCacheId:this.id}))}_backfillDEM(r){const o=this.getRenderableIds();for(let d=0;d<o.length;d++){const p=o[d];if(r.neighboringTiles&&r.neighboringTiles[p]){const g=this.getTileByID(p);u(r,g),u(g,r)}}function u(d,p){if(!d.dem||d.dem.borderReady)return;d.needsHillshadePrepare=!0,d.needsDEMTextureUpload=!0;let g=p.tileID.canonical.x-d.tileID.canonical.x;const x=p.tileID.canonical.y-d.tileID.canonical.y,b=Math.pow(2,d.tileID.canonical.z),T=p.tileID.key;g===0&&x===0||Math.abs(x)>1||(Math.abs(g)>1&&(Math.abs(g+b)===1?g+=b:Math.abs(g-b)===1&&(g-=b)),p.dem&&d.dem&&(d.dem.backfillBorder(p.dem,g,x),d.neighboringTiles&&d.neighboringTiles[T]&&(d.neighboringTiles[T].backfilled=!0)))}}getTile(r){return this.getTileByID(r.key)}getTileByID(r){return this._tiles[r]}_retainLoadedChildren(r,o,u,d){for(const p in this._tiles){let g=this._tiles[p];if(d[p]||!g.hasData()||g.tileID.overscaledZ<=o||g.tileID.overscaledZ>u)continue;let x=g.tileID;for(;g&&g.tileID.overscaledZ>o+1;){const T=g.tileID.scaledTo(g.tileID.overscaledZ-1);g=this._tiles[T.key],g&&g.hasData()&&(x=T)}let b=x;for(;b.overscaledZ>o;)if(b=b.scaledTo(b.overscaledZ-1),r[b.key]){d[x.key]=x;break}}}findLoadedParent(r,o){if(r.key in this._loadedParentTiles){const u=this._loadedParentTiles[r.key];return u&&u.tileID.overscaledZ>=o?u:null}for(let u=r.overscaledZ-1;u>=o;u--){const d=r.scaledTo(u),p=this._getLoadedTile(d);if(p)return p}}_getLoadedTile(r){const o=this._tiles[r.key];return o&&o.hasData()?o:this._cache.getByKey(this._source.reparseOverscaled?r.wrapped().key:r.canonical.key)}updateCacheSize(r,o){o=o||this._source.tileSize;const u=Math.ceil(r.width/o)+1,d=Math.ceil(r.height/o)+1,p=Math.floor(u*d*5),g=typeof this._minTileCacheSize=="number"?Math.max(this._minTileCacheSize,p):p,x=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,g):g;this._cache.setMaxSize(x)}handleWrapJump(r){const o=Math.round((r-(this._prevLng===void 0?r:this._prevLng))/360);if(this._prevLng=r,o){const u={};for(const d in this._tiles){const p=this._tiles[d];p.tileID=p.tileID.unwrapTo(p.tileID.wrap+o),u[p.tileID.key]=p}this._tiles=u;for(const d in this._timers)clearTimeout(this._timers[d]),delete this._timers[d];for(const d in this._tiles)this._setTileReloadTimer(+d,this._tiles[d])}}update(r,o,u,d){if(this.transform=r,!this._sourceLoaded||this._paused||this.transform.freezeTileCoverage||this.usedForTerrain&&!u)return;let p;if(this.updateCacheSize(r,o),this.transform.projection.name!=="globe"&&this.handleWrapJump(this.transform.center.lng),this._shadowCasterTiles={},this._coveredTiles={},this.used||this.usedForTerrain)if(this._source.tileID)p=r.getVisibleUnwrappedCoordinates(this._source.tileID).map(b=>new a.am(b.canonical.z,b.wrap,b.canonical.z,b.canonical.x,b.canonical.y));else if(this.tileCoverLift!==0){const b=r.clone();b.tileCoverLift=this.tileCoverLift,p=b.coveringTiles({tileSize:o||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!u,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain}),this._source.minzoom<=1&&r.projection.name==="globe"&&(p.push(new a.am(1,0,1,0,0)),p.push(new a.am(1,0,1,1,0)),p.push(new a.am(1,0,1,0,1)),p.push(new a.am(1,0,1,1,1)))}else p=r.coveringTiles({tileSize:o||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!u,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain}),this._source.hasTile&&(p=p.filter(b=>this._source.hasTile(b)));else p=[];if(p.length>0&&this.castsShadows&&d&&this.transform.projection.name!=="globe"&&!this.usedForTerrain&&!Pn(this._source.type)){const b=r.coveringZoomLevel({tileSize:o||this._source.tileSize,roundZoom:this._source.roundZoom&&!u}),T=Math.min(b,this._source.maxzoom),M=r.extendTileCoverForShadows(p,d,T);for(const S of M)this._shadowCasterTiles[S.key]=!0,p.push(S)}const g=this._updateRetainedTiles(p);if(Pn(this._source.type)&&p.length!==0){const b={},T={},M=Object.keys(g);for(const C of M){const P=g[C],k=this._tiles[C];if(!k||k.fadeEndTime&&k.fadeEndTime<=a.f.now())continue;const R=this.findLoadedParent(P,Math.max(P.overscaledZ-nn.maxOverzooming,this._source.minzoom));R&&(this._addTile(R.tileID),b[R.tileID.key]=R.tileID),T[C]=P}const S=p[p.length-1].overscaledZ;for(const C in this._tiles){const P=this._tiles[C];if(g[C]||!P.hasData())continue;let k=P.tileID;for(;k.overscaledZ>S;){k=k.scaledTo(k.overscaledZ-1);const R=this._tiles[k.key];if(R&&R.hasData()&&T[k.key]){g[C]=P.tileID;break}}}for(const C in b)g[C]||(this._coveredTiles[C]=!0,g[C]=b[C])}for(const b in g)this._tiles[b].clearFadeHold();const x=a.b0(this._tiles,g);for(const b of x){const T=this._tiles[b];T.hasSymbolBuckets&&!T.holdingForFade()?T.setHoldDuration(this.map._fadeDuration):T.hasSymbolBuckets&&!T.symbolFadeFinished()||this._removeTile(+b)}this._updateLoadedParentTileCache(),this._onlySymbols&&this._source.afterUpdate&&this._source.afterUpdate()}releaseSymbolFadeTiles(){for(const r in this._tiles)this._tiles[r].holdingForFade()&&this._removeTile(+r)}_updateRetainedTiles(r){const o={};if(r.length===0)return o;const u={},d=r.reduce((T,M)=>Math.min(T,M.overscaledZ),1/0),p=r[0].overscaledZ,g=Math.max(p-nn.maxOverzooming,this._source.minzoom),x=Math.max(p+nn.maxUnderzooming,this._source.minzoom),b={};for(const T of r){const M=this._addTile(T);o[T.key]=T,M.hasData()||d<this._source.maxzoom&&(b[T.key]=T)}this._retainLoadedChildren(b,d,x,o);for(const T of r){let M=this._tiles[T.key];if(M.hasData())continue;if(T.canonical.z>=this._source.maxzoom){const C=T.children(this._source.maxzoom)[0],P=this.getTile(C);if(P&&P.hasData()){o[C.key]=C;continue}}else{const C=T.children(this._source.maxzoom);if(o[C[0].key]&&o[C[1].key]&&o[C[2].key]&&o[C[3].key])continue}let S=M.wasRequested();for(let C=T.overscaledZ-1;C>=g;--C){const P=T.scaledTo(C);if(u[P.key]||(u[P.key]=!0,M=this.getTile(P),!M&&S&&(M=this._addTile(P)),M&&(o[P.key]=P,S=M.wasRequested(),M.hasData())))break}}return o}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const r in this._tiles){const o=[];let u,d=this._tiles[r].tileID;for(;d.overscaledZ>0;){if(d.key in this._loadedParentTiles){u=this._loadedParentTiles[d.key];break}o.push(d.key);const p=d.scaledTo(d.overscaledZ-1);if(u=this._getLoadedTile(p),u)break;d=p}for(const p of o)this._loadedParentTiles[p]=u}}_addTile(r){let o=this._tiles[r.key];if(o)return o.isExtraShadowCaster!==!0||this._shadowCasterTiles[r.key]||this._reloadTile(r.key,"reloading"),o;o=this._cache.getAndRemove(r),o&&(this._setTileReloadTimer(r.key,o),o.tileID=r,this._state.initializeTileState(o,this.map?this.map.painter:null),this._cacheTimers[r.key]&&(clearTimeout(this._cacheTimers[r.key]),delete this._cacheTimers[r.key],this._setTileReloadTimer(r.key,o)));const u=!!o;if(!u){const d=this.map?this.map.painter:null,p=this._source.tileSize*r.overscaleFactor();o=this._source.type==="raster-array"?new zo(r,p,this.transform.tileZoom,d,this._isRaster):new Jn(r,p,this.transform.tileZoom,d,this._isRaster),this._loadTile(o,this._tileLoaded.bind(this,o,r.key,o.state))}return o?(o.uses++,this._tiles[r.key]=o,u||this._source.fire(new a.b("dataloading",{tile:o,coord:o.tileID,dataType:"source"})),o):null}_setTileReloadTimer(r,o){r in this._timers&&(clearTimeout(this._timers[r]),delete this._timers[r]);const u=o.getExpiryTimeout();u&&(this._timers[r]=setTimeout(()=>{this._reloadTile(r,"expired"),delete this._timers[r]},u))}_removeTile(r){const o=this._tiles[r];o&&(o.uses--,delete this._tiles[r],this._timers[r]&&(clearTimeout(this._timers[r]),delete this._timers[r]),o.uses>0||(o.hasData()&&o.state!=="reloading"||o.state==="empty"?this._cache.add(o.tileID,o,o.getExpiryTimeout()):(o.aborted=!0,this._abortTile(o),this._unloadTile(o))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const r in this._tiles)this._removeTile(+r);this._source._clear&&this._source._clear(),this._cache.reset(),this.map&&this.usedForTerrain&&this.map.painter.terrain&&this.map.painter.terrain.resetTileLookupCache(this.id)}tilesIn(r,o,u){const d=[],p=this.transform;if(!p)return d;const g=p.projection.name==="globe",x=a.a5(p.center.lng);for(const b in this._tiles){const T=this._tiles[b];if(u&&T.clearQueryDebugViz(),T.holdingForFade())continue;let M;if(g){const S=T.tileID.canonical;if(S.z===0){const C=[Math.abs(a.aa(x,...Ws(S,-1))-x),Math.abs(a.aa(x,...Ws(S,1))-x)];M=[0,2*C.indexOf(Math.min(...C))-1]}else{const C=[Math.abs(a.aa(x,...Ws(S,-1))-x),Math.abs(a.aa(x,...Ws(S,0))-x),Math.abs(a.aa(x,...Ws(S,1))-x)];M=[C.indexOf(Math.min(...C))-1]}}else M=[0];for(const S of M){const C=r.containsTile(T,p,o,S);C&&d.push(C)}}return d}getShadowCasterCoordinates(){return this._getRenderableCoordinates(!1,!0)}getVisibleCoordinates(r){return this._getRenderableCoordinates(r)}_getRenderableCoordinates(r,o){const u=this.getRenderableIds(r,o).map(p=>this._tiles[p].tileID),d=this.transform.projection.name==="globe";for(const p of u)p.projMatrix=this.transform.calculateProjMatrix(p.toUnwrapped()),p.expandedProjMatrix=d?this.transform.calculateProjMatrix(p.toUnwrapped(),!1,!0):p.projMatrix;return u}sortCoordinatesByDistance(r){const o=r.slice(),u=this.transform._camera.position,d=this.transform._camera.forward(),p={};for(const g of o){const x=1/(1<<g.canonical.z);p[g.key]=((g.canonical.x+.5)*x+g.wrap-u[0])*d[0]+((g.canonical.y+.5)*x-u[1])*d[1]-u[2]*d[2]}return o.sort((g,x)=>p[g.key]-p[x.key]),o}hasTransition(){if(this._source.hasTransition())return!0;if(Pn(this._source.type))for(const r in this._tiles){const o=this._tiles[r];if(o.fadeEndTime!==void 0&&o.fadeEndTime>=a.f.now())return!0}return!1}setFeatureState(r,o,u){this._state.updateState(r=r||"_geojsonTileLayer",o,u)}removeFeatureState(r,o,u){this._state.removeFeatureState(r=r||"_geojsonTileLayer",o,u)}getFeatureState(r,o){return this._state.getState(r=r||"_geojsonTileLayer",o)}setDependencies(r,o,u){const d=this._tiles[r];d&&d.setDependencies(o,u)}reloadTilesForDependencies(r,o){for(const u in this._tiles)this._tiles[u].hasDependency(r,o)&&this._reloadTile(+u,"reloading");this._cache.filter(u=>!u.hasDependency(r,o))}_preloadTiles(r,o){if(!this._sourceLoaded){const b=()=>{this._sourceLoaded&&(this._source.off("data",b),this._preloadTiles(r,o))};return void this._source.on("data",b)}const u=new Map,d=Array.isArray(r)?r:[r],p=this.map.painter.terrain,g=this.usedForTerrain&&p?p.getScaledDemTileSize():this._source.tileSize;for(const b of d){const T=b.coveringTiles({tileSize:g,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!this.usedForTerrain,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain});for(const M of T)u.set(M.key,M);this.usedForTerrain&&b.updateElevation(!1)}const x=Array.from(u.values());a.b1(x,(b,T)=>{const M=new Jn(b,this._source.tileSize*b.overscaleFactor(),this.transform.tileZoom,this.map.painter,this._isRaster);this._loadTile(M,S=>{this._source.type==="raster-dem"&&M.dem&&this._backfillDEM(M),T(S,M)})},o)}}function Ha(c,r){const o=Math.abs(2*c.wrap)-+(c.wrap<0),u=Math.abs(2*r.wrap)-+(r.wrap<0);return c.overscaledZ-r.overscaledZ||u-o||r.canonical.y-c.canonical.y||r.canonical.x-c.canonical.x}function Pn(c){return c==="raster"||c==="image"||c==="video"||c==="custom"}function Ws(c,r){const o=1<<c.z;return[c.x/o+r,(c.x+1)/o+r]}nn.maxOverzooming=10,nn.maxUnderzooming=3;class eh{constructor(r){this.style=r,this.layersGotHidden=!1,this.layers=[]}processLayersChanged(){this.layers=[];const r=!1,o=!1;for(const u in this.style._mergedLayers){const d=this.style._mergedLayers[u];if(d.type==="fill-extrusion")this.layers.push({layer:d,visible:r,visibilityChanged:o});else if(d.type==="model"){const p=this.style.getLayerSource(d);p&&p.type==="batched-model"&&this.layers.push({layer:d,visible:r,visibilityChanged:o})}}}onNewFrame(r){this.layersGotHidden=!1;for(const o of this.layers){const u=o.layer;let d=!1;u.type==="fill-extrusion"?d=!u.isHidden(r)&&u.paint.get("fill-extrusion-opacity")>0:u.type==="model"&&(d=!u.isHidden(r)&&u.paint.get("model-opacity")>0),this.layersGotHidden=this.layersGotHidden||!d&&o.visible,o.visible=d}}updateZOffset(r,o){this.currentBuildingBuckets=[];for(const d of this.layers){const p=d.layer,g=this.style.getLayerSourceCache(p);let x=1;p.type==="fill-extrusion"&&(x=d.visible?p.paint.get("fill-extrusion-vertical-scale"):0);let b=g?g.getTile(o):null;if(!b&&g&&o.canonical.z>g.getSource().minzoom){let T=o.scaledTo(Math.min(g.getSource().maxzoom,o.overscaledZ-1));for(;T.overscaledZ>=g.getSource().minzoom&&(b=g.getTile(T),!b&&T.overscaledZ!==0);)T=T.scaledTo(T.overscaledZ-1)}this.currentBuildingBuckets.push({bucket:b?b.getBucket(p):null,tileID:b?b.tileID:o,verticalScale:x})}r.hasAnyZOffset=!1;let u=!1;for(let d=0;d<r.symbolInstances.length;d++){const p=r.symbolInstances.get(d),g=p.zOffset,x=this._getHeightAtTileOffset(o,p.tileAnchorX,p.tileAnchorY);p.zOffset=x!==Number.NEGATIVE_INFINITY?x:g,u||g===p.zOffset||(u=!0),r.hasAnyZOffset||p.zOffset===0||(r.hasAnyZOffset=!0)}u&&(r.zOffsetBuffersNeedUpload=!0,r.zOffsetSortDirty=!0)}_mapCoordToOverlappingTile(r,o,u,d){let p=o,g=u;if(r.canonical.z!==d.canonical.z){const x=d.canonical,b=1/(1<<r.canonical.z-x.z);p=(o+r.canonical.x*a.V)*b-x.x*a.V|0,g=(u+r.canonical.y*a.V)*b-x.y*a.V|0}return{tileX:p,tileY:g}}_getHeightAtTileOffset(r,o,u){let d,p;for(let g=0;g<this.layers.length;++g){if(this.layers[g].layer.type!=="fill-extrusion")continue;const{bucket:x,tileID:b,verticalScale:T}=this.currentBuildingBuckets[g];if(!x)continue;const{tileX:M,tileY:S}=this._mapCoordToOverlappingTile(r,o,u,b),C=x.getHeightAtTileCoord(M,S);C&&C.height!==void 0&&(C.hidden?d=C.height:p=Math.max(C.height*T,p||0))}if(p!==void 0)return p;for(let g=0;g<this.layers.length;++g){const x=this.layers[g];if(x.layer.type!=="model"||!x.visible)continue;const{bucket:b,tileID:T}=this.currentBuildingBuckets[g];if(!b)continue;const{tileX:M,tileY:S}=this._mapCoordToOverlappingTile(r,o,u,T),C=b.getHeightAtTileCoord(M,S);if(C&&!C.hidden)return C.height===void 0&&d!==void 0?Math.min(C.maxHeight,d)*C.verticalScale:(C.height||0)*C.verticalScale}return this.layersGotHidden?0:Number.NEGATIVE_INFINITY}}function Do(c,r){const o={};for(const u in c)u!=="ref"&&(o[u]=c[u]);return a.b2.forEach(u=>{u in r&&(o[u]=r[u])}),o}function th(c){c=c.slice();const r=Object.create(null);for(let o=0;o<c.length;o++)r[c[o].id]=c[o];for(let o=0;o<c.length;o++)"ref"in c[o]&&(c[o]=Do(c[o],r[c[o].ref]));return c}const Gt={setStyle:"setStyle",addLayer:"addLayer",removeLayer:"removeLayer",setPaintProperty:"setPaintProperty",setLayoutProperty:"setLayoutProperty",setSlot:"setSlot",setFilter:"setFilter",addSource:"addSource",removeSource:"removeSource",setGeoJSONSourceData:"setGeoJSONSourceData",setLayerZoomRange:"setLayerZoomRange",setLayerProperty:"setLayerProperty",setCenter:"setCenter",setZoom:"setZoom",setBearing:"setBearing",setPitch:"setPitch",setSprite:"setSprite",setGlyphs:"setGlyphs",setTransition:"setTransition",setLight:"setLight",setTerrain:"setTerrain",setFog:"setFog",setCamera:"setCamera",setLights:"setLights",setProjection:"setProjection",addImport:"addImport",removeImport:"removeImport",updateImport:"updateImport"};function Hs(c,r,o){o.push({command:Gt.addSource,args:[c,r[c]]})}function rc(c,r,o){r.push({command:Gt.removeSource,args:[c]}),o[c]=!0}function Wd(c,r,o,u){rc(c,o,u),Hs(c,r,o)}function Hd(c,r,o){let u;for(u in c[o])if(c[o].hasOwnProperty(u)&&u!=="data"&&!Pt(c[o][u],r[o][u]))return!1;for(u in r[o])if(r[o].hasOwnProperty(u)&&u!=="data"&&!Pt(c[o][u],r[o][u]))return!1;return!0}function Qn(c,r,o,u,d,p){let g;for(g in r=r||{},c=c||{})c.hasOwnProperty(g)&&(Pt(c[g],r[g])||o.push({command:p,args:[u,g,r[g],d]}));for(g in r)r.hasOwnProperty(g)&&!c.hasOwnProperty(g)&&(Pt(c[g],r[g])||o.push({command:p,args:[u,g,r[g],d]}))}function eo(c){return c.id}function Xa(c,r){return c[r.id]=r,c}class us{constructor(r,o){this.reset(r,o)}reset(r,o){this.points=r||[],this._distances=[0];for(let u=1;u<this.points.length;u++)this._distances[u]=this._distances[u-1]+this.points[u].dist(this.points[u-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(o||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(r){if(this.points.length===1)return this.points[0];r=a.aa(r,0,1);let o=1,u=this._distances[o];const d=r*this.paddedLength+this.padding;
vendor: 4,365 bytes, line 14
14for(;u<d&&o<this._distances.length;)u=this._distances[++o];const p=o-1,g=this._distances[p],x=u-g,b=x>0?(d-g)/x:0;return this.points[p].mult(1-b).add(this.points[o].mult(b))}}class nc{constructor(r,o,u){const d=this.boxCells=[],p=this.circleCells=[];this.xCellCount=Math.ceil(r/u),this.yCellCount=Math.ceil(o/u);for(let g=0;g<this.xCellCount*this.yCellCount;g++)d.push([]),p.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=r,this.height=o,this.xScale=this.xCellCount/r,this.yScale=this.yCellCount/o,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(r,o,u,d,p){this._forEachCell(o,u,d,p,this._insertBoxCell,this.boxUid++),this.boxKeys.push(r),this.bboxes.push(o),this.bboxes.push(u),this.bboxes.push(d),this.bboxes.push(p)}insertCircle(r,o,u,d){this._forEachCell(o-d,u-d,o+d,u+d,this._insertCircleCell,this.circleUid++),this.circleKeys.push(r),this.circles.push(o),this.circles.push(u),this.circles.push(d)}_insertBoxCell(r,o,u,d,p,g){this.boxCells[p].push(g)}_insertCircleCell(r,o,u,d,p,g){this.circleCells[p].push(g)}_query(r,o,u,d,p,g){if(u<0||r>this.width||d<0||o>this.height)return!p&&[];const x=[];if(r<=0&&o<=0&&this.width<=u&&this.height<=d){if(p)return!0;for(let b=0;b<this.boxKeys.length;b++)x.push({key:this.boxKeys[b],x1:this.bboxes[4*b],y1:this.bboxes[4*b+1],x2:this.bboxes[4*b+2],y2:this.bboxes[4*b+3]});for(let b=0;b<this.circleKeys.length;b++){const T=this.circles[3*b],M=this.circles[3*b+1],S=this.circles[3*b+2];x.push({key:this.circleKeys[b],x1:T-S,y1:M-S,x2:T+S,y2:M+S})}return g?x.filter(g):x}return this._forEachCell(r,o,u,d,this._queryCell,x,{hitTest:p,seenUids:{box:{},circle:{}}},g),p?x.length>0:x}_queryCircle(r,o,u,d,p){const g=r-u,x=r+u,b=o-u,T=o+u;if(x<0||g>this.width||T<0||b>this.height)return!d&&[];const M=[];return this._forEachCell(g,b,x,T,this._queryCellCircle,M,{hitTest:d,circle:{x:r,y:o,radius:u},seenUids:{box:{},circle:{}}},p),d?M.length>0:M}query(r,o,u,d,p){return this._query(r,o,u,d,!1,p)}hitTest(r,o,u,d,p){return this._query(r,o,u,d,!0,p)}hitTestCircle(r,o,u,d){return this._queryCircle(r,o,u,!0,d)}_queryCell(r,o,u,d,p,g,x,b){const T=x.seenUids,M=this.boxCells[p];if(M!==null){const C=this.bboxes;for(const P of M)if(!T.box[P]){T.box[P]=!0;const k=4*P;if(r<=C[k+2]&&o<=C[k+3]&&u>=C[k+0]&&d>=C[k+1]&&(!b||b(this.boxKeys[P]))){if(x.hitTest)return g.push(!0),!0;g.push({key:this.boxKeys[P],x1:C[k],y1:C[k+1],x2:C[k+2],y2:C[k+3]})}}}const S=this.circleCells[p];if(S!==null){const C=this.circles;for(const P of S)if(!T.circle[P]){T.circle[P]=!0;const k=3*P;if(this._circleAndRectCollide(C[k],C[k+1],C[k+2],r,o,u,d)&&(!b||b(this.circleKeys[P]))){if(x.hitTest)return g.push(!0),!0;{const R=C[k],O=C[k+1],D=C[k+2];g.push({key:this.circleKeys[P],x1:R-D,y1:O-D,x2:R+D,y2:O+D})}}}}}_queryCellCircle(r,o,u,d,p,g,x,b){const T=x.circle,M=x.seenUids,S=this.boxCells[p];if(S!==null){const P=this.bboxes;for(const k of S)if(!M.box[k]){M.box[k]=!0;const R=4*k;if(this._circleAndRectCollide(T.x,T.y,T.radius,P[R+0],P[R+1],P[R+2],P[R+3])&&(!b||b(this.boxKeys[k])))return g.push(!0),!0}}const C=this.circleCells[p];if(C!==null){const P=this.circles;for(const k of C)if(!M.circle[k]){M.circle[k]=!0;const R=3*k;if(this._circlesCollide(P[R],P[R+1],P[R+2],T.x,T.y,T.radius)&&(!b||b(this.circleKeys[k])))return g.push(!0),!0}}}_forEachCell(r,o,u,d,p,g,x,b){const T=this._convertToXCellCoord(r),M=this._convertToYCellCoord(o),S=this._convertToXCellCoord(u),C=this._convertToYCellCoord(d);for(let P=T;P<=S;P++)for(let k=M;k<=C;k++)if(p.call(this,r,o,u,d,this.xCellCount*k+P,g,x,b))return}_convertToXCellCoord(r){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(r*this.xScale)))}_convertToYCellCoord(r){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(r*this.yScale)))}_circlesCollide(r,o,u,d,p,g){const x=d-r,b=p-o,T=u+g;return T*T>x*x+b*b}_circleAndRectCollide(r,o,u,d,p,g,x){const b=(g-d)/2,T=Math.abs(r-(d+b));if(T>b+u)return!1;const M=(x-p)/2,S=Math.abs(o-(p+M));if(S>M+u)return!1;if(T<=b||S<=M)return!0;const C=T-b,P=S-M;return C*C+P*P<=u*u}}const zn={unknown:0,flipRequired:1,flipNotRequired:2},to=Math.tan(85*Math.PI/180);function Xs(c,r,o,u,d,p,g){const x=a.a6.create();if(o)if(p.name==="globe"){const b=a.b3(d,r);a.a6.multiply(x,x,b)}else{const b=a.b4.invert([],g);x[0]=b[0],x[1]=b[1],x[4]=b[2],x[5]=b[3],u||a.a6.rotateZ(x,x,d.angle)}
vendor: 9,952 bytes, line 14
14else a.a6.multiply(x,d.labelPlaneMatrix,c);return x}function oc(c,r,o,u,d,p,g){const x=Xs(c,r,o,u,d,p,g);return p.name==="globe"&&o||(x[2]=x[6]=x[10]=x[14]=0),x}function sc(c,r,o,u,d,p,g){if(o){if(p.name==="globe"){const x=Xs(c,r,o,u,d,p,g);return a.a6.invert(x,x),a.a6.multiply(x,c,x),x}{const x=a.a6.clone(c),b=a.a6.identity([]);return b[0]=g[0],b[1]=g[1],b[4]=g[2],b[5]=g[3],a.a6.multiply(x,x,b),u||a.a6.rotateZ(x,x,-d.angle),x}}return d.glCoordMatrix}function Wr(c,r,o,u){const d=[c,r,o,1];o?a.a7.transformMat4(d,d,u):dc(d,d,u);const p=d[3];return d[0]/=p,d[1]/=p,d[2]/=p,d}function ih(c,r){return Math.min(.5+c/r*.5,1.5)}function ac(c,r){const o=c[0]/c[3],u=c[1]/c[3];return o>=-r[0]&&o<=r[0]&&u>=-r[1]&&u<=r[1]}function lc(c,r,o,u,d,p,g,x,b,T){const M=o.transform,S=u?c.textSizeData:c.iconSizeData,C=a.b5(S,o.transform.zoom),P=M.projection.name==="globe",k=[256/o.width*2+1,256/o.height*2+1],R=u?c.text.dynamicLayoutVertexArray:c.icon.dynamicLayoutVertexArray;R.clear();let O=null;P&&(O=u?c.text.globeExtVertexArray:c.icon.globeExtVertexArray);const D=c.lineVertexArray,F=u?c.text.placedSymbolArray:c.icon.placedSymbolArray,Z=o.transform.width/o.transform.height;let V,q=!1;for(let B=0;B<F.length;B++){const $=F.get(B),{numGlyphs:Y,writingMode:K}=$;if(K!==a.b6.vertical||q||V===a.b6.horizontal||(q=!0),V=K,($.hidden||K===a.b6.vertical)&&!q){io(Y,R);continue}q=!1;const ee=new a.P($.tileAnchorX,$.tileAnchorY);let{x:ce,y:re,z:me}=M.projection.projectTilePoint(ee.x,ee.y,T.canonical);if(b){const[je,et,ct]=b(ee);ce+=je,re+=et,me+=ct}const fe=[ce,re,me,1];if(a.a7.transformMat4(fe,fe,r),!ac(fe,k)){io(Y,R);continue}const Ae=fe[3],ne=ih(o.transform.getCameraToCenterDistance(M.projection),Ae),he=a.b7(S,C,$),Q=g?he/ne:he*ne,ae=Wr(ce,re,me,d);if(ae[3]<=0){io(Y,R);continue}let Ie={};const Re=g?null:b,Le=hc($,Q,!1,x,r,d,p,c.glyphOffsetArray,D,R,O,ae,ee,Ie,Z,Re,M.projection,T,g);q=Le.useVertical,Re&&Le.needsFlipping&&(Ie={}),(Le.notEnoughRoom||q||Le.needsFlipping&&hc($,Q,!0,x,r,d,p,c.glyphOffsetArray,D,R,O,ae,ee,Ie,Z,Re,M.projection,T,g).notEnoughRoom)&&io(Y,R)}u?(c.text.dynamicLayoutVertexBuffer.updateData(R),O&&c.text.globeExtVertexBuffer&&c.text.globeExtVertexBuffer.updateData(O)):(c.icon.dynamicLayoutVertexBuffer.updateData(R),O&&c.icon.globeExtVertexBuffer&&c.icon.globeExtVertexBuffer.updateData(O))}function cc(c,r,o,u,d,p,g,x,b,T,M,S,C,P,k,R){const{lineStartIndex:O,glyphStartIndex:D,segment:F}=x,Z=D+x.numGlyphs,V=O+x.lineLength,q=r.getoffsetX(D),B=r.getoffsetX(Z-1),$=Ys(c*q,o,u,d,p,g,F,O,V,b,T,M,S,C,!0,P,k,R);if(!$)return null;const Y=Ys(c*B,o,u,d,p,g,F,O,V,b,T,M,S,C,!0,P,k,R);return Y?{first:$,last:Y}:null}function uc(c,r,o,u){return c===a.b6.horizontal&&Math.abs(u)>Math.abs(o)?{useVertical:!0}:c===a.b6.vertical?u>0?{needsFlipping:!0}:null:r!==zn.unknown&&function(d,p){return d===0||Math.abs(p/d)>to}(o,u)?r===zn.flipRequired?{needsFlipping:!0}:null:o<0?{needsFlipping:!0}:null}function hc(c,r,o,u,d,p,g,x,b,T,M,S,C,P,k,R,O,D,F){const Z=r/24,V=c.lineOffsetX*Z,q=c.lineOffsetY*Z,{lineStartIndex:B,glyphStartIndex:$,numGlyphs:Y,segment:K,writingMode:ee,flipState:ce}=c,re=B+c.lineLength,me=fe=>{if(M){const[Q,ae,Ie]=fe.up,Re=T.length;a.b8(M,Re+0,Q,ae,Ie),a.b8(M,Re+1,Q,ae,Ie),a.b8(M,Re+2,Q,ae,Ie),a.b8(M,Re+3,Q,ae,Ie)}const[Ae,ne,he]=fe.point;a.b9(T,Ae,ne,he,fe.angle)};if(Y>1){const fe=cc(Z,x,V,q,o,S,C,c,b,p,P,R,!1,O,D,F);if(!fe)return{notEnoughRoom:!0};if(u&&!o){let[Ae,ne,he]=fe.first.point,[Q,ae,Ie]=fe.last.point;[Ae,ne]=Wr(Ae,ne,he,g),[Q,ae]=Wr(Q,ae,Ie,g);const Re=uc(ee,ce,(Q-Ae)*k,ae-ne);if(c.flipState=Re&&Re.needsFlipping?zn.flipRequired:zn.flipNotRequired,Re)return Re}me(fe.first);for(let Ae=$+1;Ae<$+Y-1;Ae++){const ne=Ys(Z*x.getoffsetX(Ae),V,q,o,S,C,K,B,re,b,p,P,R,!1,!1,O,D,F);if(!ne)return T.length-=4*(Ae-$),{notEnoughRoom:!0};me(ne)}me(fe.last)}else{if(u&&!o){const Ae=Wr(C.x,C.y,0,d),ne=B+K+1,he=new a.P(b.getx(ne),b.gety(ne)),Q=Wr(he.x,he.y,0,d),ae=Q[3]>0?Q:Ya(C,he,Ae,1,d,void 0,O,D.canonical),Ie=uc(ee,ce,(ae[0]-Ae[0])*k,ae[1]-Ae[1]);if(c.flipState=Ie&&Ie.needsFlipping?zn.flipRequired:zn.flipNotRequired,Ie)return Ie}const fe=Ys(Z*x.getoffsetX($),V,q,o,S,C,K,B,re,b,p,P,R,!1,!1,O,D,F);if(!fe)return{notEnoughRoom:!0};me(fe)}return{}}function hs(c,r,o,u,d){const{x:p,y:g,z:x}=u.projectTilePoint(c.x,c.y,r);if(!d)return Wr(p,g,x,o);const[b,T,M]=d(c);return Wr(p+b,g+T,x+M,o)}function Ya(c,r,o,u,d,p,g,x){const b=hs(c.sub(r)._unit()._add(c),x,d,g,p);return a.N.sub(b,o,b),a.N.normalize(b,b),a.N.scaleAndAdd(b,o,b,u)}function Ys(c,r,o,u,d,p,g,x,b,T,M,S,C,P,k,R,O,D){const F=u?c-r:c+r;let Z=F>0?1:-1,V=0;u&&(Z*=-1,V=Math.PI),Z<0&&(V+=Math.PI);let q=x+g+(Z>0?0:1)|0,B=d,$=d,Y=0,K=0;const ee=Math.abs(F),ce=[],re=[];let me=p,fe=me;const Ae=()=>Ya(fe,me,$,ee-Y+1,M,C,R,O.canonical);for(;Y+K<=ee;){if(q+=Z,q<x||q>=b)return null;if($=B,fe=me,ce.push($),P&&re.push(fe),me=new a.P(T.getx(q),T.gety(q)),B=S[q],!B){const et=hs(me,O.canonical,M,R,C);B=et[3]>0?S[q]=et:Ae()}Y+=K,K=a.N.distance($,B)}k&&C&&(S[q]&&(B=Ae(),K=a.N.distance($,B)),S[q]=B);const ne=(ee-Y)/K,he=me.sub(fe)._mult(ne)._add(fe),Q=a.N.sub([],B,$),ae=a.N.scaleAndAdd([],$,Q,ne);let Ie=[0,0,1],Re=Q[0],Le=Q[1];if(D&&(Ie=R.upVector(O.canonical,he.x,he.y),Ie[0]!==0||Ie[1]!==0||Ie[2]!==1)){const et=[Ie[2],0,-Ie[0]],ct=a.N.cross([],Ie,et);a.N.normalize(et,et),a.N.normalize(ct,ct),Re=a.N.dot(Q,et),Le=a.N.dot(Q,ct)}if(o){const et=a.N.cross([],Ie,Q);a.N.normalize(et,et),a.N.scaleAndAdd(ae,ae,et,o*Z)}const je=V+Math.atan2(Le,Re);return ce.push(ae),P&&re.push(he),{point:ae,angle:je,path:ce,tilePath:re,up:Ie}}function io(c,r){const o=r.length,u=o+4*c;r.resize(u),r.float32.fill(-1/0,4*o,4*u)}function dc(c,r,o){const u=r[0],d=r[1];return c[0]=o[0]*u+o[4]*d+o[12],c[1]=o[1]*u+o[5]*d+o[13],c[3]=o[3]*u+o[7]*d+o[15],c}const Hr=100;class qe{constructor(r,o,u=new nc(r.width+200,r.height+200,25),d=new nc(r.width+200,r.height+200,25)){this.transform=r,this.grid=u,this.ignoredGrid=d,this.pitchfactor=Math.cos(r._pitch)*r.cameraToCenterDistance,this.screenRightBoundary=r.width+Hr,this.screenBottomBoundary=r.height+Hr,this.gridRightBoundary=r.width+200,this.gridBottomBoundary=r.height+200,this.fogState=o}placeCollisionBox(r,o,u,d,p,g,x,b){let T=u.projectedAnchorX,M=u.projectedAnchorY,S=u.projectedAnchorZ;const C=u.elevation,P=u.tileID,k=r.getProjection();if(C&&P){const[B,$,Y]=k.upVector(P.canonical,u.tileAnchorX,u.tileAnchorY),K=k.upVectorScale(P.canonical,this.transform.center.lat,this.transform.worldSize).metersToTile;T+=B*C*K,M+=$*C*K,S+=Y*C*K}const R=this.projectAndGetPerspectiveRatio(x,T,M,S,u.tileID,k.name==="globe"||!!C||this.transform.pitch>0,k),O=g*R.perspectiveRatio,D=(u.x1*o+d.x-u.padding)*O+R.point.x,F=(u.y1*o+d.y-u.padding)*O+R.point.y,Z=(u.x2*o+d.x+u.padding)*O+R.point.x,V=(u.y2*o+d.y+u.padding)*O+R.point.y,q=R.perspectiveRatio<=.55||R.occluded;return!this.isInsideGrid(D,F,Z,V)||!p&&this.grid.hitTest(D,F,Z,V,b)||q?{box:[],offscreen:!1,occluded:R.occluded}:{box:[D,F,Z,V],offscreen:this.isOffscreen(D,F,Z,V),occluded:!1}}placeCollisionCircles(r,o,u,d,p,g,x,b,T,M,S,C,P,k,R){const O=[],D=this.transform.elevation,F=r.getProjection(),Z=D?D.getAtTileOffsetFunc(R,this.transform.center.lat,this.transform.worldSize,F):null,V=new a.P(u.tileAnchorX,u.tileAnchorY);let{x:q,y:B,z:$}=F.projectTilePoint(V.x,V.y,R.canonical);if(Z){const[he,Q,ae]=Z(V);q+=he,B+=Q,$+=ae}const Y=F.name==="globe",K=this.projectAndGetPerspectiveRatio(x,q,B,$,R,Y||!!D||this.transform.pitch>0,F),{perspectiveRatio:ee}=K,ce=(S?g/ee:g*ee)/a.bc,re=Wr(q,B,$,b),me=K.signedDistanceFromCamera>0?cc(ce,p,u.lineOffsetX*ce,u.lineOffsetY*ce,!1,re,V,u,d,b,{},D&&!S?Z:null,S&&!!D,F,R,S):null;let fe=!1,Ae=!1,ne=!0;if(me&&!K.occluded){const he=.5*P*ee+k,Q=new a.P(-100,-100),ae=new a.P(this.screenRightBoundary,this.screenBottomBoundary),Ie=new us,{first:Re,last:Le}=me,je=Re.path.length;let et=[];for(let at=je-1;at>=1;at--)et.push(Re.path[at]);for(let at=1;at<Le.path.length;at++)et.push(Le.path[at]);const ct=2.5*he;T&&(et=et.map(([at,Et,gt],bt)=>(Z&&!Y&&(gt=Z(bt<je-1?Re.tilePath[je-1-bt]:Le.tilePath[bt-je+2])[2]),Wr(at,Et,gt,T))),et.some(at=>at[3]<=0)&&(et=[]));let nt=[];if(et.length>0){let at=1/0,Et=-1/0,gt=1/0,bt=-1/0;for(const vt of et)at=Math.min(at,vt[0]),gt=Math.min(gt,vt[1]),Et=Math.max(Et,vt[0]),bt=Math.max(bt,vt[1]);Et>=Q.x&&at<=ae.x&&bt>=Q.y&><=ae.y&&(nt=[et.map(vt=>new a.P(vt[0],vt[1]))],(at<Q.x||Et>ae.x||gt<Q.y||bt>ae.y)&&(nt=a.ba(nt,Q.x,Q.y,ae.x,ae.y)))}for(const at of nt){Ie.reset(at,.25*he);let Et=0;Et=Ie.length<=.5*he?1:Math.ceil(Ie.paddedLength/ct)+1;for(let gt=0;gt<Et;gt++){const bt=gt/Math.max(Et-1,1),vt=Ie.lerp(bt),Zt=vt.x+Hr,_i=vt.y+Hr;O.push(Zt,_i,he,0);const Ot=Zt-he,Pi=_i-he,Bt=Zt+he,Kt=_i+he;if(ne=ne&&this.isOffscreen(Ot,Pi,Bt,Kt),Ae=Ae||this.isInsideGrid(Ot,Pi,Bt,Kt),!o&&this.grid.hitTestCircle(Zt,_i,he,C)&&(fe=!0,!M))return{circles:[],offscreen:!1,collisionDetected:fe,occluded:!1}}}}return{circles:!M&&fe||!Ae?[]:O,offscreen:ne,collisionDetected:fe,occluded:K.occluded}}queryRenderedSymbols(r){if(r.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const o=[];let u=1/0,d=1/0,p=-1/0,g=-1/0;for(const M of r){const S=new a.P(M.x+Hr,M.y+Hr);u=Math.min(u,S.x),d=Math.min(d,S.y),p=Math.max(p,S.x),g=Math.max(g,S.y),o.push(S)}const x=this.grid.query(u,d,p,g).concat(this.ignoredGrid.query(u,d,p,g)),b={},T={};for(const M of x){const S=M.key;if(b[S.bucketInstanceId]===void 0&&(b[S.bucketInstanceId]={}),b[S.bucketInstanceId][S.featureIndex])continue;const C=[new a.P(M.x1,M.y1),new a.P(M.x2,M.y1),new a.P(M.x2,M.y2),new a.P(M.x1,M.y2)];a.bb(o,C)&&(b[S.bucketInstanceId][S.featureIndex]=!0,T[S.bucketInstanceId]===void 0&&(T[S.bucketInstanceId]=[]),T[S.bucketInstanceId].push(S.featureIndex))}return T}insertCollisionBox(r,o,u,d,p){(o?this.ignoredGrid:this.grid).insert({bucketInstanceId:u,featureIndex:d,collisionGroupID:p},r[0],r[1],r[2],r[3])}insertCollisionCircles(r,o,u,d,p){const g=o?this.ignoredGrid:this.grid,x={bucketInstanceId:u,featureIndex:d,collisionGroupID:p};for(let b=0;b<r.length;
14b+=4)g.insertCircle(x,r[b],r[b+1],r[b+2])}projectAndGetPerspectiveRatio(r,o,u,d,p,g,x){const b=[o,u,d,1];let T=!1;d||this.transform.pitch>0?(a.a7.transformMat4(b,b,r),this.fogState&&p&&x.name!=="globe"&&(T=function(C,P,k,R,O,D){const F=D.calculateFogTileMatrix(O),Z=[P,k,R];return a.N.transformMat4(Z,Z,F),ri(C,a.N.length(Z),D.pitch,D._fov)}(this.fogState,o,u,d,p.toUnwrapped(),this.transform)>.9)):dc(b,b,r);const M=b[3];return{point:new a.P((b[0]/M+1)/2*this.transform.width+Hr,(-b[1]/M+1)/2*this.transform.height+Hr),perspectiveRatio:Math.min(.5+this.transform.getCameraToCenterDistance(x)/M*.5,1.5),signedDistanceFromCamera:M,occluded:g&&b[2]>M||T}}isOffscreen(r,o,u,d){return u<Hr||r>=this.screenRightBoundary||d<Hr||o>this.screenBottomBoundary}isInsideGrid(r,o,u,d){return u>=0&&r<this.gridRightBoundary&&d>=0&&o<this.gridBottomBoundary}getViewportMatrix(){const r=a.a6.identity([]);return a.a6.translate(r,r,[-100,-100,0]),r}}function Ka(c,r,o){const u=r.createTileMatrix(c,c.worldSize,o.toUnwrapped());return a.a6.multiply(new Float32Array(16),c.projMatrix,u)}function fc(c,r,o){if(r.projection.name===o.projection.name)return c.projMatrix;const u=o.clone();return u.setProjection(r.projection),Ka(u,r.getProjection(),c)}function Ks(c,r,o){return r.name===o.projection.name?c.projMatrix:Ka(o,r,c)}class pc{constructor(r,o,u,d){this.opacity=r?Math.max(0,Math.min(1,r.opacity+(r.placed?o:-o))):d&&u?1:0,this.placed=u}isHidden(){return this.opacity===0&&!this.placed}}class ro{constructor(r,o,u,d,p,g=!1){this.text=new pc(r?r.text:null,o,u,p),this.icon=new pc(r?r.icon:null,o,d,p),this.clipped=g}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class on{constructor(r,o,u,d=!1){this.text=r,this.icon=o,this.skipFade=u,this.clipped=d}}class mc{constructor(){this.invProjMatrix=a.a6.create(),this.viewportMatrix=a.a6.create(),this.circles=[]}}class Lo{constructor(r,o,u,d,p){this.bucketInstanceId=r,this.featureIndex=o,this.sourceLayerIndex=u,this.bucketIndex=d,this.tileID=p}}class Ja{constructor(r){this.crossSourceCollisions=r,this.maxGroupID=0,this.collisionGroups={}}get(r){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[r]){const o=++this.maxGroupID;this.collisionGroups[r]={ID:o,predicate:u=>u.collisionGroupID===o}}return this.collisionGroups[r]}}function Ro(c,r,o,u,d){const{horizontalAlign:p,verticalAlign:g}=a.bf(c),x=-(p-.5)*r,b=-(g-.5)*o,T=a.bd(c,u);return new a.P(x+T[0]*d,b+T[1]*d)}function _c(c,r,o,u,d){const p=new a.P(c,r);return o&&p._rotate(u?d:-d),p}class Xd{constructor(r,o,u,d,p,g){this.transform=r.clone(),this.projection=r.projection.name,this.collisionIndex=new qe(this.transform,p),this.buildingIndex=g,this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=o,this.retainedQueryData={},this.collisionGroups=new Ja(u),this.collisionCircleArrays={},this.prevPlacement=d,d&&(d.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(r,o,u,d){const p=u.getBucket(o),g=u.latestFeatureIndex;if(!p||!g||o.fqid!==p.layerIds[0])return;const x=p.layers[0].layout,b=u.collisionBoxArray,T=Math.pow(2,this.transform.zoom-u.tileID.overscaledZ),M=u.tileSize/a.V,S=u.tileID.toUnwrapped();this.transform.setProjection(p.projection);const C=(P=u.tileID,k=p.getProjection(),R=this.transform,k.name===this.projection?R.calculateProjMatrix(P.toUnwrapped()):Ka(R,k,P));var P,k,R;const O=x.get("text-pitch-alignment")==="map",D=x.get("text-rotation-alignment")==="map";o.compileFilter();const F=o.dynamicFilter(),Z=o.dynamicFilterNeedsFeature(),V=this.transform.calculatePixelsToTileUnitsMatrix(u),q=oc(C,u.tileID.canonical,O,D,this.transform,p.getProjection(),V);let B=null;if(O){const K=sc(C,u.tileID.canonical,O,D,this.transform,p.getProjection(),V);B=a.a6.multiply([],this.transform.labelPlaneMatrix,K)}let $=null;F&&u.latestFeatureIndex&&($={unwrappedTileID:S,dynamicFilter:F,dynamicFilterNeedsFeature:Z,featureIndex:u.latestFeatureIndex}),this.retainedQueryData[p.bucketInstanceId]=new Lo(p.bucketInstanceId,g,p.sourceLayerIndex,p.index,u.tileID);
vendor: 22,442 bytes, line 14
14const Y={bucket:p,layout:x,posMatrix:C,textLabelPlaneMatrix:q,labelToScreenMatrix:B,clippingData:$,scale:T,textPixelRatio:M,holdingForFade:u.holdingForFade(),collisionBoxArray:b,partiallyEvaluatedTextSize:a.b5(p.textSizeData,this.transform.zoom),partiallyEvaluatedIconSize:a.b5(p.iconSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(p.sourceID)};if(d)for(const K of p.sortKeyRanges){const{sortKey:ee,symbolInstanceStart:ce,symbolInstanceEnd:re}=K;r.push({sortKey:ee,symbolInstanceStart:ce,symbolInstanceEnd:re,parameters:Y})}else r.push({symbolInstanceStart:0,symbolInstanceEnd:p.symbolInstances.length,parameters:Y})}attemptAnchorPlacement(r,o,u,d,p,g,x,b,T,M,S,C,P,k,R,O,D,F){const{textOffset0:Z,textOffset1:V,crossTileID:q}=C,B=[Z,V],$=Ro(r,u,d,B,p),Y=this.collisionIndex.placeCollisionBox(k,p,o,_c($.x,$.y,g,x,this.transform.angle),S,b,T,M.predicate);if(O){const K=k.getSymbolInstanceIconSize(F,this.transform.zoom,C.placedIconSymbolIndex);if(this.collisionIndex.placeCollisionBox(k,K,O,_c($.x,$.y,g,x,this.transform.angle),S,b,T,M.predicate).box.length===0)return}if(Y.box.length>0){let K;return this.prevPlacement&&this.prevPlacement.variableOffsets[q]&&this.prevPlacement.placements[q]&&this.prevPlacement.placements[q].text&&(K=this.prevPlacement.variableOffsets[q].anchor),this.variableOffsets[q]={textOffset:B,width:u,height:d,anchor:r,textScale:p,prevAnchor:K},this.markUsedJustification(k,r,C,R),k.allowVerticalPlacement&&(this.markUsedOrientation(k,R,C),this.placedOrientations[q]=R),{shift:$,placedGlyphBoxes:Y}}}placeLayerBucketPart(r,o,u,d){const{bucket:p,layout:g,posMatrix:x,textLabelPlaneMatrix:b,labelToScreenMatrix:T,clippingData:M,textPixelRatio:S,holdingForFade:C,collisionBoxArray:P,partiallyEvaluatedTextSize:k,partiallyEvaluatedIconSize:R,collisionGroup:O}=r.parameters,D=g.get("text-optional"),F=g.get("icon-optional"),Z=g.get("text-allow-overlap"),V=g.get("icon-allow-overlap"),q=g.get("text-rotation-alignment")==="map",B=g.get("text-pitch-alignment")==="map",$=g.get("symbol-z-order")==="viewport-y",Y=g.get("symbol-z-elevate");this.transform.setProjection(p.projection);let K=Z&&(V||!p.hasIconData()||F),ee=V&&(Z||!p.hasTextData()||D);!p.collisionArrays&&P&&p.deserializeCollisionBoxes(P),u&&d&&p.updateCollisionDebugBuffers(this.transform.zoom,P);const ce=(re,me,fe)=>{const{crossTileID:Ae,numVerticalGlyphVertices:ne}=re;if(M){const Bt={zoom:this.transform.zoom,pitch:this.transform.pitch};let Kt=null;if(M.dynamicFilterNeedsFeature){const Ft=this.retainedQueryData[p.bucketInstanceId];Kt=M.featureIndex.loadFeature({featureIndex:re.featureIndex,bucketIndex:Ft.bucketIndex,sourceLayerIndex:Ft.sourceLayerIndex,layoutVertexArrayOffset:0})}if(!(0,M.dynamicFilter)(Bt,Kt,this.retainedQueryData[p.bucketInstanceId].tileID.canonical,new a.P(re.tileAnchorX,re.tileAnchorY),this.transform.calculateDistanceTileData(M.unwrappedTileID)))return this.placements[Ae]=new on(!1,!1,!1,!0),void o.add(Ae)}if(o.has(Ae))return;if(C)return void(this.placements[Ae]=new on(!1,!1,!1));let he=!1,Q=!1,ae=!0,Ie=!1,Re=!1,Le=null,je={box:null,offscreen:null,occluded:null},et={box:null,offscreen:null,occluded:null},ct=null,nt=null,at=null,Et=0,gt=0,bt=0;fe.textFeatureIndex?Et=fe.textFeatureIndex:re.useRuntimeCollisionCircles&&(Et=re.featureIndex),fe.verticalTextFeatureIndex&&(gt=fe.verticalTextFeatureIndex);const vt=Bt=>{Bt.tileID=this.retainedQueryData[p.bucketInstanceId].tileID;const Kt=this.transform.elevation;Bt.elevation=re.zOffset+(Kt?Kt.getAtTileOffset(Bt.tileID,Bt.tileAnchorX,Bt.tileAnchorY):0)},Zt=fe.textBox;if(Zt){vt(Zt);const Bt=Ft=>{let Yt=a.b6.horizontal;if(p.allowVerticalPlacement&&!Ft&&this.prevPlacement){const xi=this.prevPlacement.placedOrientations[Ae];xi&&(this.placedOrientations[Ae]=xi,Yt=xi,this.markUsedOrientation(p,Yt,re))}return Yt},Kt=(Ft,Yt)=>{if(p.allowVerticalPlacement&&ne>0&&fe.verticalTextBox){for(const xi of p.writingModes)if(xi===a.b6.vertical?(je=Yt(),et=je):je=Ft(),je&&je.box&&je.box.length)break}else je=Ft()};if(g.get("text-variable-anchor")){let Ft=g.get("text-variable-anchor");if(this.prevPlacement&&this.prevPlacement.variableOffsets[Ae]){const ii=this.prevPlacement.variableOffsets[Ae];Ft.indexOf(ii.anchor)>0&&(Ft=Ft.filter(Qi=>Qi!==ii.anchor),Ft.unshift(ii.anchor))}const Yt=(ii,Qi,ur)=>{const Pr=p.getSymbolInstanceTextSize(k,re,this.transform.zoom,me),bn=(ii.x2-ii.x1)*Pr+2*ii.padding,zr=(ii.y2-ii.y1)*Pr+2*ii.padding,er=re.hasIconTextFit&&!V?Qi:null;er&&vt(er);let Hi={box:[],offscreen:!1,occluded:!1};const yr=Z?2*Ft.length:Ft.length;for(let Tr=0;Tr<yr;++Tr){const Dr=this.attemptAnchorPlacement(Ft[Tr%Ft.length],ii,bn,zr,Pr,q,B,S,x,O,Tr>=Ft.length,re,me,p,ur,er,k,R);if(Dr&&(Hi=Dr.placedGlyphBoxes,Hi&&Hi.box&&Hi.box.length)){he=!0,Le=Dr.shift;break}}return Hi};Kt(()=>Yt(Zt,fe.iconBox,a.b6.horizontal),()=>{const ii=fe.verticalTextBox;return ii&&vt(ii),p.allowVerticalPlacement&&!(je&&je.box&&je.box.length)&&ne>0&&ii?Yt(ii,fe.verticalIconBox,a.b6.vertical):{box:null,offscreen:null,occluded:null}}),je&&(he=je.box,ae=je.offscreen,Ie=je.occluded);const xi=Bt(!(!je||!je.box));if(!he&&this.prevPlacement){const ii=this.prevPlacement.variableOffsets[Ae];ii&&(this.variableOffsets[Ae]=ii,this.markUsedJustification(p,ii.anchor,re,xi))}}else{const Ft=(Yt,xi)=>{const ii=p.getSymbolInstanceTextSize(k,re,this.transform.zoom,me),Qi=this.collisionIndex.placeCollisionBox(p,ii,Yt,new a.P(0,0),Z,S,x,O.predicate);return Qi&&Qi.box&&Qi.box.length&&(this.markUsedOrientation(p,xi,re),this.placedOrientations[Ae]=xi),Qi};Kt(()=>Ft(Zt,a.b6.horizontal),()=>{const Yt=fe.verticalTextBox;return p.allowVerticalPlacement&&ne>0&&Yt?(vt(Yt),Ft(Yt,a.b6.vertical)):{box:null,offscreen:null,occluded:null}}),Bt(!!(je&&je.box&&je.box.length))}}if(ct=je,he=ct&&ct.box&&ct.box.length>0,ae=ct&&ct.offscreen,Ie=ct&&ct.occluded,re.useRuntimeCollisionCircles){const Bt=p.text.placedSymbolArray.get(re.centerJustifiedTextSymbolIndex>=0?re.centerJustifiedTextSymbolIndex:re.verticalPlacedTextSymbolIndex),Kt=a.b7(p.textSizeData,k,Bt),Ft=g.get("text-padding");nt=this.collisionIndex.placeCollisionCircles(p,Z,Bt,p.lineVertexArray,p.glyphOffsetArray,Kt,x,b,T,u,B,O.predicate,re.collisionCircleDiameter*Kt/a.bc,Ft,this.retainedQueryData[p.bucketInstanceId].tileID),he=Z||nt.circles.length>0&&!nt.collisionDetected,ae=ae&&nt.offscreen,Ie=nt.occluded}if(fe.iconFeatureIndex&&(bt=fe.iconFeatureIndex),fe.iconBox){const Bt=Kt=>{vt(Kt);const Ft=re.hasIconTextFit&&Le?_c(Le.x,Le.y,q,B,this.transform.angle):new a.P(0,0),Yt=p.getSymbolInstanceIconSize(R,this.transform.zoom,re.placedIconSymbolIndex);return this.collisionIndex.placeCollisionBox(p,Yt,Kt,Ft,V,S,x,O.predicate)};et&&et.box&&et.box.length&&fe.verticalIconBox?(at=Bt(fe.verticalIconBox),Q=at.box.length>0):(at=Bt(fe.iconBox),Q=at.box.length>0),ae=ae&&at.offscreen,Re=at.occluded}const _i=D||re.numHorizontalGlyphVertices===0&&ne===0,Ot=F||re.numIconVertices===0;if(_i||Ot?Ot?_i||(Q=Q&&he):he=Q&&he:Q=he=Q&&he,he&&ct&&ct.box&&this.collisionIndex.insertCollisionBox(ct.box,g.get("text-ignore-placement"),p.bucketInstanceId,et&&et.box&>?gt:Et,O.ID),Q&&at&&this.collisionIndex.insertCollisionBox(at.box,g.get("icon-ignore-placement"),p.bucketInstanceId,bt,O.ID),nt&&(he&&this.collisionIndex.insertCollisionCircles(nt.circles,g.get("text-ignore-placement"),p.bucketInstanceId,Et,O.ID),u)){const Bt=p.bucketInstanceId;let Kt=this.collisionCircleArrays[Bt];Kt===void 0&&(Kt=this.collisionCircleArrays[Bt]=new mc);for(let Ft=0;Ft<nt.circles.length;Ft+=4)Kt.circles.push(nt.circles[Ft+0]),Kt.circles.push(nt.circles[Ft+1]),Kt.circles.push(nt.circles[Ft+2]),Kt.circles.push(nt.collisionDetected?1:0)}const Pi=p.projection.name!=="globe";K=K&&(Pi||!Ie),ee=ee&&(Pi||!Re),this.placements[Ae]=new on(he||K,Q||ee,ae||p.justReloaded),o.add(Ae)};if(Y&&this.buildingIndex&&(this.buildingIndex.updateZOffset(p,this.retainedQueryData[p.bucketInstanceId].tileID),p.updateZOffset()),$){const re=p.getSortedSymbolIndexes(this.transform.angle);for(let me=re.length-1;me>=0;--me){const fe=re[me];ce(p.symbolInstances.get(fe),fe,p.collisionArrays[fe])}p.hasAnyZOffset&&a.w(`${p.layerIds[0]} layer symbol-z-elevate: symbols are not sorted by elevation if symbol-z-order is evaluated to viewport-y`)}else if(p.hasAnyZOffset){const re=p.getSortedIndexesByZOffset();for(let me=0;me<re.length;++me){const fe=re[me];ce(p.symbolInstances.get(fe),fe,p.collisionArrays[fe])}}else for(let re=r.symbolInstanceStart;re<r.symbolInstanceEnd;re++)ce(p.symbolInstances.get(re),re,p.collisionArrays[re]);if(u&&p.bucketInstanceId in this.collisionCircleArrays){const re=this.collisionCircleArrays[p.bucketInstanceId];a.a6.invert(re.invProjMatrix,x),re.viewportMatrix=this.collisionIndex.getViewportMatrix()}p.justReloaded=!1}markUsedJustification(r,o,u,d){const{leftJustifiedTextSymbolIndex:p,centerJustifiedTextSymbolIndex:g,rightJustifiedTextSymbolIndex:x,verticalPlacedTextSymbolIndex:b,crossTileID:T}=u,M=a.be(o),S=d===a.b6.vertical?b:M==="left"?p:M==="center"?g:M==="right"?x:-1;p>=0&&(r.text.placedSymbolArray.get(p).crossTileID=S>=0&&p!==S?0:T),g>=0&&(r.text.placedSymbolArray.get(g).crossTileID=S>=0&&g!==S?0:T),x>=0&&(r.text.placedSymbolArray.get(x).crossTileID=S>=0&&x!==S?0:T),b>=0&&(r.text.placedSymbolArray.get(b).crossTileID=S>=0&&b!==S?0:T)}markUsedOrientation(r,o,u){const d=o===a.b6.horizontal||o===a.b6.horizontalOnly?o:0,p=o===a.b6.vertical?o:0,{leftJustifiedTextSymbolIndex:g,centerJustifiedTextSymbolIndex:x,rightJustifiedTextSymbolIndex:b,verticalPlacedTextSymbolIndex:T}=u,M=r.text.placedSymbolArray;g>=0&&(M.get(g).placedOrientation=d),x>=0&&(M.get(x).placedOrientation=d),b>=0&&(M.get(b).placedOrientation=d),T>=0&&(M.get(T).placedOrientation=p)}commit(r){this.commitTime=r,this.zoomAtLastRecencyCheck=this.transform.zoom;const o=this.prevPlacement;let u=!1;this.prevZoomAdjustment=o?o.zoomAdjustment(this.transform.zoom):0;const d=o?o.symbolFadeChange(r):1,p=o?o.opacities:{},g=o?o.variableOffsets:{},x=o?o.placedOrientations:{};for(const b in this.placements){const T=this.placements[b],M=p[b];M?(this.opacities[b]=new ro(M,d,T.text,T.icon,null,T.clipped),u=u||T.text!==M.text.placed||T.icon!==M.icon.placed):(this.opacities[b]=new ro(null,d,T.text,T.icon,T.skipFade,T.clipped),u=u||T.text||T.icon)}for(const b in p){const T=p[b];if(!this.opacities[b]){const M=new ro(T,d,!1,!1);M.isHidden()||(this.opacities[b]=M,u=u||T.text.placed||T.icon.placed)}}for(const b in g)this.variableOffsets[b]||!this.opacities[b]||this.opacities[b].isHidden()||(this.variableOffsets[b]=g[b]);for(const b in x)this.placedOrientations[b]||!this.opacities[b]||this.opacities[b].isHidden()||(this.placedOrientations[b]=x[b]);u?this.lastPlacementChangeTime=r:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=o?o.lastPlacementChangeTime:r)}updateLayerOpacities(r,o){const u=new Set;for(const d of o){const p=d.getBucket(r);p&&d.latestFeatureIndex&&r.fqid===p.layerIds[0]&&(this.updateBucketOpacities(p,u,d.collisionBoxArray),p.layers[0].layout.get("symbol-z-elevate")&&this.buildingIndex&&(this.buildingIndex.updateZOffset(p,d.tileID),p.updateZOffset()))}}updateBucketOpacities(r,o,u){r.hasTextData()&&r.text.opacityVertexArray.clear(),r.hasIconData()&&r.icon.opacityVertexArray.clear(),r.hasIconCollisionBoxData()&&r.iconCollisionBox.collisionVertexArray.clear(),r.hasTextCollisionBoxData()&&r.textCollisionBox.collisionVertexArray.clear();const d=r.layers[0].layout,p=!!r.layers[0].dynamicFilter(),g=new ro(null,0,!1,!1,!0),x=d.get("text-allow-overlap"),b=d.get("icon-allow-overlap"),T=d.get("text-variable-anchor"),M=d.get("text-rotation-alignment")==="map",S=d.get("text-pitch-alignment")==="map",C=new ro(null,0,x&&(b||!r.hasIconData()||d.get("icon-optional")),b&&(x||!r.hasTextData()||d.get("text-optional")),!0);!r.collisionArrays&&u&&(r.hasIconCollisionBoxData()||r.hasTextCollisionBoxData())&&r.deserializeCollisionBoxes(u);const P=(R,O,D)=>{for(let F=0;F<O/4;F++)R.opacityVertexArray.emplaceBack(D)};let k=0;for(let R=0;R<r.symbolInstances.length;R++){const O=r.symbolInstances.get(R),{numHorizontalGlyphVertices:D,numVerticalGlyphVertices:F,crossTileID:Z,numIconVertices:V}=O,q=o.has(Z);let B=this.opacities[Z];q?B=g:B||(B=C,this.opacities[Z]=B),o.add(Z);const $=D>0||F>0,Y=V>0,K=this.placedOrientations[Z],ee=K===a.b6.vertical,ce=K===a.b6.horizontal||K===a.b6.horizontalOnly;if(!$&&!Y||B.isHidden()||k++,$){const re=oh(B.text);P(r.text,D,ee?Js:re),P(r.text,F,ce?Js:re);const me=B.text.isHidden(),{leftJustifiedTextSymbolIndex:fe,centerJustifiedTextSymbolIndex:Ae,rightJustifiedTextSymbolIndex:ne,verticalPlacedTextSymbolIndex:he}=O,Q=r.text.placedSymbolArray,ae=me||ee?1:0;fe>=0&&(Q.get(fe).hidden=ae),Ae>=0&&(Q.get(Ae).hidden=ae),ne>=0&&(Q.get(ne).hidden=ae),he>=0&&(Q.get(he).hidden=me||ce?1:0);const Ie=this.variableOffsets[Z];Ie&&this.markUsedJustification(r,Ie.anchor,O,K);const Re=this.placedOrientations[Z];Re&&(this.markUsedJustification(r,"left",O,Re),this.markUsedOrientation(r,Re,O))}if(Y){const re=oh(B.icon),{placedIconSymbolIndex:me,verticalPlacedIconSymbolIndex:fe}=O,Ae=r.icon.placedSymbolArray,ne=B.icon.isHidden()?1:0;me>=0&&(P(r.icon,V,ee?Js:re),Ae.get(me).hidden=ne),fe>=0&&(P(r.icon,O.numVerticalIconVertices,ce?Js:re),Ae.get(fe).hidden=ne)}if(r.hasIconCollisionBoxData()||r.hasTextCollisionBoxData()){const re=r.collisionArrays[R];if(re){let me=new a.P(0,0),fe=!0;if(re.textBox||re.verticalTextBox){if(T){const ne=this.variableOffsets[Z];ne?(me=Ro(ne.anchor,ne.width,ne.height,ne.textOffset,ne.textScale),M&&me._rotate(S?this.transform.angle:-this.transform.angle)):fe=!1}p&&(fe=!B.clipped),re.textBox&&ds(r.textCollisionBox.collisionVertexArray,B.text.placed,!fe||ee,me.x,me.y),re.verticalTextBox&&ds(r.textCollisionBox.collisionVertexArray,B.text.placed,!fe||ce,me.x,me.y)}const Ae=fe&&!!(!ce&&re.verticalIconBox);re.iconBox&&ds(r.iconCollisionBox.collisionVertexArray,B.icon.placed,Ae,O.hasIconTextFit?me.x:0,O.hasIconTextFit?me.y:0),re.verticalIconBox&&ds(r.iconCollisionBox.collisionVertexArray,B.icon.placed,!Ae,O.hasIconTextFit?me.x:0,O.hasIconTextFit?me.y:0)}}}if(r.fullyClipped=k===0,r.sortFeatures(this.transform.angle),this.retainedQueryData[r.bucketInstanceId]&&(this.retainedQueryData[r.bucketInstanceId].featureSortOrder=r.featureSortOrder),r.hasTextData()&&r.text.opacityVertexBuffer&&r.text.opacityVertexBuffer.updateData(r.text.opacityVertexArray),r.hasIconData()&&r.icon.opacityVertexBuffer&&r.icon.opacityVertexBuffer.updateData(r.icon.opacityVertexArray),r.hasIconCollisionBoxData()&&r.iconCollisionBox.collisionVertexBuffer&&r.iconCollisionBox.collisionVertexBuffer.updateData(r.iconCollisionBox.collisionVertexArray),r.hasTextCollisionBoxData()&&r.textCollisionBox.collisionVertexBuffer&&r.textCollisionBox.collisionVertexBuffer.updateData(r.textCollisionBox.collisionVertexArray),r.bucketInstanceId in this.collisionCircleArrays){const R=this.collisionCircleArrays[r.bucketInstanceId];r.placementInvProjMatrix=R.invProjMatrix,r.placementViewportMatrix=R.viewportMatrix,r.collisionCircleArray=R.circles,delete this.collisionCircleArrays[r.bucketInstanceId]}}symbolFadeChange(r){return this.fadeDuration===0?1:(r-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(r){return Math.max(0,(this.transform.zoom-r)/1.5)}hasTransitions(r){return this.stale||r-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(r,o){const u=this.zoomAtLastRecencyCheck===o?1-this.zoomAdjustment(o):1;return this.zoomAtLastRecencyCheck=o,this.commitTime+this.fadeDuration*u>r}setStale(){this.stale=!0}}function ds(c,r,o,u,d){c.emplaceBack(r?1:0,o?1:0,u||0,d||0),c.emplaceBack(r?1:0,o?1:0,u||0,d||0),c.emplaceBack(r?1:0,o?1:0,u||0,d||0),c.emplaceBack(r?1:0,o?1:0,u||0,d||0)}const Yd=Math.pow(2,25),rh=Math.pow(2,24),nh=Math.pow(2,17),gc=Math.pow(2,16),Kd=Math.pow(2,9),Jd=Math.pow(2,8),Qd=Math.pow(2,1);function oh(c){if(c.opacity===0&&!c.placed)return 0;if(c.opacity===1&&c.placed)return 4294967295;const r=c.placed?1:0,o=Math.floor(127*c.opacity);return o*Yd+r*rh+o*nh+r*gc+o*Kd+r*Jd+o*Qd+r}const Js=0;class ef{constructor(r){this._sortAcrossTiles=r.layout.get("symbol-z-order")!=="viewport-y"&&r.layout.get("symbol-sort-key").constantOr(1)!==void 0,this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs=new Set,this._bucketParts=[]}continuePlacement(r,o,u,d,p){const g=this._bucketParts;for(;this._currentTileIndex<r.length;)if(o.getBucketParts(g,d,r[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,p())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,g.sort((x,b)=>x.sortKey-b.sortKey));this._currentPartIndex<g.length;){const x=g[this._currentPartIndex];if(o.placeLayerBucketPart(x,this._seenCrossTileIDs,u,x.symbolInstanceStart===0),this._currentPartIndex++,p())return!0}return!1}}class Qa{constructor(r,o,u,d,p,g,x,b,T){this.placement=new Xd(r,p,g,x,b,T),this._currentPlacementIndex=o.length-1,this._forceFullPlacement=u,this._showCollisionBoxes=d,this._done=!1}isDone(){return this._done}continuePlacement(r,o,u,d){const p=a.f.now(),g=()=>{const x=a.f.now()-p;return!this._forceFullPlacement&&x>2};for(;this._currentPlacementIndex>=0;){const x=o[r[this._currentPlacementIndex]],b=this.placement.collisionIndex.transform.zoom;if(x.type==="symbol"&&(!x.minzoom||x.minzoom<=b)&&(!x.maxzoom||x.maxzoom>b)){const T=x,M=T.layout.get("symbol-z-elevate"),S=this._inProgressLayer=this._inProgressLayer||new ef(T),C=a.ag(x.source,x.scope);if(S.continuePlacement(M?d[C]:u[C],this.placement,this._showCollisionBoxes,x,g))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(r){return this.placement.commit(r),this.placement}}const yc=512/a.V/2;class sh{constructor(r,o,u){this.tileID=r,this.bucketInstanceId=u,this.index=new a.bg(o.length,16,Int32Array),this.keys=[],this.crossTileIDs=[];const d=r.canonical.x*a.V,p=r.canonical.y*a.V;for(let g=0;g<o.length;g++){const{key:x,crossTileID:b,tileAnchorX:T,tileAnchorY:M}=o.get(g),S=Math.floor((d+T)*yc),C=Math.floor((p+M)*yc);this.index.add(S,C),this.keys.push(x),this.crossTileIDs.push(b)}this.index.finish()}findMatches(r,o,u){const d=this.tileID.canonical.z<o.canonical.z?1:Math.pow(2,this.tileID.canonical.z-o.canonical.z),p=yc/Math.pow(2,o.canonical.z-this.tileID.canonical.z),g=o.canonical.x*a.V,x=o.canonical.y*a.V;for(let b=0;b<r.length;b++){const T=r.get(b);if(T.crossTileID)continue;const{key:M,tileAnchorX:S,tileAnchorY:C}=T,P=Math.floor((g+S)*p),k=Math.floor((x+C)*p),R=this.index.range(P-d,k-d,P+d,k+d);for(const O of R){const D=this.crossTileIDs[O];if(this.keys[O]===M&&!u.has(D)){u.add(D),T.crossTileID=D;break}}}}}class xc{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class el{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(r){const o=Math.round((r-this.lng)/360);if(o!==0)for(const u in this.indexes){const d=this.indexes[u],p={};for(const g in d){const x=d[g];x.tileID=x.tileID.unwrapTo(x.tileID.wrap+o),p[x.tileID.key]=x}this.indexes[u]=p}this.lng=r}addBucket(r,o,u){if(this.indexes[r.overscaledZ]&&this.indexes[r.overscaledZ][r.key]){if(this.indexes[r.overscaledZ][r.key].bucketInstanceId===o.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(r.overscaledZ,this.indexes[r.overscaledZ][r.key])}for(let p=0;p<o.symbolInstances.length;p++)o.symbolInstances.get(p).crossTileID=0;this.usedCrossTileIDs[r.overscaledZ]||(this.usedCrossTileIDs[r.overscaledZ]=new Set);const d=this.usedCrossTileIDs[r.overscaledZ];for(const p in this.indexes){const g=this.indexes[p];if(Number(p)>r.overscaledZ)for(const x in g){const b=g[x];b.tileID.isChildOf(r)&&b.findMatches(o.symbolInstances,r,d)}else{const x=g[r.scaledTo(Number(p)).key];x&&x.findMatches(o.symbolInstances,r,d)}}for(let p=0;p<o.symbolInstances.length;p++){const g=o.symbolInstances.get(p);g.crossTileID||(g.crossTileID=u.generate(),d.add(g.crossTileID))}return this.indexes[r.overscaledZ]===void 0&&(this.indexes[r.overscaledZ]={}),this.indexes[r.overscaledZ][r.key]=new sh(r,o.symbolInstances,o.bucketInstanceId),!0}removeBucketCrossTileIDs(r,o){for(const u of o.crossTileIDs)this.usedCrossTileIDs[r].delete(u)}removeStaleBuckets(r){let o=!1;for(const u in this.indexes){const d=this.indexes[u];for(const p in d)r[d[p].bucketInstanceId]||(this.removeBucketCrossTileIDs(u,d[p]),delete d[p],o=!0)}return o}}class vc{constructor(){this.layerIndexes={},this.crossTileIDs=new xc,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(r,o,u,d){let p=this.layerIndexes[r.fqid];p===void 0&&(p=this.layerIndexes[r.fqid]=new el);let g=!1;const x={};d.name!=="globe"&&p.handleWrapJump(u);for(const b of o){const T=b.getBucket(r);T&&r.fqid===T.layerIds[0]&&(T.bucketInstanceId||(T.bucketInstanceId=++this.maxBucketInstanceId),p.addBucket(b.tileID,T,this.crossTileIDs)&&(g=!0),x[T.bucketInstanceId]=!0)}return p.removeStaleBuckets(x)&&(g=!0),g}pruneUnusedLayers(r){const o={};r.forEach(u=>{o[u]=!0});for(const u in this.layerIndexes)o[u]||delete this.layerIndexes[u]}}class ko{constructor(r=0,o=0,u=0,d=0){if(isNaN(r)||r<0||isNaN(o)||o<0||isNaN(u)||u<0||isNaN(d)||d<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=r,this.bottom=o,this.left=u,this.right=d}interpolate(r,o,u){return o.top!=null&&r.top!=null&&(this.top=a.U(r.top,o.top,u)),o.bottom!=null&&r.bottom!=null&&(this.bottom=a.U(r.bottom,o.bottom,u)),o.left!=null&&r.left!=null&&(this.left=a.U(r.left,o.left,u)),o.right!=null&&r.right!=null&&(this.right=a.U(r.right,o.right,u)),this}getCenter(r,o){const u=a.aa((this.left+r-this.right)/2,0,r),d=a.aa((this.top+o-this.bottom)/2,0,o);return new a.P(u,d)}equals(r){return this.top===r.top&&this.bottom===r.bottom&&this.left===r.left&&this.right===r.right}clone(){return new ko(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}function tl(c,r){const o=a.bk(c,3);a.a6.fromQuat(c,r),a.bm(c,3,o)}function Qs(c,r){const o=a.bi.identity([]);return a.bi.rotateZ(o,o,-r),a.bi.rotateX(o,o,-c),o}function bc(c,r){const o=[c[0],c[1],0],u=[r[0],r[1],0];if(a.N.length(o)>=1e-15){const g=a.N.normalize([],o);a.N.scale(u,g,a.N.dot(u,g)),r[0]=u[0],r[1]=u[1]}const d=a.N.cross([],r,c);if(a.N.len(d)<1e-15)return null;const p=Math.atan2(-d[1],d[0]);return Qs(Math.atan2(Math.sqrt(c[0]*c[0]+c[1]*c[1]),-c[2]),p)}class ea{constructor(r,o){this.position=r,this.orientation=o}get position(){return this._position}set position(r){if(r){const o=r instanceof a.L?r:new a.L(r[0],r[1],r[2]);
14this._renderWorldCopies&&(o.x=a.bh(o.x,0,1)),this._position=o}else this._position=null}lookAtPoint(r,o){if(this.orientation=null,!this.position)return;const u=this.position,d=this._elevation?this._elevation.getAtPointOrZero(a.L.fromLngLat(r)):0,p=a.L.fromLngLat(r,d),g=[p.x-u.x,p.y-u.y,p.z-u.z];o||(o=[0,0,1]),o[2]=Math.abs(o[2]),this.orientation=bc(g,o)}setPitchBearing(r,o){this.orientation=Qs(a.bj(r),a.bj(-o))}}class fs{constructor(r,o){this._transform=a.a6.identity([]),this.orientation=o,this.position=r}get mercatorPosition(){const r=this.position;return new a.L(r[0],r[1],r[2])}get position(){const r=a.bk(this._transform,3);return[r[0],r[1],r[2]]}set position(r){var o;r&&a.bm(this._transform,3,[(o=r)[0],o[1],o[2],1])}get orientation(){return this._orientation}set orientation(r){this._orientation=r||a.bi.identity([]),r&&tl(this._transform,this._orientation)}getPitchBearing(){const r=this.forward(),o=this.right();return{bearing:Math.atan2(-o[1],o[0]),pitch:Math.atan2(Math.sqrt(r[0]*r[0]+r[1]*r[1]),-r[2])}}setPitchBearing(r,o){this._orientation=Qs(r,o),tl(this._transform,this._orientation)}forward(){const r=a.bk(this._transform,2);return[-r[0],-r[1],-r[2]]}up(){const r=a.bk(this._transform,1);return[-r[0],-r[1],-r[2]]}right(){const r=a.bk(this._transform,0);return[r[0],r[1],r[2]]}getCameraToWorld(r,o){const u=new Float64Array(16);return a.a6.invert(u,this.getWorldToCamera(r,o)),u}getCameraToWorldMercator(){return this._transform}getWorldToCameraPosition(r,o,u){const d=this.position;a.N.scale(d,d,-r);const p=new Float64Array(16);return a.a6.fromScaling(p,[u,u,u]),a.a6.translate(p,p,d),p[10]*=o,p}getWorldToCamera(r,o){const u=new Float64Array(16),d=new Float64Array(4),p=this.position;return a.bi.conjugate(d,this._orientation),a.N.scale(p,p,-r),a.a6.fromQuat(u,d),a.a6.translate(u,u,p),u[1]*=-1,u[5]*=-1,u[9]*=-1,u[13]*=-1,u[8]*=o,u[9]*=o,u[10]*=o,u[11]*=o,u}getCameraToClipPerspective(r,o,u,d){const p=new Float64Array(16);return a.a6.perspective(p,r,o,u,d),p}getCameraToClipOrthographic(r,o,u,d,p,g){const x=new Float64Array(16);return a.a6.ortho(x,r,o,u,d,p,g),x}getDistanceToElevation(r,o=!1){const u=r===0?0:a.bl(r,o?a.au(this.position[1]):this.position[1]),d=this.forward();return(u-this.position[2])/d[2]}clone(){return new fs([...this.position],[...this.orientation])}}const ps=(c,r,o)=>(1-o)*c+o*r,ta=c=>c*c*c*c*c;class ia{constructor(r,o,u,d,p,g,x){this.tileSize=512,this._renderWorldCopies=p===void 0||p,this._minZoom=r||0,this._maxZoom=o||22,this._minPitch=u??0,this._maxPitch=d??60,this.setProjection(g),this.setMaxBounds(x),this.width=0,this.height=0,this._center=new a.bn(0,0),this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._nearZ=0,this._farZ=0,this._unmodified=!0,this._edgeInsets=new ko,this._projMatrixCache={},this._alignedProjMatrixCache={},this._fogTileMatrixCache={},this._expandedProjMatrixCache={},this._distanceTileDataCache={},this._camera=new fs,this._centerAltitude=0,this._averageElevation=0,this.cameraElevationReference="ground",this._pixelsPerMercatorPixel=1,this.globeRadius=0,this.globeCenterInViewSpace=[0,0,0],this._tileCoverLift=0,this._horizonShift=.1,this._orthographicProjectionAtLowPitch=!1}clone(){const r=new ia(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies,this.getProjection());return r._elevation=this._elevation,r._centerAltitude=this._centerAltitude,r._centerAltitudeValidForE
14xaggeration=this._centerAltitudeValidForExaggeration,r.tileSize=this.tileSize,r.mercatorFromTransition=this.mercatorFromTransition,r.width=this.width,r.height=this.height,r.cameraElevationReference=this.cameraElevationReference,r._center=this._center,r._setZoom(this.zoom),r._seaLevelZoom=this._seaLevelZoom,r.angle=this.angle,r._fov=this._fov,r._pitch=this._pitch,r._nearZ=this._nearZ,r._farZ=this._farZ,r._averageElevation=this._averageElevation,r._orthographicProjectionAtLowPitch=this._orthographicProjectionAtLowPitch,r._unmodified=this._unmodified,r._edgeInsets=this._edgeInsets.clone(),r._camera=this._camera.clone(),r._calcMatrices(),r.freezeTileCoverage=this.freezeTileCoverage,r.frustumCorners=this.frustumCorners,r}get isOrthographic(){return this.projection.name!=="globe"&&this._orthographicProjectionAtLowPitch&&this.pitch<15}get elevation(){return this._elevation}set elevation(r){this._elevation!==r&&(this._elevation=r,this._updateCameraOnTerrain(),this._calcMatrices())}get depthOcclusionForSymbolsAndCircles(){return this.projection.name!=="globe"&&!this.isOrthographic}updateElevation(r,o=!1){const u=this._elevation&&this._elevation.exaggeration()!==this._centerAltitudeValidForE
vendor: 3,939 bytes, line 14
14xaggeration;(this._seaLevelZoom==null||u)&&this._updateCameraOnTerrain(),(r||u)&&this._constrainCamera(o),this._calcMatrices()}getProjection(){return a.ac(this.projection,["name","center","parallels"])}setProjection(r){this.projectionOptions=r||{name:"mercator"};const o=this.projection?this.getProjection():void 0;this.projection=a.bo(this.projectionOptions);const u=!Pt(o,this.getProjection());return u&&this._calcMatrices(),this.mercatorFromTransition=!1,u}setOrthographicProjectionAtLowPitch(r){return this._orthographicProjectionAtLowPitch!==r&&(this._orthographicProjectionAtLowPitch=r,this._calcMatrices(),!0)}setMercatorFromTransition(){const r=this.projection.name;this.mercatorFromTransition=!0,this.projectionOptions={name:"mercator"},this.projection=a.bo({name:"mercator"});const o=r!==this.projection.name;return o&&this._calcMatrices(),o}get minZoom(){return this._minZoom}set minZoom(r){this._minZoom!==r&&(this._minZoom=r,this.zoom=Math.max(this.zoom,r))}get maxZoom(){return this._maxZoom}set maxZoom(r){this._maxZoom!==r&&(this._maxZoom=r,this.zoom=Math.min(this.zoom,r))}get minPitch(){return this._minPitch}set minPitch(r){this._minPitch!==r&&(this._minPitch=r,this.pitch=Math.max(this.pitch,r))}get maxPitch(){return this._maxPitch}set maxPitch(r){this._maxPitch!==r&&(this._maxPitch=r,this.pitch=Math.min(this.pitch,r))}get renderWorldCopies(){return this._renderWorldCopies&&this.projection.supportsWorldCopies===!0}set renderWorldCopies(r){r===void 0?r=!0:r===null&&(r=!1),this._renderWorldCopies=r}get worldSize(){return this.tileSize*this.scale}get cameraWorldSizeForFog(){const r=Math.max(this._camera.getDistanceToElevation(this._averageElevation),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(r))}get cameraWorldSize(){const r=Math.max(this._camera.getDistanceToElevation(this._averageElevation,!0),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(r))}get pixelsPerMeter(){return this.projection.pixelsPerMeter(this.center.lat,this.worldSize)}get cameraPixelsPerMeter(){return a.bl(1,this.center.lat)*this.cameraWorldSizeForFog}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new a.P(this.width,this.height)}get bearing(){return a.bh(this.rotation,-180,180)}set bearing(r){this.rotation=r}get rotation(){return-this.angle/Math.PI*180}set rotation(r){const o=-r*Math.PI/180;this.angle!==o&&(this._unmodified=!1,this.angle=o,this._calcMatrices(),this.rotationMatrix=a.b4.create(),a.b4.rotate(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(r){const o=a.aa(r,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==o&&(this._unmodified=!1,this._pitch=o,this._calcMatrices())}get aspect(){return this.width/this.height}get fov(){return this._fov/Math.PI*180}get fovX(){return this._fov}get fovY(){const r=1/Math.tan(.5*this.fovX);return 2*Math.atan(1/this.aspect/r)}set fov(r){r=Math.max(.01,Math.min(60,r)),this._fov!==r&&(this._unmodified=!1,this._fov=a.bj(r),this._calcMatrices())}get averageElevation(){return this._averageElevation}set averageElevation(r){this._averageElevation=r,this._calcFogMatrices(),this._distanceTileDataCache={}}get zoom(){return this._zoom}set zoom(r){const o=Math.min(Math.max(r,this.minZoom),this.maxZoom);this._zoom!==o&&(this._unmodified=!1,this._setZoom(o),this._updateSeaLevelZoom(),this._constrain(),this._calcMatrices())}_setZoom(r){this._zoom=r,this.scale=this.zoomScale(r),this.tileZoom=Math.floor(r),this.zoomFraction=r-this.tileZoom}get tileCoverLift(){return this._tileCoverLift}set tileCoverLift(r){this._tileCoverLift!==r&&(this._tileCoverLift=r)}_updateCameraOnTerrain(){const r=this.elevation?this.elevation.getAtPoint(this.locationCoordinate(this.center),Number.NEGATIVE_INFINITY):Number.NEGATIVE_INFINITY,o=this.elevation&&r===Number.NEGATIVE_INFINITY&&this.elevation.visibleDemTiles.length>0&&this.elevation.exaggeration()>
140&&this._centerAltitudeValidForExaggeration;if(!this._elevation||r===Number.NEGATIVE_INFINITY&&(!o||!this._centerAltitude))return this._centerAltitude=0,this._seaLevelZoom=null,void(this._centerAltitudeValidForExaggeration=void 0);const u=this._elevation;o||this._centerAltitude&&this._centerAltitudeValidForExaggeration&&u.exaggeration()&&this._centerAltitudeValidForExaggeration!==u.exaggeration()?(this._centerAltitude=this._centerAltitude/this._centerAltitudeValidForExaggeration*u.exaggeration(),this._centerAltitudeValidForExaggeration=u.exaggeration()):(this._centerAltitude=r||0,this._centerAltitudeValidForExaggeration=u.exaggeration()),this._updateSeaLevelZoom()}_updateSeaLevelZoom(){this._centerAltitudeValidForExaggeration!==void 0&&(this._seaLevelZoom=this._zoomFromMercatorZ((this.pixelsPerMeter*this._centerAltitude+this.cameraToCenterDistance)/this.worldSize))}sampleAverageElevation(){if(!this._elevation)return 0;const r=this._elevation,o=[[.5,.2],[.3,.5],[.5,.5],[.7,.5],[.5,.8]],u=this.horizonLineFromTop();let d=0,p=0;for(let g=0;g<o.length;g++){const x=new a.P(o[g][0]*this.width,u+o[g][1]*(this.height-u)),b=r.pointCoordinate(x);if(!b)continue;const T=1/Math.hypot(b[0]-this._camera.position[0],b[1]-this._camera.position[1]);d+=b[3]*T,p+=T}return p===0?NaN:d/p}get center(){return this._center}set center(r){r.lat===this._center.lat&&r.lng===this._center.lng||(this._unmodified=!1,this._center=r,this._terrainEnabled()&&(this.cameraElevationReference==="ground"?this._updateCameraOnTerrain():this._updateZoomFromElevation()),this._constrain(),this._calcMatrices())}_updateZoomFromElevation(){if(this._seaLevelZoom==null||!this._elevation)return;const r=this._seaLevelZoom,o=this._elevation.getAtPointOrZero(this.locationCoordinate(this.center)),u=this.pixelsPerMeter/this.worldSize*o,d=this._mercatorZfromZoom(r),p=this._mercatorZfromZoom(this._maxZoom),g=Math.max(d-u,p);this._setZoom(this._zoomFromMercatorZ(g))}get padding(){return this._edgeInsets.toJSON()}set padding(r){this._edgeInsets.equals(r)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,r,1),this._calcMatrices())}computeZoomRelativeTo(r){const o=this.rayIntersectionCoordinate(this.pointRayIntersection(this.centerPoint,r.toAltitude()));let u;u=r.z<this._camera.position[2]?[o.x,o.y,o.z]:[r.x,r.y,r.z];const d=a.N.length(a.N.sub([],this._camera.position,u));return a.aa(this._zoomFromMercatorZ(d),this._minZoom,this._maxZoom)}setFreeCameraOptions(r){if(!this.height||!r.position&&!r.orientation)return;this._updateCameraState();let o=!1;if(r.orientation&&!a.bi.exactEquals(r.orientation,this._camera.orientation)&&(o=this._setCameraOrientation(r.orientation)),r.position){const u=[r.position.x,r.position.y,r.position.z];a.N.exactEquals(u,this._camera.position)||(this._setCameraPosition(u),o=!0)}o&&(this._updateStateFromCamera(),this.recenterOnTerrain())}getFreeCameraOptions(){this._updateCameraState();const r=this._camera.position,o=new ea;return o.position=new a.L(r[0],r[1],r[2]),o.orientation=this._camera.orientation,o._elevation=this.elevation,o._renderWorldCopies=this.renderWorldCopies,o}_setCameraOrientation(r){if(!a.bi.length(r))return!1;a.bi.normalize(r,r);const o=a.N.transformQuat([],[0,0,-1],r),u=a.N.transformQuat([],[0,-1,0],r);if(u[2]<0)return!1;const d=bc(o,u);return!!d&&(this._camera.orientation=d,!0)}_setCameraPosition(r){const o=this.zoomScale(this.minZoom)*this.tileSize,u=this.zoomScale(this.maxZoom)*this.tileSize,d=this.cameraToCenterDistance;r[2]=a.aa(r[2],d/u,d/o),this._camera.position=r}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}get fovAboveCenter(){return this._fov*(.5+this.centerOffset.y/this.height)}isPaddingEqual(r){return this._edgeInsets.equals(r)}interpolatePadding(r,o,u){this._unmodified=!1,this._edgeInsets.interpolate(r,o,u),this._constrain(),this._calcMatrices()}coveringZoomLevel(r){const o=(r.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/r.tileSize));return Math.max(0,o)}getVisibleUnwrappedCoordinates(r){const o=[new a.bp(0,r)];if(this.renderWorldCopies){const u=this.pointCoordinate(new a.P(0,0)),d=this.pointCoordinate(new a.P(this.width,0)),p=this.pointCoordinate(new a.P(this.width,this.height)),g=this.pointCoordinate(new a.P(0,this.height)),x=Math.floor(Math.min(u.x,d.x,p.x,g.x)),b=Math.floor(Math.max(u.x,d.x,p.x,g.x)),T=1;for(let M=x-T;M<=b+T;M++)M!==0&&o.push(new a.bp(M,r))}return o}isLODDisabled(r){return(!r||this.pitch<=60)&&this._edgeInsets.top<=this._edgeInsets.bottom&&!this._elevation&&!this.projection.isReprojectedInTileSpace}extendTileCoverForShadows(r,o,u){let d=[];
14if(o[0]===0&&o[1]===0)return d;for(const g of r){const x=g.canonical,b=g.overscaledZ,T=g.wrap,M=1<<x.z,S=x.x+1<M,C=x.x>0,P=x.y+1<M,k=x.y>0,R=g.wrap-(C?0:1),O=g.wrap+(S?0:1),D=C?x.x-1:M-1,F=S?x.x+1:0;o[0]<0?(d.push(new a.am(b,O,x.z,F,x.y)),o[1]<0&&P&&(d.push(new a.am(b,T,x.z,x.x,x.y+1)),d.push(new a.am(b,O,x.z,F,x.y+1))),o[1]>0&&k&&(d.push(new a.am(b,T,x.z,x.x,x.y-1)),d.push(new a.am(b,O,x.z,F,x.y-1)))):o[0]>0?(d.push(new a.am(b,R,x.z,D,x.y)),o[1]<0&&P&&(d.push(new a.am(b,T,x.z,x.x,x.y+1)),d.push(new a.am(b,R,x.z,D,x.y+1))),o[1]>0&&k&&(d.push(new a.am(b,T,x.z,x.x,x.y-1)),d.push(new a.am(b,R,x.z,D,x.y-1)))):o[1]<0&&P?d.push(new a.am(b,T,x.z,x.x,x.y+1)):k&&d.push(new a.am(b,T,x.z,x.x,x.y-1))}if(d.length>1){d.sort((b,T)=>b.overscaledZ-T.overscaledZ||b.wrap-T.wrap||b.canonical.z-T.canonical.z||b.canonical.x-T.canonical.x||b.canonical.y-T.canonical.y);let g=0,x=0;for(;x<d.length;)d[x].equals(d[g])?++x:d[++g]=d[x++];d.length=g+1}const p=[];for(const g of d)d.some(x=>g.isChildOf(x))||p.push(g);return d=p.filter(g=>!r.some(x=>!!(g.overscaledZ<u&&x.isChildOf(g))||g.equals(x)||g.isChildOf(x))),d}coveringTiles(r){let o=this.coveringZoomLevel(r);const u=o,d=this.elevation&&this.elevation.exaggeration(),p=d&&!r.isTerrainDEM,g=this.projection.name==="mercator";if(r.minzoom!==void 0&&o<r.minzoom)return[];r.maxzoom!==void 0&&o>r.maxzoom&&(o=r.maxzoom);const x=this.locationCoordinate(this.center),b=this.center.lat,T=1<<o,M=[T*x.x,T*x.y,0],S=this.projection.name==="globe",C=!S,P=a.bq.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,o,C),k=S?this._camera.mercatorPosition:this.pointCoordinate(this.getCameraPoint()),R=T*a.bl(1,this.center.lat),O=this._camera.position[2]/a.bl(1,this.center.lat),D=[T*k.x,T*k.y,O*(C?1:R)],F=S||d,Z=this.cameraToCenterDistance/r.tileSize*(r.roundZoom?1:.502),V=this.isLODDisabled(!0)?o:0;let q;if(this._elevation&&r.isTerrainDEM)q=1e4*this._elevation.exaggeration();else if(this._elevation){const Q=this._elevation.getMinMaxForVisibleTiles();q=Q?Q.max:this._centerAltitude}else q=this._centerAltitude;const B=r.isTerrainDEM?-q:this._elevation?this._elevation.getMinElevationBelowMSL():0,$=this.projection.isReprojectedInTileSpace?a.br(this):1,Y=Q=>{const Ie=new a.L(Q.x+25e-6,Q.y,Q.z),Re=new a.L(Q.x,Q.y+25e-6,Q.z),Le=Q.toLngLat(),je=Ie.toLngLat(),et=Re.toLngLat(),ct=this.locationCoordinate(Le),nt=this.locationCoordinate(je),at=this.locationCoordinate(et),Et=Math.hypot(nt.x-ct.x,nt.y-ct.y),gt=Math.hypot(at.x-ct.x,at.y-ct.y);return Math.sqrt(Et*gt)*$/25e-6},K=Q=>{const ae=q,Ie=B;return{aabb:a.bu(this,T,0,0,0,Q,Ie,ae,this.projection),zoom:0,x:0,y:0,minZ:Ie,maxZ:ae,wrap:Q,fullyVisible:!1}},ee=[];let ce=[];const re=o,me=r.reparseOverscaled?u:o,fe=Q=>Q*Q,Ae=fe((O-this._centerAltitude)*R),ne=Q=>{if(!this._elevation||!Q.tileID||!g)return;const ae=this._elevation.getMinMaxForTile(Q.tileID),Ie=Q.aabb;ae?(Ie.min[2]=ae.min,Ie.max[2]=ae.max,Ie.center[2]=(Ie.min[2]+Ie.max[2])/2):(Q.shouldSplit=he(Q),Q.shouldSplit||(Ie.min[2]=Ie.max[2]=Ie.center[2]=this._centerAltitude))},he=Q=>{if(Q.zoom<V)return!0;if(Q.zoom===re)return!1;if(Q.shouldSplit!=null)return Q.shouldSplit;const ae=Q.aabb.distanceX(D),Ie=Q.aabb.distanceY(D);let Re=Ae,Le=1;if(S){Re=fe(Q.aabb.distanceZ(D));const ct=Math.pow(2,Q.zoom),nt=a.au((Q.y+1)/ct),at=a.au(Q.y/ct),Et=Math.min(Math.max(b,nt),at),gt=a.bJ(Et)/a.bJ(b);if(Le=Et===b?1/Math.max(1,this._mercatorScaleRatio-.3):Math.min(1,gt/this._mercatorScaleRatio),this.zoom<=a.bG&&Q.zoom===re-1&>>=.9)return!0}else if(p&&(Re=fe(Q.aabb.distanceZ(D)*R)),this.projection.isReprojectedInTileSpace&&u<=5){const ct=Math.pow(2,Q.zoom),nt=Y(new a.L((Q.x+.5)/ct,(Q.y+.5)/ct));Le=nt>.85?1:nt}const je=ae*ae+Ie*Ie+Re,et=fe((1<<re-Q.zoom)*Z*Le*((ct,nt)=>{if(nt*fe(.707)<ct)return 1;const at=Math.sqrt(nt/ct);return at/(1.4144271570014144+(Math.pow(1.1,at-1.4144271570014144+1)-1)/(1.1-1)-1)})(Math.max(Re,Ae),je));return je<et};if(this.renderWorldCopies)for(let Q=1;Q<=3;Q++)ee.push(K(-Q)),ee.push(K(Q));for(ee.push(K(0));ee.length>0;){const Q=ee.pop(),ae=Q.x,Ie=Q.y;let Re=Q.fullyVisible;const Le=()=>this.projection.name==="globe"&&(Q.y===0||Q.y===(1<<Q.zoom)-1);if(!Re){let je=F?Q.aabb.intersects(P):Q.aabb.intersectsFlat(P);if(je===0&&Le()){const et=new a.bs(Q.zoom,ae,Ie);je=a.bt(this,T,et,!0).intersects(P)}if(je===0)continue;Re=je===2}if(Q.zoom!==re&&he(Q))for(let je=0;je<4;je++){const et=(ae<<1)+je%2,ct=(Ie<<1)+(je>>1),nt={aabb:g?Q.aabb.quadrant(je):a.bu(this,T,Q.zoom+1,et,ct,Q.wrap,Q.minZ,Q.maxZ,this.projection),zoom:Q.zoom+1,x:et,y:ct,wrap:Q.wrap,fullyVisible:Re,tileID:void 0,shouldSplit:void 0,minZ:Q.minZ,maxZ:Q.maxZ};p&&!S&&(nt.tileID=new a.am(Q.zoom+1===re?me:Q.zoom+1,Q.wrap,Q.zoom+1,et,ct),ne(nt)),ee.push(nt)}else{const je=Q.zoom===re?me:Q.zoom;if(r.minzoom&&r.minzoom>je)continue;if(!Re){let at=F?Q.aabb.intersectsPrecise(P):Q.aabb.intersectsPreciseFlat(P);if(at===0&&Le()){const Et=new a.bs(Q.zoom,ae,Ie);at=a.bt(this,T,Et,!0).intersectsPrecise(P)}if(at===0)continue}const et=M[0]-(.5+ae+(Q.wrap<<Q.zoom))*(1<<o-Q.zoom),ct=M[1]-.5-Ie,nt=Q.tileID?Q.tileID:new a.am(je,Q.wrap,Q.zoom,ae,Ie);ce.push({tileID:nt,distanceSq:et*et+ct*ct})}}if(this.fogCullDistSq){const Q=this.fogCullDistSq,ae=this.horizonLineFromTop();ce=ce.filter(Ie=>
14{const Re=[0,0,0,1],Le=[a.V,a.V,0,1],je=this.calculateFogTileMatrix(Ie.tileID.toUnwrapped());a.a7.transformMat4(Re,Re,je),a.a7.transformMat4(Le,Le,je);const et=a.a7.min([],Re,Le),ct=a.a7.max([],Re,Le),nt=a.bv(et,ct);if(nt===0)return!0;let at=!1;const Et=this._elevation;if(Et&&nt>Q&&ae!==0){const gt=this.calculateProjMatrix(Ie.tileID.toUnwrapped());let bt;r.isTerrainDEM||(bt=Et.getMinMaxForTile(Ie.tileID)),bt||(bt={min:B,max:q});const vt=a.bH(this.rotation),Zt=[vt[0]*a.V,vt[1]*a.V,bt.max];a.N.transformMat4(Zt,Zt,gt),at=(1-Zt[1])*this.height*.5<ae}return nt<Q||at})}return ce.sort((Q,ae)=>Q.distanceSq-ae.distanceSq).map(Q=>Q.tileID)}resize(r,o){this.width=r,this.height=o,this.pixelsToGLUnits=[2/r,-2/o],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(r){return Math.pow(2,r)}scaleZoom(r){return Math.log(r)/Math.LN2}project(r){const o=a.aa(r.lat,-a.bw,a.bw),u=this.projection.project(r.lng,o);return new a.P(u.x*this.worldSize,u.y*this.worldSize)}unproject(r){return this.projection.unproject(r.x/this.worldSize,r.y/this.worldSize)}get point(){return this.project(this.center)}get pointMerc(){return this.point._div(this.worldSize)}get pixelsPerMeterRatio(){return this.pixelsPerMeter/a.bl(1,this.center.lat)/this.worldSize}setLocationAtPoint(r,o){let u,d;const p=this.centerPoint;if(this.projection.name==="globe"){const x=this.worldSize;u=(o.x-p.x)/x,d=(o.y-p.y)/x}else{const x=this.pointCoordinate(o),b=this.pointCoordinate(p);u=x.x-b.x,d=x.y-b.y}const g=this.locationCoordinate(r);this.setLocation(new a.L(g.x-u,g.y-d))}setLocation(r){this.center=this.coordinateLocation(r),this.projection.wrap&&(this.center=this.center.wrap())}locationPoint(r){return this.projection.locationPoint(this,r)}locationPoint3D(r){return this.projection.locationPoint(this,r,!0)}pointLocation(r){return this.coordinateLocation(this.pointCoordinate(r))}pointLocation3D(r){return this.coordinateLocation(this.pointCoordinate3D(r))}locationCoordinate(r,o){const u=o?a.bl(o,r.lat):void 0,d=this.projection.project(r.lng,r.lat);return new a.L(d.x,d.y,u)}coordinateLocation(r){return this.projection.unproject(r.x,r.y)}pointRayIntersection(r,o){const u=o??this._centerAltitude,d=[r.x,r.y,0,1],p=[r.x,r.y,1,1];a.a7.transformMat4(d,d,this.pixelMatrixInverse),a.a7.transformMat4(p,p,this.pixelMatrixInverse);const g=p[3];a.a7.scale(d,d,1/d[3]),a.a7.scale(p,p,1/g);const x=d[2],b=p[2];return{p0:d,p1:p,t:x===b?0:(u-x)/(b-x)}}screenPointToMercatorRay(r){const o=[r.x,r.y,0,1],u=[r.x,r.y,1,1];return a.a7.transformMat4(o,o,this.pixelMatrixInverse),a.a7.transformMat4(u,u,this.pixelMatrixInverse),a.a7.scale(o,o,1/o[3]),a.a7.scale(u,u,1/u[3]),o[2]=a.bl(o[2],this._center.lat)*this.worldSize,u[2]=a.bl(u[2],this._center.lat)*this.worldSize,a.a7.scale(o,o,1/this.worldSize),a.a7.scale(u,u,1/this.worldSize),new a.a2([o[0],o[1],o[2]],a.N.normalize([],a.N.sub([],u,o)))}rayIntersectionCoordinate(r){const{p0:o,p1:u,t:d}=r,p=a.bl(o[2],this._center.lat),g=a.bl(u[2],this._center.lat);return new a.L(a.U(o[0],u[0],d)/this.worldSize,a.U(o[1],u[1],d)/this.worldSize,a.U(p,g,d))}pointCoordinate(r,o=this._centerAltitude){return this.projection.pointCoordinate(this,r.x,r.y,o)}pointCoordinate3D(r){if(!this.elevation)return this.pointCoordinate(r);let o=this.projection.pointCoordinate3D(this,r.x,r.y);if(o)return new a.L(o[0],o[1],o[2]);let u=0,d=this.horizonLineFromTop();if(r.y>d)return this.pointCoordinate(r);const p=.02*d,g=r.clone();for(let x=0;x<10&&d-u>p;x++){g.y=a.U(u,d,.66);const b=this.projection.pointCoordinate3D(this,g.x,g.y);b?(d=g.y,o=b):u=g.y}return o?new a.L(o[0],o[1],o[2]):this.pointCoordinate(r)}isPointAboveHorizon(r){return this.projection.isPointAboveHorizon(this,r)}isPointOnSurface(r){if(r.y<0||r.y>this.height||r.x<0||r.x>this.width)return!1;if(this.elevation||this.zoom>=a.bx)return!this.isPointAboveHorizon(r);const o=this.pointCoordinate(r);return o.y>=0&&o.y<=1}_coordinatePoint(r,o){const u=o&&this.elevation?this.elevation.getAtPointOrZero(r,this._centerAltitude):this._centerAltitude,d=[r.x*this.worldSize,r.y*this.worldSize,u+r.toAltitude(),1];return a.a7.transformMat4(d,d,this.pixelMatrix),d[3]>0?new a.P(d[0]/d[3],d[1]/d[3]):new a.P(Number.MAX_VALUE,Number.MAX_VALUE)}_getBoundsNonRectangular(){const{top:r,left:o}=this._edgeInsets,u=this.height-this._edgeInsets.bottom,d=this.width-this._edgeInsets.right,p=this.pointLocation3D(new a.P(o,r)),g=this.pointLocation3D(new a.P(d,r)),x=this.pointLocation3D(new a.P(d,u)),b=this.pointLocation3D(new a.P(o,u));let T=Math.min(p.lng,g.lng,x.lng,b.lng),M=Math.max(p.lng,g.lng,x.lng,b.lng),S=Math.min(p.lat,g.lat,x.lat,b.lat),C=Math.max(p.lat,g.lat,x.lat,b.lat);const P=Math.pow(2,-this.zoom)/16*270,k=this.projection.name==="globe"?1:4,R=(O,D,F,Z,V)=>
vendor: 6,649 bytes, line 14
14{const q=(O+F)/2,B=(D+Z)/2,$=new a.P(q,B),{lng:Y,lat:K}=this.pointLocation3D($),ee=Math.max(0,T-Y,S-K,Y-M,K-C);T=Math.min(T,Y),M=Math.max(M,Y),S=Math.min(S,K),C=Math.max(C,K),(V<k||ee>P)&&(R(O,D,q,B,V+1),R(q,B,F,Z,V+1))};if(R(o,r,d,r,1),R(d,r,d,u,1),R(d,u,o,u,1),R(o,u,o,r,1),this.projection.name==="globe"){const[O,D]=a.by(this);O?(C=90,M=180,T=-180):D&&(S=-90,M=180,T=-180)}return new a.ad(new a.bn(T,S),new a.bn(M,C))}_getBoundsRectangular(r,o){const{top:u,left:d}=this._edgeInsets,p=this.height-this._edgeInsets.bottom,g=this.width-this._edgeInsets.right,x=new a.P(d,u),b=new a.P(g,u),T=new a.P(g,p),M=new a.P(d,p);let S=this.pointCoordinate(x,r),C=this.pointCoordinate(b,r);const P=this.pointCoordinate(T,o),k=this.pointCoordinate(M,o),R=(O,D)=>(D.y-O.y)/(D.x-O.x);return S.y>1&&C.y>=0?S=new a.L((1-k.y)/R(k,S)+k.x,1):S.y<0&&C.y<=1&&(S=new a.L(-k.y/R(k,S)+k.x,0)),C.y>1&&S.y>=0?C=new a.L((1-P.y)/R(P,C)+P.x,1):C.y<0&&S.y<=1&&(C=new a.L(-P.y/R(P,C)+P.x,0)),new a.ad().extend(this.coordinateLocation(S)).extend(this.coordinateLocation(C)).extend(this.coordinateLocation(k)).extend(this.coordinateLocation(P))}_getBoundsRectangularTerrain(){const r=this.elevation;if(!r.visibleDemTiles.length||r.isUsingMockSource())return this._getBoundsRectangular(0,0);const o=r.visibleDemTiles.reduce((u,d)=>{if(d.dem){const p=d.dem.tree;u.min=Math.min(u.min,p.minimums[0]),u.max=Math.max(u.max,p.maximums[0])}return u},{min:Number.MAX_VALUE,max:0});return this._getBoundsRectangular(o.min*r.exaggeration(),o.max*r.exaggeration())}getBounds(){return this.projection.name==="mercator"||this.projection.name==="equirectangular"?this._terrainEnabled()?this._getBoundsRectangularTerrain():this._getBoundsRectangular(0,0):this._getBoundsNonRectangular()}horizonLineFromTop(r=!0){const o=this.height/2/Math.tan(this._fov/2)/Math.tan(Math.max(this._pitch,.1))-this.centerOffset.y,u=this.height/2-o*(1-this._horizonShift);return r?Math.max(0,u):u}getMaxBounds(){return this.maxBounds}setMaxBounds(r){this.maxBounds=r,this.minLat=-a.bw,this.maxLat=a.bw,this.minLng=-180,this.maxLng=180,r&&(this.minLat=r.getSouth(),this.maxLat=r.getNorth(),this.minLng=r.getWest(),this.maxLng=r.getEast(),this.maxLng<this.minLng&&(this.maxLng+=360)),this.worldMinX=a.a5(this.minLng)*this.tileSize,this.worldMaxX=a.a5(this.maxLng)*this.tileSize,this.worldMinY=a.ae(this.maxLat)*this.tileSize,this.worldMaxY=a.ae(this.minLat)*this.tileSize,this._constrain()}calculatePosMatrix(r,o){return this.projection.createTileMatrix(this,o,r)}calculateDistanceTileData(r){const o=r.key,u=this._distanceTileDataCache;if(u[o])return u[o];const d=r.canonical,p=1/this.height,g=this.cameraWorldSize,x=g/this.zoomScale(d.z),b=(d.x+Math.pow(2,d.z)*r.wrap)*x,T=d.y*x,M=this.point;M.x*=g/this.worldSize,M.y*=g/this.worldSize;const S=this.angle,C=Math.sin(-S),P=-Math.cos(-S);return u[o]={bearing:[C,P],center:[(M.x-b)*p,(M.y-T)*p],scale:x/a.V*p},u[o]}calculateFogTileMatrix(r){const o=r.key,u=this._fogTileMatrixCache;if(u[o])return u[o];const d=this.projection.createTileMatrix(this,this.cameraWorldSizeForFog,r);return a.a6.multiply(d,this.worldToFogMatrix,d),u[o]=new Float32Array(d),u[o]}calculateProjMatrix(r,o=!1,u=!1){const d=r.key;let p;if(p=u?this._expandedProjMatrixCache:o?this._alignedProjMatrixCache:this._projMatrixCache,p[d])return p[d];const g=this.calculatePosMatrix(r,this.worldSize);let x;return x=this.projection.isReprojectedInTileSpace?this.mercatorMatrix:u?this.expandedFarZProjMatrix:o?this.alignedProjMatrix:this.projMatrix,a.a6.multiply(g,x,g),p[d]=new Float32Array(g),p[d]}calculatePixelsToTileUnitsMatrix(r){const o=r.tileID.key,u=this._pixelsToTileUnitsCache;if(u[o])return u[o];const d=a.bz(r,this);return u[o]=d,u[o]}customLayerMatrix(){return this.mercatorMatrix.slice()}globeToMercatorMatrix(){if(this.projection.name==="globe"){const r=1/this.worldSize,o=a.a6.fromScaling([],[r,r,r]);return a.a6.multiply(o,o,this.globeMatrix),o}}recenterOnTerrain(){if(!this._elevation||this.projection.name==="globe")return;const r=this._elevation;this._updateCameraState();const o=a.bl(1,this._center.lat)*this.worldSize,u=this._computeCameraPosition(o),d=this._camera.forward(),p=a.bl(1,this._center.lat);u[2]/=p,d[2]/=p,a.N.normalize(d,d);const g=r.raycast(u,d,r.exaggeration());if(g){const x=a.N.scaleAndAdd([],u,d,g),b=new a.L(x[0],x[1],a.bl(x[2],a.au(x[1]))),T=(b.z+a.N.length([b.x-u[0],b.y-u[1],b.z-u[2]*p]))*this._pixelsPerMercatorPixel;this._seaLevelZoom=this._zoomFromMercatorZ(T),this._centerAltitude=b.toAltitude(),this._center=this.coordinateLocation(b),this._updateZoomFromElevation(),this._constrain(),this._calcMatrices()}}_constrainCamera(r=!1){if(!this._elevation)return;const o=this._elevation,u=a.bl(1,this._center.lat)*this.worldSize,d=this._computeCameraPosition(u),p=o.getAtPointOrZero(new a.L(...d)),g=this.pixelsPerMeter/this.worldSize*p,x=this._minimumHeightOverTerrain(),b=d[2]-g;if(b<=x)if(b<0||r){const T=this.locationCoordinate(this._center,this._centerAltitude),M=[d[0],d[1],T.z-d[2]],S=a.N.length(M);M[2]-=(x-b)/this._pixelsPerMercatorPixel;const C=a.N.length(M);if(C===0)return;a.N.scale(M,M,S/C*this._pixelsPerMercatorPixel),this._camera.position=[d[0],d[1],T.z*this._pixelsPerMercatorPixel-M[2]],this._updateStateFromCamera()}else this._isCameraConstrained=!0}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;const r=this.projection.name==="globe"||this.mercatorFromTransition;if(this.projection.isReprojectedInTileSpace||r){const C=this.center;return C.lat=a.aa(C.lat,this.minLat,this.maxLat),(this.maxBounds||!this.renderWorldCopies&&!r)&&(C.lng=a.aa(C.lng,this.minLng,this.maxLng)),this.center=C,void(this._constraining=!1)}const o=this._unmodified,{x:u,y:d}=this.point;let p=0,g=u,x=d;const b=this.width/2,T=this.height/2,M=this.worldMinY*this.scale,S=this.worldMaxY*this.scale;if(d-T<M&&(x=M+T),d+T>S&&(x=S-T),S-M<this.height&&(p=Math.max(p,this.height/(S-M)),x=(S+M)/2),this.maxBounds||!this._renderWorldCopies||!this.projection.wrap){const C=this.worldMinX*this.scale,P=this.worldMaxX*this.scale,k=this.worldSize/2-(C+P)/2;g=(u+k+this.worldSize)%this.worldSize-k,g-b<C&&(g=C+b),g+b>P&&(g=P-b),P-C<this.width&&(p=Math.max(p,this.width/(P-C)),g=(P+C)/2)}g===u&&x===d||(this.center=this.unproject(new a.P(g,x))),p&&(this.zoom+=this.scaleZoom(p)),this._constrainCamera(),this._unmodified=o,this._constraining=!1}_minZoomForBounds(){let r=Math.max(0,this.scaleZoom(this.height/(this.worldMaxY-this.worldMinY)));return this.maxBounds&&(r=Math.max(r,this.scaleZoom(this.width/(this.worldMaxX-this.worldMinX)))),r}_maxCameraBoundsDistance(){return this._mercatorZfromZoom(this._minZoomForBounds())}
14_calcMatrices(){if(!this.height)return;const r=this.centerOffset,o=this.projection.name==="globe",u=this.pixelsPerMeter;this.projection.name==="globe"&&(this._mercatorScaleRatio=a.bl(1,this.center.lat)/a.bl(1,a.bI));const d=a.bA(this.projection,this.zoom,this.width,this.height,1024);this._pixelsPerMercatorPixel=this.projection.pixelSpaceConversion(this.center.lat,this.worldSize,d),this.cameraToCenterDistance=.5/Math.tan(.5*this._fov)*this.height*this._pixelsPerMercatorPixel,this._updateCameraState(),this._farZ=this.projection.farthestPixelDistance(this),this._nearZ=this.height/50;const p=this.projection.zAxisUnit==="meters"?u:1,g=this._camera.getWorldToCamera(this.worldSize,p);let x;const b=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,this._farZ);if(b[8]=2*-r.x/this.width,b[9]=2*r.y/this.height,this.isOrthographic){let K=.5*this.height/Math.tan(this._fov/2)*1*Math.tan(.5*this._fov),ee=K*this.aspect,ce=-ee,re=-K;ee-=r.x,ce-=r.x,K+=r.y,re+=r.y,x=this._camera.getCameraToClipOrthographic(ce,ee,re,K,this._nearZ,this._farZ),((me,fe,Ae,ne)=>{for(let he=0;he<16;he++)me[he]=ps(fe[he],Ae[he],ne)})(x,x,b,ta(this.pitch>=15?1:this.pitch/15))}else x=b;const T=a.a6.mul([],b,g);let M=a.a6.mul([],x,g);if(this.projection.isReprojectedInTileSpace){const K=this.locationCoordinate(this.center),ee=a.a6.identity([]);a.a6.translate(ee,ee,[K.x*this.worldSize,K.y*this.worldSize,0]),a.a6.multiply(ee,ee,a.bB(this)),a.a6.translate(ee,ee,[-K.x*this.worldSize,-K.y*this.worldSize,0]),a.a6.multiply(M,M,ee),a.a6.multiply(T,T,ee),this.inverseAdjustmentMatrix=a.bC(this)}else this.inverseAdjustmentMatrix=[1,0,0,1];if(this.mercatorMatrix=a.a6.scale([],M,[this.worldSize,this.worldSize,this.worldSize/p,1]),this.projMatrix=M,this.invProjMatrix=a.a6.invert(new Float64Array(16),this.projMatrix),o){const K=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,1/0);K[8]=2*-r.x/this.width,K[9]=2*r.y/this.height,this.expandedFarZProjMatrix=a.a6.mul([],K,g)}else this.expandedFarZProjMatrix=this.projMatrix;const S=a.a6.invert([],x);this.frustumCorners=a.bD.fromInvProjectionMatrix(S,this.horizonLineFromTop(),this.height),this.cameraFrustum=a.bq.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,0,!o);const C=new Float32Array(16);a.a6.identity(C),a.a6.scale(C,C,[1,-1,1]),a.a6.rotateX(C,C,this._pitch),a.a6.rotateZ(C,C,this.angle);const P=a.a6.perspective(new Float32Array(16),this._fov,this.width/this.height,this._nearZ,this._farZ);this.starsProjMatrix=a.a6.clone(P);const k=(Math.PI/2-this._pitch)*(this.height/this._fov)*this._horizonShift;P[8]=2*-r.x/this.width,P[9]=2*(r.y+k)/this.height,this.skyboxMatrix=a.a6.multiply(C,P,C);const R=this.point,O=R.x,D=R.y,F=this.width%2/2,Z=this.height%2/2,V=Math.cos(this.angle),q=Math.sin(this.angle),B=O-Math.round(O)+V*F+q*Z,$=D-Math.round(D)+V*Z+q*F,Y=new Float64Array(M);if(a.a6.translate(Y,Y,[B>.5?B-1:B,$>.5?$-1:$,0]),this.alignedProjMatrix=Y,M=a.a6.create(),a.a6.scale(M,M,[this.width/2,-this.height/2,1]),a.a6.translate(M,M,[1,-1,0]),this.labelPlaneMatrix=M,M=a.a6.create(),a.a6.scale(M,M,[1,-1,1]),a.a6.translate(M,M,[-1,-1,0]),a.a6.scale(M,M,[2/this.width,2/this.height,1]),this.glCoordMatrix=M,this.pixelMatrix=a.a6.multiply(new Float64Array(16),this.labelPlaneMatrix,T),this._calcFogMatrices(),this._distanceTileDataCache={},M=a.a6.invert(new Float64Array(16),this.pixelMatrix),!M)throw new Error("failed to invert matrix");if(this.pixelMatrixInverse=M,this.projection.name==="globe"||this.mercatorFromTransition){this.globeMatrix=a.bE(this);const K=[this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]];this.globeCenterInViewSpace=a.N.transformMat4(K,K,g),this.globeRadius=this.worldSize/2/Math.PI-1}else this.globeMatrix=M;this._projMatrixCache={},this._alignedProjMatrixCache={},this._pixelsToTileUnitsCache={},this._expandedProjMatrixCache={}}_calcFogMatrices(){this._fogTileMatrixCache={};const r=this.cameraWorldSizeForFog,o=this.cameraPixelsPerMeter,u=this._camera.position,d=1/this.height/this._pixelsPerMercatorPixel,p=[r,r,o];a.N.scale(p,p,d),a.N.scale(u,u,-1),a.N.multiply(u,u,p);const g=a.a6.create();a.a6.translate(g,g,u),a.a6.scale(g,g,p),this.mercatorFogMatrix=g,this.worldToFogMatrix=this._camera.getWorldToCameraPosition(r,o,d)}_computeCameraPosition(r){const o=(r=r||this.pixelsPerMeter)/this.pixelsPerMeter,u=this._camera.forward(),d=this.point,p=this._mercatorZfromZoom(this._seaLevelZoom?this._seaLevelZoom:this._zoom)*o-r/this.worldSize*this._centerAltitude;return[d.x/this.worldSize-u[0]*p,d.y/this.worldSize-u[1]*p,r/this.worldSize*this._centerAltitude-u[2]*p]}_updateCameraState(){this.height&&(this._camera.setPitchBearing(this._pitch,this.angle),this._camera.position=this._computeCameraPosition())}_translateCameraConstrained(r){const o=this._maxCameraBoundsDistance()*Math.cos(this._pitch),u=this._camera.position[2],d=r[2];let p=1;this.projection.wrap&&(this.center=this.center.wrap()),d>0&&(p=Math.min((o-u)/d,1)),this._camera.position=a.N.scaleAndAdd([],this._camera.position,r,p),this._updateStateFromCamera()}_updateStateFromCamera(){const r=this._camera.position,o=this._camera.forward(),{pitch:u,bearing:d}=this._camera.getPitchBearing(),p=a.bl(this._centerAltitude,this.center.lat)*this._pixelsPerMercatorPixel,g=this._mercatorZfromZoom(this._maxZoom)*Math.cos(a.bj(this._maxPitch)),x=Math.max((r[2]-
14p)/Math.cos(u),g),b=this._zoomFromMercatorZ(x);a.N.scaleAndAdd(r,r,o,x),this._pitch=a.aa(u,a.bj(this.minPitch),a.bj(this.maxPitch)),this.angle=a.bh(d,-Math.PI,Math.PI),this._setZoom(a.aa(b,this._minZoom,this._maxZoom)),this._updateSeaLevelZoom(),this._center=this.coordinateLocation(new a.L(r[0],r[1],r[2])),this._unmodified=!1,this._constrain(),this._calcMatrices()}_worldSizeFromZoom(r){return Math.pow(2,r)*this.tileSize}_mercatorZfromZoom(r){return this.cameraToCenterDistance/this._worldSizeFromZoom(r)}_minimumHeightOverTerrain(){const r=Math.min(this._seaLevelZoom!=null?this._seaLevelZoom:this._zoom,this._maxZoom)+4;return this._mercatorZfromZoom(r)}_zoomFromMercatorZ(r){return this.scaleZoom(this.cameraToCenterDistance/(r*this.tileSize))}zoomFromMercatorZAdjusted(r){let o=0,u=a.bx,d=0,p=1/0;for(;u-o>1e-6&&u>o;){const g=o+.5*(u-o),x=this.tileSize*Math.pow(2,g),b=this.getCameraToCenterDistance(this.projection,g,x),T=this.scaleZoom(b/(r*this.tileSize)),M=Math.abs(g-T);M<p&&(p=M,d=g),g<T?o=g:u=g}return d}_terrainEnabled(){return!(!this._elevation||!this.projection.supportsTerrain&&(a.w("Terrain is not yet supported with alternate projections. Use mercator or globe to enable terrain."),1))}anyCornerOffEdge(r,o){const u=Math.min(r.x,o.x),d=Math.max(r.x,o.x),p=Math.min(r.y,o.y),g=Math.max(r.y,o.y);if(p<this.horizonLineFromTop(!1))return!0;if(this.projection.name!=="mercator")return!1;const x=[new a.P(u,p),new a.P(d,g),new a.P(u,g),new a.P(d,p)],b=this.renderWorldCopies?-3:0,T=this.renderWorldCopies?4:1;for(const M of x){const S=this.pointRayIntersection(M);if(S.t<0)return!0;const C=this.rayIntersectionCoordinate(S);if(C.x<b||C.y<0||C.x>T||C.y>1)return!0}return!1}isHorizonVisible(){return this.pitch+a.bF(this.fovAboveCenter)>88||this.anyCornerOffEdge(new a.P(0,0),new a.P(this.width,this.height))}zoomDeltaToMovement(r,o){const u=a.N.length(a.N.sub([],this._camera.position,r)),d=this._zoomFromMercatorZ(u)+o;return u-this._mercatorZfromZoom(d)}getCameraPoint(){if(this.projection.name==="globe"){const r=function([o,u,d],p){const g=[o,u,d,1];a.a7.transformMat4(g,g,p);const x=g[3]=Math.max(g[3],1e-6);return g[0]/=x,g[1]/=x,g[2]/=x,g}([this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]],this.pixelMatrix);return new a.P(r[0],r[1])}{const r=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new a.P(0,r))}}getCameraToCenterDistance(r,o=this.zoom,u=this.worldSize){const d=a.bA(r,o,this.width,this.height,1024),p=r.pixelSpaceConversion(this.center.lat,u,d);let g=.5/Math.tan(.5*this._fov)*this.height*p;return this.isOrthographic&&(g=ps(1,g,ta(this.pitch>=15?1:this.pitch/15))),g}getWorldToCameraMatrix(){const r=this._camera.getWorldToCamera(this.worldSize,this.projection.zAxisUnit==="meters"?this.pixelsPerMeter:1);return this.projection.name==="globe"&&a.a6.multiply(r,r,this.globeMatrix),r}getFrustum(r){return a.bq.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,r,this.projection.zAxisUnit==="meters")}}const cr={BaseColor:5,MetallicRoughness:6,Normal:7,Occlusion:8,Emission:9,ShadowMap0:10},no=(c,r)=>{if(r>0&&c.terrain&&a.w("Cutoff is currently disabled on terrain"),r<=0||c.terrain)return{shouldRenderCutoff:!1,uniformValues:{u_cutoff_params:[0,0,0,1]}};const o=c.transform,u=Math.max(Math.abs(o._zoom-(c.minCutoffZoom-1)),1),d=o.isLODDisabled(!1)?a.O(60,45,o.pitch):a.O(30,15,o.pitch),p=o._farZ-o._nearZ,g=r*o.height,x=((1-(b=d))*o.cameraToCenterDistance+b*(o._farZ+g))*u;var b;return{shouldRenderCutoff:d<1,uniformValues:{u_cutoff_params:[o._nearZ,o._farZ,(x-o._nearZ)/p,(x-g-o._nearZ)/p]}}},br={cascadeCount:2,shadowMapResolution:2048};class wc{constructor(r,o){this.aabb=r,this.lastCascade=o}}class ah{add(r,o){const u=this.receivers[r.key];u!==void 0?(u.aabb.min[0]=Math.min(u.aabb.min[0],o.min[0]),u.aabb.min[1]=Math.min(u.aabb.min[1],o.min[1]),u.aabb.min[2]=Math.min(u.aabb.min[2],o.min[2]),u.aabb.max[0]=Math.max(u.aabb.max[0],o.max[0]),u.aabb.max[1]=Math.max(u.aabb.max[1],o.max[1]),u.aabb.max[2]=Math.max(u.aabb.max[2],o.max[2])):this.receivers[r.key]=new wc(o,null)}clear(){this.receivers={}}get(r){return this.receivers[r.key]}computeRequiredCascades(r,o,u){const d=a.bS.fromPoints(r.points);let p=0;for(const g in this.receivers){const x=this.receivers[g];if(!x||!d.intersectsAabb(x.aabb))continue;x.aabb.min=d.closestPoint(x.aabb.min),x.aabb.max=d.closestPoint(x.aabb.max);const b=x.aabb.getCorners();for(let T=0;T<u.length;T++){let M=!0;for(const S of b){const C=[S[0]*o,S[1]*o,S[2]];
14if(a.N.transformMat4(C,C,u[T].matrix),C[0]<-1||C[0]>1||C[1]<-1||C[1]>1){M=!1;break}}if(x.lastCascade=T,p=Math.max(p,T),M)break}}return p+1}}class Tc{constructor(r){this.painter=r,this._enabled=!1,this._shadowLayerCount=0,this._numCascadesToRender=0,this._cascades=[],this._groundShadowTiles=[],this._receivers=new ah,this._depthMode=new dt(r.context.gl.LEQUAL,dt.ReadWrite,[0,1]),this._uniformValues={u_light_matrix_0:new Float32Array(16),u_light_matrix_1:new Float32Array(16),u_shadow_intensity:0,u_fade_range:[0,0],u_shadow_normal_offset:[1,1,1],u_shadow_texel_size:1,u_shadow_map_resolution:1,u_shadow_direction:[0,0,1],u_shadow_bias:[36e-5,.0012,.012],u_shadowmap_0:0,u_shadowmap_1:0},this.useNormalOffset=!1,r.tp.registerParameter(br,["Shadows"],"cascadeCount",{min:1,max:2,step:1}),r.tp.registerParameter(br,["Shadows"],"shadowMapResolution",{min:32,max:2048,step:32})}destroy(){for(const r of this._cascades)r.texture.destroy(),r.framebuffer.destroy();this._cascades=[]}updateShadowParameters(r,o){const u=this.painter;if(this._enabled=!1,this._shadowLayerCount=0,this._receivers.clear(),!o||!o.properties)return;const d=o.properties.get("shadow-intensity");if(!o.shadowsEnabled()||d<=0||(this._shadowLayerCount=u.style.order.reduce((k,R)=>{const O=u.style._mergedLayers[R];return k+(O.hasShadowPass()&&!O.isHidden(r.zoom)?1:0)},0),this._enabled=this._shadowLayerCount>0,!this._enabled))return;const p=u.context,g=br.shadowMapResolution,x=br.shadowMapResolution;if(this._cascades.length===0||br.shadowMapResolution!==this._cascades[0].texture.size[0]){this._cascades=[];for(let k=0;k<br.cascadeCount;++k){const R=u._shadowMapDebug,O=p.gl,D=p.createFramebuffer(g,x,R,"texture"),F=new a.T(p,{width:g,height:x,data:null},O.DEPTH_COMPONENT);if(D.depthAttachment.set(F.texture),R){const Z=new a.T(p,{width:g,height:x,data:null},O.RGBA);D.colorAttachment.set(Z.texture)}this._cascades.push({framebuffer:D,texture:F,matrix:[],far:0,boundingSphereRadius:0,frustum:new a.bq,scale:0})}}this.shadowDirection=il(o);let b=0;if(r.elevation){const k=r.elevation,R=[1e4,-1e4];k.visibleDemTiles.filter(O=>O.dem).forEach(O=>{const D=O.dem.tree;R[0]=Math.min(R[0],D.minimums[0]),R[1]=Math.max(R[1],D.maximums[0])}),R[0]!==1e4&&(b=(R[1]-R[0])*k.exaggeration())}const T=1.5*r.cameraToCenterDistance,M=3*T,S=new Float64Array(16);for(let k=0;k<this._cascades.length;++k){const R=this._cascades[k];let O=r.height/50,D=1;br.cascadeCount===1?D=M:k===0?D=T:(O=T,D=M);const[F,Z]=lh(r,this.shadowDirection,O,D,br.shadowMapResolution,b);R.scale=r.scale,R.matrix=F,R.boundingSphereRadius=Z,a.a6.invert(S,R.matrix),R.frustum=a.bq.fromInvProjectionMatrix(S,1,0,!0),R.far=D}const C=this._cascades.length-1;this._uniformValues.u_fade_range=[.75*this._cascades[C].far,this._cascades[C].far],this._uniformValues.u_shadow_intensity=d,this._uniformValues.u_shadow_direction=[this.shadowDirection[0],this.shadowDirection[1],this.shadowDirection[2]],this._uniformValues.u_shadow_texel_size=1/br.shadowMapResolution,this._uniformValues.u_shadow_map_resolution=br.shadowMapResolution,this._uniformValues.u_shadowmap_0=cr.ShadowMap0,this._uniformValues.u_shadowmap_1=cr.ShadowMap0+1,this._groundShadowTiles=u.transform.coveringTiles({tileSize:512,renderWorldCopies:!0});const P=u.transform.elevation;for(const k of this._groundShadowTiles){let R={min:0,max:0};if(P){const O=P.getMinMaxForTile(k);O&&(R=O)}this.addShadowReceiver(k.toUnwrapped(),R.min,R.max)}}get enabled(){return this._enabled}set enabled(r){this._enabled=r}drawShadowPass(r,o){if(!this._enabled)return;const u=this.painter,d=u.context;this._numCascadesToRender=this._receivers.computeRequiredCascades(u.transform.getFrustum(0),u.transform.worldSize,this._cascades),d.viewport.set([0,0,br.shadowMapResolution,br.shadowMapResolution]);for(let p=0;p<this._numCascadesToRender;++p){u.currentShadowCascade=p,d.bindFramebuffer.set(this._cascades[p].framebuffer.framebuffer),d.clear({color:a.ax.white,depth:1});for(const g of r.order){const x=r._mergedLayers[g];if(!x.hasShadowPass()||x.isHidden(u.transform.zoom))continue;const b=r.getLayerSourceCache(x),T=b?o[b.id]:void 0;(x.type==="model"||T&&T.length)&&u.renderLayer(u,b,x,T)}}u.currentShadowCascade=0}drawGroundShadows(){if(!this._enabled)return;const r=this.painter,o=r.style,u=r.context,d=o.directionalLight,p=o.ambientLight;
14if(!d||!p)return;const g=[],x=no(r,r.longestCutoffRange);x.shouldRenderCutoff&&g.push("RENDER_CUTOFF");const b=ra(d,p),T=new dt(u.gl.LEQUAL,dt.ReadOnly,r.depthRangeFor3D);for(const M of this._groundShadowTiles){const S=M.toUnwrapped(),C=r.isTileAffectedByFog(M),P=r.getOrCreateProgram("groundShadow",{defines:g,overrideFog:C});this.setupShadows(S,P),r.uploadCommonUniforms(u,P,S,null,x);const k={u_matrix:r.transform.calculateProjMatrix(S),u_ground_shadow_factor:b};P.draw(r,u.gl.TRIANGLES,T,yt.disabled,Rt.multiply,ft.disabled,k,"ground_shadow",r.tileExtentBuffer,r.quadTriangleIndexBuffer,r.tileExtentSegments,{},r.transform.zoom,null,null)}}getShadowPassColorMode(){return this.painter._shadowMapDebug?Rt.unblended:Rt.disabled}getShadowPassDepthMode(){return this._depthMode}getShadowCastingLayerCount(){return this._shadowLayerCount}calculateShadowPassMatrixFromTile(r){const o=this.painter.transform,u=o.calculatePosMatrix(r,o.worldSize);return a.a6.multiply(u,this._cascades[this.painter.currentShadowCascade].matrix,u),Float32Array.from(u)}calculateShadowPassMatrixFromMatrix(r){return a.a6.multiply(r,this._cascades[this.painter.currentShadowCascade].matrix,r),Float32Array.from(r)}setupShadows(r,o,u,d=0){if(!this._enabled)return;const p=this.painter.transform,g=this.painter.context,x=g.gl,b=this._uniformValues,T=new Float64Array(16),M=p.calculatePosMatrix(r,p.worldSize);for(let S=0;S<this._cascades.length;S++)a.a6.multiply(T,this._cascades[S].matrix,M),b[S===0?"u_light_matrix_0":"u_light_matrix_1"]=Float32Array.from(T),g.activeTexture.set(x.TEXTURE0+cr.ShadowMap0+S),this._cascades[S].texture.bind(x.NEAREST,x.CLAMP_TO_EDGE);if(this.useNormalOffset=!!u,this.useNormalOffset){const S=a.bR(r.canonical),C=2/p.tileSize*a.V/br.shadowMapResolution,P=C*this._cascades[0].boundingSphereRadius,k=C*this._cascades[this._cascades.length-1].boundingSphereRadius,R=(u==="vector-tile"?1:3)/Math.pow(2,d-r.canonical.z-(1-p.zoom+Math.floor(p.zoom)));b.u_shadow_normal_offset=[S,P*R,k*R],b.u_shadow_bias=[6e-5,.0012,.012]}else b.u_shadow_bias=[36e-5,.0012,.012];o.setShadowUniformValues(g,b)}setupShadowsFromMatrix(r,o,u=!1){if(!this._enabled)return;const d=this.painter.context,p=d.gl,g=this._uniformValues,x=new Float64Array(16);for(let b=0;b<br.cascadeCount;b++)a.a6.multiply(x,this._cascades[b].matrix,r),g[b===0?"u_light_matrix_0":"u_light_matrix_1"]=Float32Array.from(x),d.activeTexture.set(p.TEXTURE0+cr.ShadowMap0+b),this._cascades[b].texture.bind(p.NEAREST,p.CLAMP_TO_EDGE);this.useNormalOffset=u,u?(g.u_shadow_normal_offset=[1,5,5],g.u_shadow_bias=[6e-5,.0012,.012]):g.u_shadow_bias=[36e-5,.0012,.012],o.setShadowUniformValues(d,g)}getShadowUniformValues(){return this._uniformValues}getCurrentCascadeFrustum(){return this._cascades[this.painter.currentShadowCascade].frustum}computeSimplifiedTileShadowVolume(r,o,u,d){if(d[2]>=0)return{};const p=function(b,T,M){const S=M/(1<<b.canonical.z);return new a.bS([b.canonical.x*S+b.wrap*M,b.canonical.y*S+b.wrap*M,0],[(b.canonical.x+1)*S+b.wrap*M,(b.canonical.y+1)*S+b.wrap*M,T])}(r,o,u).getCorners(),g=o/-d[2];d[0]<0?(a.N.add(p[0],p[0],[d[0]*g,0,0]),a.N.add(p[3],p[3],[d[0]*g,0,0])):d[0]>0&&(a.N.add(p[1],p[1],[d[0]*g,0,0]),a.N.add(p[2],p[2],[d[0]*g,0,0])),d[1]<0?(a.N.add(p[0],p[0],[0,d[1]*g,0]),a.N.add(p[1],p[1],[0,d[1]*g,0])):d[1]>0&&(a.N.add(p[2],p[2],[0,d[1]*g,0]),a.N.add(p[3],p[3],[0,d[1]*g,0]));const x={};return x.vertices=p,x.planes=[Oo(p[1],p[0],p[4]),Oo(p[2],p[1],p[5]),Oo(p[3],p[2],p[6]),Oo(p[0],p[3],p[7])],x}addShadowReceiver(r,o,u){this._receivers.add(r,a.bS.fromTileIdAndHeight(r,o,u))}getMaxCascadeForTile(r){const o=this._receivers.get(r);return o&&o.lastCascade?o.lastCascade:0}}function Oo(c,r,o){const u=a.N.sub([],o,r),d=a.N.sub([],c,r),p=a.N.cross([],u,d),g=a.N.length(p);return g===0?[0,0,1,0]:(a.N.scale(p,p,1/g),[p[0],p[1],p[2],-a.N.dot(p,r)])}function il(c){const r=c.properties.get("direction"),o=a.bQ(r.x,r.y,r.z);o[2]=a.aa(o[2],0,75);const u=a.bT([o[0],o[1],o[2]]);return a.N.fromValues(u.x,u.y,u.z)}function ra(c,r){const o=c.properties.get("color"),u=c.properties.get("intensity"),d=c.properties.get("direction"),p=[d.x,d.y,d.z],g=r.properties.get("color"),x=r.properties.get("intensity"),b=Math.max(a.N.dot([0,0,1],p),0
14),T=[0,0,0];a.N.scale(T,g.toArray01Linear().slice(0,3),x);const M=[0,0,0];return a.N.scale(M,o.toArray01Linear().slice(0,3),b*u),a.bU([T[0]>0?T[0]/(T[0]+M[0]):0,T[1]>0?T[1]/(T[1]+M[1]):0,T[2]>0?T[2]/(T[2]+M[2]):0])}function lh(c,r,o,u,d,p){const g=c.zoom,x=c.scale,b=c.worldSize,T=1/b,M=c.aspect,S=Math.sqrt(1+M*M)*Math.tan(.5*c.fovX),C=S*S,P=u-o,k=u+o;let R,O;C>P/k?(R=u,O=u*S):(R=.5*k*(1+C),O=.5*Math.sqrt(P*P+2*(u*u+o*o)*C+k*k*C*C));const D=c.projection.pixelsPerMeter(c.center.lat,b),F=c._camera.getCameraToWorldMercator(),Z=[0,0,-R*T];a.N.transformMat4(Z,Z,F);let V=O*T;const q=c._edgeInsets;if(!(q.left===0&&q.top===0&&q.right===0&&q.bottom===0||q.left===q.right&&q.top===q.bottom)){const Re=c._camera.getWorldToCamera(c.worldSize,c.projection.zAxisUnit==="meters"?D:1),Le=c._camera.getCameraToClipPerspective(c._fov,c.width/c.height,o,u);Le[8]=2*-c.centerOffset.x/c.width,Le[9]=2*c.centerOffset.y/c.height;const je=new Float64Array(16);a.a6.mul(je,Le,Re);const et=new Float64Array(16);a.a6.invert(et,je);const ct=a.bq.fromInvProjectionMatrix(et,b,g,!0);for(const nt of ct.points){const at=((B=nt)[0]/=x,B[1]/=x,B[2]=a.bl(B[2],c._center.lat),B);V=Math.max(V,a.N.len(a.N.subtract([],Z,at)))}}var B;V*=d/(d-1);const $=Math.acos(r[2]),Y=Math.atan2(-r[0],-r[1]),K=new fs;K.position=Z,K.setPitchBearing($,Y);const ee=K.getWorldToCamera(b,D),ce=V*b,re=Math.min(c._mercatorZfromZoom(17)*b*-2,-2*ce),me=K.getCameraToClipOrthographic(-ce,ce,-ce,ce,re,(ce+p*D)/r[2]),fe=new Float64Array(16);a.a6.multiply(fe,me,ee);const Ae=a.N.fromValues(Math.floor(1e6*Z[0])/1e6*b,Math.floor(1e6*Z[1])/1e6*b,0),ne=.5*d,he=[0,0,0];a.N.transformMat4(he,Ae,fe),a.N.scale(he,he,ne);const Q=[Math.floor(he[0]),Math.floor(he[1]),Math.floor(he[2])],ae=[0,0,0];a.N.sub(ae,he,Q),a.N.scale(ae,ae,-1/ne);const Ie=new Float64Array(16);return a.a6.identity(Ie),a.a6.translate(Ie,Ie,ae),a.a6.multiply(fe,Ie,fe),[fe,ce]}const oo=(c,r)=>rt(c,r&&r.filter(o=>o.identifier!=="source.canvas")),ch=a.ac(Gt,["addLayer","removeLayer","setLights","setPaintProperty","setLayoutProperty","setSlot","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setTerrain","setFog","setProjection","setCamera","addImport","removeImport","updateImport"]),ms=a.ac(Gt,["setCenter","setZoom","setBearing","setPitch"]),Mc={version:8,layers:[],sources:{}},uh={duration:300,delay:0},tf=new Set(["fill","line","background","hillshade","raster"]);class sn extends a.E{constructor(r,o={}){super(),this.map=r,this.scope=o.scope||"",this.fragments=[],this.importDepth=o.importDepth||0,this.importsCache=o.importsCache||new Map,this.resolvedImports=o.resolvedImports||new Set,this.transition=a.e({},uh),this._buildingIndex=new eh(this),this.crossTileSymbolIndex=new vc,this._mergedOrder=[],this._drapedFirstOrder=[],this._mergedLayers={},this._mergedSourceCaches={},this._mergedOtherSourceCaches={},this._mergedSymbolSourceCaches={},this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this._changes=o.styleChanges||new To,this.dispatcher=o.dispatcher?o.dispatcher:new a.bW(a.bX(),this),o.imageManager?this.imageManager=o.imageManager:(this.imageManager=new ja,this.imageManager.setEventedParent(this)),this.imageManager.createScope(this.scope),this.glyphManager=o.glyphManager?o.glyphManager:new a.bY(r._requestManager,o.localFontFamily?a.bZ.all:o.localIdeographFontFamily?a.bZ.ideographs:a.bZ.none,o.localFontFamily||o.localIdeographFontFamily),o.modelManager?this.modelManager=o.modelManager:(this.modelManager=new Us(r._requestManager),this.modelManager.setEventedParent(this)),this._layers={},this._serializedLayers={},this._sourceCaches={},this._otherSourceCaches={},this._symbolSourceCaches={},this._loaded=!1,this._precompileDone=!1,this._shouldPrecompile=!1,this._availableImages=[],this._order=[],this._markersNeedUpdate=!1,this.options=o.configOptions?o.configOptions:new Map,this._configDependentLayers=o.configDependentLayers?o.configDependentLayers:new Set,this._config=o.config,this.dispatcher.broadcast("setReferrer",a.b_());const u=this;this._rtlTextPluginCallback=sn.registerForPluginStateChange(d=>{u.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:d.pluginStatus,pluginURL:d.pluginURL},(p,g)=>{if(a.b$(p),g&&g.every(x=>x))for(const x in u._sourceCaches){const b=u._sourceCaches[x],T=b.getSource().type;T!=="vector"&&T!=="geojson"||b.reload()}})}),this.on("data",d=>{if(d.dataType!=="source"||d.sourceDataType!=="metadata")return;const p=this.getOwnSource(d.sourceId);if(p&&p.vectorLayerIds)for(const g in this._layers){const x=this._layers[g];
14x.source===p.id&&this._validateLayer(x)}})}loadURL(r,o={}){this.fire(new a.b("dataloading",{dataType:"style"}));const u=typeof o.validate=="boolean"?o.validate:!a.c0(r);r=this.map._requestManager.normalizeStyleURL(r,o.accessToken),this.resolvedImports.add(r);const d=this.importsCache.get(r);if(d)return this._load(d,u);const p=this.map._requestManager.transformRequest(r,a.R.Style);this._request=a.g(p,(g,x)=>{if(this._request=null,g)this.fire(new a.a(g));else if(x)return this.importsCache.set(r,x),this._load(x,u)})}loadJSON(r,o={}){this.fire(new a.b("dataloading",{dataType:"style"})),this._request=a.f.frame(()=>{this._request=null,this._load(r,o.validate!==!1)})}loadEmpty(){this.fire(new a.b("dataloading",{dataType:"style"})),this._load(Mc,!1)}_loadImports(r,o,u){if(this.importDepth>=4)return a.w("Style doesn't support nesting deeper than 5"),Promise.resolve();const d=[];for(const p of r){const g=this._createFragmentStyle(p),x=new Promise(M=>{g.once("style.import.load",M),g.once("error",M)}).then(()=>this.mergeAll());if(d.push(x),this.resolvedImports.has(p.url)){g.loadEmpty();continue}const b=p.data||this.importsCache.get(p.url);b?g.loadJSON(b,{validate:o}):p.url?g.loadURL(p.url,{validate:o}):g.loadEmpty();const T={style:g,id:p.id,config:p.config};if(u){const M=this.fragments.findIndex(({id:S})=>S===u);this.fragments=this.fragments.slice(0,M).concat(T).concat(this.fragments.slice(M))}else this.fragments.push(T)}return Promise.allSettled(d)}_createFragmentStyle(r){const o=this.scope?a.ag(r.id,this.scope):r.id,u=new sn(this.map,{scope:o,styleChanges:this._changes,importDepth:this.importDepth+1,importsCache:this.importsCache,resolvedImports:new Set(this.resolvedImports),dispatcher:this.dispatcher,imageManager:this.imageManager,glyphManager:this.glyphManager,modelManager:this.modelManager,config:r.config,configOptions:this.options,configDependentLayers:this._configDependentLayers});return u.setEventedParent(this.map,{style:u}),u}_reloadImports(){this.mergeAll(),this._updateMapProjection(),this.updateConfigDependencies(),this.map._triggerCameraUpdate(this.camera),this.dispatcher.broadcast("setLayers",{layers:this._serializeLayers(this._order),scope:this.scope,options:this.options});const r=this.isRootStyle();this._shouldPrecompile=r,this.fire(new a.b(r?"style.load":"style.import.load"))}_load(r,o){const u=r.schema;if(this.isRootStyle()&&(r.fragment||u&&r.fragment!==!1)){const g=a.e({},Mc,{imports:[{id:"basemap",data:r,url:""}]});return void this._load(g,o)}if(this.setConfig(this._config,u),o&&oo(this,Zr(r)))return;this._loaded=!0,this.stylesheet=a.c1(r);for(const g in r.sources)this.addSource(g,r.sources[g],{validate:!1,isInitialLoad:!0});r.sprite?this._loadSprite(r.sprite):(this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0})),this.glyphManager.setURL(r.glyphs,this.scope);const d=th(this.stylesheet.layers);if(this._order=d.map(g=>g.id),this.stylesheet.light&&a.w("The `light` root property is deprecated, prefer using `lights` with `flat` light type instead."),this.stylesheet.lights)if(this.stylesheet.lights.length===1&&this.stylesheet.lights[0].type==="flat"){const g=this.stylesheet.lights[0];this.light=new ot(g.properties,g.id)}else this.setLights(this.stylesheet.lights);this.light||(this.light=new ot(this.stylesheet.light)),this._layers={},this._serializedLayers={};for(const g of d){const x=a.c2(g,this.scope,this.options);x.isConfigDependent&&this._configDependentLayers.add(x.fqid),x.setEventedParent(this,{layer:{id:x.id}}),this._layers[x.id]=x,this._serializedLayers[x.id]=x.serialize();const b=this.getOwnLayerSourceCache(x),T=!!this.directionalLight&&this.directionalLight.shadowsEnabled();b&&x.canCastShadows()&&T&&(b.castsShadows=!0)}this.stylesheet.models&&this.modelManager.addModels(this.stylesheet.models,this.scope);const p=this.stylesheet.terrain;p&&(this.disableElevatedTerrain===void 0&&(this.disableElevatedTerrain=a.f.hasCanvasFingerprintNoise()),this.disableElevatedTerrain?a.w("Terrain and hillshade are disabled because of Canvas2D limitations when fingerprinting protection is enabled (e.g. in private browsing mode)."):this.terrainSetForDrapingOnly()||this._createTerrain(p,1)),this.stylesheet.fog&&this._createFog(this.stylesheet.fog),this.stylesheet.transition&&this.setTransition(this.stylesheet.transition),this.fire(new a.b("data",{dataType:"style"})),r.imports?this._loadImports(r.imports,o).then(()=>this._reloadImports()):this._reloadImports()}isRootStyle(){return this.importDepth===0}mergeAll(){let r,o,u,d,p,g,x,b;this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle(T=>{if(T.stylesheet){if(T.light!=null&&(r=T.light),T.stylesheet.lights)for(const M of T.stylesheet.lights)M.type==="ambient"&&T.ambientLight!=null&&(o=T.ambientLight),M.type==="directional"&&T.directionalLight!=null&&(u=T.directionalLight);d=this._prioritizeTerrain(d,T.terrain,T.stylesheet.terrain),T.stylesheet.fog&&T.fog!=null&&(p=T.fog),T.stylesheet.camera!=null&&(b=T.stylesheet.camera),T.stylesheet.projection!=null&&(g=T.stylesheet.projection),T.stylesheet.transition!=null&&(x=T.stylesheet.transition)}}),this.light=r,this.ambientLight=o,this.directionalLight=u,this.fog=p,d===null?delete this.terrain:this.terrain=d,this.camera=b||{"camera-projection":"perspective"},this.projection=g||{name:"mercator"},this.transition=a.e({},uh,x),this.mergeSources(),this.mergeLayers()}forEachFragmentStyle(r){const o=u=>
14{for(const d of u.fragments)o(d.style);r(u)};o(this)}_prioritizeTerrain(r,o,u){const d=r&&r.drapeRenderMode===0;return u===null?o&&o.drapeRenderMode===0?o:d?r:null:o!=null&&(!r||d||o&&o.drapeRenderMode===1)?o:r}mergeTerrain(){let r;this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle(o=>{r=this._prioritizeTerrain(r,o.terrain,o.stylesheet.terrain)}),r===null?delete this.terrain:this.terrain=r}mergeProjection(){let r;this.forEachFragmentStyle(o=>{o.stylesheet.projection!=null&&(r=o.stylesheet.projection)}),this.projection=r||{name:"mercator"}}mergeSources(){const r={},o={},u={};this.forEachFragmentStyle(d=>{for(const p in d._sourceCaches){const g=a.ag(p,d.scope);r[g]=d._sourceCaches[p]}for(const p in d._otherSourceCaches){const g=a.ag(p,d.scope);o[g]=d._otherSourceCaches[p]}for(const p in d._symbolSourceCaches){const g=a.ag(p,d.scope);u[g]=d._symbolSourceCaches[p]}}),this._mergedSourceCaches=r,this._mergedOtherSourceCaches=o,this._mergedSymbolSourceCaches=u}mergeLayers(){const r={},o=[],u={};this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this.forEachFragmentStyle(p=>{for(const g of p._order){const x=p._layers[g];if(x.type==="slot"){const b=a.c3(g);if(r[b])continue;r[b]=[]}x.slot&&r[x.slot]?r[x.slot].push(x):o.push(x)}}),this._mergedOrder=[];const d=(p=[])=>{for(const g of p)if(g.type==="slot"){const x=a.c3(g.id);r[x]&&d(r[x])}else{const x=a.ag(g.id,g.scope);this._mergedOrder.push(x),u[x]=g,g.is3D()&&(this._has3DLayers=!0),g.type==="circle"&&(this._hasCircleLayers=!0),g.type==="symbol"&&(this._hasSymbolLayers=!0)}};d(o),this._mergedLayers=u,this.updateDrapeFirstLayers(),this._buildingIndex.processLayersChanged()}terrainSetForDrapingOnly(){return!!this.terrain&&this.terrain.drapeRenderMode===0}getCamera(){return this.stylesheet.camera}setCamera(r){return this.stylesheet.camera=a.e({},this.stylesheet.camera,r),this.camera=this.stylesheet.camera,this}setProjection(r){r?this.stylesheet.projection=r:delete this.stylesheet.projection,this.mergeProjection(),this._updateMapProjection()}applyProjectionUpdate(){this._loaded&&(this.dispatcher.broadcast("setProjection",this.map.transform.projectionOptions),this.map.transform.projection.requiresDraping?(this.getTerrain()||this.stylesheet.terrain)&&!this.disableElevatedTerrain||this.setTerrainForDraping():this.terrainSetForDrapingOnly()&&this.setTerrain(null,0))}_updateMapProjection(){this.isRootStyle()&&(this.map._useExplicitProjection?this.applyProjectionUpdate():this.map._prioritizeAndUpdateProjection(null,this.projection))}_loadSprite(r){this._spriteRequest=function(o,u,d){let p,g,x;const b=a.f.devicePixelRatio>1?"@2x":"";let T=a.g(u.transformRequest(u.normalizeSpriteURL(o,b,".json"),a.R.SpriteJSON),(C,P)=>{T=null,x||(x=C,p=P,S())}),M=a.d(u.transformRequest(u.normalizeSpriteURL(o,b,".png"),a.R.SpriteImage),(C,P)=>{M=null,x||(x=C,g=P,S())});function S(){if(x)d(x);else if(p&&g){const C=a.f.getImageData(g),P={};for(const k in p){const{width:R,height:O,x:D,y:F,sdf:Z,pixelRatio:V,stretchX:q,stretchY:B,content:$}=p[k],Y=new a.h({width:R,height:O});a.h.copy(C,Y,{x:D,y:F},{x:0,y:0},{width:R,height:O}),P[k]={data:Y,pixelRatio:V,sdf:Z,stretchX:q,stretchY:B,content:$}}d(null,P)}}return{cancel(){T&&(T.cancel(),T=null),M&&(M.cancel(),M=null)}}}(r,this.map._requestManager,(o,u)=>{if(this._spriteRequest=null,o)this.fire(new a.a(o));else if(u)for(const d in u)this.imageManager.addImage(d,this.scope,u[d]);this.imageManager.setLoaded(!0,this.scope),this._availableImages=this.imageManager.listImages(this.scope),this.dispatcher.broadcast("setImages",{scope:this.scope,images:this._availableImages}),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0}),this.fire(new a.b("data",{dataType:"style"}))})}_validateLayer(r){const o=this.getOwnSource(r.source);if(!o)return;const u=r.sourceLayer;u&&(o.type==="geojson"||o.vectorLayerIds&&o.vectorLayerIds.indexOf(u)===-1)&&this.fire(new a.a(new Error(`Source layer "${u}" does not exist on source "${o.id}" as specified by style layer "${r.id}"`)))}
14loaded(){if(!this._loaded||Object.keys(this._changes.getUpdatedSourceCaches()).length)return!1;for(const r in this._sourceCaches)if(!this._sourceCaches[r].loaded())return!1;if(!this.imageManager.isLoaded()||!this.modelManager.isLoaded())return!1;for(const{style:r}of this.fragments)if(!r.loaded())return!1;return!0}_serializeImports(){if(this.stylesheet.imports)return this.stylesheet.imports.map((r,o)=>{const u=this.fragments[o];return u&&u.style&&(r.data=u.style.serialize()),r})}_serializeSources(){const r={};for(const o in this._sourceCaches){const u=this._sourceCaches[o].getSource();r[u.id]||(r[u.id]=u.serialize())}return r}_serializeLayers(r){const o=[];for(const u of r){const d=this._layers[u];d&&d.type!=="custom"&&o.push(d.serialize())}return o}hasLightTransitions(){return!(!this.light||!this.light.hasTransition())||!(!this.ambientLight||!this.ambientLight.hasTransition())||!(!this.directionalLight||!this.directionalLight.hasTransition())}hasFogTransition(){return!!this.fog&&this.fog.hasTransition()}hasTransitions(){if(this.hasLightTransitions()||this.hasFogTransition())return!0;for(const r in this._sourceCaches)if(this._sourceCaches[r].hasTransition())return!0;for(const r in this._layers)if(this._layers[r].hasTransition())return!0;return!1}get order(){return this.terrain?this._drapedFirstOrder:this._mergedOrder}isLayerDraped(r){return!!this.terrain&&(typeof r.isLayerDraped=="function"?r.isLayerDraped(this.getLayerSourceCache(r)):tf.has(r.type))}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading")}_checkLayer(r){const o=this.getOwnLayer(r);if(o)return o;this.fire(new a.a(new Error(`The layer '${r}' does not exist in the map's style.`)))}_checkSource(r){const o=this.getOwnSource(r);if(o)return o;this.fire(new a.a(new Error(`The source '${r}' does not exist in the map's style.`)))}update(r){if(!this._loaded)return;this.ambientLight&&this.ambientLight.recalculate(r),this.directionalLight&&this.directionalLight.recalculate(r);const o=this.calculateLightsBrightness();r.brightness=o||0,o!==this._brightness&&(this._brightness=o,this.dispatcher.broadcast("setBrightness",o));const u=this._changes.isDirty();if(this._changes.isDirty()){const p=this._changes.getLayerUpdatesByScope();for(const g in p){const{updatedIds:x,removedIds:b}=p[g];(x||b)&&this._updateWorkerLayers(g,x,b)}this.updateSourceCaches(),this._updateTilesForChangedImages(),this.updateLayers(r),this.light&&this.light.updateTransitions(r),this.ambientLight&&this.ambientLight.updateTransitions(r),this.directionalLight&&this.directionalLight.updateTransitions(r),this.fog&&this.fog.updateTransitions(r),this._changes.reset()}const d={};for(const p in this._mergedSourceCaches){const g=this._mergedSourceCaches[p];d[p]=g.used,g.used=!1,g.tileCoverLift=0}for(const p of this._mergedOrder){const g=this._mergedLayers[p];if(g.recalculate(r,this._availableImages),!g.isHidden(r.zoom)){const x=this.getLayerSourceCache(g);x&&(x.used=!0,x.tileCoverLift=Math.max(x.tileCoverLift,g.tileCoverLift()))}if(!this._precompileDone&&this._shouldPrecompile)for(let x=g.minzoom||0;x<(g.maxzoom||25.5);x++){const b=this.map.painter;if(b){const T=g.getProgramIds();if(!T)continue;for(const M of T){const S=g.getDefaultProgramParams(M,r.zoom);S&&(b.style=this,this.fog&&(b._fogVisible=!0,S.overrideFog=!0,b.getOrCreateProgram(M,S)),b._fogVisible=!1,S.overrideFog=!1,b.getOrCreateProgram(M,S),(this.stylesheet.terrain||this.stylesheet.projection&&this.stylesheet.projection.name==="globe")&&(S.overrideRtt=!0,b.getOrCreateProgram(M,S)))}}}}this._shouldPrecompile&&(this._precompileDone=!0);for(const p in d){const g=this._mergedSourceCaches[p];d[p]!==g.used&&g.getSource().fire(new a.b("data",{sourceDataType:"visibility",dataType:"source",sourceId:g.getSource().id}))}this.light&&this.light.recalculate(r),this.terrain&&this.terrain.recalculate(r),this.fog&&this.fog.recalculate(r),this.z=r.zoom,this._markersNeedUpdate&&(this._updateMarkersOpacity(),this._markersNeedUpdate=!1),u&&this.fire(new a.b("data",{dataType:"style"}))}_updateTilesForChangedImages(){const r=this._changes.getUpdatedImages();if(r.length){for(const o in this._sourceCaches)this._sourceCaches[o].reloadTilesForDependencies(["icons","patterns"],r);this._changes.resetUpdatedImages()}}_updateWorkerLayers(r,o,u){const d=this.getFragmentStyle(r);d&&this.dispatcher.broadcast("updateLayers",{layers:o?d._serializeLayers(o):[],scope:r,removedIds:u||[],options:d.options})}setState(r){if(this._checkLoaded(),oo(this,Zr(r)))return!1;(r=a.c1(r)).layers=th(r.layers);
14const o=function(d,p){if(!d)return[{command:Gt.setStyle,args:[p]}];let g=[];try{if(!Pt(d.version,p.version))return[{command:Gt.setStyle,args:[p]}];Pt(d.center,p.center)||g.push({command:Gt.setCenter,args:[p.center]}),Pt(d.zoom,p.zoom)||g.push({command:Gt.setZoom,args:[p.zoom]}),Pt(d.bearing,p.bearing)||g.push({command:Gt.setBearing,args:[p.bearing]}),Pt(d.pitch,p.pitch)||g.push({command:Gt.setPitch,args:[p.pitch]}),Pt(d.sprite,p.sprite)||g.push({command:Gt.setSprite,args:[p.sprite]}),Pt(d.glyphs,p.glyphs)||g.push({command:Gt.setGlyphs,args:[p.glyphs]}),Pt(d.imports,p.imports)||function(S=[],C=[],P){C=C||[];const k=(S=S||[]).map(eo),R=C.map(eo),O=S.reduce(Xa,{}),D=C.reduce(Xa,{}),F=k.slice();let Z,V,q,B;for(Z=0,V=0;Z<k.length;Z++)q=k[Z],D.hasOwnProperty(q)?V++:(P.push({command:Gt.removeImport,args:[q]}),F.splice(F.indexOf(q,V),1));for(Z=0,V=0;Z<R.length;Z++)q=R[R.length-1-Z],F[F.length-1-Z]!==q&&(O.hasOwnProperty(q)?(P.push({command:Gt.removeImport,args:[q]}),F.splice(F.lastIndexOf(q,F.length-V),1)):V++,B=F[F.length-Z],P.push({command:Gt.addImport,args:[D[q],B]}),F.splice(F.length-Z,0,q));for(const $ of C){const Y=O[$.id];Y&&!Pt(Y,$)&&P.push({command:Gt.updateImport,args:[$.id,$]})}}(d.imports,p.imports,g),Pt(d.transition,p.transition)||g.push({command:Gt.setTransition,args:[p.transition]}),Pt(d.light,p.light)||g.push({command:Gt.setLight,args:[p.light]}),Pt(d.fog,p.fog)||g.push({command:Gt.setFog,args:[p.fog]}),Pt(d.projection,p.projection)||g.push({command:Gt.setProjection,args:[p.projection]}),Pt(d.lights,p.lights)||g.push({command:Gt.setLights,args:[p.lights]}),Pt(d.camera,p.camera)||g.push({command:Gt.setCamera,args:[p.camera]});const x={},b=[];(function(S,C,P,k){let R;for(R in C=C||{},S=S||{})S.hasOwnProperty(R)&&(C.hasOwnProperty(R)||rc(R,P,k));for(R in C){if(!C.hasOwnProperty(R))continue;const O=C[R];S.hasOwnProperty(R)?Pt(S[R],O)||(S[R].type==="geojson"&&O.type==="geojson"&&Hd(S,C,R)?P.push({command:Gt.setGeoJSONSourceData,args:[R,O.data]}):Wd(R,C,P,k)):Hs(R,C,P)}})(d.sources,p.sources,b,x);const T=[];d.layers&&d.layers.forEach(S=>{S.source&&x[S.source]?g.push({command:Gt.removeLayer,args:[S.id]}):T.push(S)});let M=d.terrain;M&&x[M.source]&&(g.push({command:Gt.setTerrain,args:[void 0]}),M=void 0),g=g.concat(b),Pt(M,p.terrain)||g.push({command:Gt.setTerrain,args:[p.terrain]}),function(S,C,P){C=C||[];const k=(S=S||[]).map(eo),R=C.map(eo),O=S.reduce(Xa,{}),D=C.reduce(Xa,{}),F=k.slice(),Z=Object.create(null);let V,q,B,$,Y,K,ee;for(V=0,q=0;V<k.length;V++)B=k[V],D.hasOwnProperty(B)?q++:(P.push({command:Gt.removeLayer,args:[B]}),F.splice(F.indexOf(B,q),1));for(V=0,q=0;V<R.length;V++)B=R[R.length-1-V],F[F.length-1-V]!==B&&(O.hasOwnProperty(B)?(P.push({command:Gt.removeLayer,args:[B]}),F.splice(F.lastIndexOf(B,F.length-q),1)):q++,K=F[F.length-V],P.push({command:Gt.addLayer,args:[D[B],K]}),F.splice(F.length-V,0,B),Z[B]=!0);for(V=0;V<R.length;V++)if(B=R[V],$=O[B],Y=D[B],!Z[B]&&!Pt($,Y))if(Pt($.source,Y.source)&&Pt($["source-layer"],Y["source-layer"])&&Pt($.type,Y.type)){for(ee in Qn($.layout,Y.layout,P,B,null,Gt.setLayoutProperty),Qn($.paint,Y.paint,P,B,null,Gt.setPaintProperty),Pt($.slot,Y.slot)||P.push({command:Gt.setSlot,args:[B,Y.slot]}),Pt($.filter,Y.filter)||P.push({command:Gt.setFilter,args:[B,Y.filter]}),Pt($.minzoom,Y.minzoom)&&Pt($.maxzoom,Y.maxzoom)||P.push({command:Gt.setLayerZoomRange,args:[B,Y.minzoom,Y.maxzoom]}),$)$.hasOwnProperty(ee)&&ee!=="layout"&&ee!=="paint"&&ee!=="filter"&&ee!=="metadata"&&ee!=="minzoom"&&ee!=="maxzoom"&&ee!=="slot"&&(ee.indexOf("paint.")===0?Qn($[ee],Y[ee],P,B,ee.slice(6),Gt.setPaintProperty):Pt($[ee],Y[ee])||P.push({command:Gt.setLayerProperty,args:[B,ee,Y[ee]]}
14));for(ee in Y)Y.hasOwnProperty(ee)&&!$.hasOwnProperty(ee)&&ee!=="layout"&&ee!=="paint"&&ee!=="filter"&&ee!=="metadata"&&ee!=="minzoom"&&ee!=="maxzoom"&&ee!=="slot"&&(ee.indexOf("paint.")===0?Qn($[ee],Y[ee],P,B,ee.slice(6),Gt.setPaintProperty):Pt($[ee],Y[ee])||P.push({command:Gt.setLayerProperty,args:[B,ee,Y[ee]]}))}else P.push({command:Gt.removeLayer,args:[B]}),K=F[F.lastIndexOf(B)+1],P.push({command:Gt.addLayer,args:[Y,K]})}(T,p.layers,g)}catch(x){console.warn("Unable to compute style diff:",x),g=[{command:Gt.setStyle,args:[p]}]}return g}(this.serialize(),r).filter(d=>!(d.command in ms));if(o.length===0)return!1;const u=o.filter(d=>!(d.command in ch));if(u.length>0)throw new Error(`Unimplemented: ${u.map(d=>d.command).join(", ")}.`);return o.forEach(d=>{this[d.command].apply(this,d.args)}),this.stylesheet=r,this.mergeAll(),this.dispatcher.broadcast("setLayers",{layers:this._serializeLayers(this._order),scope:this.scope,options:this.options}),!0}addImage(r,o){return this.getImage(r)?this.fire(new a.a(new Error("An image with this name already exists."))):(this.imageManager.addImage(r,this.scope,o),this._afterImageUpdated(r),this)}updateImage(r,o){this.imageManager.updateImage(r,this.scope,o)}getImage(r){return this.imageManager.getImage(r,this.scope)}removeImage(r){return this.getImage(r)?(this.imageManager.removeImage(r,this.scope),this._afterImageUpdated(r),this):this.fire(new a.a(new Error("No image with this name exists.")))}_afterImageUpdated(r){this._availableImages=this.imageManager.listImages(this.scope),this._changes.updateImage(r),this.dispatcher.broadcast("setImages",{scope:this.scope,images:this._availableImages}),this.fire(new a.b("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this._availableImages.slice()}addModel(r,o,u={}){return this._checkLoaded(),this._validate(tt,`models.${r}`,o,null,u)||(this.modelManager.addModel(r,o,this.scope),this._changes.setDirty()),this}hasModel(r){return this.modelManager.hasModel(r,this.scope)}removeModel(r){return this.hasModel(r)?(this.modelManager.removeModel(r,this.scope),this):this.fire(new a.a(new Error("No model with this ID exists.")))}listModels(){return this._checkLoaded(),this.modelManager.listModels(this.scope)}addSource(r,o,u={}){if(this._checkLoaded(),this.getOwnSource(r)!==void 0)throw new Error(`There is already a source with ID "${r}".`);if(!o.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(o).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(o.type)>=0&&this._validate(An,`sources.${r}`,o,null,u))return;this.map&&this.map._collectResourceTiming&&(o.collectResourceTiming=!0);const d=Wi(r,o,this.dispatcher,this);d.scope=this.scope,d.setEventedParent(this,()=>({isSourceLoaded:this._isSourceCacheLoaded(d.id),source:d.serialize(),sourceId:d.id}));const p=g=>{const x=(g?"symbol:":"other:")+d.id,b=a.ag(x,this.scope),T=this._sourceCaches[x]=new nn(b,d,g);(g?this._symbolSourceCaches:this._otherSourceCaches)[d.id]=T,T.onAdd(this.map)};p(!1),o.type!=="vector"&&o.type!=="geojson"||p(!0),d.onAdd&&d.onAdd(this.map),u.isInitialLoad||(this.mergeSources(),this._changes.setDirty())}removeSource(r){this._checkLoaded();const o=this.getOwnSource(r);if(!o)throw new Error("There is no source with this ID");for(const d in this._layers)if(this._layers[d].source===r)return this.fire(new a.a(new Error(`Source "${r}" cannot be removed while layer "${d}" is using it.`)));if(this.terrain&&this.terrain.scope===this.scope&&this.terrain.get().source===r)return this.fire(new a.a(new Error(`Source "${r}" cannot be removed while terrain is using it.`)));const u=this.getOwnSourceCaches(r);for(const d of u){const p=a.c3(d.id);delete this._sourceCaches[p],this._changes.discardSourceCacheUpdate(d.id),d.fire(new a.b("data",{sourceDataType:"metadata",dataType:"source",sourceId:d.getSource().id})),d.setEventedParent(null),d.clearTiles()}return delete this._otherSourceCaches[r],delete this._symbolSourceCaches[r],this.mergeSources(),o.setEventedParent(null),o.onRemove&&o.onRemove(this.map),this._changes.setDirty(),this}setGeoJSONSourceData(r,o){this._checkLoaded(),this.getOwnSource(r).setData(o),this._changes.setDirty()}getOwnSource(r){const o=this.getOwnSourceCache(r);return o&&o.getSource()}getOwnSources(){const r=[];for(const o in this._otherSourceCaches){const u=this.getOwnSourceCache(o);u&&r.push(u.getSource())}return r}areTilesLoaded(){const r=this._mergedSourceCaches;for(const o in r){const u=r[o]._tiles;for(const d in u){const p=u[d];if(p.state!=="loaded"&&p.state!=="errored")return!1}}return!0}setLights(r){if(this._checkLoaded(),!r)return delete this.ambientLight,void delete this.directionalLight;const o=this._getTransitionParameters();
14for(const d of r){if(this._validate(Te,"lights",d))return;switch(d.type){case"ambient":if(this.ambientLight){const p=this.ambientLight;p.set(d),p.updateTransitions(o)}else this.ambientLight=new _r(d,Er,this.scope,this.options);break;case"directional":if(this.directionalLight){const p=this.directionalLight;p.set(d),p.updateTransitions(o)}else this.directionalLight=new _r(d,Zi,this.scope,this.options)}}const u=new a.K(this.z||0,o);this.ambientLight&&this.ambientLight.recalculate(u),this.directionalLight&&this.directionalLight.recalculate(u),this._brightness=this.calculateLightsBrightness(),this.dispatcher.broadcast("setBrightness",this._brightness)}calculateLightsBrightness(){const r=this.directionalLight,o=this.ambientLight;if(!r||!o)return;const u=S=>.2126*(S[0]<=.03928?S[0]/12.92:Math.pow((S[0]+.055)/1.055,2.4))+.7152*(S[1]<=.03928?S[1]/12.92:Math.pow((S[1]+.055)/1.055,2.4))+.0722*(S[2]<=.03928?S[2]/12.92:Math.pow((S[2]+.055)/1.055,2.4)),d=r.properties.get("color").toArray01(),p=r.properties.get("intensity"),g=r.properties.get("direction"),x=1-a.bQ(g.x,g.y,g.z)[2]/90,b=u(d)*p*x,T=o.properties.get("color").toArray01(),M=o.properties.get("intensity");return(b+u(T)*M)/2}getBrightness(){return this._brightness}getLights(){if(!this.enable3dLights())return null;const r=[];return this.directionalLight&&r.push(this.directionalLight.get()),this.ambientLight&&r.push(this.ambientLight.get()),r}enable3dLights(){return!!this.ambientLight&&!!this.directionalLight}getFragmentStyle(r){if(!r)return this;if(a.c4(r)){const o=a.c5(r),u=this.fragments.find(({id:p})=>p===o);if(!u)throw new Error(`Style import not found: ${r}`);const d=a.c3(r);return u.style.getFragmentStyle(d)}{const o=this.fragments.find(({id:u})=>u===r);if(!o)throw new Error(`Style import not found: ${r}`);return o.style}}getConfigProperty(r,o){const u=this.getFragmentStyle(r);if(!u)return null;const d=a.ag(o,u.scope),p=u.options.get(d),g=p?p.value||p.default:null;return g?g.serialize():null}setConfigProperty(r,o,u){const d=a.r(u);if(d.result!=="success")return void oo(this,d.value);const p=d.value.expression,g=this.getFragmentStyle(r);if(!g)return;const x=a.ag(o,g.scope),b=g.options.get(x);b&&(this.options.set(x,{...b,value:p}),this.updateConfigDependencies())}setConfig(r,o){if(this._config=r,r||o)if(o)for(const u in o){let d,p;const g=a.r(o[u].default);if(g.result==="success"&&(d=g.value.expression),r&&r[u]!==void 0){const C=a.r(r[u]);C.result==="success"&&(p=C.value.expression)}const{minValue:x,maxValue:b,stepValue:T,type:M,values:S}=o[u];if(d){const C=a.ag(u,this.scope);this.options.set(C,{default:d,value:p,minValue:x,maxValue:b,stepValue:T,type:M,values:S})}else this.fire(new a.a(new Error(`No schema defined for config option "${u}".`)))}else this.fire(new a.a(new Error("Attempting to set config for a style without schema.")))}updateConfigDependencies(){for(const r of this._configDependentLayers){const o=this.getLayer(r);o&&(o.possiblyEvaluateVisibility(),this._updateLayer(o))}this.ambientLight&&this.ambientLight.updateConfig(this.options),this.directionalLight&&this.directionalLight.updateConfig(this.options),this.fog&&this.fog.updateConfig(this.options),this._changes.setDirty()}addLayer(r,o,u={}){this._checkLoaded();const d=r.id;if(this._layers[d])return void this.fire(new a.a(new Error(`Layer with i
14d "${d}" already exists on this map`)));let p;if(r.type==="custom"){if(oo(this,a.c6(r)))return;p=a.c2(r,this.scope,this.options)}else{if(typeof r.source=="object"&&(this.addSource(d,r.source),r=a.c1(r),r=a.e(r,{source:d})),this._validate(te,`layers.${d}`,r,{arrayIndex:-1},u))return;p=a.c2(r,this.scope,this.options),this._validateLayer(p),p.setEventedParent(this,{layer:{id:d}}),this._serializedLayers[p.id]=p.serialize()}p.isConfigDependent&&this._configDependentLayers.add(p.fqid);let g=this._order.length;if(o){const M=this._order.indexOf(o);if(M===-1)return void this.fire(new a.a(new Error(`Layer with id "${o}" does not exist on this map.`)));p.slot===this._layers[o].slot?g=M:a.w(`Layer with id "${o}" has a different slot. Layers can only be rearranged within the same slot.`)}this._order.splice(g,0,d),this._layerOrderChanged=!0,this._layers[d]=p;const x=this.getOwnLayerSourceCache(p),b=!!this.directionalLight&&this.directionalLight.shadowsEnabled();x&&p.canCastShadows()&&b&&(x.castsShadows=!0);const T=this._changes.getRemovedLayer(p);if(T&&p.source&&x&&p.type!=="custom"){this._changes.discardLayerRemoval(p);const M=a.ag(p.source,p.scope);T.type!==p.type?this._changes.updateSourceCache(M,"clear"):(this._changes.updateSourceCache(M,"reload"),x.pause())}this._updateLayer(p),p.onAdd&&p.onAdd(this.map),p.scope=this.scope,this.mergeLayers()}moveLayer(r,o){this._checkLoaded();const u=this._checkLayer(r);if(!u||r===o)return;const d=this._order.indexOf(r);this._order.splice(d,1);let p=this._order.length;if(o){const g=this._order.indexOf(o);
14if(g===-1)return void this.fire(new a.a(new Error(`Layer with id "${o}" does not exist on this map.`)));u.slot===this._layers[o].slot?p=g:a.w(`Layer with id "${o}" has a different slot. Layers can only be rearranged within the same slot.`)}this._order.splice(p,0,r),this._changes.setDirty(),this._layerOrderChanged=!0,this.mergeLayers()}removeLayer(r){this._checkLoaded();const o=this._checkLayer(r);if(!o)return;o.setEventedParent(null);const u=this._order.indexOf(r);this._order.splice(u,1),delete this._layers[r],delete this._serializedLayers[r],this._changes.setDirty(),this._layerOrderChanged=!0,this._configDependentLayers.delete(o.fqid),this._changes.removeLayer(o);const d=this.getOwnLayerSourceCache(o);if(d&&d.castsShadows){let p=!1;for(const g in this._layers)if(this._layers[g].source===o.source&&this._layers[g].canCastShadows()){p=!0;break}d.castsShadows=p}o.onRemove&&o.onRemove(this.map),this.mergeLayers()}getOwnLayer(r){return this._layers[r]}hasLayer(r){return r in this._mergedLayers}hasLayerType(r){for(const o in this._layers)if(this._layers[o].type===r)return!0;return!1}setLayerZoomRange(r,o,u){this._checkLoaded();const d=this._checkLayer(r);d&&(d.minzoom===o&&d.maxzoom===u||(o!=null&&(d.minzoom=o),u!=null&&(d.maxzoom=u),this._updateLayer(d)))}setSlot(r,o){this._checkLoaded();const u=this._checkLayer(r);u&&u.slot!==o&&(u.slot=o,this._updateLayer(u))}setFilter(r,o,u={}){this._checkLoaded();const d=this._checkLayer(r);if(d&&!Pt(d.filter,o))return o==null?(d.filter=void 0,void this._updateLayer(d)):void(this._validate(ye,`layers.${d.id}.filter`,o,{layerType:d.type},u)||(d.filter=a.c1(o),this._updateLayer(d)))}getFilter(r){const o=this._checkLayer(r);if(o)return a.c1(o.filter)}setLayoutProperty(r,o,u,d={}){this._checkLoaded();const p=this._checkLayer(r);if(p&&!Pt(p.getLayoutProperty(o),u)){if(u!=null&&(!d||d.validate!==!1)&&oo(p,ze.call(Zr,{key:`layers.${r}.layout.${o}`,layerType:p.type,objectKey:o,value:u,styleSpec:a.D,style:{glyphs:!0,sprite:!0}})))return;p.setLayoutProperty(o,u),p.isConfigDependent&&this._configDependentLayers.add(p.fqid),this._updateLayer(p)}}getLayoutProperty(r,o){const u=this._checkLayer(r);if(u)return u.getLayoutProperty(o)}setPaintProperty(r,o,u,d={}){this._checkLoaded();const p=this._checkLayer(r);if(!p||Pt(p.getPaintProperty(o),u)||u!=null&&(!d||d.validate!==!1)&&oo(p,Ee.call(Zr,{key:`layers.${r}.paint.${o}`,layerType:p.type,objectKey:o,value:u,styleSpec:a.D})))return;const g=p.setPaintProperty(o,u);p.isConfigDependent&&this._configDependentLayers.add(p.fqid),g&&this._updateLayer(p),this._changes.updatePaintProperties(p)}getPaintProperty(r,o){const u=this._checkLayer(r);if(u)return u.getPaintProperty(o)}setFeatureState(r,o){this._checkLoaded();const u=r.source,d=r.sourceLayer,p=this._checkSource(u);if(!p)return;const g=p.type;if(g==="geojson"&&d)return void this.fire(new a.a(new Error("GeoJSON sources cannot have a sourceLayer parameter.")));if(g==="vector"&&!d)return void this.fire(new a.a(new Error("The sourceLayer parameter must be provided for vector source types.")));r.id===void 0&&this.fire(new a.a(new Error("The feature id parameter must be provided.")));const x=this.getOwnSourceCaches(u);for(const b of x)b.setFeatureState(d,r.id,o)}removeFeatureState(r,o){this._checkLoaded();const u=r.source,d=this._checkSource(u);if(!d)return;const p=d.type,g=p==="vector"?r.sourceLayer:void 0;if(p==="vector"&&!g)return void this.fire(new a.a(new Error("The sourceLayer parameter must be provided for vector source types.")));if(o&&typeof r.id!="string"&&typeof r.id!="number")return void this.fire(new a.a(new Error("A feature id is required to remove its specific state property.")));const x=this.getOwnSourceCaches(u);for(const b of x)b.removeFeatureState(g,r.id,o)}getFeatureState(r){this._checkLoaded();const o=r.source,u=r.sourceLayer,d=this._checkSource(o);if(d){if(d.type!=="vector"||u)return r.id===void 0&&this.fire(new a.a(new Error("The feature id parameter must be provided."))),this.getOwnSourceCaches(o)[0].getFeatureState(u,r.id);this.fire(new a.a(new Error("The sourceLayer parameter must be provided for vector source types.")))}}setTransition(r){return this.stylesheet.transition=a.e({},this.stylesheet.transition,r),this.transition=this.stylesheet.transition,this}getTransition(){return a.e({},this.stylesheet.transition)}serialize(){this._checkLoaded();const r=this.getTerrain(),o=r&&this.terrain&&this.terrain.scope===this.scope?r:this.stylesheet.terrain;return a.c7({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,imports:this._serializeImports(),schema:this.stylesheet.schema,camera:this.stylesheet.camera,light:this.stylesheet.light,lights:this.stylesheet.lights,terrain:o,fog:this.stylesheet.fog,center:this.stylesheet.center,zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,projection:this.stylesheet.projection,sources:this._serializeSources(),layers:this._serializeLayers(this._order)},u=>u!==void 0)}_updateLayer(r){this._changes.updateLayer(r);const o=this.getLayerSourceCache(r),u=a.ag(r.source,r.scope),d=this._changes.getUpd
14atedSourceCaches();r.source&&!d[u]&&o&&o.getSource().type!=="raster"&&(this._changes.updateSourceCache(u,"reload"),o.pause()),r.invalidateCompiledFilter()}_flattenAndSortRenderedFeatures(r){const o=x=>this._mergedLayers[x].type==="fill-extrusion"||this._mergedLayers[x].type==="model",u=this.order,d={},p=[];for(let x=u.length-1;x>=0;x--){const b=u[x];if(o(b)){d[b]=x;for(const T of r){const M=T[b];if(M)for(const S of M)p.push(S)}}}p.sort((x,b)=>b.intersectionZ-x.intersectionZ);const g=[];for(let x=u.length-1;x>=0;x--){const b=u[x];if(o(b))for(let T=p.length-1;T>=0;T--){const M=p[T].feature;if(d[M.layer.id]<x)break;g.push(M),p.pop()}else for(const T of r){const M=T[b];if(M)for(const S of M)g.push(S.feature)}}return g}queryRenderedFeatures(r,o,u){o&&o.filter&&this._validate(ye,"queryRenderedFeatures.filter",o.filter,null,o),o.scope=this.scope,o.availableImages=this._availableImages,o.serializedLayers=this._serializedLayers;const d={};if(o&&o.layers){if(!Array.isArray(o.layers))return this.fire(new a.a(new Error("parameters.layers must be an Array."))),[];for(const T of o.layers){const M=this._mergedLayers[T];if(!M)return this.fire(new a.a(new Error(`The layer '${T}' does not exist in the map's style and cannot be queried for features.`))),[];d[M.source]=!0}}const p=[],g=o.serializedLayers||{},x=o&&o.layers?o.layers.some(T=>{const M=this.getLayer(T);return M&&M.is3D()}):this.has3DLayers(),b=Ui.createFromScreenPoints(r,u);for(const T in this._mergedSourceCaches){const M=this._mergedSourceCaches[T].getSource();if(!M||M.scope!==o.scope)continue;const S=this._mergedSourceCaches[T].getSource().id;o.layers&&!d[S]||p.push(ic(this._mergedSourceCaches[T],this._mergedLayers,g,b,o,u,x,!!this.map._showQueryGeometry))}return this.placement&&p.push(function(T,M,S,C,P,k,R){const O={},D=k.queryRenderedSymbols(C),F=[];for(const Z of Object.keys(D).map(Number))F.push(R[Z]);F.sort(ls);for(const Z of F){const V=Z.featureIndex.lookupSymbolFeatures(D[Z.bucketInstanceId],M,Z.bucketIndex,Z.sourceLayerIndex,P.filter,P.layers,P.availableImages,T);for(const q in V){const B=O[q]=O[q]||[],$=V[q];$.sort((Y,K)=>{const ee=Z.featureSortOrder;if(ee){const ce=ee.indexOf(Y.featureIndex);return ee.indexOf(K.featureIndex)-ce}return K.featureIndex-Y.featureIndex});for(const Y of $)B.push(Y)}}for(const Z in O)O[Z].forEach(V=>{const q=V.feature,B=S(T[Z]);if(!B)return;const $=B.getFeatureState(q.layer["source-layer"],q.id);q.source=q.layer.source,q.layer["source-layer"]&&(q.sourceLayer=q.layer["source-layer"]),q.state=$});return O}(this._mergedLayers,g,this.getLayerSourceCache.bind(this),b.screenGeometry,o,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(p)}querySourceFeatures(r,o){o&&o.filter&&this._validate(ye,"querySourceFeatures.filter",o.filter,null,o);const u=this.getOwnSourceCaches(r);let d=[];for(const p of u)d=d.concat(Cn(p,o));return d}addSourceType(r,o,u){return sn.getSourceType(r)?u(new Error(`A source type called "${r}" already exists.`)):(sn.setSourceType(r,o),o.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:r,url:o.workerSourceURL},u):u(null,null))}getFlatLight(){return this.light.getLight()}setFlatLight(r,o,u={}){this._checkLoaded();const d=this.light.getLight();let p=!1;for(const x in r)if(!Pt(r[x],d[x])){p=!0;break}if(!p)return;const g=this._getTransitionParameters();this.light.setLight(r,o,u),this.light.updateTransitions(g)}getTerrain(){return this.terrain&&this.terrain.drapeRenderMode===1?this.terrain.get():null}setTerrainForDraping(){this.setTerrain({source:"",exaggeration:0},0)}setTerrain(r,o=1){if(this._checkLoaded(),!r)return this.terrainSetForDrapingOnly()&&o!==0||delete this.terrain,r===null?this.stylesheet.terrain=null:delete this.stylesheet.terrain,this._force3DLayerUpdate(),void(this._markersNeedUpdate=!0);let u=r;const d=r.source==null;if(o===1){if(typeof u.source=="object"){const x="terrain-dem-src";this.addSource(x,u.source),u=a.c1(u),u=a.e(u,{source:x})}const p=a.e({},u),g={};if(this.terrain&&d){p.source=this.terrain.get().source;const x=this.terrain?this.getFragmentStyle(this.terrain.scope):null;x&&(g.style=x.serialize())}
14if(this._validate(U,"terrain",p,g))return}if(!this.terrain||this.terrain.scope!==this.scope&&!d||this.terrain&&o!==this.terrain.drapeRenderMode){if(!u)return;this._createTerrain(u,o),this.fire(new a.b("data",{dataType:"style"}))}else{const p=this.terrain,g=p.get();for(const x of Object.keys(a.D.terrain))!u.hasOwnProperty(x)&&a.D.terrain[x].default&&(u[x]=a.D.terrain[x].default);for(const x in r)if(!Pt(r[x],g[x])){p.set(r,this.options),this.stylesheet.terrain=r;const b=this._getTransitionParameters({duration:0});p.updateTransitions(b),this.fire(new a.b("data",{dataType:"style"}));break}}this.mergeTerrain(),this.updateDrapeFirstLayers(),this._markersNeedUpdate=!0}_createFog(r){const o=this.fog=new vr(r,this.map.transform,this.scope,this.options);this.stylesheet.fog=o.get();const u=this._getTransitionParameters({duration:0});o.updateTransitions(u)}_updateMarkersOpacity(){this.map._markers.length!==0&&this.map._requestDomTask(()=>{for(const r of this.map._markers)r._evaluateOpacity()})}getFog(){return this.fog?this.fog.get():null}setFog(r){if(this._checkLoaded(),!r)return delete this.fog,delete this.stylesheet.fog,void(this._markersNeedUpdate=!0);if(this.fog){const o=this.fog;if(!Pt(o.get(),r)){o.set(r,this.options),this.stylesheet.fog=o.get();const u=this._getTransitionParameters({duration:0});o.updateTransitions(u)}}else this._createFog(r);this._markersNeedUpdate=!0}_getTransitionParameters(r){return{now:a.f.now(),transition:a.e(this.transition,r)}}updateDrapeFirstLayers(){if(!this.terrain)return;const r=[],o=[];for(const u in this._mergedLayers)this.isLayerDraped(this._mergedLayers[u])?r.push(u):o.push(u);this._drapedFirstOrder=[],this._drapedFirstOrder.push(...r),this._drapedFirstOrder.push(...o)}_createTerrain(r,o){const u=this.terrain=new hi(r,o,this.scope,this.options);o===1&&(this.stylesheet.terrain=r),this.mergeTerrain(),this.updateDrapeFirstLayers(),this._force3DLayerUpdate();const d=this._getTransitionParameters({duration:0});u.updateTransitions(d)}_force3DLayerUpdate(){for(const r in this._layers){const o=this._layers[r];o.type==="fill-extrusion"&&this._updateLayer(o)}}_forceSymbolLayerUpdate(){for(const r in this._layers){const o=this._layers[r];o.type==="symbol"&&this._updateLayer(o)}}_validate(r,o,u,d,p={}){if(p&&p.validate===!1)return!1;const g=a.e({},this.serialize());return oo(this,r.call(Zr,a.e({key:o,style:g,value:u,styleSpec:a.D},d)))}_remove(){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),a.c8.off("pluginStateChange",this._rtlTextPluginCallback);for(const r in this._mergedLayers)this._mergedLayers[r].setEventedParent(null);for(const r in this._mergedSourceCaches)this._mergedSourceCaches[r].clearTiles(),this._mergedSourceCaches[r].setEventedParent(null);this.setEventedParent(null),delete this.fog,delete this.terrain,delete this.ambientLight,delete this.directionalLight,this.isRootStyle()&&(this.imageManager.setEventedParent(null),this.modelManager.setEventedParent(null),this.dispatcher.remove())}clearSource(r){const o=this.getSourceCaches(r);for(const u of o)u.clearTiles()}clearSources(){for(const r in this._mergedSourceCaches)this._mergedSourceCaches[r].clearTiles()}reloadSource(r){const o=this.getSourceCaches(r);for(const u of o)u.resume(),u.reload()}reloadSources(){for(const r of this.getSources())r.reload&&r.reload()}updateSources(r){let o;this.directionalLight&&(o=il(this.directionalLight));for(const u in this._mergedSourceCaches)this._mergedSourceCaches[u].update(r,void 0,void 0,o)}_generateCollisionBoxes(){for(const r in this._sourceCaches){const o=this._sourceCaches[r];o.resume(),o.reload()}}_updatePlacement(r,o,u,d,p=!1){let g=!1,x=!1;const b={},T={};for(const M of this._mergedOrder){const S=this._mergedLayers[M];if(S.type!=="symbol")continue;const C=a.ag(S.source,S.scope);let P=b[C];if(!P){const R=this.getLayerSourceCache(S);if(!R)continue;const O=R.getRenderableIds(!0).map(D=>R.getTileByID(D));T[C]=O.slice(),P=b[C]=O.sort((D,F)=>F.tileID.overscaledZ-D.tileID.overscaledZ||(D.tileID.isLessThan(F.tileID)?-1:1))}const k=this.crossTileSymbolIndex.addLayer(S,P,r.center.lng,r.projection);g=g||k}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._mergedOrder),p=p||this._layerOrderChanged||u===0,this._layerOrderChanged&&this.fire(new a.b("neworder")),(p||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(a.f.now(),r.zoom))&&(this.pauseablePlacement=new Qa(r,this._mergedOrder,p,o,u,d,this.placement,this.fog&&r.projection.supportsFog?this.fog.state:null,this._buildingIndex),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._mergedOrder,this._mergedLayers,b,T),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(a.f.now()),x=!0),g&&this.pauseablePlacement.placement.setStale()),x||g){this._buildingIndex.onNewFrame(r.zoom);for(const M of this._mergedOrder){const S=this._mergedLayers[M];S.type==="symbol"&&this.placement.updateLayerOpacities(S,b[a.ag(S.source,S.scope)])}}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(a.f.now())}_releaseSymbolFadeTiles(){for(const r in this._sourceCaches)this._sourceCaches[r].releaseSymbolFadeTiles()}addImport(r,o){this._checkLoaded();const u=this.stylesheet.imports=this.stylesheet.imports||[];if(u.findIndex(({id:p})=>p===r.id)!==-1)return this.fire(new a.a(new Error(`Import with i
14d '${r.id}' already exists in the map's style.`)));if(!o)return u.push(r),this._loadImports([r],!0),this;const d=u.findIndex(({id:p})=>p===o);return d===-1?this.fire(new a.a(new Error(`Import with id "${o}" does not exist on this map.`))):(this.stylesheet.imports=u.slice(0,d).concat(r).concat(u.slice(d)),this._loadImports([r],!0,o),this)}updateImport(r,o){this._checkLoaded();const u=this.stylesheet.imports||[],d=this.getImportIndex(r);return d===-1?this:typeof o=="string"?(this.setImportUrl(r,o),this):(o.url&&o.url!==u[d].url&&this.setImportUrl(r,o.url),Pt(o.config,u[d].config)||this.setImportConfig(r,o.config),Pt(o.data,u[d].data)||this.setImportData(r,o.data),this)}moveImport(r,o){this._checkLoaded();let u=this.stylesheet.imports||[];const d=this.getImportIndex(r);if(d===-1)return this;const p=this.getImportIndex(o);if(p===-1)return this;const g=u[d],x=this.fragments[d];return u=u.filter(({id:b})=>b!==r),this.fragments=this.fragments.filter(({id:b})=>b!==r),this.stylesheet.imports=u.slice(0,p).concat(g).concat(u.slice(p)),this.fragments=this.fragments.slice(0,p).concat(x).concat(this.fragments.slice(p)),this.mergeLayers(),this}setImportUrl(r,o){this._checkLoaded();const u=this.stylesheet.imports||[],d=this.getImportIndex(r);if(d===-1)return this;u[d].url=o;const p=this.fragments[d];return p.style=this._createFragmentStyle(u[d]),p.style.on("style.import.load",()=>this.mergeAll()),p.style.loadURL(o),this}setImportData(r,o){this._checkLoaded();const u=this.getImportIndex(r),d=this.stylesheet.imports||[];return u===-1?this:o?(this.fragments[u].style.setState(o),this._reloadImports(),this):(delete d[u].data,this.setImportUrl(r,d[u].url))}setImportConfig(r,o){this._checkLoaded();const u=this.getImportIndex(r),d=this.stylesheet.imports||[];if(u===-1)return this;o?d[u].config=o:delete d[u].config;const p=this.fragments[u],g=p.style.stylesheet&&p.style.stylesheet.schema;return p.config=o,p.style.setConfig(o,g),this.updateConfigDependencies(),this}removeImport(r){this._checkLoaded();const o=this.stylesheet.imports||[],u=this.getImportIndex(r);return u===-1||(o.splice(u,1),this.fragments[u].style._remove(),this.fragments.splice(u,1),this._reloadImports()),this}getImportIndex(r){const o=(this.stylesheet.imports||[]).findIndex(u=>u.id===r);return o===-1&&this.fire(new a.a(new Error(`Import '${r}' does not exist in the map's style and cannot be updated.`))),o}getLayer(r){return this._mergedLayers[r]}getSources(){const r=[];for(const o in this._mergedOtherSourceCaches){const u=this._mergedOtherSourceCaches[o];u&&r.push(u.getSource())}return r}getSource(r,o){const u=this.getSourceCache(r,o);return u&&u.getSource()}getLayerSource(r){const o=this.getLayerSourceCache(r);return o&&o.getSource()}getSourceCache(r,o){const u=a.ag(r,o);return this._mergedOtherSourceCaches[u]}getLayerSourceCache(r){const o=a.ag(r.source,r.scope);return r.type==="symbol"?this._mergedSymbolSourceCaches[o]:this._mergedOtherSourceCaches[o]}getSourceCaches(r){const o=[];return this._mergedOtherSourceCaches[r]&&o.push(this._mergedOtherSourceCaches[r]),this._mergedSymbolSourceCaches[r]&&o.push(this._mergedSymbolSourceCaches[r]),o}updateSourceCaches(){const r=this._changes.getUpdatedSourceCaches();for(const o in r){const u=r[o];u==="reload"?this.reloadSource(o):u==="clear"&&this.clearSource(o)}}updateLayers(r){const o=this._changes.getUpdatedPaintProperties();for(const u of o){const d=this.getLayer(u);d&&d.updateTransitions(r)}}getImages(r,o,u){this.imageManager.getImages(o.icons,o.scope,u),this._updateTilesForChangedImages();const d=p=>{p&&p.setDependencies(o.tileID.key,o.type,o.icons)};d(this._otherSourceCaches[o.source]),d(this._symbolSourceCaches[o.source])}getGlyphs(r,o,u){this.glyphManager.getGlyphs(o.stacks,o.scope,u)}getResource(r,o,u){return a.c9(o,u)}getOwnSourceCache(r){return this._otherSourceCaches[r]}getOwnLayerSourceCache(r){return r.type==="symbol"?this._symbolSourceCaches[r.source]:this._otherSourceCaches[r.source]}getOwnSourceCaches(r){const o=[];return this._otherSourceCaches[r]&&o.push(this._otherSourceCaches[r]),this._symbolSourceCaches[r]&&o.push(this._symbolSourceCaches[r]),o}_isSourceCacheLoaded(r){const o=this.getOwnSourceCaches(r);return o.length===0?(this.fire(new a.a(new Error(`There is no source with ID '${r}'`))),!1):o.every(u=>u.loaded())}has3DLayers(){return this._has3DLayers}hasSymbolLayers(){return this._hasSymbolLayers}hasCircleLayers(){return this._hasCircleLayers}_clearWorkerCaches(){this.dispatcher.broadcast("clearCaches")}
14destroy(){this._clearWorkerCaches(),this.fragments.forEach(r=>{r.style._remove()}),this.terrainSetForDrapingOnly()&&(delete this.terrain,delete this.stylesheet.terrain)}}sn.getSourceType=function(c){return In[c]},sn.setSourceType=function(c,r){In[c]=r},sn.registerForPluginStateChange=a.bV;var rl=` 15#define EPSILON 0.0000001 16#define PI 3.141592653589793 17#ifdef RENDER_CUTOFF 18float cutoff_opacity(vec4 cutoff_params,float depth) {float near=cutoff_params.x;float far=cutoff_params.y;float cutoffStart=cutoff_params.z;float cutoffEnd=cutoff_params.w;float linearDepth=(depth-near)/(far-near);return clamp((linearDepth-cutoffStart)/(cutoffEnd-cutoffStart),0.0,1.0);} 19#endif`,nl=` 20out vec4 glFragColor;highp float unpack_depth(highp vec4 rgba_depth) 21{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}highp vec4 pack_depth(highp float ndc_z) {highp float depth=ndc_z*0.5+0.5;const highp vec4 bit_shift=vec4(255.0*255.0*255.0,255.0*255.0,255.0,1.0);const highp vec4 bit_mask =vec4(0.0,1.0/255.0,1.0/255.0,1.0/255.0);highp vec4 res=fract(depth*bit_shift);res-=res.xxyz*bit_mask;return res;} 22#ifdef INDICATOR_CUTOUT 23uniform vec2 u_indicator_cutout_centers;uniform vec4 u_indicator_cutout_params; 24#endif 25vec4 applyCutout(vec4 color) { 26#ifdef INDICATOR_CUTOUT 27float holeMinOpacity=u_indicator_cutout_params.x;float holeRadius=max(u_indicator_cutout_params.y,0.0);float holeAspectRatio=u_indicator_cutout_params.z;float fadeStart=u_indicator_cutout_params.w;float distA=distance(vec2(gl_FragCoord.x,gl_FragCoord.y*holeAspectRatio),vec2(u_indicator_cutout_centers[0],u_indicator_cutout_centers[1]*holeAspectRatio));return color*min(smoothstep(fadeStart,holeRadius,distA)+holeMinOpacity,1.0); 28#else 29return color; 30#endif 31} 32#ifdef DEBUG_WIREFRAME 33#define HANDLE_WIREFRAME_DEBUG \\ 34glFragColor=vec4(0.7,0.0,0.0,0.7); \\ 35gl_FragDepth=gl_FragCoord.z-0.0001; 36#else 37#define HANDLE_WIREFRAME_DEBUG 38#endif 39#ifdef RENDER_CUTOFF 40uniform highp vec4 u_cutoff_params;in float v_cutoff_opacity; 41#endif 42vec4 textureLodCustom(sampler2D image,vec2 pos,vec2 lod_coord) {vec2 size=vec2(textureSize(image,0));vec2 dx=dFdx(lod_coord.xy*size);vec2 dy=dFdy(lod_coord.xy*size);float delta_max_sqr=max(dot(dx,dx),dot(dy,dy));float lod=0.5*log2(delta_max_sqr);return textureLod(image,pos,lod);}`,ol=` 43#define EXTENT 8192.0 44#define RAD_TO_DEG 180.0/PI 45#define DEG_TO_RAD PI/180.0 46#define GLOBE_RADIUS EXTENT/PI/2.0 47float wrap(float n,float min,float max) {float d=max-min;float w=mod(mod(n-min,d)+d,d)+min;return (w==min) ? max : w;} 48#ifdef PROJECTION_GLOBE_VIEW 49vec3 mercator_tile_position(mat4 matrix,vec2 tile_anchor,vec3 tile_id,vec2 mercator_center) { 50#ifndef PROJECTED_POS_ON_VIEWPORT 51float tiles=tile_id.z;vec2 mercator=(tile_anchor/EXTENT+tile_id.xy)/tiles;mercator-=mercator_center;mercator.x=wrap(mercator.x,-0.5,0.5);vec4 mercator_tile=vec4(mercator.xy*EXTENT,EXTENT/(2.0*PI),1.0);mercator_tile=matrix*mercator_tile;return mercator_tile.xyz; 52#else 53return vec3(0.0); 54#endif 55}vec3 mix_globe_mercator(vec3 globe,vec3 mercator,float t) {return mix(globe,mercator,t);}mat3 globe_mercator_surface_vectors(vec3 pos_normal,vec3 up_dir,float zoom_transition) {vec3 normal=zoom_transition==0.0 ? pos_normal : normalize(mix(pos_normal,up_dir,zoom_transition));vec3 xAxis=normalize(vec3(normal.z,0.0,-normal.x));vec3 yAxis=normalize(cross(normal,xAxis));return mat3(xAxis,yAxis,normal);} 56#endif 57vec2 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( 58unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0 59);}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);
59return (tile_units_to_pixels*pos+offset)/pattern_size;}float mercatorXfromLng(float lng) {return (180.0+lng)/360.0;}float mercatorYfromLat(float lat) {return (180.0-(RAD_TO_DEG*log(tan(PI/4.0+lat/2.0*DEG_TO_RAD))))/360.0;}vec3 latLngToECEF(vec2 latLng) {latLng=DEG_TO_RAD*latLng;float cosLat=cos(latLng[0]);float sinLat=sin(latLng[0]);float cosLng=cos(latLng[1]);float sinLng=sin(latLng[1]);float sx=cosLat*sinLng*GLOBE_RADIUS;float sy=-sinLat*GLOBE_RADIUS;float sz=cosLat*cosLng*GLOBE_RADIUS;return vec3(sx,sy,sz);} 60#ifdef RENDER_CUTOFF 61uniform vec4 u_cutoff_params;out float v_cutoff_opacity; 62#endif 63const vec4 AWAY=vec4(-1000.0,-1000.0,-1000.0,1);const float skirtOffset=24575.0;vec3 decomposeToPosAndSkirt(vec2 posWithComposedSkirt) 64{float skirt=float(posWithComposedSkirt.x >=skirtOffset);vec2 pos=posWithComposedSkirt-vec2(skirt*skirtOffset,0.0);return vec3(pos,skirt);}`,sl="in highp vec3 a_pos_3f;uniform lowp mat4 u_matrix;out highp vec3 v_uv;void main() {const mat3 half_neg_pi_around_x=mat3(1.0,0.0, 0.0,0.0,0.0,-1.0,0.0,1.0, 0.0);v_uv=half_neg_pi_around_x*a_pos_3f;vec4 pos=u_matrix*vec4(a_pos_3f,1.0);gl_Position=pos.xyww;}",Ec=` 65#define ELEVATION_SCALE 7.0 66#define ELEVATION_OFFSET 450.0 67#ifdef PROJECTION_GLOBE_VIEW 68uniform vec3 u_tile_tl_up;uniform vec3 u_tile_tr_up;uniform vec3 u_tile_br_up;uniform vec3 u_tile_bl_up;uniform float u_tile_up_scale;vec3 elevationVector(vec2 pos) {vec2 uv=pos/EXTENT;vec3 up=normalize(mix( 69mix(u_tile_tl_up,u_tile_tr_up,uv.xxx),mix(u_tile_bl_up,u_tile_br_up,uv.xxx),uv.yyy));return up*u_tile_up_scale;} 70#else 71vec3 elevationVector(vec2 pos) { return vec3(0,0,1); } 72#endif 73#ifdef TERRAIN 74uniform highp sampler2D u_dem;uniform highp sampler2D u_dem_prev;uniform vec2 u_dem_tl;uniform vec2 u_dem_tl_prev;uniform float u_dem_scale;uniform float u_dem_scale_prev;uniform float u_dem_size;uniform float u_dem_lerp;uniform float u_exaggeration;uniform float u_meter_to_dem;uniform mat4 u_label_plane_matrix_inv;uniform sampler2D u_depth;uniform vec2 u_depth_size_inv;vec4 tileUvToDemSample(vec2 uv,float dem_size,float dem_scale,vec2 dem_tl) {vec2 pos=dem_size*(uv*dem_scale+dem_tl)+1.0;vec2 f=fract(pos);return vec4((pos-f+0.5)/(dem_size+2.0),f);}float currentElevation(vec2 apos) { 75#ifdef TERRAIN_DEM_FLOAT_FORMAT 76vec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale+u_dem_tl)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture(u_dem,pos).r; 77#else 78float dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale,u_dem_tl);vec2 pos=r.xy;vec2 f=r.zw;float tl=texture(u_dem,pos).r;float tr=texture(u_dem,pos+vec2(dd,0)).r;float bl=texture(u_dem,pos+vec2(0,dd)).r;float br=texture(u_dem,pos+vec2(dd,dd)).r;return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y); 79#endif 80}float prevElevation(vec2 apos) { 81#ifdef TERRAIN_DEM_FLOAT_FORMAT 82vec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale_prev+u_dem_tl_prev)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture(u_dem_prev,pos).r; 83#else 84float dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale_prev,u_dem_tl_prev);vec2 pos=r.xy;vec2 f=r.zw;float tl=texture(u_dem_prev,pos).r;float tr=texture(u_dem_prev,pos+vec2(dd,0)).r;float bl=texture(u_dem_prev,pos+vec2(0,dd)).r;float br=texture(u_dem_prev,pos+vec2(dd,dd)).r;return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y); 85#endif 86} 87#ifdef TERRAIN_VERTEX_MORPHING 88float elevation(vec2 apos) { 89#ifdef ZERO_EXAGGERATION 90return 0.0; 91#endif 92float nextElevation=currentElevation(apos);float prevElevation=prevElevation(apos);return mix(prevElevation,nextElevation,u_dem_lerp);} 93#else 94float elevation(vec2 apos) { 95#ifdef ZERO_EXAGGERATION 96return 0.0; 97#endif 98return currentElevation(apos);} 99#endif 100highp float unpack_depth(highp vec4 rgba_depth) 101{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}bool isOccluded(vec4 frag) {vec3 coord=frag.xyz/frag.w;float depth=unpack_depth(texture(u_depth,(coord.xy+1.0)*0.5));return coord.z > depth+0.0005;}float occlusionFade(vec4 frag) {vec3 coord=frag.xyz/frag.w;vec3 df=vec3(5.0*u_depth_size_inv,0.0);vec2 uv=0.5*coord.xy+0.5;vec4 depth=vec4( 102unpack_depth(texture(u_depth,uv-df.xz)),unpack_depth(texture(u_depth,uv+df.xz)),unpack_depth(texture(u_depth,uv-df.zy)),unpack_depth(texture(u_depth,uv+df.zy)) 103);return dot(vec4(0.25),vec4(1.0)-clamp(300.0*(vec4(coord.z-0.001)-depth),0.0,1.0));}vec4 fourSample(vec2 pos,vec2 off) {float tl=texture(u_dem,pos).r;float tr=texture(u_dem,pos+vec2(off.x,0.0)).r;float bl=texture(u_dem,pos+vec2(0.0,off.y)).r;float br=texture(u_dem,pos+off).r;return vec4(tl,tr,bl,br);}float flatElevation(vec2 pack) {vec2 apos=floor(pack/8.0);vec2 span=10.0*(pack-apos*8.0);vec2 uvTex=(apos-vec2(1.0,1.0))/8190.0;float size=u_dem_size+2.0;float dd=1.0/size;vec2 pos=u_dem_size*(uvTex*u_dem_scale+u_dem_tl)+1.0;vec2 f=fract(pos);pos=(pos-f+0.5)*dd;vec4 h=fourSample(pos,vec2(dd));float z=mix(mix(h.x,h.y,f.x),mix(h.z,h.w,f.x),f.y);vec2 w=floor(0.5*(span*u_meter_to_dem-1.0));vec2 d=dd*w;h=fourSample(pos-d,2.0*d+vec2(dd));vec4 diff=abs(h.xzxy-h.ywzw);vec2 slope=min(vec2(0.25),u_meter_to_dem*0.5*(diff.xz+diff.yw)/(2.0*w+vec2(1.0)));vec2 fix=slope*span;float base=z+max(fix.x,fix.y);return u_exaggeration*base;}float elevationFromUint16(float word) {return u_exaggeration*(word/ELEVATION_SCALE-ELEVATION_OFFSET);} 104#else 105float elevation(vec2 pos) { return 0.0; }bool isOccluded(vec4 frag) { return false; }float occlusionFade(vec4 frag) { return 1.0; } 106#endif`,Sc=`#ifdef FOG 107uniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump mat4 u_fog_matrix;out vec3 v_fog_pos;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}vec3 fog_position(vec3 pos) {return (u_fog_matrix*vec4(pos,1.0)).xyz;}vec3 fog_position(vec2 pos) {return fog_position(vec3(pos,0.0));}float fog(vec3 pos) {float depth=length(pos);float opacity=fog_opacity(fog_range(depth));return opacity*fog_horizon_blending(pos/depth);} 108#endif`,hh=`highp vec3 hash(highp vec2 p) {highp vec3 p3=fract(p.xyx*vec3(443.8975,397.2973,491.1871));p3+=dot(p3,p3.yxz+19.19);return fract((p3.xxy+p3.yzz)*p3.zyx);}
108vec3 dither(vec3 color,highp vec2 seed) {vec3 rnd=hash(seed)+hash(seed+0.59374)-0.5;return color+rnd/255.0;} 109#ifdef FOG 110uniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump vec2 u_fog_vertical_limit;uniform mediump float u_fog_temporal_offset;in vec3 v_fog_pos;uniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform highp vec2 u_viewport;uniform float u_globe_transition;uniform int u_is_globe;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}float globe_glow_progress() {highp vec2 uv=gl_FragCoord.xy/u_viewport;highp vec3 ray_dir=mix( 111mix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);highp vec3 dir=normalize(ray_dir);highp vec3 closest_point=dot(u_globe_pos,dir)*dir;highp float sdf=length(closest_point-u_globe_pos)/u_globe_radius;return sdf+PI*0.5;}float fog_opacity(vec3 pos) {float depth=length(pos);return fog_opacity(fog_range(depth));}vec3 fog_apply(vec3 color,vec3 pos,float opacity_limit) {float depth=length(pos);float opacity;if (u_is_globe==1) {float glow_progress=globe_glow_progress();float t=mix(glow_progress,depth,u_globe_transition);opacity=fog_opacity(fog_range(t));} else {opacity=fog_opacity(fog_range(depth));opacity*=fog_horizon_blending(pos/depth);}return mix(color,u_fog_color.rgb,min(opacity,opacity_limit));}vec3 fog_apply(vec3 color,vec3 pos) {return fog_apply(color,pos,1.0);}vec4 fog_apply_from_vert(vec4 color,float fog_opac) {float alpha=EPSILON+color.a;color.rgb=mix(color.rgb/alpha,u_fog_color.rgb,fog_opac)*alpha;return color;}vec3 fog_apply_sky_gradient(vec3 camera_ray,vec3 sky_color) {float horizon_blend=fog_horizon_blending(normalize(camera_ray));return mix(sky_color,u_fog_color.rgb,horizon_blend);}vec4 fog_apply_premultiplied(vec4 color,vec3 pos) {float alpha=EPSILON+color.a;color.rgb=fog_apply(color.rgb/alpha,pos)*alpha;return color;}vec4 fog_apply_premultiplied(vec4 color,vec3 pos,float heightMeters) {float verticalProgress=(u_fog_vertical_limit.x > 0.0 || u_fog_vertical_limit.y > 0.0) ? smoothstep(u_fog_vertical_limit.x,u_fog_vertical_limit.y,heightMeters) : 0.0;float opacityLimit=1.0-smoothstep(0.9,1.0,fog_opacity(pos));return mix(fog_apply_premultiplied(color,pos),color,min(verticalProgress,opacityLimit));}vec3 fog_dither(vec3 color) { 112#ifdef FOG_DITHERING 113vec2 dither_seed=gl_FragCoord.xy+u_fog_temporal_offset;return dither(color,dither_seed); 114#else 115return color; 116#endif 117}vec4 fog_dither(vec4 color) {return vec4(fog_dither(color.rgb),color.a);} 118#endif`,_s=`#ifdef RASTER_ARRAY 119uniform sampler2D u_image0;uniform sampler2D u_image1;const vec4 NODATA=vec4(1);ivec4 _raTexLinearCoord(highp vec2 texCoord,highp vec2 texResolution,out highp vec2 fxy) {texCoord=texCoord*texResolution-0.5;fxy=fract(texCoord);texCoord-=fxy;return ivec4(texCoord.xxyy+vec2(1.5,0.5).xyxy);}vec2 _raTexLinearMix(highp vec2 fxy,highp vec4 colorMix,highp float colorOffset,highp vec4 t00,highp vec4 t10,highp vec4 t01,highp vec4 t11) {vec2 c00=t00==NODATA ? vec2(0) : vec2(colorOffset+dot(t00,colorMix),1);vec2 c10=t10==NODATA ? vec2(0) : vec2(colorOffset+dot(t10,colorMix),1);vec2 c01=t01==NODATA ? vec2(0) : vec2(colorOffset+dot(t01,colorMix),1);vec2 c11=t11==NODATA ? vec2(0) : vec2(colorOffset+dot(t11,colorMix),1);return mix(mix(c01,c11,fxy.x),mix(c00,c10,fxy.x),fxy.y);}vec2 raTexture2D_image0_linear(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec2 fxy;ivec4 c=_raTexLinearCoord(texCoord,texResolution,fxy);return _raTexLinearMix(fxy,colorMix,colorOffset,texelFetch(u_image0,c.yz,0),texelFetch(u_image0,c.xz,0),texelFetch(u_image0,c.yw,0),texelFetch(u_image0,c.xw,0) 120);}
120vec2 raTexture2D_image1_linear(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec2 fxy;ivec4 c=_raTexLinearCoord(texCoord,texResolution,fxy);return _raTexLinearMix(fxy,colorMix,colorOffset,texelFetch(u_image1,c.yz,0),texelFetch(u_image1,c.xz,0),texelFetch(u_image1,c.yw,0),texelFetch(u_image1,c.xw,0) 121);}vec2 raTexture2D_image0_nearest(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec4 t=texelFetch(u_image0,ivec2(texCoord*texResolution),0);return t==NODATA ? vec2(0) : vec2(colorOffset+dot(t,colorMix),1);}vec2 raTexture2D_image1_nearest(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec4 t=texelFetch(u_image1,ivec2(texCoord*texResolution),0);return t==NODATA ? vec2(0) : vec2(colorOffset+dot(t,colorMix),1);} 122#endif`,gs=`#ifdef RASTER_ARRAY 123uniform sampler2D u_velocity;uniform vec2 u_velocity_res;uniform float u_max_speed;const vec2 INVALID_VELOCITY=vec2(-1);uniform vec2 u_texture_offset;uniform float u_data_offset;uniform vec4 u_data_scale;vec2 lookup_velocity(vec2 uv) {uv=u_texture_offset.x+u_texture_offset.y*uv;vec2 fxy;ivec4 c=_raTexLinearCoord(uv,u_velocity_res,fxy);vec4 tl=texelFetch(u_velocity,c.yz,0);vec4 tr=texelFetch(u_velocity,c.xz,0);vec4 bl=texelFetch(u_velocity,c.yw,0);vec4 br=texelFetch(u_velocity,c.xw,0);if (tl==NODATA) {return INVALID_VELOCITY;}if (tr==NODATA) {return INVALID_VELOCITY;}if (bl==NODATA) {return INVALID_VELOCITY;}if (br==NODATA) {return INVALID_VELOCITY;}vec4 t=mix(mix(bl,br,fxy.x),mix(tl,tr,fxy.x),fxy.y); 124#ifdef DATA_FORMAT_UINT32 125vec2 velocity=vec2(u_data_offset+dot(t,u_data_scale),0);return velocity; 126#else 127vec2 velocity=vec2(u_data_offset+dot(t.rg,u_data_scale.yx),-(u_data_offset+dot(t.ba,u_data_scale.yx))); 128#endif 129return velocity/max(u_max_speed,length(velocity));} 130#endif`,Ac=`#ifdef RENDER_SHADOWS 131uniform mediump vec3 u_shadow_direction;uniform highp vec3 u_shadow_normal_offset;vec3 shadow_normal_offset(vec3 normal) {float tileInMeters=u_shadow_normal_offset[0];vec3 n=vec3(-normal.xy,tileInMeters*normal.z);float dotScale=min(1.0-dot(normal,u_shadow_direction),1.0)*0.5+0.5;return n*dotScale;}vec3 shadow_normal_offset_model(vec3 normal) {float dotScale=min(1.0-dot(normal,u_shadow_direction),1.0)*0.5+0.5;return normal*dotScale;}float shadow_normal_offset_multiplier0() {return u_shadow_normal_offset[1];}float shadow_normal_offset_multiplier1() {return u_shadow_normal_offset[2];} 132#endif//RENDER_SHADOWS`,na=`#ifdef RENDER_SHADOWS 133#ifdef DEPTH_TEXTURE 134uniform highp sampler2D u_shadowmap_0;uniform highp sampler2D u_shadowmap_1; 135#else 136uniform sampler2D u_shadowmap_0;uniform sampler2D u_shadowmap_1; 137#endif 138uniform float u_shadow_intensity;uniform float u_shadow_map_resolution;uniform float u_shadow_texel_size;uniform highp vec3 u_shadow_normal_offset;uniform vec2 u_fade_range;uniform mediump vec3 u_shadow_direction;uniform highp vec3 u_shadow_bias;highp float shadow_sample_1(highp vec2 uv,highp float compare) {highp float shadow_depth; 139#ifdef DEPTH_TEXTURE 140shadow_depth=texture(u_shadowmap_1,uv).r; 141#else 142shadow_depth=unpack_depth(texture(u_shadowmap_1,uv))*0.5+0.5; 143#endif 144return step(shadow_depth,compare);}highp float shadow_sample_0(highp vec2 uv,highp float compare) {highp float shadow_depth; 145#ifdef DEPTH_TEXTURE 146shadow_depth=texture(u_shadowmap_0,uv).r; 147#else 148shadow_depth=unpack_depth(texture(u_shadowmap_0,uv))*0.5+0.5; 149#endif 150return step(shadow_depth,compare);}float shadow_occlusion_1(highp vec4 pos,highp float bias) {highp vec2 uv=pos.xy;return shadow_sample_1(uv,pos.z-bias);}float shadow_occlusion_0(highp vec4 pos,highp float bias) {highp float compare0=pos.z-bias; 151#ifdef NATIVE 152highp vec2 uv=pos.xy;highp vec4 samples=textureGather(u_shadowmap_0,uv,0);lowp vec4 stepSamples=step(samples,vec4(compare0)); 153#else 154highp vec2 uv00=pos.xy-vec2(0.5*u_shadow_texel_size);highp vec2 uv10=uv00+vec2(u_shadow_texel_size,0.0);highp vec2 uv01=uv00+vec2(0.0,u_shadow_texel_size);highp vec2 uv11=uv01+vec2(u_shadow_texel_size,0.0);lowp vec4 stepSamples=vec4( 155shadow_sample_0(uv01,compare0),shadow_sample_0(uv11,compare0),shadow_sample_0(uv10,compare0),shadow_sample_0(uv00,compare0) 156); 157#endif 158vec2 f=fract(pos.xy*u_shadow_map_resolution-vec2(0.5));lowp vec2 lerpx=mix(stepSamples.wx,stepSamples.zy,f.xx);return mix(lerpx.x,lerpx.y,f.y);}float shadow_occlusion(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth,highp float bias) { 159#ifdef SHADOWS_SINGLE_CASCADE 160light_view_pos0.xyz=light_view_pos0.xyz/light_view_pos0.w*0.5+0.5;return shadow_occlusion_0(light_view_pos0,bias); 161#else 162light_view_pos0.xyz/=light_view_pos0.w;light_view_pos1.xyz/=light_view_pos1.w;vec4 uv=vec4(light_view_pos0.xy,light_view_pos1.xy);vec4 abs_bounds=abs(uv);if (abs_bounds.x < 1.0 && abs_bounds.y < 1.0) {light_view_pos0.xyz=light_view_pos0.xyz*0.5+0.5;return shadow_occlusion_0(light_view_pos0,bias);}if (abs_bounds.z >=1.0 || abs_bounds.w >=1.0) {return 0.0;}light_view_pos1.xyz=light_view_pos1.xyz*0.5+0.5;float occlusion1=shadow_occlusion_1(light_view_pos1,bias);return mix(occlusion1,0.0,smoothstep(u_fade_range.x,u_fade_range.y,view_depth)); 163#endif 164}highp float calculate_shadow_bias(float NDotL) { 165#ifdef NORMAL_OFFSET 166return 0.5*u_shadow_bias.x; 167#else 168return 0.5*(u_shadow_bias.x+clamp(u_shadow_bias.y*tan(acos(NDotL)),0.0,u_shadow_bias.z)); 169#endif 170}float shadowed_light_factor_normal(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float NDotL=dot(N,u_shadow_direction);float bias=calculate_shadow_bias(NDotL);float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}float shadowed_light_factor_normal_unbiased(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float NDotL=dot(N,u_shadow_direction);float bias=0.0;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}float shadowed_light_factor(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float bias=0.0;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return 1.0-(u_shadow_intensity*occlusion);}float shadow_occlusion(float ndotl,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float bias=calculate_shadow_bias(ndotl);return shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);} 171#endif`;const ys=[];so(rl,ys),so(ol,ys),so(nl,ys);const Fr={"_prelude_fog.vertex.glsl":Sc,"_prelude_terrain.vertex.glsl":Ec,"_prelude_shadow.vertex.glsl":Ac,"_prelude_fog.fragment.glsl":hh,"_prelude_shadow.fragment.glsl":na,"_prelude_lighting.glsl":` 172#ifdef LIGHTING_3D_MODE 173uniform mediump vec3 u_lighting_ambient_color;uniform mediump vec3 u_lighting_directional_dir;uniform mediump vec3 u_lighting_directional_color;uniform mediump vec3 u_ground_radiance;float calculate_ambient_directional_factor(vec3 normal) {float NdotL=dot(normal,u_lighting_directional_dir);const float factor_reduction_max=0.3;float dir_luminance=dot(u_lighting_directional_color,vec3(0.2126,0.7152,0.0722));float directional_factor_min=1.0-factor_reduction_max*min(dir_luminance,1.0);float ambient_directional_factor=mix(directional_factor_min,1.0,min((NdotL+1.0),1.0
173));const float vertical_factor_min=0.92;float vertical_factor=mix(vertical_factor_min,1.0,normal.z*0.5+0.5);return vertical_factor*ambient_directional_factor;}vec3 linearProduct(vec3 srgbIn,vec3 k) {return srgbIn*pow(k,vec3(1./2.2));}vec3 apply_lighting(vec3 color,vec3 normal,float dir_factor) {float ambient_directional_factor=calculate_ambient_directional_factor(normal);vec3 ambient_contrib=ambient_directional_factor*u_lighting_ambient_color;vec3 directional_contrib=u_lighting_directional_color*dir_factor;return linearProduct(color,ambient_contrib+directional_contrib);}vec4 apply_lighting(vec4 color,vec3 normal,float dir_factor) {return vec4(apply_lighting(color.rgb,normal,dir_factor),color.a);}vec3 apply_lighting(vec3 color,vec3 normal) {float dir_factor=max(dot(normal,u_lighting_directional_dir),0.0);return apply_lighting(color.rgb,normal,dir_factor);}vec4 apply_lighting(vec4 color,vec3 normal) {float dir_factor=max(dot(normal,u_lighting_directional_dir),0.0);return vec4(apply_lighting(color.rgb,normal,dir_factor),color.a);}vec3 apply_lighting_ground(vec3 color) {return color*u_ground_radiance;}vec4 apply_lighting_ground(vec4 color) {return vec4(apply_lighting_ground(color.rgb),color.a);}float calculate_NdotL(vec3 normal) {const float ext=0.70710678118;return (clamp(dot(normal,u_lighting_directional_dir),-ext,1.0)+ext)/(1.0+ext);}vec4 apply_lighting_with_emission_ground(vec4 color,float emissive_strength) {return mix(apply_lighting_ground(color),color,emissive_strength);}vec3 compute_flood_lighting(vec3 flood_light_color,float fully_occluded_factor,float occlusion,vec3 ground_shadow_factor) {vec3 fully_occluded_color=flood_light_color*mix(ground_shadow_factor,vec3(1.0),fully_occluded_factor);float occlusion_ramp=smoothstep(0.0,0.2,1.0-occlusion);return mix(fully_occluded_color,flood_light_color,occlusion_ramp);}vec3 compute_emissive_draped(vec3 unlit_color,float fully_occluded_factor,float occlusion,vec3 ground_shadow_factor) {vec3 fully_occluded_color=unlit_color*mix(ground_shadow_factor,vec3(1.0),fully_occluded_factor);return mix(fully_occluded_color,unlit_color,1.0-occlusion);} 174#endif//LIGHTING_3D_MODE`,"_prelude_raster_array.glsl":_s,"_prelude_raster_particle.glsl":gs},xs={};Xt("",Ec),Xt(hh,Sc),Xt(na,Ac),Xt(_s,""),Xt(gs,"");const Ic=Xt(nl,ol),al=rl;var Cc={background:Xt(`#include "_prelude_fog.fragment.glsl" 175#include "_prelude_lighting.glsl" 176uniform vec4 u_color;uniform float u_opacity; 177#ifdef LIGHTING_3D_MODE 178in vec4 v_color; 179#endif 180void main() {vec4 out_color; 181#ifdef LIGHTING_3D_MODE 182out_color=v_color; 183#else 184out_color=u_color; 185#endif 186#ifdef FOG 187out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); 188#endif 189glFragColor=out_color*u_opacity; 190#ifdef OVERDRAW_INSPECTOR 191glFragColor=vec4(1.0); 192#endif 193HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 194#include "_prelude_lighting.glsl" 195in vec2 a_pos;uniform mat4 u_matrix; 196#ifdef LIGHTING_3D_MODE 197uniform mediump vec4 u_color;out vec4 v_color;uniform float u_emissive_strength; 198#endif 199void main() {gl_Position=u_matrix*vec4(a_pos,0,1); 200#ifdef LIGHTING_3D_MODE 201v_color=apply_lighting_with_emission_ground(u_color,u_emissive_strength); 202#endif 203#ifdef FOG 204v_fog_pos=fog_position(a_pos); 205#endif 206}`),backgroundPattern:Xt(`#include "_prelude_fog.fragment.glsl" 207#include "_prelude_lighting.glsl" 208uniform vec2 u_pattern_tl;uniform vec2 u_pattern_br;uniform vec2 u_texsize;uniform float u_opacity;uniform float u_emissive_strength;uniform sampler2D u_image;in vec2 v_pos;void main() {vec2 imagecoord=mod(v_pos,1.0);vec2 pos=mix(u_pattern_tl/u_texsize,u_pattern_br/u_texsize,imagecoord);vec4 out_color=textureLodCustom(u_image,pos,v_pos); 209#ifdef LIGHTING_3D_MODE 210out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); 211#endif 212#ifdef FOG 213out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); 214#endif 215glFragColor=out_color*u_opacity; 216#ifdef OVERDRAW_INSPECTOR 217glFragColor=vec4(1.0); 218#endif 219HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 220uniform mat4 u_matrix;uniform vec2 u_pattern_size;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_pattern_size,u_tile_units_to_pixels,a_pos); 221#ifdef FOG 222v_fog_pos=fog_position(a_pos); 223#endif 224}`),circle:Xt(`#include "_prelude_fog.fragment.glsl" 225#include "_prelude_lighting.glsl" 226in vec3 v_data;in float v_visibility; 227#pragma mapbox: define highp vec4 color 228#pragma mapbox: define mediump float radius 229#pragma mapbox: define lowp float blur 230#pragma mapbox: define lowp float opacity 231#pragma mapbox: define highp vec4 stroke_color 232#pragma mapbox: define mediump float stroke_width 233#pragma mapbox: define lowp float stroke_opacity 234uniform float u_emissive_strength;void main() { 235#pragma mapbox: initialize highp vec4 color 236#pragma mapbox: initialize mediump float radius 237#pragma mapbox: initialize lowp float blur 238#pragma mapbox: initialize lowp float opacity 239#pragma mapbox: initialize highp vec4 stroke_color 240#pragma mapbox: initialize mediump float stroke_width 241#pragma mapbox: initialize lowp float stroke_opacity 242vec2 extrude=v_data.xy;float extrude_length=length(extrude);lowp float antialiasblur=v_data.z;float antialiased_blur=-max(blur,antialiasblur);float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(
243antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width) 244);vec4 out_color=mix(color*opacity,stroke_color*stroke_opacity,color_t); 245#ifdef LIGHTING_3D_MODE 246out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); 247#endif 248#ifdef FOG 249out_color=fog_apply_premultiplied(out_color,v_fog_pos); 250#endif 251glFragColor=out_color*(v_visibility*opacity_t); 252#ifdef OVERDRAW_INSPECTOR 253glFragColor=vec4(1.0); 254#endif 255}`,`#include "_prelude_fog.vertex.glsl" 256#include "_prelude_terrain.vertex.glsl" 257#define NUM_VISIBILITY_RINGS 2 258#define INV_SQRT2 0.70710678 259#define ELEVATION_BIAS 0.0001 260#define NUM_SAMPLES_PER_RING 16 261uniform mat4 u_matrix;uniform mat2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;in vec2 a_pos; 262#ifdef PROJECTION_GLOBE_VIEW 263in vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir; 264#endif 265out vec3 v_data;out float v_visibility; 266#pragma mapbox: define highp vec4 color 267#pragma mapbox: define mediump float radius 268#pragma mapbox: define lowp float blur 269#pragma mapbox: define lowp float opacity 270#pragma mapbox: define highp vec4 stroke_color 271#pragma mapbox: define mediump float stroke_width 272#pragma mapbox: define lowp float stroke_opacity 273vec2 calc_offset(vec2 extrusion,float radius,float stroke_width, float view_scale) {return extrusion*(radius+stroke_width)*u_extrude_scale*view_scale;}float cantilevered_elevation(vec2 pos,float radius,float stroke_width,float view_scale) {vec2 c1=pos+calc_offset(vec2(-1,-1),radius,stroke_width,view_scale);vec2 c2=pos+calc_offset(vec2(1,-1),radius,stroke_width,view_scale);vec2 c3=pos+calc_offset(vec2(1,1),radius,stroke_width,view_scale);vec2 c4=pos+calc_offset(vec2(-1,1),radius,stroke_width,view_scale);float h1=elevation(c1)+ELEVATION_BIAS;float h2=elevation(c2)+ELEVATION_BIAS;float h3=elevation(c3)+ELEVATION_BIAS;float h4=elevation(c4)+ELEVATION_BIAS;return max(h4,max(h3,max(h1,h2)));}float circle_elevation(vec2 pos) { 274#if defined(TERRAIN) 275return elevation(pos)+ELEVATION_BIAS; 276#else 277return 0.0; 278#endif 279}vec4 project_vertex(vec2 extrusion,vec4 world_center,vec4 projected_center,float radius,float stroke_width, float view_scale,mat3 surface_vectors) {vec2 sample_offset=calc_offset(extrusion,radius,stroke_width,view_scale); 280#ifdef PITCH_WITH_MAP 281#ifdef PROJECTION_GLOBE_VIEW 282return u_matrix*( world_center+vec4(sample_offset.x*surface_vectors[0]+sample_offset.y*surface_vectors[1],0) ); 283#else 284return u_matrix*( world_center+vec4(sample_offset,0,0) ); 285#endif 286#else 287return projected_center+vec4(sample_offset,0,0); 288#endif 289}float get_sample_step() { 290#ifdef PITCH_WITH_MAP 291return 2.0*PI/float(NUM_SAMPLES_PER_RING); 292#else 293return PI/float(NUM_SAMPLES_PER_RING); 294#endif 295}void main(void) { 296#pragma mapbox: initialize highp vec4 color 297#pragma mapbox: initialize mediump float radius 298#pragma mapbox: initialize lowp float blur 299#pragma mapbox: initialize lowp float opacity 300#pragma mapbox: initialize highp vec4 stroke_color 301#pragma mapbox: initialize mediump float stroke_width 302#pragma mapbox: initialize lowp float stroke_opacity 303vec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);vec4 world_center;mat3 surface_vectors; 304#ifdef PROJECTION_GLOBE_VIEW 305vec3 pos_normal_3=a_pos_normal_3/16384.0;surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(circle_center)*circle_elevation(circle_center);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*circle_elevation(circle_center);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,circle_center,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;vec3 pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);world_center=vec4(pos,1); 306#else 307surface_vectors=mat3(1.0);float height=circle_elevation(circle_center);world_center=vec4(circle_center,height,1); 308#endif 309vec4 projected_center=u_matrix*world_center;float view_scale=0.0; 310#ifdef PITCH_WITH_MAP 311#ifdef SCALE_WITH_MAP 312view_scale=1.0; 313#else 314view_scale=projected_center.w/u_camera_to_center_distance; 315#endif 316#else 317#ifdef SCALE_WITH_MAP 318view_scale=u_camera_to_center_distance; 319#else 320view_scale=projected_center.w; 321#endif 322#endif 323gl_Position=project_vertex(extrude,world_center,projected_center,radiu
323s,stroke_width,view_scale,surface_vectors);float visibility=0.0; 324#ifdef TERRAIN 325float step=get_sample_step();vec4 occlusion_world_center;vec4 occlusion_projected_center; 326#ifdef PITCH_WITH_MAP 327float cantilevered_height=cantilevered_elevation(circle_center,radius,stroke_width,view_scale);occlusion_world_center=vec4(circle_center,cantilevered_height,1);occlusion_projected_center=u_matrix*occlusion_world_center; 328#else 329occlusion_world_center=world_center;occlusion_projected_center=projected_center; 330#endif 331for(int ring=0; ring < NUM_VISIBILITY_RINGS; ring++) {float scale=(float(ring)+1.0)/float(NUM_VISIBILITY_RINGS);for(int i=0; i < NUM_SAMPLES_PER_RING; i++) {vec2 extrusion=vec2(cos(step*float(i)),-sin(step*float(i)))*scale;vec4 frag_pos=project_vertex(extrusion,occlusion_world_center,occlusion_projected_center,radius,stroke_width,view_scale,surface_vectors);visibility+=float(!isOccluded(frag_pos));}}visibility/=float(NUM_VISIBILITY_RINGS)*float(NUM_SAMPLES_PER_RING); 332#else 333visibility=1.0; 334#endif 335#ifdef PROJECTION_GLOBE_VIEW 336visibility=1.0; 337#endif 338v_visibility=visibility;lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur); 339#ifdef FOG 340v_fog_pos=fog_position(world_center.xyz); 341#endif 342}`),clippingMask:Xt("void main() {glFragColor=vec4(1.0);}","in vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),heatmap:Xt(`#include "_prelude_fog.fragment.glsl" 343uniform highp float u_intensity;in vec2 v_extrude; 344#pragma mapbox: define highp float weight 345#define GAUSS_COEF 0.3989422804014327 346void main() { 347#pragma mapbox: initialize highp float weight 348float d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);glFragColor=vec4(val,1.0,1.0,1.0); 349#ifdef FOG 350if (u_is_globe==0) {glFragColor.r*=pow(1.0-fog_opacity(v_fog_pos),2.0);} 351#endif 352#ifdef OVERDRAW_INSPECTOR 353glFragColor=vec4(1.0); 354#endif 355HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_terrain.vertex.glsl" 356#include "_prelude_fog.vertex.glsl" 357uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;in vec2 a_pos; 358#ifdef PROJECTION_GLOBE_VIEW 359in vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir; 360#endif 361out vec2 v_extrude; 362#pragma mapbox: define highp float weight 363#pragma mapbox: define mediump float radius 364const highp float ZERO=1.0/255.0/16.0; 365#define GAUSS_COEF 0.3989422804014327 366void main(void) { 367#pragma mapbox: initialize highp float weight 368#pragma mapbox: initialize mediump float radius 369vec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec2 tilePos=floor(a_pos*0.5);vec3 pos; 370#ifdef PROJECTION_GLOBE_VIEW 371vec3 pos_normal_3=a_pos_normal_3/16384.0;mat3 surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(tilePos)*elevation(tilePos);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*elevation(tilePos);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,tilePos,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition); 372#else 373pos=vec3(tilePos+extrude,elevation(tilePos)); 374#endif 375gl_Position=u_matrix*vec4(pos,1); 376#ifdef FOG 377v_fog_pos=fog_position(pos); 378#endif 379}`),heatmapTexture:Xt(`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));glFragColor=color*u_opacity; 380#ifdef OVERDRAW_INSPECTOR 381glFragColor=vec4(0.0); 382#endif 383HANDLE_WIREFRAME_DEBUG;}`,"in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=vec4(a_pos,0,1);v_pos=a_pos*0.5+0.5;}"),collisionBox:Xt("in float v_placed;in float v_notUsed;void main() {vec4 red =vec4(1.0,0.0,0.0,1.0);vec4 blue=vec4(0.0,0.0,1.0,0.5);glFragColor =mix(red,blue,step(0.5,v_placed))*0.5;glFragColor*=mix(1.0,0.1,step(0.5,v_notUsed));}",`#include "_prelude_terrain.vertex.glsl" 384in vec3 a_pos;in vec2 a_anchor_pos;in vec2 a_extrude;in vec2 a_placed;in vec2 a_shift;in float a_size_scale;in vec2 a_padding;in float a_z_offset;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;out float v_placed;out float v_notUsed;void main() {vec4 projectedPoint=u_matrix*vec4(a_pos+elevationVector(a_anchor_pos)*(a_z_offset+elevation(a_anchor_pos)),1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp( 3850.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,1.5);gl_Position=projectedPoint;gl_Position.xy+=(a_extrude*a_size_scale+a_shift+a_padding)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}`),collisionCircle:Xt("in float v_radius;in vec2 v_extrude;in float v_perspective_ratio;in float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);glFragColor=color*alpha*opacity_t;}",`in vec2 a_pos_2f;in float a_radius;in vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;out float v_radius;out vec2 v_extrude;out float v_perspective_ratio;out float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos_2f;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2( 386mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp( 3870.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}`),debug:Xt("uniform highp vec4 u_color;uniform sampler2D u_overlay;in vec2 v_uv;void main() {vec4 overlay_color=texture(u_overlay,v_uv);glFragColor=mix(u_color,overlay_color,overlay_color.a);}",`#include "_prelude_terrain.vertex.glsl" 388in vec2 a_pos; 389#ifdef PROJECTION_GLOBE_VIEW 390in vec3 a_pos_3; 391#endif 392out vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {float h=elevation(a_pos);v_uv=a_pos/8192.0; 393#ifdef PROJECTION_GLOBE_VIEW
394gl_Position=u_matrix*vec4(a_pos_3+elevationVector(a_pos)*h,1); 395#else 396gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,h,1); 397#endif 398}`),fill:Xt(`#include "_prelude_fog.fragment.glsl" 399#include "_prelude_lighting.glsl" 400#pragma mapbox: define highp vec4 color 401#pragma mapbox: define lowp float opacity 402uniform float u_emissive_strength;void main() { 403#pragma mapbox: initialize highp vec4 color 404#pragma mapbox: initialize lowp float opacity 405vec4 out_color=color; 406#ifdef LIGHTING_3D_MODE 407out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); 408#endif 409#ifdef FOG 410out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); 411#endif 412glFragColor=out_color*opacity; 413#ifdef OVERDRAW_INSPECTOR 414glFragColor=vec4(1.0); 415#endif 416HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 417in vec2 a_pos;uniform mat4 u_matrix; 418#pragma mapbox: define highp vec4 color 419#pragma mapbox: define lowp float opacity 420void main() { 421#pragma mapbox: initialize highp vec4 color 422#pragma mapbox: initialize lowp float opacity 423gl_Position=u_matrix*vec4(a_pos,0,1); 424#ifdef FOG 425v_fog_pos=fog_position(a_pos); 426#endif 427}`),fillOutline:Xt(`#include "_prelude_fog.fragment.glsl" 428#include "_prelude_lighting.glsl" 429in highp vec2 v_pos;uniform float u_emissive_strength; 430#pragma mapbox: define highp vec4 outline_color 431#pragma mapbox: define lowp float opacity 432void main() { 433#pragma mapbox: initialize highp vec4 outline_color 434#pragma mapbox: initialize lowp float opacity 435float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=outline_color; 436#ifdef LIGHTING_3D_MODE 437out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); 438#endif 439#ifdef FOG 440out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); 441#endif 442glFragColor=out_color*(alpha*opacity); 443#ifdef OVERDRAW_INSPECTOR 444glFragColor=vec4(1.0); 445#endif 446HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 447in vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;out highp vec2 v_pos; 448#pragma mapbox: define highp vec4 outline_color 449#pragma mapbox: define lowp float opacity 450void main() { 451#pragma mapbox: initialize highp vec4 outline_color 452#pragma mapbox: initialize lowp float opacity 453gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world; 454#ifdef FOG 455v_fog_pos=fog_position(a_pos); 456#endif 457}`),fillOutlinePattern:Xt(`#include "_prelude_fog.fragment.glsl" 458#include "_prelude_lighting.glsl" 459uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_emissive_strength;in highp vec2 v_pos;in highp vec2 v_pos_world; 460#pragma mapbox: define lowp float opacity 461#pragma mapbox: define lowp vec4 pattern 462void main() { 463#pragma mapbox: initialize lowp float opacity 464#pragma mapbox: initialize mediump vec4 pattern 465vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 imagecoord=mod(v_pos,1.0);vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);float dist=length(v_pos_world-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=textureLodCustom(u_image,pos,lod_pos); 466#ifdef LIGHTING_3D_MODE 467out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); 468#endif 469#ifdef FOG 470out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); 471#endif 472glFragColor=out_color*(alpha*opacity); 473#ifdef OVERDRAW_INSPECTOR 474glFragColor=vec4(1.0); 475#endif 476HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 477uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in vec2 a_pos;out highp vec2 v_pos;out highp vec2 v_pos_world; 478#pragma mapbox: define lowp float opacity 479#pragma mapbox: define lowp vec4 pattern 480#pragma mapbox: define lowp float pixel_ratio 481void main() { 482#pragma mapbox: initialize lowp float opacity 483#pragma mapbox: initialize mediump vec4 pattern 484#pragma mapbox: initialize lowp float pixel_ratio 485vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,a_pos);v_pos_world=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world; 486#ifdef FOG 487v_fog_pos=fog_position(a_pos); 488#endif 489}`),fillPattern:Xt(`#include "_prelude_fog.fragment.glsl" 490#include "_prelude_lighting.glsl" 491uniform vec2 u_texsize;uniform sampler2D u_image;in vec2 v_pos;uniform float u_emissive_strength; 492#pragma mapbox: define lowp float opacity 493#pragma mapbox: define lowp vec4 pattern 494void main() { 495#pragma mapbox: initialize lowp float opacity 496#pragma mapbox: initialize mediump vec4 pattern 497vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 imagecoord=mod(v_pos,1.0);vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);vec4 out_color=textureLodCustom(u_image,pos,lod_pos); 498#ifdef LIGHTING_3D_MODE 499out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); 500#endif 501#ifdef FOG 502out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); 503#endif 504glFragColor=out_color*opacity; 505#ifdef OVERDRAW_INSPECTOR 506glFragColor=vec4(1.0); 507#endif 508HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 509uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in vec2 a_pos;out vec2 v_pos; 510#pragma mapbox: define lowp float opacity 511#pragma mapbox: define lowp vec4 pattern 512#pragma mapbox: define lowp float pixel_ratio 513void main() { 514#pragma mapbox: initialize lowp float opacity 515#pragma mapbox: initialize mediump vec4 pattern 516#pragma mapbox: initialize lowp float pixel_ratio 517vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,a_pos); 518#ifdef FOG 519v_fog_pos=fog_position(a_pos); 520#endif 521}`),fillExtrusion:Xt(`#include "_prelude_fog.fragment.glsl" 522#include "_prelude_shadow.fragment.glsl" 523#include "_prelude_lighting.glsl" 524in vec4 v_color;in vec4 v_flat; 525#ifdef RENDER_SHADOWS 526in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1; 527#endif 528uniform lowp float u_opacity; 529#ifdef FAUX_AO 530uniform lowp vec2 u_ao;in vec2 v_ao; 531#endif 532#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE) 533in vec4 v_roof_color; 534#endif 535#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE) 536in highp vec3 v_normal; 537#endif 538uniform vec3 u_flood_light_color;uniform highp float u_vertical_scale;uniform float u_flood_light_intensity;uniform vec3 u_ground_shadow_factor; 539#if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT)
540in float v_flood_radius;in float v_has_floodlight; 541#endif 542uniform float u_emissive_strength;in float v_height;void main() { 543#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE) 544vec3 normal=normalize(v_normal); 545#endif 546float z;vec4 color=v_color; 547#ifdef ZERO_ROOF_RADIUS 548z=float(normal.z > 0.00001); 549#ifdef LIGHTING_3D_MODE 550normal=mix(normal,vec3(0.0,0.0,1.0),z); 551#else 552color=mix(v_color,v_roof_color,z); 553#endif 554#endif 555float h=max(0.0,v_height);float ao_shade=1.0; 556#ifdef FAUX_AO 557float intensity=u_ao[0];float h_floors=h/(u_ao[1]*u_vertical_scale);float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);ao_shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x; 558#ifdef ZERO_ROOF_RADIUS 559concave*=(1.0-z); 560#endif 561float x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);ao_shade*=mix(1.0,x_shade*x_shade*x_shade,concave); 562#ifdef LIGHTING_3D_MODE 563#ifdef FLOOD_LIGHT 564color.rgb*=mix(ao_shade,1.0,v_has_floodlight); 565#else 566color.rgb*=ao_shade; 567#endif 568#else 569color.rgb*=ao_shade; 570#endif 571#endif 572#ifdef LIGHTING_3D_MODE 573float flood_radiance=0.0; 574#ifdef FLOOD_LIGHT 575flood_radiance=(1.0-min(h/v_flood_radius,1.0))*u_flood_light_intensity*v_has_floodlight; 576#endif 577#ifdef RENDER_SHADOWS 578#ifdef FLOOD_LIGHT 579float ndotl_unclamped=dot(normal,u_shadow_direction);float ndotl=max(0.0,ndotl_unclamped);float occlusion=ndotl_unclamped < 0.0 ? 1.0 : shadow_occlusion(ndotl,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);vec3 litColor=apply_lighting(color.rgb,normal,(1.0-u_shadow_intensity*occlusion)*ndotl);vec3 floodLitColor=compute_flood_lighting(u_flood_light_color*u_opacity,1.0-u_shadow_intensity,occlusion,u_ground_shadow_factor);color.rgb=mix(litColor,floodLitColor,flood_radiance); 580#else 581float shadowed_lighting_factor=shadowed_light_factor_normal(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);color.rgb=apply_lighting(color.rgb,normal,shadowed_lighting_factor); 582#endif 583#else 584color.rgb=apply_lighting(color.rgb,normal); 585#ifdef FLOOD_LIGHT 586color.rgb=mix(color.rgb,u_flood_light_color*u_opacity,flood_radiance); 587#endif 588#endif 589color.rgb=mix(color.rgb,v_flat.rgb,u_emissive_strength);color*=u_opacity; 590#endif 591#ifdef FOG 592color=fog_dither(fog_apply_premultiplied(color,v_fog_pos,h)); 593#endif 594#ifdef INDICATOR_CUTOUT 595color=applyCutout(color); 596#endif 597glFragColor=color; 598#ifdef OVERDRAW_INSPECTOR 599glFragColor=vec4(1.0); 600#endif 601HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 602#include "_prelude_terrain.vertex.glsl" 603#include "_prelude_shadow.vertex.glsl" 604#include "_prelude_lighting.glsl" 605uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform float u_edge_radius;in vec4 a_pos_normal_ed;in vec2 a_centroid_pos; 606#ifdef PROJECTION_GLOBE_VIEW 607in vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift; 608#endif 609uniform highp float u_vertical_scale;out vec4 v_color;out vec4 v_flat; 610#ifdef RENDER_SHADOWS 611uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out float v_depth; 612#endif 613#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE) 614out vec4 v_roof_color; 615#endif 616#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE) 617out highp vec3 v_normal; 618#endif 619#ifdef FAUX_AO 620uniform lowp vec2 u_ao;out vec2 v_ao; 621#endif 622#if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT) 623out float v_flood_radius;out float v_has_floodlight; 624#endif 625out float v_height; 626#pragma mapbox: define highp float base 627#pragma mapbox: define highp float height 628#pragma mapbox: define highp vec4 color 629#pragma mapbox: define highp float flood_light_wall_radius 630void main() { 631#pragma mapbox: initialize highp float base 632#pragma mapbox: initialize highp float height 633#pragma mapbox: initialize highp vec4 color 634#pragma mapbox: initialize highp float flood_light_wall_radius 635base*=u_vertical_scale;height*=u_vertical_scale;vec4 pos_nx=floor(a_pos_normal_ed*0.5);vec4 top_up_ny_start=a_pos_normal_ed-2.0*pos_nx;vec3 top_up_ny=top_up_ny_start.xyz;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0)); 636#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE) 637v_normal=normal; 638#endif 639base=max(0.0,base);float attr_height=height;height=max(0.0,top_up_ny.y==0.0 && top_up_ny.x==1.0 ? height-u_edge_radius : height);float t=top_up_ny.x;vec2 centroid_pos=vec2(0.0); 640#if defined(HAS_CENTROID) || defined(TERRAIN) 641centroid_pos=a_centroid_pos; 642#endif 643float ele=0.0;float h=0.0;float c_ele=0.0;vec3 pos; 644#ifdef TERRAIN 645bool flat_roof=centroid_pos.x !=0.0 && t > 0.0;ele=elevation(pos_nx.xy);c_ele=flat_roof ? centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos) : ele;h=flat_roof ? max(c_ele+height,ele+base+2.0) : ele+(t > 0.0 ? height : base==0.0 ?-5.0 : base);pos=vec3(pos_nx.xy,h); 646#else 647h=t > 0.0 ? height : base;pos=vec3(pos_nx.xy,h); 648#endif 649#ifdef PROJECTION_GLOBE_VIEW 650float lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*h);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,pos.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*pos.z;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition); 651#endif 652float cutoff=1.0;vec3 scaled_pos=pos; 653#ifdef RENDER_CUTOFF
654vec3 centroid_random=vec3(centroid_pos.xy,centroid_pos.x+centroid_pos.y+1.0);vec3 ground_pos=centroid_pos.x==0.0 ? pos.xyz : (centroid_random/8.0);vec4 ground=u_matrix*vec4(ground_pos.xy,ele,1.0);cutoff=max(0.01,cutoff_opacity(u_cutoff_params,ground.z));if (centroid_pos.y !=0.0 && centroid_pos.x !=0.0) {vec3 g=floor(ground_pos);vec3 mod_=centroid_random-g*8.0;float seed=min(1.0,0.1*(min(3.5,max(mod_.x+mod_.y,0.2*attr_height))*0.35+mod_.z));if (cutoff < 0.8-seed) {cutoff=0.0;}}float cutoff_scale=cutoff;scaled_pos.z=mix(c_ele,h,cutoff_scale); 655#endif 656float hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (cutoff < 0.01 && centroid_pos.x !=0.0));gl_Position=mix(u_matrix*vec4(scaled_pos,1),AWAY,hidden);h=h-ele;v_height=h; 657#ifdef RENDER_SHADOWS 658vec3 shd_pos0=pos;vec3 shd_pos1=pos; 659#ifdef NORMAL_OFFSET 660vec3 offset=shadow_normal_offset(normal);shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1(); 661#endif 662v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1); 663#endif 664float NdotL=0.0;float colorvalue=0.0; 665#ifndef LIGHTING_3D_MODE 666colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;NdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),NdotL);if (normal.y !=0.0) {float r=0.84;r=mix(0.7,0.98,1.0-u_lightintensity);NdotL*=( 667(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));} 668#endif 669#ifdef FAUX_AO 670float concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height; 671#ifdef TERRAIN 672top_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(ce
672ntroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height); 673#endif 674v_ao=vec2(mix(concave,-concave,start),y_ground);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]); 675#ifdef PROJECTION_GLOBE_VIEW 676top_height+=u_height_lift; 677#endif 678gl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w; 679#endif 680#ifdef LIGHTING_3D_MODE 681#ifdef FLOOD_LIGHT 682float is_wall=1.0-float(t > 0.0 && top_up_ny.y > 0.0);v_has_floodlight=float(flood_light_wall_radius > 0.0 && is_wall > 0.0);v_flood_radius=flood_light_wall_radius*u_vertical_scale; 683#endif 684v_color=vec4(color.rgb,1.0);v_flat=vec4(linearProduct(color.rgb,vec3(calculate_NdotL(normal))),1.0); 685#else 686v_color=vec4(0.0,0.0,0.0,1.0);v_color.rgb+=clamp(color.rgb*NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_color*=u_opacity; 687#endif 688#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE) 689float roofNdotL=clamp(u_lightpos.z,0.0,1.0);roofNdotL=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),roofNdotL);v_roof_color=vec4(0.0,0.0,0.0,1.0);v_roof_color.rgb+=clamp(color.rgb*roofNdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_roof_color*=u_opacity; 690#endif 691#ifdef FOG 692v_fog_pos=fog_position(pos); 693#endif 694}`),fillExtrusionDepth:Xt(`in highp float v_depth;void main() { 695#ifndef DEPTH_TEXTURE 696glFragColor=pack_depth(v_depth); 697#endif 698}`,`#include "_prelude_terrain.vertex.glsl" 699uniform mat4 u_matrix;uniform float u_edge_radius;uniform float u_vertical_scale;in vec4 a_pos_normal_ed;in vec2 a_centroid_pos; 700#pragma mapbox: define highp float base 701#pragma mapbox: define highp float height 702out highp float v_depth;void main() { 703#pragma mapbox: initialize highp float base 704#pragma mapbox: initialize highp float height 705base*=u_vertical_scale;height*=u_vertical_scale;vec3 pos_nx=floor(a_pos_normal_ed.xyz*0.5);mediump vec3 top_up_ny=a_pos_normal_ed.xyz-2.0*pos_nx;base=max(0.0,base);height=max(0.0,top_up_ny.y==0.0 && top_up_ny.x==1.0 ? height-u_edge_radius : height);float t=top_up_ny.x;vec2 centroid_pos=vec2(0.0); 706#if defined(HAS_CENTROID) || defined(TERRAIN) 707centroid_pos=a_centroid_pos; 708#endif 709vec3 pos; 710#ifdef TERRAIN 711bool flat_roof=centroid_pos.x !=0.0 && t > 0.0;float ele=elevation(pos_nx.xy);float c_ele=flat_roof ? centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos) : ele;float h=flat_roof ? max(c_ele+height,ele+base+2.0) : ele+(t > 0.0 ? height : base);pos=vec3(pos_nx.xy,h); 712#else 713pos=vec3(pos_nx.xy,t > 0.0 ? height : base); 714#endif 715float hidden=float(centroid_pos.x==0.0 && centroid_pos.y==1.0);gl_Position=mix(u_matrix*vec4(pos,1),AWAY,hidden);v_depth=gl_Position.z/gl_Position.w;}`),fillExtrusionPattern:Xt(`#include "_prelude_fog.fragment.glsl" 716#include "_prelude_lighting.glsl" 717uniform vec2 u_texsize;uniform sampler2D u_image; 718#ifdef FAUX_AO 719uniform lowp vec2 u_ao;in vec3 v_ao; 720#endif 721#ifdef LIGHTING_3D_MODE 722in vec3 v_normal; 723#endif 724in vec2 v_pos;in vec4 v_lighting;uniform lowp float u_opacity; 725#pragma mapbox: define highp float base 726#pragma mapbox: define highp float height 727#pragma mapbox: define mediump vec4 pattern 728#pragma mapbox: define highp float pixel_ratio 729void main() { 730#pragma mapbox: initialize highp float base 731#pragma mapbox: initialize highp float height 732#pragma mapbox: initialize mediump vec4 pattern 733#pragma mapbox: initialize highp float pixel_ratio 734vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 imagecoord=mod(v_pos,1.0);vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);vec4 out_color=textureLodCustom(u_image,pos,lod_pos); 735#ifdef LIGHTING_3D_MODE 736out_color=apply_lighting(out_color,normalize(v_normal))*u_opacity; 737#else 738out_color=out_color*v_lighting; 739#endif 740#ifdef FAUX_AO 741float intensity=u_ao[0];float h=max(0.0,v_ao.z);float h_floors=h/u_ao[1];float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);float shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x;float x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);shade*=mix(1.0,x_shade*x_shade*x_shade,concave);out_color.rgb=out_color.rgb*shade;
742#endif 743#ifdef FOG 744out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); 745#endif 746#ifdef INDICATOR_CUTOUT 747out_color=applyCutout(out_color); 748#endif 749glFragColor=out_color; 750#ifdef OVERDRAW_INSPECTOR 751glFragColor=vec4(1.0); 752#endif 753HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 754#include "_prelude_terrain.vertex.glsl" 755#include "_prelude_lighting.glsl" 756uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform float u_tile_units_to_pixels;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;in vec4 a_pos_normal_ed;in vec2 a_centroid_pos; 757#ifdef PROJECTION_GLOBE_VIEW 758in vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift; 759#endif 760out vec2 v_pos;out vec4 v_lighting; 761#ifdef FAUX_AO 762uniform lowp vec2 u_ao;out vec3 v_ao; 763#endif 764#ifdef LIGHTING_3D_MODE 765out vec3 v_normal; 766#endif 767#pragma mapbox: define highp float base 768#pragma mapbox: define highp float height 769#pragma mapbox: define mediump vec4 pattern 770#pragma mapbox: define highp float pixel_ratio 771void main() { 772#pragma mapbox: initialize highp float base 773#pragma mapbox: initialize highp float height 774#pragma mapbox: initialize mediump vec4 pattern 775#pragma mapbox: initialize highp float pixel_ratio 776vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec4 pos_nx=floor(a_pos_normal_ed*0.5);mediump vec4 top_up_ny_start=a_pos_normal_ed-2.0*pos_nx;mediump vec3 top_up_ny=top_up_ny_start.xyz;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0));float edgedistance=a_pos_normal_ed.w;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;base=max(0.0,base);height=max(0.0,height);float t=top_up_ny.x;float z=t > 0.0 ? height : base;vec2 centroid_pos=vec2(0.0); 777#if defined(HAS_CENTROID) || defined(TERRAIN) 778centroid_pos=a_centroid_pos; 779#endif 780float ele=0.0;float h=z;vec3 p;float c_ele; 781#ifdef TERRAIN 782bool flat_roof=centroid_pos.x !=0.0 && t > 0.0;ele=elevation(pos_nx.xy);c_ele=flat_roof ? centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos) : ele;h=flat_roof ? max(c_ele+height,ele+base+2.0) : ele+(t > 0.0 ? height : base==0.0 ?-5.0 : base);p=vec3(pos_nx.xy,h); 783#else 784p=vec3(pos_nx.xy,z); 785#endif 786#ifdef PROJECTION_GLOBE_VIEW 787float lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*(p.z+lift));vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,p.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*p.z;p=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition); 788#endif 789float hidden=float(centroid_pos.x==0.0 && centroid_pos.y==1.0);gl_Position=mix(u_matrix*vec4(p,1),AWAY,hidden);vec2 pos=normal.z==1.0 790? pos_nx.xy 791: vec2(edgedistance,z*u_height_factor);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float NdotL=0.0; 792#ifdef LIGHTING_3D_MODE 793NdotL=calculate_NdotL(normal); 794#else 795NdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),NdotL); 796#endif 797if (normal.y !=0.0) {float r=0.84; 798#ifndef LIGHTING_3D_MODE 799r=mix(0.7,0.98,1.0-u_lightintensity); 800#endif 801NdotL*=( 802(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));} 803#ifdef FAUX_AO 804float concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height; 805#ifdef TERRAIN 806top_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(ce
806ntroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height); 807#endif 808v_ao=vec3(mix(concave,-concave,start),y_ground,h-ele);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]); 809#ifdef PROJECTION_GLOBE_VIEW 810top_height+=u_height_lift; 811#endif 812gl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w; 813#endif 814#ifdef LIGHTING_3D_MODE 815v_normal=normal; 816#else 817v_lighting.rgb+=clamp(NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity; 818#endif 819#ifdef FOG 820v_fog_pos=fog_position(p); 821#endif 822}`),groundShadow:Xt(`#include "_prelude_shadow.fragment.glsl" 823precision highp float;uniform vec3 u_ground_shadow_factor;in vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1; 824#ifdef FOG 825in float v_fog_opacity; 826#endif 827void main() {float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);vec3 shadow=mix(u_ground_shadow_factor,vec3(1.0),light); 828#ifdef RENDER_CUTOFF 829shadow=mix(vec3(1.0),shadow,cutoff_opacity(u_cutoff_params,1.0/gl_FragCoord.w)); 830#endif 831#ifdef FOG 832shadow=mix(shadow,vec3(1.0),v_fog_opacity); 833#endif 834#ifdef INDICATOR_CUTOUT 835shadow=mix(shadow,vec3(1.0),1.0-applyCutout(vec4(1.0)).r); 836#endif 837glFragColor=vec4(shadow,1.0);}`,`#include "_prelude_fog.vertex.glsl" 838uniform mat4 u_matrix;uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;in vec2 a_pos;out vec4 v_pos_light_view_0;out vec4 v_pos_light_view_1; 839#ifdef FOG 840out float v_fog_opacity; 841#endif 842void main() {gl_Position=u_matrix*vec4(a_pos,0.0,1.0);v_pos_light_view_0=u_light_matrix_0*vec4(a_pos,0.0,1.0);v_pos_light_view_1=u_light_matrix_1*vec4(a_pos,0.0,1.0); 843#ifdef FOG 844v_fog_pos=fog_position(a_pos);v_fog_opacity=fog(v_fog_pos); 845#endif 846}`),fillExtrusionGroundEffect:Xt(`uniform highp float u_ao_pass;uniform highp float u_opacity;uniform highp float u_flood_light_intensity;uniform highp vec3 u_flood_light_color;uniform highp float u_attenuation;uniform sampler2D u_fb;uniform float u_fb_size; 847#ifdef SDF_SUBPASS 848in highp vec2 v_pos;in highp vec4 v_line_segment;in highp float v_flood_light_radius_tile;in highp vec2 v_ao;float line_df(highp vec2 a,highp vec2 b,highp vec2 p) {highp vec2 ba=b-a;highp vec2 pa=p-a;highp float r=clamp(dot(pa,ba)/dot(ba,ba),0.0,1.0);return length(pa-r*ba);} 849#ifdef FOG 850in highp float v_fog; 851#endif 852#endif 853void main() { 854#ifdef CLEAR_SUBPASS 855vec4 color=vec4(1.0); 856#ifdef CLEAR_FROM_TEXTURE 857color=texture(u_fb,gl_FragCoord.xy/vec2(u_fb_size)); 858#endif 859glFragColor=color; 860#else 861#ifdef SDF_SUBPASS 862highp float d=line_df(v_line_segment.xy,v_line_segment.zw,v_pos);highp float effect_radius=mix(v_flood_light_radius_tile,v_ao.y,u_ao_pass);d/=effect_radius;d=min(d,1.0);d=1.0-pow(1.0-d,u_attenuation);highp float effect_intensity=mix(u_flood_light_intensity,v_ao.x,u_ao_pass);highp float fog=1.0; 863#ifdef FOG 864fog=v_fog; 865#endif 866#ifdef RENDER_CUTOFF 867fog*=v_cutoff_opacity; 868#endif 869glFragColor=vec4(vec3(0.0),mix(1.0,d,effect_intensity*u_opacity*fog)); 870#else 871vec4 color=mix(vec4(u_flood_light_color,1.0),vec4(vec3(0.0),1.0),u_ao_pass); 872#ifdef OVERDRAW_INSPECTOR 873color=vec4(1.0); 874#endif 875glFragColor=color; 876#endif 877HANDLE_WIREFRAME_DEBUG; 878#endif 879}`,`#include "_prelude_fog.vertex.glsl" 880in highp vec4 a_pos_end;in highp float a_angular_offset_factor;in highp float a_hidden_by_landmark; 881#ifdef SDF_SUBPASS 882out highp vec2 v_pos;out highp vec4 v_line_segment;out highp float v_flood_light_radius_tile;out highp vec2 v_ao; 883#ifdef FOG 884out highp float v_fog; 885#endif 886#endif 887uniform highp float u_flood_light_intensity;uniform highp mat4 u_matrix;uniform highp float u_ao_pass;uniform highp float u_meter_to_tile;uniform highp float u_edge_radius;uniform highp vec2 u_ao; 888#pragma mapbox: define highp float flood_light_ground_radius 889const float TANGENT_CUTOFF=4.0;const float NORM=32767.0;void main() { 890#pragma mapbox: initialize highp float flood_light_ground_radius 891vec2 p=a_pos_end.xy;vec2 q=floor(a_pos_end.zw*0.5);vec2 start_bottom=a_pos_end.zw-q*2.0;float fl_ground_radius=flood_light_ground_radius;fl_ground_radius=abs(flood_light_ground_radius);float direction=flood_light_ground_radius < 0.0 ?-1.0 : 1.0;
891float flood_radius_tile=fl_ground_radius*u_meter_to_tile;vec2 v=normalize(q-p);float ao_radius=u_ao.y/3.5;float effect_radius=mix(flood_radius_tile,ao_radius,u_ao_pass)+u_edge_radius;float angular_offset_factor=a_angular_offset_factor/NORM*TANGENT_CUTOFF;float angular_offset=direction*angular_offset_factor*effect_radius;float top=1.0-start_bottom.y;float side=(0.5-start_bottom.x)*2.0;vec2 extrusion_parallel=v*side*mix(1.0,angular_offset,top);vec2 perp=vec2(v.y,-v.x);vec2 extrusion_perp=direction*perp*effect_radius*top;vec3 pos=vec3(mix(q,p,start_bottom.x),0.0);pos.xy+=extrusion_parallel+extrusion_perp; 892#ifdef SDF_SUBPASS 893v_pos=pos.xy;v_line_segment=vec4(p,q)+perp.xyxy*u_edge_radius;v_flood_light_radius_tile=flood_radius_tile;v_ao=vec2(u_ao.x,ao_radius); 894#ifdef FOG 895v_fog_pos=fog_position(pos);v_fog=1.0-fog(v_fog_pos); 896#endif 897#endif 898float hidden_by_landmark=0.0; 899#ifdef HAS_CENTROID 900hidden_by_landmark=a_hidden_by_landmark; 901#endif 902float isFloodlit=float(fl_ground_radius > 0.0 && u_flood_light_intensity > 0.0);float hidden=mix(1.0-isFloodlit,isFloodlit,u_ao_pass);hidden+=hidden_by_landmark;gl_Position=mix(u_matrix*vec4(pos,1.0),AWAY,float(hidden > 0.0)); 903#ifdef RENDER_CUTOFF 904v_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z); 905#endif 906}`),hillshadePrepare:Xt(`precision highp float;uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;float getElevation(vec2 coord) {return texture(u_image,coord).r/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y));float b=getElevation(v_pos+vec2(0,-epsilon.y));float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y));float d=getElevation(v_pos+vec2(-epsilon.x,0));float e=getElevation(v_pos+vec2(epsilon.x,0));float f=getElevation(v_pos+vec2(-epsilon.x,epsilon.y));float g=getElevation(v_pos+vec2(0,epsilon.y));float h=getElevation(v_pos+vec2(epsilon.x,epsilon.y));float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2( 907(c+e+e+h)-(a+d+d+f),(f+g+g+h)-(a+b+b+c) 908)/pow(2.0,exaggeration+(19.2562-u_zoom));glFragColor=clamp(vec4( 909deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);}`,"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:Xt(`#include "_prelude_fog.fragment.glsl" 910#include "_prelude_lighting.glsl" 911uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;uniform float u_emissive_strength;void main() {vec4 pixel=texture(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);glFragColor=accent_color*(1.0-shade_color.a)+shade_color; 912#ifdef LIGHTING_3D_MODE 913glFragColor=apply_lighting_with_emission_ground(glFragColor,u_emissive_strength); 914#endif 915#ifdef FOG 916glFragColor=fog_dither(fog_apply_premultiplied(glFragColor,v_fog_pos)); 917#endif 918#ifdef OVERDRAW_INSPECTOR 919glFragColor=vec4(1.0); 920#endif 921HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 922uniform mat4 u_matrix;in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0; 923#ifdef FOG 924v_fog_pos=fog_position(a_pos); 925#endif 926}`),line:Xt(`#include "_prelude_fog.fragment.glsl" 927#include "_prelude_lighting.glsl" 928uniform lowp float u_device_pixel_ratio;
928uniform float u_alpha_discard_threshold;uniform highp vec2 u_trim_offset;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;in highp vec4 v_uv; 929#ifdef RENDER_LINE_DASH 930uniform sampler2D u_dash_image;in vec2 v_tex; 931#endif 932#ifdef RENDER_LINE_GRADIENT 933uniform sampler2D u_gradient_image; 934#endif 935float luminance(vec3 c) {return (c.r+c.r+c.b+c.g+c.g+c.g)*0.1667;}uniform float u_emissive_strength; 936#pragma mapbox: define highp vec4 color 937#pragma mapbox: define lowp float floorwidth 938#pragma mapbox: define lowp vec4 dash 939#pragma mapbox: define lowp float blur 940#pragma mapbox: define lowp float opacity 941#pragma mapbox: define lowp float border_width 942#pragma mapbox: define lowp vec4 border_color 943float linearstep(float edge0,float edge1,float x) {return clamp((x-edge0)/(edge1-edge0),0.0,1.0);}void main() { 944#pragma mapbox: initialize highp vec4 color 945#pragma mapbox: initialize lowp float floorwidth 946#pragma mapbox: initialize lowp vec4 dash 947#pragma mapbox: initialize lowp float blur 948#pragma mapbox: initialize lowp float opacity 949#pragma mapbox: initialize lowp float border_width 950#pragma mapbox: initialize lowp vec4 border_color 951float 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); 952#ifdef RENDER_LINE_DASH 953float sdfdist=texture(u_dash_image,v_tex).r;
953float sdfgamma=1.0/(2.0*u_device_pixel_ratio)/dash.z;alpha*=linearstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist); 954#endif 955highp vec4 out_color; 956#ifdef RENDER_LINE_GRADIENT 957out_color=texture(u_gradient_image,v_uv.xy); 958#else 959out_color=color; 960#endif 961float trimmed=1.0; 962#ifdef RENDER_LINE_TRIM_OFFSET 963highp float start=v_uv[2];highp float end=v_uv[3];highp float trim_start=u_trim_offset[0];highp float trim_end=u_trim_offset[1];highp float line_progress=(start+(v_uv.x)*(end-start));if (trim_end > trim_start) {if (line_progress <=trim_end && line_progress >=trim_start) {out_color=vec4(0,0,0,0);trimmed=0.0;}} 964#endif 965if (u_alpha_discard_threshold !=0.0) {if (alpha < u_alpha_discard_threshold) {discard;}} 966#ifdef RENDER_LINE_BORDER 967float edgeBlur=(border_width+1.0/u_device_pixel_ratio);float alpha2=clamp(min(dist-(v_width2.t-edgeBlur),v_width2.s-dist)/edgeBlur,0.0,1.0);if (alpha2 < 1.) {float smoothAlpha=smoothstep(0.6,1.0,alpha2);if (border_color.a==0.0) { 968float Y=(out_color.a > 0.01) ? luminance(out_color.rgb/out_color.a) : 1.;float adjustment=(Y > 0.) ? 0.5/Y : 0.45;if (out_color.a > 0.25 && Y < 0.25) {vec3 borderColor=(Y > 0.) ? out_color.rgb : vec3(1,1,1)*out_color.a;out_color.rgb=out_color.rgb+borderColor*(adjustment*(1.0-smoothAlpha));} else {out_color.rgb*=(0.6 +0.4*smoothAlpha);}} else {out_color.rgb=mix(border_color.rgb*border_color.a*trimmed,out_color.rgb,smoothAlpha);}} 969#endif 970#ifdef LIGHTING_3D_MODE 971out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); 972#endif 973#ifdef FOG 974out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); 975#endif 976out_color*=(alpha*opacity); 977#ifdef INDICATOR_CUTOUT 978out_color=applyCutout(out_color); 979#endif 980glFragColor=out_color; 981#ifdef OVERDRAW_INSPECTOR 982glFragColor=vec4(1.0); 983#endif 984HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 985#define EXTRUDE_SCALE 0.015873016 986in vec2 a_pos_normal;in vec4 a_data; 987#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET) 988in highp vec4 a_packed; 989#endif 990#ifdef RENDER_LINE_DASH 991in float a_linesofar; 992#endif 993uniform mat4 u_matrix;uniform mat2 u_pixels_to_tile_units;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 vec4 v_uv; 994#ifdef RENDER_LINE_DASH 995uniform vec2 u_texsize;uniform float u_tile_units_to_pixels;out vec2 v_tex; 996#endif 997#ifdef RENDER_LINE_GRADIENT 998uniform float u_image_height; 999#endif 1000#pragma mapbox: define highp vec4 color 1001#pragma mapbox: define lowp float floorwidth 1002#pragma mapbox: define lowp vec4 dash 1003#pragma mapbox: define lowp float blur 1004#pragma mapbox: define lowp float opacity 1005#pragma mapbox: define mediump float gapwidth 1006#pragma mapbox: define lowp float offset 1007#pragma mapbox: define mediump float width 1008#pragma mapbox: define lowp float border_width 1009#pragma mapbox: define lowp vec4 border_color 1010void main() { 1011#pragma mapbox: initialize highp vec4 color 1012#pragma mapbox: initialize lowp float floorwidth 1013#pragma mapbox: initialize lowp vec4 dash 1014#pragma mapbox: initialize lowp float blur 1015#pragma mapbox: initialize lowp float opacity 1016#pragma mapbox: initialize mediump float gapwidth 1017#pragma mapbox: initialize lowp float offset 1018#pragma mapbox: initialize mediump float width 1019#pragma mapbox: initialize lowp float border_width 1020#pragma mapbox: initialize lowp vec4 border_color 1021float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*EXTRUDE_SCALE;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*EXTRUDE_SCALE*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist*u_pixels_to_tile_units,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude; 1022#ifndef RENDER_TO_TEXTURE 1023float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective; 1024#else 1025v_gamma_scale=1.0; 1026#endif 1027#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET) 1028float a_uv_x=a_packed[0];float a_split_index=a_packed[1];highp float a_clip_start=a_packed[2];highp float a_clip_end=a_packed[3]; 1029#ifdef RENDER_LINE_GRADIENT 1030highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec4(a_uv_x,a_split_index*texel_height-half_texel_height,a_clip_start,a_clip_end); 1031#else 1032v_uv=vec4(a_uv_x,0.0,a_clip_start,a_clip_end); 1033#endif 1034#endif 1035#ifdef RENDER_LINE_DASH 1036float scale=dash.z==0.0 ? 0.0 : u_tile_units_to_pixels/dash.z;float height=dash.y;v_tex=vec2(a_linesofar*scale/floorwidth,(-normal.y*height+dash.x+0.5)/u_texsize.y); 1037#endif 1038v_width2=vec2(outset,inset); 1039#ifdef FOG 1040v_fog_pos=fog_position(pos); 1041#endif 1042}`),linePattern:Xt(`#include "_prelude_fog.fragment.glsl" 1043#include "_prelude_lighting.glsl" 1044uniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_tile_units_to_pixels;uniform highp vec2 u_trim_offset;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; 1045#ifdef RENDER_LINE_TRIM_OFFSET 1046in highp vec4 v_uv; 1047#endif 1048#pragma mapbox: define lowp vec4 pattern 1049#pragma mapbox: define lowp float pixel_ratio 1050#pragma mapbox: define lowp float blur 1051#pragma mapbox: define lowp float opacity 1052void main() { 1053#pragma mapbox: initialize mediump vec4 pattern 1054#pragma mapbox: initialize lowp float pixel_ratio 1055#pragma mapbox: initialize lowp float blur 1056#pragma mapbox: initialize lowp float opacity 1057vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;vec2 pattern_size=vec2(display_size.x/u_tile_units_to_pixels,display_size.y);float aspect=display_size.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 pattern_x=v_linesofar/pattern_size.x*aspect;float x=mod(pattern_x,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos=mix(pattern_tl*texel_size-texel_size,pattern_br*texel_size+texel_size,vec2(x,y));vec2 lod_pos=mix(pattern_tl*texel_size-texel_size,pattern_br*texel_size+texel_size,vec2(pattern_x,y));vec4 color=textureLodCustom(u_image,pos,lod_pos); 1058#ifdef RENDER_LINE_TRIM_OFFSET 1059highp float start=v_uv[2];highp float end=v_uv[3];highp float trim_start=u_trim_offset[0];highp float trim_end=u_trim_offset[1];highp float line_progress=(start+(v_uv.x)*(end-start));if (trim_end > trim_start) {if (line_progress <=trim_end && line_progress >=trim_start) {color=vec4(0,0,0,0);}} 1060#endif 1061#ifdef LIGHTING_3D_MODE 1062color=apply_lighting_ground(color); 1063#endif 1064#ifdef FOG 1065color=fog_dither(fog_apply_premultiplied(color,v_fog_pos)); 1066#endif 1067color*=(alpha*opacity); 1068#ifdef INDICATOR_CUTOUT 1069color=applyCutout(color); 1070#endif 1071glFragColor=color; 1072#ifdef OVERDRAW_INSPECTOR 1073glFragColor=vec4(1.0); 1074#endif 1075HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 1076#define scale 0.015873016 1077in vec2 a_pos_normal;in vec4 a_data; 1078#ifdef RENDER_LINE_TRIM_OFFSET 1079in highp vec4 a_packed; 1080#endif 1081in float a_linesofar;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mat2 u_pixels_to_tile_units;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;out vec2 v_width2;out float v_linesofar;out float v_gamma_scale;out float v_width; 1082#ifdef RENDER_LINE_TRIM_OFFSET 1083out highp vec4 v_uv; 1084#endif 1085#pragma mapbox: define lowp float blur 1086#pragma mapbox: define lowp float opacity 1087#pragma mapbox: define lowp float offset 1088#pragma mapbox: define mediump float gapwidth 1089#pragma mapbox: define mediump float width 1090#pragma mapbox: define lowp float floorwidth 1091#pragma mapbox: define lowp vec4 pattern 1092#pragma mapbox: define lowp float pixel_ratio 1093void main() { 1094#pragma mapbox: initialize lowp float blur 1095#pragma mapbox: initialize lowp float opacity 1096#pragma mapbox: initialize lowp float offset 1097#pragma mapbox: initialize mediump float gapwidth 1098#pragma mapbox: initialize mediump float width 1099#pragma mapbox: initialize lowp float floorwidth 1100#pragma mapbox: initialize mediump vec4 pattern 1101#pragma mapbox: initialize lowp float pixel_ratio 1102float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist*u_pixels_to_tile_units,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude; 1103#ifndef RENDER_TO_TEXTURE 1104float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective; 1105#else 1106v_gamma_scale=1.0; 1107#endif 1108#ifdef RENDER_LINE_TRIM_OFFSET 1109float a_uv_x=a_packed[0];highp float a_clip_start=a_packed[2];highp float a_clip_end=a_packed[3];v_uv=vec4(a_uv_x,0.0,a_clip_start,a_clip_end); 1110#endif 1111v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth; 1112#ifdef FOG 1113v_fog_pos=fog_position(pos); 1114#endif 1115}`),raster:Xt(`#include "_prelude_fog.fragment.glsl" 1116#include "_prelude_lighting.glsl" 1117#include "_prelude_raster_array.glsl" 1118uniform float u_fade_t;uniform float u_opacity;uniform highp float u_raster_elevation;uniform highp float u_zoom_transition;in vec2 v_pos0;in vec2 v_pos1;in float v_depth; 1119#ifdef PROJECTION_GLOBE_VIEW 1120in float v_split_fade; 1121#endif 1122uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;uniform float u_emissive_strength; 1123#ifndef RASTER_ARRAY 1124uniform sampler2D u_image0;uniform sampler2D u_image1; 1125#endif 1126#ifdef RASTER_COLOR 1127uniform sampler2D u_color_ramp;uniform highp vec4 u_colorization_mix;uniform highp float u_colorization_offset;uniform vec2 u_texture_res; 1128#endif 1129void main() {vec4 color0,color1,color;vec2 value; 1130#ifdef RASTER_COLOR 1131#ifdef RASTER_ARRAY 1132#ifdef RASTER_ARRAY_LINEAR 1133value=mix( 1134raTexture2D_image0_linear(v_pos0,u_texture_res,u_colorization_mix,u_colorization_offset),raTexture2D_image1_linear(v_pos1,u_texture_res,u_colorization_mix,u_colorization_offset),u_fade_t 1135); 1136#else 1137value=mix( 1138raTexture2D_image0_nearest(v_pos0,u_texture_res,u_colorization_mix,u_colorization_offset),raTexture2D_image1_nearest(v_pos1,u_texture_res,u_colorization_mix,u_colorization_offset),u_fade_t 1139); 1140#endif 1141if (value.y > 0.0) value.x/=value.y; 1142#else 1143color=mix(texture(u_image0,v_pos0),texture(u_image1,v_pos1),u_fade_t);value=vec2(u_colorization_offset+dot(color.rgb,u_colorization_mix.rgb),color.a); 1144#endif 1145color=texture(u_color_ramp,vec2(value.x,0.5));if (color.a > 0.0) color.rgb/=color.a;color.a*=value.y; 1146#else 1147color0=texture(u_image0,v_pos0);color1=texture(u_image1,v_pos1);if (color0.a > 0.0) color0.rgb/=color0.a;if (color1.a > 0.0) color1.rgb/=color1.a;color=mix(color0,color1,u_fade_t); 1148#endif 1149color.a*=u_opacity; 1150#ifdef GLOBE_POLES 1151color.a*=1.0-smoothstep(0.0,0.05,u_zoom_transition); 1152#endif 1153vec3 rgb=color.rgb;rgb=vec3( 1154dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);vec3 out_color=mix(u_high_vec,u_low_vec,rgb); 1155#ifdef LIGHTING_3D_MODE 1156out_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),u_emissive_strength).rgb; 1157#endif 1158#ifdef FOG 1159highp float fog_limit_high_meters=1000000.0;highp float fog_limit_low_meters=600000.0;float fog_limit=1.0-smoothstep(fog_limit_low_meters,fog_limit_high_meters,u_raster_elevation);out_color=fog_dither(fog_apply(out_color,v_fog_pos,fog_limit)); 1160#endif 1161glFragColor=vec4(out_color*color.a,color.a); 1162#ifdef PROJECTION_GLOBE_VIEW 1163glFragColor*=mix(1.0,1.0-smoothstep(0.0,0.05,u_zoom_transition),smoothstep(0.8,0.9,v_split_fade)); 1164#endif 1165#ifdef RENDER_CUTOFF 1166glFragColor=glFragColor*cutoff_opacity(u_cutoff_params,v_depth); 1167#endif 1168#ifdef OVERDRAW_INSPECTOR 1169glFragColor=vec4(1.0); 1170#endif 1171HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 1172uniform mat4 u_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform mat3 u_grid_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform vec2 u_perspective_transform;uniform vec2 u_texture_offset;uniform float u_raster_elevation;uniform float u_zoom_transition;uniform vec2 u_merc_center; 1173#define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8 1174#ifdef GLOBE_POLES 1175in vec3 a_globe_pos;in vec2 a_uv; 1176#else 1177in vec2 a_pos;in vec2 a_texture_pos; 1178#endif 1179out vec2 v_pos0;out vec2 v_pos1;out float v_depth; 1180#ifdef PROJECTION_GLOBE_VIEW 1181out float v_split_fade; 1182#endif 1183void main() {vec2 uv; 1184#ifdef GLOBE_POLES 1185vec3 globe_pos=a_globe_pos;globe_pos+=normalize(globe_pos)*u_raster_elevation*GLOBE_UPSCALE;gl_Position=u_matrix*u_globe_matrix*vec4(globe_pos ,1.0);uv=a_uv; 1186#ifdef FOG 1187v_fog_pos=fog_position((u_normalize_matrix*vec4(a_globe_pos,1.0)).xyz); 1188#endif 1189#else 1190float w=1.0+dot(a_texture_pos,u_perspective_transform);uv=a_texture_pos/8192.0; 1191#ifdef PROJECTION_GLOBE_VIEW 1192vec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);vec3 globe_pos=latLngToECEF(latLng.xy);globe_pos+=normalize(globe_pos)*u_raster_elevation*GLOBE_UPSCALE;vec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);float mercatorY=mercatorYfromLat(latLng[0]);float mercatorX=mercatorXfromLng(latLng[1]); 1193v_split_fade=0.0;if (u_zoom_transition > 0.0) {vec2 merc_pos=vec2(mercatorX,mercatorY);merc_world_pos=vec4(merc_pos,u_raster_elevation,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;float opposite_merc_center=mod(u_merc_center.x+0.5,1.0);float dist_from_poles=(abs(mercatorY-0.5)*2.0);float range=0.1;v_split_fade=abs(opposite_merc_center-mercatorX);v_split_fade=clamp(1.0-v_split_fade,0.0,1.0);v_split_fade=max(smoothstep(1.0-range,1.0,dist_from_poles),max(smoothstep(1.0-range,1.0,v_split_fade),smoothstep(1.0-range,1.0,1.0-v_split_fade)));}float tiles=u_grid_matrix[0][2];
1193if (tiles > 0.0) {float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];float uvY=mercatorY*tiles-idy;float uvX=mercatorX*tiles-idx;uv=vec2(uvX,uvY);}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition)*w,w);gl_Position=u_matrix*interpolated_pos; 1194#ifdef FOG 1195v_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz); 1196#endif 1197#else 1198gl_Position=u_matrix*vec4(a_pos*w,u_raster_elevation*w,w); 1199#ifdef FOG 1200v_fog_pos=fog_position(a_pos); 1201#endif 1202#endif 1203#endif 1204v_pos0=uv;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;v_pos0=u_texture_offset.x+u_texture_offset.y*v_pos0;v_pos1=u_texture_offset.x+u_texture_offset.y*v_pos1; 1205#ifdef RENDER_CUTOFF 1206v_depth=gl_Position.z; 1207#endif 1208}`),rasterParticle:Xt(`#include "_prelude_fog.fragment.glsl" 1209#include "_prelude_lighting.glsl" 1210uniform float u_fade_t;uniform float u_opacity;uniform highp float u_raster_elevation;in vec2 v_pos0;in vec2 v_pos1;uniform sampler2D u_image0;uniform sampler2D u_image1;void main() {vec4 color0,color1,color;color0=texture(u_image0,v_pos0);color1=texture(u_image1,v_pos1);if (color0.a > 0.0) color0.rgb/=color0.a;if (color1.a > 0.0) color1.rgb/=color1.a;color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 out_color=color.rgb; 1211#ifdef LIGHTING_3D_MODE 1212out_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),0.0).rgb; 1213#endif 1214#ifdef FOG 1215highp float fog_limit_high_meters=1000000.0;highp float fog_limit_low_meters=600000.0;float fog_limit=1.0-smoothstep(fog_limit_low_meters,fog_limit_high_meters,u_raster_elevation);out_color=fog_dither(fog_apply(out_color,v_fog_pos,fog_limit)); 1216#endif 1217glFragColor=vec4(out_color*color.a,color.a); 1218#ifdef OVERDRAW_INSPECTOR 1219glFragColor=vec4(1.0); 1220#endif 1221HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 1222uniform mat4 u_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform mat3 u_grid_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_raster_elevation;uniform float u_zoom_transition;uniform vec2 u_merc_center; 1223#define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8 1224in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos0;out vec2 v_pos1;void main() {float w=1.0; 1225#ifdef PROJECTION_GLOBE_VIEW 1226vec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);float mercatorY=mercatorYfromLat(latLng[0]);float mercatorX=mercatorXfromLng(latLng[1]);float tiles=u_grid_matrix[0][2];float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];float uvX=mercatorX*tiles-idx;float uvY=mercatorY*tiles-idy;vec2 uv=vec2(uvX,uvY);vec3 globe_pos=latLngToECEF(latLng.xy);globe_pos+=normalize(globe_pos)*u_raster_elevation*GLOBE_UPSCALE;vec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);if (u_zoom_transition > 0.0) {vec2 merc_pos=vec2(mercatorX,mercatorY);merc_world_pos=vec4(merc_pos,u_raster_elevation,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition)*w,w);gl_Position=u_matrix*interpolated_pos; 1227#ifdef FOG 1228v_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz); 1229#endif 1230#else 1231vec2 uv=a_texture_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*w,u_raster_elevation*w,w); 1232#ifdef FOG 1233v_fog_pos=fog_position(a_pos); 1234#endif 1235#endif 1236v_pos0=uv;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}`),rasterParticleDraw:Xt("precision highp float;uniform sampler2D u_color_ramp;in float v_particle_speed;void main() {glFragColor=texture(u_color_ramp,vec2(v_particle_speed,0.5));}",`precision highp float; 1237#include "_prelude_raster_array.glsl" 1238#include "_prelude_raster_particle.glsl" 1239in vec3 a_pos;uniform vec2 u_tile_offset;out float v_particle_speed;void main() {vec2 pos=a_pos.xy+u_tile_offset;vec2 tex_coords=fract(pos);gl_PointSize=1.0;vec2 velocity=lookup_velocity(tex_coords);if (velocity==INVALID_VELOCITY) {v_particle_speed=0.0;gl_Position=vec4(2.0,2.0,2.0,1.0);} else {v_particle_speed=length(velocity);gl_Position=vec4(2.0*pos-vec2(1.0),0.0,1.0);}}`),rasterParticleTexture:Xt("uniform sampler2D u_texture;uniform float u_opacity;in vec2 v_tex_pos;void main() {vec4 color=texture(u_texture,v_tex_pos);glFragColor=vec4(floor(255.0*color*u_opacity)/255.0);}","in vec2 a_pos;out vec2 v_tex_pos;void main() {v_tex_pos=0.5*a_pos+vec2(0.5);gl_Position=vec4(a_pos,0.0,1.0);}"),rasterParticleUpdate:Xt("void main() {}",`#include "_prelude_raster_array.glsl" 1240#include "_prelude_raster_particle.glsl" 1241in vec3 a_pos;uniform float u_speed_factor;uniform float u_lifetime_delta;uniform float u_rand_seed;out vec3 v_new_particle;const vec3 rand_constants=vec3(12.9898,78.233,4375.85453);float rand(const vec2 co) {float t=dot(rand_constants.xy,co);return fract(sin(t)*(rand_constants.z+t));}void main() {float lifetime=a_pos.z;vec2 pos=a_pos.xy;vec2 uv=clamp(pos,vec2(0.0),vec2(1.0));vec2 velocity=lookup_velocity(uv);float next_lifetime=lifetime-u_lifetime_delta;float t=step(0.0,next_lifetime); 1242#ifdef DATA_FORMAT_UINT32 1243vec2 dp=vec2(0); 1244#else
1245vec2 dp=velocity==INVALID_VELOCITY ? vec2(0) : velocity*u_speed_factor; 1246#endif 1247vec2 seed=pos*u_rand_seed;vec2 next_pos=pos+dp;vec2 random_pos=vec2(rand(seed+1.3),rand(seed+2.1));v_new_particle=vec3( 1248vec2(mix(random_pos,next_pos,t)),mix(1.0,next_lifetime,t) 1249);}`),symbolIcon:Xt(`#include "_prelude_lighting.glsl" 1250uniform sampler2D u_texture; 1251#ifdef ICON_TRANSITION 1252uniform float u_icon_transition; 1253#endif 1254in float v_fade_opacity;in vec2 v_tex_a; 1255#ifdef ICON_TRANSITION 1256in vec2 v_tex_b; 1257#endif 1258uniform mediump float u_icon_saturation; 1259#pragma mapbox: define lowp float opacity 1260#pragma mapbox: define lowp float emissive_strength 1261void main() { 1262#pragma mapbox: initialize lowp float opacity 1263#pragma mapbox: initialize lowp float emissive_strength 1264lowp float alpha=opacity*v_fade_opacity;vec4 out_color; 1265#ifdef ICON_TRANSITION 1266vec4 a=texture(u_texture,v_tex_a)*(1.0-u_icon_transition);vec4 b=texture(u_texture,v_tex_b)*u_icon_transition;out_color=(a+b)*alpha; 1267#else 1268out_color=texture(u_texture,v_tex_a)*alpha; 1269#endif 1270#ifdef SATURATION 1271vec3 luma=vec3(dot(out_color.rgb,vec3(0.2126,0.7152,0.0722)));out_color.rgb=mix(luma,out_color.rgb,u_icon_saturation); 1272#endif 1273#ifdef LIGHTING_3D_MODE 1274out_color=apply_lighting_with_emission_ground(out_color,emissive_strength); 1275#endif 1276glFragColor=out_color; 1277#ifdef OVERDRAW_INSPECTOR 1278glFragColor=vec4(1.0); 1279#endif 1280HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_terrain.vertex.glsl" 1281in vec4 a_pos_offset;in vec4 a_tex_size;in vec4 a_pixeloffset;in vec4 a_projected_pos;in float a_fade_opacity; 1282#ifdef Z_OFFSET 1283in float a_z_offset; 1284#endif 1285#ifdef PROJECTION_GLOBE_VIEW 1286in vec3 a_globe_anchor;in vec3 a_globe_normal; 1287#endif 1288#ifdef ICON_TRANSITION 1289in vec2 a_texb; 1290#endif 1291uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;uniform vec3 u_up_vector; 1292#ifdef PROJECTION_GLOBE_VIEW 1293uniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_camera_forward;uniform float u_zoom_transition;uniform vec3 u_ecef_origin;uniform mat4 u_tile_matrix; 1294#endif 1295out vec2 v_tex_a; 1296#ifdef ICON_TRANSITION 1297out vec2 v_tex_b; 1298#endif 1299out float v_fade_opacity; 1300#pragma mapbox: define lowp float opacity 1301#pragma mapbox: define lowp float emissive_strength 1302void main() { 1303#pragma mapbox: initialize lowp float opacity 1304#pragma mapbox: initialize lowp float emissive_strength 1305vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_min_font_scale=a_pixeloffset.zw/256.0;highp float segment_angle=-a_projected_pos[3];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 tile_anchor=a_pos;float e=elevation(tile_anchor); 1306#ifdef Z_OFFSET 1307e+=a_z_offset; 1308#endif 1309vec3 h=elevationVector(tile_anchor)*e;float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos; 1310#ifdef PROJECTION_GLOBE_VIEW 1311mercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);world_pos=mix_globe_mercator(a_globe_anchor+h,mercator_pos,u_zoom_transition);vec4 ecef_point=u_tile_matrix*vec4(world_pos,1.0);vec3 origin_to_point=ecef_point.xyz-u_ecef_origin;globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0; 1312#else 1313world_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0; 1314#endif 1315vec4 projected_point=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projected_point.w;highp float distance_ratio=u_pitch_with_map ? 1316camera_to_anchor_distance/u_camera_to_center_distance : 1317u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp( 13180.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float font_scale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjected_point; 1319#ifdef PROJECTION_GLOBE_VIEW 1320vec3 displacement=vec3(a_globe_normal.z,0,-a_globe_normal.x);offsetProjected_point=u_matrix*vec4(a_globe_anchor+displacement,1); 1321#else 1322offsetProjected_point=u_matrix*vec4(tile_anchor+vec2(1,0),0,1); 1323#endif 1324vec2 a=projected_point.xy/projected_point.w;vec2 b=offsetProjected_point.xy/offsetProjected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos; 1325#ifdef PROJECTION_GLOBE_VIEW 1326vec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz+h,mercator_pos,u_zoom_transition);projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0); 1327#else 1328projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0); 1329#endif 1330highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*max(a_min_font_scale,font_scale)+a_pxoffset/16.0); 1331#ifdef TERRAIN 1332#ifdef PITCH_WITH_MAP_TERRAIN 1333vec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy); 1334#endif 1335#endif 1336float occlusion_fade=occlusionFade(projected_point)*globe_occlusion_fade;float projection_transition_fade=1.0; 1337#if defined(PROJECTED_POS_ON_VIEWPORT) && defined(PROJECTION_GLOBE_VIEW) 1338projection_transition_fade=1.0-step(EPSILON,u_zoom_transition); 1339#endif 1340vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float out_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change))*projection_transition_fade;float alpha=opacity*out_fade_opacity;float hidden=float(alpha==0.0 || projected_point.w <=0.0 || occlusion_fade==0.0); 1341#ifdef PROJECTION_GLOBE_VIEW 1342vec3 xAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,u_up_vector)) : vec3(1,0,0);vec3 yAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,xAxis)) : vec3(0,1,0);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y,1.0),AWAY,hidden); 1343#else 1344gl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,hidden); 1345#endif 1346v_tex_a=a_tex/u_texsize; 1347#ifdef ICON_TRANSITION 1348v_tex_b=a_texb/u_texsize; 1349#endif 1350v_fade_opacity=out_fade_opacity;}`),symbolSDF:Xt(`#include "_prelude_lighting.glsl" 1351#define SDF_PX 8.0 1352uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;uniform bool u_is_halo;in float v_draw_halo;in vec2 v_data0;in vec3 v_data1; 1353#pragma mapbox: define highp vec4 fill_color 1354#pragma mapbox: define highp vec4 halo_color 1355#pragma mapbox: define lowp float opacity 1356#pragma mapbox: define lowp float halo_width 1357#pragma mapbox: define lowp float halo_blur 1358#pragma mapbox: define lowp float emissive_strength 1359void main() { 1360#pragma mapbox: initialize highp vec4 fill_color 1361#pragma mapbox: initialize highp vec4 halo_color 1362#pragma mapbox: initialize lowp float opacity 1363#pragma mapbox: initialize lowp float halo_width 1364#pragma mapbox: initialize lowp float halo_blur 1365#pragma mapbox: initialize lowp float emissive_strength 1366float EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;bool draw_halo=v_draw_halo > 0.0;if (draw_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture(u_texture,tex).r;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);vec4 out_color=color*(alpha*opacity*fade_opacity); 1367#ifdef LIGHTING_3D_MODE 1368out_color=apply_lighting_with_emission_ground(out_color,emissive_strength); 1369#endif 1370glFragColor=out_color; 1371#ifdef OVERDRAW_INSPECTOR 1372glFragColor=vec4(1.0); 1373#endif 1374HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_terrain.vertex.glsl" 1375in vec4 a_pos_offset;in vec4 a_tex_size;in vec4 a_pixeloffset;in vec4 a_projected_pos;in float a_fade_opacity; 1376#ifdef Z_OFFSET 1377in float a_z_offset; 1378#endif 1379#ifdef PROJECTION_GLOBE_VIEW 1380in vec3 a_globe_anchor;in vec3 a_globe_normal; 1381#endif 1382uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec3 u_up_vector;uniform bool u_is_halo; 1383#ifdef PROJECTION_GLOBE_VIEW 1384uniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_camera_forward;uniform float u_zoom_transition;uniform vec3 u_ecef_origin;uniform mat4 u_tile_matrix; 1385#endif 1386out float v_draw_halo;out vec2 v_data0;out vec3 v_data1; 1387#pragma mapbox: define highp vec4 fill_color 1388#pragma mapbox: define highp vec4 halo_color 1389#pragma mapbox: define lowp float opacity 1390#pragma mapbox: define lowp float halo_width 1391#pragma mapbox: define lowp float halo_blur 1392#pragma mapbox: define lowp float emissive_strength 1393void main() { 1394#pragma mapbox: initialize highp vec4 fill_color 1395#pragma mapbox: initialize highp vec4 halo_color 1396#pragma mapbox: initialize lowp float opacity 1397#pragma mapbox: initialize lowp float halo_width 1398#pragma mapbox: initialize lowp float halo_blur 1399#pragma mapbox: initialize lowp float emissive_strength 1400vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;highp float segment_angle=-a_projected_pos[3];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 tile_anchor=a_pos;float e=elevation(tile_anchor); 1401#ifdef Z_OFFSET 1402e+=a_z_offset; 1403#endif 1404vec3 h=elevationVector(tile_anchor)*e;float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos; 1405#ifdef PROJECTION_GLOBE_VIEW 1406mercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);world_pos=mix_globe_mercator(a_globe_anchor+h,mercator_pos,u_zoom_transition);vec4 ecef_point=u_tile_matrix*vec4(world_pos,1.0);vec3 origin_to_point=ecef_point.xyz-u_ecef_origin;globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0; 1407#else 1408world_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0; 1409#endif 1410vec4 projected_point=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projected_point.w;highp float distance_ratio=u_pitch_with_map ? 1411camera_to_anchor_distance/u_camera_to_center_distance : 1412u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp( 14130.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetprojected_point; 1414#ifdef PROJECTION_GLOBE_VIEW 1415vec3 displacement=vec3(a_globe_normal.z,0,-a_globe_normal.x);offsetprojected_point=u_matrix*vec4(a_globe_anchor+displacement,1); 1416#else 1417offsetprojected_point=u_matrix*vec4(tile_anchor+vec2(1,0),0,1); 1418#endif 1419vec2 a=projected_point.xy/projected_point.w;vec2 b=offsetprojected_point.xy/offsetprojected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos; 1420#ifdef PROJECTION_GLOBE_VIEW 1421vec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz+h,mercator_pos,u_zoom_transition);projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0); 1422#else 1423projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0); 1424#endif 1425highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset); 1426#ifdef TERRAIN 1427#ifdef PITCH_WITH_MAP_TERRAIN 1428vec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy); 1429#endif 1430#endif 1431float occlusion_fade=occlusionFade(projected_point)*globe_occlusion_fade;float projection_transition_fade=1.0; 1432#if defined(PROJECTED_POS_ON_VIEWPORT) && defined(PROJECTION_GLOBE_VIEW) 1433projection_transition_fade=1.0-step(EPSILON,u_zoom_transition); 1434#endif 1435vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change));float out_fade_opacity=interpolated_fade_opacity*projection_transition_fade;float alpha=opacity*out_fade_opacity;float hidden=float(alpha==0.0 || projected_point.w <=0.0 || occlusion_fade==0.0); 1436#ifdef PROJECTION_GLOBE_VIEW 1437vec3 xAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,u_up_vector)) : vec3(1,0,0);vec3 yAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,xAxis)) : vec3(0,1,0);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y,1.0),AWAY,hidden); 1438#else 1439gl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,hidden); 1440#endif 1441float gamma_scale=gl_Position.w;v_draw_halo=(u_is_halo && float(gl_InstanceID)==0.0) ? 1.0 : 0.0;v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,out_fade_opacity);}`),symbolTextAndIcon:Xt(`#include "_prelude_lighting.glsl" 1442#define SDF_PX 8.0 1443#define SDF 1.0 1444#define ICON 0.0 1445uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_halo;in float v_draw_halo;in vec4 v_data0;in vec4 v_data1; 1446#pragma mapbox: define highp vec4 fill_color 1447#pragma mapbox: define highp vec4 halo_color 1448#pragma mapbox: define lowp float opacity 1449#pragma mapbox: define lowp float halo_width 1450#pragma mapbox: define lowp float halo_blur 1451#pragma mapbox: define lowp float emissive_strength 1452void main() { 1453#pragma mapbox: initialize highp vec4 fill_color 1454#pragma mapbox: initialize highp vec4 halo_color 1455#pragma mapbox: initialize lowp float opacity 1456#pragma mapbox: initialize lowp float halo_width 1457#pragma mapbox: initialize lowp float halo_blur 1458#pragma mapbox: initialize lowp float emissive_strength 1459float fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;
1459glFragColor=texture(u_texture_icon,tex_icon)*alpha; 1460#ifdef OVERDRAW_INSPECTOR 1461glFragColor=vec4(1.0); 1462#endif 1463return;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;bool draw_halo=v_draw_halo > 0.0;if (draw_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture(u_texture,tex).r;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);vec4 out_color=color*(alpha*opacity*fade_opacity); 1464#ifdef LIGHTING_3D_MODE 1465out_color=apply_lighting_with_emission_ground(out_color,emissive_strength); 1466#endif 1467glFragColor=out_color; 1468#ifdef OVERDRAW_INSPECTOR 1469glFragColor=vec4(1.0); 1470#endif 1471HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_terrain.vertex.glsl" 1472in vec4 a_pos_offset;in vec4 a_tex_size;in vec4 a_projected_pos;in float a_fade_opacity; 1473#ifdef Z_OFFSET 1474in float a_z_offset; 1475#endif 1476#ifdef PROJECTION_GLOBE_VIEW 1477in vec3 a_globe_anchor;in vec3 a_globe_normal; 1478#endif 1479uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec3 u_up_vector;uniform vec2 u_texsize_icon;uniform bool u_is_halo; 1480#ifdef PROJECTION_GLOBE_VIEW 1481uniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_camera_forward;uniform float u_zoom_transition;uniform vec3 u_ecef_origin;uniform mat4 u_tile_matrix; 1482#endif 1483out float v_draw_halo;out vec4 v_data0;out vec4 v_data1; 1484#pragma mapbox: define highp vec4 fill_color 1485#pragma mapbox: define highp vec4 halo_color 1486#pragma mapbox: define lowp float opacity 1487#pragma mapbox: define lowp float halo_width 1488#pragma mapbox: define lowp float halo_blur 1489#pragma mapbox: define lowp float emissive_strength 1490void main() { 1491#pragma mapbox: initialize highp vec4 fill_color 1492#pragma mapbox: initialize highp vec4 halo_color 1493#pragma mapbox: initialize lowp float opacity 1494#pragma mapbox: initialize lowp float halo_width 1495#pragma mapbox: initialize lowp float halo_blur 1496#pragma mapbox: initialize lowp float emissive_strength 1497vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;highp float segment_angle=-a_projected_pos[3];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 tile_anchor=a_pos;float e=elevation(tile_anchor); 1498#ifdef Z_OFFSET 1499e+=a_z_offset; 1500#endif 1501vec3 h=elevationVector(tile_anchor)*e;float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos; 1502#ifdef PROJECTION_GLOBE_VIEW 1503mercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);world_pos=mix_globe_mercator(a_globe_anchor+h,mercator_pos,u_zoom_transition);vec4 ecef_point=u_tile_matrix*vec4(world_pos,1.0);vec3 origin_to_point=ecef_point.xyz-u_ecef_origin;globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0; 1504#else 1505world_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0; 1506#endif 1507vec4 projected_point=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projected_point.w;highp float distance_ratio=u_pitch_with_map ? 1508camera_to_anchor_distance/u_camera_to_center_distance : 1509u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp( 15100.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float font_scale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offset_projected_point=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projected_point.xy/projected_point.w;vec2 b=offset_projected_point.xy/offset_projected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos; 1511#ifdef PROJECTION_GLOBE_VIEW 1512vec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz+h,mercator_pos,u_zoom_transition);projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0); 1513#else 1514projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0); 1515#endif 1516highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*font_scale); 1517#ifdef TERRAIN 1518#ifdef PITCH_WITH_MAP_TERRAIN 1519vec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy); 1520#endif 1521#endif 1522float occlusion_fade=occlusionFade(projected_point)*globe_occlusion_fade;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change));float projection_transition_fade=1.0; 1523#if defined(PROJECTED_POS_ON_VIEWPORT) && defined(PROJECTION_GLOBE_VIEW) 1524projection_transition_fade=1.0-step(EPSILON,u_zoom_transition); 1525#endif 1526float out_fade_opacity=interpolated_fade_opacity*projection_transition_fade;float alpha=opacity*out_fade_opacity;float hidden=float(alpha==0.0 || projected_point.w <=0.0 || occlusion_fade==0.0); 1527#ifdef PROJECTION_GLOBE_VIEW 1528vec3 xAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,u_up_vector)) : vec3(1,0,0);vec3 yAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,xAxis)) : vec3(0,1,0);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y,1.0),AWAY,hidden); 1529#else 1530gl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,hidden); 1531#endif 1532float gamma_scale=gl_Position.w;v_draw_halo=(u_is_halo && float(gl_InstanceID)==0.0) ? 1.0 : 0.0;v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,out_fade_opacity,is_sdf);}`),terrainRaster:Xt(`#include "_prelude_fog.fragment.glsl" 1533#include "_prelude_shadow.fragment.glsl" 1534#include "_prelude_lighting.glsl" 1535uniform sampler2D u_image0;in vec2 v_pos0; 1536#ifdef FOG 1537in float v_fog_opacity; 1538#endif 1539#ifdef RENDER_SHADOWS 1540in vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1; 1541#endif 1542uniform vec3 u_ground_shadow_factor;void main() {vec4 image_color=texture(u_image0,v_pos0);vec4 color; 1543#ifdef LIGHTING_3D_MODE 1544const vec3 normal=vec3(0.0,0.0,1.0); 1545#ifdef RENDER_SHADOWS 1546float cutoffOpacity=1.0; 1547#ifdef RENDER_CUTOFF 1548cutoffOpacity=cutoff_opacity(u_cutoff_params,1.0/gl_FragCoord.w); 1549#endif 1550#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS 1551vec3 unlit_base=image_color.rgb*(1.0-image_color.a);vec3 emissive_base=image_color.rgb*image_color.a;float ndotl=u_shadow_direction.z;float occlusion=ndotl < 0.0 ? 1.0 : shadow_occlusion(v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w,0.0);ndotl=max(0.0,ndotl);vec3 lit=apply_lighting(unlit_base,normal,mix(1.0,(1.0-(u_shadow_intensity*occlusion))*ndotl,cutoffOpacity));vec3 emissive=compute_emissive_draped(emissive_base,1.0-u_shadow_intensity,occlusion,u_ground_shadow_factor);color.rgb=lit+emissive;color.a=1.0; 1552#else 1553float lighting_factor=shadowed_light_factor_normal_unbiased(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);color=apply_lighting(image_color,normal,mix(1.0,lighting_factor,cutoffOpacity)); 1554#endif 1555#else 1556float lighting_factor=u_lighting_directional_dir.z;color=apply_lighting(image_color,normal,lighting_factor); 1557#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS 1558color.rgb=mix(color.rgb,image_color.rgb,image_color.a);color.a=1.0; 1559#endif 1560#endif 1561#else 1562color=image_color; 1563#endif 1564#ifdef FOG 1565#ifdef ZERO_EXAGGERATION 1566color=fog_dither(fog_apply_premultiplied(color,v_fog_pos)); 1567#else 1568color=fog_dither(fog_apply_from_vert(color,v_fog_opacity)); 1569#endif 1570#endif 1571glFragColor=color; 1572#ifdef OVERDRAW_INSPECTOR 1573glFragColor=vec4(1.0); 1574#endif 1575HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 1576#include "_prelude_terrain.vertex.glsl" 1577uniform mat4 u_matrix;uniform float u_skirt_height;in vec2 a_pos;out vec2 v_pos0; 1578#ifdef FOG 1579out float v_fog_opacity; 1580#endif 1581#ifdef RENDER_SHADOWS 1582uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out vec4 v_pos_light_view_0;out vec4 v_pos_light_view_1;out float v_depth; 1583#endif 1584void main() {vec3 decomposedPosAndSkirt=decomposeToPosAndSkirt(a_pos);float skirt=decomposedPosAndSkirt.z;vec2 decodedPos=decomposedPosAndSkirt.xy;float elevation=elevation(decodedPos)-skirt*u_skirt_height;v_pos0=decodedPos/8192.0;gl_Position=u_matrix*vec4(decodedPos,elevation,1.0); 1585#ifdef FOG 1586#ifdef ZERO_EXAGGERATION 1587v_fog_pos=fog_position(decodedPos); 1588#else 1589v_fog_opacity=fog(fog_position(vec3(decodedPos,elevation))); 1590#endif 1591#endif 1592#ifdef RENDER_SHADOWS 1593vec3 pos=vec3(decodedPos,elevation);v_pos_light_view_0=u_light_matrix_0*vec4(pos,1.);v_pos_light_view_1=u_light_matrix_1*vec4(pos,1.); 1594#endif 1595}`),terrainDepth:Xt("precision highp float;in float v_depth;void main() {glFragColor=pack_depth(v_depth);}",`#include "_prelude_terrain.vertex.glsl" 1596uniform mat4 u_matrix;in vec2 a_pos;out float v_depth;void main() {float elevation=elevation(a_pos);gl_Position=u_matrix*vec4(a_pos,elevation,1.0);v_depth=gl_Position.z/gl_Position.w;}`),skybox:Xt(`#include "_prelude_fog.fragment.glsl" 1597in lowp vec3 v_uv;uniform lowp samplerCube u_cubemap;uniform lowp float u_opacity;uniform highp float u_temporal_offset;uniform highp vec3 u_sun_direction;float sun_disk(highp vec3 ray_direction,highp vec3 sun_direction) {highp float cos_angle=dot(normalize(ray_direction),sun_direction);const highp float cos_sun_angular_diameter=0.99996192306;const highp float smoothstep_delta=1e-5;return smoothstep( 1598cos_sun_angular_diameter-smoothstep_delta,cos_sun_angular_diameter+smoothstep_delta,cos_angle);}float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(e
1598nd-start)+new_start;}void main() {vec3 uv=v_uv;const float y_bias=0.015;uv.y+=y_bias;uv.y=pow(abs(uv.y),1.0/5.0);uv.y=map(uv.y,0.0,1.0,-1.0,1.0);vec3 sky_color=texture(u_cubemap,uv).rgb; 1599#ifdef FOG 1600sky_color=fog_apply_sky_gradient(v_uv.xzy,sky_color); 1601#endif 1602sky_color.rgb=dither(sky_color.rgb,gl_FragCoord.xy+u_temporal_offset);sky_color+=0.1*sun_disk(v_uv,u_sun_direction);glFragColor=vec4(sky_color*u_opacity,u_opacity); 1603#ifdef OVERDRAW_INSPECTOR 1604glFragColor=vec4(1.0); 1605#endif 1606}`,sl),skyboxGradient:Xt(`#include "_prelude_fog.fragment.glsl" 1607in highp vec3 v_uv;uniform lowp sampler2D u_color_ramp;uniform highp vec3 u_center_direction;uniform lowp float u_radius;uniform lowp float u_opacity;uniform highp float u_temporal_offset;void main() {float progress=acos(dot(normalize(v_uv),u_center_direction))/u_radius;vec4 color=texture(u_color_ramp,vec2(progress,0.5)); 1608#ifdef FOG 1609color.rgb=fog_apply_sky_gradient(v_uv.xzy,color.rgb/color.a)*color.a; 1610#endif 1611color*=u_opacity;color.rgb=dither(color.rgb,gl_FragCoord.xy+u_temporal_offset);glFragColor=color; 1612#ifdef OVERDRAW_INSPECTOR 1613glFragColor=vec4(1.0); 1614#endif 1615}`,sl),skyboxCapture:Xt
vendor: 3,792 bytes, lines 1615-1626
1615(` 1616in highp vec3 v_position;uniform highp float u_sun_intensity;uniform highp float u_luminance;uniform lowp vec3 u_sun_direction;uniform highp vec4 u_color_tint_r;uniform highp vec4 u_color_tint_m;precision highp float; 1617#define BETA_R vec3(5.5e-6,13.0e-6,22.4e-6) 1618#define BETA_M vec3(21e-6,21e-6,21e-6) 1619#define MIE_G 0.76 1620#define DENSITY_HEIGHT_SCALE_R 8000.0 1621#define DENSITY_HEIGHT_SCALE_M 1200.0 1622#define PLANET_RADIUS 6360e3 1623#define ATMOSPHERE_RADIUS 6420e3 1624#define SAMPLE_STEPS 10 1625#define DENSITY_STEPS 4 1626float ray_sphere_exit(vec3 orig,vec3 dir,float radius) {float a=dot(dir,dir);float b=2.0*dot(dir,orig);float c=dot(orig,orig)-radius*radius;float d=sqrt(b*b-4.0*a*c);return (-b+d)/(2.0*a);}vec3 extinction(vec2 density) {return exp(-vec3(BETA_R*u_color_tint_r.a*density.x+BETA_M*u_color_tint_m.a*density.y));}vec2 local_density(vec3 point) {float height=max(length(point)-PLANET_RADIUS,0.0);float exp_r=exp(-height/DENSITY_HEIGHT_SCALE_R);float exp_m=exp(-height/DENSITY_HEIGHT_SCALE_M);return vec2(exp_r,exp_m);}float phase_ray(float cos_angle) {return (3.0/(16.0*PI))*(1.0+cos_angle*cos_angle);}float phase_mie(float cos_angle) {return (3.0/(8.0*PI))*((1.0-MIE_G*MIE_G)*(1.0+cos_angle*cos_angle))/((2.0+MIE_G*MIE_G)*pow(1.0+MIE_G*MIE_G-2.0*MIE_G*cos_angle,1.5));}vec2 density_to_atmosphere(vec3 point,vec3 light_dir) {float ray_len=ray_sphere_exit(point,light_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(DENSITY_STEPS);vec2 density_point_to_atmosphere=vec2(0.0);for (int i=0; i < DENSITY_STEPS;++i) {vec3 point_on_ray=point+light_dir*((float(i)+0.5)*step_len);density_point_to_atmosphere+=local_density(point_on_ray)*step_len;;}return density_point_to_atmosphere;}vec3 atmosphere(vec3 ray_dir,vec3 sun_direction,float sun_intensity) {vec2 density_orig_to_point=vec2(0.0);vec3 scatter_r=vec3(0.0);vec3 scatter_m=vec3(0.0);vec3 origin=vec3(0.0,PLANET_RADIUS,0.0);float ray_len=ray_sphere_exit(origin,ray_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(SAMPLE_STEPS);for (int i=0; i < SAMPLE_STEPS;++i) {vec3 point_on_ray=origin+ray_dir*((float(i)+0.5)*step_len);vec2 density=local_density(point_on_ray)*step_len;density_orig_to_point+=density;vec2 density_point_to_atmosphere=density_to_atmosphere(point_on_ray,sun_direction);vec2 density_orig_to_atmosphere=density_orig_to_point+density_point_to_atmosphere;vec3 extinction=extinction(density_orig_to_atmosphere);scatter_r+=density.x*extinction;scatter_m+=density.y*extinction;}float cos_angle=dot(ray_dir,sun_direction);float phase_r=phase_ray(cos_angle);float phase_m=phase_mie(cos_angle);vec3 beta_r=BETA_R*u_color_tint_r.rgb*u_color_tint_r.a;vec3 beta_m=BETA_M*u_color_tint_m.rgb*u_color_tint_m.a;return (scatter_r*phase_r*beta_r+scatter_m*phase_m*beta_m)*sun_intensity;}const float A=0.15;const float B=0.50;const float C=0.10;const float D=0.20;const float E=0.02;const float F=0.30;vec3 uncharted2_tonemap(vec3 x) {return ((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;}void main() {vec3 ray_direction=v_position;ray_direction.y=pow(ray_direction.y,5.0);const float y_bias=0.015;ray_direction.y+=y_bias;vec3 color=atmosphere(normalize(ray_direction),u_sun_direction,u_sun_intensity);float white_scale=1.0748724675633854;color=uncharted2_tonemap((log2(2.0/pow(u_luminance,4.0)))*color)*white_scale;glFragColor=vec4(color,1.0);}`,"in highp vec3 a_pos_3f;uniform mat3 u_matrix_3f;out highp vec3 v_position;float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(end-start)+new_start;}void main() {vec4 pos=vec4(u_matrix_3f*a_pos_3f,1.0);v_position=pos.xyz;v_position.y*=-1.0;v_position.y=map(v_position.y,-1.0,1.0,0.0,1.0);gl_Position=vec4(a_pos_3f.xy,0.0,1.0);}"),globe
1626Raster:Xt(`#include "_prelude_fog.fragment.glsl" 1627#include "_prelude_lighting.glsl" 1628uniform sampler2D u_image0;uniform float u_far_z_cutoff;in vec2 v_pos0; 1629#ifndef FOG 1630uniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform vec2 u_viewport; 1631#endif 1632void main() {vec4 color; 1633#ifdef CUSTOM_ANTIALIASING 1634vec2 uv=gl_FragCoord.xy/u_viewport;highp vec3 ray_dir=mix( 1635mix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);vec3 dir=normalize(ray_dir);vec3 closest_point=dot(u_globe_pos,dir)*dir;float norm_dist_from_center=1.0-length(closest_point-u_globe_pos)/u_globe_radius;const float antialias_pixel=2.0;float antialias_factor=antialias_pixel*fwidth(norm_dist_from_center);float antialias=smoothstep(0.0,antialias_factor,norm_dist_from_center);vec4 raster=texture(u_image0,v_pos0); 1636#ifdef LIGHTING_3D_MODE 1637#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS 1638raster=apply_lighting_with_emission_ground(raster,raster.a);color=vec4(raster.rgb*antialias,antialias); 1639#else 1640raster=apply_lighting_ground(raster);color=vec4(raster.rgb*antialias,raster.a*antialias); 1641#endif 1642#else 1643color=vec4(raster.rgb*antialias,raster.a*antialias); 1644#endif 1645#else 1646color=texture(u_image0,v_pos0); 1647#ifdef LIGHTING_3D_MODE 1648#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS 1649color=apply_lighting_with_emission_ground(color,color.a);color.a=1.0; 1650#else 1651color=apply_lighting_ground(color); 1652#endif 1653#endif 1654#endif 1655#ifdef FOG 1656color=fog_dither(fog_apply_premultiplied(color,v_fog_pos)); 1657#endif 1658color*=1.0-step(u_far_z_cutoff,1.0/gl_FragCoord.w);glFragColor=color; 1659#ifdef OVERDRAW_INSPECTOR 1660glFragColor=vec4(1.0); 1661#endif 1662HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 1663#include "_prelude_terrain.vertex.glsl" 1664uniform mat4 u_proj_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform float u_zoom_transition;uniform vec2 u_merc_center;uniform mat3 u_grid_matrix;uniform float u_skirt_height; 1665#ifdef GLOBE_POLES 1666in vec3 a_globe_pos;in vec2 a_uv; 1667#else 1668in vec2 a_pos; 1669#endif 1670out vec2 v_pos0;void main() { 1671#ifdef GLOBE_POLES 1672vec3 globe_pos=a_globe_pos;vec2 uv=a_uv; 1673#else 1674float tiles=u_grid_matrix[0][2];float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];vec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);float mercatorY=mercatorYfromLat(latLng[0]);float uvY=mercatorY*tiles-idy;float mercatorX=mercatorXfromLng(latLng[1]);float uvX=mercatorX*tiles-idx;vec3 globe_pos=latLngToECEF(latLng.xy);vec2 merc_pos=vec2(mercatorX,mercatorY);vec2 uv=vec2(uvX,uvY); 1675#endif 1676v_pos0=uv;vec2 tile_pos=uv*EXTENT;vec3 globe_derived_up_vector=normalize(globe_pos)*u_tile_up_scale; 1677#ifdef GLOBE_POLES 1678vec3 up_vector=globe_derived_up_vector; 1679#else 1680vec3 up_vector=elevationVector(tile_pos); 1681#endif 1682float height=elevation(tile_pos);globe_pos+=up_vector*height; 1683#ifndef GLOBE_POLES 1684globe_pos-=globe_derived_up_vector*u_skirt_height*decomposed_pos_and_skirt.z; 1685#endif 1686#ifdef GLOBE_POLES 1687vec4 interpolated_pos=u_globe_matrix*vec4(globe_pos,1.0); 1688#else 1689vec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);if (u_zoom_transition > 0.0) {merc_world_pos=vec4(merc_pos,height-u_skirt_height*decomposed_pos_and_skirt.z,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition),1.0); 1690#endif 1691gl_Position=u_proj_matrix*interpolated_pos; 1692#ifdef FOG 1693v_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz); 1694#endif 1695}`),globeAtmosphere:Xt(`#include "_prelude_fog.fragment.glsl" 1696uniform float u_transition;uniform highp float u_fadeout_range;uniform highp float u_temporal_offset;uniform vec4 u_color;uniform vec4 u_high_color;uniform vec4 u_space_color;uniform float u_horizon_angle;in highp vec3 v_ray_dir;in highp vec3 v_horizon_dir;void main() {highp vec3 dir=normalize(v_ray_dir);float globe_pos_dot_dir; 1697#ifdef PROJECTION_GLOBE_VIEW 1698globe_pos_dot_dir=dot(u_globe_pos,dir);highp vec3 closest_point_forward=abs(globe_pos_dot_dir)*dir;float norm_dist_from_center=length(closest_point_forward-u_globe_pos)/u_globe_radius;if (norm_dist_from_center < 0.98) { 1699#ifdef ALPHA_PASS 1700glFragColor=vec4(0,0,0,0);return; 1701#else 1702#ifdef NATIVE 1703glFragColor=vec4(1,1,1,1); 1704#else 1705glFragColor=vec4(0,0,0,1); 1706#endif 1707return; 1708#endif 1709} 1710#endif 1711highp vec3 horizon_dir=normalize(v_horizon_dir);float horizon_angle_mercator=dir.y < horizon_dir.y ? 17120.0 : max(acos(clamp(dot(dir,horizon_dir),-1.0,1.0)),0.0);float horizon_angle; 1713#ifdef PROJECTION_GLOBE_VIEW 1714highp vec3 closest_point=globe_pos_dot_dir*dir;highp float closest_point_to_center=length(closest_point-u_globe_pos);highp float theta=asin(clamp(closest_point_to_center/length(u_globe_pos),-1.0,1.0));horizon_angle=globe_pos_dot_dir < 0.0 ? 1715PI-theta-u_horizon_angle : theta-u_horizon_angle;float angle_t=pow(u_transition,10.0);horizon_angle=mix(horizon_angle,horizon_angle_mercator,angle_t); 1716#else 1717horizon_angle=horizon_angle_mercator; 1718#endif 1719horizon_angle/=PI;float t=exp(-horizon_angle/u_fadeout_range);float alpha_0=u_color.a;float alpha_1=u_high_color.a;float alpha_2=u_space_color.a;vec3 color_stop_0=u_color.rgb;vec3 color_stop_1=u_high_color.rgb;
1719vec3 color_stop_2=u_space_color.rgb; 1720#ifdef ALPHA_PASS 1721float a0=mix(alpha_2,1.0,alpha_1);float a1=mix(a0,1.0,alpha_0);float a2=mix(a0,a1,t);float a =mix(alpha_2,a2,t);glFragColor=vec4(1.0,1.0,1.0,a); 1722#else 1723vec3 c0=mix(color_stop_2,color_stop_1,alpha_1);vec3 c1=mix(c0,color_stop_0,alpha_0);vec3 c2=mix(c0,c1,t);vec3 c=c2; 1724#ifndef NATIVE 1725c=dither(c,gl_FragCoord.xy+u_temporal_offset); 1726#endif 1727glFragColor=vec4(c*t,t); 1728#endif 1729}`,`in vec3 a_pos;in vec2 a_uv;uniform vec3 u_frustum_tl;uniform vec3 u_frustum_tr;uniform vec3 u_frustum_br;uniform vec3 u_frustum_bl;uniform float u_horizon;out highp vec3 v_ray_dir;out highp vec3 v_horizon_dir;void main() {v_ray_dir=mix( 1730mix(u_frustum_tl,u_frustum_tr,a_uv.x),mix(u_frustum_bl,u_frustum_br,a_uv.x),a_uv.y);v_horizon_dir=mix( 1731mix(u_frustum_tl,u_frustum_bl,u_horizon),mix(u_frustum_tr,u_frustum_br,u_horizon),a_uv.x);gl_Position=vec4(a_pos,1.0);}`),model:Xt(`#include "_prelude_fog.fragment.glsl" 1732#include "_prelude_shadow.fragment.glsl" 1733#include "_prelude_lighting.glsl" 1734uniform float u_opacity;uniform vec3 u_lightcolor;uniform vec3 u_lightpos;uniform float u_lightintensity;uniform vec4 u_baseColorFactor;uniform vec4 u_emissiveFactor;uniform float u_metallicFactor;uniform float u_roughnessFactor;uniform float u_emissive_strength;in highp vec4 v_position_height;in lowp vec4 v_color_mix; 1735#ifdef RENDER_SHADOWS 1736in vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1;in float v_depth_shadows; 1737#endif 1738#ifdef OCCLUSION_TEXTURE_TRANSFORM 1739uniform vec4 u_occlusionTextureTransform; 1740#endif 1741#pragma mapbox: define-attribute highp vec3 normal_3f 1742#pragma mapbox: define-attribute highp vec3 color_3f 1743#pragma mapbox: define-attribute highp vec4 color_4f 1744#pragma mapbox: define-attribute highp vec2 uv_2f 1745#pragma mapbox: initialize-attribute highp vec3 normal_3f 1746#pragma mapbox: initialize-attribute highp vec3 color_3f 1747#pragma mapbox: initialize-attribute highp vec4 color_4f 1748#pragma mapbox: initialize-attribute highp vec2 uv_2f 1749#ifdef HAS_ATTRIBUTE_a_pbr 1750in lowp vec4 v_roughness_metallic_emissive_alpha;in mediump vec4 v_height_based_emission_params; 1751#endif 1752#ifdef HAS_TEXTURE_u_baseColorTexture 1753uniform sampler2D u_baseColorTexture;uniform bool u_baseTextureIsAlpha;uniform bool u_alphaMask;uniform float u_alphaCutoff; 1754#endif 1755#ifdef HAS_TEXTURE_u_metallicRoughnessTexture 1756uniform sampler2D u_metallicRoughnessTexture; 1757#endif 1758#ifdef HAS_TEXTURE_u_occlusionTexture 1759uniform sampler2D u_occlusionTexture;uniform float u_aoIntensity; 1760#endif 1761#ifdef HAS_TEXTURE_u_normalTexture 1762uniform sampler2D u_normalTexture; 1763#endif 1764#ifdef HAS_TEXTURE_u_emissionTexture 1765uniform sampler2D u_emissionTexture; 1766#endif 1767#ifdef TERRAIN_FRAGMENT_OCCLUSION 1768in highp float v_depth;uniform sampler2D u_depthTexture;uniform vec2 u_inv_depth_size;bool isOccluded() {vec2 coord=gl_FragCoord.xy*u_inv_depth_size;highp float depth=unpack_depth(texture(u_depthTexture,coord));return v_depth > depth+0.0005;} 1769#endif 1770#define saturate(_x) clamp(_x,0.,1.) 1771vec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}float calculate_NdotL(vec3 normal,vec3 lightDir) {const float ext=0.70710678118;return (clamp(dot(normal,lightDir),-ext,1.0)+ext)/(1.0+ext);}vec3 getDiffuseShadedColor(vec3 albedo,vec3 normal,vec3 lightDir,vec3 lightColor) 1772{ 1773#ifdef LIGHTING_3D_MODE 1774vec3 transformed_normal=vec3(-normal.xy,normal.z);float lighting_factor; 1775#ifdef RENDER_SHADOWS 1776lighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows); 1777#else 1778lighting_factor=saturate(dot(transformed_normal,u_lighting_directional_dir)); 1779#endif 1780return apply_lighting(albedo,transformed_normal,lighting_factor); 1781#else 1782vec3 n=normal;float colorvalue=((albedo.x*0.2126)+(albedo.y*0.7152))+(albedo.z*0.0722);vec3 c=vec3(0.03,0.03,0.03);float directional=clamp(dot(n,vec3(lightDir)),0.0,1.0);directional=mix(1.0-u_lightintensity,max((1.0-colorvalue)+u_lightintensity,1.0),directional);vec3 c3=c+clamp((albedo*directional)*lightColor,mix(vec3(0.0),vec3(0.3),vec3(1.0)-lightColor),vec3(1.0));return c3; 1783#endif 1784}vec4 getBaseColor() {vec4 albedo=u_baseColorFactor; 1785#ifdef HAS_ATTRIBUTE_a_color_3f 1786albedo*=vec4(color_3f,1.0); 1787#endif 1788#ifdef HAS_ATTRIBUTE_a_pbr 1789#else 1790#ifdef HAS_ATTRIBUTE_a_color_4f 1791albedo*=color_4f; 1792#endif 1793#endif 1794#if defined (HAS_TEXTURE_u_baseColorTexture) && defined (HAS_ATTRIBUTE_a_uv_2f) 1795vec4 texColor=texture(u_baseColorTexture,uv_2f);if(u_alphaMask) {if (texColor.w < u_alphaCutoff) {discard;}} 1796#ifdef UNPREMULT_TEXTURE_IN_SHADER 1797if(texColor.w > 0.0) {texColor.rgb/=texColor.w;}texColor.w=1.0; 1798#endif 1799if(u_baseTextureIsAlpha) {if (texColor.r < 0.5) {discard;}} else {texColor.rgb=sRGBToLinear(texColor.rgb);albedo*=texColor;} 1800#endif 1801return vec4(mix(albedo.rgb,v_color_mix.rgb,v_color_mix.a),albedo.a);}highp mat3 cotangentFrame(highp vec3 N,highp vec3 p,highp vec2 uv ) { 1802#ifdef HAS_TEXTURE_u_normalTexture 1803highp vec3 dp1=vec3(dFdx(p.x),dFdx(p.y),dFdx(p.z));highp vec3 dp2=vec3(dFdy(p.x),dFdy(p.y),dFdy(p.z));highp vec2 duv1=vec2(dFdx(uv.x),dFdx(uv.y));highp vec2 duv2=vec2(dFdy(uv.x),dFdy(uv.y));highp vec3 dp2perp=cross( dp2,N );highp vec3 dp1perp=cross( N,dp1 );highp vec3 T=dp2perp*duv1.x+dp1perp*duv2.x;highp vec3 B=dp2perp*duv1.y+dp1perp*duv2.y;highp float lengthT=dot(T,T);highp float lengthB=dot(B,B);highp float maxLength=max(lengthT,lengthB);highp float invmax=inversesqrt( maxLength );highp mat3 res=mat3( T*invmax,B*invmax,N );return res; 1804#else 1805return mat3(1.0); 1806#endif 1807}highp vec3 getNormal(){highp vec3 n; 1808#ifdef HAS_ATTRIBUTE_a_normal_3f 1809n=normalize(normal_3f); 1810#else 1811highp vec3 fdx=vec3(dFdx(v_position_height.x),dFdx(v_position_height.y),dFdx(v_position_height.z));highp vec3 fdy=vec3(dFdy(v_position_height.x),dFdy(v_position_height.y),dFdy(v_position_height.z));n=normalize(cross(fdx,fdy))*-1.0; 1812#endif 1813#if defined(HAS_TEXTURE_u_normalTexture) && defined(HAS_ATTRIBUTE_a_uv_2f) 1814vec3 nMap=texture( u_normalTexture,uv_2f).xyz;nMap=normalize(2.0*nMap-vec3(1.0));highp vec3 v=normalize(-v_position_height.xyz);highp mat3 TBN=cotangentFrame(n,v,uv_2f);n=normalize(TBN*nMap); 1815#endif 1816return n;}struct Material {float perceptualRoughness;float alphaRoughness;float metallic;vec3 f90;vec4 baseColor;vec3 diffuseColor;vec3 specularColor;highp vec3 normal;};Material getPBRMaterial() {Material mat;mat.baseColor=getBaseColor();mat.perceptualRoughness=u_roughnessFactor;mat.metallic=u_metallicFactor; 1817#ifdef HAS_ATTRIBUTE_a_pbr 1818mat.perceptualRoughness=v_roughness_metallic_emissive_alpha.x;mat.metallic=v_roughness_metallic_emissive_alpha.y;mat.baseColor.w*=v_roughness_metallic_emissive_alpha.w; 1819#endif 1820#if defined(HAS_TEXTURE_u_metallicRoughnessTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)
vendor: 3,959 bytes, lines 1820-1852
1820 1821vec4 mrSample=texture(u_metallicRoughnessTexture,uv_2f);mat.perceptualRoughness*=mrSample.g;mat.metallic*=mrSample.b; 1822#endif 1823const float c_minRoughness=0.04;mat.perceptualRoughness=clamp(mat.perceptualRoughness,c_minRoughness,1.0);mat.metallic=saturate(mat.metallic);mat.alphaRoughness=mat.perceptualRoughness*mat.perceptualRoughness;const vec3 f0=vec3(0.04);mat.diffuseColor=mat.baseColor.rgb*(vec3(1.0)-f0);mat.diffuseColor*=1.0-mat.metallic;mat.specularColor=mix(f0,mat.baseColor.rgb,mat.metallic);highp float reflectance=max(max(mat.specularColor.r,mat.specularColor.g),mat.specularColor.b);highp float reflectance90=saturate(reflectance*25.0);mat.f90=vec3(reflectance90);mat.normal=getNormal();return mat;}float V_GGX(float NdotL,float NdotV,float roughness) 1824{float a2=roughness*roughness;float GGXV=NdotL*sqrt(NdotV*NdotV*(1.0-a2)+a2);float GGXL=NdotV*sqrt(NdotL*NdotL*(1.0-a2)+a2);return 0.5/(GGXV+GGXL);}float V_GGXFast(float NdotL,float NdotV,float roughness) {float a=roughness;float GGXV=NdotL*(NdotV*(1.0-a)+a);float GGXL=NdotV*(NdotL*(1.0-a)+a);return 0.5/(GGXV+GGXL);}vec3 F_Schlick(vec3 specularColor,vec3 f90,float VdotH) 1825{return specularColor+(f90-specularColor)*pow(clamp(1.0-VdotH,0.0,1.0),5.0);}vec3 F_SchlickFast(vec3 specularColor,float VdotH) 1826{float x=1.0-VdotH;float x4=x*x*x*x;return specularColor+(1.0-specularColor)*x4*x;}float D_GGX(highp float NdotH,float alphaRoughness) 1827{highp float a4=alphaRoughness*alphaRoughness;highp float f=(NdotH*a4-NdotH)*NdotH+1.0;return a4/(PI*f*f);}vec3 diffuseBurley(Material mat,float LdotH,float NdotL,float NdotV) 1828{float f90=2.0*LdotH*LdotH*mat.alphaRoughness-0.5;return (mat.diffuseColor/PI)*(1.0+f90*pow((1.0-NdotL),5.0))*(1.0+f90*pow((1.0-NdotV),5.0));}vec3 diffuseLambertian(Material mat) 1829{ 1830#ifdef LIGHTING_3D_MODE 1831return mat.diffuseColor; 1832#else 1833return mat.diffuseColor/PI; 1834#endif 1835}vec3 EnvBRDFApprox(vec3 specularColor,float roughness,highp float NdotV) 1836{vec4 c0=vec4(-1,-0.0275,-0.572,0.022);vec4 c1=vec4(1,0.0425,1.04,-0.04);highp vec4 r=roughness*c0+c1;highp float a004=min(r.x*r.x,exp2(-9.28*NdotV))*r.x+r.y;vec2 AB=vec2(-1.04,1.04)*a004+r.zw;return specularColor*AB.x+AB.y;}vec3 computeIndirectLightContribution(Material mat,float NdotV,vec3 normal) 1837{vec3 env_light=vec3(0.65,0.65,0.65); 1838#ifdef LIGHTING_3D_MODE 1839float ambient_factor=calculate_ambient_directional_factor(normal);env_light=u_lighting_ambient_color*ambient_factor; 1840#endif 1841vec3 envBRDF=EnvBRDFApprox(mat.specularColor,mat.perceptualRoughness,NdotV);vec3 indirectSpecular= envBRDF*env_light;vec3 indirectDiffuse=mat.diffuseColor*env_light;return indirectSpecular+indirectDiffuse;}vec3 computeLightContribution(Material mat,vec3 lightPosition,vec3 lightColor) 1842{highp vec3 n=mat.normal;highp vec3 v=normalize(-v_position_height.xyz);highp vec3 l=normalize(lightPosition);highp vec3 h=normalize(v+l);float NdotV=clamp(abs(dot(n,v)),0.001,1.0);float NdotL=saturate(dot(n,l));highp float NdotH=saturate(dot(n,h));float VdotH=saturate(dot(v,h));vec3 f=F_SchlickFast(mat.specularColor,VdotH);float g=V_GGXFast(NdotL,NdotV,mat.alphaRoughness);float d=D_GGX(NdotH,mat.alphaRoughness);vec3 diffuseTerm=(1.0-f)*diffuseLambertian(mat);vec3 specularTerm=f*g*d;vec3 transformed_normal=vec3(-n.xy,n.z);float lighting_factor; 1843#ifdef RENDER_SHADOWS 1844lighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows); 1845#else 1846lighting_factor=NdotL; 1847#endif 1848vec3 directLightColor=(specularTerm+diffuseTerm)*lighting_factor*lightColor;vec3 indirectLightColor=computeIndirectLightContribution(mat,NdotV,transformed_normal);vec3 color=(saturate(directLightColor)+indirectLightColor);float intensityFactor=1.0; 1849#if !defined(LIGHTING_3D_MODE) 1850const vec3 luminosityFactor=vec3(0.2126,0.7152,0.0722);float luminance=dot(diffuseTerm,luminosityFactor);intensityFactor=mix((1.0-u_lightintensity),max((1.0-luminance+u_lightintensity),1.0),NdotL); 1851#endif 1852color*=intensityFactor;return color;}void main() {
1852 1853#ifdef TERRAIN_FRAGMENT_OCCLUSION 1854if (isOccluded()) {discard;} 1855#endif 1856vec3 lightDir=u_lightpos;vec3 lightColor=u_lightcolor; 1857#ifdef LIGHTING_3D_MODE 1858lightDir=u_lighting_directional_dir;lightDir.xy=-lightDir.xy;lightColor=u_lighting_directional_color; 1859#endif 1860vec4 finalColor; 1861#ifdef DIFFUSE_SHADED 1862vec3 N=getNormal();vec3 baseColor=getBaseColor().rgb;vec3 diffuse=getDiffuseShadedColor(baseColor,N,lightDir,lightColor); 1863#ifdef HAS_TEXTURE_u_occlusionTexture 1864float ao=(texture(u_occlusionTexture,uv_2f).r-1.0)*u_aoIntensity+1.0;diffuse*=ao; 1865#endif 1866finalColor=vec4(mix(diffuse,baseColor,u_emissive_strength),1.0)*u_opacity; 1867#else 1868Material mat=getPBRMaterial();vec3 color=computeLightContribution(mat,lightDir,lightColor);float ao=1.0; 1869#if defined (HAS_TEXTURE_u_occlusionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f) 1870#ifdef OCCLUSION_TEXTURE_TRANSFORM 1871vec2 uv=uv_2f.xy*u_occlusionTextureTransform.zw+u_occlusionTextureTransform.xy; 1872#else 1873vec2 uv=uv_2f; 1874#endif 1875ao=(texture(u_occlusionTexture,uv).x-1.0)*u_aoIntensity+1.0;color*=ao; 1876#endif 1877vec4 emissive=u_emissiveFactor; 1878#if defined(HAS_TEXTURE_u_emissionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f) 1879emissive.rgb*=sRGBToLinear(texture(u_emissionTexture,uv_2f).rgb); 1880#endif 1881color+=emissive.rgb;float opacity=mat.baseColor.w*u_opacity; 1882#ifdef HAS_ATTRIBUTE_a_pbr 1883float resEmission=v_roughness_metallic_emissive_alpha.z;resEmission*=v_height_based_emission_params.z+v_height_based_emission_params.w*pow(clamp(v_height_based_emission_params.x,0.0,1.0),v_height_based_emission_params.y);color=mix(color,v_color_mix.rgb,min(1.0,resEmission)); 1884#ifdef HAS_ATTRIBUTE_a_color_4f 1885float distance=length(vec2(1.3*max(0.0,abs(color_4f.x)-color_4f.z),color_4f.
1885y));distance+= mix(0.5,0.0,clamp(resEmission-1.0,0.0,1.0));opacity*=v_roughness_metallic_emissive_alpha.w*saturate(1.0-distance*distance); 1886#endif 1887#endif 1888vec3 unlitColor=mat.baseColor.rgb*ao+emissive.rgb;color=mix(color,unlitColor,u_emissive_strength);color=linearTosRGB(color);color*=opacity;finalColor=vec4(color,opacity); 1889#endif 1890#ifdef FOG 1891finalColor=fog_dither(fog_apply_premultiplied(finalColor,v_fog_pos,v_position_height.w)); 1892#endif 1893#ifdef RENDER_CUTOFF 1894finalColor*=v_cutoff_opacity; 1895#endif 1896#ifdef INDICATOR_CUTOUT 1897finalColor=applyCutout(finalColor); 1898#endif 1899glFragColor=finalColor; 1900#ifdef OVERDRAW_INSPECTOR 1901glFragColor=vec4(1.0); 1902#endif 1903HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 1904#include "_prelude_shadow.vertex.glsl" 1905in vec3 a_pos_3f; 1906#pragma mapbox: define-attribute highp vec3 normal_3f 1907#pragma mapbox: define-attribute highp vec2 uv_2f 1908#pragma mapbox: define-attribute highp vec3 color_3f 1909#pragma mapbox: define-attribute highp vec4 color_4f 1910#pragma mapbox: define-attribute-vertex-shader-only highp vec4 pbr 1911#pragma mapbox: define-attribute-vertex-shader-only highp vec3 heightBasedEmissiveStrength 1912uniform mat4 u_matrix;uniform mat4 u_lighting_matrix;uniform vec3 u_camera_pos;uniform vec4 u_color_mix; 1913#ifdef INSTANCED_ARRAYS 1914in vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3; 1915#else 1916uniform highp mat4 u_normal_matrix; 1917#endif 1918#ifdef RENDER_SHADOWS 1919uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out vec4 v_pos_light_view_0;out vec4 v_pos_light_view_1;out float v_depth_shadows; 1920#endif 1921out vec4 v_position_height;out lowp vec4 v_color_mix; 1922#ifdef TERRAIN_FRAGMENT_OCCLUSION 1923out highp float v_depth; 1924#endif 1925#ifdef HAS_ATTRIBUTE_a_pbr 1926out lowp vec4 v_roughness_metallic_emissive_alpha;out mediump vec4 v_height_based_emission_params; 1927#endif 1928vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}void main() { 1929#pragma mapbox: initialize-attribute highp vec3 normal_3f 1930#pragma mapbox: initialize-attribute highp vec2 uv_2f 1931#pragma mapbox: initialize-attribute highp vec3 color_3f 1932#pragma mapbox: initialize-attribute highp vec4 color_4f 1933#pragma mapbox: initialize-attribute-custom highp vec4 pbr 1934#pragma mapbox: initialize-attribute-custom highp vec3 heightBasedEmissiveStrength 1935highp mat4 normal_matrix; 1936#ifdef INSTANCED_ARRAYS 1937normal_matrix=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3); 1938#else 1939normal_matrix=u_normal_matrix; 1940#endif 1941vec3 local_pos;mat3 rs; 1942#ifdef MODEL_POSITION_ON_GPU 1943vec3 pos_color=normal_matrix[0].xyz;vec4 translate=normal_matrix[1];vec3 pos_a=floor(pos_color);vec3 rgb=1.05*(pos_color-pos_a);float color_mix=pos_a.z/100.0;v_color_mix=vec4(sRGBToLinear(rgb),color_mix);float meter_to_tile=normal_matrix[0].w;vec4 pos=vec4(pos_a.xy,translate.z,1.0);rs[0].x=normal_matrix[1].w;rs[0].yz=normal_matrix[2].xy;rs[1].xy=normal_matrix[2].zw;rs[1].z=normal_matrix[3].x;rs[2].xyz=normal_matrix[3].yzw;vec4 pos_node=u_lighting_matrix*vec4(a_pos_3f,1.0);vec3 rotated_pos_node=rs*pos_node.xyz;vec3 pos_model_tile=(rotated_pos_node+vec3(translate.xy,0.0))*vec3(meter_to_tile,meter_to_tile,1.0);pos.xyz+=pos_model_tile;local_pos=pos.xyz;gl_Position=u_matrix*pos;pos.z*=meter_to_tile;v_position_height.xyz=pos.xyz-u_camera_pos; 1944#else 1945local_pos=a_pos_3f;gl_Position=u_matrix*vec4(a_pos_3f,1);v_position_height.xyz=vec3(u_lighting_matrix*vec4(a_pos_3f,1));v_color_mix=vec4(sRGBToLinear(u_color_mix.rgb),u_color_mix.a); 1946#endif 1947v_position_height.w=a_pos_3f.z; 1948#ifdef HAS_ATTRIBUTE_a_pbr 1949vec4 albedo_c=decode_color(pbr.xy);vec2 e_r_m=unpack_float(pbr.z);vec2 r_m= unpack_float(e_r_m.y*16.0);r_m.r=r_m.r*16.0;v_color_mix=vec4(albedo_c.rgb,1.0);v_roughness_metallic_emissive_alpha=vec4(vec3(r_m,e_r_m.x)/255.0,albedo_c.a);v_roughness_metallic_emissive_alpha.z*=2.0;float heightBasedRelativeIntepolation=a_pos_3f.z*heightBasedEmissiveStrength.x+heightBasedEmissiveStrength.y;v_height_based_emission_params.x=heightBasedRelativeIntepolation;v_height_based_emission_params.y=heightBasedEmissiveStrength.z;vec2 emissionMultiplierValues=unpack_float(pbr.w)/256.0;v_height_based_emission_params.z=emissionMultiplierValues.x;v_height_based_emission_params.w=emissionMultiplierValues.y-emissionMultiplierValues.x; 1950#endif 1951#ifdef FOG 1952v_fog_pos=fog_position(local_pos); 1953#endif 1954#ifdef RENDER_CUTOFF 1955v_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z); 1956#endif 1957#ifdef TERRAIN_FRAGMENT_OCCLUSION 1958v_depth=gl_Position.z/gl_Position.w; 1959#endif 1960#ifdef HAS_ATTRIBUTE_a_normal_3f 1961#ifdef MODEL_POSITION_ON_GPU 1962float x_squared_scale=dot(rs[0],rs[0]);float y_squared_scale=dot(rs[1],rs[1]);float z_squared_scale=dot(rs[2],rs[2]);vec3 squared_scale=vec3(x_squared_scale,y_squared_scale,z_squared_scale);normal_3f=rs*((u_lighting_matrix*vec4(normal_3f,0.0)).xyz/squared_scale);normal_3f=normalize(normal_3f); 1963#else
1964normal_3f=vec3(normal_matrix*vec4(normal_3f,0)); 1965#endif 1966#endif 1967#ifdef HAS_ATTRIBUTE_a_pbr 1968#ifdef HAS_ATTRIBUTE_a_color_4f 1969v_roughness_metallic_emissive_alpha.w=clamp(color_4f.a*v_roughness_metallic_emissive_alpha.w*(v_roughness_metallic_emissive_alpha.z-1.0),0.0,1.0); 1970#endif 1971#endif 1972#ifdef RENDER_SHADOWS 1973vec3 shadow_pos=local_pos; 1974#ifdef NORMAL_OFFSET 1975#ifdef HAS_ATTRIBUTE_a_normal_3f 1976#ifdef MODEL_POSITION_ON_GPU 1977vec3 offset=shadow_normal_offset(vec3(-normal_3f.xy,normal_3f.z));shadow_pos+=offset*shadow_normal_offset_multiplier0(); 1978#else 1979vec3 offset=shadow_normal_offset_model(normalize(normal_3f));shadow_pos+=offset*shadow_normal_offset_multiplier0(); 1980#endif 1981#endif 1982#endif 1983v_pos_light_view_0=u_light_matrix_0*vec4(shadow_pos,1);v_pos_light_view_1=u_light_matrix_1*vec4(shadow_pos,1);v_depth_shadows=gl_Position.w; 1984#endif 1985}`),modelDepth:Xt(`in highp float v_depth;void main() { 1986#ifndef DEPTH_TEXTURE 1987glFragColor=pack_depth(v_depth); 1988#endif 1989}`,`in vec3 a_pos_3f;uniform mat4 u_matrix;out highp float v_depth; 1990#ifdef MODEL_POSITION_ON_GPU 1991#ifdef INSTANCED_ARRAYS 1992in vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3; 1993#else 1994uniform highp mat4 u_instance; 1995#endif 1996uniform highp mat4 u_node_matrix; 1997#endif 1998void main() { 1999#ifdef MODEL_POSITION_ON_GPU 2000highp mat4 instance; 2001#ifdef INSTANCED_ARRAYS 2002instance=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3); 2003#else 2004instance=u_instance; 2005#endif 2006vec3 pos_color=instance[0].xyz;vec4 translate=instance[1];vec3 pos_a=floor(pos_color);float meter_to_tile=instance[0].w;vec4 pos=vec4(pos_a.xy,translate.z,1.0);mat3 rs;rs[0].x=instance[1].w;rs[0].yz=instance[2].xy;
2006rs[1].xy=instance[2].zw;rs[1].z=instance[3].x;rs[2].xyz=instance[3].yzw;vec4 pos_node=u_node_matrix*vec4(a_pos_3f,1.0);vec3 rotated_pos_node=rs*pos_node.xyz;vec3 pos_model_tile=(rotated_pos_node+vec3(translate.xy,0.0))*vec3(meter_to_tile,meter_to_tile,1.0);pos.xyz+=pos_model_tile;gl_Position=u_matrix*pos; 2007#else 2008gl_Position=u_matrix*vec4(a_pos_3f,1); 2009#endif 2010v_depth=gl_Position.z/gl_Position.w;}`),stars:Xt(`in highp vec2 v_uv;in mediump float v_intensity;float shapeCircle(in vec2 uv) 2011{float beginFade=0.6;float lengthFromCenter=length(v_uv);return 1.0-clamp((lengthFromCenter-beginFade)/(1.0-beginFade),0.0,1.0);}void main() {float alpha=shapeCircle(v_uv);vec3 color=vec3(1.0,1.0,1.0);alpha*=v_intensity;glFragColor=vec4(color*alpha,alpha);HANDLE_WIREFRAME_DEBUG;}`,` 2012in vec3 a_pos_3f;in vec2 a_uv;in float a_size_scale;in float a_fade_opacity;uniform mat4 u_matrix;uniform vec3 u_up;uniform vec3 u_right;uniform float u_intensity_multiplier;out highp vec2 v_uv;out mediump float v_intensity;void main() {v_uv=a_uv;v_intensity=a_fade_opacity*u_intensity_multiplier;vec3 pos=a_pos_3f;pos+=a_uv.x*u_right*a_size_scale;pos+=a_uv.y*u_up*a_size_scale;gl_Position=u_matrix*vec4(pos,1.0);}`)};function so(c,r){const o=c.replace(/\s*\/\/[^\n]*\n/g,` 2013`).split(` 2014`);for(let u of o)if(u=u.trim(),u[0]==="#"&&u.includes("if")&&!u.includes("endif")){u=u.replace("#","").replace(/ifdef|ifndef|elif|if/g,"").replace(/!|defined|\(|\)|\|\||&&/g,"").replace(/\s+/g," ").trim();const d=u.split(" ");for(const p of d)r.includes(p)||r.push(p)}}function Xt(c,r){const o=/#include\s+"([^"]+)"/g,u=/#pragma mapbox: ([\w\-]+) ([\w]+) ([\w]+) ([\w]+)/g;let d=r.match(/(attribute(\S*)|(^\s*|;)in) (highp |mediump |lowp )?([\w]+) ([\w]+)/gm);d&&(d=d.map(T=>{const M=T.split(" ");return M[M.length-1]}),d=[...new Set(d)]);const p={},g=[],x=[];if(c=c.replace(o,(T,M)=>(x.push(M),"")),(r=r.replace(o,(T,M)=>(g.push(M),""))).includes("flat out"))return void console.error('The usage of "flat" qualifier is disallowed, see: https://bugs.webkit.org/show_bug.cgi?id=268071');let b=[...ys];so(c,b),so(r,b);for(const T of[...g,...x])Fr[T]||console.error(`Undefined include: ${T}`),xs[T]||(xs[T]=[],so(Fr[T],xs[T])),b=[...b,...xs[T]];return{fragmentSource:c=c.replace(u,(T,M,S,C,P)=>(p[P]=!0,M==="define"?` 2015#ifndef HAS_UNIFORM_u_${P} 2016in ${S} ${C} ${P}; 2017#else 2018uniform ${S} ${C} u_${P}; 2019#endif 2020`:M==="initialize"?` 2021#ifdef HAS_UNIFORM_u_${P} 2022 ${S} ${C} ${P} = u_${P}; 2023#endif 2024`:M==="define-attribute"?` 2025#ifdef HAS_ATTRIBUTE_a_${P} 2026 in ${S} ${C} ${P}; 2027#endif 2028`:M==="initialize-attribute"?"":void 0)),vertexSource:r=r.replace(u,(T,M,S,C,P)=>{const k=C==="float"?"vec2":C,R=P.match(/color/)?"color":k;return M==="define-attribute-vertex-shader-only"?` 2029#ifdef HAS_ATTRIBUTE_a_${P} 2030in ${S} ${C} a_${P}; 2031#endif 2032`:p[P]?M==="define"?` 2033#ifndef HAS_UNIFORM_u_${P} 2034uniform lowp float u_${P}_t; 2035in ${S} ${k} a_${P}; 2036out ${S} ${C} ${P}; 2037#else 2038uniform ${S} ${C} u_${P}; 2039#endif 2040`:M==="initialize"?R==="vec4"?` 2041#ifndef HAS_UNIFORM_u_${P} 2042 ${P} = a_${P}; 2043#else 2044 ${S} ${C} ${P} = u_${P}; 2045#endif 2046`:` 2047#ifndef HAS_UNIFORM_u_${P} 2048 ${P} = unpack_mix_${R}(a_${P}, u_${P}_t); 2049#else 2050 ${S} ${C} ${P} = u_${P}; 2051#endif 2052`:M==="define-attribute"?` 2053#ifdef HAS_ATTRIBUTE_a_${P} 2054 in ${S} ${C} a_${P}; 2055 out ${S} ${C} ${P}; 2056#endif 2057`:M==="initialize-attribute"?` 2058#ifdef HAS_ATTRIBUTE_a_${P} 2059 ${P} = a_${P}; 2060#endif 2061`:void 0:M==="define"?` 2062#ifndef HAS_UNIFORM_u_${P} 2063uniform lowp float u_${P}_t; 2064in ${S} ${k} a_${P}; 2065#else 2066uniform ${S} ${C} u_${P}; 2067#endif 2068`:M==="define-instanced"?R==="mat4"?` 2069#ifdef INSTANCED_ARRAYS 2070in vec4 a_${P}0; 2071in vec4 a_${P}1; 2072in vec4 a_${P}2; 2073in vec4 a_${P}3; 2074#else 2075uniform ${S} ${C} u_${P}; 2076#endif 2077`:` 2078#ifdef INSTANCED_ARRAYS 2079in ${S} ${k} a_${P}; 2080#else 2081uniform ${S} ${C} u_${P}; 2082#endif 2083`:M==="initialize-attribute-custom"?` 2084#ifdef HAS_ATTRIBUTE_a_${P} 2085 ${S} ${C} ${P} = a_${P}; 2086#endif 2087`:R==="vec4"?` 2088#ifndef HAS_UNIFORM_u_${P} 2089 ${S} ${C} ${P} = a_${P}; 2090#else 2091 ${S} ${C} ${P} = u_${P}; 2092#endif 2093`:` 2094#ifndef HAS_UNIFORM_u_${P} 2095 ${S} ${C} ${P} = unpack_mix_${R}(a_${P}, u_${P}_t); 2096#else 2097 ${S} ${C} ${P} = u_${P}; 2098#endif 2099`}),staticAttributes:d,usedDefines:b,vertexIncludes:g,fragmentIncludes:x}}class Pc{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffers=[],this.vao=null}bind(r,o,u,d,p,g,x,b){this.context=r;let T=this.boundPaintVertexBuffers.length!==d.length;for(let S=0;!T&&S<d.length;S++)this.boundPaintVertexBuffers[S]!==d[S]&&(T=!0);let M=this.boundDynamicVertexBuffers.length!==x.length;for(let S=0;!M&&S<x.length;S++)this.boundDynamicVertexBuffers[S]!==x[S]&&(M=!0);if(!this.vao||this.boundProgram!==o||this.boundLayoutVertexBuffer!==u||T||M||this.boundIndexBuffer!==p||this.boundVertexOffset!==g)this.freshBind(o,u,d,p,g,x,b);else{r.bindVertexArrayOES.set(this.vao);for(const S of x)S&&(S.bind(),b&&S.instanceCount&&S.setVertexAttribDivisor(r.gl,o,b));p&&p.dynamicDraw&&p.bind()}}freshBind(r,o,u,d,p,g,x){const b=r.numAttributes,T=this.context,M=T.gl;this.vao&&this.destroy(),this.vao=T.gl.createVertexArray(),T.bindVertexArrayOES.set(this.vao),this.boundProgram=r,this.boundLayoutVertexBuffer=o,this.boundPaintVertexBuffers=u,this.boundIndexBuffer=d,this.boundVertexOffset=p,this.boundDynamicVertexBuffers=g,o.enableAttributes(M,r),o.bind(),o.setVertexAttribPointers(M,r,p);for(const S of u)S.enableAttributes(M,r),S.bind(),S.setVertexAttribPointers(M,r,p);for(const S of g)S&&(S.enableAttributes(M,r),S.bind(),S.setVertexAttribPointers(M,r,p),x&&S.instanceCount&&S.setVertexAttribDivisor(M,r,x));d&&d.bind(),T.currentNumAttributes=b}destroy(){this.vao&&(this.context.gl.deleteVertexArray(this.vao),this.vao=null)}}function rf(c,r){const o=Math.pow(2,r.canonical.z),u=r.canonical.y;return[new a.L(0,u/o).toLngLat().lat,new a.L(0,(u+1)/o).toLngLat().lat]}function ll(c,r,o,u,d,p,g){const x=c.context,b=x.gl,T=o.hillshadeFBO;if(!T)return;c.prepareDrawTile();const M=c.isTileAffectedByFog(r),S=c.getOrCreateProgram("hillshade",{overrideFog:M});x.activeTexture.set(b.TEXTURE0),b.bindTexture(b.TEXTURE_2D,T.colorAttachment.get());const C=((O,D,F,Z)=>{const V=F.paint.get("hillshade-shadow-color"),q=F.paint.get("hillshade-highlight-color"),B=F.paint.get("hillshade-accent-color"),$=F.paint.get("hillshade-emissive-strength");let Y=a.bj(F.paint.get("hillshade-illumination-direction"));if(F.paint.get("hillshade-illumination-anchor")==="viewport")Y-=O.transform.angle;else if(O.style&&O.style.enable3dLights()&&O.style.directionalLight){const ee=O.style.directionalLight.properties.get("direction"),ce=a.bQ(ee.x,ee.y,ee.z);Y=a.bj(ce[1])}const K=!O.options.moving;return{u_matrix:Z||O.transform.calculateProjMatrix(D.tileID.toUnwrapped(),K),u_image:0,u_latrange:rf(0,D.tileID),u_light:[F.paint.get("hillshade-exaggeration"),Y],u_shadow:V,u_highlight:q,u_emissive_strength:$,u_accent:B}})(c,o,u,c.terrain?r.projMatrix:null);c.uploadCommonUniforms(x,S,r.toUnwrapped());const{tileBoundsBuffer:P,tileBoundsIndexBuffer:k,tileBoundsSegments:R}=c.getTileBoundsBuffers(o);S.draw(c,b.TRIANGLES,d,p,g,ft.disabled,C,u.id,P,k,R)}function dh(c,r,o){if(!r.needsDEMTextureUpload)return;const u=c.context,d=u.gl;u.pixelStoreUnpackPremultiplyAlpha.set(!1),r.demTexture=r.demTexture||c.getTileTexture(o.stride);const p=o.getPixels();r.demTexture?r.demTexture.update(p,{premultiply:!1}):r.demTexture=new a.T(u,p,d.R32F,{premultiply:!1}),r.needsDEMTextureUpload=!1}function zc(c,r,o){const u=c.context,d=u.gl;if(!r.dem)return;const p=r.dem;if(u.activeTexture.set(d.TEXTURE1),dh(c,r,p),!r.demTexture)return;r.demTexture.bind(d.NEAREST,d.CLAMP_TO_EDGE);const g=p.dim;u.activeTexture.set(d.TEXTURE0);let x=r.hillshadeFBO;if(!x){const C=new a.T(u,{width:g,height:g,data:null},d.RGBA);C.bind(d.LINEAR,d.CLAMP_TO_EDGE),x=r.hillshadeFBO=u.createFramebuffer(g,g,!0,"renderbuffer"),x.colorAttachment.set(C.texture)}u.bindFramebuffer.set(x.framebuffer),u.viewport.set([0,0,g,g]);const{tileBoundsBuffer:b,tileBoundsIndexBuffer:T,tileBoundsSegments:M}=c.getMercatorTileBoundsBuffers(),S=[];c.linearFloatFilteringSupported()&&S.push("TERRAIN_DEM_FLOAT_FORMAT"),c.getOrCreateProgram("hillshadePrepare",{defines:S}).draw(c,d.TRIANGLES,dt.disabled,yt.disabled,Rt.unblended,ft.disabled,((C,P)=>{const k=P.stride,R=a.a6.create();return a.a6.ortho(R,0,a.V,-a.V,0,0,1),a.a6.translate(R,R,[0,-a.V,0]),{u_matrix:R,u_image:1,u_dimension:[k,k],u_zoom:C.overscaledZ}})(r.tileID,p),o.id,b,T,M),r.needsHillshadePrepare=!1}const fh=c=>({u_matrix:new a.bK(c),u_image0:new a.bO(c),u_skirt_height:new a.bN(c),u_ground_shadow_factor:new a.bM(c)}),cl=(c,r,o)=>({u_matrix:c,u_image0:0,u_skirt_height:r,u_ground_shadow_factor:o}),ph=(c,r,o,u,d,p,g,x,b,T,M,S,C,P,k,R)=>({u_proj_matrix:Float32Array.from(c),u_globe_matrix:r,u_normalize_matrix:Float32Array.from(u),u_merc_matrix:o,u_zoom_transition:d,u_merc_center:p,u_image0:0,u_frustum_tl:g,u_frustum_tr:x,u_frustum_br:b,u_frustum_bl:T,u_globe_pos:M,u_globe_radius:S,u_viewport:C,u_grid_matrix:R?Float32Array.from(R):new Float32Array(9),u_skirt_height:P,u_far_z_cutoff:k});function oa(c,r){return c!=null&&r!=null&&!(!c.hasData()||!r.hasData())&&c.demTexture!=null&&r.demTexture!=null&&c.tileID.key!==r.tileID.key}const vs=new class{constructor(){this.operations={}}
2099newMorphing(c,r,o,u,d){if(c in this.operations){const p=this.operations[c];p.to.tileID.key!==o.tileID.key&&(p.queued=o)}else this.operations[c]={startTime:u,phase:0,duration:d,from:r,to:o,queued:null}}getMorphValuesForProxy(c){if(!(c in this.operations))return null;const r=this.operations[c];return{from:r.from,to:r.to,phase:r.phase}}update(c){for(const r in this.operations){const o=this.operations[r];for(o.phase=(c-o.startTime)/o.duration;o.phase>=1||!this._validOp(o);)if(!this._nextOp(o,c)){delete this.operations[r];break}}}_nextOp(c,r){return!!c.queued&&(c.from=c.to,c.to=c.queued,c.queued=null,c.phase=0,c.startTime=r,!0)}_validOp(c){return c.from.hasData()&&c.to.hasData()}},Dc={0:null,1:"TERRAIN_VERTEX_MORPHING"};function Lc(c,r,o){if(r===0)return 0;const u=r<1&&o===514?.25/r:1;return 6*Math.pow(1.5,22-c)*Math.max(r,1)*u}function bs(c,r){const o=1<<c.z;return!r&&(c.x===0||c.x===o-1)||c.y===0||c.y===o-1}const Rc=c=>({u_matrix:c});function kc(c,r,o,u,d){if(d>0){const p=a.f.now(),g=(p-c.timeAdded)/d,x=r?(p-r.timeAdded)/d:-1,b=o.getSource(),T=u.coveringZoomLevel({tileSize:b.tileSize,roundZoom:b.roundZoom}),M=!r||Math.abs(r.tileID.overscaledZ-T)>Math.abs(c.tileID.overscaledZ-T),S=M&&c.refreshedUponExpiration?1:a.aa(M?g:1-x,0,1);return c.refreshedUponExpiration&&g>=1&&(c.refreshedUponExpiration=!1),r?{opacity:1,mix:1-S}:{opacity:S,mix:0}}return{opacity:1,mix:0}}class nf extends nn{constructor(r){const o={type:"raster-dem",maxzoom:r.transform.maxZoom},u=new a.bW(a.bX(),null),d=Wi("mock-dem",o,u,r.style);super("mock-dem",d,!1),d.setEventedParent(this),this._sourceLoaded=!0}_loadTile(r,o){r.state="loaded",o(null)}}class of extends nn{constructor(r){const o=Wi("proxy",{type:"geojson",maxzoom:r.transform.maxZoom},new a.bW(a.bX(),null),r.style);super("proxy",o,!1),o.setEventedParent(this),this.map=this.getSource().map=r,this.used=this._sourceLoaded=!0,this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}update(r,o,u){if(r.freezeTileCoverage)return;this.transform=r;const d=r.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}).reduce((p,g)=>{if(p[g.key]="",!this._tiles[g.key]){const x=new Jn(g,this._source.tileSize*g.overscaleFactor(),r.tileZoom);x.state="loaded",this._tiles[g.key]=x}return p},{});for(const p in this._tiles)p in d||(this.freeFBO(p),this._tiles[p].unloadVectorData(),delete this._tiles[p])}freeFBO(r){const o=this.proxyCachedFBO[r];if(o!==void 0){const u=Object.values(o);this.renderCachePool.push(...u),delete this.proxyCachedFBO[r]}}deallocRenderCache(){this.renderCache.forEach(r=>r.fb.destroy()),this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}}class mh extends a.am{constructor(r,o,u){super(r.overscaledZ,r.wrap,r.canonical.z,r.canonical.x,r.canonical.y),this.proxyTileKey=o,this.projMatrix=u}}class sf extends a.ck{constructor(r,o){super(),this._debugParams={sortTilesHiZFirst:!0,disableRenderCache:!1},r.tp.registerParameter(this._debugParams,["Terrain"],"sortTilesHiZFirst",{},()=>{this._style.map.triggerRepaint()}),r.tp.registerParameter(this._debugParams,["Terrain"],"disableRenderCache",{},()=>{this._style.map.triggerRepaint()}),r.tp.registerButton(["Terrain"],"Invalidate Render Cache",()=>{this.invalidateRenderCache=!0,this._style.map.triggerRepaint()}),this.painter=r,this.terrainTileForTile={},this.prevTerrainTileForTile={};const[u,d,p]=function(b){const T=new a.aN,M=new a.aw,S=131;T.reserve(17161),M.reserve(33800);const C=a.V/128,P=a.V+C/2,k=P+C;for(let O=-C;O<k;O+=C)for(let D=-C;D<k;D+=C){const F=D<0||D>P||O<0||O>P?24575:0,Z=a.aa(Math.round(D),0,a.V),V=a.aa(Math.round(O),0,a.V);T.emplaceBack(Z+F,V)}const R=(O,D)=>{const F=D*S+O;M.emplaceBack(F+1,F,F+S),M.emplaceBack(F+S,F+S+1,F+1)};for(let O=1;O<129;O++)for(let D=1;D<129;D++)R(D,O);return[0,129].forEach(O=>{for(let D=0;D<130;D++)R(D,O),R(O,D)}),[T,M,32768]}(),g=r.context;this.gridBuffer=g.createVertexBuffer(u,a.aP.members),this.gridIndexBuffer=g.createIndexBuffer(d),this.gridSegments=a.aB.simpleSegment(0,0,u.length,d.length),this.gridNoSkirtSegments=a.aB.simpleSegment(0,0,u.length,p),this.proxyCoords=[],this.proxiedCoords={},this._visibleDemTiles=[],this._drapedRenderBatches=[],this._sourceTilesOverlap={},this.proxySourceCache=new of(o.map),this.orthoMatrix=a.a6.create(),a.a6.ortho(this.orthoMatrix,this.painter.transform.projection.name==="globe"?.015:0,a.V,0,a.V,0,1);const x=g.gl;this._overlapStencilMode=new yt({func:x.GEQUAL,mask:255},0,255,x.KEEP,x.KEEP,x.REPLACE),this._previousZoom=r.transform.zoom,this.pool=[],this._findCoveringTileCache={},this._tilesDirty={},this.style=o,this._useVertexMorphing=!0,this._exaggeration=1,this._mockSourceCache=new nf(o.map),this._pendingGroundEffectLayers=[]}set style(r){r.on("data",this._onStyleDataEvent.bind(this)),this._style=r,this._style.map.on("moveend",()=>{this._clearLineLayersFromRenderCache()})}update(r,o,u){if(r&&r.terrain){this._style!==r&&(this.style=r,this._evaluationZoom=void 0);const d=r.terrain.properties,p=r.terrain.drapeRenderMode===0,g=r.terrain.isZoomDependent();this._previousUpdateTimestamp=this.enabled?this._updateTimestamp:void 0,this._updateTimestamp=a.f.now();const x=r.terrain&&r.terrain.scope,b=d.get("source"),T=p?this._mockSourceCache:r.getSourceCache(b,x);if(!T)return void a.w(`Couldn't find terrain source "${b}".`);if(this.sourceCache=T,this._exaggeration=g?this.calculateExaggeration(o):d.get("exaggeration"),!o.projection.requiresDraping&&g&&this._exaggeration===0)return void this._disable();this.enabled=!0;const M=()=>{this.sourceCache.used&&a.w(`Raster DEM source '${this.sourceCache.id}' is used both for terrain and as layer source. 2100This leads to lower resolution of hillshade. For full hillshade resolution but higher memory consumption, define another raster DEM source.`);const S=this.getScaledDemTileSize();this.sourceCache.update(o,S,!0),this.resetTileLookupCache(this.sourceCache.id)};this.sourceCache.usedForTerrain||(this.resetTileLookupCache(this.sourceCache.id),this.sourceCache.usedForTerrain=!0,M(),this._initializing=!0),M(),o.updateElevation(!0,u),this.resetTileLookupCache(this.proxySourceCache.id),this.proxySourceCache.update(o),this._emptyDEMTextureDirty=!0,this._previousZoom=
vendor: 4,398 bytes, line 2100
2100o.zoom}else this._disable()}calculateExaggeration(r){const o=this._previousCameraAltitude,u=r.getFreeCameraOptions().position.z/r.pixelsPerMeter*r.worldSize;this._previousCameraAltitude=u;const d=o!=null?u-o:Number.MAX_VALUE;if(Math.abs(d)<2)return this._exaggeration;const p=r.zoom,g=this._style.terrain;if(!this._previousUpdateTimestamp)return g.getExaggeration(p);let x=p-this._previousZoom;const b=this._previousUpdateTimestamp;let T=p;this._evaluationZoom!=null&&(T=this._evaluationZoom,Math.abs(p-T)>.5&&(x=.5*(p-T+x)),x*d<0&&(T+=x)),this._evaluationZoom=T;const M=g.getExaggeration(T),S=M===g.getExaggeration(Math.max(0,T-.1));if(S&&Math.abs(M-this._exaggeration)<.01)return M;let C=Math.min(.1,.00375*(this._updateTimestamp-b));return(S||M<.1||Math.abs(x)<1e-4)&&(C=Math.min(.2,4*C)),a.U(this._exaggeration,M,C)}resetTileLookupCache(r){this._findCoveringTileCache[r]={}}getScaledDemTileSize(){return this.sourceCache.getSource().tileSize/128*this.proxySourceCache.getSource().tileSize}_onStyleDataEvent(r){r.coord&&r.dataType==="source"?this._clearRenderCacheForTile(r.sourceCacheId,r.coord):r.dataType==="style"&&(this.invalidateRenderCache=!0,this._evaluationZoom=void 0,this._previousUpdateTimestamp=void 0,this._previousCameraAltitude=void 0)}_disable(){if(this.enabled&&(this.enabled=!1,this._sharedDepthStencil=void 0,this._evaluationZoom=void 0,this._previousUpdateTimestamp=void 0,this.proxySourceCache.deallocRenderCache(),this._style))for(const r in this._style._mergedSourceCaches)this._style._mergedSourceCaches[r].usedForTerrain=!1}destroy(){this._disable(),this._emptyDEMTexture&&this._emptyDEMTexture.destroy(),this._emptyDepthBufferTexture&&this._emptyDepthBufferTexture.destroy(),this.pool.forEach(r=>r.fb.destroy()),this.pool=[],this._depthFBO&&(this._depthFBO.destroy(),this._depthFBO=void 0,this._depthTexture=void 0),this.framebufferCopyTexture&&this.framebufferCopyTexture.destroy()}_source(){return this.enabled?this.sourceCache:null}isUsingMockSource(){return this.sourceCache===this._mockSourceCache}exaggeration(){return this._exaggeration}get visibleDemTiles(){return this._visibleDemTiles}get drapeBufferSize(){const r=2*this.proxySourceCache.getSource().tileSize;return[r,r]}set useVertexMorphing(r){this._useVertexMorphing=r}updateTileBinding(r){if(!this.enabled)return;this.prevTerrainTileForTile=this.terrainTileForTile;const o=this.proxySourceCache,u=this.painter.transform;this._initializing&&(this._initializing=u._centerAltitude===0&&this.getAtPointOrZero(a.L.fromLngLat(u.center),-1)===-1,this._emptyDEMTextureDirty=!this._initializing);const d=this.proxyCoords=o.getIds().map(b=>{const T=o.getTileByID(b).tileID;return T.projMatrix=u.calculateProjMatrix(T.toUnwrapped()),T});(function(b,T){const M=T.transform.pointCoordinate(T.transform.getCameraPoint()),S=new a.P(M.x,M.y);b.sort((C,P)=>{if(P.overscaledZ-C.overscaledZ)return P.overscaledZ-C.overscaledZ;const k=new a.P(C.canonical.x+(1<<C.canonical.z)*C.wrap,C.canonical.y),R=new a.P(P.canonical.x+(1<<P.canonical.z)*P.wrap,P.canonical.y),O=S.mult(1<<C.canonical.z);return O.x-=.5,O.y-=.5,O.distSqr(k)-O.distSqr(R)})})(d,this.painter);const p=this.proxyToSource||{};this.proxyToSource={},d.forEach(b=>{this.proxyToSource[b.key]={}}),this.terrainTileForTile={};const g=this._style._mergedSourceCaches;for(const b in g){const T=g[b];if(!T.used||(T!==this.sourceCache&&this.resetTileLookupCache(T.id),this._setupProxiedCoordsForOrtho(T,r[b],p),T.usedForTerrain))continue;const M=r[b];T.getSource().reparseOverscaled&&this._assignTerrainTiles(M)}this.proxiedCoords[o.id]=d.map(b=>new mh(b,b.key,this.orthoMatrix)),this._assignTerrainTiles(d),this._prepareDEMTextures(),this._setupDrapedRenderBatches(),this._initFBOPool(),this._setupRenderCache(p),this.renderingToTexture=!1;const x={};this._visibleDemTiles=[];for(const b of this.proxyCoords){const T=this.terrainTileForTile[b.key];if(!T)continue;const M=T.tileID.key;M in x||(this._visibleDemTiles.push(T),x[M]=M)}}_assignTerrainTiles(r){this._initializing||r.forEach(o=>{if(this.terrainTileForTile[o.key])return;const u=this._findTileCoveringTileID(o,this.sourceCache);u&&(this.terrainTileForTile[o.key]=u)})}_prepareDEMTextures(){const r=this.painter.context,o=r.gl;for(const u in this.terrainTileForTile){const d=this.terrainTileForTile[u],p=d.dem;!p||d.demTexture&&!d.needsDEMTextureUpload||(r.activeTexture.set(o.TEXTURE1),dh(this.painter,d,p))}}
2100_prepareDemTileUniforms(r,o,u,d){if(!o||o.demTexture==null)return!1;const p=r.tileID.canonical,g=Math.pow(2,o.tileID.canonical.z-p.z),x=d||"";return u[`u_dem_tl${x}`]=[p.x*g%1,p.y*g%1],u[`u_dem_scale${x}`]=g,!0}get emptyDEMTexture(){return!this._emptyDEMTextureDirty&&this._emptyDEMTexture?this._emptyDEMTexture:this._updateEmptyDEMTexture()}get emptyDepthBufferTexture(){const r=this.painter.context,o=r.gl;if(!this._emptyDepthBufferTexture){const u=new a.h({width:1,height:1},Uint8Array.of(255,255,255,255));this._emptyDepthBufferTexture=new a.T(r,u,o.RGBA,{premultiply:!1})}return this._emptyDepthBufferTexture}_getLoadedAreaMinimum(){let r=0;const o=this._visibleDemTiles.reduce((u,d)=>{if(!d.dem)return u;const p=d.dem.tree.minimums[0];return p>0&&r++,u+p},0);return r?o/r:0}_updateEmptyDEMTexture(){const r=this.painter.context,o=r.gl;r.activeTexture.set(o.TEXTURE2);const u=this._getLoadedAreaMinimum(),[d,p]=(()=>{const x=new a.cm({width:1,height:1},new Float32Array([u]));return[o.R32F,x]})();this._emptyDEMTextureDirty=!1;let g=this._emptyDEMTexture;return g?g.update(p,{premultiply:!1}):g=this._emptyDEMTexture=new a.T(r,p,d,{premultiply:!1}),g}setupElevationDraw(r,o,u){const d=this.painter.context,p=d.gl,g={u_dem:2,u_dem_prev:4,u_dem_tl:[0,0],u_dem_tl_prev:[0,0],u_dem_scale:0,u_dem_scale_prev:0,u_dem_size:0,u_dem_lerp:1,u_depth:3,u_depth_size_inv:[0,0],u_exaggeration:0};g.u_exaggeration=this.exaggeration();let x=null,b=null,T=1;if(u&&u.morphing&&this._useVertexMorphing){const C=u.morphing.srcDemTile,P=u.morphing.dstDemTile;T=u.morphing.phase,C&&P&&(this._prepareDemTileUniforms(r,C,g,"_prev")&&(b=C),this._prepareDemTileUniforms(r,P,g)&&(x=P))}const M=C=>C&&C.demTexture&&this.painter.linearFloatFilteringSupported()?p.LINEAR:p.NEAREST,S=C=>{g.u_dem_size=C.size[0]===1?1:C.size[0]-2};if(b&&x)d.activeTexture.set(p.TEXTURE2),x.demTexture.bind(M(x),p.CLAMP_TO_EDGE),d.activeTexture.set(p.TEXTURE4),b.demTexture.bind(M(b),p.CLAMP_TO_EDGE),x.demTexture&&S(x.demTexture),g.u_dem_lerp=T;else{x=this.terrainTileForTile[r.tileID.key],d.activeTexture.set(p.TEXTURE2);const C=this._prepareDemTileUniforms(r,x,g)?x.demTexture:this.emptyDEMTexture;C.bind(M(x),p.CLAMP_TO_EDGE),S(C)}if(d.activeTexture.set(p.TEXTURE3),u&&u.useDepthForOcclusion?(this._depthTexture&&this._depthTexture.bind(p.NEAREST,p.CLAMP_TO_EDGE),this._depthFBO&&(g.u_depth_size_inv=[1/this._depthFBO.width,1/this._depthFBO.height])):(this.emptyDepthBufferTexture.bind(p.NEAREST,p.CLAMP_TO_EDGE),g.u_depth_size_inv=[1,1]),u&&u.useMeterToDem&&x){const C=(1<<x.tileID.canonical.z)*a.bl(1,this.painter.transform.center.lat)*this.sourceCache.getSource().tileSize;g.u_meter_to_dem=C}if(u&&u.labelPlaneMatrixInv&&(g.u_label_plane_matrix_inv=u.labelPlaneMatrixInv),o.setTerrainUniformValues(d,g),this.painter.transform.projection.name==="globe"){const C=this.globeUniformValues(this.painter.transform,r.tileID.canonical,u&&u.useDenormalizedUpVectorScale);o.setGlobeUniformValues(d,C)}}globeUniformValues(r,o,u){const d=r.projection;return{u_tile_tl_up:d.upVector(o,0,0),u_tile_tr_up:d.upVector(o,a.V,0),u_tile_br_up:d.upVector(o,a.V,a.V),u_tile_bl_up:d.upVector(o,0,a.V),u_tile_up_scale:u?a.cl(1):d.upVectorScale(o,r.center.lat,r.worldSize).metersToTile}}renderToBackBuffer(r){const o=this.painter,u=this.painter.context;r.length!==0&&(u.bindFramebuffer.set(null),u.viewport.set([0,0,o.width,o.height]),o.gpuTimingDeferredRenderStart(),this.renderingToTexture=!1,function(d,p,g,x,b){if(d.transform.projection.name==="globe")(function(T,M,S,C,P){const k=T.context,R=k.gl;let O,D;const F=T.transform,Z=a.cd(T,k,F),V=(me,fe)=>{if(D===fe)return;const Ae=[Dc[fe],"PROJECTION_GLOBE_VIEW"];Z&&Ae.push("CUSTOM_ANTIALIASING");const ne=T.isTileAffectedByFog(me);O=T.getOrCreateProgram("globeRaster",{defines:Ae,overrideFog:ne}),D=fe},q=T.colorModeForRenderPass(),B=new dt(R.LEQUAL,dt.ReadWrite,T.depthRangeFor3D);vs.update(P);const $=a.ce(F),Y=[a.a5(F.center.lng),a.ae(F.center.lat)],K=T.globeSharedBuffers,ee=[F.width*a.f.devicePixelRatio,F.height*a.f.devicePixelRatio],ce=Float32Array.from(F.globeMatrix),re={useDenormalizedUpVectorScale:!0};{const me=T.transform,fe=Lc(me.zoom,M.exaggeration(),M.sourceCache._source.tileSize);D=-1;const Ae=R.TRIANGLES;for(const ne of C){const he=S.getTile(ne),Q=yt.disabled,ae=M.prevTerrainTileForTile[ne.key],Ie=M.terrainTileForTile[ne.key];oa(ae,Ie)&&vs.newMorphing(ne.key,ae,Ie,P,250),k.activeTexture.set(R.TEXTURE0),he.texture&&he.texture.bind(R.LINEAR,R.CLAMP_TO_EDGE);
vendor: 10,071 bytes, line 2100
2100const Re=vs.getMorphValuesForProxy(ne.key),Le=Re?1:0;Re&&a.j(re,{morphing:{srcDemTile:Re.from,dstDemTile:Re.to,phase:a.cc(Re.phase)}});const je=a.cf(ne.canonical),et=a.cg(je.getCenter().lat),ct=a.ch(ne.canonical,je,et,me.worldSize/me._pixelsPerMercatorPixel),nt=a.aT(a.ci(ne.canonical)),at=ph(me.expandedFarZProjMatrix,ce,$,nt,a.S(me.zoom),Y,me.frustumCorners.TL,me.frustumCorners.TR,me.frustumCorners.BR,me.frustumCorners.BL,me.globeCenterInViewSpace,me.globeRadius,ee,fe,me._farZ,ct);if(V(ne,Le),O&&(M.setupElevationDraw(he,O,re),T.uploadCommonUniforms(k,O,ne.toUnwrapped()),K)){const[Et,gt,bt]=K.getGridBuffers(et,fe!==0);O.draw(T,Ae,B,Q,q,ft.backCCW,at,"globe_raster",Et,gt,bt)}}}if(K&&(T.renderDefaultNorthPole||T.renderDefaultSouthPole)){const me=["GLOBE_POLES","PROJECTION_GLOBE_VIEW"];Z&&me.push("CUSTOM_ANTIALIASING"),O=T.getOrCreateProgram("globeRaster",{defines:me});for(const fe of C){const{x:Ae,y:ne,z:he}=fe.canonical,Q=ne===0,ae=ne===(1<<he)-1,[Ie,Re,Le,je]=K.getPoleBuffers(he,!1);if(je&&(Q||ae)){const et=S.getTile(fe);k.activeTexture.set(R.TEXTURE0),et.texture&&et.texture.bind(R.LINEAR,R.CLAMP_TO_EDGE);let ct=a.cj(he,Ae,F);const nt=a.aT(a.ci(fe.canonical)),at=(Et,gt)=>Et.draw(T,R.TRIANGLES,B,yt.disabled,q,ft.disabled,ph(F.expandedFarZProjMatrix,ct,ct,nt,0,Y,F.frustumCorners.TL,F.frustumCorners.TR,F.frustumCorners.BR,F.frustumCorners.BL,F.globeCenterInViewSpace,F.globeRadius,ee,0,F._farZ),"globe_pole_raster",gt,Le,je);M.setupElevationDraw(et,O,re),T.uploadCommonUniforms(k,O,fe.toUnwrapped()),Q&&T.renderDefaultNorthPole&&at(O,Ie),ae&&T.renderDefaultSouthPole&&(ct=a.a6.scale(a.a6.create(),ct,[1,-1,1]),at(O,Re))}}}})(d,p,g,x,b);else{const T=d.context,M=T.gl;let S,C;const P=d.shadowRenderer,k=no(d,d.longestCutoffRange),R=q=>{if(C===q)return;const B=[];B.push(Dc[q]),k.shouldRenderCutoff&&B.push("RENDER_CUTOFF"),S=d.getOrCreateProgram("terrainRaster",{defines:B}),C=q},O=d.colorModeForRenderPass(),D=new dt(M.LEQUAL,dt.ReadWrite,d.depthRangeFor3D);vs.update(b);const F=d.transform,Z=Lc(F.zoom,p.exaggeration(),p.sourceCache._source.tileSize);let V=[0,0,0];if(P){const q=d.style.directionalLight,B=d.style.ambientLight;q&&B&&(V=ra(q,B))}{C=-1;const q=M.TRIANGLES,[B,$]=[p.gridIndexBuffer,p.gridSegments];for(const Y of x){const K=g.getTile(Y),ee=yt.disabled,ce=p.prevTerrainTileForTile[Y.key],re=p.terrainTileForTile[Y.key];oa(ce,re)&&vs.newMorphing(Y.key,ce,re,b,250),T.activeTexture.set(M.TEXTURE0),K.texture&&K.texture.bind(M.LINEAR,M.CLAMP_TO_EDGE);const me=vs.getMorphValuesForProxy(Y.key),fe=me?1:0;let Ae;me&&(Ae={morphing:{srcDemTile:me.from,dstDemTile:me.to,phase:a.cc(me.phase)}});const ne=cl(Y.projMatrix,bs(Y.canonical,F.renderWorldCopies)?Z/10:Z,V);if(R(fe),!S)continue;p.setupElevationDraw(K,S,Ae);const he=Y.toUnwrapped();P&&P.setupShadows(he,S),d.uploadCommonUniforms(T,S,he,null,k),S.draw(d,q,D,ee,O,ft.backCCW,ne,"terrain_raster",p.gridBuffer,B,$)}}}}(o,this,this.proxySourceCache,r,this._updateTimestamp),this.renderingToTexture=!0,o.gpuTimingDeferredRenderEnd(),r.splice(0,r.length))}renderBatch(r){if(this._drapedRenderBatches.length===0)return r+1;this.renderingToTexture=!0;const o=this.painter,u=this.painter.context,d=this.proxySourceCache,p=this.proxiedCoords[d.id],g=this._drapedRenderBatches.shift(),x=o.style.order,b=[];let T=0;for(const M of p){const S=d.getTileByID(M.proxyTileKey),C=d.proxyCachedFBO[M.key]?d.proxyCachedFBO[M.key][r]:void 0,P=C!==void 0?d.renderCache[C]:this.pool[T++],k=C!==void 0;if(S.texture=P.tex,k&&!P.dirty){b.push(S.tileID);continue}let R;u.bindFramebuffer.set(P.fb.framebuffer),this.renderedToTile=!1,P.dirty&&(u.clear({color:a.ax.transparent,stencil:0}),P.dirty=!1);for(let O=g.start;O<=g.end;++O){const D=o.style._mergedLayers[x[O]];if(D.isHidden(o.transform.zoom))continue;const F=o.style.getLayerSourceCache(D),Z=F?this.proxyToSource[M.key][F.id]:[M];if(!Z)continue;const V=Z;u.viewport.set([0,0,P.fb.width,P.fb.height]),R!==(F?F.id:null)&&(this._setupStencil(P,Z,D,F),R=F?F.id:null),o.renderLayer(o,F,D,V)}if(this._drapedRenderBatches.length===0)for(const O of this._pendingGroundEffectLayers){const D=o.style._mergedLayers[x[O]];if(D.isHidden(o.transform.zoom))continue;const F=o.style.getLayerSourceCache(D),Z=F?this.proxyToSource[M.key][F.id]:[M];if(!Z)continue;const V=Z;u.viewport.set([0,0,P.fb.width,P.fb.height]),R!==(F?F.id:null)&&(this._setupStencil(P,Z,D,F),R=F?F.id:null),o.renderLayer(o,F,D,V)}this.renderedToTile?(P.dirty=!0,b.push(S.tileID)):k||--T,T===5&&(T=0,this.renderToBackBuffer(b))}return this.renderToBackBuffer(b),this.renderingToTexture=!1,u.bindFramebuffer.set(null),u.viewport.set([0,0,o.width,o.height]),g.end+1}postRender(){}isLayerOrderingCorrect(r){const o=r.order.length;let u=-1,d=o;for(let p=0;p<o;++p)this._style.isLayerDraped(r._mergedLayers[r.order[p]])?u=Math.max(u,p):d=Math.min(d,p);return d>u}getMinElevationBelowMSL(){let r=0;return this._visibleDemTiles.filter(o=>o.dem).forEach(o=>{r=Math.min(r,o.dem.tree.minimums[0])}),r===0?r:(r-30)*this._exaggeration}raycast(r,o,u){if(!this._visibleDemTiles)return null;const d=this._visibleDemTiles.filter(p=>p.dem).map(p=>{const g=p.tileID,x=1<<g.overscaledZ,{x:b,y:T}=g.canonical,M=b/x,S=(b+1)/x,C=T/x,P=(T+1)/x;return{minx:M,miny:C,maxx:S,maxy:P,t:p.dem.tree.raycastRoot(M,C,S,P,r,o,u),tile:p}});d.sort((p,g)=>(p.t!==null?p.t:Number.MAX_VALUE)-(g.t!==null?g.t:Number.MAX_VALUE));for(const p of d){if(p.t==null)return null;const g=p.tile.dem.tree.raycast(p.minx,p.miny,p.maxx,p.maxy,r,o,u);if(g!=null)return g}return null}_createFBO(){const r=this.painter.context,o=r.gl,u=this.drapeBufferSize;r.activeTexture.set(o.TEXTURE0);const d=new a.T(r,{width:u[0],height:u[1],data:null},o.RGBA);d.bind(o.LINEAR,o.CLAMP_TO_EDGE);const p=r.createFramebuffer(u[0],u[1],!0,null);return p.colorAttachment.set(d.texture),p.depthAttachment=new Ar(r,p.framebuffer),this._sharedDepthStencil===void 0?(this._sharedDepthStencil=r.createRenderbuffer(r.gl.DEPTH_STENCIL,u[0],u[1]),this._stencilRef=0,p.depthAttachment.set(this._sharedDepthStencil),r.clear({stencil:0})):p.depthAttachment.set(this._sharedDepthStencil),r.extTextureFilterAnisotropic&&o.texParameterf(o.TEXTURE_2D,r.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,r.extTextureFilterAnisotropicMax),{fb:p,tex:d,dirty:!1}}_initFBOPool(){for(;this.pool.length<Math.min(5,this.proxyCoords.length);)this.pool.push(this._createFBO())}_shouldDisableRenderCache(){if(this._debugParams.disableRenderCache||this._style.hasLightTransitions())return!0;for(const r in this._style._mergedSourceCaches)if(this._style._mergedSourceCaches[r].hasTransition())return!0;return this._style.order.some(r=>{const o=this._style._mergedLayers[r],u=o.isHidden(this.painter.transform.zoom);return o.type==="custom"?!u&&o.shouldRedrape():!u&&o.hasTransition()})}_clearLineLayersFromRenderCache(){let r=!1;for(const u of this._style.getSources())if(u instanceof Ge){r=!0;break}if(!r)return;const o={};for(let u=0;u<this._style.order.length;++u){const d=this._style._mergedLayers[this._style.order[u]],p=this._style.getLayerSourceCache(d);if(p&&!o[p.id]&&!d.isHidden(this.painter.transform.zoom)&&d.type==="line"&&d.widthExpression()instanceof a.Z){o[p.id]=!0;for(const g of this.proxyCoords){const x=this.proxyToSource[g.key][p.id];if(x)for(const b of x)this._clearRenderCacheForTile(p.id,b)}}}}_clearRasterLayersFromRenderCache(){let r=!1;for(const u in this._style._mergedSourceCaches)if(this._style._mergedSourceCaches[u]._source instanceof Ze){r=!0;break}if(!r)return;const o={};for(let u=0;u<this._style.order.length;++u){const d=this._style._mergedLayers[this._style.order[u]],p=this._style.getLayerSourceCache(d);if(!p||o[p.id]||d.isHidden(this.painter.transform.zoom)||d.type!=="raster")continue;const g=d.paint.get("raster-fade-duration");for(const x of this.proxyCoords){const b=this.proxyToSource[x.key][p.id];if(b)for(const T of b){const M=kc(p.getTile(T),p.findLoadedParent(T,0),p,this.painter.transform,g);(M.opacity!==1||M.mix!==0)&&this._clearRenderCacheForTile(p.id,T)}}}}_setupDrapedRenderBatches(){const r=this._style.order,o=r.length;if(o===0)return;const u=[];this._pendingGroundEffectLayers=[];let d,p=0,g=this._style._mergedLayers[r[p]];for(;!this._style.isLayerDraped(g)&&g.isHidden(this.painter.transform.zoom)&&++p<o;)g=this._style._mergedLayers[r[p]];for(;p<o;++p){const x=this._style._mergedLayers[r[p]];x.isHidden(this.painter.transform.zoom)||(this._style.isLayerDraped(x)?d===void 0&&(d=p):(x.type==="fill-extrusion"&&this._pendingGroundEffectLayers.push(p),d!==void 0&&(u.push({start:d,end:p-1}),d=void 0)))}if(d!==void 0&&u.push({start:d,end:p-1}),u.length!==0){const x=u[u.length-1];this._pendingGroundEffectLayers.every(b=>b>x.end)||a.w("fill-extrusion with flood lighting and/or ground ambient occlusion should be moved to be on top of all draped layers.")}this._drapedRenderBatches=u}_setupRenderCache(r){const o=this.proxySourceCache;if(this._shouldDisableRenderCache()||this.invalidateRenderCache){if(this.invalidateRenderCache=!1,o.renderCache.length>o.renderCachePool.length){const g=Object.values(o.proxyCachedFBO);o.proxyCachedFBO={};for(let x=0;x<g.length;++x){const b=Object.values(g[x]);o.renderCachePool.push(...b)}}return}this._clearRasterLayersFromRenderCache();const u=this.proxyCoords,d=this._tilesDirty;for(let g=u.length-1;g>=0;g--){const x=u[g];if(o.getTileByID(x.key),o.proxyCachedFBO[x.key]!==void 0){const b=r[x.key],T=this.proxyToSource[x.key];let M=0;for(const S in T){const C=T[S],P=b[S];if(!P||P.length!==C.length||C.some((k,R)=>k!==P[R]||d[S]&&d[S].hasOwnProperty(k.key))){M=-1;break}++M}for(const S in o.proxyCachedFBO[x.key])o.renderCache[o.proxyCachedFBO[x.key][S]].dirty=M<0||M!==Object.values(b).length}}const p=[...this._drapedRenderBatches];p.sort((g,x)=>x.end-x.start-(g.end-g.start));for(const g of p)for(const x of u){if(o.proxyCachedFBO[x.key])continue;let b=o.renderCachePool.pop();b===void 0&&o.renderCache.length<50&&(b=o.renderCache.length,o.renderCache.push(this._createFBO())),b!==void 0&&(o.proxyCachedFBO[x.key]={},o.proxyCachedFBO[x.key][g.start]=b,o.renderCache[b].dirty=!0)}this._tilesDirty={}}
2100_setupStencil(r,o,u,d){if(!d||!this._sourceTilesOverlap[d.id])return void(this._overlapStencilType&&(this._overlapStencilType=!1));const p=this.painter.context,g=p.gl;if(o.length<=1)return void(this._overlapStencilType=!1);let x;if(u.isTileClipped())x=o.length,this._overlapStencilMode.test={func:g.EQUAL,mask:255},this._overlapStencilType="Clip";else{if(!(o[0].overscaledZ>o[o.length-1].overscaledZ))return void(this._overlapStencilType=!1);x=1,this._overlapStencilMode.test={func:g.GREATER,mask:255},this._overlapStencilType="Mask"}this._stencilRef+x>255&&(p.clear({stencil:0}),this._stencilRef=0),this._stencilRef+=x,this._overlapStencilMode.ref=this._stencilRef,u.isTileClipped()&&this._renderTileClippingMasks(o,this._overlapStencilMode.ref)}clipOrMaskOverlapStencilType(){return this._overlapStencilType==="Clip"||this._overlapStencilType==="Mask"}stencilModeForRTTOverlap(r){return this.renderingToTexture&&this._overlapStencilType?(this._overlapStencilType==="Clip"&&(this._overlapStencilMode.ref=this.painter._tileClippingMaskIDs[r.key]),this._overlapStencilMode):yt.disabled}_renderTileClippingMasks(r,o){const u=this.painter,d=this.painter.context,p=d.gl;u._tileClippingMaskIDs={},d.setColorMode(Rt.disabled),d.setDepthMode(dt.disabled);const g=u.getOrCreateProgram("clippingMask");for(const x of r){const b=u._tileClippingMaskIDs[x.key]=--o;g.draw(u,p.TRIANGLES,dt.disabled,new yt({func:p.ALWAYS,mask:0},b,255,p.KEEP,p.KEEP,p.REPLACE),Rt.disabled,ft.disabled,Rc(x.projMatrix),"$clipping",u.tileExtentBuffer,u.quadTriangleIndexBuffer,u.tileExtentSegments)}}pointCoordinate(r){const o=this.painter.transform;if(r.x<0||r.x>o.width||r.y<0||r.y>o.height)return null;const u=[r.x,r.y,1,1];a.a7.transformMat4(u,u,o.pixelMatrixInverse),a.a7.scale(u,u,1/u[3]),u[0]/=o.worldSize,u[1]/=o.worldSize;const d=o._camera.position,p=a.bl(1,o.center.lat),g=[d[0],d[1],d[2]/p,0],x=a.N.subtract([],u.slice(0,3),g);a.N.normalize(x,x);const b=this.raycast(g,x,this._exaggeration);return b!==null&&b?(a.N.scaleAndAdd(g,g,x,b),g[3]=g[2],g[2]*=p,g):null}drawDepth(){const r=this.painter,o=r.context,u=this.proxySourceCache,d=Math.ceil(r.width),p=Math.ceil(r.height);if(!this._depthFBO||this._depthFBO.width===d&&this._depthFBO.height===p||(this._depthFBO.destroy(),this._depthFBO=void 0,this._depthTexture=void 0),!this._depthFBO){const g=o.gl,x=o.createFramebuffer(d,p,!0,"renderbuffer");o.activeTexture.set(g.TEXTURE0);const b=new a.T(o,{width:d,height:p,data:null},g.RGBA);b.bind(g.NEAREST,g.CLAMP_TO_EDGE),x.colorAttachment.set(b.texture);const T=o.createRenderbuffer(o.gl.DEPTH_COMPONENT16,d,p);x.depthAttachment.set(T),this._depthFBO=x,this._depthTexture=b}o.bindFramebuffer.set(this._depthFBO.framebuffer),o.viewport.set([0,0,d,p]),function(g,x,b,T){if(g.transform.projection.name==="globe")return;const M=g.context,S=M.gl;M.clear({depth:1});const C=g.getOrCreateProgram("terrainDepth"),P=new dt(S.LESS,dt.ReadWrite,g.depthRangeFor3D);for(const k of T){const R=b.getTile(k),O=cl(k.projMatrix,0,[0,0,0]);x.setupElevationDraw(R,C),C.draw(g,S.TRIANGLES,P,yt.disabled,Rt.unblended,ft.backCCW,O,"terrain_depth",x.gridBuffer,x.gridIndexBuffer,x.gridNoSkirtSegments)}}(r,this,u,this.proxyCoords)}_setupProxiedCoordsForOrtho(r,o,u){if(r.getSource()instanceof a.ap)return this._setupProxiedCoordsForImageSource(r,o,u);this._findCoveringTileCache[r.id]=this._findCoveringTileCache[r.id]||{};const d=this.proxiedCoords[r.id]=[],p=this.proxyCoords;for(let b=0;b<p.length;b++){const T=p[b],M=this._findTileCoveringTileID(T,r);if(M){const S=this._createProxiedId(T,M,u[T.key]&&u[T.key][r.id]);d.push(S),this.proxyToSource[T.key][r.id]=[S]}}let g=!1;const x=new Set;for(let b=0;b<o.length;b++){const T=r.getTile(o[b]);if(!T||!T.hasData())continue;const M=this._findTileCoveringTileID(T.tileID,this.proxySourceCache);if(M&&M.tileID.canonical.z!==T.tileID.canonical.z){const S=this.proxyToSource[M.tileID.key][r.id],C=this._createProxiedId(M.tileID,T,u[M.tileID.key]&&u[M.tileID.key][r.id]);S?S.splice(S.length-1,0,C):this.proxyToSource[M.tileID.key][r.id]=[C];const P=this.proxyToSource[M.tileID.key][r.id];x.has(P)||x.add(P),d.push(C),g=!0}}if(this._sourceTilesOverlap[r.id]=g,g&&this._debugParams.sortTilesHiZFirst)for(const b of x)b.sort((T,M)=>
2100M.overscaledZ-T.overscaledZ)}_setupProxiedCoordsForImageSource(r,o,u){if(!r.getSource().loaded())return;const d=this.proxiedCoords[r.id]=[],p=this.proxyCoords,g=r.getSource(),x=g.tileID;if(!x)return;const b=new a.P(x.x,x.y)._div(1<<x.z),T=g.coordinates.map(a.L.fromLngLat).reduce((S,C)=>(S.min.x=Math.min(S.min.x,C.x-b.x),S.min.y=Math.min(S.min.y,C.y-b.y),S.max.x=Math.max(S.max.x,C.x-b.x),S.max.y=Math.max(S.max.y,C.y-b.y),S),{min:new a.P(Number.MAX_VALUE,Number.MAX_VALUE),max:new a.P(-Number.MAX_VALUE,-Number.MAX_VALUE)}),M=(S,C)=>{const P=S.wrap+S.canonical.x/(1<<S.canonical.z),k=S.canonical.y/(1<<S.canonical.z),R=a.V/(1<<S.canonical.z),O=C.wrap+C.canonical.x/(1<<C.canonical.z),D=C.canonical.y/(1<<C.canonical.z);return P+R<O+T.min.x||P>O+T.max.x||k+R<D+T.min.y||k>D+T.max.y};for(let S=0;S<p.length;S++){const C=p[S];for(let P=0;P<o.length;P++){const k=r.getTile(o[P]);if(!k||!k.hasData()||M(C,k.tileID))continue;const R=this._createProxiedId(C,k,u[C.key]&&u[C.key][r.id]),O=this.proxyToSource[C.key][r.id];O?O.push(R):this.proxyToSource[C.key][r.id]=[R],d.push(R)}}}_createProxiedId(r,o,u){let d=this.orthoMatrix;if(u){const p=u.find(g=>g.key===o.tileID.key);if(p)return p}if(o.tileID.key!==r.key){const p=r.canonical.z-o.tileID.canonical.z;let g,x,b;d=a.a6.create();const T=o.tileID.wrap-r.wrap<<r.overscaledZ;p>0?(g=a.V>>p,x=g*((o.tileID.canonical.x<<p)-r.canonical.x+T),b=g*((o.tileID.canonical.y<<p)-r.canonical.y)):(g=a.V<<-p,x=a.V*(o.tileID.canonical.x-(r.canonical.x+T<<-p)),b=a.V*(o.tileID.canonical.y-(r.canonical.y<<-p))),a.a6.ortho(d,0,g,0,g,0,1),a.a6.translate(d,d,[x,b,0])}return new mh(o.tileID,r.key,d)}_findTileCoveringTileID(r,o){let u=o.getTile(r);if(u&&u.hasData())return u;const d=this._findCoveringTileCache[o.id],p=d[r.key];if(u=p?o.getTileByID(p):null,u&&u.hasData()||p===null)return u;let g=u?u.tileID:r,x=g.overscaledZ;const b=o.getSource().minzoom,T=[];if(!p){const S=o.getSource().maxzoom;if(r.canonical.z>=S){const C=r.canonical.z-S;o.getSource().reparseOverscaled?(x=Math.max(r.canonical.z+2,o.transform.tileZoom),g=new a.am(x,r.wrap,S,r.canonical.x>>C,r.canonical.y>>C)):C!==0&&(x=S,g=new a.am(x,r.wrap,S,r.canonical.x>>C,r.canonical.y>>C))}g.key!==r.key&&(T.push(g.key),u=o.getTile(g))}const M=S=>{T.forEach(C=>{d[C]=S}),T.length=0};for(x-=1;x>=b&&(!u||!u.hasData());x--){u&&M(u.tileID.key);const S=g.calculateScaledKey(x);if(u=o.getTileByID(S),u&&u.hasData())break;const C=d[S];if(C===null)break;C===void 0?T.push(S):u=o.getTileByID(C)}return M(u?u.tileID.key:null),u&&u.hasData()?u:null}findDEMTileFor(r){return this.enabled?this._findTileCoveringTileID(r,this.sourceCache):null}prepareDrawTile(){this.renderedToTile=!0}_clearRenderCacheForTile(r,o){let u=this._tilesDirty[r];u||(u=this._tilesDirty[r]={}),u[o.key]=!0}}function Oc(c,r,o){const u=function(x,b,T){const M=a.N.dot(b,x),S=a.N.dot(T,[.2126,.7152,.0722]),C=(k,R,O)=>(1-O)*k+O*R,P=C(1-.3*Math.min(S,1),1,Math.min(M+1,1));return C(.92,1,Math.asin(a.aa(b[2],-1,1))/Math.PI+.5)*P}(c,[0,0,1],r),d=[0,0,0];a.N.scale(d,o.slice(0,3),u);const p=[0,0,0];a.N.scale(p,r.slice(0,3),c[2]);const g=[0,0,0];return a.N.add(g,d,p),a.bU(g)}const Bc=["fill","fillOutline","fillPattern","line","linePattern","background","backgroundPattern","hillshade","raster"],_h=["stars","fillExtrusion","fillExtrusionGroundEffect","model","symbolSDF","symbolIcon","symbolTextAndIcon"];class Fc{static cacheKey(r,o,u,d){let p=`${o}${d?d.cacheKey:""}`;for(const g of u)r.usedDefines.includes(g)&&(p+=`/${g}`);return p}constructor(r,o,u,d,p,g,x){const b=r.gl;this.program=b.createProgram(),this.configuration=d,this.name=o,this.fixedDefines=[...g];const T=d?d.getBinderAttributes():[],M=(u.staticAttributes||[]).concat(T);let S=d?d.defines():[];S=S.concat(g.map(D=>`#define ${D}`));const C=`#version 300 es 2101`;let P=C+S.concat("precision mediump float;",al,Ic.fragmentSource).join(` 2102`);for(const D of u.fragmentIncludes)P+=` 2103${Fr[D]}`;P+=` 2104${u.fragmentSource}`;let k=C+S.concat("precision highp float;",al,Ic.vertexSource).join(` 2105`);for(const D of u.vertexIncludes)k+=` 2106${Fr[D]}`;k+=` 2107${u.vertexSource}`;const R=b.createShader(b.FRAGMENT_SHADER);if(b.isContextLost())return void(this.failedToCreate=!0);b.shaderSource(R,P),b.compileShader(R),b.attachShader(this.program,R);const O=b.createShader(b.VERTEX_SHADER);if(b.isContextLost())this.failedToCreate=!0;else{b.shaderSource(O,k),b.compileShader(O),b.attachShader(this.program,O),this.attributes={},this.numAttributes=M.length;for(let D=0;D<this.numAttributes;
2107D++)if(M[D]){const F=M[D].startsWith("a_")?M[D]:`a_${M[D]}`;b.bindAttribLocation(this.program,D,F),this.attributes[F]=D}x&&x.shaderVaryings.length>0&&b.transformFeedbackVaryings(this.program,x.shaderVaryings,x.bufferMode),b.linkProgram(this.program),b.deleteShader(O),b.deleteShader(R),this.fixedUniforms=p(r),this.binderUniforms=d?d.getUniforms(r):[],g.includes("TERRAIN")&&(this.terrainUniforms=(D=>({u_dem:new a.bO(D),u_dem_prev:new a.bO(D),u_dem_tl:new a.bL(D),u_dem_scale:new a.bN(D),u_dem_tl_prev:new a.bL(D),u_dem_scale_prev:new a.bN(D),u_dem_size:new a.bN(D),u_dem_lerp:new a.bN(D),u_exaggeration:new a.bN(D),u_depth:new a.bO(D),u_depth_size_inv:new a.bL(D),u_meter_to_dem:new a.bN(D),u_label_plane_matrix_inv:new a.bK(D)}))(r)),g.includes("GLOBE")&&(this.globeUniforms=(D=>({u_tile_tl_up:new a.bM(D),u_tile_tr_up:new a.bM(D),u_tile_br_up:new a.bM(D),u_tile_bl_up:new a.bM(D),u_tile_up_scale:new a.bN(D)}))(r)),g.includes("FOG")&&(this.fogUniforms=(D=>({u_fog_matrix:new a.bK(D),u_fog_range:new a.bL(D),u_fog_color:new a.bP(D),u_fog_horizon_blend:new a.bN(D),u_fog_vertical_limit:new a.bL(D),u_fog_temporal_offset:new a.bN(D),u_frustum_tl:new a.bM(D),u_frustum_tr:new a.bM(D),u_frustum_br:new a.bM(D),u_frustum_bl:new a.bM(D),u_globe_pos:new a.bM(D),u_globe_radius:new a.bN(D),u_globe_transition:new a.bN(D),u_is_globe:new a.bO(D),u_viewport:new a.bL(D)}))(r)),g.includes("RENDER_CUTOFF")&&(this.cutoffUniforms=(D=>({u_cutoff_params:new a.bP(D)}))(r)),g.includes("LIGHTING_3D_MODE")&&(this.lightsUniforms=(D=>({u_lighting_ambient_color:new a.bM(D),u_lighting_directional_dir:new a.bM(D),u_lighting_directional_color:new a.bM(D),u_ground_radiance:new a.bM(D)}))(r)),g.includes("RENDER_SHADOWS")&&(this.shadowUniforms=(D=>({u_light_matrix_0:new a.bK(D),u_light_matrix_1:new a.bK(D),u_fade_range:new a.bL(D),u_shadow_normal_offset:new a.bM(D),u_shadow_intensity:new a.bN(D),u_shadow_texel_size:new a.bN(D),u_shadow_map_resolution:new a.bN(D),u_shadow_direction:new a.bM(D),u_shadow_bias:new a.bM(D),u_shadowmap_0:new a.bO(D),u_shadowmap_1:new a.bO(D)}))(r))}}setTerrainUniformValues(r,o){if(!this.terrainUniforms)return;const u=this.terrainUniforms;if(!this.failedToCreate){r.program.set(this.program);for(const d in o)u[d]&&u[d].set(this.program,d,o[d])}}setGlobeUniformValues(r,o){if(!this.globeUniforms)return;const u=this.globeUniforms;if(!this.failedToCreate){r.program.set(this.program);for(const d in o)u[d]&&u[d].set(this.program,d,o[d])}}setFogUniformValues(r,o){if(!this.fogUniforms)return;const u=this.fogUniforms;if(!this.failedToCreate){r.program.set(this.program);for(const d in o)u[d].set(this.program,d,o[d])}}setCutoffUniformValues(r,o){if(!this.cutoffUniforms)return;const u=this.cutoffUniforms;if(!this.failedToCreate){r.program.set(this.program);for(const d in o)u[d].set(this.program,d,o[d])}}setLightsUniformValues(r,o){if(!this.lightsUniforms)return;const u=this.lightsUniforms;if(!this.failedToCreate){r.program.set(this.program);for(const d in o)u[d].set(this.program,d,o[d])}}setShadowUniformValues(r,o){if(this.failedToCreate||!this.shadowUniforms)return;const u=this.shadowUniforms;r.program.set(this.program);for(const d in o)u[d].set(this.program,d,o[d])}_drawDebugWireframe(r,o,u,d,p,g,x,b,T,M){const S=r.options.wireframe;if(S.terrain===!1&&S.layers2D===!1&&S.layers3D===!1)return;const C=r.context;if(!(!(!S.terrain||this.name!=="terrainRaster"&&this.name!=="globeRaster")||!(!S.layers2D||r._terrain&&r._terrain.renderingToTexture||!Bc.includes(this.name))||!(!S.layers3D||!_h.includes(this.name))))return;const P=C.gl,k=r.wireframeDebugCache.getLinesFromTrianglesBuffer(r.frameCounter,p,C);if(!k)return;const R=[...this.fixedDefines];R.push("DEBUG_WIREFRAME");const O=r.getOrCreateProgram(this.name,{config:this.configuration,defines:R});C.program.set(O.program);const D=(V,q,B)=>{if(q[V]&&B[V])for(const $ in q[V])B[V][$]&&B[V][$].set(B.program,$,q[V][$].current)};T&&T.setUniforms(O.program,C,O.binderUniforms,x,{zoom:b}),D("fixedUniforms",this,O),D("terrainUniforms",this,O),D("globeUniforms",this,O),D("fogUniforms",this,O),D("lightsUniforms",this,O),D("shadowUniforms",this,O),k.bind(),C.setColorMode(new Rt([P.ONE,P.ONE_MINUS_SRC_ALPHA,P.ZERO,P.ONE],a.ax.transparent,[!0,!0,!0,!1])),C.setDepthMode(new dt(o.func===P.LESS?P.LEQUAL:o.func,dt.ReadOnly,o.range)),C.setStencilMode(yt.disabled);const F=3*g.primitiveLength*2,Z=3*g.primitiveOffset*2*2;M&&M>1?P.drawElementsInstanced(P.LINES,F,P.UNSIGNED_SHORT,Z,M):P.drawElements(P.LINES,F,P.UNSIGNED_SHORT,Z),p.bind(),C.program.set(this.program),C.setDepthMode(o),C.setStencilMode(u),C.setColorMode(d)}draw(r,o,u,d,p,g,x,b,T,M,S,C,P,k,R,O,D){const F=r.context,Z=F.gl;if(this.failedToCreate)return;F.program.set(this.program),F.setDepthMode(u),F.setStencilMode(d),F.setColorMode(p),F.setCullFace(g);for(const $ of Object.keys(this.fixedUniforms))this.fixedUniforms[$].set(this.program,$,x[$]);k&&k.setUniforms(this.program,F,this.binderUniforms,C,{zoom:P});const V={[Z.POINTS]:1,[Z.LINES]:2,[Z.TRIANGLES]:3,[Z.LINE_STRIP]:1}[o],q=D&&D.length>0;if(q){for(const $ of D)Z.bindBufferBase(Z.TRANSFORM_FEEDBACK_BUFFER,$.targetIndex,$.buffer.buffer);Z.beginTransformFeedback(o)}const B=O&&O>0?1:void 0;for(const $ of S.get()){const Y=$.vaos||($.vaos={});(Y[b]||(Y[b]=new Pc)).bind(F,this,T,k?k.getPaintVertexBuffers():[],M,$.vertexOffset,R||[],B),O&&O>1?Z.drawElementsInstanced(o,$.primitiveLength*V,Z.UNSIGNED_SHORT,$.primitiveOffset*V*2,O):M?Z.drawElements(o,$.primitiveLength*V,Z.UNSIGNED_SHORT,$.primitiveOffset*V*2):Z.drawArrays(o,$.vertexOffset,$.vertexLength),o===
2107Z.TRIANGLES&&M&&this._drawDebugWireframe(r,u,d,p,M,$,C,P,k,O)}q&&Z.endTransformFeedback()}}function Nc(c,r){const o=Math.pow(2,r.tileID.overscaledZ),u=r.tileSize*Math.pow(2,c.transform.tileZoom)/o,d=u*(r.tileID.canonical.x+r.tileID.wrap*o),p=u*r.tileID.canonical.y;return{u_image:0,u_texsize:r.imageAtlasTexture?r.imageAtlasTexture.size:[0,0],u_tile_units_to_pixels:1/a.a3(r,1,c.transform.tileZoom),u_pixel_coord_upper:[d>>16,p>>16],u_pixel_coord_lower:[65535&d,65535&p]}}const gh=a.a6.create(),Vc=(c,r,o,u,d,p,g,x,b,T,M,S,C,P,k,R)=>{const O=r.style.light,D=O.properties.get("position"),F=[D.x,D.y,D.z],Z=a.co.create();O.properties.get("anchor")==="viewport"&&(a.co.fromRotation(Z,-r.transform.angle),a.N.transformMat3(F,F,Z));const V=O.properties.get("color"),q=r.transform,B={u_matrix:c,u_lightpos:F,u_lightintensity:O.properties.get("intensity"),u_lightcolor:[V.r,V.g,V.b],u_vertical_gradient:+o,u_opacity:u,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:gh,u_merc_center:[0,0],u_up_dir:[0,0,0],u_height_lift:0,u_ao:d,u_edge_radius:p,u_flood_light_color:S,u_vertical_scale:C,u_flood_light_intensity:P,u_ground_shadow_factor:k,u_emissive_strength:R};return q.projection.name==="globe"&&(B.u_tile_id=[g.canonical.x,g.canonical.y,1<<g.canonical.z],B.u_zoom_transition=b,B.u_inv_rot_matrix=M,B.u_merc_center=T,B.u_up_dir=q.projection.upVector(new a.bs(0,0,0),T[0]*a.V,T[1]*a.V),B.u_height_lift=x),B},Uc=(c,r,o)=>({u_matrix:c,u_edge_radius:r,u_vertical_scale:o}),Bo=(c,r,o,u,d,p,g,x,b,T,M,S,C,P)=>{const k=Vc(c,r,o,u,d,p,g,b,T,M,S,C,P,1,[0,0,0],0),R={u_height_factor:-Math.pow(2,g.overscaledZ)/x.tileSize/8};return a.e(k,Nc(r,x),R)},ws=(c,r)=>({u_matrix:c,u_emissive_strength:r}),jc=(c,r,o,u)=>a.e(ws(c,r),Nc(o,u)),Fo=(c,r,o)=>({u_matrix:c,u_world:o,u_emissive_strength:r}),yh=(c,r,o,u,d)=>a.e(jc(c,r,o,u),{u_world:d}),ul=(c,r,o,u)=>{const d=a.V/o.tileSize;return{u_matrix:c,u_camera_to_center_distance:r.getCameraToCenterDistance(u),u_extrude_scale:[r.pixelsToGLUnits[0]/d,r.pixelsToGLUnits[1]/d]}},Gc=(c,r,o=1)=>({u_matrix:c,u_color:r,u_overlay:0,u_overlay_scale:o}),xh=a.a6.create(),Zc=(c,r,o,u,d,p,g)=>{const x=c.transform,b=x.projection.name==="globe",T=b?a.cp(x.zoom,r.canonical)*x._pixelsPerMercatorPixel:a.a3(o,1,p),M={u_matrix:r.projMatrix,u_extrude_scale:T,u_intensity:g,u_inv_rot_matrix:xh,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0]};if(b){M.u_inv_rot_matrix=u,M.u_merc_center=d,M.u_tile_id=[r.canonical.x,r.canonical.y,1<<r.canonical.z],M.u_zoom_transition=a.S(x.zoom);const S=d[0]*a.V,C=d[1]*a.V;M.u_up_dir=x.projection.upVector(new a.bs(0,0,0),S,C)}return M};function hl(c,[r,o,u,d],[p,g]){if(p===g)return[0,0,0,0];const x=255*(c-1)/(c*(g-p));return[r*x,o*x,u*x,d*x]}function vh(c,r,[o,u]){return o===u?0:.5/c+(r-o)*(c-1)/(c*(u-o))}const qc=(c,r,o,u,d,p,g,x,b,T,M,S,C,P,k,R,O,D,F,Z,V)=>{return{u_matrix:c,u_normalize_matrix:r,u_globe_matrix:o,u_merc_matrix:u,u_grid_matrix:d,u_tl_parent:p,u_scale_parent:T,u_fade_t:M.mix,u_opacity:M.opacity*S.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:S.paint.get("raster-brightness-min"),u_brightness_high:S.paint.get("raster-brightness-max"),u_saturation_factor:(B=S.paint.get("raster-saturation"),B>0?1-1/(1.001-B):-B),u_contrast_factor:(q=S.paint.get("raster-contrast"),q>0?1/(1-q):1+q),u_spin_weights:sa(S.paint.get("raster-hue-rotate")),u_perspective_transform:C,u_raster_elevation:P,u_zoom_transition:g,u_merc_center:x,u_cutoff_params:b,u_colorization_mix:hl(a.cq,R,D),u_colorization_offset:vh(a.cq,O,D),u_color_ramp:k,u_texture_offset:[Z/(F+2*Z),F/(F+2*Z)],u_texture_res:[F+2*Z,F+2*Z],u_emissive_strength:V};var q,B};function sa(c){c*=Math.PI/180;const r=Math.sin(c),o=Math.cos(c);return[(2*o+1)/3,(-Math.sqrt(3)*r-o+1)/3,(Math.sqrt(3)*r-o+1)/3]}const af=(c,r,o,u,d,p,g,x,b,T,M,S)=>({u_matrix:c,u_normalize_matrix:r,u_globe_matrix:o,u_merc_matrix:u,u_grid_matrix:d,u_tl_parent:p,u_scale_parent:T,u_fade_t:M.mix,u_opacity:M.opacity,u_image0:0,u_image1:1,u_raster_elevation:S,u_zoom_transition:g,u_merc_center:x,u_cutoff_params:b}),lf=(c,r,o,u,d,p,g,x)=>({u_tile_offset:c,u_velocity:r,u_color_ramp:u,u_velocity_res:o,u_max_speed:d,u_texture_offset:p,u_data_scale:g,u_data_offset:x}),bh=(c,r,o,u,d,p,g,x)=>({u_velocity:c,u_velocity_res:r,u_max_speed:o,u_speed_factor:u,u_lifetime_delta:d,u_rand_seed:Math.random(),u_texture_offset:p,u_data_scale:g,u_data_offset:x}),wh=a.a6.create(),dl=(c,r,o,u,d,p,g,x,b,T,M,S,C,P,k,R,O,D)=>{const F=d.transform,Z={u_is_size_zoom_constant:+(c==="constant"||c==="source"),u_is_size_feature_constant:+(c==="constant"||c==="camera"),u_size_t:r?r.uSizeT:0,u_size:r?r.uSize:0,u_camera_to_center_distance:F.getCameraToCenterDistance(R),u_rotate_symbol:+o,u_aspect_ratio:F.width/F.height,u_fade_change:d.options.fadeDuration?d.symbolFadeChange:1,u_matrix:p,u_label_plane_matrix:g,u_coord_matrix:x,u_is_text:+b,u_pitch_with_map:+u,u_texsize:T,u_texture:0,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:wh,u_merc_center:[0,0],u_camera_forward:[0,0,0],u_ecef_origin:[0,0,0],u_tile_matrix:wh,u_up_vector:[0,-1,0],u_icon_transition:D||0,u_icon_saturation:O};return R.name==="globe"&&(Z.u_tile_id=[M.canonical.x,M.canonical.y,1<<M.canonical.z],Z.u_zoom_transition=S,Z.u_inv_rot_matrix=P,Z.u_merc_center=C,Z.u_c
2107amera_forward=F._camera.forward(),Z.u_ecef_origin=a.cr(F.globeMatrix,M.toUnwrapped()),Z.u_tile_matrix=Float32Array.from(F.globeMatrix),Z.u_up_vector=k),Z},aa=(c,r,o,u,d,p,g,x,b,T,M,S,C,P,k,R,O)=>a.e(dl(c,r,o,u,d,p,g,x,b,T,S,C,P,k,R,O,1),{u_gamma_scale:u?d.transform.getCameraToCenterDistance(O)*Math.cos(d.terrain?0:d.transform._pitch):1,u_device_pixel_ratio:a.f.devicePixelRatio,u_is_halo:+M,undefined:void 0}),fl=(c,r,o,u,d,p,g,x,b,T,M,S,C,P,k,R)=>a.e(aa(c,r,o,u,d,p,g,x,!0,b,!0,M,S,C,P,k,R),{u_texsize_icon:T,u_texture_icon:1}),$c=(c,r,o,u)=>({u_matrix:c,u_emissive_strength:r,u_opacity:o,u_color:u}),la=(c,r,o,u,d,p,g)=>a.e(function(x,b,T,M){const S=T.imageManager.getPattern(x.toString(),b),{width:C,height:P}=T.imageManager.getPixelSize(b),k=Math.pow(2,M.tileID.overscaledZ),R=M.tileSize*Math.pow(2,T.transform.tileZoom)/k,O=R*(M.tileID.canonical.x+M.tileID.wrap*k),D=R*M.tileID.canonical.y;return{u_image:0,u_pattern_tl:S.tl,u_pattern_br:S.br,u_texsize:[C,P],u_pattern_size:S.displaySize,u_tile_units_to_pixels:1/a.a3(M,1,T.transform.tileZoom),u_pixel_coord_upper:[O>>16,D>>16],u_pixel_coord_lower:[65535&O,65535&D]}}(d,p,u,g),{u_matrix:c,u_emissive_strength:r,u_opacity:o}),pl=(c,r,o,u,d,p,g,x,b,T,M,S,C=[0,0,0],P)=>{const k=u.style.light,R=k.properties.get("position"),O=[-R.x,-R.y,R.z],D=a.co.create();k.properties.get("anchor")==="viewport"&&(a.co.fromRotation(D,-u.transform.angle),a.N.transformMat3(O,O,D));const F=T.alphaMode==="MASK",Z=k.properties.get("color"),V=S.paint.get("model-ambient-occlusion-intensity"),q=S.paint.get("model-color").constantOr(a.ax.white),B=S.paint.get("model-color-mix-intensity").constantOr(0);return{u_matrix:c,u_lighting_matrix:r,u_normal_matrix:o,u_lightpos:O,u_lightintensity:k.properties.get("intensity"),u_lightcolor:[Z.r,Z.g,Z.b],u_camera_pos:C,u_opacity:d,u_baseTextureIsAlpha:0,u_alphaMask:+F,u_alphaCutoff:T.alphaCutoff,u_baseColorFactor:[p.r,p.g,p.b,p.a],u_emissiveFactor:[g[0],g[1],g[2],1],u_metallicFactor:x,u_roughnessFactor:b,u_baseColorTexture:cr.BaseColor,u_metallicRoughnessTexture:cr.MetallicRoughness,u_normalTexture:cr.Normal,u_occlusionTexture:cr.Occlusion,u_emissionTexture:cr.Emission,u_color_mix:[q.r,q.g,q.b,B],u_aoIntensity:V,u_emissive_strength:M,u_occlusionTextureTransform:P||[0,0,0,0]}},ca=new Float32Array(16),ua=(c,r=ca,o=ca)=>({u_matrix:c,u_instance:r,u_node_matrix:o}),cf={fillExtrusion:c=>({u_matrix:new a.bK(c),u_lightpos:new a.bM(c),u_lightintensity:new a.bN(c),u_lightcolor:new a.bM(c),u_vertical_gradient:new a.bN(c),u_opacity:new a.bN(c),u_edge_radius:new a.bN(c),u_ao:new a.bL(c),u_tile_id:new a.bM(c),u_zoom_transition:new a.bN(c),u_inv_rot_matrix:new a.bK(c),u_merc_center:new a.bL(c),u_up_dir:new a.bM(c),u_height_lift:new a.bN(c),u_flood_light_color:new a.bM(c),u_vertical_scale:new a.bN(c),u_flood_light_intensity:new a.bN(c),u_ground_shadow_factor:new a.bM(c),u_emissive_strength:new a.bN(c)}),fillExtrusionDepth:c=>({u_matrix:new a.bK(c),u_edge_radius:new a.bN(c),u_vertical_scale:new a.bN(c)}),fillExtrusionPattern:c=>({u_matrix:new a.bK(c),u_lightpos:new a.bM(c),u_lightintensity:new a.bN(c),u_lightcolor:new a.bM(c),u_vertical_gradient:new a.bN(c),u_height_factor:new a.bN(c),u_edge_radius:new a.bN(c),u_ao:new a.bL(c),u_tile_id:new a.bM(c),u_zoom_transition:new a.bN(c),u_inv_rot_matrix:new a.bK(c),u_merc_center:new a.bL(c),u_up_dir:new a.bM(c),u_height_lift:new a.bN(c),u_image:new a.bO(c),u_texsize:new a.bL(c),u_pixel_coord_upper:new a.bL(c),u_pixel_coord_lower:new a.bL(c),u_tile_units_to_pixels:new a.bN(c),u_opacity:new a.bN(c)}),fillExtrusionGroundEffect:c=>({u_matrix:new a.bK(c),u_opacity:new a.bN(c),u_ao_pass:new a.bN(c),u_meter_to_tile:new a.bN(c),u_ao:new a.bL(c),u_flood_light_intensity:new a.bN(c),u_flood_light_color:new a.bM(c),u_attenuation:new a.bN(c),u_edge_radius:new a.bN(c),u_fb:new a.bO(c),u_fb_size:new a.bN(c)}),fill:c=>({u_matrix:new a.bK(c),u_emissive_strength:new a.bN(c)}),fillPattern:c=>({u_matrix:new a.bK(c),u_emissive_strength:new a.bN(c),u_image:new a.bO(c),u_texsize:new a.bL(c),u_pixel_coord_upper:new a.bL(c),u_pixel_coord_lower:new a.bL(c),u_tile_units_to_pixels:new a.bN(c)}),fillOutline:c=>({u_matrix:new a.bK(c),u_emissive_strength:new a.bN(c),u_world:new a.bL(c)}),fillOutlinePattern:c=>({u_matrix:new a.bK(c),u_emissive_strength:new a.bN(c),u_world:new a.bL(c),u_image:new a.bO(c),u_texsize:new a.bL(c),u_pixel_coord_upper:new a.bL(c),u_pixel_coord_lower:new a.bL(c),u_tile_units_to_pixels:new a.bN(c)}),circle:a.cs,collisionBox:c=>({u_matrix:new a.bK(c),u_camera_to_center_distance:new a.bN(c),u_extrude_scale:new a.bL(c)}),collisionCircle:c=>({u_matrix:new a.bK(c),u_inv_matrix:new a.bK(c),u_camera_to_center_distance:new a.bN(c),u_viewport_size:new a.bL(c)}),debug:c=>({u_color:new a.ca(c),u_matrix:new a.bK(c),u_overlay:new a.bO(c),u_overlay_scale:new a.bN(c)}),clippingMask:c=>({u_matrix:new a.bK(c)}),heatmap:c=>({u_extrude_scale:new a.bN(c),u_intensity:new a.bN(c),u_matrix:new a.bK(c),u_inv_rot_matrix:new a.bK(c),u_merc_center:new a.bL(c),u_tile_id:new a.bM(c),u_zoom_transition:new a.bN(c),u_up_dir:new a.bM(c)}),heatmapTexture:c=>({u_image:new a.bO(c),u_color_ramp:new a.bO(c),u_opacity:new a.bN(c)}),hillshade:c=>({u_matrix:new a.bK(c),u_image:new a.bO(c),u_latrange:new a.bL(c),u_light:new a.bL(c),u_shadow:new a.ca(c),u_highlight:new a.ca(c),u_emissive_strength:new a.bN(c),u_accent:new a.ca(c)}),hillshadePrepare:c=>({u_matrix:new a.bK(c),u_image:new a.bO(c),u_dimension:new a.bL(c),u_zoom:new a.bN(c)}),line:a.ct,linePattern:a.cu,raster:c=>({u_matrix:new a.bK(c),u_normalize_matrix:new a.bK(c),u_globe_matrix:new a.bK(c),u_merc_matrix:new a.bK(c),u_grid_matrix:new a.cb(c),u_tl_parent:new a.bL(c),u_scale_parent:new a.bN(c),u_fade_t:new a.bN(c),u_opacity:new a.bN(c),u_image0:new a.bO(c),u_image1:new a.bO(c),u_brightness_low:new a.bN(c),u_brightness_high:new a.bN(c),u_saturation_factor:new a.bN(c),u_contrast_factor:new a.bN(c),u_spin_weights:new a.bM(c),u_perspective_transform:new a.bL(c),u_raster_elevation:new a.bN(c),u_zoom_transition:new a.bN(c),u_merc_center:new a.bL(c),u_cutoff_params:new a.bP(c),u_colorization_mix:new a.bP(c),u_colorization_offset:new a.bN(c),u_color_ramp:new a.bO(c),u_texture_offset:new a.bL(c),u_texture_res:new a.bL(c),u_emissive_strength:new a.bN(c)}),rasterParticle:c=>({u_matrix:new a.bK(c),u_normalize_matrix:new a.bK(c),u_globe_matrix:new a.bK(c),u_merc_matrix:new a.bK(c),u_grid_matrix:new a.cb(c),u_tl_parent:new a.bL(c),u_scale_parent:new a.bN(c),u_fade_t:new a.bN(c),u_opacity:new a.bN(c),u_image0:new a.bO(c),u_image1:new a.bO(c),u_raster_elevation:new a.bN(c),u_zoom_transition:new a.bN(c),u_merc_center:new a.bL(c),u_cutoff_params:new a.bP(c)}),rasterParticleTexture:c=>({u_texture:new a.bO(c),u_opacity:new a.bN(c)}),rasterParticleDraw:c=>({u_tile_offset:new a.bL(c),u_velocity:new a.bO(c),u_color_ramp:new a.bO(c),u_velocity_res:new a.bL(c),u_max_speed:new a.bN(c),u_texture_offset:new a.bL(c),u_data_scale:new a.bP(c),u_data_offset:new a.bN(c)}),rasterParticleUpdate:c=>({u_velocity:new a.bO(c),u_velocity_res:new a.bL(c),u_max_speed:new a.bN(c),u_speed_factor:new a.bN(c),u_lifetime_delta:new a.bN(c),u_rand_seed:new a.bN(c),u_texture_offset:new a.bL(c),u_data_scale:new a.bP(c),u_data_offset:new a.bN(c)}),symbolIcon:c=>({u_is_size_zoom_constant:new a.bO(c),u_is_size_feature_constant:new a.bO(c),u_size_t:new a.bN(c),u_size:new a.bN(c),u_camera_to_center_distance:new a.bN(c),u_rotate_symbol:new a.bO(c),u_aspect_ratio:new a.bN(c),u_fade_change:new a.bN(c),u_matrix:new a.bK(c),u_label_plane_matrix:new a.bK(c),u_coord_matrix:new a.bK(c),u_is_text:new a.bO(c),u_pitch_with_map:new a.bO(c),u_texsize:new a.bL(c),u_tile_id:new a.bM(c),u_zoom_transition:new a.bN(c),u_inv_rot_matrix:new a.bK(c),u_merc_center:new a.bL(c),u_camera_forward:new a.bM(c),u_tile_matrix:new a.bK(c),u_up_vector:new a.bM(c),u_ecef_origin:new a.bM(c),u_texture:new a.bO(c),u_icon_transition:new a.bN(c),u_icon_saturation:new a.bN(c)}),symbolSDF:c=>({u_is_size_zoom_constant:new a.bO(c),u_is_size_feature_constant:new a.bO(c),u_size_t:new a.bN(c),u_size:new a.bN(c),u_camera_to_center_distance:new a.bN(c),u_rotate_symbol:new a.bO(c),u_aspect_ratio:new a.bN(c),u_fade_change:new a.bN(c),u_matrix:new a.bK(c),u_label_plane_matrix:new a.bK(c),u_coord_matrix:new a.bK(c),u_is_text:new a.bO(c),u_pitch_with_map:new a.bO(c),u_texsize:new a.bL(c),u_texture:new a.bO(c),u_gamma_scale:new a.bN(c),u_device_pixel_ratio:new a.bN(c),u_tile_id:new a.bM(c),u_zoom_transition:new a.bN(c),u_inv_rot_matrix:new a.bK(c),u_merc_center:new a.bL(c),u_camera_forward:new a.bM(c),u_tile_matrix:new a.bK(c),u_up_vector:new a.bM(c),u_ecef_origin:new a.bM(c),u_is_halo:new a.bO(c)}),symbolTextAndIcon:c=>({u_is_size_zoom_constant:new a.bO(c),u_is_size_feature_constant:new a.bO(c),u_size_t:new a.bN(c),u_size:new a.bN(c),u_camera_to_center_distance:new a.bN(c),u_rotate_symbol:new a.bO(c),u_aspect_ratio:new a.bN(c),u_fade_change:new a.bN(c),u_matrix:new a.bK(c),u_label_plane_matrix:new a.bK(c),u_coord_matrix:new a.bK(c),u_is_text:new a.bO(c),u_pitch_with_map:new a.bO(c),u_texsize:new a.bL(c),u_texsize_icon:new a.bL(c),u_texture:new a.bO(c),u_texture_icon:new a.bO(c),u_gamma_scale:new a.bN(c),u_device_pixel_ratio:new a.bN(c),u_is_halo:new a.bO(c)}),background:c=>({u_matrix:new a.bK(c),u_emissive_strength:new a.bN(c),u_opacity:new a.bN(c),u_color:new a.ca(c)}),backgroundPattern:c=>({u_matrix:new a.bK(c),u_emissive_strength:new a.bN(c),u_opacity:new a.bN(c),u_image:new a.bO(c),u_pattern_tl:new a.bL(c),u_pattern_br:new a.bL(c),u_texsize:new a.bL(c),u_pattern_size:new a.bL(c),u_pixel_coord_upper:new a.bL(c),u_pixel_coord_lower:new a.bL(c),u_tile_units_to_pixels:new a.bN(c)}),terrainRaster:fh,terrainDepth:fh,skybox:c=>({u_matrix:new a.bK(c),u_sun_direction:new a.bM(c),u_cubemap:new a.bO(c),u_opacity:new a.bN(c),u_temporal_offset:new a.bN(c)}),skyboxGradient:c=>({u_matrix:new a.bK(c),u_color_ramp:new a.bO(c),u_center_direction:new a.bM(c),u_radius:new a.bN(c),u_opacity:new a.bN(c),u_temporal_offset:new a.bN(c)}),skyboxCapture:c=>({u_matrix_3f:new a.cb(c),u_sun_direction:new a.bM(c),u_sun_intensity:new a.bN(c),u_color_tint_r:new a.bP(c),u_color_tint_m:new a.bP(c),u_luminance:new a.bN(c)}),globeRaster:c=>({u_proj_matrix:new a.bK(c),u_globe_matrix:new a.bK(c),u_normalize_matrix:new a.bK(c),u_merc_matrix:new a.bK(c),u_zoom_transition:new a.bN(c),u_merc_center:new a.bL(c),u_image0:new a.bO(c),u_grid_matrix:new a.cb(c),u_skirt_height:new a.bN(c),u_far_z_cutoff:new a.bN(c),u_frustum_tl:new a.bM(c),u_frustum_tr:new a.bM(c),u_frustum_br:new a.bM(c),u_frustum_bl:new a.bM(c),u_globe_pos:new a.bM(c),u_globe_radius:new a.bN(c),u_viewport:new a.bL(c)}),globeAtmosphere:c=>({u_frustum_tl:new a.bM(c),u_frustum_tr:new a.bM(c),u_frustum_br:new a.bM(c),u_frustum_bl:new a.bM(c),u_horizon:new a.bN(c),u_transition:new a.bN(c),u_fadeout_range:new a.bN(c),u_color:new a.bP(c),u_high_color:new a.bP(c),u_space_color:new a.bP(c),u_temporal_offset:new a.bN(c),u_horizon_angle:new a.bN(c)}),model:c=>({u_matrix:new a.bK(c),u_lighting_matrix:new a.bK(c),u_normal_matrix:new a.bK(c),u_lightpos:new a.bM(c),u_lightintensity:new a.bN(c),u_lightcolor:new a.bM(c),u_camera_pos:new a.bM(c),u_opacity:new a.bN(c),u_baseColorFactor:new a.bP(c),u_emissiveFactor:new a.bP(c),u_metallicFactor:new a.bN(c),u_roughnessFactor:new a.bN(c),u_baseTextureIsAlpha:new a.bO(c),u_alph
2107aMask:new a.bO(c),u_alphaCutoff:new a.bN(c),u_baseColorTexture:new a.bO(c),u_metallicRoughnessTexture:new a.bO(c),u_normalTexture:new a.bO(c),u_occlusionTexture:new a.bO(c),u_emissionTexture:new a.bO(c),u_color_mix:new a.bP(c),u_aoIntensity:new a.bN(c),u_emissive_strength:new a.bN(c),u_occlusionTextureTransform:new a.bP(c)}),modelDepth:c=>({u_matrix:new a.bK(c),u_instance:new a.bK(c),u_node_matrix:new a.bK(c)}),groundShadow:c=>({u_matrix:new a.bK(c),u_ground_shadow_factor:new a.bM(c)}),stars:c=>({u_matrix:new a.bK(c),u_up:new a.bM(c),u_right:new a.bM(c),u_intensity_multiplier:new a.bN(c)})};let an;function ln(c,r,o,u,d,p,g){const x=c.context,b=x.gl,T=c.transform,M=c.getOrCreateProgram("collisionBox"),S=[];let C=0,P=0;for(let V=0;V<u.length;V++){const q=u[V],B=r.getTile(q),$=B.getBucket(o);if(!$)continue;const Y=fc(q,$,T);let K=Y;d[0]===0&&d[1]===0||(K=c.translatePosMatrix(Y,B,d,p));const ee=g?$.textCollisionBox:$.iconCollisionBox,ce=$.collisionCircleArray;if(ce.length>0){const re=a.a6.create(),me=K;a.a6.mul(re,$.placementInvProjMatrix,T.glCoordMatrix),a.a6.mul(re,re,$.placementViewportMatrix),S.push({circleArray:ce,circleOffset:P,transform:me,invTransform:re,projection:$.getProjection()}),C+=ce.length/4,P=C}ee&&(c.terrain&&c.terrain.setupElevationDraw(B,M),M.draw(c,b.LINES,dt.disabled,yt.disabled,c.colorModeForRenderPass(),ft.disabled,ul(K,T,B,$.getProjection()),o.id,ee.layoutVertexBuffer,ee.indexBuffer,ee.segments,null,T.zoom,null,[ee.collisionVertexBuffer,ee.collisionVertexBufferExt]))}if(!g||!S.length)return;const k=c.getOrCreateProgram("collisionCircle"),R=new a.cv;R.resize(4*C),R._trim();let O=0;for(const V of S)for(let q=0;q<V.circleArray.length/4;q++){const B=4*q,$=V.circleArray[B+0],Y=V.circleArray[B+1],K=V.circleArray[B+2],ee=V.circleArray[B+3];R.emplace(O++,$,Y,K,ee,0),R.emplace(O++,$,Y,K,ee,1),R.emplace(O++,$,Y,K,ee,2),R.emplace(O++,$,Y,K,ee,3)}(!an||an.length<2*C)&&(an=function(V){const q=2*V,B=new a.aw;B.resize(q),B._trim();for(let $=0;$<q;$++){const Y=6*$;B.uint16[Y+0]=4*$+0,B.uint16[Y+1]=4*$+1,B.uint16[Y+2]=4*$+2,B.uint16[Y+3]=4*$+2,B.uint16[Y+4]=4*$+3,B.uint16[Y+5]=4*$+0}return B}(C));const D=x.createIndexBuffer(an,!0),F=x.createVertexBuffer(R,a.cw.members,!0);for(const V of S){const q={u_matrix:V.transform,u_inv_matrix:V.invTransform,u_camera_to_center_distance:(Z=T).getCameraToCenterDistance(V.projection),u_viewport_size:[Z.width,Z.height]};k.draw(c,b.TRIANGLES,dt.disabled,yt.disabled,c.colorModeForRenderPass(),ft.disabled,q,o.id,F,D,a.aB.simpleSegment(0,2*V.circleOffset,V.circleArray.length,V.circleArray.length/2),null,T.zoom)}var Z;F.destroy(),D.destroy()}const Dn=a.a6.create();function ha(c){const r=c._camera.getWorldToCamera(c.worldSize,1),o=a.a6.multiply([],r,c.globeMatrix);a.a6.invert(o,o);const u=[0,0,0],d=[0,1,0,0];return a.a7.transformMat4(d,d,o),u[0]=d[0],u[1]=d[1],u[2]=d[2],a.N.normalize(u,u),u}function Ke({width:c,height:r,anchor:o,textOffset:u,textScale:d},p){const{horizontalAlign:g,verticalAlign:x}=a.bf(o),b=-(g-.5)*c,T=-(x-.5)*r,M=a.bd(o,u);return new a.P((b/d+M[0])*p,(T/d+M[1])*p)}function Th(c,r,o,u,d,p,g,x,b,T,M){const S=c.text.placedSymbolArray,C=c.text.dynamicLayoutVertexArray,P=c.icon.dynamicLayoutVertexArray,k={},R=c.getProjection(),O=Ks(x,R,p),D=p.elevation,F=R.upVectorScale(x.canonical,p.center.lat,p.worldSize).metersToTile;C.clear();for(let Z=0;Z<S.length;Z++){const V=S.get(Z),{tileAnchorX:q,tileAnchorY:B,numGlyphs:$}=V,Y=V.hidden||!V.crossTileID||c.allowVerticalPlacement&&!V.placedOrientation?null:u[V.crossTileID];if(Y){let K=0,ee=0,ce=0;if(D){const Ie=D?D.getAtTileOffset(x,q,B):0,[Re,Le,je]=R.upVector(x.canonical,q,B);K=Ie*Re*F,ee=Ie*Le*F,ce=Ie*je*F}let[re,me,fe,Ae]=Wr(V.projectedAnchorX+K,V.projectedAnchorY+ee,V.projectedAnchorZ+ce,o?O:g);const ne=ih(p.getCameraToCenterDistance(R),Ae);let he=d.evaluateSizeForFeature(c.textSizeData,T,V)*ne/a.bc;o&&(he*=c.tilePixelRatio/b);const Q=Ke(Y,he);o?({x:re,y:me,z:fe}=R.projectTilePoint(q+Q.x,B+Q.y,x.canonical),[re,me,fe]=Wr(re+K,me+ee,fe+ce,g)):(r&&Q._rotate(-p.angle),re+=Q.x,me+=Q.y,fe=0);const ae=c.allowVerticalPlacement&&V.placedOrientation===a.b6.vertical?Math.PI/2:0;for(let Ie=0;Ie<$;Ie++)a.b9(C,re,me,fe,ae);M&&V.associatedIconIndex>=0&&(k[V.associatedIconIndex]={x:re,y:me,z:fe,angle:ae})}else io($,C)}if(M){P.clear();const Z=c.icon.placedSymbolArray;for(let V=0;V<Z.length;V++){const q=Z.get(V),{numGlyphs:B}=q,$=k[V];if(q.hidden||!$)io(B,P);else{const{x:Y,y:K,z:ee,angle:ce}=$;for(let re=0;re<B;re++)a.b9(P,Y,K,ee,ce)}}c.icon.dynamicLayoutVertexBuffer.updateData(P)}c.text.dynamicLayoutVertexBuffer.updateData(C)}function ml(c,r,o,u,d,p,g={}){const x=o.paint.get("icon-translate"),b=o.paint.get("text-translate"),T=o.paint.get("icon-translate-anchor"),M=o.paint.get("text-translate-anchor"),S=o.layout.get("icon-rotation-alignment"),C=o.layout.get("text-rotation-alignment"),P=o.layout.get("icon-pitch-alignment"),k=o.layout.get("text-pitch-alignment"),R=o.layout.get("icon-keep-upright"),O=o.layout.get("text-keep-upright"),D=o.paint.get("icon-color-saturation"),F=c.context,Z=F.gl,V=c.transform,q=S==="map",B=C==="map",$=P==="map",Y=k==="map",K=o.layout.get("symbol-sort-key").constantOr(1)!==void 0;let ee=!1;const ce=c.depthModeForSublayer(0,dt.ReadOnly),re=[a.a5(V.center.lng),a.ae(V.center.lat)],me=o.layout.get("text-variable-anchor"),fe=V.projection.name==="globe",Ae=[],ne=[0,-1,0];for(const he of u){const Q=r.getTile(he),ae=Q.getBucket(o);if(!ae||ae.projection.name==="mercator"&&fe||ae.fullyClipped)continue;const Ie=ae.projection.name==="globe",Re=Ie?a.S(V.zoom):0,Le=Ks(he,ae.getProjection(),V),je=V.calculatePixelsToTileUnitsMatrix(Q),et=me&&ae.hasTextData(),ct=ae.hasIconTextFit()&&et&&ae.hasIconData(),nt=ae.getProjection().createInversionMatrix(V,he.canonical),at=()=>{const Pi=q&&o.layout.get("symbol-placement")!=="point",Bt=[],Kt=Pi||ct,Ft=o.paint.get("icon-image-cross-fade").constantOr(0);c.terrainRenderModeElevated()&&$&&Bt.push("PITCH_WITH_MAP_TERRAIN"),Ie&&(Bt.push("PROJECTION_GLOBE_VIEW"),Kt&&Bt.push("PROJECTED_POS_ON_VIEWPORT")),Ft>0&&Bt.push("ICON_TRANSITION"),ae.icon.zOffsetVertexBuffer&&Bt.push("Z_OFFSET"),D<1&&Bt.push("SATURATION");const Yt=ae.icon.programConfigurations.get(o.id),xi=c.getOrCreateProgram(ae.sdfIcons?"symbolSDF":"symbolIcon",{config:Yt,defines:Bt});let ii;
2107const Qi=Q.imageAtlasTexture?Q.imageAtlasTexture.size:[0,0],ur=ae.iconSizeData,Pr=a.b5(ur,V.zoom),bn=$||V.pitch!==0,zr=Xs(Le,Q.tileID.canonical,$,q,V,ae.getProjection(),je),er=sc(Le,Q.tileID.canonical,$,q,V,ae.getProjection(),je),Hi=c.translatePosMatrix(er,Q,x,T,!0),yr=c.translatePosMatrix(Le,Q,x,T),Tr=Kt?Dn:zr,Dr=q&&!$&&!Pi;let wn=ne;!fe&&!V.mercatorFromTransition||q||(wn=ha(V));const _o=Ie?wn:ne;ii=ae.sdfIcons&&!ae.iconsInText?aa(ur.kind,Pr,Dr,$,c,yr,Tr,Hi,!1,Qi,!0,he,Re,re,nt,_o,ae.getProjection()):dl(ur.kind,Pr,Dr,$,c,yr,Tr,Hi,!1,Qi,he,Re,re,nt,_o,ae.getProjection(),D,Ft);const Go=Q.imageAtlasTexture?Q.imageAtlasTexture:null,Pa=o.layout.get("icon-size").constantOr(0)!==1||ae.iconsNeedLinear,za=ae.sdfIcons||c.options.rotating||c.options.zooming||Pa||bn?Z.LINEAR:Z.NEAREST,wu=ae.sdfIcons&&o.paint.get("icon-halo-width").constantOr(1)!==0,Da=c.terrain&&$&&Pi?a.a6.invert(a.a6.create(),zr):Dn;if(Pi&&ae.icon){const As=V.elevation,El=As?As.getAtTileOffsetFunc(he,V.center.lat,V.worldSize,ae.getProjection()):null,On=oc(Le,Q.tileID.canonical,$,q,V,ae.getProjection(),je);lc(ae,Le,c,!1,On,er,$,R,El,he)}return{program:xi,buffers:ae.icon,uniformValues:ii,atlasTexture:Go,atlasTextureIcon:null,atlasInterpolation:za,atlasInterpolationIcon:null,isSDF:ae.sdfIcons,hasHalo:wu,tile:Q,labelPlaneMatrixInv:Da}},Et=()=>{const Pi=B&&o.layout.get("symbol-placement")!=="point",Bt=[],Kt=Pi||me||ct;c.terrainRenderModeElevated()&&Y&&Bt.push("PITCH_WITH_MAP_TERRAIN"),Ie&&(Bt.push("PROJECTION_GLOBE_VIEW"),Kt&&Bt.push("PROJECTED_POS_ON_VIEWPORT")),ae.text.zOffsetVertexBuffer&&Bt.push("Z_OFFSET");const Ft=ae.text.programConfigurations.get(o.id),Yt=c.getOrCreateProgram(ae.iconsInText?"symbolTextAndIcon":"symbolSDF",{config:Ft,defines:Bt});let xi,ii=[0,0],Qi=null;const ur=ae.textSizeData;ae.iconsInText&&(ii=Q.imageAtlasTexture?Q.imageAtlasTexture.size:[0,0],Qi=Q.imageAtlasTexture?Q.imageAtlasTexture:null,xi=Y||V.pitch!==0||c.options.rotating||c.options.zooming||ur.kind==="composite"||ur.kind==="camera"?Z.LINEAR:Z.NEAREST);const Pr=Q.glyphAtlasTexture?Q.glyphAtlasTexture.size:[0,0],bn=a.b5(ur,V.zoom),zr=Xs(Le,Q.tileID.canonical,Y,B,V,ae.getProjection(),je),er=sc(Le,Q.tileID.canonical,Y,B,V,ae.getProjection(),je),Hi=c.translatePosMatrix(er,Q,b,M,!0),yr=c.translatePosMatrix(Le,Q,b,M),Tr=Kt?Dn:zr,Dr=B&&!Y&&!Pi;let wn=ne;!fe&&!V.mercatorFromTransition||B||(wn=ha(V));const _o=Ie?wn:ne;let Go;Go=ae.iconsInText?fl(ur.kind,bn,Dr,Y,c,yr,Tr,Hi,Pr,ii,he,Re,re,nt,_o,ae.getProjection()):aa(ur.kind,bn,Dr,Y,c,yr,Tr,Hi,!0,Pr,!0,he,Re,re,nt,_o,ae.getProjection());const Pa=Q.glyphAtlasTexture?Q.glyphAtlasTexture:null,za=Z.LINEAR,wu=o.paint.get("text-halo-width").constantOr(1)!==0,Da=c.terrain&&Y&&Pi?a.a6.invert(a.a6.create(),zr):Dn;if(Pi&&ae.text){const As=V.elevation,El=As?As.getAtTileOffsetFunc(he,V.center.lat,V.worldSize,ae.getProjection()):null,On=oc(Le,Q.tileID.canonical,Y,B,V,ae.getProjection(),je);lc(ae,Le,c,!0,On,er,Y,O,El,he)}return{program:Yt,buffers:ae.text,uniformValues:Go,atlasTexture:Pa,atlasTextureIcon:Qi,atlasInterpolation:za,atlasInterpolationIcon:xi,isSDF:!0,hasHalo:wu,tile:Q,labelPlaneMatrixInv:Da}},gt=ae.icon.segments.get().length,bt=ae.text.segments.get().length,vt=gt&&!g.onlyText?at():null,Zt=bt&&!g.onlyIcons?Et():null,_i=o.paint.get("icon-opacity").constantOr(1),Ot=o.paint.get("text-opacity").constantOr(1);if(K&&ae.canOverlap){ee=!0;const Pi=_i&&!g.onlyText?ae.icon.segments.get():[],Bt=Ot&&!g.onlyIcons?ae.text.segments.get():[];for(const Kt of Pi)Ae.push({segments:new a.aB([Kt]),sortKey:Kt.sortKey,state:vt});for(const Kt of Bt)Ae.push({segments:new a.aB([Kt]),sortKey:Kt.sortKey,state:Zt})}else g.onlyText||Ae.push({segments:_i?ae.icon.segments:new a.aB([]),sortKey:0,state:vt}),g.onlyIcons||Ae.push({segments:Ot?ae.text.segments:new a.aB([]),sortKey:0,state:Zt})}ee&&Ae.sort((he,Q)=>he.sortKey-Q.sortKey);for(const he of Ae){const Q=he.state;if(Q)if(c.terrain&&c.terrain.setupElevationDraw(Q.tile,Q.program,{useDepthForOcclusion:V.depthOcclusionForSymbolsAndCircles,labelPlaneMatrixInv:Q.labelPlaneMatrixInv}),F.activeTexture.set(Z.TEXTURE0),Q.atlasTexture&&Q.atlasTexture.bind(Q.atlasInterpolation,Z.CLAMP_TO_EDGE,!0),Q.atlasTextureIcon&&(F.activeTexture.set(Z.TEXTURE1),Q.atlasTextureIcon&&Q.atlasTextureIcon.bind(Q.atlasInterpolationIcon,Z.CLAMP_TO_EDGE,!0)),c.uploadCommonLightUniforms(c.context,Q.program),Q.hasHalo){const ae=Q.uniformValues;ae.u_is_halo=1,ao(Q.buffers,he.segments,o,c,Q.program,ce,d,p,ae,2),ae.u_is_halo=0}else{if(Q.isSDF){const ae=Q.uniformValues;
2107Q.hasHalo&&(ae.u_is_halo=1,ao(Q.buffers,he.segments,o,c,Q.program,ce,d,p,ae,1)),ae.u_is_halo=0}ao(Q.buffers,he.segments,o,c,Q.program,ce,d,p,Q.uniformValues,1)}}}function ao(c,r,o,u,d,p,g,x,b,T){const M=[c.dynamicLayoutVertexBuffer,c.opacityVertexBuffer,c.iconTransitioningVertexBuffer,c.globeExtVertexBuffer,c.zOffsetVertexBuffer];d.draw(u,u.context.gl.TRIANGLES,p,g,x,ft.disabled,b,o.id,c.layoutVertexBuffer,c.indexBuffer,r,o.paint,u.transform.zoom,c.programConfigurations.get(o.id),M,T)}function No(c,r,o,u,d,p,g){const x=c.context.gl,b=o.paint.get("fill-pattern"),T=b&&b.constantOr(1);let M,S,C,P,k;g?(S=T&&!o.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",M=x.LINES):(S=T?"fillPattern":"fill",M=x.TRIANGLES);for(const R of u){const O=r.getTile(R);if(T&&!O.patternsLoaded())continue;const D=O.getBucket(o);if(!D)continue;c.prepareDrawTile();const F=D.programConfigurations.get(o.id),Z=c.isTileAffectedByFog(R),V=c.getOrCreateProgram(S,{config:F,overrideFog:Z});T&&(c.context.activeTexture.set(x.TEXTURE0),O.imageAtlasTexture&&O.imageAtlasTexture.bind(x.LINEAR,x.CLAMP_TO_EDGE),F.updatePaintBuffers());const q=b.constantOr(null);if(q&&O.imageAtlas){const Y=O.imageAtlas.patternPositions[q.toString()];Y&&F.setConstantPatternPositions(Y)}const B=c.translatePosMatrix(R.projMatrix,O,o.paint.get("fill-translate"),o.paint.get("fill-translate-anchor")),$=o.paint.get("fill-emissive-strength");if(g){P=D.indexBuffer2,k=D.segments2;const Y=c.terrain&&c.terrain.renderingToTexture?c.terrain.drapeBufferSize:[x.drawingBufferWidth,x.drawingBufferHeight];C=S==="fillOutlinePattern"&&T?yh(B,$,c,O,Y):Fo(B,$,Y)}else P=D.indexBuffer,k=D.segments,C=T?jc(B,$,c,O):ws(B,$);c.uploadCommonUniforms(c.context,V,R.toUnwrapped()),V.draw(c,M,d,c.stencilModeForClipping(R),p,ft.disabled,C,o.id,D.layoutVertexBuffer,P,k,o.paint,c.transform.zoom,F,void 0)}}function it(c,r,o,u,d,p,g,x){o.resetLayerRenderingStats(c);const b=c.context,T=b.gl,M=c.transform,S=o.paint.get("fill-extrusion-pattern"),C=S.constantOr(1),P=o.paint.get("fill-extrusion-opacity"),k=c.style.enable3dLights(),R=o.paint.get(k&&!C?"fill-extrusion-ambient-occlusion-wall-radius":"fill-extrusion-ambient-occlusion-radius"),O=[o.paint.get("fill-extrusion-ambient-occlusion-intensity"),R],D=o.layout.get("fill-extrusion-edge-radius"),F=D>0&&!o.paint.get("fill-extrusion-rounded-roof"),Z=F?0:D,V=M.projection.name==="globe"?a.cF():0,q=M.projection.name==="globe",B=q?a.S(M.zoom):0,$=[a.a5(M.center.lng),a.ae(M.center.lat)],Y=o.paint.get("fill-extrusion-flood-light-color").toArray01().slice(0,3),K=o.paint.get("fill-extrusion-flood-light-intensity"),ee=o.paint.get("fill-extrusion-vertical-scale"),ce=no(c,o.paint.get("fill-extrusion-cutoff-fade-range")),re=o.paint.get("fill-extrusion-emissive-strength"),me=[];let fe;q&&me.push("PROJECTION_GLOBE_VIEW"),O[0]>0&&me.push("FAUX_AO"),F&&me.push("ZERO_ROOF_RADIUS"),x&&me.push("HAS_CENTROID"),K>0&&me.push("FLOOD_LIGHT"),ce.shouldRenderCutoff&&me.push("RENDER_CUTOFF");const Ae=c.renderPass==="shadow",ne=c.shadowRenderer,he=Ae&&!!ne;c.shadowRenderer&&(c.shadowRenderer.useNormalOffset=!0);let Q=[0,0,0];if(ne){const Re=c.style.directionalLight,Le=c.style.ambientLight;Re&&Le&&(Q=ra(Re,Le)),fe=me.concat(["SHADOWS_SINGLE_CASCADE"])}const ae=he?"fillExtrusionDepth":C?"fillExtrusionPattern":"fillExtrusion",Ie=o.getLayerRenderingStats();for(const Re of u){const Le=r.getTile(Re),je=Le.getBucket(o);if(!je||je.projection.name!==M.projection.name)continue;let et=!1;ne&&(et=ne.getMaxCascadeForTile(Re.toUnwrapped())===0);const ct=c.isTileAffectedByFog(Re),nt=je.programConfigurations.get(o.id),at=c.getOrCreateProgram(ae,{config:nt,defines:et?fe:me,overrideFog:ct});if(c.terrain&&c.terrain.setupElevationDraw(Le,at,{useMeterToDem:!0}),!je.centroidVertexBuffer){const _i=at.attributes.a_centroid_pos;_i!==void 0&&T.vertexAttrib2f(_i,0,0)}!Ae&&ne&&ne.setupShadows(Le.tileID.toUnwrapped(),at,"vector-tile",Le.tileID.overscaledZ),C&&(c.context.activeTexture.set(T.TEXTURE0),Le.imageAtlasTexture&&Le.imageAtlasTexture.bind(T.LINEAR,T.CLAMP_TO_EDGE),nt.updatePaintBuffers());const Et=S.constantOr(null);if(Et&&Le.imageAtlas){const _i=Le.imageAtlas.patternPositions[Et.toString()];_i&&nt.setConstantPatternPositions(_i)}const gt=o.paint.get("fill-extrusion-vertical-gradient");let bt;if(Ae&&ne){if(Eh(Le.tileID,je,c))continue;const _i=ne.calculateShadowPassMatrixFromTile(Le.tileID.toUnwrapped());bt=Uc(_i,Z,ee)}else{const _i=c.translatePosMatrix(Re.expandedProjMatrix,Le,o.paint.get("fill-extrusion-translate"),o.paint.get("fill-extrusion-translate-anchor")),Ot=M.projection.createInversionMatrix(M,Re.canonical);bt=C?Bo(_i,c,gt,P,O,Z,Re,Le,V,B,$,Ot,Y,ee):Vc(_i,c,gt,P,O,Z,Re,V,B,$,Ot,Y,ee,K,Q,re)}c.uploadCommonUniforms(b,at,Re.toUnwrapped(),null,ce);let vt=je.segments;if(M.projection.name==="mercator"&&!Ae&&(vt=je.getVisibleSegments(Le.tileID,c.terrain,c.transform.getFrustum(0)),!vt.get().length))continue;if(Ie)if(Ae)for(const _i of vt.get())Ie.numRenderedVerticesInShadowPass+=_i.primitiveLength;else for(const _i of vt.get())Ie.numRenderedVerticesInTransparentPass+=_i.primitiveLength;const Zt=[];(c.terrain||x)&&Zt.push(je.centroidVertexBuffer),q&&Zt.push(je.layoutVertexExtBuffer),at.draw(c,b.gl.TRIANGLES,d,p,g,ft.backCCW,bt,o.id,je.layoutVertexBuffer,je.indexBuffer,vt,o.paint,c.transform.zoom,nt,Zt)}c.shadowRenderer&&(c.shadowRenderer.useNormalOffset=!1)}function lo(c,r,o,u,d,p,g,x,b,T,M,S,C,P,k,R,O,D,F){const Z=c.context,V=Z.gl,q=c.transform,B=c.transform.zoom,$=[],Y=no(c,o.paint.get("fill-extrusion-cutoff-fade-range"));T==="clear"?($.push("CLEAR_SUBPASS"),F&&($.push("CLEAR_FROM_TEXTURE"),Z.activeTexture.set(V.TEXTURE0),F.bind(V.LINEAR,V.CLAMP_TO_EDGE))):T==="sdf"&&$.push("SDF_SUBPASS"),O&&$.push("HAS_CENTROID"),Y.shouldRenderCutoff&&$.push("RENDER_CUTOFF");const K=o.layout.get("fill-extrusion-edge-radius"),ee=(ce,re,me,fe,Ae)=>{const ne=re.programConfigurations.get(o.id),he=c.isTileAffectedByFog(ce),Q=c.getOrCreateProgram("fillExtrusionGroundEffect",{config:ne,defines:$,overrideFog:he}),ae=((Re,Le,je,et,ct,nt,at,Et,gt,bt,vt)=>({u_matrix:Le,u_opacity:je,u_ao_pass:et?1:0,u_meter_to_tile:ct,u_ao:nt,u_flood_light_intensity:at,u_flood_light_color:Et,u_attenuation:gt,u_edge_radius:bt,u_fb:0,u_fb_size:vt}))(0,fe,M,b,Ae,[S,C*Ae],P,k,R,B>=17?0:K*Ae,F?F.size[0]:0),Ie=[];O&&Ie.push(re.hiddenByLandmarkVertexBuffer),c.uploadCommonUniforms(Z,Q,ce.toUnwrapped(),null,Y),Q.draw(c,Z.gl.TRIANGLES,d,p,g,x,ae,o.id,re.vertexBuffer,re.indexBuffer,me,o.paint,B,ne,Ie)};for(const ce of u){const re=r.getTile(ce),me=re.getBucket(o);if(!me||me.projection.name!==q.projection.name||!me.groundEffect||me.groundEffect&&!me.groundEffect.hasData())continue;const fe=me.groundEffect,Ae=1/me.tileToMeter;{const ne=c.translatePosMatrix(ce.projMatrix,re,o.paint.get("fill-extrusion-translate"),o.paint.get("fill-extrusion-translate-anchor")),he=fe.getDefaultSegment();ee(ce,fe,he,ne,Ae)}if(D)for(let ne=0;ne<4;ne++){const he=a.cG[ne](ce),Q=r.getTile(he);if(!Q)continue;const ae=Q.getBucket(o);if(!ae||ae.projection.name!==q.projection.name||!ae.groundEffect||ae.groundEffect&&!ae.groundEffect.hasData())continue;const Ie=ae.groundEffect;let Re,Le;ne===0?(Re=[-a.V,0,0],Le=1):ne===1?(Re=[a.V,0,0],Le=0):ne===2?(Re=[0,-a.V,0],Le=3):(Re=[0,a.V,0],Le=2);const je=Ie.regionSegments[Le];if(!je)continue;const et=new Float32Array(16);a.a6.translate(et,ce.projMatrix,Re),ee(ce,Ie,je,c.translatePosMatrix(et,re,o.paint.get("fill-extrusion-translate"),o.paint.get("fill-extrusion-translate-anchor")),Ae)}}}function uf(c,r,o,u,d,p,g){u.centroidVertexArray.length===0&&u.createCentroidsBuffer();const x=p?p.findDEMTileFor(o):null;if(!(x&&x.dem||g))return;const b=D=>new a.P(Math.ceil((D+a.cJ)*a.cK),0),T=D=>{const F=r.getSource().minzoom,Z=q=>{const B=r.getTileByID(q);if(B&&B.hasData())return B.getBucket(d)},V=[0,-1,1];for(const q of V){if(D.overscaledZ+q<F)continue;const B=Z(D.calculateScaledKey(D.overscaledZ+q));
2107if(B)return B}},M=[0,0,0],S=(D,F)=>(M[0]=Math.min(D.min.y,F.min.y),M[1]=Math.max(D.max.y,F.max.y),M[2]=a.V-F.min.x>D.max.x?F.min.x-a.V:D.max.x,M),C=(D,F)=>(M[0]=Math.min(D.min.x,F.min.x),M[1]=Math.max(D.max.x,F.max.x),M[2]=a.V-F.min.y>D.max.y?F.min.y-a.V:D.max.y,M),P=[(D,F)=>S(D,F),(D,F)=>S(F,D),(D,F)=>C(D,F),(D,F)=>C(F,D)],k=(D,F,Z,V,q,B,$)=>{if(!p)return 0;const Y=[[B?Z:D,B?D:Z,0],[B?Z:F,B?F:Z,0]],K=$<0?a.V+$:$,ee=[B?K:(D+F)/2,B?(D+F)/2:K,0];return Z===0&&$<0||Z!==0&&$>0?p.getForTilePoints(q,[ee],!0,V):Y.push(ee),p.getForTilePoints(o,Y,!0,x),Math.max(Y[0][2],Y[1][2],ee[2])/p.exaggeration()};for(let D=0;D<4;D++){const F=u.borderFeatureIndices[D];if(F.length===0)continue;const Z=a.cG[D](o),V=T(Z);if(!(V&&V instanceof a.cH)||u.borderDoneWithNeighborZ[D]===V.canonical.z)continue;V.centroidVertexArray.length===0&&V.createCentroidsBuffer();const q=p?p.findDEMTileFor(Z):null;if(!(q&&q.dem||g))continue;const B=(D<2?1:5)-D,$=V.borderDoneWithNeighborZ[B]!==u.canonical.z,Y=V.borderFeatureIndices[B];let K=0;if(u.canonical.z!==V.canonical.z){for(const ee of F)u.showCentroid(u.featuresOnBorder[ee]);if($)for(const ee of Y)V.showCentroid(V.featuresOnBorder[ee]);u.borderDoneWithNeighborZ[D]=V.canonical.z,V.borderDoneWithNeighborZ[B]=u.canonical.z}for(const ee of F){const ce=u.featuresOnBorder[ee],re=u.centroidData[ce.centroidDataIndex],me=ce.borders[D];let fe;for(;K<Y.length;){fe=V.featuresOnBorder[Y[K]];const Ae=fe.borders[B];if(Ae[1]>me[0]+3||Ae[0]>me[0]-3)break;V.showCentroid(fe),K++}if(fe&&K<Y.length){const Ae=K;let ne=0;for(;!(fe.borders[B][0]>me[1]-3)&&(ne++,++K!==Y.length);)fe=V.featuresOnBorder[Y[K]];if(fe=V.featuresOnBorder[Y[Ae]],ne>1){const ae=fe.borders[B];Math.abs(me[0]-ae[0])<3&&Math.abs(me[1]-ae[1])<3&&(ne=1,K=Ae+1)}else if(ne===0){u.showCentroid(ce);continue}const he=V.centroidData[fe.centroidDataIndex];g&&ne===1&&(((R=re).flags|(O=he).flags)&a.cI?(R.flags|=a.cI,O.flags|=a.cI):(R.flags&=~a.cI,O.flags&=~a.cI));const Q=ce.intersectsCount()>1||fe.intersectsCount()>1;if(ne>1)K=Ae,re.centroidXY=he.centroidXY=new a.P(0,0);else if(q&&q.dem&&!Q){const ae=P[D](re,he),Ie=D%2?a.V-1:0,Re=k(ae[0],Math.min(a.V-1,ae[1]),Ie,q,Z,D<2,ae[2]);re.centroidXY=he.centroidXY=b(Re)}else Q?re.centroidXY=he.centroidXY=new a.P(0,0):(re.centroidXY=u.encodeBorderCentroid(ce),he.centroidXY=V.encodeBorderCentroid(fe));u.writeCentroidToBuffer(re),V.writeCentroidToBuffer(he)}else u.showCentroid(ce)}u.borderDoneWithNeighborZ[D]=V.canonical.z,V.borderDoneWithNeighborZ[B]=u.canonical.z}var R,O;(u.needsCentroidUpdate||!u.centroidVertexBuffer&&u.centroidVertexArray.length!==0)&&u.uploadCentroid(c)}const hf=[1,0,0],Wc=[0,1,0],Mh=[0,0,1];function Eh(c,r,o){const u=o.transform,d=o.shadowRenderer;if(!d)return!0;const p=c.toUnwrapped(),g=u.tileSize*d._cascades[o.currentShadowCascade].scale;let x=r.maxHeight;if(u.elevation){const R=u.elevation.getMinMaxForTile(c);R&&(x+=R.max)}const b=[...d.shadowDirection];b[2]=-b[2];const T=d.computeSimplifiedTileShadowVolume(p,x,g,b);if(!T)return!1;const M=[hf,Wc,Mh,b,[b[0],0,b[2]],[0,b[1],b[2]]],S=u.projection.name==="globe",C=u.scaleZoom(g),P=a.bq.fromInvProjectionMatrix(u.invProjMatrix,u.worldSize,C,!S),k=d.getCurrentCascadeFrustum();return P.intersectsPrecise(T.vertices,T.planes,M)===0||k.intersectsPrecise(T.vertices,T.planes,M)===0}function Sh(c){return[c[0]*a.cL,c[1]*a.cL,c[2]*a.cL,0]}function Hc(c,r,o,u,d,p,g,x,b){const T=u.getSource(),M=o.globeSharedBuffers;if(!M)return;let S,C,P;if(r&&(S=u.getTile(r)),T instanceof a.ap?(C=T.texture,P=a.cj(0,0,o.transform)):S&&r&&(C=S.texture,P=a.cj(r.canonical.z,r.canonical.x,o.transform)),!C||!P)return;c||(P=a.a6.scale(a.a6.create(),P,[1,-1,1]));const k=o.context,R=k.gl,O=d.paint.get("raster-resampling")==="nearest"?R.NEAREST:R.LINEAR,D=o.colorModeForDrapableLayerRenderPass(p),F=g.defines;F.push("GLOBE_POLES");const Z=new dt(R.LEQUAL,dt.ReadWrite,o.depthRangeFor3D),V=Float32Array.from(o.transform.expandedFarZProjMatrix),q=Float32Array.from(a.aT(a.ci(new a.bs(0,0,0))));o.terrain&&o.terrain.prepareDrawTile(),k.activeTexture.set(R.TEXTURE0),C.bind(O,R.CLAMP_TO_EDGE),k.activeTexture.set(R.TEXTURE1),C.bind(O,R.CLAMP_TO_EDGE),C.useMipmap&&k.extTextureFilterAnisotropic&&o.transform.pitch>20&&R.texParameterf(R.TEXTURE_2D,k.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,k.extTextureFilterAnisotropicMax);const[B,$,Y,K]=r?M.getPoleBuffers(r.canonical.z,!1):M.getPoleBuffers(0,!0),ee=d.paint.get("raster-elevation");let ce;c?(ce=B,o.renderDefaultNorthPole=ee!==0):(ce=$,o.renderDefaultSouthPole=ee!==0);const re=Sh(g.mix),me=((Ae,ne,he,Q,ae,Ie,Re,Le,je,et,ct,nt,at)=>qc(Ae,ne,he,new Float32Array(16),new Float32Array(9),[0,0],Q,[0,0],[0,0,0,0],1,{opacity:1,mix:0},Ie,[0,0],Le,2,et,ct,nt,1,0,at))(V,q,P,a.S(o.transform.zoom),0,d,0,ee,0,re,g.offset,g.range,p),fe=o.getOrCreateProgram("raster",{defines:F});o.uploadCommonUniforms(k,fe,null),fe.draw(o,R.TRIANGLES,Z,b,D,x,me,d.id,ce,Y,K)}function Xc(c){const r=c._nearZ,o=c.projection.farthestPixelDistance(c),u=o-r,d=.2*c.height,p=r+d;return[r,o,(p-d-r)/u,(p-r)/u]}function Yc(c,r,o,u){if(c)return r instanceof Be&&c instanceof zo?r.getTextureDescriptor(c,o,!0):{texture:c.texture,mix:Sh(u.mix),offset:u.offset,buffer:0,tileSize:1}}function Kc(c,r,o){if(!c)return null;const u=r.getTextureDescriptor(c,o,!0);if(!u)return null;let{texture:d,mix:p,offset:g,tileSize:x,buffer:b,format:T}=u;
vendor: 8,647 bytes, line 2107
2107if(!d||!T)return null;let M=!1;return T==="uint32"&&(M=!0,p[3]=0,p=hl(a.cM,p,[0,o.paint.get("raster-particle-max-speed")]),g=vh(a.cM,g,[0,o.paint.get("raster-particle-max-speed")])),{texture:d,textureOffset:[b/(x+2*b),x/(x+2*b)],tileSize:x,scalarData:M,scale:p,offset:g,defines:["RASTER_ARRAY",{uint8:"DATA_FORMAT_UINT8",uint16:"DATA_FORMAT_UINT16",uint32:"DATA_FORMAT_UINT32"}[T]]}}function Jc(c){const r=c._nearZ,o=c.projection.farthestPixelDistance(c),u=o-r,d=.2*c.height,p=r+d;return[r,o,(p-d-r)/u,(p-r)/u]}const Ir=new a.ax(1,0,0,1),co=new a.ax(0,1,0,1),Ah=new a.ax(0,0,1,1),Qc=new a.ax(1,0,1,1),eu=new a.ax(0,1,1,1);function uo(c,r,o,u,d,p,g){const x=c.context,b=c.transform,T=x.gl,M=b.projection.name==="globe",S=M?["PROJECTION_GLOBE_VIEW"]:[];let C=a.a6.clone(o.projMatrix);if(M&&a.S(b.zoom)>0){const re=a.aS(o.canonical,b),me=a.cN(re);C=a.a6.multiply(new Float32Array(16),b.globeMatrix,me),a.a6.multiply(C,b.projMatrix,C)}const P=a.a6.create();P[12]+=2*d/(a.f.devicePixelRatio*b.width),P[13]+=2*p/(a.f.devicePixelRatio*b.height),a.a6.multiply(C,P,C);const k=c.getOrCreateProgram("debug",{defines:S}),R=r.getTileByID(o.key);c.terrain&&c.terrain.setupElevationDraw(R,k);const O=dt.disabled,D=yt.disabled,F=c.colorModeForRenderPass(),Z="$debug";x.activeTexture.set(T.TEXTURE0),c.emptyTexture.bind(T.LINEAR,T.CLAMP_TO_EDGE),M?R._makeGlobeTileDebugBuffers(c.context,b):R._makeDebugTileBoundsBuffers(c.context,b.projection);const V=R._tileDebugBuffer||c.debugBuffer,q=R._tileDebugIndexBuffer||c.debugIndexBuffer,B=R._tileDebugSegments||c.debugSegments;if(k.draw(c,T.LINE_STRIP,O,D,F,ft.disabled,Gc(C,u),Z,V,q,B,null,null,null,[R._globeTileDebugBorderBuffer]),g){const re=R.latestRawTileData,me=Math.floor((re&&re.byteLength||0)/1024);let fe=o.canonical.toString();o.overscaledZ!==o.canonical.z&&(fe+=` => ${o.overscaledZ}`),fe+=` ${R.state}`,fe+=` ${me}kb`,function(Ae,ne){Ae.initDebugOverlayCanvas();const he=Ae.debugOverlayCanvas,Q=Ae.context.gl,ae=Ae.debugOverlayCanvas.getContext("2d");ae.clearRect(0,0,he.width,he.height),ae.shadowColor="white",ae.shadowBlur=2,ae.lineWidth=1.5,ae.strokeStyle="white",ae.textBaseline="top",ae.font="bold 36px Open Sans, sans-serif",ae.fillText(ne,5,5),ae.strokeText(ne,5,5),Ae.debugOverlayTexture.update(he),Ae.debugOverlayTexture.bind(Q.LINEAR,Q.CLAMP_TO_EDGE)}(c,fe)}const $=r.getTile(o).tileSize,Y=512/Math.min($,512)*(o.overscaledZ/b.zoom)*.5,K=R._tileDebugTextBuffer||c.debugBuffer,ee=R._tileDebugTextIndexBuffer||c.quadTriangleIndexBuffer,ce=R._tileDebugTextSegments||c.debugSegments;k.draw(c,T.TRIANGLES,O,D,Rt.alphaBlended,ft.disabled,Gc(C,a.ax.transparent,Y),Z,K,ee,ce,null,null,null,[R._globeTileDebugTextBuffer])}function tu(c,r,o,u){Ii(c,0,r+o/2,c.transform.width,o,u)}function Nr(c,r,o,u){Ii(c,r-o/2,0,o,c.transform.height,u)}function Ii(c,r,o,u,d,p){const g=c.context,x=g.gl;x.enable(x.SCISSOR_TEST),x.scissor(r*a.f.devicePixelRatio,o*a.f.devicePixelRatio,u*a.f.devicePixelRatio,d*a.f.devicePixelRatio),g.clear({color:p}),x.disable(x.SCISSOR_TEST)}const _l=a.ay([{name:"a_pos_3f",components:3,type:"Float32"}]),{members:iu}=_l;function Ln(c,r,o,u){c.emplaceBack(r,o,u)}class ru{constructor(r){this.vertexArray=new a.az,this.indices=new a.aw,Ln(this.vertexArray,-1,-1,1),Ln(this.vertexArray,1,-1,1),Ln(this.vertexArray,-1,1,1),Ln(this.vertexArray,1,1,1),Ln(this.vertexArray,-1,-1,-1),Ln(this.vertexArray,1,-1,-1),Ln(this.vertexArray,-1,1,-1),Ln(this.vertexArray,1,1,-1),this.indices.emplaceBack(5,1,3),this.indices.emplaceBack(3,7,5),this.indices.emplaceBack(6,2,0),this.indices.emplaceBack(0,4,6),this.indices.emplaceBack(2,6,7),this.indices.emplaceBack(7,3,2),this.indices.emplaceBack(5,4,0),this.indices.emplaceBack(0,1,5),this.indices.emplaceBack(0,2,3),this.indices.emplaceBack(3,1,0),this.indices.emplaceBack(7,6,4),this.indices.emplaceBack(4,5,7),this.vertexBuffer=r.createVertexBuffer(this.vertexArray,iu),this.indexBuffer=r.createIndexBuffer(this.indices),this.segment=a.aB.simpleSegment(0,0,36,12)}}function Vo(c,r,o,u,d,p){const g=c.context.gl,x=r.paint.get("sky-atmosphere-color"),b=r.paint.get("sky-atmosphere-halo-color"),T=r.paint.get("sky-atmosphere-sun-intensity"),M=((S,C,P,k,R)=>({u_matrix_3f:S,u_sun_direction:C,u_sun_intensity:P,u_color_tint_r:[k.r,k.g,k.b,k.a],u_color_tint_m:[R.r,R.g,R.b,R.a],u_luminance:5e-5}))(a.co.fromMat4(a.co.create(),u),d,T,x,b);g.framebufferTexture2D(g.FRAMEBUFFER,g.COLOR_ATTACHMENT0,g.TEXTURE_CUBE_MAP_POSITIVE_X+p,r.skyboxTexture,0),o.draw(c,g.TRIANGLES,dt.disabled,yt.disabled,Rt.unblended,ft.frontCW,M,"skyboxCapture",r.skyboxGeometry.vertexBuffer,r.skyboxGeometry.indexBuffer,r.skyboxGeometry.segment)}const df=a.ay([{type:"Float32",name:"a_pos",components:3},{type:"Float32",name:"a_uv",components:2}]);class Ts{constructor(r){const o=new a.cO;o.emplaceBack(-1,1,1,0,0),o.emplaceBack(1,1,1,1,0),o.emplaceBack(1,-1,1,1,1),o.emplaceBack(-1,-1,1,0,1);const u=new a.aw;u.emplaceBack(0,1,2),u.emplaceBack(2,3,0),this.vertexBuffer=r.createVertexBuffer(o,df.members),this.indexBuffer=r.createIndexBuffer(u),this.segments=a.aB.simpleSegment(0,0,4,2)}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy()}}const da=a.ay([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_size_scale",components:1},{type:"Float32",name:"a_fade_opacity",components:1}]);class Oe{constructor(){this.starsCount=16e3,this.sizeMultiplier=.15,this.sizeRange=100,this.intensityRange=200}}class ut{constructor(r){this.colorModeAlphaBlendedWriteRGB=new Rt([1,Kn,1,Kn],a.ax.transparent,[!0,!0,!0,!1]),this.colorModeWriteAlpha=new Rt([1,0,1,0],a.ax.transparent,[!1,!1,!1,!0]),this.params=new Oe,this.updateNeeded=!0,r.tp.registerParameter(this.params,["Stars"],"starsCount",{min:100,max:16e3,step:1},()=>{this.updateNeeded=!0}),r.tp.registerParameter(this.params,["Stars"],"sizeMultiplier",{min:.01,max:2,step:.01}),r.tp.registerParameter(this.params,["Stars"],"sizeRange",{min:0,max:200,step:1},()=>{this.updateNeeded=!0}),r.tp.registerParameter(this.params,["Stars"],"intensityRange",{min:0,max:200,step:1},()=>{this.updateNeeded=!0})}update(r){const o=r.context;if(!this.atmosphereBuffer||this.updateNeeded){this.updateNeeded=!1,this.atmosphereBuffer=new Ts(o);const u=this.params.sizeRange,d=this.params.intensityRange,p=function(M){const S=a.aA(30),C=[];for(let P=0;P<M;++P){const k=2*Math.PI*S(),R=Math.acos(1-2*S())-.5*Math.PI;C.push(a.N.fromValues(Math.cos(R)*Math.cos(k),Math.cos(R)*Math.sin(k),Math.sin(R)))}return C}(this.params.starsCount),g=a.aA(300),x=new a.cP,b=new a.aw;let T=0;for(let M=0;M<p.length;++M){const S=a.N.scale([],p[M],200),C=Math.max(0,1+.01*u*(1*g()-.5)),P=Math.max(0,1+.01*d*(1*g()-.5));x.emplaceBack(S[0],S[1],S[2],-1,-1,C,P),x.emplaceBack(S[0],S[1],S[2],1,-1,C,P),x.emplaceBack(S[0],S[1],S[2],1,1,C,P),x.emplaceBack(S[0],S[1],S[2],-1,1,C,P),b.emplaceBack(T+0,T+1,T+2),b.emplaceBack(T+0,T+2,T+3),T+=4}this.starsVx=o.createVertexBuffer(x,da.members),this.starsIdx=o.createIndexBuffer(b),this.starsSegments=a.aB.simpleSegment(0,0,x.length,b.length)}}destroy(){this.atmosphereBuffer&&this.atmosphereBuffer.destroy(),this.starsVx&&this.starsVx.destroy(),this.starsIdx&&this.starsIdx.destroy()}drawAtmosphereGlow(r,o){const u=r.context,d=u.gl,p=r.transform,g=new dt(d.LEQUAL,dt.ReadOnly,[0,1]),x=a.S(p.zoom),b=o.properties.get("color").toArray01(),T=o.properties.get("high-color").toArray01(),M=o.properties.get("space-color").toArray01PremultipliedAlpha(),S=5e-4,C=a.cQ(o.properties.get("horizon-blend"),0,1,S,.25),P=a.cd(r,u,p)&&C===S?p.worldSize/(2*Math.PI*1.025)-1:p.globeRadius,k=r.frameCounter/1e3%1,R=a.N.length(p.globeCenterInViewSpace),O=Math.sqrt(Math.pow(R,2)-Math.pow(P,2)),D=Math.acos(O/R),F=Z=>{const V=p.projection.name==="globe"?["PROJECTION_GLOBE_VIEW","FOG"]:["FOG"];Z&&V.push("ALPHA_PASS");const q=r.getOrCreateProgram("globeAtmosphere",{defines:V}),B=((Y,K,ee,ce,re,me,fe,Ae,ne,he,Q,ae)=>({u_frustum_tl:Y,u_frustum_tr:K,u_frustum_br:ee,u_frustum_bl:ce,u_horizon:re,u_transition:me,u_fadeout_range:fe,u_color:Ae,u_high_color:ne,u_space_color:he,u_temporal_offset:Q,u_horizon_angle:ae}))(p.frustumCorners.TL,p.frustumCorners.TR,p.frustumCorners.BR,p.frustumCorners.BL,p.frustumCorners.horizon,x,C,b,T,M,k,D);r.uploadCommonUniforms(u,q);const $=this.atmosphereBuffer;$&&q.draw(r,d.TRIANGLES,g,yt.disabled,Z?this.colorModeWriteAlpha:this.colorModeAlphaBlendedWriteRGB,ft.backCW,B,Z?"atmosphere_glow_alpha":"atmosphere_glow",$.vertexBuffer,$.indexBuffer,$.segments)};F(!1),F(!0)}drawStars(r,o){const u=a.aa(o.properties.get("star-intensity"),0,1);if(u===0)return;const d=r.context,p=d.gl,g=r.transform,x=r.getOrCreateProgram("stars"),b=
2107a.bi.identity([]);a.bi.rotateX(b,b,-g._pitch),a.bi.rotateZ(b,b,-g.angle),a.bi.rotateX(b,b,a.bj(g._center.lat)),a.bi.rotateY(b,b,-a.bj(g._center.lng));const T=a.a6.fromQuat(new Float32Array(16),b),M=a.a6.multiply([],g.starsProjMatrix,T),S=a.co.fromMat4([],T),C=a.co.invert([],S),P=[0,1,0];a.N.transformMat3(P,P,C),a.N.scale(P,P,this.params.sizeMultiplier);const k=[1,0,0];a.N.transformMat3(k,k,C),a.N.scale(k,k,this.params.sizeMultiplier);const R=(O=P,D=k,F=u,{u_matrix:Float32Array.from(M),u_up:O,u_right:D,u_intensity_multiplier:F});var O,D,F;r.uploadCommonUniforms(d,x),this.starsVx&&this.starsIdx&&x.draw(r,p.TRIANGLES,dt.disabled,yt.disabled,this.colorModeAlphaBlendedWriteRGB,ft.disabled,R,"atmosphere_stars",this.starsVx,this.starsIdx,this.starsSegments)}}function Uo(c,r){const o=[...c],u=r.cameraWorldSizeForFog/r.worldSize,d=a.a6.identity([]);return a.a6.scale(d,d,[u,u,1]),a.a6.multiply(o,d,o),a.a6.multiply(o,r.worldToFogMatrix,o),o}function Ci(c,r,o,u){const d=o.material,p=u.context,{baseColorTexture:g,metallicRoughnessTexture:x}=d.pbrMetallicRoughness,{normalTexture:b,occlusionTexture:T,emissionTexture:M}=d;function S(C,P,k){if(C&&(c.push(P),p.activeTexture.set(p.gl.TEXTURE0+k),C.gfxTexture)){const{minFilter:R,magFilter:O,wrapS:D,wrapT:F}=C.sampler;C.gfxTexture.bindExtraParam(R,O,D,F)}}S(g,"HAS_TEXTURE_u_baseColorTexture",cr.BaseColor),S(x,"HAS_TEXTURE_u_metallicRoughnessTexture",cr.MetallicRoughness),S(b,"HAS_TEXTURE_u_normalTexture",cr.Normal),S(T,"HAS_TEXTURE_u_occlusionTexture",cr.Occlusion),S(M,"HAS_TEXTURE_u_emissionTexture",cr.Emission),o.texcoordBuffer&&(c.push("HAS_ATTRIBUTE_a_uv_2f"),r.push(o.texcoordBuffer)),o.colorBuffer&&(c.push(o.colorBuffer.itemSize===12?"HAS_ATTRIBUTE_a_color_3f":"HAS_ATTRIBUTE_a_color_4f"),r.push(o.colorBuffer)),o.normalBuffer&&(c.push("HAS_ATTRIBUTE_a_normal_3f"),r.push(o.normalBuffer)),o.pbrBuffer&&(c.push("HAS_ATTRIBUTE_a_pbr"),c.push("HAS_ATTRIBUTE_a_heightBasedEmissiveStrength"),r.push(o.pbrBuffer)),d.alphaMode!=="OPAQUE"&&d.alphaMode!=="MASK"||c.push("UNPREMULT_TEXTURE_IN_SHADER"),d.defined||c.push("DIFFUSE_SHADED"),c.push("USE_STANDARD_DERIVATIVES")}function fa(c,r,o,u,d,p){const g=o.paint.get("model-opacity"),x=r.context,b=new dt(r.context.gl.LEQUAL,dt.ReadWrite,r.depthRangeFor3D),T=r.transform,M=c.mesh,S=M.material,C=S.pbrMetallicRoughness,P=r.style.fog;let k;k=r.transform.projection.zAxisUnit==="pixels"?[...c.nodeModelMatrix]:a.a6.multiply([],u.zScaleMatrix,c.nodeModelMatrix),a.a6.multiply(k,u.negCameraPosMatrix,k);const R=a.a6.invert([],k);a.a6.transpose(R,R);const O=o.paint.get("model-emissive-strength").constantOr(0),D=pl(new Float32Array(c.worldViewProjection),new Float32Array(k),new Float32Array(R),r,g,C.baseColorFactor,S.emissiveFactor,C.metallicFactor,C.roughnessFactor,S,O,o),F={defines:[]},Z=[];Ci(F.defines,Z,M,r);const V=r.shadowRenderer;V&&(V.useNormalOffset=!1);let q=null;if(P){const Y=Uo(c.nodeModelMatrix,r.transform);if(q=new Float32Array(Y),T.projection.name!=="globe"){const K=M.aabb.min,ee=M.aabb.max,[ce,re]=P.getOpacityForBounds(Y,K[0],K[1],ee[0],ee[1]);F.overrideFog=ce>=ai||re>=ai}}const B=no(r,o.paint.get("model-cutoff-fade-range"));B.shouldRenderCutoff&&F.defines.push("RENDER_CUTOFF");const $=r.getOrCreateProgram("model",F);r.uploadCommonUniforms(x,$,null,q,B),r.renderPass!=="shadow"&&V&&V.setupShadowsFromMatrix(c.nodeModelMatrix,$),$.draw(r,x.gl.TRIANGLES,b,d,p,M.material.doubleSided?ft.disabled:ft.backCCW,D,o.id,M.vertexBuffer,M.indexBuffer,M.segments,o.paint,r.transform.zoom,void 0,Z)}function pa(c,r,o,u,d,p,g){let x;x=c.projection.name==="globe"?a.cS(o,c):[...o],a.a6.multiply(x,x,r.matrix);const b=a.a6.multiply([],u,x);if(r.meshes)for(const T of r.meshes){if(T.material.alphaMode!=="BLEND"){g.push({mesh:T,depth:0,modelIndex:d,worldViewProjection:b,nodeModelMatrix:x});continue}const M=a.N.transformMat4([],T.centroid,b);M[2]>0&&p.push({mesh:T,depth:M[2],modelIndex:d,worldViewProjection:b,nodeModelMatrix:x})}if(r.children)for(const T of r.children)pa(c,T,o,u,d,p,g)}function le(c,r,o,u){const d=o.shadowRenderer;if(!d)return;const p=d.getShadowPassDepthMode(),g=d.getShadowPassColorMode(),x=d.calculateShadowPassMatrixFromMatr
2107ix(r),b=ua(x);o.getOrCreateProgram("modelDepth",{defines:o._shadowMapDebug?[]:["DEPTH_TEXTURE"]}).draw(o,o.context.gl.TRIANGLES,p,yt.disabled,g,ft.backCCW,b,u.id,c.vertexBuffer,c.indexBuffer,c.segments,u.paint,o.transform.zoom,void 0,void 0)}function nu(c,r,o){const u=r.updateZoomBasedPaintProperties(),d=function(p,g,x){let b,T,M,S=p.terrain?p.terrain.exaggeration():0;if(p.terrain&&S>0){const C=p.terrain,P=C.findDEMTileFor(x);P&&P.dem?b=a.cU.create(C,x,P):S=0}if(S===0&&(g.terrainElevationMin=0,g.terrainElevationMax=0),S===g.validForExaggeration&&(S===0||b&&b._demTile&&b._demTile.tileID===g.validForDEMTile.id&&b._dem._timestamp===g.validForDEMTile.timestamp))return!1;for(const C in g.instancesPerModel){const P=g.instancesPerModel[C];for(let k=0;k<P.instancedDataArray.length;++k){const R=(b?S*b.getElevationAt(0|P.instancedDataArray.float32[16*k],0|P.instancedDataArray.float32[16*k+1],!0,!0):0)+P.instancesEvaluatedElevation[k];P.instancedDataArray.float32[16*k+6]=R,T=T?Math.min(g.terrainElevationMin,R):R,M=M?Math.max(g.terrainElevationMax,R):R}}return g.terrainElevationMin=T||0,g.terrainElevationMax=M||0,g.validForExaggeration=S,g.validForDEMTile=b&&b._demTile?{id:b._demTile.tileID,timestamp:b._dem._timestamp}:{id:void 0,timestamp:0},!0}(c,r,o);(u||d)&&(r.uploaded=!1,r.upload(c.context))}const Vr={shadowUniformsInitialized:!1,useSingleShadowCascade:!1,tileMatrix:new Float64Array(16),shadowTileMatrix:new Float32Array(16),aabb:new a.bS([0,0,0],[a.V,a.V,0])};function Ih(c,r){const o=1<<c.canonical.z,u=r.getFreeCameraOptions().position,d=r.elevation,p=c.canonical.x/o,g=(c.canonical.x+1)/o,x=c.canonical.y/o,b=(c.canonical.y+1)/o;let T=r._centerAltitude;if(d){const P=d.getMinMaxForTile(c);P&&P.max>T&&(T=P.max)}const M=a.aa(u.x,p,g)-u.x,S=a.aa(u.y,x,b)-u.y,C=a.bl(T,r.center.lat)-u.z;return r._zoomFromMercatorZ(Math.sqrt(M*M+S*S+C*C))}function ou(c,r,o,u,d,p,g){const x=c.context,b=c.renderPass==="shadow",T=c.shadowRenderer,M=b&&T?T.getShadowPassDepthMode():new dt(x.gl.LEQUAL,dt.ReadWrite,c.depthRangeFor3D),S=c.isTileAffectedByFog(p);if(o.meshes)for(const C of o.meshes){const P=["MODEL_POSITION_ON_GPU"],k=[];let R,O,D;u.instancedDataArray.length>20&&P.push("INSTANCED_ARRAYS");const F=no(c,r.paint.get("model-cutoff-fade-range"));if(F.shouldRenderCutoff&&P.push("RENDER_CUTOFF"),b&&T)R=c.getOrCreateProgram("modelDepth",{defines:P}),O=ua(g.shadowTileMatrix,g.shadowTileMatrix,Float32Array.from(o.matrix)),D=T.getShadowPassColorMode();else{Ci(P,k,C,c),R=c.getOrCreateProgram("model",{defines:P,overrideFog:S});const V=C.material,q=V.pbrMetallicRoughness,B=r.paint.get("model-opacity"),$=r.paint.get("model-emissive-strength").constantOr(0);O=pl(p.expandedProjMatrix,Float32Array.from(o.matrix),new Float32Array(16),c,B,q.baseColorFactor,V.emissiveFactor,q.metallicFactor,q.roughnessFactor,V,$,r,d),T&&(g.shadowUniformsInitialized?R.setShadowUniformValues(x,T.getShadowUniformValues()):(T.setupShadows(p.toUnwrapped(),R,"model-tile",p.overscaledZ),g.shadowUniformsInitialized=!0)),D=F.shouldRenderCutoff||B<1||V.alphaMode!=="OPAQUE"?Rt.alphaBlended:Rt.unblended}c.uploadCommonUniforms(x,R,p.toUnwrapped(),null,F);const Z=C.material.doubleSided?ft.disabled:ft.backCCW;if(u.instancedDataArray.length>20)k.push(u.instancedDataBuffer),R.draw(c,x.gl.TRIANGLES,M,yt.disabled,D,Z,O,r.id,C.vertexBuffer,C.indexBuffer,C.segments,r.paint,c.transform.zoom,void 0,k,u.instancedDataArray.length);else{const V=b?"u_instance":"u_normal_matrix";for(let q=0;q<u.instancedDataArray.length;++q)O[V]=new Float32Array(u.instancedDataArray.arrayBuffer,64*q,16),R.draw(c,x.gl.TRIANGLES,M,yt.disabled,D,Z,O,r.id,C.vertexBuffer,C.indexBuffer,C.segments,r.paint,c.transform.zoom,void 0,k)}}if(o.children)for(const C of o.children)ou(c,r,C,u,d,p,g)}const Ms=[1,-1,1];function ff(c,r,o,u){if(!o.modelManager)return!0;const d=o.modelManager;if(!o.shadowRenderer)return!0;const p=o.shadowRenderer,g=r.aabb;let x=!0,b=c.maxHeight;if(b===0){let M=0;for(const S in c.instancesPerModel){const C=d.getModel(S,u);C?M=Math.max(M,Math.max(Math.max(C.aabb.max[0],C.aabb.max[1]),C.aabb.max[2])):x=!1}b=c.maxScale*M*1.41+c.maxVerticalOffset,x&&(c.maxHeight=b)}g.max[2]=b,g.min[2]+=c.terrainElevationMin,g.max[2]+=c.terrainElevationMax,a.N.transformMat4(g.min,g.min,r.tileMatrix),a.N.transformMat4(g.max,g.max,r.tileMatrix);const T=g.intersects(p.getCurrentCascadeFrustum());return o.currentShadowCascade===0&&(c.isInsideFirstShadowMapFrustum=T===2),T===0}class pf{}class Ch{constructor(){this._storage=new Map}
2107getLinesFromTrianglesBuffer(r,o,u){{const S=this._storage.get(o.id);if(S)return S.lastUsedFrameIdx=r,S.buf}const d=u.gl,p=d.getBufferParameter(d.ELEMENT_ARRAY_BUFFER,d.BUFFER_SIZE),g=new ArrayBuffer(p),x=new Int16Array(g);d.getBufferSubData(d.ELEMENT_ARRAY_BUFFER,0,new Int16Array(g));const b=new a.cW;for(let S=0;S<p/2;S+=3){const C=x[S],P=x[S+1],k=x[S+2];b.emplaceBack(C,P),b.emplaceBack(P,k),b.emplaceBack(k,C)}const T=u.bindVertexArrayOES.current,M=new pf;return M.buf=new gi(u,b),M.lastUsedFrameIdx=r,this._storage.set(o.id,M),u.bindVertexArrayOES.set(T),M.buf}update(r){for(const[o,u]of this._storage)r-u.lastUsedFrameIdx>30&&(u.buf.destroy(),this._storage.delete(o))}destroy(){for(const[r,o]of this._storage)o.buf.destroy(),this._storage.delete(r)}}class ma{registerParameter(r,o,u,d,p){}registerButton(r,o,u){}}const _a={symbol:function(c,r,o,u,d){if(c.renderPass!=="translucent")return;const p=yt.disabled,g=c.colorModeForRenderPass();o.layout.get("text-variable-anchor")&&function(T,M,S,C,P,k,R){const O=M.transform,D=P==="map",F=k==="map";for(const Z of T){const V=C.getTile(Z),q=V.getBucket(S);if(!q||!q.text||!q.text.segments.get().length)continue;const B=a.b5(q.textSizeData,O.zoom),$=Ks(Z,q.getProjection(),O),Y=O.calculatePixelsToTileUnitsMatrix(V),K=Xs($,V.tileID.canonical,F,D,O,q.getProjection(),Y),ee=q.hasIconTextFit()&&q.hasIconData();if(B){const ce=Math.pow(2,O.zoom-V.tileID.overscaledZ);Th(q,D,F,R,a.cx,O,K,Z,ce,B,ee)}}}(u,c,o,r,o.layout.get("text-rotation-alignment"),o.layout.get("text-pitch-alignment"),d);const x=o.paint.get("icon-opacity").constantOr(1)!==0,b=o.paint.get("text-opacity").constantOr(1)!==0;o.layout.get("symbol-sort-key").constantOr(1)!==void 0&&(x||b)?ml(c,r,o,u,p,g):(x&&ml(c,r,o,u,p,g,{onlyIcons:!0}),b&&ml(c,r,o,u,p,g,{onlyText:!0})),r.map.showCollisionBoxes&&(ln(c,r,o,u,o.paint.get("text-translate"),o.paint.get("text-translate-anchor"),!0),ln(c,r,o,u,o.paint.get("icon-translate"),o.paint.get("icon-translate-anchor"),!1))},circle:function(c,r,o,u){if(c.renderPass!=="translucent")return;const d=o.paint.get("circle-opacity"),p=o.paint.get("circle-stroke-width"),g=o.paint.get("circle-stroke-opacity"),x=o.layout.get("circle-sort-key").constantOr(1)!==void 0,b=o.paint.get("circle-emissive-strength");if(d.constantOr(1)===0&&(p.constantOr(1)===0||g.constantOr(1)===0))return;const T=c.context,M=T.gl,S=c.transform,C=c.depthModeForSublayer(0,dt.ReadOnly),P=yt.disabled,k=c.colorModeForDrapableLayerRenderPass(b),R=S.projection.name==="globe",O=[a.a5(S.center.lng),a.ae(S.center.lat)],D=[];for(let Z=0;Z<u.length;Z++){const V=u[Z],q=r.getTile(V),B=q.getBucket(o);if(!B||B.projection.name!==S.projection.name)continue;const $=B.programConfigurations.get(o.id),Y=a.cy(o),K=c.isTileAffectedByFog(V);R&&Y.push("PROJECTION_GLOBE_VIEW");const ee=c.getOrCreateProgram("circle",{config:$,defines:Y,overrideFog:K}),ce=B.layoutVertexBuffer,re=B.globeExtVertexBuffer,me=B.indexBuffer,fe=S.projection.createInversionMatrix(S,V.canonical),Ae={programConfiguration:$,program:ee,layoutVertexBuffer:ce,globeExtVertexBuffer:re,indexBuffer:me,uniformValues:a.cz(c,V,q,fe,O,o),tile:q};if(x){const ne=B.segments.get();for(const he of ne)D.push({segments:new a.aB([he]),sortKey:he.sortKey,state:Ae})}else D.push({segments:B.segments,sortKey:0,state:Ae})}x&&D.sort((Z,V)=>Z.sortKey-V.sortKey);const F={useDepthForOcclusion:S.depthOcclusionForSymbolsAndCircles};for(const Z of D){const{programConfiguration:V,program:q,layoutVertexBuffer:B,globeExtVertexBuffer:$,indexBuffer:Y,uniformValues:K,tile:ee}=Z.state,ce=Z.segments;c.terrain&&c.terrain.setupElevationDraw(ee,q,F),c.uploadCommonUniforms(T,q,ee.tileID.toUnwrapped()),q.draw(c,M.TRIANGLES,C,P,k,ft.disabled,K,o.id,B,Y,ce,o.paint,S.zoom,V,[$])}},heatmap:function(c,r,o,u){if(o.paint.get("heatmap-opacity")!==0)if(c.renderPass==="offscreen"){const d=c.context,p=d.gl,g=yt.disabled,x=new Rt([p.ONE,p.ONE,p.ONE,p.ONE],a.ax.transparent,[!0,!0,!0,!0]);(function(P,k,R,O){const D=P.gl,F=k.width*O,Z=k.height*O;P.activeTexture.set(D.TEXTURE1),P.viewport.set([0,0,F,Z]);let V=R.heatmapFbo;if(!V||V&&(V.width!==F||V.height!==Z)){V&&V.destroy();const q=D.createTexture();D.bindTexture(D.TEXTURE_2D,q),D.texParameteri(D.TEXTURE_2D,D.TEXTURE_WRAP_S,D.CLAMP_TO_EDGE),D.texParameteri(D.TEXTURE_2D,D.TEXTURE_WRAP_T,D.CLAMP_TO_EDGE),D.texParameteri(D.TEXTURE_2D,D.TEXTURE_MIN_FILTER,D.LINEAR),D.texParameteri(D.TEXTURE_2D,D.TEXTURE_MAG_FILTER,D.LINEAR),V=R.heatmapFbo=P.createFramebuffer(F,Z,!0,null),function(B,$,Y,K,ee,ce){const re=B.gl;re.texImage2D(re.TEXTURE_2D,0,B.extRenderToTextureHalfFloat?re.RGBA16F:re.RGBA,ee,ce,0,re.RGBA,B.extRenderToTextureHalfFloat?re.HALF_FLOAT:re.UNSIGNED_BYTE,null),K.colorAttachment.set(Y)}(P,0,q,V,F,Z)}else D.bindTexture(D.TEXTURE_2D,V.colorAttachment.get()),P.bindFramebuffer.set(V.framebuffer)}
2107)(d,c,o,c.transform.projection.name==="globe"?.5:.25),d.clear({color:a.ax.transparent});const b=c.transform,T=b.projection.name==="globe",M=T?["PROJECTION_GLOBE_VIEW"]:[],S=T?ft.frontCCW:ft.disabled,C=[a.a5(b.center.lng),a.ae(b.center.lat)];for(let P=0;P<u.length;P++){const k=u[P];if(r.hasRenderableParent(k))continue;const R=r.getTile(k),O=R.getBucket(o);if(!O||O.projection.name!==b.projection.name)continue;const D=c.isTileAffectedByFog(k),F=O.programConfigurations.get(o.id),Z=c.getOrCreateProgram("heatmap",{config:F,defines:M,overrideFog:D}),{zoom:V}=c.transform;c.terrain&&c.terrain.setupElevationDraw(R,Z),c.uploadCommonUniforms(d,Z,k.toUnwrapped());const q=b.projection.createInversionMatrix(b,k.canonical);Z.draw(c,p.TRIANGLES,dt.disabled,g,x,S,Zc(c,k,R,q,C,V,o.paint.get("heatmap-intensity")),o.id,O.layoutVertexBuffer,O.indexBuffer,O.segments,o.paint,c.transform.zoom,F,T?[O.globeExtVertexBuffer]:null)}d.viewport.set([0,0,c.width,c.height])}else c.renderPass==="translucent"&&(c.context.setColorMode(c.colorModeForRenderPass()),function(d,p){const g=d.context,x=g.gl,b=p.heatmapFbo;if(!b)return;g.activeTexture.set(x.TEXTURE0),x.bindTexture(x.TEXTURE_2D,b.colorAttachment.get()),g.activeTexture.set(x.TEXTURE1);let T=p.colorRampTexture;T||(T=p.colorRampTexture=new a.T(g,p.colorRamp,x.RGBA)),T.bind(x.LINEAR,x.CLAMP_TO_EDGE),d.getOrCreateProgram("heatmapTexture").draw(d,x.TRIANGLES,dt.disabled,yt.disabled,d.colorModeForRenderPass(),ft.disabled,((M,S,C,P)=>({u_image:0,u_color_ramp:1,u_opacity:S.paint.get("heatmap-opacity")}))(0,p),p.id,d.viewportBuffer,d.quadTriangleIndexBuffer,d.viewportSegments,p.paint,d.transform.zoom)}(c,o))},line:function(c,r,o,u){if(c.renderPass!=="translucent")return;const d=o.paint.get("line-opacity"),p=o.paint.get("line-width");if(d.constantOr(1)===0||p.constantOr(1)===0)return;const g=o.paint.get("line-emissive-strength"),x=c.depthModeForSublayer(0,dt.ReadOnly),b=c.colorModeForDrapableLayerRenderPass(g),T=c.terrain&&c.terrain.renderingToTexture?1:a.f.devicePixelRatio,M=o.paint.get("line-dasharray"),S=M.constantOr(1),C=o.layout.get("line-cap"),P=o.paint.get("line-pattern"),k=P.constantOr(1),R=o.paint.get("line-pattern").constantOr(1),O=o.paint.get("line-opacity").constantOr(1)!==1;let D=!R&&O;const F=o.paint.get("line-gradient"),Z=k?"linePattern":"line",V=c.context,q=V.gl,B=a.cA(o);c.terrain&&c.terrain.clipOrMaskOverlapStencilType()&&(D=!1);for(const $ of u){const Y=r.getTile($);if(k&&!Y.patternsLoaded())continue;const K=Y.getBucket(o);if(!K)continue;c.prepareDrawTile();const ee=K.programConfigurations.get(o.id),ce=c.isTileAffectedByFog($),re=c.getOrCreateProgram(Z,{config:ee,defines:B,overrideFog:ce}),me=P.constantOr(null);if(me&&Y.imageAtlas){const Re=Y.imageAtlas.patternPositions[me.toString()];Re&&ee.setConstantPatternPositions(Re)}const fe=M.constantOr(null),Ae=C.constantOr(null);if(!k&&fe&&Ae&&Y.lineAtlas){const Re=Y.lineAtlas.getDash(fe,Ae);Re&&ee.setConstantPatternPositions(Re)}let[ne,he]=o.paint.get("line-trim-offset");(Ae==="round"||Ae==="square")&&ne!==he&&(ne===0&&(ne-=1),he===1&&(he+=1));const Q=c.terrain?$.projMatrix:null,ae=k?a.cB(c,Y,o,Q,T,[ne,he]):a.cC(c,Y,o,Q,K.lineClipsArray.length,T,[ne,he]);if(F){const Re=K.gradients[o.id];let Le=Re.texture;if(o.gradientVersion!==Re.version){let je=256;if(o.stepInterpolant){const et=r.getSource().maxzoom,ct=$.canonical.z===et?Math.ceil(1<<c.transform.maxZoom-$.canonical.z):1;je=a.aa(a.cD(K.maxLineLength/a.V*1024*ct),256,V.maxTextureSize)}Re.gradient=a.cE({expression:o.gradientExpression(),evaluationKey:"lineProgress",resolution:je,image:Re.gradient||void 0,clips:K.lineClipsArray}),Re.texture?Re.texture.update(Re.gradient):Re.texture=new a.T(V,Re.gradient,q.RGBA),Re.version=o.gradientVersion,Le=Re.texture}V.activeTexture.set(q.TEXTURE1),Le.bind(o.stepInterpolant?q.NEAREST:q.LINEAR,q.CLAMP_TO_EDGE)}S&&(V.activeTexture.set(q.TEXTURE0),Y.lineAtlasTexture&&Y.lineAtlasTexture.bind(q.LINEAR,q.REPEAT),ee.updatePaintBuffers()),k&&(V.activeTexture.set(q.TEXTURE0),Y.imageAtlasTexture&&Y.imageAtlasTexture.bind(q.LINEAR,q.CLAMP_TO_EDGE),ee.updatePaintBuffers()),c.uploadCommonUniforms(V,re,$.toUnwrapped());
2107const Ie=Re=>{re.draw(c,q.TRIANGLES,x,Re,b,ft.disabled,ae,o.id,K.layoutVertexBuffer,K.indexBuffer,K.segments,o.paint,c.transform.zoom,ee,[K.layoutVertexBuffer2])};if(D){const Re=c.stencilModeForClipping($).ref;Re===0&&c.terrain&&V.clear({stencil:0});const Le={func:q.EQUAL,mask:255};ae.u_alpha_discard_threshold=.8,Ie(new yt(Le,Re,255,q.KEEP,q.KEEP,q.INVERT)),ae.u_alpha_discard_threshold=0,Ie(new yt(Le,Re,255,q.KEEP,q.KEEP,q.KEEP))}else Ie(c.stencilModeForClipping($))}D&&(c.resetStencilClippingMasks(),c.terrain&&V.clear({stencil:0}))},fill:function(c,r,o,u){const d=o.paint.get("fill-color"),p=o.paint.get("fill-opacity");if(p.constantOr(1)===0)return;const g=o.paint.get("fill-emissive-strength"),x=c.colorModeForDrapableLayerRenderPass(g),b=o.paint.get("fill-pattern"),T=c.opaquePassEnabledForLayer()&&!b.constantOr(1)&&d.constantOr(a.ax.transparent).a===1&&p.constantOr(0)===1?"opaque":"translucent";if(c.renderPass===T){const M=c.depthModeForSublayer(1,c.renderPass==="opaque"?dt.ReadWrite:dt.ReadOnly);No(c,r,o,u,M,x,!1)}if(c.renderPass==="translucent"&&o.paint.get("fill-antialias")){const M=c.depthModeForSublayer(o.getPaintProperty("fill-outline-color")?2:0,dt.ReadOnly);No(c,r,o,u,M,x,!0)}},"fill-extrusion":function(c,r,o,u){const d=o.paint.get("fill-extrusion-opacity"),p=c.context,g=p.gl,x=c.terrain,b=x&&x.renderingToTexture;if(d===0)return;const T=c.conflationActive&&c.layerUsedInConflation(o,r.getSource());if(T&&function(M,S,C,P){for(const k of P){const R=S.getTile(k).getBucket(C);R&&(R.updateReplacement(k,M.replacementSource),R.uploadCentroid(M.context))}}(c,r,o,u),x||T)for(const M of u){const S=r.getTile(M).getBucket(o);S&&uf(c.context,r,M,S,o,x,T)}if(c.renderPass==="shadow"&&c.shadowRenderer){const M=c.shadowRenderer;if(x&&d<.65&&o._transitionablePaint._values["fill-extrusion-opacity"].value.expression instanceof a.Z)return;const S=M.getShadowPassDepthMode(),C=M.getShadowPassColorMode();it(c,r,o,u,S,yt.disabled,C,T)}else if(c.renderPass==="translucent"){const M=!o.paint.get("fill-extrusion-pattern").constantOr(1),S=o.paint.get("fill-extrusion-color").constantOr(a.ax.white);if(!b&&S.a!==0){const C=new dt(c.context.gl.LEQUAL,dt.ReadWrite,c.depthRangeFor3D);d===1&&M?it(c,r,o,u,C,yt.disabled,Rt.unblended,T):(it(c,r,o,u,C,yt.disabled,Rt.disabled,T),it(c,r,o,u,C,c.stencilModeFor3D(),c.colorModeForRenderPass(),T),c.resetStencilClippingMasks())}if(c.style.enable3dLights()&&M&&(!x&&c.transform.projection.name!=="globe"||b)){const C=o.paint.get("fill-extrusion-opacity"),P=o.paint.get("fill-extrusion-ambient-occlusion-intensity"),k=o.paint.get("fill-extrusion-ambient-occlusion-ground-radius"),R=o.paint.get("fill-extrusion-flood-light-intensity"),O=o.paint.get("fill-extrusion-flood-light-color").toArray01().slice(0,3),D=P>0&&k>0,F=R>0,Z=(q,B,$)=>(1-$)*q+$*B,V=q=>{const B=c.depthModeForSublayer(1,dt.ReadOnly,g.LEQUAL,!0),$=o.paint.get(q?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"),Y=Z(.1,3,$),K=c._showOverdrawInspector;if(!K){const ee=new yt({func:g.ALWAYS,mask:255},255,255,g.KEEP,g.KEEP,g.REPLACE),ce=new Rt([g.ONE,g.ONE,g.ONE,g.ONE],a.ax.transparent,[!1,!1,!1,!0],g.MIN);lo(c,r,o,u,B,ee,ce,ft.disabled,q,"sdf",C,P,k,R,O,Y,T,!1)}{const ee=K?yt.disabled:new yt({func:g.EQUAL,mask:255},255,255,g.KEEP,g.DECR,g.DECR),ce=K?c.colorModeForRenderPass():new Rt([g.ONE_MINUS_DST_ALPHA,g.DST_ALPHA,g.ONE,g.ONE],a.ax.transparent,[!0,!0,!0,!0]);lo(c,r,o,u,B,ee,ce,ft.disabled,q,"color",C,P,k,R,O,Y,T,!1)}};if(b){const q=(B,$,Y)=>{const K=c.depthModeForSublayer(1,dt.ReadOnly,g.LEQUAL,!1),ee=o.paint.get(B?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"),ce=Z(.1,3,ee);{const re=new Rt([g.ONE,g.ONE,g.ONE,g.ONE],a.ax.transparent,[!1,!1,!1,!0]);lo(c,r,o,u,K,yt.disabled,re,ft.disabled,B,"clear",C,P,k,R,O,ce,T,$)}{const re=new yt({func:g.ALWAYS,mask:255},255,255,g.KEEP,g.KEEP,g.REPLACE),me=new Rt([g.ONE,g.ONE,g.ONE,g.ONE],a.ax.transparent,[!1,!1,!1,!0],g.MIN);lo(c,r,o,u,K,re,me,ft.disabled,B,"sdf",C,P,k,R,O,ce,T,$)}{const re=B?g.ZERO:g.ONE_MINUS_DST_ALPHA,me=new yt({func:g.EQUAL,mask:255},255,255,g.KEEP,g.DECR,g.DECR),fe=new Rt([re,g.DST_ALPHA,g.ONE_MINUS_DST_ALPHA,g.ZERO],a.ax.transparent,[!0,!0,!0,!0]);lo(c,r,o,u,K,me,fe,ft.disabled,B,"color",C,P,k,R,O,ce,T,$)}{const re=new Rt([g.ONE,g.ONE,g.ONE,B?g.ZERO:g.ONE],a.ax.transparent,[!1,!1,!1,!0],B?g.FUNC_ADD:g.MAX);lo(c,r,o,u,K,yt.disabled,re,ft.disabled,B,"clear",C,P,k,R,O,ce,T,$,Y)}};if(D||F){let B;if(c.prepareDrawTile(),x){const $=x.drapeBufferSize[0],Y=x.drapeBufferSize[1];B=x.framebufferCopyTexture,B&&(!B||B.size[0]===$&&B.size[1]===Y)||(B&&B.destroy(),B=x.framebufferCopyTexture=new a.T(p,new a.h({width:$,height:Y}),g.RGBA)),B.bind(g.LINEAR,g.CLAMP_TO_EDGE),g.copyTexImage2D(g.TEXTURE_2D,0,g.RGBA,0,0,$,Y,0)}D&&q(!0,!1,B),F&&q(!1,!0,B)}}else D&&V(!0),F&&V(!1)}}},hillshade:function(c,r,o,u){if(c.renderPass!=="offscreen"&&c.renderPass!=="translucent"||c.style.disableElevatedTerrain)return;const d=c.context,p=c.terrain&&c.terrain.renderingToTexture,[g,x]=c.renderPass!=="translucent"||p?[{},u]:c.stencilConfigForOverlap(u);for(const b of x){const T=r.getTile(b);
vendor: 1,335 bytes, line 2107
2107if(T.needsHillshadePrepare&&c.renderPass==="offscreen")zc(c,T,o);else if(c.renderPass==="translucent"){const M=c.depthModeForSublayer(0,dt.ReadOnly),S=o.paint.get("hillshade-emissive-strength"),C=c.colorModeForDrapableLayerRenderPass(S),P=p&&c.terrain?c.terrain.stencilModeForRTTOverlap(b):g[b.overscaledZ];ll(c,b,T,o,M,P,C)}}d.viewport.set([0,0,c.width,c.height]),c.resetStencilClippingMasks()},raster:function(c,r,o,u,d,p){if(c.renderPass!=="translucent"||o.paint.get("raster-opacity")===0)return;const g=c.transform.projection.name==="globe",x=o.paint.get("raster-elevation")!==0,b=x&&g;if(c.renderElevatedRasterBackface&&!b)return;const T=c.context,M=T.gl,S=r.getSource(),C=function(B,$,Y,K){const ee=$.paint.get("raster-color"),ce=B.type==="raster-array",re=[],me=$.paint.get("raster-resampling"),fe=$.paint.get("raster-color-mix");let Ae=$.paint.get("raster-color-range");const ne=[fe[0],fe[1],fe[2],0],he=fe[3];let Q=me==="nearest"?K.NEAREST:K.LINEAR;if(ce&&(re.push("RASTER_ARRAY"),ee||re.push("RASTER_COLOR"),me==="linear"&&re.push("RASTER_ARRAY_LINEAR"),Q=K.NEAREST,!Ae&&B.rasterLayers)){const ae=B.rasterLayers.find(({id:Ie})=>Ie===$.sourceLayer);ae&&ae.fields&&ae.fields.range&&(Ae=ae.fields.range)}if(Ae=Ae||[0,1],ee){re.push("RASTER_COLOR"),Y.activeTexture.set(K.TEXTURE2),$.updateColorRamp(Ae);let ae=$.colorRampTexture;
2107ae||(ae=$.colorRampTexture=new a.T(Y,$.colorRamp,K.RGBA)),ae.bind(K.LINEAR,K.CLAMP_TO_EDGE)}return{mix:ne,range:Ae,offset:he,defines:re,resampling:Q}}(S,o,T,M);if(S instanceof a.ap&&!u.length&&!g)return;const P=o.paint.get("raster-emissive-strength"),k=c.colorModeForDrapableLayerRenderPass(P),R=c.terrain&&c.terrain.renderingToTexture,O=!c.options.moving,D=o.paint.get("raster-resampling")==="nearest"?M.NEAREST:M.LINEAR;if(S instanceof a.ap&&!u.length&&(S.onNorthPole||S.onSouthPole)){const B=x?c.stencilModeFor3D():yt.disabled;return void Hc(!!S.onNorthPole,null,c,r,o,P,C,ft.disabled,B)}if(!u.length)return;const[F,Z]=S instanceof a.ap||R?[{},u]:c.stencilConfigForOverlap(u),V=Z[Z.length-1].overscaledZ;b&&C.defines.push("PROJECTION_GLOBE_VIEW"),x&&C.defines.push("RENDER_CUTOFF");const q=(B,$,Y)=>{for(const K of B){const ee=K.toUnwrapped(),ce=r.getTile(K);if(R&&(!ce||!ce.hasData()))continue;T.activeTexture.set(M.TEXTURE0);const re=Yc(ce,S,o,C);if(!re||!re.texture)continue;const{texture:me,mix:fe,offset:Ae,tileSize:ne,buffer:he}=re;let Q,ae;R?(Q=dt.disabled,ae=K.projMatrix):x?(Q=new dt(M.LEQUAL,dt.ReadWrite,c.depthRangeFor3D),ae=g?Float32Array.from(c.transform.expandedFarZProjMatrix):c.transform.calculateProjMatrix(ee,O)):(Q=c.depthModeForSublayer(K.overscaledZ-V,o.paint.get("raster-opacity")===1?dt.ReadWrite:dt.ReadOnly,M.LESS),ae=c.transform.calculateProjMatrix(ee,O));const Ie=c.terrain&&R?c.terrain.stencilModeForRTTOverlap(K):F[K.overscaledZ],Re=p?0:o.paint.get("raster-fade-duration");ce.registerFadeDuration(Re);const Le=r.findLoadedParent(K,0),je=kc(ce,Le,r,c.transform,Re);let et,ct;c.terrain&&c.terrain.prepareDrawTile(),T.activeTexture.set(M.TEXTURE0),me.bind(D,M.CLAMP_TO_EDGE),T.activeTexture.set(M.TEXTURE1),Le?(Le.texture&&Le.texture.bind(D,M.CLAMP_TO_EDGE),et=Math.pow(2,Le.tileID.overscaledZ-ce.tileID.overscaledZ),ct=[ce.tileID.canonical.x*et%1,ce.tileID.canonical.y*et%1
2107]):me.bind(D,M.CLAMP_TO_EDGE),me.useMipmap&&T.extTextureFilterAnisotropic&&c.transform.pitch>20&&M.texParameterf(M.TEXTURE_2D,T.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,T.extTextureFilterAnisotropicMax);const nt=c.transform;let at;const Et=x?Xc(nt):[0,0,0,0];let gt,bt,vt,Zt,_i,Ot=0;if(b&&S instanceof a.ap&&S.coordinates.length>3)gt=Float32Array.from(a.aT(a.ci(new a.bs(0,0,0)))),bt=Float32Array.from(nt.globeMatrix),vt=Float32Array.from(a.ce(nt)),Zt=[a.a5(nt.center.lng),a.ae(nt.center.lat)],at=S.elevatedGlobePerspectiveTransform,_i=S.elevatedGlobeGridMatrix||new Float32Array(9);else if(b){const Ft=a.cf(K.canonical);Ot=a.cg(Ft.getCenter().lat),gt=Float32Array.from(a.aT(a.ci(K.canonical))),bt=Float32Array.from(nt.globeMatrix),vt=Float32Array.from(a.ce(nt)),Zt=[a.a5(nt.center.lng),a.ae(nt.center.lat)],at=[0,0],_i=Float32Array.from(a.ch(K.canonical,Ft,Ot,nt.worldSize/nt._pixelsPerMercatorPixel))}else at=S instanceof a.ap?S.perspectiveTransform:[0,0],gt=new Float32Array(16),bt=new Float32Array(9),vt=new Float32Array(16),Zt=[0,0],_i=new Float32Array(9);const Pi=qc(ae,gt,bt,vt,_i,ct||[0,0],a.S(c.transform.zoom),Zt,Et,et||1,je,o,at,x?o.paint.get("raster-elevation"):0,2,fe,Ae,C.range,ne,he,P),Bt=c.isTileAffectedByFog(K),Kt=c.getOrCreateProgram("raster",{defines:C.defines,overrideFog:Bt});if(c.uploadCommonUniforms(T,Kt,ee),S instanceof a.ap){const Ft=S.elevatedGlobeVertexBuffer,Yt=S.elevatedGlobeIndexBuffer;if(R||!g)S.boundsBuffer&&S.boundsSegments&&Kt.draw(c,M.TRIANGLES,Q,yt.disabled,k,ft.disabled,Pi,o.id,S.boundsBuffer,c.quadTriangleIndexBuffer,S.boundsSegments);else if(Ft&&Yt){const xi=nt.zoom<=a.bG?S.elevatedGlobeSegments:S.getSegmentsForLongitude(nt.center.lng);xi&&Kt.draw(c,M.TRIANGLES,Q,yt.disabled,k,$,Pi,o.id,Ft,Yt,xi)}}else if(b){Q=new dt(M.LEQUAL,dt.ReadOnly,c.depthRangeFor3D);const Ft=c.globeSharedBuffers;if(Ft){const[Yt,xi,ii]=Ft.getGridBuffers(Ot,!1);Kt.draw(c,M.TRIANGLES,Q,Y||Ie,c.colorModeForRenderPass(),$,Pi,o.id,Yt,xi,ii)}}else{const{tileBoundsBuffer:Ft,tileBoundsIndexBuffer:Yt,tileBoundsSegments:xi}=c.getTileBoundsBuffers(ce);Kt.draw(c,M.TRIANGLES,Q,Ie,k,ft.disabled,Pi,o.id,Ft,Yt,xi)}}if(!(S instanceof a.ap)&&b)for(const K of B){const ee=K.canonical.y===(1<<K.canonical.z)-1;K.canonical.y===0&&Hc(!0,K,c,r,o,P,C,$,Y||yt.disabled),ee&&Hc(!1,K,c,r,o,P,C,$===ft.frontCW?ft.backCW:ft.frontCW,Y||yt.disabled)}};b?q(Z,c.renderElevatedRasterBackface?ft.backCW:ft.frontCW,c.stencilModeFor3D()):q(Z,ft.disabled,void 0),c.resetStencilClippingMasks()},"raster-particle":function(c,r,o,u,d,p){c.renderPass==="offscreen"&&function(g,x,b,T){if(!T.length)return;const M=g.context,S=M.gl,C=x.getSource();if(!(C instanceof Be))return;const P=[];for(const O of T){const D=x.getTile(O);if(!(D instanceof zo))continue;const F=Kc(D,C,b);if(!F)continue;const Z=[F.tileSize,F.tileSize];let V=b.tileFramebuffer;V||(V=b.tileFramebuffer=M.createFramebuffer(Z[0],Z[1],!0,null));let q=D.rasterParticleState;const B=b.paint.get("raster-particle-count");q||(q=D.rasterParticleState=new $i(M,O,Z,B));const $=q.update(b.lastInvalidatedAt);q.numParticles!==B&&q.setNumParticles(O,B);const Y=q.targetColorTexture;q.targetColorTexture=q.backgroundColorTexture,q.backgroundColorTexture=Y;const K=q.particleVertices0;q.particleVertices0=q.particleVertices1,q.particleVertices1=K,P.push([O,F,q,$])}if(P.length===0)return;const k=a.f.now(),R=b.previousDrawTimestamp?.001*(k-b.previousDrawTimestamp):.0167;if(b.previousDrawTimestamp=k,b.hasColorMap()){M.activeTexture.set(S.TEXTURE0+2);let O=b.colorRampTexture;O||(O=b.colorRampTexture=new a.T(M,b.colorRamp,S.RGBA)),O.bind(S.LINEAR,S.CLAMP_TO_EDGE)}M.bindFramebuffer.set(b.tileFramebuffer.framebuffer),M.activeTexture.set(S.TEXTURE0),function(O,D,F){const Z=O.context,V=Z.gl,q=D.tileFramebuffer;Z.activeTexture.set(V.TEXTURE0);const B={u_texture:0,u_opacity:1.05*(Y=D.paint.get("raster-particle-fade-opacity-factor"))/(Y+.05)},$=O.getOrCreateProgram("rasterParticleTexture",{defines:[],overrideFog:!1});var Y;for(const K of F){const[,,ee,ce]=K;q.colorAttachment.set(ee.targetColorTexture.texture),Z.viewport.set([0,0,q.width,q.height]),Z.clear({color:a.ax.transparent}),ce&&(ee.backgroundColorTexture.bind(V.NEAREST,V.CLAMP_TO_EDGE),$.draw(O,V.TRIANGLES,dt.disabled,yt.disabled,Rt.alphaBlended,ft.disabled,B,D.id,O.viewportBuffer,O.quadTriangleIndexBuffer,O.viewportSegments))}}(g,b,P),function(O,D,F,Z){const V=O.context.gl,q=F.tileFramebuffer,B=O.transform.projection.name==="globe",$=F.paint.get("raster-particle-max-speed");for(const Y of Z){const[K,ee,ce]=Y;ee.texture.bind(V.LINEAR,V.CLAMP_TO_EDGE),q.colorAttachment.set(ce.targetColorTexture.texture);const re=O.getOrCreateProgram("rasterParticleDraw",{defines:ee.defines,overrideFog:!1}),me=ee.scalarData?[]:[0,1,2,3].map(ne=>a.cG[ne](K));me.push(K);const fe=K.canonical.x,Ae=K.canonical.y;for(const ne of me){const he=D.getTile(B?ne.wrapped():ne);if(!he)continue;const Q=he.rasterParticleState;if(!Q)continue;const ae=lf([ne.canonical.x+(1<<ne.canonical.z)*(ne.wrap-K.wrap)-fe,ne.canonical.y-Ae],0,ee.texture.size,2,$,ee.textureOffset,ee.scale,ee.offset);re.draw(O,V.POINTS,dt.disabled,yt.disabled,Rt.alphaBlended,ft.disabled,ae,F.id,Q.particleVertices0,void 0,Q.particleSegment)}}}(g,x,b,P),function(O,D,F,Z){const V=O.context.gl;let q=D.transformFeedbackObject;q||(q=D.transformFeedbackObject=V.createTransformFeedback()),V.bindTransformFeedback(V.TRANSFORM_FEEDBACK,D.transformFeedbackObject);const B=D.paint.get("raster-particle-max-speed"),$=Z*D.paint.get("raster-particle-speed-factor")*.3,Y=(K=D.paint.get("raster-particle-reset-rate-factor"),Math.pow(K,6));var K;for(const ee of F){const[,ce,re]=ee;ce.texture.bind(V.LINEAR,V.CLAMP_TO_EDGE);const me=bh(0,ce.texture.size,B,$,Y,ce.textureOffset,ce.scale,ce.offset);O.getOrCreateProgram("rasterParticleUpdate",{defines:ce.defines,transformFeedback:{bufferMode:V.SEPARATE_ATTRIBS,shaderVaryings:["v_new_particle"]}}).draw(O,V.POINTS,dt.disabled,yt.disabled,Rt.disabled,ft.disabled,me,D.id,re.particleVertices0,void 0,re.particleSegment,{},void 0,void 0,void 0,void 0,[{buffer:re.particleVertices1,targetIndex:0}])}V.bindTransformFeedback(V.TRANSFORM_FEEDBACK,null)}(g,b,P,R)}(c,r,o,u),c.renderPass==="translucent"&&(function(g,x,b,T,M){const S=g.context,C=S.gl,P=!g.options.moving,k=g.transform.projection.name==="globe";if(!T.length)return;const[R,O]=g.stencilConfigForOverlap(T),D=[];k&&D.push("PROJECTION_GLOBE_VIEW");for(const F of O){const Z=F.toUnwrapped(),V=x.getTile(F);if(!V.rasterParticleState)continue;const q=V.rasterParticleState,B=100;V.registerFadeDuration(B);const $=x.findLoadedParent(F,0),Y=kc(V,$,x,g.transform,B);let K,ee;g.terrain&&g.terrain.prepareDrawTile(),S.activeTexture.set(C.TEXTURE0),q.targetColorTexture.bind(C.LINEAR,C.CLAMP_TO_EDGE),S.activeTexture.set(C.TEXTURE1),$&&$.rasterParticleState?($.rasterParticleState.targetColorTexture.bind(C.LINEAR,C.CLAMP_TO_EDGE),K=Math.pow(2,$.tileID.overscaledZ-V.tileID.overscaledZ
vendor: 7,558 bytes, line 2107
2107),ee=[V.tileID.canonical.x*K%1,V.tileID.canonical.y*K%1]):q.targetColorTexture.bind(C.LINEAR,C.CLAMP_TO_EDGE);const ce=k?Float32Array.from(g.transform.expandedFarZProjMatrix):g.transform.calculateProjMatrix(Z,P),re=g.transform,me=Jc(re),fe=a.cf(F.canonical),Ae=a.cg(fe.getCenter().lat);let ne,he,Q,ae,Ie;k?(ne=Float32Array.from(a.aT(a.ci(F.canonical))),he=Float32Array.from(re.globeMatrix),Q=Float32Array.from(a.ce(re)),ae=[a.a5(re.center.lng),a.ae(re.center.lat)],Ie=Float32Array.from(a.ch(F.canonical,fe,Ae,re.worldSize/re._pixelsPerMercatorPixel))):(ne=new Float32Array(16),he=new Float32Array(9),Q=new Float32Array(16),ae=[0,0],Ie=new Float32Array(9));const Re=af(ce,ne,he,Q,Ie,ee||[0,0],a.S(g.transform.zoom),ae,me,K||1,Y,250),Le=g.isTileAffectedByFog(F),je=g.getOrCreateProgram("rasterParticle",{defines:D,overrideFog:Le});if(g.uploadCommonUniforms(S,je,Z),k){const et=new dt(C.LEQUAL,dt.ReadWrite,g.depthRangeFor3D),ct=0,nt=g.globeSharedBuffers;if(nt){const[at,Et,gt]=nt.getGridBuffers(Ae,ct!==0);je.draw(g,C.TRIANGLES,et,yt.disabled,Rt.alphaBlended,ft.backCCW,Re,b.id,at,Et,gt)}}else{const et=g.depthModeForSublayer(0,dt.ReadOnly),ct=R[F.overscaledZ],{tileBoundsBuffer:nt,tileBoundsIndexBuffer:at,tileBoundsSegments:Et}=g.getTileBoundsBuffers(V);je.draw(g,C.TRIANGLES,et,ct,Rt.alphaBlended,ft.disabled,Re,b.id,nt,at,Et)}}g.resetStencilClippingMasks()}(c,r,o,u),c.style.map.triggerRepaint())},background:function(c,r,o,u){const d=o.paint.get("background-color"),p=o.paint.get("background-opacity"),g=o.paint.get("background-emissive-strength");if(p===0)return;const x=c.context,b=x.gl,T=c.transform,M=T.tileSize,S=o.paint.get("background-pattern");if(c.isPatternMissing(S,o.scope))return;const C=!S&&d.a===1&&p===1&&c.opaquePassEnabledForLayer()?"opaque":"translucent";if(c.renderPass!==C)return;const P=yt.disabled,k=c.depthModeForSublayer(0,C==="opaque"?dt.ReadWrite:dt.ReadOnly),R=c.colorModeForDrapableLayerRenderPass(g),O=S?"backgroundPattern":"background";let D,F=u;F||(D=c.getBackgroundTiles(),F=Object.values(D).map(Z=>Z.tileID)),S&&(x.activeTexture.set(b.TEXTURE0),c.imageManager.bind(c.context,o.scope));for(const Z of F){const V=c.isTileAffectedByFog(Z),q=c.getOrCreateProgram(O,{overrideFog:V}),B=Z.toUnwrapped(),$=u?Z.projMatrix:c.transform.calculateProjMatrix(B);c.prepareDrawTile();const Y=r?r.getTile(Z):D?D[Z.key]:new Jn(Z,M,T.zoom,c),K=S?la($,g,p,c,S,o.scope,{tileID:Z,tileSize:M}):$c($,g,p,d);c.uploadCommonUniforms(x,q,B);const{tileBoundsBuffer:ee,tileBoundsIndexBuffer:ce,tileBoundsSegments:re}=c.getTileBoundsBuffers(Y);q.draw(c,b.TRIANGLES,k,P,R,ft.disabled,K,o.id,ee,ce,re)}},sky:function(c,r,o){const u=c._atmosphere?a.S(c.transform.zoom):1,d=o.paint.get("sky-opacity")*u;if(d===0)return;const p=c.context,g=o.paint.get("sky-type"),x=new dt(p.gl.LEQUAL,dt.ReadOnly,[0,1]),b=c.frameCounter/1e3%1;g==="atmosphere"?c.renderPass==="offscreen"?o.needsSkyboxCapture(c)&&(function(T,M,S,C){const P=T.context,k=P.gl;let R=M.skyboxFbo;if(!R){R=M.skyboxFbo=P.createFramebuffer(32,32,!0,null),M.skyboxGeometry=new ru(P),M.skyboxTexture=P.gl.createTexture(),k.bindTexture(k.TEXTURE_CUBE_MAP,M.skyboxTexture),k.texParameteri(k.TEXTURE_CUBE_MAP,k.TEXTURE_WRAP_S,k.CLAMP_TO_EDGE),k.texParameteri(k.TEXTURE_CUBE_MAP,k.TEXTURE_WRAP_T,k.CLAMP_TO_EDGE),k.texParameteri(k.TEXTURE_CUBE_MAP,k.TEXTURE_MIN_FILTER,k.LINEAR),k.texParameteri(k.TEXTURE_CUBE_MAP,k.TEXTURE_MAG_FILTER,k.LINEAR);for(let Z=0;Z<6;++Z)k.texImage2D(k.TEXTURE_CUBE_MAP_POSITIVE_X+Z,0,k.RGBA,32,32,0,k.RGBA,k.UNSIGNED_BYTE,null)}P.bindFramebuffer.set(R.framebuffer),P.viewport.set([0,0,32,32]);const O=M.getCenter(T,!0),D=T.getOrCreateProgram("skyboxCapture"),F=new Float64Array(16);a.a6.identity(F),a.a6.rotateY(F,F,.5*-Math.PI),Vo(T,M,D,F,O,0),a.a6.identity(F),a.a6.rotateY(F,F,.5*Math.PI),Vo(T,M,D,F,O,1),a.a6.identity(F),a.a6.rotateX(F,F,.5*-Math.PI),Vo(T,M,D,F,O,2),a.a6.identity(F),a.a6.rotateX(F,F,.5*Math.PI),Vo(T,M,D,F,O,3),a.a6.identity(F),Vo(T,M,D,F,O,4),a.a6.identity(F),a.a6.rotateY(F,F,Math.PI),Vo(T,M,D,F,O,5),P.viewport.set([0,0,T.width,T.height])}(c,o),o.markSkyboxValid(c)):c.renderPass==="sky"&&function(T,M,S,C,P){const k=T.context,R=k.gl,O=T.transform,D=T.getOrCreateProgram("skybox");k.activeTexture.set(R.TEXTURE0),R.bindTexture(R.TEXTURE_CUBE_MAP,M.skyboxTexture);const F=((Z,V,q,B,$)=>({u_matrix:Z,u_sun_direction:V,u_cubemap:0,u_opacity:B,u_temporal_offset:$}))(O.skyboxMatrix,M.getCenter(T,!1),0,C,P);T.uploadCommonUniforms(k,D),D.draw(T,R.TRIANGLES,S,yt.disabled,T.colorModeForRenderPass(),ft.backCW,F,"skybox",M.skyboxGeometry.vertexBuffer,M.skyboxGeometry.indexBuffer,M.skyboxGeometry.segment)}(c,o,x,d,b):g==="gradient"&&c.renderPass==="sky"&&function(T,M,S,C,P){const k=T.context,R=k.gl,O=T.transform,D=T.getOrCreateProgram("skyboxGradient");M.skyboxGeometry||(M.skyboxGeometry=new ru(k)),k.activeTexture.set(R.TEXTURE0);let F=M.colorRampTexture;F||(F=M.colorRampTexture=new a.T(k,M.colorRamp,R.RGBA)),F.bind(R.LINEAR,R.CLAMP_TO_EDGE);const Z=((V,q,B,$,Y)=>({u_matrix:V,u_color_ramp:0,u_center_direction:q,u_radius:a.bj(B),u_opacity:$,u_temporal_offset:Y}))(O.skyboxMatrix,M.getCenter(T,!1),M.paint.get("sky-gradient-radius"),C,P);T.uploadCommonUniforms(k,D),D.draw(T,R.TRIANGLES,S,yt.disabled,T.colorModeForRenderPass(),ft.backCW,Z,"skyboxGradient",M.skyboxGeometry.vertexBuffer,M.skyboxGeometry.indexBuffer,M.skyboxGeometry.segment)}(c,o,x,d,b)},debug:function(c,r,o,u,d,p){for(let g=0;g<o.length;g++)if(d){const T=new a.ax(u.r*.8,u.g*.8,u.b*.8,1);uo(c,r,o[g],u,-1,-1,p),uo(c,r,o[g],u,-1,1,p),uo(c,r,o[g],u,1,1,p),uo(c,r,o[g],u,1,-1,p),uo(c,r,o[g],T,0,0,p)}else uo(c,r,o[g],u,0,0,p)},custom:function(c,r,o,u){const d=c.context,p=o.implementation;if(!c.transform.projection.unsupportedLayers||!c.transform.projection.unsupportedLayers.includes("custom")||c.terrain&&(c.terrain.renderingToTexture||c.renderPass==="offscreen")&&o.isLayerDraped(r)){if(c.renderPass==="offscreen"){const g=p.prerender;if(g){if(c.setCustomLayerDefaults(),d.setColorMode(c.colorModeForRenderPass()),c.transform.projection.name==="globe"){const x=c.transform.pointMerc;g.call(p,d.gl,c.transform.customLayerMatrix(),c.transform.getProjection(),c.transform.globeToMercatorMatrix(),a.S(c.transform.zoom),[x.x,x.y],c.transform.pixelsPerMeterRatio)}else g.call(p,d.gl,c.transform.customLayerMatrix());d.setDirty(),c.setBaseState()}}else if(c.renderPass==="translucent"){if(c.terrain&&c.terrain.renderingToTexture){const x=p.renderToTile;if(x){const b=u[0].canonical,T=new a.L(b.x+u[0].wrap*(1<<b.z),b.y,b.z);d.setDepthMode(dt.disabled),d.setStencilMode(yt.disabled),d.setColorMode(c.colorModeForRenderPass()),c.setCustomLayerDefaults(),x.call(p,d.gl,T),d.setDirty(),c.setBaseState()}return}c.setCustomLayerDefaults(),d.setColorMode(c.colorModeForRenderPass()),d.setStencilMode(yt.disabled);const g=p.renderingMode==="3d"?new dt(c.context.gl.LEQUAL,dt.ReadWrite,c.depthRangeFor3D):c.depthModeForSublayer(0,dt.ReadOnly);if(d.setDepthMode(g),c.transform.projection.name==="globe"){const x=c.transform.pointMerc;p.render(d.gl,c.transform.customLayerMatrix(),c.transform.getProjection(),c.transform.globeToMercatorMatrix(),a.S(c.transform.zoom),[x.x,x.y],c.transform.pixelsPerMeterRatio)}else p.render(d.gl,c.transform.customLayerMatrix());d.setDirty(),c.setBaseState(),d.bindFramebuffer.set(null)}}else a.w("Custom layers are not yet supported with this projection. Use mercator or globe to enable usage of custom layers.")},model:function(c,r,o,u){if(c.renderPass==="opaque")return;const d=o.paint.get("model-opacity");if(d===0)return;const p=o.paint.get("model-cast-shadows");
2107if(c.renderPass==="shadow"&&(!p||c.terrain&&d<.65&&o._transitionablePaint._values["model-opacity"].value.expression instanceof a.Z))return;const g=c.shadowRenderer,x=o.paint.get("model-receive-shadows");g&&(g.useNormalOffset=!0,x||(g.enabled=!1));const b=()=>{g&&(g.useNormalOffset=!0,x||(g.enabled=!0))},T=r.getSource();if(c.renderPass==="light-beam"&&T.type!=="batched-model")return;if(T.type==="vector"||T.type==="geojson")return function(D,F,Z,V){const q=D.transform;if(q.projection.name!=="mercator")return void a.w(`Drawing 3D models for ${q.projection.name} projection is not yet implemented`);const B=q.getFreeCameraOptions().position;if(!D.modelManager)return;const $=D.modelManager;Z.modelManager=$;const Y=D.shadowRenderer;if(!Z._unevaluatedLayout._values.hasOwnProperty("model-id"))return;const K=Z._unevaluatedLayout._values["model-id"],ee={...Z.layout.get("model-id").parameters};for(const ce of V){const re=F.getTile(ce).getBucket(Z);if(!re||re.projection.name!==q.projection.name)continue;const me=Ih(ce,q);ee.zoom=me;const fe=K.possiblyEvaluate(ee);if(nu(D,re,ce),Vr.shadowUniformsInitialized=!1,Vr.useSingleShadowCascade=!!Y&&Y.getMaxCascadeForTile(ce.toUnwrapped())===0,D.renderPass==="shadow"&&Y){if(D.currentShadowCascade===1&&re.isInsideFirstShadowMapFrustum)continue;const he=q.calculatePosMatrix(ce.toUnwrapped(),q.worldSize);if(Vr.tileMatrix.set(he),Vr.shadowTileMatrix=Float32Array.from(Y.calculateShadowPassMatrixFromMatrix(he)),Vr.aabb.min.fill(0),Vr.aabb.max[0]=Vr.aabb.max[1]=a.V,Vr.aabb.max[2]=0,ff(re,Vr,D,Z.scope))continue}const Ae=1<<ce.canonical.z,ne=[((B.x-ce.wrap)*Ae-ce.canonical.x)*a.V,(B.y*Ae-ce.canonical.y)*a.V,B.z*Ae*a.V];for(let he in re.instancesPerModel){const Q=re.instancesPerModel[he];Q.features.length>0&&(he=fe.evaluate(Q.features[0].feature,{}));const ae=$.getModel(he,Z.scope);if(ae&&ae.uploaded)for(const Ie of ae.nodes)ou(D,Z,Ie,Q,ne,ce,Vr)}}}(c,r,o,u),void b();if(!T.loaded())return;if(T.type==="batched-model")return function(D,F,Z,V){Z.resetLayerRenderingStats(D);const q=D.context,B=D.transform,$=D.style.fog,Y=D.shadowRenderer;if(B.projection.name!=="mercator")return void a.w(`Drawing 3D landmark models for ${B.projection.name} projection is not yet implemented`);const K=D.transform.getFreeCameraOptions().position,ee=a.N.scale([],[K.x,K.y,K.z],D.transform.worldSize);a.N.negate(ee,ee);const ce=a.a6.identity([]),re=a.cR(B.center.lat,B.zoom),me=a.a6.fromScaling([],[1,1,1/re]);a.a6.translate(ce,ce,ee);const fe=Z.paint.get("model-opacity"),Ae=new dt(q.gl.LEQUAL,dt.ReadWrite,D.depthRangeFor3D),ne=new dt(q.gl.LEQUAL,dt.ReadOnly,D.depthRangeFor3D),he=new a.bS([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),Q=D.renderPass==="shadow",ae=Q&&Y?Y.getCurrentCascadeFrustum():B.getFrustum(B.scaleZoom(B.worldSize)),Ie=Z.getLayerRenderingStats(),Re=function(Le,je){for(const et of V){const ct=F.getTile(et).getBucket(Z);if(!ct||!ct.uploaded)continue;let nt=!1;Y&&(nt=Y.getMaxCascadeForTile(et.toUnwrapped())===0);const at=B.calculatePosMatrix(et.toUnwrapped(),B.worldSize),Et=ct.modelTraits;for(const gt of ct.getNodesInfo()){if(gt.hiddenByReplacement||!gt.node.meshes)continue;const bt=gt.evaluatedScale,vt=gt.node;let Zt=0;if(D.terrain&&vt.elevation&&(Zt=vt.elevation*D.terrain.exaggeration()),bt[0]<=1&&bt[1]<=1&&bt[2]<=1&&(()=>{const xi=gt.getLocalBounds();return he.min=[...xi.min],he.max=[...xi.max],he.min[2]+=Zt,he.max[2]+=Zt,a.N.transformMat4(he.min,he.min,at),a.N.transformMat4(he.max,he.max,at),he})().intersects(ae)===0)continue;const _i=D.renderPass==="light-beam",Ot=[...at];a.a6.translate(Ot,Ot,[(vt.anchor?vt.anchor[0]:0)*(bt[0]-1),(vt.anchor?vt.anchor[1]:0)*(bt[1]-1),Zt]),a.N.exactEquals(bt,a.cT)||a.a6.scale(Ot,Ot,bt),a.a6.multiply(Ot,Ot,vt.matrix);const Pi=a.a6.multiply([],me,Ot);a.a6.multiply(Pi,ce,Pi);const Bt=a.a6.invert([],Pi);a.a6.transpose(Bt,Bt),a.a6.scale(Bt,Bt,Ms);const Kt=a.a6.multiply([],B.expandedFarZProjMatrix,Ot),Ft=Et&a.cV.HasMapboxMeshFeatures,Yt=Ft?0:gt.evaluatedRMEA[0][2];for(let xi=0;xi<vt.meshes.length;++xi){const ii=vt.meshes[xi],Qi=xi===vt.lightMeshIndex;if(Qi){if(!_i&&!D.terrain&&D.shadowRenderer){D.currentLayer<D.firstLightBeamLayer&&(D.firstLightBeamLayer=D.currentLayer);continue}}else if(_i)continue;const ur={defines:[]},Pr=[];if(Ci(ur.defines,Pr,ii,D),Ft||ur.defines.push("DIFFUSE_SHADED"),nt&&ur.defines.push("SHADOWS_SINGLE_CASCADE"),Ie&&(Q?Ie.numRenderedVerticesInShadowPass+=ii.vertexArray.length:Ie.numRenderedVerticesInTransparentPass+=ii.vertexArray.length),Q){le(ii,Ot,D,Z);continue}let bn=null;if($){const Dr=Uo(Ot,D.transform);if(bn=new Float32Array(Dr),B.projection.name!=="globe"){const wn=ii.aabb.min,_o=ii.aabb.max,[Go,Pa]=$.getOpacityForBounds(Dr,wn[0],wn[1],_o[0],_o[1]);ur.overrideFog=Go>=ai||Pa>=ai}}const zr=ii.material;let er;zr.occlusionTexture&&zr.occlusionTexture.offsetScale&&(er=zr.occlusionTexture.offsetScale,ur.defines.push("OCCLUSION_TEXTURE_TRANSFORM")),!Q&&Y&&(Y.useNormalOffset=!!ii.normalBuffer);const Hi=D.getOrCreateProgram("model",ur);
2107!Q&&Y&&Y.setupShadowsFromMatrix(Ot,Hi,Y.useNormalOffset),D.uploadCommonUniforms(q,Hi,et.toUnwrapped(),bn);const yr=zr.pbrMetallicRoughness;yr.metallicFactor=.9,yr.roughnessFactor=.5;const Tr=pl(new Float32Array(Kt),new Float32Array(Pi),new Float32Array(Bt),D,fe,yr.baseColorFactor,zr.emissiveFactor,yr.metallicFactor,yr.roughnessFactor,zr,Yt,Z,[0,0,0],er);Hi.draw(D,q.gl.TRIANGLES,je&&!Qi?Ae:ne,yt.disabled,Le?Qi||fe<1||gt.hasTranslucentParts?Rt.alphaBlended:Rt.unblended:Rt.disabled,ft.backCCW,Tr,Z.id,ii.vertexBuffer,ii.indexBuffer,ii.segments,Z.paint,D.transform.zoom,void 0,Pr)}}}};(function(Le,je,et,ct){const nt=Le.terrain?Le.terrain.exaggeration():0,at=Le.transform.zoom;for(const Et of ct){const gt=je.getTile(Et).getBucket(et);gt&&(Le.conflationActive&>.updateReplacement(Et,Le.replacementSource),gt.evaluateScale(Le,et),Le.terrain&&nt>0&>.elevationUpdate(Le.terrain,nt,Et,et.source),gt.needsReEvaluation(Le,at,et)&>.evaluate(et))}})(D,F,Z,V),fe===1?Re(!0,!0):(Re(!1,!0),Re(!0,!1))}(c,r,o,u),void b();const M=T.getModels(),S=[],C=c.transform.getFreeCameraOptions().position,P=a.N.scale([],[C.x,C.y,C.z],c.transform.worldSize);a.N.negate(P,P);const k=[],R=[];let O=0;for(const D of M){const F=o.paint.get("model-rotation").constantOr(null),Z=o.paint.get("model-scale").constantOr(null),V=o.paint.get("model-translation").constantOr(null);D.computeModelMatrix(c,F,Z,V,!0,!0,!1);const q=a.a6.identity([]),B=a.cR(D.position.lat,c.transform.zoom),$=a.a6.fromScaling([],[1,1,1/B]);a.a6.translate(q,q,P),S.push({zScaleMatrix:$,negCameraPosMatrix:q});for(const Y of D.nodes)pa(c.transform,Y,D.matrix,c.transform.expandedFarZProjMatrix,O,k,R);O++}if(k.sort((D,F)=>F.depth-D.depth),c.renderPass!=="shadow"){if(d===1)for(const D of R)fa(D,c,o,S[D.modelIndex],yt.disabled,c.colorModeForRenderPass());else{for(const D of R)fa(D,c,o,S[D.modelIndex],yt.disabled,Rt.disabled);for(const D of R)fa(D,c,o,S[D.modelIndex],c.stencilModeFor3D(),c.colorModeForRenderPass());c.resetStencilClippingMasks()}for(const D of k)fa(D,c,o,S[D.modelIndex],yt.disabled,c.colorModeForRenderPass());b()}else{for(const D of R)le(D.mesh,D.nodeModelMatrix,c,o);for(const D of k)le(D.mesh,D.nodeModelMatrix,c,o);b()}}},su={model:function(c,r,o){const u=c.scope,d=r.getSource();if(!d.loaded())return;if(d.type==="vector"||d.type==="geojson")return void(o.modelManager&&o.modelManager.upload(o,u));if(d.type==="batched-model")return;const p=d.getModels();for(const g of p)g.upload(o.context)},raster:function(c,r,o){const u=r.getSource();if(!(u instanceof Be&&u.loaded()))return;const d=c.sourceLayer||u.rasterLayerIds&&u.rasterLayerIds[0];if(!d)return;const p=c.paint.get("raster-array-band")||u.getInitialBand(d);if(p==null)return;const g=r.getIds().map(x=>r.getTileByID(x));for(const x of g)x.updateNeeded(d,p)&&u.prepareTile(x,d,p)},"raster-particle":function(c,r,o){const u=r.getSource();if(!(u instanceof Be&&u.loaded()))return;const d=c.sourceLayer||u.rasterLayerIds&&u.rasterLayerIds[0];if(!d)return;const p=c.paint.get("raster-particle-array-band")||u.getInitialBand(d);if(p==null)return;const g=r.getIds().map(x=>r.getTileByID(x));for(const x of g)x.updateNeeded(d,p)&&u.prepareTile(x,d,p)}};class Ph{constructor(r,o,u,d){this.context=new Qu(r,o),this.transform=u,this._tileTextures={},this.frameCopies=[],this.loadTimeStamps=[],this.tp=d,this._debugParams={showTerrainProxyTiles:!1},d.registerParameter(this._debugParams,["Terrain"],"showTerrainProxyTiles",{},()=>{this.style.map.triggerRepaint()}),this.setup(),this.numSublayers=nn.maxUnderzooming+nn.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.deferredRenderGpuTimeQueries=[],this.gpuTimers={},this.frameCounter=0,this._backgroundTiles={},this.conflationActive=!1,this.replacementSource=new a.cX,this.longestCutoffRange=0,this.minCutoffZoom=0,this._fogVisible=!1,this._cachedTileFogOpacities={},this._shadowRenderer=new Tc(this),this._wireframeDebugCache=new Ch,this.renderDefaultNorthPole=!0,this.renderDefaultSouthPole=!0}updateTerrain(r,o){const u=!!r&&!!r.terrain&&this.transform.projection.supportsTerrain;if(!(u||this._terrain&&this._terrain.enabled))return;this._terrain||(this._terrain=new sf(this,r));const d=this._terrain;this.transform.elevation=u?d:null,d.update(r,this.transform,o),this.transform.elevation&&!d.enabled&&(this.transform.elevation=null)}_updateFog(r){const o=r.fog;if(!o||this.transform.projection.name==="globe"||o.getOpacity(this.transform.pitch)<1||o.properties.get("horizon-blend")<.03)return void(this.transform.fogCullDistSq=null);const[u,d]=o.getFovAdjustedRange(this.transform._fov);if(u>d)return void(this.transform.fogCullDistSq=null);const p=u+.78*(d-u);this.transform.fogCullDistSq=p*p}get terrain(){return this.transform._terrainEnabled()&&this._terrain&&this._terrain.enabled?this._terrain:null}get shadowRenderer(){return this._shadowRenderer&&this._shadowRenderer.enabled?this._shadowRenderer:null}get wireframeDebugCache(){return this._wireframeDebugCache}resize(r,o){if(this.width=r*a.f.devicePixelRatio,this.height=o*a.f.devicePixelRatio,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const u of this.style.order)this.style._mergedLayers[u].resize()}setup(){const r=this.context,o=new a.aN;o.emplaceBack(0,0),o.emplaceBack(a.V,0),o.emplaceBack(0,a.V),o.emplaceBack(a.V,a.V),this.tileExtentBuffer=r.createVertexBuffer(o,a.aP.members),this.tileExtentSegments=a.aB.simpleSegment(0,0,4,2);const u=new a.aN;u.emplaceBack(0,0),u.emplaceBack(a.V,0),u.emplaceBack(0,a.V),u.emplaceBack(a.V,a.V),this.debugBuffer=r.createVertexBuffer(u,a.aP.members),this.debugSegments=a.aB.simpleSegment(0,0,4,5);const d=new a.aN;d.emplaceBack(-1,-1),d.emplaceBack(1,-1),d.emplaceBack(-1,1),d.emplaceBack(1,1),this.viewportBuffer=r.createVertexBuffer(d,a.aP.members),this.viewportSegments=a.aB.simpleSegment(0,0,4,2);const p=new a.av;p.emplaceBack(0,0,0,0),p.emplaceBack(a.V,0,a.V,0),p.emplaceBack(0,a.V,0,a.V),p.emplaceBack(a.V,a.V,a.V,a.V),this.mercatorBoundsBuffer=r.createVertexBuffer(p,a.aR.members),this.mercatorBoundsSegments=a.aB.simpleSegment(0,0,4,2);const g=new a.aw;g.emplaceBack(0,1,2),g.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=r.createIndexBuffer(g);const x=new a.aO;for(const T of[0,1,3,2,0])x.emplaceBack(T);this.debugIndexBuffer=r.createIndexBuffer(x),this.emptyTexture=new a.T(r,new a.h({width:1,height:1},Uint8Array.of(0,0,0,0)),r.gl.RGBA),this.identityMat=a.a6.create();const b=this.context.gl;this.stencilClearMode=new yt({func:b.ALWAYS,mask:0},0,255,b.ZERO,b.ZERO,b.ZERO),this.loadTimeStamps.push(performance.now())}getMercatorTileBoundsBuffers(){return{tileBoundsBuffer:this.mercatorBoundsBuffer,tileBoundsIndexBuffer:this.quadTriangleIndexBuffer,tileBoundsSegments:this.mercatorBoundsSegments}}getTileBoundsBuffers(r){return r._makeTileBoundsBuffers(this.context,this.transform.projection),r._tileBoundsBuffer?{tileBoundsBuffer:r._tileBoundsBuffer,tileBoundsIndexBuffer:r._tileBoundsIndexBuffer,tileBoundsSegments:r._tileBoundsSegments}:this.getMercatorTileBoundsBuffers()}clearStencil(){const r=this.context.gl;this.nextStencilID=1,this.currentStencilSource=void 0,this._tileClippingMaskIDs={},this.getOrCreateProgram("clippingMask").draw(this,r.TRIANGLES,dt.disabled,this.stencilClearMode,Rt.disabled,ft.disabled,Rc(this.identityMat),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}resetStencilClippingMasks(){this.terrain||(this.currentStencilSource=void 0,this._tileClippingMaskIDs={})}_renderTileClippingMasks(r,o,u){if(!o||this.currentStencilSource===o.id||!r.isTileClipped()||!u||u.length===0)return;if(this._tileClippingMaskIDs&&!this.terrain){let x=!1;for(const b of u)if(this._tileClippingMaskIDs[b.key]===void 0){x=!0;break}if(!x)return}this.currentStencilSource=o.id;const d=this.context,p=d.gl;this.nextStencilID+u.length>256&&this.clearStencil(),d.setColorMode(Rt.disabled),d.setDepthMode(dt.disabled);const g=this.getOrCreateProgram("clippingMask");this._tileClippingMaskIDs={};for(const x of u){const b=o.getTile(x),T=this._tileClippingMaskIDs[x.key]=this.nextStencilID++,{tileBoundsBuffer:M,tileBoundsIndexBuffer:S,tileBoundsSegments:C}=this.getTileBoundsBuffers(b);g.draw(this,p.TRIANGLES,dt.disabled,new yt({func:p.ALWAYS,mask:0},T,255,p.KEEP,p.KEEP,p.REPLACE),Rt.disabled,ft.disabled,Rc(x.projMatrix),"$clipping",M,S,C)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const r=this.nextStencilID++,o=this.context.gl;return new yt({func:o.NOTEQUAL,mask:255},r,255,o.KEEP,o.KEEP,o.REPLACE)}stencilModeForClipping(r){if(this.terrain)return this.terrain.stencilModeForRTTOverlap(r);const o=this.context.gl;return new yt({func:o.EQUAL,mask:255},this._tileClippingMaskIDs[r.key],0,o.KEEP,o.KEEP,o.REPLACE)}stencilConfigForOverlap(r){const o=this.context.gl,u=r.sort((g,x)=>
2107x.overscaledZ-g.overscaledZ),d=u[u.length-1].overscaledZ,p=u[0].overscaledZ-d+1;if(p>1){this.currentStencilSource=void 0,this.nextStencilID+p>256&&this.clearStencil();const g={};for(let x=0;x<p;x++)g[x+d]=new yt({func:o.GEQUAL,mask:255},x+this.nextStencilID,255,o.KEEP,o.KEEP,o.REPLACE);return this.nextStencilID+=p,[g,u]}return[{[d]:yt.disabled},u]}colorModeForRenderPass(){const r=this.context.gl;return this._showOverdrawInspector?new Rt([r.CONSTANT_COLOR,r.ONE,r.CONSTANT_COLOR,r.ONE],new a.ax(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?Rt.unblended:Rt.alphaBlended}colorModeForDrapableLayerRenderPass(r){const o=this.context.gl;return this.style&&this.style.enable3dLights()&&this.terrain&&this.terrain.renderingToTexture&&this.renderPass==="translucent"?new Rt([o.ONE,o.ONE_MINUS_SRC_ALPHA,o.CONSTANT_ALPHA,o.ONE_MINUS_SRC_ALPHA],new a.ax(0,0,0,r===void 0?0:r),[!0,!0,!0,!0]):this.colorModeForRenderPass()}depthModeForSublayer(r,o,u,d=!1){if(!this.opaquePassEnabledForLayer()&&!d)return dt.disabled;const p=1-((1+this.currentLayer)*this.numSublayers+r)*this.depthEpsilon;return new dt(u||this.context.gl.LEQUAL,o,[p,p])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(r,o){this._wireframeDebugCache.update(this.frameCounter),this.style=r,this.options=o;const u=this.style._mergedLayers,d=this.style.order,p=d.map(B=>u[B]),g=this.style._mergedSourceCaches;this.imageManager=r.imageManager,this.modelManager=r.modelManager,this.symbolFadeChange=r.placement.symbolFadeChange(a.f.now()),this.imageManager.beginFrame();let x=0,b=!1;for(const B in g){const $=g[B];$.used&&($.prepare(this.context),$.getSource().usedInConflation&&++x)}for(const B of p)B.isHidden(this.transform.zoom)||this.prepareLayer(B);const T={},M={},S={},C={},P={};for(const B in g){const $=g[B];T[B]=$.getVisibleCoordinates(),M[B]=T[B].slice().reverse(),S[B]=$.getVisibleCoordinates(!0).reverse(),C[B]=$.getShadowCasterCoordinates(),P[B]=$.sortCoordinatesByDistance(T[B])}const k=B=>{const $=this.style.getLayerSourceCache(B);return $&&$.used?$.getSource():null};if(x){const B=[];for(const $ of p)this.layerUsedInConflation($,k($))&&B.push($);if(B&&B.length>1){const $=[];for(const Y of B){const K=this.style.getLayerSourceCache(Y);K&&K.used&&K.getSource().usedInConflation&&$.push({layer:Y.fqid,cache:K})}this.replacementSource.setSources($),b=!0}}b||this.replacementSource.clear(),this.conflationActive=b,this.minCutoffZoom=0,this.longestCutoffRange=0;for(const B of p){const $=B.cutoffRange();if(this.longestCutoffRange=Math.max($,this.longestCutoffRange),$>0){const Y=k(B);Y&&(this.minCutoffZoom=Math.max(Y.minzoom,this.minCutoffZoom)),B.minzoom&&(this.minCutoffZoom=Math.max(B.minzoom,this.minCutoffZoom))}}this.opaquePassCutoff=1/0;for(let B=0;B<p.length;B++)if(p[B].is3D()){this.opaquePassCutoff=B;break}const R=this.style&&this.style.fog;R?(this._fogVisible=R.getOpacity(this.transform.pitch)!==0,this._fogVisible&&this.transform.projection.name!=="globe"&&(this._fogVisible=R.isVisibleOnFrustum(this.transform.cameraFrustum))):this._fogVisible=!1,this._cachedTileFogOpacities={},this.terrain&&(this.terrain.updateTileBinding(S),this.opaquePassCutoff=0);const O=this._shadowRenderer;if(O){O.updateShadowParameters(this.transform,this.style.directionalLight);for(const B in g)for(const $ of T[B]){let Y={min:0,max:0};this.terrain&&(Y=this.terrain.getMinMaxForTile($)||Y),O.addShadowReceiver($.toUnwrapped(),Y.min,Y.max)}}if(this.transform.projection.name!=="globe"||this.globeSharedBuffers||(this.globeSharedBuffers=new a.cY(this.context)),this.style.fog&&this.transform.projection.supportsFog?(this._atmosphere||(this._atmosphere=new ut(this)),this._atmosphere.update(this)):this._atmosphere&&(this._atmosphere.destroy(),this._atmosphere=void 0),!a.cZ(this.context.gl))return;this.renderPass="offscreen";for(const B of p){const $=r.getLayerSourceCache(B);if(!B.hasOffscreenPass()||B.isHidden(this.transform.zoom))continue;const Y=$?M[$.id]:void 0;(B.type==="custom"||B.type==="raster"||B.type==="raster-particle"||B.isSky()||Y&&Y.length)&&this.renderLayer(this,$,B,Y)}this.depthRangeFor3D=[0,1-(p.length+2)*this.numSublayers*this.depthEpsilon];const D=this.terrain;D&&(this.style.hasSymbolLayers()||this.style.hasCircleLayers())&&!this.transform.isOrthographic&&D.drawDepth(),this._shadowRenderer&&(this.renderPass="shadow",this._shadowRenderer.drawShadowPass(this.style,C)),this.context.bindFramebuffer.set(null),this.context.viewport.set([0,0,this.width,this.height]);const F=this.transform.projection.name==="globe"||this.transform.isH
2107orizonVisible(),Z=(()=>{if(o.showOverdrawInspector)return a.ax.black;if(this.style.fog&&this.transform.projection.supportsFog&&!F){const B=this.style.fog.properties.get("color").toArray01();return new a.ax(...B)}if(this.style.fog&&this.transform.projection.supportsFog&&F){const B=this.style.fog.properties.get("space-color").toArray01();return new a.ax(...B)}return a.ax.transparent})();if(this.context.clear({color:Z,depth:1}),this.clearStencil(),this._showOverdrawInspector=o.showOverdrawInspector,this.renderPass="opaque",this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&F&&this._atmosphere.drawStars(this,this.style.fog),!this.terrain)for(this.currentLayer=d.length-1;this.currentLayer>=0;this.currentLayer--){const B=p[this.currentLayer],$=r.getLayerSourceCache(B);if(B.isSky())continue;const Y=$?(B.is3D()?P:M)[$.id]:void 0;this._renderTileClippingMasks(B,$,Y),this.renderLayer(this,$,B,Y)}if(this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&F&&this._atmosphere.drawAtmosphereGlow(this,this.style.fog),this.renderPass="sky",(!this._atmosphere||a.S(this.transform.zoom)>0)&&(this.transform.projection.name==="globe"||this.transform.isHorizonVisible()))for(this.currentLayer=0;this.currentLayer<d.length;this.currentLayer++){const B=p[this.currentLayer],$=r.getLayerSourceCache(B);B.isSky()&&this.renderLayer(this,$,B,$?M[$.id]:void 0)}function V(B,$){let Y;return $&&(Y=(B.type==="symbol"?S:B.is3D()?P:M)[$.id]),Y}if(this.renderPass="translucent",this.transform.projection.name==="globe"){for(this.renderElevatedRasterBackface=!0,this.currentLayer=0;this.currentLayer<d.length;){const B=p[this.currentLayer];if(B.type==="raster"){const $=r.getLayerSourceCache(B);this.renderLayer(this,$,B,V(B,$))}++this.currentLayer}this.renderElevatedRasterBackface=!1}this.currentLayer=0,this.firstLightBeamLayer=Number.MAX_SAFE_INTEGER;let q=0;for(O&&(q=O.getShadowCastingLayerCount());this.currentLayer<d.length;){const B=p[this.currentLayer],$=r.getLayerSourceCache(B);if(B.isSky())++this.currentLayer;else if(D&&this.style.isLayerDraped(B)){if(B.isHidden(this.transform.zoom)){++this.currentLayer;continue}this.currentLayer=D.renderBatch(this.currentLayer)}else{if(this._renderTileClippingMasks(B,$,$?T[$.id]:void 0),this.renderLayer(this,$,B,V(B,$)),!D&&O&&q>0&&B.hasShadowPass()&&--q==0&&(O.drawGroundShadows(),this.firstLightBeamLayer<=this.currentLayer)){const Y=this.currentLayer;for(this.renderPass="light-beam",this.currentLayer=this.firstLightBeamLayer;this.currentLayer<=Y;this.currentLayer++){const K=p[this.currentLayer];if(!K.hasLightBeamPass())continue;const ee=r.getLayerSourceCache(K);this.renderLayer(this,ee,K,ee?M[ee.id]:void 0)}this.currentLayer=Y,this.renderPass="translucent"}++this.currentLayer}}if(this.terrain&&this.terrain.postRender(),this.options.showTileBoundaries||this.options.showQueryGeometry||this.options.showTileAABBs){let B=null;p.forEach($=>{const Y=r.getLayerSourceCache($);Y&&!$.isHidden(this.transform.zoom)&&Y.getVisibleCoordinates().length&&(!B||B.getSource().maxzoom<Y.getSource().maxzoom)&&(B=Y)}),B&&this.options.showTileBoundaries&&_a.debug(this,B,B.getVisibleCoordinates(),a.ax.red,!1,this.options.showParseStatus)}this.terrain&&this._debugParams.showTerrainProxyTiles&&_a.debug(this,this.terrain.proxySourceCache,this.terrain.proxyCoords,new a.ax(1,.8,.1,1),!0,this.options.showParseStatus),this.options.showPadding&&function(B){const $=B.transform.padding;tu(B,B.transform.height-($.top||0),3,Ir),tu(B,$.bottom||0,3,co),Nr(B,$.left||0,3,Ah),Nr(B,B.transform.width-($.right||0),3,Qc);const Y=B.transform.centerPoint;(function(K,ee,ce,re){Ii(K,ee-1,ce-10,2,20,re),Ii(K,ee-10,ce-1,20,2,re)})(B,Y.x,B.transform.height-Y.y,eu)}(this),this.context.setDefault(),this.frameCounter=(this.frameCounter+1)%Number.MAX_SAFE_INTEGER,this.tileLoaded&&this.options.speedIndexTiming&&(this.loadTimeStamps.push(performance.now()),this.saveC
vendor: 1,830 bytes, line 2107
2107anvasCopy()),b||(this.conflationActive=!1)}prepareLayer(r){this.gpuTimingStart(r);const{unsupportedLayers:o}=this.transform.projection,u=!o||!o.includes(r.type);if(su[r.type]&&(u||this.terrain&&r.type==="custom")){const d=this.style.getLayerSourceCache(r);su[r.type](r,d,this)}this.gpuTimingEnd()}renderLayer(r,o,u,d){u.isHidden(this.transform.zoom)||(u.type==="background"||u.type==="sky"||u.type==="custom"||u.type==="model"||u.type==="raster"||u.type==="raster-particle"||d&&d.length)&&(this.id=u.id,this.gpuTimingStart(u),(!r.transform.projection.unsupportedLayers||!r.transform.projection.unsupportedLayers.includes(u.type)||r.terrain&&u.type==="custom")&&_a[u.type](r,o,u,d,this.style.placement.variableOffsets,this.options.isInitialLoad),this.gpuTimingEnd())}gpuTimingStart(r){if(!this.options.gpuTiming)return;const o=this.context.extTimerQuery,u=this.context.gl;let d=this.gpuTimers[r.id];d||(d=this.gpuTimers[r.id]={calls:0,cpuTime:0,query:u.createQuery()}),d.calls++,u.beginQuery(o.TIME_ELAPSED_EXT,d.query)}gpuTimingDeferredRenderStart(){if(this.options.gpuTimingDeferredRender){const r=this.context.extTimerQuery,o=this.context.gl,u=o.createQuery();this.deferredRenderGpuTimeQueries.push(u),o.beginQuery(r.TIME_ELAPSED_EXT,u)}}gpuTimingDeferredRenderEnd(){this.options.gpuTimingDeferredRender&&this.context.gl.endQuery(this.context.extTimerQuery.TIME_ELAPSED_EXT)}gpuTimingEnd(){this.options.gpuTiming&&this.context.gl.endQuery(this.context.extTimerQuery.TIME_ELAPSED_EXT)}collectGpuTimers(){const r=this.gpuTimers;return this.gpuTimers={},r}collectDeferredRenderGpuQueries(){const r=this.deferredRenderGpuTimeQueries;return this.deferredRenderGpuTimeQueries=[],r}queryGpuTimers(r){const o={};for(const u in r){const d=r[u],p=this.context.extTimerQuery,g=p.getQueryParameter(d.query,this.context.gl.QUERY_RESULT)/1e6;
2107p.deleteQueryEXT(d.query),o[u]=g}return o}queryGpuTimeDeferredRender(r){if(!this.options.gpuTimingDeferredRender)return 0;const o=this.context.extTimerQuery,u=this.context.gl;let d=0;for(const p of r)d+=o.getQueryParameter(p,u.QUERY_RESULT)/1e6,o.deleteQueryEXT(p);return d}translatePosMatrix(r,o,u,d,p){if(!u[0]&&!u[1])return r;const g=p?d==="map"?this.transform.angle:0:d==="viewport"?-this.transform.angle:0;if(g){const T=Math.sin(g),M=Math.cos(g);u=[u[0]*M-u[1]*T,u[0]*T+u[1]*M]}const x=[p?u[0]:a.a3(o,u[0],this.transform.zoom),p?u[1]:a.a3(o,u[1],this.transform.zoom),0],b=new Float32Array(16);return a.a6.translate(b,r,x),b}saveTileTexture(r){const o=r.size[0],u=this._tileTextures[o];u?u.push(r):this._tileTextures[o]=[r]}getTileTexture(r){const o=this._tileTextures[r];return o&&o.length>0?o.pop():null}isPatternMissing(r,o){return r===null||r!==void 0&&!this.imageManager.getPattern(r.toString(),o)}terrainRenderModeElevated(){return this.style&&!!this.style.getTerrain()&&!!this.terrain&&!this.terrain.renderingToTexture}linearFloatFilteringSupported(){return this.context.extTextureFloatLinear!=null}currentGlobalDefines(r,o,u){const d=u===void 0?this.terrain&&this.terrain.renderingToTexture:u,p=this.terrain&&this.terrain.exaggeration()===0,g=[];return this.style&&this.style.enable3dLights()&&(r==="globeRaster"||r==="terrainRaster"?(g.push("LIGHTING_3D_MODE"),g.push("LIGHTING_3D_ALPHA_EMISSIVENESS")):d||g.push("LIGHTING_3D_MODE")),this.renderPass==="shadow"?this._shadowMapDebug||g.push("DEPTH_TEXTURE"):this.shadowRenderer&&(this.shadowRenderer.useNormalOffset?g.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET"):g.push("RENDER_SHADOWS","DEPTH_TEXTURE")),this.terrainRenderModeElevated()&&(g.push("TERRAIN"),this.linearFloatFilteringSupported()&&g.push("TERRAIN_DEM_FLOAT_FORMAT"),p&&g.push("ZERO_EXAGGERATION")),this.transform.projection.name==="globe"&&g.push("GLOBE"),!this._fogVisible||d||o!==void 0&&!o||g.push("FOG","FOG_DITHERING"),d&&g.push("RENDER_TO_TEXTURE"),this._showOverdrawInspector&&g.pu
vendor: 28,969 bytes, line 2107
2107sh("OVERDRAW_INSPECTOR"),g}getOrCreateProgram(r,o){this.cache=this.cache||{};const u=o&&o.defines||[],d=o&&o.config,p=o&&o.transformFeedback,g=this.currentGlobalDefines(r,o&&o.overrideFog,o&&o.overrideRtt).concat(u),x=Fc.cacheKey(Cc[r],r,g,d);return this.cache[x]||(this.cache[x]=new Fc(this.context,r,Cc[r],d,cf[r],g,p)),this.cache[x]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.frontFace.setDefault(),this.context.cullFaceSide.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const r=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(r.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new a.T(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this._terrain&&this._terrain.destroy(),this._atmosphere&&(this._atmosphere.destroy(),this._atmosphere=void 0),this.globeSharedBuffers&&this.globeSharedBuffers.destroy(),this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this._wireframeDebugCache.destroy()}prepareDrawTile(){this.terrain&&this.terrain.prepareDrawTile()}uploadCommonLightUniforms(r,o){if(this.style.enable3dLights()){const u=this.style.directionalLight,d=this.style.ambientLight;if(u&&d){const p=((g,x)=>{const b=g.properties.get("direction"),T=g.properties.get("color").toArray01(),M=g.properties.get("intensity"),S=x.properties.get("color").toArray01(),C=x.properties.get("intensity"),P=[b.x,b.y,b.z],k=a.cn(S,C),R=a.cn(T,M);return{u_lighting_ambient_color:k,u_lighting_directional_dir:P,u_lighting_directional_color:R,u_ground_radiance:Oc(P,R,k)}})(u,d);o.setLightsUniformValues(r,p)}}}uploadCommonUniforms(r,o,u,d,p){if(this.uploadCommonLightUniforms(r,o),this.terrain&&this.terrain.renderingToTexture)return;const g=this.style.fog;if(g){const x=g.getOpacity(this.transform.pitch),b=((T,M,S,C,P,k,R,O,D,F,Z,V)=>{const q=T.transform,B=M.properties.get("color").toArray01();B[3]=C;const $=T.frameCounter/1e3%1,[Y,K]=M.properties.get("vertical-range");return{u_fog_matrix:S?q.calculateFogTileMatrix(S):V||T.identityMat,u_fog_range:M.getFovAdjustedRange(q._fov),u_fog_color:B,u_fog_horizon_blend:M.properties.get("horizon-blend"),u_fog_vertical_limit:[Math.min(Y,K),K],u_fog_temporal_offset:$,u_frustum_tl:P,u_frustum_tr:k,u_frustum_br:R,u_frustum_bl:O,u_globe_pos:D,u_globe_radius:F,u_viewport:Z,u_globe_transition:a.S(q.zoom),u_is_globe:+(q.projection.name==="globe")}})(this,g,u,x,this.transform.frustumCorners.TL,this.transform.frustumCorners.TR,this.transform.frustumCorners.BR,this.transform.frustumCorners.BL,this.transform.globeCenterInViewSpace,this.transform.globeRadius,[this.transform.width*a.f.devicePixelRatio,this.transform.height*a.f.devicePixelRatio],d);o.setFogUniformValues(r,b)}p&&o.setCutoffUniformValues(r,p.uniformValues)}setTileLoadedFlag(r){this.tileLoaded=r}saveCanvasCopy(){const r=this.canvasCopy();r&&(this.frameCopies.push(r),this.tileLoaded=!1)}canvasCopy(){const r=this.context.gl,o=r.createTexture();return r.bindTexture(r.TEXTURE_2D,o),r.copyTexImage2D(r.TEXTURE_2D,0,r.RGBA,0,0,r.drawingBufferWidth,r.drawingBufferHeight,0),o}getCanvasCopiesAndTimestamps(){return{canvasCopies:this.frameCopies,timeStamps:this.loadTimeStamps}}averageElevationNeedsEasing(){if(!this.transform._elevation)return!1;const r=this.style&&this.style.fog;return!!r&&r.getOpacity(this.transform.pitch)!==0}getBackgroundTiles(){const r=this._backgroundTiles,o=this._backgroundTiles={},u=this.transform.coveringTiles({tileSize:512});for(const d of u)o[d.key]=r[d.key]||new Jn(d,512,this.transform.tileZoom,this);return o}clearBackgroundTiles(){this._backgroundTiles={}}layerUsedInConflation(r,o){return!(!r.is3D()||r.minzoom&&r.minzoom>this.transform.zoom||r.sourceLayer!=="building"&&(!o||o.type!=="batched-model"))}isTileAffectedByFog(r){if(!this.style||!this.style.fog)return!1;if(this.transform.projection.name==="globe")return!0;let o=this._cachedTileFogOpacities[r.key];return o||(this._cachedTileFogOpacities[r.key]=o=this.style.fog.getOpacityForTile(r)),o[0]>=ai||o[1]>=ai}}function ga(c,r){let o=!1,u=null;const d=()=>{u=null,o&&(c(),u=setTimeout(d,r),o=!1)};return()=>(o=!0,u||d(),u)}class gl{constructor(r){this._hashName=r&&encodeURIComponent(r),a.aY(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=ga(this._updateHashUnthrottled.bind(this),300)}addTo(r){return this._map=r,window.addEventListener("hashchange",this._onHashChange,!1),r.on("moveend",this._updateHash),this}remove(){return this._map?(this._map.off("moveend",this._updateHash),window.removeEventListener("hashchange",this._onHashChange,!1),clearTimeout(this._updateHash()),this._map=void 0,this):this}getHashString(){const r=this._map;if(!r)return"";const o=au(r);if(this._hashName){const u=this._hashName;let d=!1;const p=location.hash.slice(1).split("&").map(g=>{const x=g.split("=")[0];return x===u?(d=!0,`${x}=${o}`):g}).filter(g=>g);return d||p.push(`${u}=${o}`),`#${p.join("&")}`}return`#${o}`}_getCurrentHash(){const r=location.hash.replace("#","");if(this._hashName){let o;return r.split("&").map(u=>u.split("=")).forEach(u=>{u[0]===this._hashName&&(o=u)}),(o&&o[1]||"").split("/")}return r.split("/")}_onHashChange(){const r=this._map;if(!r)return!1;const o=this._getCurrentHash();if(o.length>=3&&!o.some(u=>isNaN(u))){const u=r.dragRotate.isEnabled()&&r.touchZoomRotate.isEnabled()?+(o[3]||0):r.getBearing();return r.jumpTo({center:[+o[2],+o[1]],zoom:+o[0],bearing:u,pitch:+(o[4]||0)}),!0}return!1}_updateHashUnthrottled(){history.replaceState(history.state,"",location.href.replace(/(#.+)?$/,this.getHashString()))}}function au(c,r){const o=c.getCenter(),u=Math.round(100*c.getZoom())/100,d=Math.ceil((u*Math.LN2+Math.log(512/360/.5))/Math.LN10),p=Math.pow(10,d),g=Math.round(o.lng*p)/p,x=Math.round(o.lat*p)/p,b=c.getBearing(),T=c.getPitch();let M=r?`/${g}/${x}/${u}`:`${u}/${x}/${g}`;return(b||T)&&(M+="/"+Math.round(10*b)/10),T&&(M+=`/${Math.round(T)}`),M}const ya={linearity:.3,easing:a.c_(0,0,.3,1)},Cr=a.e({deceleration:2500,maxSpeed:1400},ya),mf=a.e({deceleration:20,maxSpeed:1400},ya),yl=a.e({deceleration:1e3,maxSpeed:360},ya),Ti=a.e({deceleration:1e3,maxSpeed:90},ya);class li{constructor(r){this._map=r,this.clear()}clear(){this._inertiaBuffer=[]}record(r){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:a.f.now(),settings:r})}_drainInertiaBuffer(){const r=this._inertiaBuffer,o=a.f.now();for(;r.length>0&&o-r[0].time>160;)r.shift()}_onMoveEnd(r){if(this._map._prefersReducedMotion()||(this._drainInertiaBuffer(),this._inertiaBuffer.length<2))return;const o={zoom:0,bearing:0,pitch:0,pan:new a.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:p}of this._inertiaBuffer)o.zoom+=p.zoomDelta||0,o.bearing+=p.bearingDelta||0,o.pitch+=p.pitchDelta||0,p.panDelta&&o.pan._add(p.panDelta),p.around&&(o.around=p.around),p.pinchAround&&(o.pinchAround=p.pinchAround);const u=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,d={};if(o.pan.mag()){const p=cn(o.pan.mag(),u,a.e({},Cr,r||{}));d.offset=o.pan.mult(p.amount/o.pan.mag()),d.center=this._map.transform.center,xa(d,p)}if(o.zoom){const p=cn(o.zoom,u,mf);d.zoom=this._map.transform.zoom+p.amount,xa(d,p)}if(o.bearing){const p=cn(o.bearing,u,yl);d.bearing=this._map.transform.bearing+a.aa(p.amount,-179,179),xa(d,p)}if(o.pitch){const p=cn(o.pitch,u,Ti);d.pitch=this._map.transform.pitch+p.amount,xa(d,p)}if(d.zoom||d.bearing){const p=o.pinchAround===void 0?o.around:o.pinchAround;d.around=p?this._map.unproject(p):this._map.getCenter()}return this.clear(),d.noMoveStart=!0,d}}function xa(c,r){(!c.duration||c.duration<r.duration)&&(c.duration=r.duration,c.easing=r.easing)}function cn(c,r,o){const{maxSpeed:u,linearity:d,deceleration:p}=o,g=a.aa(c*d/(r/1e3),-u,u),x=Math.abs(g)/(p*d);return{easing:o.easing,duration:1e3*x,amount:g*(x/2)}}class wr extends a.b{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(r,o,u,d={}){const p=$n(o.getCanvasContainer(),u),g=o.unproject(p);super(r,a.e({point:p,lngLat:g,originalEvent:u},d)),this._defaultPrevented=!1,this.target=o}}class Rn extends a.b{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(r,o,u){const d=r==="touchend"?u.changedTouches:u.touches,p=Wn(o.getCanvasContainer(),d),g=p.map(b=>o.unproject(b)),x=p.reduce((b,T,M,S)=>b.add(T.div(S.length)),new a.P(0,0));super(r,{points:p,point:x,lngLats:g,lngLat:o.unproject(x),originalEvent:u}),this._defaultPrevented=!1}}class lu extends a.b{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(r,o,u){super(r,{originalEvent:u}),this._defaultPrevented=!1}}class cu{constructor(r,o){this._map=r,this._clickTolerance=o.clickTolerance}reset(){this._mousedownPos=void 0}wheel(r){return this._firePreventable(new lu(r.type,this._map,r))}mousedown(r,o){return this._mousedownPos=o,this._firePreventable(new wr(r.type,this._map,r))}mouseup(r){this._map.fire(new wr(r.type,this._map,r))}preclick(r){const o=a.e({},r);o.type="preclick",this._map.fire(new wr(o.type,this._map,o))}click(r,o){this._mousedownPos&&this._mousedownPos.dist(o)>=this._clickTolerance||(this.preclick(r),this._map.fire(new wr(r.type,this._map,r)))}dblclick(r){return this._firePreventable(new wr(r.type,this._map,r))}mouseover(r){this._map.fire(new wr(r.type,this._map,r))}mouseout(r){this._map.fire(new wr(r.type,this._map,r))}touchstart(r){return this._firePreventable(new Rn(r.type,this._map,r))}touchmove(r){this._map.fire(new Rn(r.type,this._map,r))}touchend(r){this._map.fire(new Rn(r.type,this._map,r))}touchcancel(r){this._map.fire(new Rn(r.type,this._map,r))}_firePreventable(r){if(this._map.fire(r),r.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class ho{constructor(r){this._map=r}reset(){this._delayContextMenu=!1,this._contextMenuEvent=void 0}mousemove(r){this._map.fire(new wr(r.type,this._map,r))}mousedown(){this._delayContextMenu=!0}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new wr("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(r){this._delayContextMenu?this._contextMenuEvent=r:this._map.fire(new wr(r.type,this._map,r)),this._map.listens("contextmenu")&&r.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class fo{constructor(r,o){this._map=r,this._el=r.getCanvasContainer(),this._container=r.getContainer(),this._clickTolerance=o.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(r,o){this.isEnabled()&&r.shiftKey&&r.button===0&&(Ua(),this._startPos=this._lastPos=o,this._active=!0)}mousemoveWindow(r,o){if(!this._active)return;const u=o,d=this._startPos,p=this._lastPos;if(!d||!p||p.equals(u)||!this._box&&u.dist(d)<this._clickTolerance)return;this._lastPos=u,this._box||(this._box=Wt("div","mapboxgl-boxzoom",this._container),this._container.classList.add("mapboxgl-crosshair"),this._fireEvent("boxzoomstart",r));const g=Math.min(d.x,u.x),x=Math.max(d.x,u.x),b=Math.min(d.y,u.y),T=Math.max(d.y,u.y);this._map._requestDomTask(()=>{this._box&&(this._box.style.transform=`translate(${g}px,${b}px)`,this._box.style.width=x-g+"px",this._box.style.height=T-b+"px")})}mouseupWindow(r,o){if(!this._active)return;const u=this._startPos,d=o;if(u&&r.button===0){if(this.reset(),wo(),u.x!==d.x||u.y!==d.y)return this._map.fire(new a.b("boxzoomend",{originalEvent:r})),{cameraAnimation:p=>p.fitScreenCoordinates(u,d,this._map.getBearing(),{linear:!1})};this._fireEvent("boxzoomcancel",r)}}keydown(r){this._active&&r.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",r))}blur(){this.reset()}reset(){this._active=!1,this._container.classList.remove("mapboxgl-crosshair"),this._box&&(this._box.remove(),this._box=null),kr(),delete this._startPos,delete this._lastPos}_fireEvent(r,o){return this._map.fire(new a.b(r,{originalEvent:o}))}}function Es(c,r){const o={};for(let u=0;u<c.length;u++)o[c[u].identifier]=r[u];return o}class xl{constructor(r){this.reset(),this.numTouches=r.numTouches}reset(){this.centroid=void 0,this.startTime=0,this.touches={},this.aborted=!1}touchstart(r,o,u){(this.centroid||u.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===0&&(this.startTime=r.timeStamp),u.length===this.numTouches&&(this.centroid=function(d){const p=new a.P(0,0);for(const g of d)p._add(g);return p.div(d.length)}(o),this.touches=Es(u,o)))}touchmove(r,o,u){if(this.aborted||!this.centroid)return;const d=Es(u,o);for(const p in this.touches){const g=d[p];(!g||g.dist(this.touches[p])>30)&&(this.aborted=!0)}}touchend(r,o,u){if((!this.centroid||r.timeStamp-this.startTime>500)&&(this.aborted=!0),u.length===0){const d=!this.aborted&&this.centroid;if(this.reset(),d)return d}}}class va{constructor(r){this.singleTap=new xl(r),this.numTaps=r.numTaps,this.reset()}reset(){this.lastTime=1/0,this.lastTap=void 0,this.count=0,this.singleTap.reset()}touchstart(r,o,u){this.singleTap.touchstart(r,o,u)}touchmove(r,o,u){this.singleTap.touchmove(r,o,u)}touchend(r,o,u){const d=this.singleTap.touchend(r,o,u);if(d){const p=r.timeStamp-this.lastTime<500,g=!this.lastTap||this.lastTap.dist(d)<30;if(p&&g||this.reset(),this.count++,this.lastTime=r.timeStamp,this.lastTap=d,this.count===this.numTaps)return this.reset(),d}}}class uu{constructor(){this._zoomIn=new va({numTouches:1,numTaps:2}),this._zoomOut=new va({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(r,o,u){this._zoomIn.touchstart(r,o,u),this._zoomOut.touchstart(r,o,u)}touchmove(r,o,u){this._zoomIn.touchmove(r,o,u),this._zoomOut.touchmove(r,o,u)}touchend(r,o,u){const d=this._zoomIn.touchend(r,o,u),p=this._zoomOut.touchend(r,o,u);return d?(this._active=!0,r.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:g=>g.easeTo({duration:300,zoom:g.getZoom()+1,around:g.unproject(d)},{originalEvent:r})}):p?(this._active=!0,r.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:g=>g.easeTo({duration:300,zoom:g.getZoom()-1,around:g.unproject(p)},{originalEvent:r})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}const hu={0:1,2:2};class vn{constructor(r){this.reset(),this._clickTolerance=r.clickTolerance||1}blur(){this.reset()}reset(){this._active=!1,this._moved=!1,this._lastPoint=void 0,this._eventButton=void 0}_correctButton(r,o){return!1}_move(r,o){return{}}mousedown(r,o){if(this._lastPoint)return;const u=Mn(r);this._correctButton(r,u)&&(this._lastPoint=o,this._eventButton=u)}mousemoveWindow(r,o){const u=this._lastPoint;if(u){if(r.preventDefault(),this._eventButton!=null&&function(d,p){const g=hu[p];return d.buttons===void 0||(d.buttons&g)!==g}(r,this._eventButton))this.reset();else if(this._moved||!(o.dist(u)<this._clickTolerance))return this._moved=!0,this._lastPoint=o,this._move(u,o)}}mouseupWindow(r){this._lastPoint&&Mn(r)===this._eventButton&&(this._moved&&wo(),this.reset())}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class du extends vn{mousedown(r,o){super.mousedown(r,o),this._lastPoint&&(this._active=!0)}_correctButton(r,o){return o===0&&!r.ctrlKey}_move(r,o){return{around:o,panDelta:o.sub(r)}}}class ba extends vn{_correctButton(r,o){return o===0&&r.ctrlKey||o===2}_move(r,o){const u=.8*(o.x-r.x);if(u)return this._active=!0,{bearingDelta:u}}contextmenu(r){r.preventDefault()}}class vl extends vn{_correctButton(r,o){return o===0&&r.ctrlKey||o===2}_move(r,o){const u=-.5*(o.y-r.y);if(u)return this._active=!0,{pitchDelta:u}}contextmenu(r){r.preventDefault()}}class fu{constructor(r,o){this._map=r,this._el=r.getCanvasContainer(),this._minTouches=1,this._clickTolerance=o.clickTolerance||1,this.reset(),a.aY(["_addTouchPanBlocker","_showTouchPanBlockerAlert"],this)}reset(){this._active=!1,this._touches={},this._sum=new a.P(0,0)}touchstart(r,o,u){return this._calculateTransform(r,o,u)}touchmove(r,o,u){if(this._active&&!(u.length<this._minTouches)){if(this._map._cooperativeGestures&&!this._map.isMoving()){if(u.length===1&&!a.c$())return void this._showTouchPanBlockerAlert();this._alertContainer.style.visibility!=="hidden"&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}return r.cancelable&&r.preventDefault(),this._calculateTransform(r,o,u)}}touchend(r,o,u){this._calculateTransform(r,o,u),this._active&&u.length<this._minTouches&&this.reset()}touchcancel(){this.reset()}_calculateTransform(r,o,u){u.length>0&&(this._active=!0);const d=Es(u,o),p=new a.P(0,0),g=new a.P(0,0);let x=0;for(const T in d){const M=d[T],S=this._touches[T];S&&(p._add(M),g._add(M.sub(S)),x++,d[T]=M)}if(this._touches=d,x<this._minTouches||!g.mag())return;const b=g.div(x);return this._sum._add(b),this._sum.mag()<this._clickTolerance?void 0:{around:p.div(x),panDelta:b}}enable(){this._enabled=!0,this._map._cooperativeGestures&&(this._addTouchPanBlocker(),this._el.classList.add("mapboxgl-touch-pan-blocker-override","mapboxgl-scrollable-page"))}disable(){this._enabled=!1,this._map._cooperativeGestures&&(clearTimeout(this._alertTimer),this._alertContainer.remove(),this._el.classList.remove("mapboxgl-touch-pan-blocker-override","mapboxgl-scrollable-page")),this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}_addTouchPanBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=Wt("div","mapboxgl-touch-pan-blocker",this._map._container),this._alertContainer.textContent=this._map._getUIString("TouchPanBlocker.Message"),this._alertContainer.style.fontSize=`${Math.max(10,Math.min(24,Math.floor(.05*this._el.clientWidth)))}px`)}_showTouchPanBlockerAlert(){this._alertContainer.style.visibility="visible",this._alertContainer.classList.add("mapboxgl-touch-pan-blocker-show"),this._alertContainer.setAttribute("role","alert"),clearTimeout(this._alertTimer),this._alertTimer=setTimeout(()=>{this._alertContainer.classList.remove("mapboxgl-touch-pan-blocker-show"),this._alertContainer.removeAttribute("role")},500)}}class Ji{constructor(){this.reset()}reset(){this._active=!1,this._firstTwoTouches=void 0}_start(r){}_move(r,o,u){return{}}touchstart(r,o,u){this._firstTwoTouches||u.length<2||(this._firstTwoTouches=[u[0].identifier,u[1].identifier],this._start([o[0],o[1]]))}touchmove(r,o,u){const d=this._firstTwoTouches;if(!d)return;r.preventDefault();const[p,g]=d,x=Ss(u,o,p),b=Ss(u,o,g);if(!x||!b)return;const T=this._aroundCenter?null:x.add(b).div(2);return this._move([x,b],T,r)}touchend(r,o,u){if(!this._firstTwoTouches)return;const[d,p]=this._firstTwoTouches,g=Ss(u,o,d),x=Ss(u,o,p);g&&x||(this._active&&wo(),this.reset())}touchcancel(){this.reset()}enable(r){this._enabled=!0,this._aroundCenter=!!r&&r.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}function Ss(c,r,o){for(let u=0;u<c.length;u++)if(c[u].identifier===o)return r[u]}function bl(c,r){return Math.log(c/r)/Math.LN2}class wa extends Ji{reset(){super.reset(),this._distance=0,this._startDistance=0}_start(r){this._startDistance=this._distance=r[0].dist(r[1])}_move(r,o){const u=this._distance;if(this._distance=r[0].dist(r[1]),this._active||!(Math.abs(bl(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:bl(this._distance,u),pinchAround:o}}}function po(c,r){return 180*c.angleWith(r)/Math.PI}class pu extends Ji{reset(){super.reset(),this._minDiameter=0,this._startVector=void 0,this._vector=void 0}_start(r){this._startVector=this._vector=r[0].sub(r[1]),this._minDiameter=r[0].dist(r[1])}_move(r,o){const u=this._vector;if(this._vector=r[0].sub(r[1]),u&&(this._active||!this._isBelowThreshold(this._vector)))return this._active=!0,{bearingDelta:po(this._vector,u),pinchAround:o}}_isBelowThreshold(r){this._minDiameter=Math.min(this._minDiameter,r.mag());const o=25/(Math.PI*this._minDiameter)*360,u=this._startVector;if(!u)return!1;const d=po(r,u);return Math.abs(d)<o}}function Ta(c){return Math.abs(c.y)>Math.abs(c.x)}class mu extends Ji{constructor(r){super(),this._map=r}reset(){super.reset(),this._valid=void 0,this._firstMove=void 0,this._lastPoints=void 0}_start(r){this._lastPoints=r,Ta(r[0].sub(r[1]))&&(this._valid=!1)}_move(r,o,u){const d=this._lastPoints;if(!d)return;const p=r[0].sub(d[0]),g=r[1].sub(d[1]);return this._map._cooperativeGestures&&!a.c$()&&u.touches.length<3||(this._valid=this.gestureBeginsVertically(p,g,u.timeStamp),!this._valid)?void 0:(this._lastPoints=r,this._active=!0,{pitchDelta:(p.y+g.y)/2*-.5})}gestureBeginsVertically(r,o,u){if(this._valid!==void 0)return this._valid;const d=r.mag()>=2,p=o.mag()>=2;if(!d&&!p)return;if(!d||!p)return this._firstMove==null&&(this._firstMove=u),u-this._firstMove<100&&void 0;const g=r.y>0==o.y>0;return Ta(r)&&Ta(o)&&g}}const jo={panStep:100,bearingStep:15,pitchStep:10};class Ma{constructor(){const r=jo;this._panStep=r.panStep,this._bearingStep=r.bearingStep,this._pitchStep=r.pitchStep,this._rotationDisabled=!1}blur(){this.reset()}reset(){this._active=!1}keydown(r){if(r.altKey||r.ctrlKey||r.metaKey)return;let o=0,u=0,d=0,p=0,g=0;switch(r.keyCode){case 61:case 107:case 171:case 187:o=1;break;case 189:case 109:case 173:o=-1;break;case 37:r.shiftKey?u=-1:(r.preventDefault(),p=-1);break;case 39:r.shiftKey?u=1:(r.preventDefault(),p=1);break;case 38:r.shiftKey?d=1:(r.preventDefault(),g=-1);break;case 40:r.shiftKey?d=-1:(r.preventDefault(),g=1);break;default:return}return this._rotationDisabled&&(u=0,d=0),{cameraAnimation:x=>{const b=x.getZoom();x.easeTo({duration:300,easeId:"keyboardHandler",easing:_u,zoom:o?Math.round(b)+o*(r.shiftKey?2:1):b,bearing:x.getBearing()+u*this._bearingStep,pitch:x.getPitch()+d*this._pitchStep,offset:[-p*this._panStep,-g*this._panStep],center:x.getCenter()},{originalEvent:r})}}}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 _u(c){return c*(2-c)}const Ea=4.000244140625,gu=1/450;class zh{constructor(r,o){this._map=r,this._el=r.getCanvasContainer(),this._handler=o,this._delta=0,this._lastDelta=0,this._defaultZoomRate=.01,this._wheelZoomRate=gu,a.aY(["_onTimeout","_addScrollZoomBlocker","_showBlockerAlert"],this)}setZoomRate(r){this._defaultZoomRate=r}setWheelZoomRate(r){this._wheelZoomRate=r}isEnabled(){return!!this._enabled}isActive(){return this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(r){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!r&&r.around==="center",this._map._cooperativeGestures&&this._addScrollZoomBlocker())}disable(){this.isEnabled()&&(this._enabled=!1,this._map._cooperativeGestures&&(clearTimeout(this._alertTimer),this._alertContainer.remove()))}wheel(r){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!(r.ctrlKey||r.metaKey||this.isZooming()||a.c$()))return void this._showBlockerAlert();this._alertContainer.style.visibility!=="hidden"&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}let o=r.deltaMode===WheelEvent.DOM_DELTA_LINE?40*r.deltaY:r.deltaY;const u=a.f.now(),d=u-(this._lastWheelEventTime||0);this._lastWheelEventTime=u,o!==0&&o%Ea==0?this._type="wheel":o!==0&&Math.abs(o)<4?this._type="trackpad":d>400?(this._type=null,this._lastValue=o,this._timeout=setTimeout(this._onTimeout,40,r)):this._type||(this._type=Math.abs(d*o)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,o+=this._lastValue)),r.shiftKey&&o&&(o/=4),this._type&&(this._lastWheelEvent=r,this._delta-=o,this._active||this._start(r)),r.preventDefault()}_onTimeout(r){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(r)}_start(r){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const o=$n(this._el,r);this._aroundPoint=this._aroundCenter?this._map.transform.centerPoint:o,this._aroundCoord=this._map.transform.pointCoordinate3D(this._aroundPoint),this._targetZoom=void 0,this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const r=this._map.transform;this._type==="wheel"&&r.projection.wrap&&(r._center.lng>=180||r._center.lng<=-180)&&(this._prevEase=null,this._easing=null,this._lastWheelEvent=null,this._lastWheelEventTime=0);const o=()=>r._terrainEnabled()&&this._aroundCoord?r.computeZoomRelativeTo(this._aroundCoord):r.zoom;if(this._delta!==0){const T=this._type==="wheel"&&Math.abs(this._delta)>Ea?this._wheelZoomRate:this._defaultZoomRate;let M=2/(1+Math.exp(-Math.abs(this._delta*T)));this._delta<0&&M!==0&&(M=1/M);const S=o(),C=Math.pow(2,S),P=typeof this._targetZoom=="number"?r.zoomScale(this._targetZoom):C;this._targetZoom=Math.min(r.maxZoom,Math.max(r.minZoom,r.scaleZoom(P*M))),this._type==="wheel"&&(this._startZoom=S,this._easing=this._smoothOutEasing(200)),this._lastDelta=this._delta,this._delta=0}const u=typeof this._targetZoom=="number"?this._targetZoom:o(),d=this._startZoom,p=this._easing;let g,x=!1;if(this._type==="wheel"&&d&&p){const T=Math.min((a.f.now()-this._lastWheelEventTime)/200,1),M=p(T);g=a.U(d,u,M),T<1?this._frameId||(this._frameId=!0):x=!0}else g=u,x=!0;this._active=!0,x&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200));let b=g-o();return b*this._lastDelta<0&&(b=0),{noInertia:!0,needsRenderFrame:!x,zoomDelta:b,around:this._aroundPoint,aroundCoord:this._aroundCoord,originalEvent:this._lastWheelEvent}}_smoothOutEasing(r){let o=a.d0;if(this._prevEase){const u=this._prevEase,d=(a.f.now()-u.start)/u.duration,p=u.easing(d+.01)-u.easing(d),g=.27/Math.sqrt(p*p+1e-4)*.01,x=Math.sqrt(.0729-g*g);o=a.c_(g,x,.25,1)}return this._prevEase={start:a.f.now(),duration:r,easing:o},o}blur(){this.reset()}reset(){this._active=!1}_addScrollZoomBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=Wt("div","mapboxgl-scroll-zoom-blocker",this._map._container),this._alertContainer.textContent=/(Mac|iPad)/i.test(navigator.userAgent)?this._map._getUIString("ScrollZoomBlocker.CmdMessage"):this._map._getUIString("ScrollZoomBlocker.CtrlMessage"),this._alertContainer.style.fontSize=`${Math.max(10,Math.min(24,Math.floor(.05*this._el.clientWidth)))}px`)}_showBlockerAlert(){this._alertContainer.style.visibility="visible",this._alertContainer.classList.add("mapboxgl-scroll-zoom-blocker-show"),this._alertContainer.setAttribute("role","alert"),clearTimeout(this._alertTimer),this._alertTimer=setTimeout(()=>{this._alertContainer.classList.remove("mapboxgl-scroll-zoom-blocker-show"),this._alertContainer.removeAttribute("role")},200)}}class Dh{constructor(r,o){this._clickZoom=r,this._tapZoom=o}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 Lh{constructor(){this.reset()}reset(){this._active=!1}blur(){this.reset()}dblclick(r,o){return r.preventDefault(),{cameraAnimation:u=>{u.easeTo({duration:300,zoom:u.getZoom()+(r.shiftKey?-1:1),around:u.unproject(o)},{originalEvent:r})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Rh{constructor(){this._tap=new va({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,this._swipePoint=void 0,this._swipeTouch=0,this._tapTime=0,this._tap.reset()}touchstart(r,o,u){this._swipePoint||(this._tapTime&&r.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?u.length>0&&(this._swipePoint=o[0],this._swipeTouch=u[0].identifier):this._tap.touchstart(r,o,u))}touchmove(r,o,u){if(this._tapTime){if(this._swipePoint){if(u[0].identifier!==this._swipeTouch)return;const d=o[0],p=d.y-this._swipePoint.y;return this._swipePoint=d,r.preventDefault(),this._active=!0,{zoomDelta:p/128}}}else this._tap.touchmove(r,o,u)}touchend(r,o,u){this._tapTime?this._swipePoint&&u.length===0&&this.reset():this._tap.touchend(r,o,u)&&(this._tapTime=r.t
vendor: 6,156 bytes, line 2107
2107imeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class kh{constructor(r,o,u){this._el=r,this._mousePan=o,this._touchPan=u}enable(r){this._inertiaOptions=r||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("mapboxgl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("mapboxgl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class Oh{constructor(r,o,u){this._pitchWithRotate=r.pitchWithRotate,this._mouseRotate=o,this._mousePitch=u}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class Bh{constructor(r,o,u,d){this._el=r,this._touchZoom=o,this._touchRotate=u,this._tapDragZoom=d,this._rotationDisabled=!1,this._enabled=!0}enable(r){this._touchZoom.enable(r),this._rotationDisabled||this._touchRotate.enable(r),this._tapDragZoom.enable(),this._el.classList.add("mapboxgl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("mapboxgl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}const Sa=c=>c.zoom||c.drag||c.pitch||c.rotate;class Fh extends a.b{}class Nh{constructor(){this.constants=[1,1,.01],this.radius=0}setup(r,o){const u=a.N.sub([],o,r);this.radius=a.N.length(u[2]<0?a.N.div([],u,this.constants):[u[0],u[1],0])}projectRay(r){a.N.div(r,r,this.constants),a.N.normalize(r,r),a.N.mul(r,r,this.constants);const o=a.N.scale([],r,this.radius);if(o[2]>0){const u=a.N.scale([],[0,0,1],a.N.dot(o,[0,0,1])),d=a.N.scale([],a.N.normalize([],[o[0],o[1],0]),this.radius),p=a.N.add([],o,a.N.scale([],a.N.sub([],a.N.add([],d,u),o),2));o[0]=p[0],o[1]=p[1]}return o}}function Aa(c){return c.panDelta&&c.panDelta.mag()||c.zoomDelta||c.bearingDelta||c.pitchDelta}class _f{constructor(r,o){this._map=r,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new li(r),this._bearingSnap=o.bearingSnap,this._previousActiveHandlers={},this._trackingEllipsoid=new Nh,this._dragOrigin=null,this._eventsInProgress={},this._addDefaultHandlers(o),a.aY(["handleEvent","handleWindowEvent"],this);const u=this._el;this._listeners=[[u,"touchstart",{passive:!0}],[u,"touchmove",{passive:!1}],[u,"touchend",void 0],[u,"touchcancel",void 0],[u,"mousedown",void 0],[u,"mousemove",void 0],[u,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[u,"mouseover",void 0],[u,"mouseout",void 0],[u,"dblclick",void 0],[u,"click",void 0],[u,"keydown",{capture:!1}],[u,"keyup",void 0],[u,"wheel",{passive:!1}],[u,"contextmenu",void 0],[window,"blur",void 0]];for(const[d,p,g]of this._listeners){const x=d===document?this.handleWindowEvent:this.handleEvent;d.addEventListener(p,x,g)}}destroy(){for(const[r,o,u]of this._listeners){const d=r===document?this.handleWindowEvent:this.handleEvent;r.removeEventListener(o,d,u)}}_addDefaultHandlers(r){const o=this._map,u=o.getCanvasContainer();this._add("mapEvent",new cu(o,r));const d=o.boxZoom=new fo(o,r);this._add("boxZoom",d);const p=new uu,g=new Lh;o.doubleClickZoom=new Dh(g,p),this._add("tapZoom",p),this._add("clickZoom",g);const x=new Rh;this._add("tapDragZoom",x);const b=o.touchPitch=new mu(o);this._add("touchPitch",b);const T=new ba(r),M=new vl(r);o.dragRotate=new Oh(r,T,M),this._add("mouseRotate",T,["mousePitch"]),this._add("mousePitch",M,["mouseRotate"]);const S=new du(r),C=new fu(o,r);o.dragPan=new kh(u,S,C),this._add("mousePan",S),this._add("touchPan",C,["touchZoom","touchRotate"]);const P=new pu,k=new wa;o.touchZoomRotate=new Bh(u,k,P,x),this._add("touchRotate",P,["touchPan","touchZoom"]),this._add("touchZoom",k,["touchPan","touchRotate"]),this._add("blockableMapEvent",new ho(o));const R=o.scrollZoom=new zh(o,this);this._add("scrollZoom",R,["mousePan"]);const O=o.keyboard=new Ma;this._add("keyboard",O);for(const D of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])r.interactive&&r[D]&&o[D].enable(r[D])}_add(r,o,u){this._handlers.push({handlerName:r,handler:o,allowed:u}),this._handlersById[r]=o}stop(r){if(!this._updatingCamera){for(const{handler:o}of this._handlers)o.reset();this._inertia.clear(),this._fireEvents({},{},r),this._changes=[],this._originalZoom=void 0}}isActive(){for(const{handler:r}of this._handlers)if(r.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!Sa(this._eventsInProgress)||this.isZooming()}_isDragging(){return!!this._eventsInProgress.drag}_blockedByActive(r,o,u){for(const d in r)if(d!==u&&(!o||o.indexOf(d)<0))return!0;return!1}handleWindowEvent(r){this.handleEvent(r,`${r.type}Window`)}_getMapTouches(r){const o=[];for(const u of r)this._el.contains(u.target)&&o.push(u);return o}handleEvent(r,o){this._updatingCamera=!0;const u=r.type==="renderFrame",d=u?void 0:r,p={needsRenderFrame:!1},g={},x={},b=r.touches?this._getMapTouches(r.touches):void 0,T=b?Wn(this._el,b):u?void 0:$n(this._el,r);for(const{handlerName:C,handler:P,allowed:k}of this._handlers){if(!P.isEnabled())continue;let R;this._blockedByActive(x,k,C)?P.reset():P[o||r.type]&&(R=P[o||r.type](r,T,b),this.mergeHandlerResult(p,g,R,C,d),R&&R.needsRenderFrame&&this._triggerRe
vendor: 4,105 bytes, line 2107
2107nderFrame()),(R||P.isActive())&&(x[C]=P)}const M={};for(const C in this._previousActiveHandlers)x[C]||(M[C]=d);this._previousActiveHandlers=x,(Object.keys(M).length||Aa(p))&&(this._changes.push([p,g,M]),this._triggerRenderFrame()),(Object.keys(x).length||Aa(p))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:S}=p;S&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],S(this._map))}mergeHandlerResult(r,o,u,d,p){if(!u)return;a.e(r,u);const g={handlerName:d,originalEvent:u.originalEvent||p};u.zoomDelta!==void 0&&(o.zoom=g),u.panDelta!==void 0&&(o.drag=g),u.pitchDelta!==void 0&&(o.pitch=g),u.bearingDelta!==void 0&&(o.rotate=g)}_applyChanges(){const r={},o={},u={};for(const[d,p,g]of this._changes)d.panDelta&&(r.panDelta=(r.panDelta||new a.P(0,0))._add(d.panDelta)),d.zoomDelta&&(r.zoomDelta=(r.zoomDelta||0)+d.zoomDelta),d.bearingDelta&&(r.bearingDelta=(r.bearingDelta||0)+d.bearingDelta),d.pitchDelta&&(r.pitchDelta=(r.pitchDelta||0)+d.pitchDelta),d.around!==void 0&&(r.around=d.around),d.aroundCoord!==void 0&&(r.aroundCoord=d.aroundCoord),d.pinchAround!==void 0&&(r.pinchAround=d.pinchAround),d.noInertia&&(r.noInertia=d.noInertia),a.e(o,p),a.e(u,g);this._updateMapTransform(r,o,u),this._changes=[]}_updateMapTransform(r,o,u){const d=this._map,p=d.transform,g=F=>[F.x,F.y,F.z];if((F=>{const Z=this._eventsInProgress.drag;return Z&&!this._handlersById[Z.handlerName].isActive()})()&&!Aa(r)){const F=p.zoom;p.cameraElevationReference="sea",this._originalZoom!=null&&p._orthographicProjectionAtLowPitch&&p.projection.name!=="globe"&&p.pitch===0?(p.cameraElevationReference="ground",p.zoom=this._originalZoom):(p.recenterOnTerrain(),p.cameraElevationReference="ground"),F!==p.zoom&&this._map._update(!0)}if(p._isCameraConstrained&&d._stop(!0),!Aa(r))return void this._fireEvents(o,u,!0);let{panDelta:x,zoomDelta:b,bearingDelta:T,pitchDelta:M,around:S,aroundCoord:C,pinchAround:P}=r;p._isCameraConstrained&&(b>0&&(b=0),p._isCameraConstrained=!1),P!==void 0&&(S=P),(b||(F=>o[F]&&!this._eventsInProgress[F])("drag"))&&S&&(this._dragOrigin=g(p.pointCoordinate3D(S)),this._originalZoom=p.zoom,this._trackingEllipsoid.setup(p._camera.position,this._dragOrigin)),p.cameraElevationReference="sea",d._stop(!0),S=S||d.transform.centerPoint,T&&(p.bearing+=T),M&&(p.pitch+=M),p._updateCameraState();const k=[0,0,0];if(x)if(p.projection.name==="mercator"){const F=this._trackingEllipsoid.projectRay(p.screenPointToMercatorRay(S).dir),Z=this._trackingEllipsoid.projectRay(p.screenPointToMercatorRay(S.sub(x)).dir);k[0]=Z[0]-F[0],k[1]=Z[1]-F[1]}else{const F=p.pointCoordinate(S);if(p.projection.name==="globe"){x=x.rotate(-p.angle);const Z=p._pixelsPerMercatorPixel/p.worldSize;k[0]=-x.x*a.d1(a.au(F.y))*Z,k[1]=-x.y*a.d1(p.center.lat)*Z}else{const Z=p.pointCoordinate(S.sub(x));F&&Z&&(k[0]=Z.x-F.x,k[1]=Z.y-F.y)}}const R=p.zoom,O=[0,0,0];if(b){const F=g(C||p.pointCoordinate3D(S)),Z={dir:a.N.normalize([],a.N.sub([],F,p._camera.position))};if(Z.dir[2]<0){const V=p.zoomDeltaToMovement(F,b);a.N.scale(O,Z.dir,V)}}const D=a.N.add(k,k,O);p._translateCameraConstrained(D),b&&Math.abs(p.zoom-R)>1e-4&&p.recenterOnTerrain(),p.cameraElevationReference="ground",this._map._update(),r.noInertia||this._inertia.record(r),this._fireEvents(o,u,!0)}_fireEvents(r,o,u){const d=Sa(this._eventsInProgress),p=Sa(r),g={};for(const M in r){const{originalEvent:S}=r[M];this._eventsInProgress[M]||(g[`${M}start`]=S),this._eventsInProgress[M]=r[M]}!d&&p&&this._fireEvent("movestart",p.originalEvent);for(const M in g)this._fireEvent(M,g[M]);p&&this._fireEvent("move",p.originalEvent);for(const M in r){const{originalEvent:S}=r[M];this._fireEvent(M,S)}const x={};let b;for(const M in this._eventsInProgress){const{handlerName:S,originalEvent:C}=this._eventsInProgress[M];this._handlersById[S].isActive()||(delete this._eventsInProgress[M],b=o[S]||C,x[`${M}end`]=b)}for(const M in x)this._fireEvent(M,x[M]);const T=Sa(this._eventsInProgress);if(u&&(d||p)&&!T){this._updatingCamera=!0;const M=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),S=C=>C!==0&&-this._bearingSnap<C&&C<this._bearingSnap;
2107M?(S(M.bearing||this._map.getBearing())&&(M.bearing=0),this._map.easeTo(M,{originalEvent:b})):(this._map.fire(new a.b("moveend",{originalEvent:b})),S(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(r,o){this._map.fire(new a.b(r,o?{originalEvent:o}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(r=>{this._frameId=void 0,this.handleEvent(new Fh("renderFrame",{timeStamp:r})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}const Vh="map.setFreeCameraOptions(...) and map.getFreeCameraOptions() are not yet supported for non-mercator projections.";class Oi extends a.E{constructor(r,o){super(),this._moving=!1,this._zooming=!1,this.transform=r,this._bearingSnap=o.bearingSnap,this._respectPrefersReducedMotion=o.respectPrefersReducedMotion!==!1,a.aY(["_renderFrameCallback"],this)}getCenter(){return new a.bn(this.transform.center.lng,this.transform.center.lat)}setCenter(r,o){return this.jumpTo({center:r},o)}panBy(r,o,u){return r=a.P.convert(r).mult(-1),this.panTo(this.transform.center,a.e({offset:r},o),u)}panTo(r,o,u){return this.easeTo(a.e({center:r},o),u)}getZoom(){return this.transform.zoom}setZoom(r,o){return this.jumpTo({zoom:r},o),this}zoomTo(r,o,u){return this.easeTo(a.e({zoom:r},o),u)}zoomIn(r,o){return this.zoomTo(this.getZoom()+1,r,o),this}zoomOut(r,o){return this.zoomTo(this.getZoom()-1,r,o),this}getBearing(){return this.transform.bearing}setBearing(r,o){return this.jumpTo({bearing:r},o),this}getPadding(){return this.transform.padding}setPadding(r,o){return this.jumpTo({padding:r},o),this}rotateTo(r,o,u){return this.easeTo(a.e({bearing:r},o),u)}resetNorth(r,o){return this.rotateTo(0,a.e({duration:1e3},r),o),this}resetNorthPitch(r,o){return this.easeTo(a.e({bearing:0,pitch:0,duration:1e3},r),o),this}snapToNorth(r,o){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(r,o):this}getPitch(){return this.transform.pitch}setPitch(r,o){return this.jumpTo({pitch:r},o),this}cameraForBounds(r,o){r=a.ad.convert(r);const u=o&&o.bearing||0,d=o&&o.pitch||0,p=r.getNorthWest(),g=r.getSouthEast();return this._cameraForBounds(this.transform,p,g,u,d,o)}_extendCameraOptions(r){const o={top:0,bottom:0,right:0,left:0};if(typeof(r=a.e({padding:o,offset:[0,0],maxZoom:this.transform.maxZoom},r)).padding=="number"){const u=r.padding;r.padding={top:u,bottom:u,right:u,left:u}}return r.padding=a.e(o,r.padding),r}_minimumAABBFrustumDistance(r,o){const u=o.max[0]-o.min[0],d=o.max[1]-o.min[1];return u/d>r.aspect?u/(2*Math.tan(.5*r.fovX)*r.aspect):d/(2*Math.tan(.5*r.fovY)*r.aspect)}_cameraForBoundsOnGlobe(r,o,u,d,p,g){const x=r.clone(),b=this._extendCameraOptions(g);x.bearing=d,x.pitch=p;const T=a.bn.convert(o),M=a.bn.convert(u),S=.5*(T.lat+M.lat),C=.5*(T.lng+M.lng),P=a.d2(S,C),k=a.N.normalize([],P),R=a.N.normalize([],a.N.cross([],k,[0,1,0])),O=a.N.cross([],R,k),D=[R[0],R[1],R[2],0,O[0],O[1],O[2],0,k[0],k[1],k[2],0,0,0,0,1],F=[P,a.d2(T.lat,T.lng),a.d2(M.lat,T.lng),a.d2(M.lat,M.lng),a.d2(T.lat,M.lng),a.d2(S,T.lng),a.d2(S,M.lng),a.d2(T.lat,C),a.d2(M.lat,C)];let Z=a.bS.fromPoints(F.map(ae=>[a.N.dot(R,ae),a.N.dot(O,ae),a.N.dot(k,ae)]));const V=a.N.transformMat4([],Z.center,D);a.N.squaredLength(V)===0&&a.N.set(V,0,0,1),a.N.normalize(V,V),a.N.scale(V,V,a.ab),x.center=a.d3(V);const q=x.getWorldToCameraMatrix(),B=a.a6.invert(new Float64Array(16),q);Z=a.bS.applyTransform(Z,a.a6.multiply([],q,D)),a.N.transformMat4(V,V,q);const $=.5*(Z.max[2]-Z.min[2]),Y=this._minimumAABBFrustumDistance(x,Z),K=a.N.scale([],[0,0,1],$),ee=a.N.add(K,V,K),ce=Y+(x.pitch===0?0:a.N.distance(V,ee)),re=x.globeCenterInViewSpace,me=a.N.sub([],V,[re[0],re[1],re[2]]);a.N.normalize(me,me),a.N.scale(me,me,ce);const fe=a.N.add([],V,me);a.N.transformMat4(fe,fe,B);const Ae=a.d4/a.ab,ne=a.N.length(fe),he=a.bl(Math.max(ne*Ae-a.d4,Number.EPSILON),0),Q=Math.min(x.zoomFromMercatorZAdjusted(he),b.maxZoom);return Q>.5*(a.bG+a.bx)?(x.setProjection({name:"mercator"}),x.zoom=Q,this._cameraForBounds(x,o,u,d,p,g)):{center:x.center,zoom:Q,bearing:d,pitch:p}}queryTerrainElevation(r,o){const u=this.transform.elevation;return u?(o=a.e({},{exaggerated:!0},o),u.getAtPoint(a.L.fromLngLat(r),null,o.exaggerated)):null}_cameraForBounds(r,o,u,d,p,g){if(r.projection.name==="globe")return this._cameraForBoundsOnGlobe(r,o,u,d,p,g);const x=r.clone(),b=this._extendCameraOptions(g),T=x.padding;x.bearing=d,x.pitch=p;const M=a.bn.convert(o),S=a.bn.convert(u),C=new a.bn(M.lng,S.lat),P=new a.bn(S.lng,M.lat),k=x.project(M),R=x.project(S),O=this.queryTerrainElevation(M),D=this.queryTerrainElevation(S),F=this.queryTerrainElevation(C),Z=this.queryTerrainElevation(P),V=[[k.x,k.y,Math.min(O||0,D||0,F||0,Z||0)],[R.x,R.y,Math.max(O||0,D||0,F||0,Z||0)]];let q=a.bS.fromPoints(V);const B=x.getWorldToCameraMatrix(),$=a.a6.invert(new Float64Array(16),B);q=a.bS.applyTransform(q,B);const Y=a.N.sub([],q.max,q.min),K=T.left||0,ee=T.right||0,ce=T.bottom||0,re=T.top||0,{left:me,right:fe,top:Ae,bottom:ne}=b.padding,he=.5*(K+ee),Q=.5*(re+ce),ae=Math.min(x.scaleZoom(x.scale*Math.min((x.width-(K+ee+me+fe))/Y[0],(x.height-(ce+re+ne+Ae))/Y[1])),b.maxZoom),Ie=x.scale/x.zoomScale(ae);q=new a.bS([q.min[0]-(me+he)*Ie,q.min[1]-(ne+Q)*Ie,q.min[2]],[q.max[0]+(fe+he)*Ie,q.max[1]+(Ae+Q)*Ie,q.max[2]]);const Re=.5*Y[2],Le=this._minimumAABBFrustumDistance(x,q),je=[0,0,1,0];a.a7.transformMat4(je,je,B),a.a7.normalize(je,je);const et=a.N.scale([],je,Le+Re),ct=a.N.add([],q.center,et),nt=(typeof b.offset.x=="number"&&typeof b.offset.y=="number"?new a.P(b.offset.x,b.offset.y):a.P.convert(b.offset)).rotate(-a.bj(d));q.center[0]-=nt.x*Ie,q.center[1]+=nt.y*Ie,a.N.transformMat4(q.center,q.center,$),a.N.transformMat4(ct,ct,$);const at=[q.center[0],q.center[1],ct[2]*x.pixelsPerMeter];a.N.scale(at,at,1/x.worldSize);const Et=a.at(at[0]),gt=a.au(at[1]),bt=Math.min(x._zoomFromMercatorZ(at[2]),b.maxZoom),vt=new a.bn(Et,gt);return x.mercatorFromTransition&&bt<.5*(a.bG+a.bx)?(x.setProjection({name:"globe"}),x.zoom=bt,this._cameraForBounds(x,o,u,d,p,g)):{center:vt,zoom:bt,bearing:d,pitch:p}}fitBounds(r,o,u){const d=this.cameraForBounds(r,o);return this._fitInternal(d,o,u)}fitScreenCoordinates(r,o,u,d,p){const g=a.P.convert(r),x=a.P.convert(o),b=new a.P(Math.min(g.x,x.x),Math.min(g.y,x.y)),T=new a.P(Math.max(g.x,x.x),Math.max(g.y,x.y));if(this.transform.projection.name==="mercator"&&this.transform.anyCornerOffEdge(g,x))return this;const M=this.transform.pointLocation3D(b),S=this.transform.pointLocation3D(T),C=this.transform.pointLocation3D(new a.P(b.x,T.y)),P=this.transform.pointLocation3D(new a.P(T.x,b.y)),k=[Math.min(M.lng,S.lng,C.lng,P.lng),Math.min(M.lat,S.lat,C.lat,P.lat)],R=[Math.max(M.lng,S.lng,C.lng,P.lng),Math.max(M.lat,S.lat,C.lat,P.lat)],O=d&&d.pitch?d.pitch:this.getPitch(),D=this._cameraForBounds(this.transform,k,R,u,O,d);return this._fitInternal(D,d,p)}_fitInternal(r,o,u){return r?(delete(o=a.e(r,o)).padding,o.linear?this.easeTo(o,u):this.flyTo(o,u)):this}jumpTo(r,o){this.stop();const u=r.preloadOnly?this.transform.clone():this.transform;let d=!1,p=!1,g=!1;return"zoom"in r&&u.zoom!==+r.zoom&&(d=!0,u.zoom=+r.zoom),r.center!==void 0&&(u.center=a.bn.convert(r.center)),"bearing"in r&&u.bearing!==+r.bearing&&(p=!0,u.bearing=+r.bearing),"pitch"in r&&u.pitch!==+r.pitch&&(g=!0,u.pitch=+r.pitch),r.padding==null||u.isPaddingEqual(r.padding)||(u.padding=r.padding),r.preloadOnly?(this._preloadTiles(u),this):(this.fire(new a.b("movestart",o)).fire(new a.b("move",o)),d&&this.fire(new a.b("zoomstart",o)).fire(new a.b("zoom",o)).fire(new a.b("zoomend",o)),p&&this.fire(new a.b("rotatestart",o)).fire(new a.b("rotate",o)).fire(new a.b("rotateend",o)),g&&this.fire(new a.b("pitchstart",o)).fire(new a.b("pitch",o)).fire(new a.b("pitchend",o)),this.fire(new a.b("moveend",o)))}getFreeCameraOptions(){return this.transform.projection.supportsFreeCamera||a.w(Vh),this.transform.getFreeCameraOptions()}setFreeCameraOptions(r,o){const u=this.transform;if(!u.projection.supportsFreeCamera)return a.w(Vh),this;this.stop();const d=u.zoom,p=u.pitch,g=u.bearing;u.setFreeCameraOptions(r);const x=d!==u.zoom,b=p!==u.pitch,T=g!==u.bearing;return this.fire(new a.b("movestart",o)).fire(new a.b("move",o)),x&&this.fire(new a.b("zoomstart",o)).fire(new a.b("zoom",o)).fire(new a.b("zoomend",o)),T&&this.fire(new a.b("rotatestart",o)).fire(new a.b("rotate",o)).fire(new a.b("rotateend",o)),b&&this.fire(new a.b("pitchstart",o)).fire(new a.b("pitch",o)).fire(new a.b("pitchend",o)),this.fire(new a.b("moveend",o)),this}easeTo(r,o){this._stop(!1,r.easeId),((r=a.e({offset:[0,0],duration:500,easing:a.d0},r)).animate===!1||this._prefersReducedMotion(r))&&(r.duration=0);const u=this.transform,d=this.getZoom(),p=this.getBearing(),g=this.getPitch(),x=this.getPadding(),b="zoom"in r?+r.zoom:d,T="bearing"in r?this._normalizeBearing(r.bearing,p):p,M="pitch"in r?+r.pitch:g,S="padding"in r?r.padding:u.padding,C=a.P.convert(r.offset);let P,k,R;if(u.projection.name==="globe"){const K=a.L.fromLngLat(u.center),ee=C.rotate(-u.angle);K.x+=ee.x/u.worldSize,K.y+=ee.y/u.worldSize;const ce=K.toLngLat(),re=a.bn.convert(r.center||ce);this._normalizeCenter(re),P=u.centerPoint.add(ee),k=new a.P(K.x,K.y).mult(u.worldSize),R=new a.P(a.a5(re.lng),a.ae(re.lat)).mult(u.worldSize).sub(k)}else{P=u.centerPoint.add(C);const K=u.pointLocation(P),ee=a.bn.convert(r.center||K);this._normalizeCenter(ee),k=u.project(K),R=u.project(ee).sub(k)}const O=u.zoomScale(b-d);let D,F;
vendor: 10,460 bytes, line 2107
2107r.around&&(D=a.bn.convert(r.around),F=u.locationPoint(D));const Z=this._zooming||b!==d,V=this._rotating||p!==T,q=this._pitching||M!==g,B=!u.isPaddingEqual(S),$=K=>ee=>{if(Z&&(K.zoom=a.U(d,b,ee)),V&&(K.bearing=a.U(p,T,ee)),q&&(K.pitch=a.U(g,M,ee)),B&&(K.interpolatePadding(x,S,ee),P=K.centerPoint.add(C)),D)K.setLocationAtPoint(D,F);else{const ce=K.zoomScale(K.zoom-d),re=b>d?Math.min(2,O):Math.max(.5,O),me=Math.pow(re,1-ee),fe=K.unproject(k.add(R.mult(ee*me)).mult(ce));K.setLocationAtPoint(K.renderWorldCopies?fe.wrap():fe,P)}return r.preloadOnly||this._fireMoveEvents(o),K};if(r.preloadOnly){const K=this._emulate($,r.duration,u);return this._preloadTiles(K),this}const Y={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=Z,this._rotating=V,this._pitching=q,this._easeId=r.easeId,this._prepareEase(o,r.noMoveStart,Y),this._ease($(u),K=>{u.cameraElevationReference==="sea"&&u.recenterOnTerrain(),this._afterEase(o,K)},r),this}_prepareEase(r,o,u={}){this._moving=!0,this.transform.cameraElevationReference="sea",this.transform._orthographicProjectionAtLowPitch&&this.transform.pitch===0&&this.transform.projection.name!=="globe"&&(this.transform.cameraElevationReference="ground"),o||u.moving||this.fire(new a.b("movestart",r)),this._zooming&&!u.zooming&&this.fire(new a.b("zoomstart",r)),this._rotating&&!u.rotating&&this.fire(new a.b("rotatestart",r)),this._pitching&&!u.pitching&&this.fire(new a.b("pitchstart",r))}_fireMoveEvents(r){this.fire(new a.b("move",r)),this._zooming&&this.fire(new a.b("zoom",r)),this._rotating&&this.fire(new a.b("rotate",r)),this._pitching&&this.fire(new a.b("pitch",r))}_afterEase(r,o){if(this._easeId&&o&&this._easeId===o)return;this._easeId=void 0,this.transform.cameraElevationReference="ground";const u=this._zooming,d=this._rotating,p=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,u&&this.fire(new a.b("zoomend",r)),d&&this.fire(new a.b("rotateend",r)),p&&this.fire(new a.b("pitchend",r)),this.fire(new a.b("moveend",r))}flyTo(r,o){if(this._prefersReducedMotion(r)){const ne=a.ac(r,["center","zoom","bearing","pitch","around"]);return this.jumpTo(ne,o)}this.stop(),r=a.e({offset:[0,0],speed:1.2,curve:1.42,easing:a.d0},r);const u=this.transform,d=this.getZoom(),p=this.getBearing(),g=this.getPitch(),x="zoom"in r?a.aa(+r.zoom,u.minZoom,u.maxZoom):d,b="bearing"in r?this._normalizeBearing(r.bearing,p):p,T="pitch"in r?+r.pitch:g,M=u.zoomScale(x-d),S=a.P.convert(r.offset),C=u.centerPoint.add(S),P=u.pointLocation(C);let k=r.center;if(k&&r.padding){const ne=this._cameraForBounds(this.transform,k,k,b,T,r);ne&&(k=ne.center)}k=a.bn.convert(k||P),this._normalizeCenter(k);const R=u.project(P),O=u.project(k).sub(R);let D=r.curve;const F=Math.max(u.width,u.height),Z=F/M,V=O.mag();if("minZoom"in r){const ne=a.aa(Math.min(r.minZoom,d,x),u.minZoom,u.maxZoom),he=F/u.zoomScale(ne-d);D=Math.sqrt(he/V*2)}const q=D*D;function B(ne){const he=(Z*Z-F*F+(ne?-1:1)*q*q*V*V)/(2*(ne?Z:F)*q*V);return Math.log(Math.sqrt(he*he+1)-he)}function $(ne){return(Math.exp(ne)-Math.exp(-ne))/2}function Y(ne){return(Math.exp(ne)+Math.exp(-ne))/2}const K=B(0);let ee=function(ne){return Y(K)/Y(K+D*ne)},ce=function(ne){return F*((Y(K)*($(he=K+D*ne)/Y(he))-$(K))/q)/V;var he},re=(B(1)-K)/D;if(Math.abs(V)<1e-6||!isFinite(re)){if(Math.abs(F-Z)<1e-6)return this.easeTo(r,o);const ne=Z<F?-1:1;re=Math.abs(Math.log(Z/F))/D,ce=function(){return 0},ee=function(he){return Math.exp(ne*D*he)}}r.duration="duration"in r?+r.duration:1e3*re/("screenSpeed"in r?+r.screenSpeed/D:+r.speed),r.maxDuration&&r.duration>r.maxDuration&&(r.duration=0);const me=p!==b,fe=T!==g,Ae=ne=>he=>{const Q=he*re,ae=1/ee(Q);ne.zoom=he===1?x:d+ne.scaleZoom(ae),me&&(ne.bearing=a.U(p,b,he)),fe&&(ne.pitch=a.U(g,T,he));const Ie=he===1?k:ne.unproject(R.add(O.mult(ce(Q))).mult(ae));return ne.setLocationAtPoint(ne.renderWorldCopies?Ie.wrap():Ie,C),ne._updateCameraOnTerrain(),r.preloadOnly||this._fireMoveEvents(o),ne};if(r.preloadOnly){const ne=this._emulate(Ae,r.duration,u);return this._preloadTiles(ne),this}return this._zooming=!0,this._rotating=me,this._pitching=fe,this._prepareEase(o,!1),this._ease(Ae(u),()=>this._afterEase(o),r),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(r,o){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),this._easeFrameId=void 0,this._onEaseFrame=void 0),this._onEaseEnd){const u=this._onEaseEnd;this._onEaseEnd=void 0,u.call(this,o)}if(!r){const u=this.handlers;u&&u.stop(!1)}return this}_ease(r,o,u){u.animate===!1||u.duration===0?(r(1),o()):(this._easeStart=a.f.now(),this._easeOptions=u,this._onEaseFrame=r,this._onEaseEnd=o,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){const r=Math.min((a.f.now()-this._easeStart)/this._easeOptions.duration,1),o=this._onEaseFrame;o&&o(this._easeOptions.easing(r)),r<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(r,o){r=a.bh(r,-180,180);const u=Math.abs(r-o);return Math.abs(r-360-o)<u&&(r-=360),Math.abs(r+360-o)<u&&(r+=360),r}_normalizeCenter(r){const o=this.transform;if(o.maxBounds||o.projection.name!=="globe"&&!o.renderWorldCopies)return;const u=r.lng-o.center.lng;r.lng+=u>180?-360:u<-180?360:0}_prefersReducedMotion(r){return this._respectPrefersReducedMotion&&a.f.prefersReducedMotion&&!(r&&r.essential)}_emulate(r,o,u){const d=Math.ceil(15*o/1e3),p=[],g=r(u.clone());for(let x=0;x<=d;x++){const b=g(x/d);p.push(b.clone())}return p}}class yu{constructor(r={}){this.options=r,a.aY(["_toggleAttribution","_updateEditLink","_updateData","_updateCompact"],this)}getDefaultPosition(){return"bottom-right"}onAdd(r){const o=this.options&&this.options.compact;return this._map=r,this._container=Wt("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=Wt("button","mapboxgl-ctrl-attrib-button",this._container),Wt("span","mapboxgl-ctrl-icon",this._compactButton).setAttribute("aria-hidden","true"),this._compactButton.type="button",this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=Wt("div","mapboxgl-ctrl-attrib-inner",this._container),o&&this._container.classList.add("mapboxgl-compact"),this._updateAttributions(),this._updateEditLink(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("moveend",this._updateEditLink),o===void 0&&(this._map.on("resize",this._updateCompact),this._updateCompact()),this._container}onRemove(){this._container.remove(),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("moveend",this._updateEditLink),this._map.off("resize",this._updateCompact),this._map=void 0,this._attribHTML=void 0}_setElementTitle(r,o){const u=this._map._getUIString(`AttributionControl.${o}`);r.removeAttribute("title"),r.firstElementChild&&r.firstElementChild.setAttribute("title",u)}_toggleAttribution(){this._container.classList.contains("mapboxgl-compact-show")?(this._container.classList.remove("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","false")):(this._container.classList.add("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","true"))}_updateEditLink(){let r=this._editLink;r||(r=this._editLink=this._container.querySelector(".mapbox-improve-map"));const o=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:this._map._requestManager._customAccessToken||a.d5.ACCESS_TOKEN}];if(r){const u=o.reduce((d,p,g)=>(p.value&&(d+=`${p.key}=${p.value}${g<o.length-1?"&":""}`),d),"?");r.href=`${a.d5.FEEDBACK_URL}/${u}#${au(this._map,!0)}`,r.rel="noopener nofollow",this._setElementTitle(r,"MapFeedback")}}_updateData(r){!r||r.sourceDataType!=="metadata"&&r.sourceDataType!=="visibility"&&r.dataType!=="style"||(this._updateAttributions(),this._updateEditLink())}_updateAttributions(){if(!this._map.style)return;let r=[];if(this._map.style.stylesheet){const d=this._map.style.stylesheet;this.styleOwner=d.owner,this.styleId=d.id}const o=this._map.style._mergedSourceCaches;for(const d in o){const p=o[d];if(p.used){const g=p.getSource();g.attribution&&r.indexOf(g.attribution)<0&&r.push(g.attribution)}}r.sort((d,p)=>d.length-p.length),r=r.filter((d,p)=>{for(let g=p+1;g<r.length;g++)if(r[g].indexOf(d)>=0)return!1;return!0}),this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?r=[...this.options.customAttribution,...r]:r.unshift(this.options.customAttribution));const u=r.join(" | ");u!==this._attribHTML&&(this._attribHTML=u,r.length?(this._innerContainer.innerHTML=u,this._container.classList.remove("mapboxgl-attrib-empty")):this._container.classList.add("mapboxgl-attrib-empty"),this._editLink=null)}_updateCompact(){this._map.getCanvasContainer().offsetWidth<=640?this._container.classList.add("mapboxgl-compact"):this._container.classList.remove("mapboxgl-compact","mapboxgl-compact-show")}}class Uh{constructor(){a.aY(["_updateLogo","_updateCompact"],this)}onAdd(r){this._map=r,this._container=Wt("div","mapboxgl-ctrl");const o=Wt("a","mapboxgl-ctrl-logo");return o.target="_blank",o.rel="noopener nofollow",o.href="https://www.mapbox.com/",o.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),o.setAttribute("rel","noopener nofollow"),this._container.appendChild(o),this._container.style.display="none",this._map.on("sourcedata",this._updateLogo),this._updateLogo(),this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){this._container.remove(),this._map.off("sourcedata",this._updateLogo),this._map.off("resize",this._updateCompact)}getDefaultPosition(){return"bottom-left"}_updateLogo(r){r&&r.sourceDataType!=="metadata"||(this._container.style.display=this._logoRequired()?"block":"none")}_logoRequired(){if(!this._map.style)return!0;const r=this._map.style._sourceCaches;if(Object.entries(r).length===0)return!0;for(const o in r){const u=r[o].getSource();if(u.hasOwnProperty("mapbox_logo")&&!u.mapbox_logo)return!1}return!0}_updateCompact(){const r=this._container.children;if(r.length){const o=r[0];this._map.getCanvasContainer().offsetWidth<250?o.classList.add("mapboxgl-compact"):o.classList.remove("mapboxgl-compact")}}}class jh{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(r){const o=++this._id;
vendor: 5,128 bytes, line 2107
2107return this._queue.push({callback:r,id:o,cancelled:!1}),o}remove(r){const o=this._currentlyRunning,u=o?this._queue.concat(o):this._queue;for(const d of u)if(d.id===r)return void(d.cancelled=!0)}run(r=0){const o=this._currentlyRunning=this._queue;this._queue=[];for(const u of o)if(!u.cancelled&&(u.callback(r),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}function Ia(c,r,o){if(c=new a.bn(c.lng,c.lat),r){const u=new a.bn(c.lng-360,c.lat),d=new a.bn(c.lng+360,c.lat),p=360*Math.ceil(Math.abs(c.lng-o.center.lng)/360),g=o.locationPoint(c).distSqr(r),x=r.x<0||r.y<0||r.x>o.width||r.y>o.height;o.locationPoint(u).distSqr(r)<g&&(x||Math.abs(u.lng-o.center.lng)<p)?c=u:o.locationPoint(d).distSqr(r)<g&&(x||Math.abs(d.lng-o.center.lng)<p)&&(c=d)}for(;Math.abs(c.lng-o.center.lng)>180;){const u=o.locationPoint(c);if(u.x>=0&&u.y>=0&&u.x<=o.width&&u.y<=o.height)break;c.lng>o.center.lng?c.lng-=360:c.lng+=360}return c}const wl={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"};class xu extends a.E{constructor(r,o){if(super(),(r instanceof HTMLElement||o)&&(r=a.e({element:r},o)),a.aY(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress","_clearFadeTimer"],this),this._anchor=r&&r.anchor||"center",this._color=r&&r.color||"#3FB1CE",this._scale=r&&r.scale||1,this._draggable=r&&r.draggable||!1,this._clickTolerance=r&&r.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=r&&r.rotation||0,this._rotationAlignment=r&&r.rotationAlignment||"auto",this._pitchAlignment=r&&r.pitchAlignment&&r.pitchAlignment||"auto",this._updateMoving=()=>this._update(!0),this._occludedOpacity=r&&r.occludedOpacity||.2,r&&r.element)this._element=r.element,this._offset=a.P.convert(r&&r.offset||[0,0]);else{this._defaultMarker=!0,this._element=Wt("div");const p=41,g=27,x=Rr("svg",{display:"block",height:p*this._scale+"px",width:g*this._scale+"px",viewBox:`0 0 ${g} ${p}`},this._element),b=Rr("radialGradient",{id:"shadowGradient"},Rr("defs",{},x));Rr("stop",{offset:"10%","stop-opacity":.4},b),Rr("stop",{offset:"100%","stop-opacity":.05},b),Rr("ellipse",{cx:13.5,cy:34.8,rx:10.5,ry:5.25,fill:"url(#shadowGradient)"},x),Rr("path",{fill:this._color,d:"M27,13.5C27,19.07 20.25,27 14.75,34.5C14.02,35.5 12.98,35.5 12.25,34.5C6.75,27 0,19.22 0,13.5C0,6.04 6.04,0 13.5,0C20.96,0 27,6.04 27,13.5Z"},x),Rr("path",{opacity:.25,d:"M13.5,0C6.04,0 0,6.04 0,13.5C0,19.22 6.75,27 12.25,34.5C13,35.52 14.02,35.5 14.75,34.5C20.25,27 27,19.07 27,13.5C27,6.04 20.96,0 13.5,0ZM13.5,1C20.42,1 26,6.58 26,13.5C26,15.9 24.5,19.18 22.22,22.74C19.95,26.3 16.71,30.14 13.94,33.91C13.74,34.18 13.61,34.32 13.5,34.44C13.39,34.32 13.26,34.18 13.06,33.91C10.28,30.13 7.41,26.31 5.02,22.77C2.62,19.23 1,15.95 1,13.5C1,6.58 6.58,1 13.5,1Z"},x),Rr("circle",{fill:"white",cx:13.5,cy:13.5,r:5.5},x),this._offset=a.P.convert(r&&r.offset||[0,-14])}this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label","Map marker"),this._element.hasAttribute("role")||this._element.setAttribute("role","img"),this._element.classList.add("mapboxgl-marker"),this._element.addEventListener("dragstart",p=>{p.preventDefault()}),this._element.addEventListener("mousedown",p=>{p.preventDefault()});const u=this._element.classList;for(const p in wl)u.remove(`mapboxgl-marker-anchor-${p}`);u.add(`mapboxgl-marker-anchor-${this._anchor}`);const d=r&&r.className?r.className.trim().split(/\s+/):[];u.add(...d),this._popup=null}addTo(r){return r===this._map||(this.remove(),this._map=r,r.getCanvasContainer().appendChild(this._element),r.on("move",this._updateMoving),r.on("moveend",this._update),r.on("remove",this._clearFadeTimer),r._addMarker(this),this.setDraggable(this._draggable),this._update(),r.on("click",this._onMapClick)),this}remove(){const r=this._map;return r&&(r.off("click",this._onMapClick),r.off("move",this._updateMoving),r.off("moveend",this._update),r.off("mousedown",this._addDragHandler),r.off("touchstart",this._addDragHandler),r.off("mouseup",this._onUp),r.off("touchend",this._onUp),r.off("mousemove",this._onMove),r.off("touchmove",this._onMove),r.off("remove",this._clearFadeTimer),r._removeMarker(this),this._map=void 0),this._clearFadeTimer(),this._element.remove(),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(r){return this._lngLat=a.bn.convert(r),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(!0),this}getElement(){return this._element}setPopup(r){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeAttribute("role"),this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),r){if(!("offset"in r.options)){const d=Math.sqrt(Math.pow(13.5,2)/2);r.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[
vendor: 8,469 bytes, lines 2107-2112
21070,-38.1],"bottom-left":[d,-1*(38.1-13.5+d)],"bottom-right":[-d,-1*(38.1-13.5+d)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=r,r._marker=this,this._lngLat&&this._popup.setLngLat(this._lngLat),this._element.setAttribute("role","button"),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress),this._element.setAttribute("aria-expanded","false")}return this}_onKeyPress(r){const o=r.code,u=r.charCode||r.keyCode;o!=="Space"&&o!=="Enter"&&u!==32&&u!==13||this.togglePopup()}_onMapClick(r){const o=r.originalEvent.target,u=this._element;this._popup&&(o===u||u.contains(o))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){const r=this._popup;return r?(r.isOpen()?(r.remove(),this._element.setAttribute("aria-expanded","false")):this._map&&(r.addTo(this._map),this._element.setAttribute("aria-expanded","true")),this):this}_behindTerrain(){const r=this._map,o=this._pos;if(!r||!o)return!1;const u=r.unproject(o),d=r.getFreeCameraOptions();if(!d.position)return!1;const p=d.position.toLngLat();return p.distanceTo(u)<.9*p.distanceTo(this._lngLat)}_evaluateOpacity(){const r=this._map;if(!r)return;const o=this._pos;if(!o||o.x<0||o.x>r.transform.width||o.y<0||o.y>r.transform.height)return void this._clearFadeTimer();const u=r.unproject(o);let d;r._showingGlobe()&&a.d6(r.transform,this._lngLat)?d=0:(d=1-r._queryFogOpacity(u),r.transform._terrainEnabled()&&r.getTerrain()&&this._behindTerrain()&&(d*=this._occludedOpacity)),this._element.style.opacity=`${d}`,this._element.style.pointerEvents=d>0?"auto":"none",this._popup&&this._popup._setOpacity(d),this._fadeTimer=null}_clearFadeTimer(){this._fadeTimer&&(clearTimeout(this._fadeTimer),this._fadeTimer=null)}_updateDOM(){const r=this._pos;if(!r||!this._map)return;const o=this._offset.mult(this._scale);this._element.style.transform=` 2108 translate(${r.x}px,${r.y}px) 2109 ${wl[this._anchor]} 2110 ${this._calculateXYTransform()} ${this._calculateZTransform()} 2111 translate(${o.x}px,${o.y}px) 2112 `}_calculateXYTransform(){const r=this._pos,o=this._map,u=this.getPitchAlignment();if(!o||!r||u!=="map")return"";if(!o._showingGlobe()){const b=o.getPitch();return b?`rotateX(${b}deg)`:""}const d=a.bF(a.d7(o.transform,this._lngLat)),p=r.sub(a.d8(o.transform)),g=Math.abs(p.x)+Math.abs(p.y);if(g===0)return"";const x=d/g;return`rotateX(${-p.y*x}deg) rotateY(${p.x*x}deg)`}_calculateZTransform(){const r=this._pos,o=this._map;if(!o||!r)return"";let u=0;const d=this.getRotationAlignment();if(d==="map")if(o._showingGlobe()){const p=o.project(new a.bn(this._lngLat.lng,this._lngLat.lat+.001)),g=o.project(new a.bn(this._lngLat.lng,this._lngLat.lat-.001)).sub(p);u=a.bF(Math.atan2(g.y,g.x))-90}else u=-o.getBearing();else if(d==="horizon"){const p=a.O(4,6,o.getZoom()),g=a.d8(o.transform);g.y+=p*o.transform.height;const x=r.sub(g),b=a.bF(Math.atan2(x.y,x.x));u=(b>90?b-270:b+90)*(1-p)}return u+=this._rotation,u?`rotateZ(${u}deg)`:""}_update(r){cancelAnimationFrame(this._updateFrameId);const o=this._map;o&&(o.transform.renderWorldCopies&&(this._lngLat=Ia(this._lngLat,this._pos,o.transform)),this._pos=o.project(this._lngLat),r===!0?this._updateFrameId=requestAnimationFrame(()=>{this._element&&this._pos&&this._anchor&&(this._pos=this._pos.round(),this._updateDOM())}):this._pos=this._pos.round(),o._requestDomTask(()=>{this._map&&(this._element&&this._pos&&this._anchor&&this._updateDOM(),(o._showingGlobe()||o.getTerrain()||o.getFog())&&!this._fadeTimer&&(this._fadeTimer=setTimeout(this._evaluateOpacity.bind(this),60)))}))}getOffset(){return this._offset}setOffset(r){return this._offset=a.P.convert(r),this._update(),this}addClassName(r){return this._element.classList.add(r),this}removeClassName(r){return this._element.classList.remove(r),this}toggleClassName(r){return this._element.classList.toggle(r)}_onMove(r){const o=this._map;if(!o)return;const u=this._pointerdownPos,d=this._positionDelta;if(u&&d){if(!this._isDragging){const p=this._clickTolerance||o._clickTolerance;if(r.point.dist(u)<p)return;this._isDragging=!0}this._pos=r.point.sub(d),this._lngLat=o.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new a.b("dragstart"))),this.fire(new a.b("drag"))}}_onUp(){this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1;const r=this._map;r&&(r.off("mousemove",this._onMove),r.off("touchmove",this._onMove)),this._state==="active"&&this.fire(new a.b("dragend")),this._state="inactive"}_addDragHandler(r){const o=this._map,u=this._pos;o&&u&&this._element.contains(r.originalEvent.target)&&(r.preventDefault(),this._positionDelta=r.point.sub(u),this._pointerdownPos=r.point,this._state="pending",o.on("mousemove",this._onMove),o.on("touchmove",this._onMove),o.once("mouseup",this._onUp),o.once("touchend",this._onUp))}setDraggable(r){this._draggable=!!r;const o=this._map;return o&&(r?(o.on("mousedown",this._addDragHandler),o.on("touchstart",this._addDragHandler)):(o.off("mousedown",this._addDragHandler),o.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(r){return this._rotation=r||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(r){return this._rotationAlignment=r||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment==="auto"||this._rotationAlignment==="horizon"&&this._map&&!this._map._showingGlobe()?"viewport":this._rotationAlignment}setPitchAlignment(r){return this._pitchAlignment=r||"auto",this._update(),this}getPitchAlignment(){return this._pitchAlignment==="auto"?this.getRotationAlignment():this._pitchAlignment}setOccludedOpacity(r){return this._occludedOpacity=r||.2,this._update(),this}getOccludedOpacity(){return this._occludedOpacity}}const Gh={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},Zh=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function qh(c=new a.P(0,0),r="bottom"){if(typeof c=="number"){const o=Math.round(Math.sqrt(.5*Math.pow(c,2)));switch(r){case"top":return new a.P(0,c);case"top-left":return new a.P(o,o);case"top-right":return new a.P(-o,o);case"bottom":return new a.P(0,-c);case"bottom-left":return new a.P(o,-o);case"bottom-right":return new a.P(-o,-o);case"left":return new a.P(c,0);case"right":return new a.P(-c,0)}return new a.P(0,0)}return c instanceof a.P||Array.isArray(c)?a.P.convert(c):a.P.convert(c[r]||[0,0])}class vu{constructor(r){this.jumpTo(r)}getValue(r){if(r<=this._startTime)return this._start;if(r>=this._endTime)return this._end;const o=a.cc((r-this._startTime)/(this._endTime-this._startTime));return this._start*(1-o)+this._end*o}isEasing(r){return r>=this._startTime&&r<=this._endTime}jumpTo(r){this._startTime=-1/0,this._endTime=-1/0,this._start=r,this._end=r}easeTo(r,o,u){this._start=this.getValue(o),this._end=r,this._startTime=o,this._endTime=o+u}}const Ca={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"Mapbox logo","Map.Title":"Map","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScrollZoomBlocker.CtrlMessage":"Use ctrl + scroll to zoom the map","ScrollZoomBlocker.CmdMessage":"Use â + scroll to zoom the map","TouchPanBlocker.Message":"Use two fingers to move the map"},$h={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:85,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,performanceMetricsCollection:!0,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,antialias:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,minTileCacheSize:null,maxTileC
2112acheSize:null,localIdeographFontFamily:"sans-serif",localFontFamily:null,transformRequest:null,accessToken:null,fadeDuration:300,respectPrefersReducedMotion:!0,crossSourceCollisions:!0,collectResourceTiming:!1,testMode:!1};class bu{constructor(){this.showOverdrawInspector=!1,this.showTileBoundaries=!1,this.showParseStatus=!1,this.continuousRedraw=!1,this.showTileAABBs=!1,this.showPadding=!1,this.showTerrainWireframe=!1,this.showLayers2DWireframe=!1,this.showLayers3DWireframe=!1}}const Tl={showCompass:!0,showZoom:!0,visualizePitch:!1};class kn{constructor(r,o,u=!1){this._clickTolerance=10,this.element=o,this.mouseRotate=new ba({clickTolerance:r.dragRotate._mouseRotate._clickTolerance}),this.map=r,u&&(this.mousePitch=new vl({clickTolerance:r.dragRotate._mousePitch._clickTolerance})),a.aY(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),o.addEventListener("mousedown",this.mousedown),o.addEventListener("touchstart",this.touchstart,{passive:!1}),o.addEventListener("touchmove",this.touchmove),o.addEventListener("touchend",this.touchend),o.addEventListener("touchcancel",this.reset)}down(r,o){this.mouseRotate.mousedown(r,o),this.mousePitch&&this.mousePitch.mousedown(r,o),Ua()}move(r,o){const u=this.map,d=this.mouseRotate.mousemoveWindow(r,o),p=d&&d.bearingDelta;if(p&&u.setBearing(u.getBearing()+p),this.mousePitch){const g=this.mousePitch.mousemoveWindow(r,o),x=g&&g.pitchDelta;x&&u.setPitch(u.getPitch()+x)}}off(){const r=this.element;r.removeEventListener("mousedown",this.mousedown),r.removeEventListener("touchstart",this.touchstart,{passive:!1}),r.removeEventListener("touchmove",this.touchmove),r.removeEventListener("touchend",this.touchend),r.removeEventListener("touchcancel",this.reset),this.offTemp()}offTemp(){kr(),window.removeEventListener("mousemove",this.mousemove),window.removeEventListener("mouseup",this.mouseup)}mousedown(r){this.down(a.e({},r,{ctrlKey:!0,preventDefault:()=>r.preventDefault()}),$n(this.element,r)),window.addEventListener("mousemove",this.mousemove),window.addEventListener("mouseup",this.mouseup)}mousemove(r){this.move(r,$n(this.element,r))}mouseup(r){this.mouseRotate.mouseupWindow(r),this.mousePitch&&this.mousePitch.mouseupWindow(r),this.offTemp()}touchstart(r){r.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=Wn(this.element,r.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:()=>r.preventDefault()},this._startPos))}touchmove(r){r.targetTouches.length!==1?this.reset():(this._lastPos=Wn(this.element,r.targetTouches)[0],this.move({preventDefault:()=>r.preventDefault()},this._lastPos))}touchend(r){r.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),this.reset()}reset(){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()}}const Ml={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0,showUserHeading:!1},gr={maxWidth:100,unit:"metric"},mo={kilometer:"km",meter:"m",mile:"mi",foot:"ft","nautical-mile":"nm"};return{version:a.dk,supported:Qr,setRTLTextPlugin:a.dm,getRTLTextPluginStatus:a.dn,Map:class extends Oi{constructor(c){const r=c;if((c=a.e({},$h,c)).minZoom!=null&&c.maxZoom!=null&&c.minZoom>c.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(c.minPitch!=null&&c.maxPitch!=null&&c.minPitch>c.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(c.minPitch!=null&&c.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(c.maxPitch!=null&&c.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(c.antialias&&a.d9(window)&&(c.antialias=!1,a.w("Antialiasing is disabled for this WebGL context to avoid browser bug: https://github.com/mapbox/mapbox-gl-js/issues/11609")),super(new ia(c.minZoom,c.maxZoom,c.minPitch,c.maxPitch,c.renderWorldCopies),c),this._repaint=!1,this._interactive=c.interactive,this._minTileCacheSize=c.minTileCacheSize,this._maxTileC
2112acheSize=c.maxTileCacheSize,this._failIfMajorPerformanceCaveat=c.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=c.preserveDrawingBuffer,this._antialias=c.antialias,this._trackResize=c.trackResize,this._bearingSnap=c.bearingSnap,this._refreshExpiredTiles=c.refreshExpiredTiles,this._fadeDuration=c.fadeDuration,this._isInitialLoad=!0,this._crossSourceCollisions=c.crossSourceCollisions,this._collectResourceTiming=c.collectResourceTiming,this._language=this._parseLanguage(c.language),this._worldview=c.worldview,this._renderTaskQueue=new jh,this._domRenderTaskQueue=new jh,this._controls=[],this._markers=[],this._popups=[],this._mapId=a.aC(),this._locale=a.e({},Ca,c.locale),this._clickTolerance=c.clickTolerance,this._cooperativeGestures=c.cooperativeGestures,this._performanceMetricsCollection=c.performanceMetricsCollection,this._containerWidth=0,this._containerHeight=0,this._showParseStatus=!0,this._averageElevationLastSampledAt=-1/0,this._averageElevationExaggeration=0,this._averageElevation=new vu(0),this._interactionRange=[1/0,-1/0],this._visibilityHidden=0,this._useExplicitProjection=!1,this._requestManager=new a.da(c.transformRequest,c.accessToken,c.testMode),this._silenceAuthErrors=!!c.testMode,this._contextCreateOptions=c.contextCreateOptions?{...c.contextCreateOptions}:{},typeof c.container=="string"){const o=document.getElementById(c.container);if(!o)throw new Error(`Container '${c.container.toString()}' not found.`);this._container=o}else{if(!(c.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=c.container}if(this._container.childNodes.length>0&&a.w("The map container element should be empty, otherwise the map's interactivity will be negatively impacted. If you want to display a message when WebGL is not supported, use the Mapbox GL Supported plugin instead."),c.maxBounds&&this.setMaxBounds(c.maxBounds),a.aY(["_onWindowOnline","_onWindowResize","_onVisibilityChange","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._debugParams=new bu,this._tp=c.devtools?new ma(this):new ma,this._tp.registerParameter(this._debugParams,["Debug"],"showOverdrawInspector",void 0,()=>{this._update()}),this._tp.registerParameter(this._debugParams,["Debug"],"showTileBoundaries",void 0,()=>{this._update()}),this._tp.registerParameter(this._debugParams,["Debug"],"showParseStatus",void 0,()=>{this._update()}),this._tp.registerParameter(this._debugParams,["Debug"],"continuousRedraw",void 0,o=>{this.repaint=o}),this._tp.registerParameter(this._debugParams,["Debug"],"showTileAABBs",void 0,o=>{this.showTileAABBs=o}),this._tp.registerParameter(this._debugParams,["Debug"],"showPadding",void 0,o=>{this.showPadding=o}),this._tp.registerParameter(this._debugParams,["Debug","Wireframe"],"showTerrainWireframe",void 0,()=>{this._update()}),this._tp.registerParameter(this._debugParams,["Debug","Wireframe"],"showLayers2DWireframe",void 0,()=>{this._update()}),this._tp.registerParameter(this._debugParams,["Debug","Wireframe"],"showLayers3DWireframe",void 0,()=>{this._update()}),this._setupPainter(),this.painter===void 0)throw new Error("Failed to initialize WebGL.");if(this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this._fullscreenchangeEvent="onfullscreenchange"in document?"fullscreenchange":"webkitfullscreenchange",window.addEventListener("online",this._onWindowOnline,!1),window.addEventListener("resize",this._onWindowResize,!1),window.addEventListener("orientationchange",this._onWindowResize,!1),window.addEventListener(this._fullscreenchangeEvent,this._onWindowResize,!1),window.addEventListener("visibilitychange",this._onVisibilityChange,!1),this.handlers=new _f(this,c),this._localFontFamily=c.localFontFamily,this._localIdeographFontFamily=c.localIdeographFontFamily,(c.style||!c.testMode)&&this.setStyle(c.style||a.d5.DEFAULT_STYLE,{localFontFamily:this._localFontFamily,localIdeographFontFamily:this._localIdeographFontFamily}),c.projection&&this.setProjection(c.projection),c.hash&&(this._hash=new gl(typeof c.hash=="string"&&c.hash||void 0).addTo(this)),!this._hash||!this._hash._onHashChange()){r.center==null&&r.zoom==null||(this.transform._unmodified=!1),this.jumpTo({center:c.center,zoom:c.zoom,bearing:c.bearing,pitch:c.pitch});const o=c.bounds;o&&(this.resize(),this.fitBounds(o,a.e({}
vendor: 4,604 bytes, line 2112
2112,c.fitBoundsOptions,{duration:0})))}this.resize(),c.attributionControl&&this.addControl(new yu({customAttribution:c.customAttribution})),this._logoControl=new Uh,this.addControl(this._logoControl,c.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",o=>{this._update(o.dataType==="style"),this.fire(new a.b(`${o.dataType}data`,o))}),this.on("dataloading",o=>{this.fire(new a.b(`${o.dataType}dataloading`,o))})}_getMapId(){return this._mapId}addControl(c,r){if(r===void 0&&(r=c.getDefaultPosition?c.getDefaultPosition():"top-right"),!c||!c.onAdd)return this.fire(new a.a(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const o=c.onAdd(this);this._controls.push(c);const u=this._controlPositions[r];return r.indexOf("bottom")!==-1?u.insertBefore(o,u.firstChild):u.appendChild(o),this}removeControl(c){if(!c||!c.onRemove)return this.fire(new a.a(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const r=this._controls.indexOf(c);return r>-1&&this._controls.splice(r,1),c.onRemove(this),this}hasControl(c){return this._controls.indexOf(c)>-1}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}resize(c){if(this._updateContainerDimensions(),this._containerWidth===this.transform.width&&this._containerHeight===this.transform.height)return this;this._resizeCanvas(this._containerWidth,this._containerHeight),this.transform.resize(this._containerWidth,this._containerHeight),this.painter.resize(Math.ceil(this._containerWidth),Math.ceil(this._containerHeight));const r=!this._moving;return r&&this.fire(new a.b("movestart",c)).fire(new a.b("move",c)),this.fire(new a.b("resize",c)),r&&this.fire(new a.b("moveend",c)),this}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()||null}setMaxBounds(c){return this.transform.setMaxBounds(a.ad.convert(c)),this._update()}setMinZoom(c){if((c=c??-2)>=-2&&c<=this.transform.maxZoom)return this.transform.minZoom=c,this._update(),this.getZoom()<c?this.setZoom(c):this.fire(new a.b("zoomstart")).fire(new a.b("zoom")).fire(new a.b("zoomend")),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(c){if((c=c??22)>=this.transform.minZoom)return this.transform.maxZoom=c,this._update(),this.getZoom()>c?this.setZoom(c):this.fire(new a.b("zoomstart")).fire(new a.b("zoom")).fire(new a.b("zoomend")),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(c){if((c=c??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(c>=0&&c<=this.transform.maxPitch)return this.transform.minPitch=c,this._update(),this.getPitch()<c?this.setPitch(c):this.fire(new a.b("pitchstart")).fire(new a.b("pitch")).fire(new a.b("pitchend")),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(c){if((c=c??85)>85)throw new Error("maxPitch must be less than or equal to 85");if(c>=this.transform.minPitch)return this.transform.maxPitch=c,this._update(),this.getPitch()>c?this.setPitch(c):this.fire(new a.b("pitchstart")).fire(new a.b("pitch")).fire(new a.b("pitchend")),this;throw new Error("maxPitch must be greater than or equal to minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(c){return this.transform.renderWorldCopies=c,this.transform.renderWorldCopies||this._forceMarkerAndPopupUpdate(!0),this._update()}getLanguage(){return this._language}_parseLanguage(c){return c==="auto"?navigator.language:Array.isArray(c)?c.length===0?void 0:c.map(r=>r==="auto"?navigator.language:r):c}setLanguage(c){const r=this._parseLanguage(c);if(!this.style||r===this._language)return this;this._language=r,this.style.reloadSources();for(const o of this._controls)o._setLanguage&&o._setLanguage(this._language);return this}getWorldview(){return this._worldview}setWorldview(c){return this.style&&c!==this._worldview?(this._worldview=c,this.style.reloadSources(),this):this}getProjection(){return this.transform.mercatorFromTransition?{name:"globe",center:[0,0]}:this.transform.getProjection()}_showingGlobe(){return this.transform.projection.name==="globe"}setProjection(c){return this._lazyInitEmptyStyle(),c?typeof c=="string"&&(c={name:c}
2112):c=null,this._useExplicitProjection=!!c,this._prioritizeAndUpdateProjection(c,this.style.projection)}_updateProjectionTransition(){if(this.getProjection().name!=="globe")return;const c=this.transform,r=c.projection.name;let o;r==="globe"&&c.zoom>=a.bx?(c.setMercatorFromTransition(),o=!0):r==="mercator"&&c.zoom<a.bx&&(c.setProjection({name:"globe"}),o=!0),o&&(this.style.applyProjectionUpdate(),this.style._forceSymbolLayerUpdate())}_prioritizeAndUpdateProjection(c,r){return this._updateProjection(c||r||{name:"mercator"})}_updateProjection(c){let r;return r=c.name==="globe"&&this.transform.zoom>=a.bx?this.transform.setMercatorFromTransition():this.transform.setProjection(c),this.style.applyProjectionUpdate(),r&&(this.painter.clearBackgroundTiles(),this.style.clearSources(),this._update(!0),this._forceMarkerAndPopupUpdate(!0)),this}project(c){return this.transform.locationPoint3D(a.bn.convert(c))}unproject(c){return this.transform.pointLocation3D(a.P.convert(c))}isMoving(){return this._moving||this.handlers&&this.handlers.isMoving()||!1}isZooming(){return this._zooming||this.handlers&&this.handlers.isZooming()||!1}isRotating(){return this._rotating||this.handlers&&this.handlers.isRotating()||!1}_isDragging(){return this.handlers&&this.handlers._isDragging()||!1}_createDelegatedListener(c,r,o){if(c==="mouseenter"||c==="mouseover"){let u=!1;const d=g=>{const x=r.filter(T=>this.getLayer(T)),b=x.length?this.queryRenderedFeatures(g.point,{layers:x}):[];b.length?u||(u=!0,o.call(this,new wr(c,this,g.originalEvent,{features:b}))):u=!1},p=()=>{u=!1};return{layers:new Set(r),listener:o,delegates:{mousemove:d,mouseout:p}}}if(c==="mouseleave"||c==="mouseout"){let u=!1;const d=g=>{const x=r.filter(b=>this.getLayer(b));(x.length?this.queryRenderedFeatures(g.point,{layers:x}):[]).length?u=!0:u&&(u=!1,o.call(this,new wr(c,this,g.originalEvent)))},p=g=>{u&&(u=!1,o.call(this,new wr(c,this,g.originalEvent)))};return{layers:new Set(r),listener:o,delegates:{mousemove:d,mouseout:p}}}{const u=d=>{const p=r.filter(x=>this.getLayer(x)),g=p.length?this.queryRenderedFeatures(d.point,{layers:p}):[];g.length&&(d.features=g,o.call(this,d),delete d.features)};return{layers:new Set(r),listener:o,delegates:{[c]:u}}}}on(c,r,o){if(o===void 0)return super.on(c,r);if(Array.isArray(r)||(r=[r]),r){for(const d of r)if(!this._isValidId(d))return this}const u=this._createDelegatedListener(c,r,o);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[c]=this._delegatedListeners[c]||[],this._delegatedListeners[c].push(u);for(const d in u.delegates)this.on(d,u.delegates[d]);return this}once(c,r,o){if(o===void 0)return super.once(c,r);if(Array.isArray(r)||(r=[r]),r){for(const d of r)if(!this._isValidId(d))return this}const u=this._createDelegatedListener(c,r,o);for(const d in u.delegates)this.once(d,u.delegates[d]);return this}off(c,r,o){if(o===void 0)return super.off(c,r);r=new Set(Array.isArray(r)?r:[r]);for(const p of r)if(!this._isValidId(p))return this;const u=(p,g)=>{if(p.size!==g.size)return!1;for(const x of p)if(!g.has(x))return!1;return!0},d=this._delegatedListeners?this._delegatedListeners[c]:void 0;return d&&(p=>{for(let g=0;g<p.length;g++){const x=p[g];if(x.listener===o&&u(x.layers,r)){for(const b in x.delegates)this.off(b,x.delegates[b]);return p.splice(g,1),this}}})(d),this}queryRenderedFeatures(c,r){if(!this.style)return[];if(r!==void 0||c===void 0||c instanceof a.P||Array.isArray(c)||(r=c,c=void 0),c=c||[[0,0],[this.transform.width,this.transform.height]],(r=r||{}).layers&&Array.isArray(r.layers)){for(const o of r.layers)if(!this._isValidId(o))return[]}return this.style.queryRenderedFeatures(c,r,this.transform)}querySourceFeatures(c,r){return this._isValidId(c)?this.style.querySourceFeatures(c,r):[]}isPointOnSurface(c){const{name:r}=this.transform.projection;return r!=="globe"&&r!=="mercator"&&a.w(`${r} projection does not support isPointOnSurface, this API may behave unexpectedly.`),this.transform.isPointOnSurface(a.P.convert(c))}setStyle(c,r){return(r=a.e({},{localIdeographFontFamily:this._localIdeographFontFamily,localFontFamily:this._localFontFamily},r)).diff!==!1&&r.localIdeographFontFamily===this._localIdeographFontFamily&&r.localFontFamily===this._localFontFamily&&this.style&&c?(this._diffStyle(c,r),this):(this._localIdeographFontFamily=r.localIdeographFontFamily,this._localFontFamily=r.localFontFamily,this._updateStyle(c,r))}_getUIString(c){const r=this._locale[c];if(r==null)throw new Error(`Missing UI string '${c}'`);return r}_updateStyle(c,r){return this.style&&(this.style.setEventedParent(null),this.style._remove(),this.style=void 0),c&&(this.style=new sn(this,r||{}),this.style.setEventedParent(this,{style:this.style}),typeof c=="string"?this.style.loadURL(c):this.style.loadJSON(c)),this._updateTerrain(),this}_lazyInitEmptyStyle(){this.style||(this.style=new sn(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(c,r){if(typeof c=="string"){const o=this._requestManager.normalizeStyleURL(c),u=this._requestManager.transformRequest(o,a.R.Style);a.g(u,(d,p)=>{d?this.fire(new a.a(d)):p&&this._updateDiff(p,r)})}else typeof c=="object"&&this._updateDiff(c,r)}_updateDiff(c,r){try{this.style.setState(c)&&this._update(!0)}catch(o){a.w(`Unable to perform style diff: ${o.message||o.error||o}. Rebuilding the style from scratch.`),this._updateStyle(c,r)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():(a.w("There is no style added to the map."),!1)}_isValidId(c){return c==null?(this.fire(new a.a(new Error("IDs can't be empty."))),!1):!a.c4(c)||(this.fire(new a.a(new Error(`IDs can't
2112contain special symbols: "${c}".`))),!1)}addSource(c,r){return this._isValidId(c)?(this._lazyInitEmptyStyle(),this.style.addSource(c,r),this._update(!0)):this}isSourceLoaded(c){return!!this._isValidId(c)&&!!this.style&&this.style._isSourceCacheLoaded(c)}areTilesLoaded(){return this.style.areTilesLoaded()}addSourceType(c,r,o){this._lazyInitEmptyStyle(),this.style.addSourceType(c,r,o)}removeSource(c){return this._isValidId(c)?(this.style.removeSource(c),this._updateTerrain(),this._update(!0)):this}getSource(c){return this._isValidId(c)?this.style.getOwnSource(c):null}addImage(c,r,{pixelRatio:o=1,sdf:u=!1,stretchX:d,stretchY:p,content:g}={}){if(this._lazyInitEmptyStyle(),r instanceof HTMLImageElement||ImageBitmap&&r instanceof ImageBitmap){const{width:x,height:b,data:T}=a.f.getImageData(r);this.style.addImage(c,{data:new a.h({width:x,height:b},T),pixelRatio:o,stretchX:d,stretchY:p,content:g,sdf:u,version:0})}else if(r.width===void 0||r.height===void 0)this.fire(new a.a(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));else{const{width:x,height:b}=r,T=r;this.style.addImage(c,{data:new a.h({width:x,height:b},new Uint8Array(T.data)),pixelRatio:o,stretchX:d,stretchY:p,content:g,sdf:u,version:0,userImage:T}),T.onAdd&&T.onAdd(this,c)}}updateImage(c,r){this._lazyInitEmptyStyle();const o=this.style.getImage(c);if(!o)return void this.fire(new a.a(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const u=r instanceof HTMLImageElement||ImageBitmap&&r instanceof ImageBitmap?a.f.getImageData(r):r,{width:d,height:p}=u,g=u.data;if(d===void 0||p===void 0)return void this.fire(new a.a(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(d!==o.data.width||p!==o.data.height)return void this.fire(new a.a(new Error(`The width and height of the updated image (${d}, ${p}) 2113 must be that same as the previous version of the image 2114 (${o.data.width}, ${o.data.height})`)));const x=!(r instanceof HTMLImageElement||ImageBitmap&&r instanceof ImageBitmap);o.data.replace(g,x),this.style.updateImage(c,o)}hasImage(c){return c?!!this.style&&!!this.style.getImage(c):(this.fire(new a.a(new Error("Missing required image id"))),!1)}removeImage(c){this.style.removeImage(c)}loadImage(c,r){a.d(this._requestManager.transformRequest(c,a.R.Image),(o,u)=>{r(o,u instanceof HTMLImageElement?a.f.getImageData(u):u)})}listImages(){return this.style.listImages()}addModel(c,r){this._lazyInitEmptyStyle(),this.style.addModel(c,r)}hasModel(c){return c?this.style.hasModel(c):(this.fire(new a.a(new Error("Missing required model id"))),!1)}removeModel(c){this.style.removeModel(c)}listModels(){return this.style.listModels()}addLayer(c,r){return this._isValidId(c.id)?(this._lazyInitEmptyStyle(),this.style.addLayer(c,r),this._update(!0)):this}getSlot(c){const r=this.getLayer(c);return r&&r.slot||null}setSlot(c,r){return this.style.setSlot(c,r),this.style.mergeLayers(),this._update(!0)}addImport(c,r){return this.style.addImport(c,r),this}updateImport(c,r){return typeof r!="string"&&r.id!==c?(this.removeImport(c),this.addImport(r)):(this.style.updateImport(c,r),this._update(!0))}removeImport(c){return this.style.removeImport(c),this}moveImport(c,r){return this.style.moveImport(c,r),this._update(!0)}moveLayer(c,r){return this._isValidId(c)?(this.style.moveLayer(c,r),this._update(!0)):this}removeLayer(c){return this._isValidId(c)?(this.style.removeLayer(c),this._update(!0)):this}getLayer(c){return this._isValidId(c)?this.style.getOwnLayer(c):null}setLayerZoomRange(c,r,o){return this._isValidId(c)?(this.style.setLayerZoomRange(c,r,o),this._update(!0)):this}setFilter(c,r,o={}){return this._isValidId(c)?(this.style.setFilter(c,r,o),this._update(!0)):this}getFilter(c){return this._isValidId(c)?this.style.getFilter(c):null}setPaintProperty(c,r,o,u={}){return this._isValidId(c)?(this.style.setPaintProperty(c,r,o,u),this._update(!0)):this}getPaintProperty(c,r){return this._isValidId(c)?this.style.getPaintProperty(c,r):null}setLayoutProperty(c,r,o,u={}){return this._isValidId(c)?(this.style.setLayoutProperty(c,r,o,u),this._update(!0)):this}getLayoutProperty(c,r){return this._isValidId(c)?this.style.getLayoutProperty(c,r):null}getConfigProperty(c,r){return this.style.getConfigProperty(c,r)}setConfigProperty(c,r,o){return this.style.setConfigProperty(c,r,o),this._update(!0)}setLights(c){if(this._lazyInitEmptyStyle(),c&&c.length===1&&c[0].type==="flat"){const r=c[0];r.properties?this.style.setFlatLight(r.properties,r.id,{}):this.style.setFlatLight({},"flat")}else this.style.setLights(c),this.painter.terrain&&(this.painter.terrain.invalidateRenderCache=!0);return this._update(!0)}getLights(){const c=this.style.getLights()||[];
vendor: 17,397 bytes, line 2114
2114return c.length===0&&c.push({id:this.style.light.id,type:"flat",properties:this.style.getFlatLight()}),c}setLight(c,r={}){return console.log("The `map.setLight` function is deprecated, prefer using `map.setLights` with `flat` light type instead."),this.setLights([{id:"flat",type:"flat",properties:c}])}getLight(){return console.log("The `map.getLight` function is deprecated, prefer using `map.getLights` instead."),this.style.getFlatLight()}setTerrain(c){return this._lazyInitEmptyStyle(),!c&&this.transform.projection.requiresDraping?this.style.setTerrainForDraping():this.style.setTerrain(c),this._averageElevationLastSampledAt=-1/0,this._update(!0)}getTerrain(){return this.style?this.style.getTerrain():null}setFog(c){return this._lazyInitEmptyStyle(),this.style.setFog(c),this._update(!0)}getFog(){return this.style?this.style.getFog():null}setCamera(c){return this.style.setCamera(c),this._triggerCameraUpdate(c)}_triggerCameraUpdate(c){return this._update(this.transform.setOrthographicProjectionAtLowPitch(c["camera-projection"]==="orthographic"))}getCamera(){return this.style.camera}_queryFogOpacity(c){return this.style&&this.style.fog?this.style.fog.getOpacityAtLatLng(a.bn.convert(c),this.transform):0}setFeatureState(c,r){return this._isValidId(c.source)?(this.style.setFeatureState(c,r),this._update()):this}removeFeatureState(c,r){return this._isValidId(c.source)?(this.style.removeFeatureState(c,r),this._update()):this}getFeatureState(c){return this._isValidId(c.source)?this.style.getFeatureState(c):null}_updateContainerDimensions(){if(!this._container)return;const c=this._container.getBoundingClientRect().width||400,r=this._container.getBoundingClientRect().height||300;let o,u,d,p=this._container;for(;p&&(!u||!d);){const g=window.getComputedStyle(p).transform;g&&g!=="none"&&(o=g.match(/matrix.*\((.+)\)/)[1].split(", "),o[0]&&o[0]!=="0"&&o[0]!=="1"&&(u=o[0]),o[3]&&o[3]!=="0"&&o[3]!=="1"&&(d=o[3])),p=p.parentElement}this._containerWidth=u?Math.abs(c/u):c,this._containerHeight=d?Math.abs(r/d):r}_detectMissingCSS(){window.getComputedStyle(this._missingCSSCanary).getPropertyValue("background-color")!=="rgb(250, 128, 114)"&&a.w("This page appears to be missing CSS declarations for Mapbox GL JS, which may cause the map to display incorrectly. Please ensure your page includes mapbox-gl.css, as described in https://www.mapbox.com/mapbox-gl-js/api/.")}_setupContainer(){const c=this._container;c.classList.add("mapboxgl-map"),(this._missingCSSCanary=Wt("div","mapboxgl-canary",c)).style.visibility="hidden",this._detectMissingCSS();const r=this._canvasContainer=Wt("div","mapboxgl-canvas-container",c);this._canvas=Wt("canvas","mapboxgl-canvas",r),this._interactive&&(r.classList.add("mapboxgl-interactive"),this._canvas.setAttribute("tabindex","0")),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region"),this._updateContainerDimensions(),this._resizeCanvas(this._containerWidth,this._containerHeight);const o=this._controlContainer=Wt("div","mapboxgl-control-container",c),u=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(d=>{u[d]=Wt("div",`mapboxgl-ctrl-${d}`,o)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(c,r){const o=a.f.devicePixelRatio||1;this._canvas.width=o*Math.ceil(c),this._canvas.height=o*Math.ceil(r),this._canvas.style.width=`${c}px`,this._canvas.style.height=`${r}px`}_addMarker(c){this._markers.push(c)}_removeMarker(c){const r=this._markers.indexOf(c);r!==-1&&this._markers.splice(r,1)}_addPopup(c){this._popups.push(c)}_removePopup(c){const r=this._popups.indexOf(c);r!==-1&&this._popups.splice(r,1)}_setupPainter(){const c=a.e({},Qr.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),r=this._canvas.getContext("webgl2",c);r?(a.db(r,!0),this.painter=new Ph(r,this._contextCreateOptions,this.transform,this._tp),this.on("data",o=>{o.dataType==="source"&&this.painter.setTileLoadedFlag(!0)}),a.dc.testSupport(r)):this.fire(new a.a(new Error("Failed to initialize WebGL")))}_contextLost(c){c.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new a.b("webglcontextlost",{originalEvent:c}))}_contextRestored(c){this._setupPainter(),this.resize(),this._update(),this.fire(new a.b("webglcontextrestored",{originalEvent:c}))}_onMapScroll(c){if(c.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(c){return this.style?(this._styleDirty=this._styleDirty||c,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(c){return this._update(),this._renderTaskQueue.add(c)}_cancelRenderFrame(c){this._renderTaskQueue.remove(c)}_requestDomTask(c){!this.loaded()||this.loaded()&&!this.isMoving()?c():this._domRenderTaskQueue.add(c)}_render(c){let r;this.fire(new a.b("renderstart"));const o=this.painter.context.extTimerQuery,u=a.f.now(),d=this.painter.context.gl;if(this.listens("gpu-timing-frame")&&(r=d.createQuery(),d.beginQuery(o.TIME_ELAPSED_EXT,r)),this.painter.context.setDirty(),this.painter.setBaseState(),(this.isMoving()||this.isRotating()||this.isZooming())&&(this._interactionRange[0]=Math.min(this._interactionRange[0],performance.now()),this._interactionRange[1]=Math.max(this._interactionRange[1],performance.now())),this._renderTaskQueue.run(c),this._domRenderTaskQueue.run(c),this._removed)return;this._updateProjectionTransition();const p=this._isInitialLoad?0:this._fadeDuration;if(this.style&&this._styleDirty){this._styleDirty=!1;const b=this.transform.zoom,T=this.transform.pitch,M=a.f.now(),S=new a.K(b,{now:M,fadeDuration:p,pitch:T,transition:this.style.transition});this.style.update(S)}this.style&&this.style.hasFogTransition()&&(this.style._markersNeedUpdate=!0,this._sourcesDirty=!0);let g=!1;if(this.style&&this._sourcesDirty?(this._sourcesDirty=!1,this.painter._updateFog(this.style),this._updateTerrain(),g=this._updateAverageElevation(u),this.style.updateSources(this.transform),this._forceMarkerAndPopupUpdate()):g=this._updateAverageElevation(u),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,p,this._crossSourceCollisions),this.style&&this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries||this._debugParams.showTileBoundaries,showParseStatus:this.showParseStatus||this._debugParams.showParseStatus,wireframe:{terrain:this.showTerrainWireframe||this._debugParams.showTerrainWireframe,layers2D:this.showLayers2DWireframe||this._debugParams.showLayers2DWireframe,layers3D:this.showLayers3DWireframe||this._debugParams.showLayers3DWireframe},showOverdrawInspector:this._showOverdrawInspector||this._debugParams.showOverdrawInspector,showQueryGeometry:!!this._showQueryGeometry,showTileAABBs:this.showTileAABBs||this._debugParams.showTileAABBs,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:p,isInitialLoad:this._isInitialLoad,showPadding:this.showPadding||this._debugParams.showPadding,gpuTiming:!!this.listens("gpu-timing-layer"),gpuTimingDeferredRender:!!this.listens("gpu-timing-deferred-render"),speedIndexTiming:this.speedIndexTiming}),this.fire(new a.b("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,this.fire(new a.b("load"))),this.style&&this.style.hasTransitions()&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),r){const b=a.f.now()-u;d.endQuery(o.TIME_ELAPSED_EXT),setTimeout(()=>{const T=d.getQueryParameter(r,d.QUERY_RESULT)/1e6;d.deleteQuery(r),this.fire(new a.b("gpu-timing-frame",{cpuTime:b,gpuTime:T}))},50)}if(this.listens("gpu-timing-layer")){const b=this.painter.collectGpuTimers();setTimeout(()=>{const T=this.painter.queryGpuTimers(b);this.fire(new a.b("gpu-timing-layer",{layerTimes:T}))},50)}if(this.listens("gpu-timing-deferred-render")){const b=this.painter.collectDeferredRenderGpuQueries();setTimeout(()=>{const T=this.painter.queryGpuTimeDeferredRender(b);this.fire(new a.b("gpu-timing-deferred-render",{gpuTime:T}))},50)}const x=this._sourcesDirty||this._styleDirty||this._placementDirty||g;if(x||this._repaint)this.triggerRepaint();else{const b=!this.isMoving()&&this.loaded();if(b&&(g=this._updateAverageElevation(u,!0)),g)this.triggerRepaint();else if(this._triggerFrame(!1),b&&(this.fire(new a.b("idle")),this._isInitialLoad=!1,this.speedIndexTiming)){const T=this._calculateSpeedIndex();this.fire(new a.b("speedindexcompleted",{speedIndex:T})),this.speedIndexTiming=!1}}!this._loaded||this._fullyLoaded||x||(this._fullyLoaded=!0,this._performanceMetricsCollection&&a.dd(this._requestManager._customAccessToken,{width:this.painter.width,height:this.painter.height,interactionRange:this._interactionRange,visibilityHidden:this._visibilityHidden,terrainEnabled:!!this.painter.style.getTerrain(),fogEnabled:!!this.painter.style.getFog(),projection:this.getProjection().name,zoom:this.transform.zoom,renderer:this.painter.context.renderer,vendor:this.painter.context.vendor}),this._authenticate())}_forceMarkerAndPopupUpdate(c){for(const r of this._markers)c&&!this.getRenderWorldCopies()&&(r._lngLat=r._lngLat.wrap()),r._update();for(const r of this._popups)!c||this.getRenderWorldCopies()||r._trackPointer||(r._lngLat=r._lngLat.wrap()),r._update()}_updateAverageElevation(c,r=!1){const o=d=>(this.transform.averageElevation=d,this._update(!1),!0);if(!this.painter.averageElevationNeedsEasing())return this.transform.averageElevation!==0&&o(0);const u=this.transform.elevation&&this.transform.elevation.exaggeration()!==this._averageElevationExaggeration;if(u||(r||c-this._averageElevationLastSampledAt>500)&&!this._averageElevation.isEasing(c)){const d=this.transform.averageElevation;let p=this.transform.sampleAverageElevation();this.transform.elevation&&(this._averageElevationExaggeration=this.transform.elevation.exaggeration()),isNaN(p)?p=0:this._averageElevationLastSampledAt=c;const g=Math.abs(d-p);if(g>1){if(this._isInitialLoad||u)return this._averageElevation.jumpTo(p),o(p);this._averageElevation.easeTo(p,c,300)}else if(g>1e-4)return this._averageElevation.jumpTo(p),o(p)}return!!this._averageElevation.isEasing(c)&&o(this._averageElevation.getValue(c))}_authenticate(){a.de(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,c=>{if(c&&(c.message===a.df||c.status===401)){const r=this.painter.context.gl;a.db(r,!1),this._logoControl instanceof Uh&&this._logoControl._updateLogo(),r&&r.clear(r.DEPTH_BUFFER_BIT|r.COLOR_BUFFER_BIT|r.STENCIL_BUFFER_BIT),this._silenceAuthErrors||this.fire(new a.a(new Error("A valid Mapbox access token is required to use Mapbox GL JS. To create an account or a new access token, visit https://account.mapbox.com/")))}}),a.dg(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,()=>{})}_updateTerrain(){const c=this._isDragging();this.painter.updateTerrain(this.style,c)}_calculateSpeedIndex(){const c=this.painter.canvasCopy(),r=this.painter.getCanvasCopiesAndTimestamps();r.timeStamps.push(performance.now());const o=this.painter.context.gl,u=o.createFramebuffer();function d(p){o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,o.TEXTURE_2D,p,0);const g=new Uint8Array(o.drawingBufferWidth*o.drawingBufferHeight*4);return o.readPixels(0,0,o.drawingBufferWidth,o.drawingBufferHeight,o.RGBA,o.UNSIGNED_BYTE,g),g}return o.bindFramebuffer(o.FRAMEBUFFER,u),this._canvasPixelComparison(d(c),r.canvasCopies.map(d),r.timeStamps)}_canvasPixelComparison(c,r,o){let u=o[1]-o[0];const d=c.length/4;for(let p=0;p<r.length;p++){const g=r[p];let x=0;for(let b=0;b<g.length;b+=4)g[b]===c[b]&&g[b+1]===c[b+1]&&g[b+2]===c[b+2]&&g[b+3]===c[b+3]&&(x+=1);u+=(o[p+2]-o[p+1])*(1-x/d)}return u}remove(){this._hash&&this._hash.remove();for(const r of this._controls)r.onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this._domRenderTaskQueue.clear(),this.style&&this.style.destroy(),this.painter.destroy(),this.handlers&&this.handlers.destroy(),this.handlers=void 0,this.setStyle(null),window.removeEventListener("resize",this._onWindowResize,!1),window.removeEventListener("orientationchange",this._onWindowResize,!1),window.removeEventListener(this._fullscreenchangeEvent,this._onWindowResize,!1),window.removeEventListener("online",this._onWindowOnline,!1),window.removeEventListener("visibilitychange",this._onVisibilityChange,!1);const c=this.painter.context.gl.getExtension("WEBGL_lose_context");c&&c.loseContext(),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvasContainer.remove(),this._controlContainer.remove(),this._missingCSSCanary.remove(),this._canvas=void 0,this._canvasContainer=void 0,this._controlContainer=void 0,this._missingCSSCanary=void 0,this._container.classList.remove("mapboxgl-map"),this._container.removeEventListener("scroll",this._onMapScroll,!1),a.dh(this.painter.context.gl),a.di.remove(),a.dj.remove(),this._removed=!0,this.fire(new a.b("remove"))}triggerRepaint(){this._triggerFrame(!0)}_triggerFrame(c){this._renderNextFrame=this._renderNextFrame||c,this.style&&!this._frame&&(this._frame=a.f.frame(r=>{const o=!!this._renderNextFrame;this._frame=null,this._renderNextFrame=null,o&&this._render(r)}))}_preloadTiles(c){const r=this.style?Object.values(this.style._sourceCaches):[];return a.b1(r,(o,u)=>o._preloadTiles(c,u),()=>{this.triggerRepaint()}),this}_onWindowOnline(){this._update()}_onWindowResize(c){this._trackResize&&this.resize({originalEvent:c})._update()}_onVisibilityChange(){document.visibilityState==="hidden"&&this._visibilityHidden++}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(c){this._showTileBoundaries!==c&&(this._showTileBoundaries=c,this._update())}get showParseStatus(){return!!this._showParseStatus}set showParseStatus(c){this._showParseStatus!==c&&(this._showParseStatus=c,this._update())}get showTerrainWireframe(){return!!this._showTerrainWireframe}set showTerrainWireframe(c){this._showTerrainWireframe!==c&&(this._showTerrainWireframe=c,this._update())}get showLayers2DWireframe(){return!!this._showLayers2DWireframe}set showLayers2DWireframe(c){this._showLayers2DWireframe!==c&&(this._showLayers2DWireframe=c,this._update())}get showLayers3DWireframe(){return!!this._showLayers3DWireframe}set showLayers3DWireframe(c){this._showLayers3DWireframe!==c&&(this._showLayers3DWireframe=c,this._update())}get speedIndexTiming(){return!!this._speedIndexTiming}set speedIndexTiming(c){this._speedIndexTiming!==c&&(this._speedIndexTiming=c,this._update())}get showPadding(){return!!this._showPadding}set showPadding(c){this._showPadding!==c&&(this._showPadding=c,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(c){this._showCollisionBoxes!==c&&(this._showCollisionBoxes=c,c?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(c){this._showOverdrawInspector!==c&&(this._showOverdrawInspector=c,this._update())}get repaint(){return!!this._repaint}set repaint(c){this._repaint!==c&&(this._repaint=c,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(c){this._vertices=c,this._update()}get showTileAABBs(){return!!this._showTileAABBs}set showTileAABBs(c){this._showTileAABBs!==c&&(this._showTileAABBs=c,c&&this._update())}_setCacheLimits(c,r){a.dl(c,r)}get version(){return a.dk}},NavigationControl:class{constructor(c){this.options=a.e({},Tl,c),this._container=Wt("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",r=>r.preventDefault()),this.options.showZoom&&(a.aY(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("mapboxgl-ctrl-zoom-in",r=>{this._map&&this._map.zoomIn({},{originalEvent:r})}),Wt("span","mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("mapboxgl-ctrl-zoom-out",r=>{this._map&&this._map.zoomOut({},{originalEvent:r})}),Wt("span","mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(a.aY(["_rotateCompassArrow"],this),this._compass=this._createButton("mapboxgl-ctrl-compass",r=>{const o=this._map;o&&(this.options.visualizePitch?o.resetNorthPitch({},{originalEvent:r}):o.resetNorth({},{originalEvent:r}))}),this._compassIcon=Wt("span","mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){const c=this._map;if(!c)return;const r=c.getZoom(),o=r===c.getMaxZoom(),u=r===c.getMinZoom();this._zoomInButton.disabled=o,this._zoomOutButton.disabled=u,this._zoomInButton.setAttribute("aria-disabled",o.toString()),this._zoomOutButton.setAttribute("aria-disabled",u.toString())}_rotateCompassArrow(){const c=this._map;if(!c)return;const r=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(c.transform.pitch*(Math.PI/180)
2114),.5)}) rotateX(${c.transform.pitch}deg) rotateZ(${c.transform.angle*(180/Math.PI)}deg)`:`rotate(${c.transform.angle*(180/Math.PI)}deg)`;c._requestDomTask(()=>{this._compassIcon&&(this._compassIcon.style.transform=r)})}onAdd(c){return this._map=c,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),c.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&c.on("pitch",this._rotateCompassArrow),c.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new kn(c,this._compass,this.options.visualizePitch)),this._container}onRemove(){const c=this._map;c&&(this._container.remove(),this.options.showZoom&&c.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&c.off("pitch",this._rotateCompassArrow),c.off("rotate",this._rotateCompassArrow),this._handler&&this._handler.off(),this._handler=void 0),this._map=void 0)}_createButton(c,r){const o=Wt("button",c,this._container);return o.type="button",o.addEventListener("click",r),o}_setButtonTitle(c,r){if(!this._map)return;const o=this._map._getUIString(`NavigationControl.${r}`);c.setAttribute("aria-label",o),c.firstElementChild&&c.firstElementChild.setAttribute("title",o)}},GeolocateControl:class extends a.E{constructor(c){super();const r=navigator.geolocation;this.options=a.e({geolocation:r},Ml,c),a.aY(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker","_updateMarkerRotation","_onDeviceOrientation"],this),this._updateMarkerRotationThrottled=ga(this._updateMarkerRotation,20),this._numberOfWatches=0}onAdd(c){return this._map=c,this._container=Wt("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkGeolocationSupport(this._setupUI),this._container}onRemove(){this._geolocationWatchID!==void 0&&(this.options.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),this._container.remove(),this._map.off("zoom",this._onZoom),this._map=void 0,this._numberOfWatches=0,this._noTimeout=!1}_checkGeolocationSupport(c){const r=(o=!!this.options.geolocation)=>{this._supportsGeolocation=o,c(o)};this._supportsGeolocation!==void 0?c(this._supportsGeolocation):navigator.permissions!==void 0?navigator.permissions.query({name:"geolocation"}).then(o=>r(o.state!=="denied")).catch(()=>r()):r()}_isOutOfMapMaxBounds(c){const r=this._map.getMaxBounds(),o=c.coords;return!!r&&(o.longitude<r.getWest()||o.longitude>r.getEast()||o.latitude<r.getSouth()||o.latitude>r.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting")}}_onSuccess(c){if(this._map){if(this._isOutOfMapMaxBounds(c))return this._setErrorState(),this.fire(new a.b("outofmaxbounds",c)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=c,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background")}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(c),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(c),this.options.showUserLocation&&this._userLocationDotMarker.removeClassName("mapboxgl-user-location-dot-stale"),this.fire(new a.b("geolocate",c)),this._finish()}}_updateCamera(c){const r=new a.bn(c.coords.longitude,c.coords.latitude),o=c.coords.accuracy,u=this._map.getBearing(),d=a.e({bearing:u},this.options.fitBoundsOptions);this._map.fitBounds(r.toBounds(o),d,{geolocateSource:!0})}_updateMarker(c){if(c){const r=new a.bn(c.coords.longitude,c.coords.latitude);this._accuracyCircleMarker.setLngLat(r).addTo(this._map),this._userLocationDotMarker.setLngLat(r).addTo(this._map),this._accuracy=c.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){const c=this._map.transform,r=a.bl(1,c._center.lat)*c.worldSize,o=Math.ceil(2*this._accuracy*r);this._circleElement.style.width=`${o}px`,this._circleElement.style.height=`${o}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}_updateMarkerRotation(){this._userLocationDotMarker&&typeof this._heading=="number"?(this._userLocationDotMarker.setRotation(this._heading),this._userLocationDotMarker.addClassName("mapboxgl-user-location-show-heading")):(this._userLocationDotMarker.removeClassName("mapboxgl-user-location-show-heading"),this._userLocationDotMarker.setRotation(0))}_onError(c){if(this._map){if(this.options.trackUserLocation)if(c.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const r=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.setAttribute("aria-label",r),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",r),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(c.code===3&&this._noTimeout)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._userLocationDotMarker.addClassName("mapboxgl-user-location-dot-stale"),this.fire(new a.b("error",c)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(c){if(this._map!==void 0){if(this._container.addEventListener("contextmenu",r=>r.preventDefault()),this._geolocateButton=Wt("button","mapboxgl-ctrl-geolocate",this._container),Wt("span","mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",c===!1){a.w("Geolocation support is not available so the GeolocateControl will be disabled.");const r=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.setAttribute("aria-label",r),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",r)}else{const r=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.setAttribute("aria-label",r),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",r)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","fal
2114se"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=Wt("div","mapboxgl-user-location"),this._dotElement.appendChild(Wt("div","mapboxgl-user-location-dot")),this._dotElement.appendChild(Wt("div","mapboxgl-user-location-heading")),this._userLocationDotMarker=new xu({element:this._dotElement,rotationAlignment:"map",pitchAlignment:"map"}),this._circleElement=Wt("div","mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new xu({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",r=>{r.geolocateSource||this._watchState!=="ACTIVE_LOCK"||r.originalEvent&&r.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this.fire(new a.b("trackuserlocationend")))})}}_onDeviceOrientation(c){this._userLocationDotMarker&&(c.webkitCompassHeading?this._heading=c.webkitCompassHeading:c.absolute===!0&&(this._heading=-1*c.alpha),this._updateMarkerRotationThrottled())}trigger(){if(!this._setup)return a.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 a.b("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":this._numberOfWatches--,this._noTimeout=!1,this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this.fire(new a.b("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new a.b("trackuserlocationstart"))}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"BACKGROUND":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background");break;case"BACKGROUND_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error")}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let c;this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),this._numberOfWatches++,this._numberOfWatches>1?(c={maximumAge:6e5,timeout:0},this._noTimeout=!0):(c=this.options.positionOptions,this._noTimeout=!1),this._geolocationWatchID=this.options.geolocation.watchPosition(this._onSuccess,this._onError,c),this.options.showUserHeading&&this._addDeviceOrientationListener()}}else this.options.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_addDeviceOrientationListener(){const c=()=>{"ondeviceorientationabsolute"in window?window.addEventListener("deviceorientationabsolute",this._onDeviceOrientation):window.addEventListener("deviceorientation",this._onDeviceOrientation)};typeof DeviceMotionEvent<"u"&&typeof DeviceMotionEvent.requestPermission=="function"?DeviceOrientationEvent.requestPermission().then(r=>{r==="granted"&&c()}).catch(console.error):c()}_clearWatch(){this.options.geolocation.clearWatch(this._geolocationWatchID),window.removeEventListener("deviceorientation",this._onDeviceOrientation),window.removeEventListener("deviceorientationabsolute",this._onDeviceOrientation),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","fal
2114se"),this.options.showUserLocation&&this._updateMarker(null)}},AttributionControl:yu,ScaleControl:class{constructor(c){this.options=a.e({},gr,c),this._isNumberFormatSupported=function(){try{return new Intl.NumberFormat("en",{style:"unit",unitDisplay:"short",unit:"meter"}),!0}catch{return!1}}(),a.aY(["_update","_setScale","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_update(){const c=this.options.maxWidth||100,r=this._map,o=r._containerHeight/2,u=r._containerWidth/2-c/2,d=r.unproject([u,o]),p=r.unproject([u+c,o]),g=d.distanceTo(p);if(this.options.unit==="imperial"){const x=3.2808*g;x>5280?this._setScale(c,x/5280,"mile"):this._setScale(c,x,"foot")}else this.options.unit==="nautical"?this._setScale(c,g/1852,"nautical-mile"):g>=1e3?this._setScale(c,g/1e3,"kilometer"):this._setScale(c,g,"meter")}_setScale(c,r,o){this._map._requestDomTask(()=>{const u=function(p){const g=Math.pow(10,`${Math.floor(p)}`.length-1);let x=p/g;return x=x>=10?10:x>=5?5:x>=3?3:x>=2?2:x>=1?1:function(b){const T=Math.pow(10,Math.ceil(-Math.log(b)/Math.LN10));return Math.round(b*T)/T}(x),g*x}(r),d=u/r;this._container.innerHTML=this._isNumberFormatSupported&&o!=="nautical-mile"?new Intl.NumberFormat(this._language,{style:"unit",unitDisplay:"short",unit:o}).format(u):`${u} ${mo[o]}`,this._container.style.width=c*d+"px"})}onAdd(c){return this._map=c,this._language=c.getLanguage(),this._container=Wt("div","mapboxgl-ctrl mapboxgl-ctrl-scale",c.getContainer()),this._container.dir="auto",this._map.on("move",this._update),this._update(),this._container}onRemove(){this._container.remove(),this._map.off("move",this._update),this._map=void 0}_setLanguage(c){this._language=c,this._update()}setUnit(c){this.options.unit=c,this._update()}},FullscreenControl:class{constructor(c){this._fullscreen=!1,c&&c.container&&(c.container instanceof HTMLElement?this._container=c.container:a.w("Full screen control 'container' must be a DOM element.")),a.aY(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onwebkitfullscreenchange"in document&&(this._fullscreenchange="webkitfullscreenchange")}onAdd(c){return this._map=c,this._container||(this._container=this._map.getContainer()),this._controlContainer=Wt("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",a.w("This device does not support fullscreen mode.")),this._controlContainer}onRemove(){this._controlContainer.remove(),this._map=null,document.removeEventListener(this._fullscreenchange,this._changeIcon)}_checkFullscreenSupport(){return!(!document.fullscreenEnabled&&!document.webkitFullscreenEnabled)}_setupUI(){const c=this._fullscreenButton=Wt("button","mapboxgl-ctrl-fullscreen",this._controlContainer);Wt("span","mapboxgl-ctrl-icon",c).setAttribute("aria-hidden","true"),c.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){const c=this._getTitle();this._fullscreenButton.setAttribute("aria-label",c),this._fullscreenButton.firstElementChild&&this._fullscreenButton.firstElementChild.setAttribute("title",c)}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_changeIcon(){(document.fullscreenElement||document.webkitFullscreenElement)===this._container!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"),this._updateTitle())}_onClickFullscreen(){this._isFullscreen()?document.exitFullscreen?document.exitFullscreen():document.webkitCancelFullScreen&&document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()}},Popup:class extends a.E{constructor(c){super(),this.options=a.e(Object.create(Gh),c),a.aY(["_update","_onClose","remove","_onMouseEvent"],this),this._classList=new Set(c&&c.className?c.className.trim().split(/\s+/):[])}addTo(c){return this._map&&this.remove(),this._map=c,this.options.closeOnClick&&c.on("preclick",this._onClose),this.options.closeOnMove&&c.on("move",this._onClose),c.on("remove",this.remove),this._update(),c._addPopup(this),this._focusFirstElement(),this._trackPointer?(c.on("mousemove",this._onMouseEvent),c.on("mouseup",this._onMouseEvent),c._canvasContainer.classList.add("mapboxgl-track-pointer")):c.on("move",this._update),this.fire(new a.b("open")),this}isOpen(){return!!this._map}remove(){this._content&&this._content.remove(),this._container&&(this._container.remove(),this._container=void 0);const c=this._map;
vendor: 4,229 bytes, line 2114
2114return c&&(c.off("move",this._update),c.off("move",this._onClose),c.off("preclick",this._onClose),c.off("click",this._onClose),c.off("remove",this.remove),c.off("mousemove",this._onMouseEvent),c.off("mouseup",this._onMouseEvent),c.off("drag",this._onMouseEvent),c._canvasContainer&&c._canvasContainer.classList.remove("mapboxgl-track-pointer"),c._removePopup(this),this._map=void 0),this.fire(new a.b("close")),this}getLngLat(){return this._lngLat}setLngLat(c){this._lngLat=a.bn.convert(c),this._pos=null,this._trackPointer=!1,this._update();const r=this._map;return r&&(r.on("move",this._update),r.off("mousemove",this._onMouseEvent),r._canvasContainer.classList.remove("mapboxgl-track-pointer")),this}trackPointer(){this._trackPointer=!0,this._pos=null,this._update();const c=this._map;return c&&(c.off("move",this._update),c.on("mousemove",this._onMouseEvent),c.on("drag",this._onMouseEvent),c._canvasContainer.classList.add("mapboxgl-track-pointer")),this}getElement(){return this._container}setText(c){return this.setDOMContent(document.createTextNode(c))}setHTML(c){const r=document.createDocumentFragment(),o=document.createElement("body");let u;for(o.innerHTML=c;u=o.firstChild,u;)r.appendChild(u);return this.setDOMContent(r)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(c){return this.options.maxWidth=c,this._update(),this}setDOMContent(c){let r=this._content;if(r)for(;r.hasChildNodes();)r.firstChild&&r.removeChild(r.firstChild);else r=this._content=Wt("div","mapboxgl-popup-content",this._container||void 0);if(r.appendChild(c),this.options.closeButton){const o=this._closeButton=Wt("button","mapboxgl-popup-close-button",r);o.type="button",o.setAttribute("aria-label","Close popup"),o.setAttribute("aria-hidden","true"),o.innerHTML="×",o.addEventListener("click",this._onClose)}return this._update(),this._focusFirstElement(),this}addClassName(c){return this._classList.add(c),this._updateClassList(),this}removeClassName(c){return this._classList.delete(c),this._updateClassList(),this}setOffset(c){return this.options.offset=c,this._update(),this}toggleClassName(c){let r;return this._classList.delete(c)?r=!1:(this._classList.add(c),r=!0),this._updateClassList(),r}_onMouseEvent(c){this._update(c.point)}_getAnchor(c){if(this.options.anchor)return this.options.anchor;const r=this._map,o=this._container,u=this._pos;if(!r||!o||!u)return"bottom";const d=o.offsetWidth,p=o.offsetHeight,g=u.x<d/2,x=u.x>r.transform.width-d/2;if(u.y+c<p)return g?"top-left":x?"top-right":"top";if(u.y>r.transform.height-p){if(g)return"bottom-left";if(x)return"bottom-right"}return g?"left":x?"right":"bottom"}_updateClassList(){const c=this._container;if(!c)return;const r=[...this._classList];r.push("mapboxgl-popup"),this._anchor&&r.push(`mapboxgl-popup-anchor-${this._anchor}`),this._trackPointer&&r.push("mapboxgl-popup-track-pointer"),c.className=r.join(" ")}_update(c){const r=this._map,o=this._content;if(!r||!this._lngLat&&!this._trackPointer||!o)return;let u=this._container;if(u||(u=this._container=Wt("div","mapboxgl-popup",r.getContainer()),this._tip=Wt("div","mapboxgl-popup-tip",u),u.appendChild(o)),this.options.maxWidth&&u.style.maxWidth!==this.options.maxWidth&&(u.style.maxWidth=this.options.maxWidth),r.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=Ia(this._lngLat,this._pos,r.transform)),!this._trackPointer||c){const d=this._pos=this._trackPointer&&c?c:r.project(this._lngLat),p=qh(this.options.offset),g=this._anchor=this._getAnchor(p.y),x=qh(this.options.offset,g),b=d.add(x).round();r._requestDomTask(()=>{this._container&&g&&(this._container.style.transform=`${wl[g]} translate(${b.x}px,${b.y}px)`)})}if(!this._marker&&r._showingGlobe()){const d=a.d6(r.transform,this._lngLat)?0:1;this._setOpacity(d)}this._updateClassList()}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const c=this._container.querySelector(Zh);c&&c.focus()}_onClose(){this.remove()}_setOpacity(c){this._container&&(this._container.style.opacity=`${c}`),this._content&&(this._content.style.pointerEvents=c?"auto":"none")}},Marker:xu,Style:sn,LngLat:a.bn,LngLatBounds:a.ad,Point:a.P,MercatorCoordinate:a.L,FreeCameraOptions:ea,Evented:a.E,config:a.d
21145,prewarm:a.dp,clearPrewarmedResources:a.dq,get accessToken(){return a.d5.ACCESS_TOKEN},set accessToken(c){a.d5.ACCESS_TOKEN=c},get baseApiUrl(){return a.d5.API_URL},set baseApiUrl(c){a.d5.API_URL=c},get workerCount(){return a.dr.workerCount},set workerCount(c){a.dr.workerCount=c},get maxParallelImageRequests(){return a.d5.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(c){a.d5.MAX_PARALLEL_IMAGE_REQUESTS=c},clearStorage(c){a.ds(c)},get workerUrl(){return a.dt.workerUrl},set workerUrl(c){a.dt.workerUrl=c},get workerClass(){return a.dt.workerClass},set workerClass(c){a.dt.workerClass=c},get workerParams(){return a.dt.workerParams},set workerParams(c){a.dt.workerParams=c},get dracoUrl(){return a.du()},set dracoUrl(c){a.dv(c)},get meshoptUrl(){return a.dw()},set meshoptUrl(c){a.dx(c)},setNow:a.f.setNow,restoreNow:a.f.restoreNow}});var Wy=Gd;return Wy})})(Zy);var S1=Zy.exports;const C1=E1(S1);export{C1 as m};
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.