1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[78301],{2146:(t,i,r)=>{let a,o,s,n,l,h,c,u,d,_,p,m,f,g,v,y,x,b,w;r.d(i,{T5:()=>oY,UH:()=>eL,ov:()=>oJ,pH:()=>o9,zD:()=>st});var T,P=r(95478);function M(){var t=new P.Pi(4);return P.Pi!=Float32Array&&(t[1]=0,t[2]=0),t[0]=1,t[3]=1,t}let C={frame(t,i,r,a){let o=a||window,s=o.requestAnimationFrame(t=>{n(),i(t)}),{unsubscribe:n}=(0,P.kr)(t.signal,"abort",()=>{n(),o.cancelAnimationFrame(s),r(new P.jn(t.signal.reason))},!1)},frameAsync(t,i){return new Promise((r,a)=>{this.frame(t,r,a,i)})},getImageData(t,i=0){return this.getImageCanvasContext(t).getImageData(-i,-i,t.width+2*i,t.height+2*i)},getImageCanvasContext(t){let i;if((0,P.Ii)()&&!(0,P.Fi)())i=new OffscreenCanvas(t.width,t.height).getContext("2d",{willReadFrequently:!0});else{let r=window.document.createElement("canvas");r.width=t.width,r.height=t.height,i=r.getContext("2d",{willReadFrequently:!0})}if(!i)throw Error("failed to create canvas 2d context");return i.drawImage(t,0,0,t.width,t.height),i},resolveURL:t=>((a||=document.createElement("a")).href=t,a.href),get hardwareConcurrency(){return"u">typeof navigator&&navigator.hardwareConcurrency||4},get prefersReducedMotion(){return void 0===s?!!matchMedia&&(o??=matchMedia("(prefers-reduced-motion: reduce)")).matches:s},set prefersReducedMotion(e){s=e}},I=new class{constructor(){this._frozenAt=null}getCurrentTime(){return null===this._frozenAt?performance.now():this._frozenAt}setNow(t){this._frozenAt=t}restoreNow(){this._frozenAt=null}isFrozen(){return null!==this._frozenAt}};function S(){return I.getCurrentTime()}let E=new Set("a.abbr.b.bdi.bdo.br.cite.code.del.div.em.i.img.ins.kbd.li.mark.ol.p.q.s.samp.small.span.strong.sub.sup.time.u.ul.var.wbr".split(".")),z=new Set(["alt","class","datetime","dir","height","href","hreflang","lang","referrerpolicy","rel","role","src","target","title","translate","type","width"]),R=new Set(["href","src"]),D=new Set(["http:","https:","mailto:"]);function L(){return n??={getAttribute:Element.prototype.getAttribute,getAttributeNames:Element.prototype.getAttributeNames,querySelectorAll:Element.prototype.querySelectorAll,remove:Element.prototype.remove,removeAttribute:Element.prototype.removeAttribute,localName:Object.getOwnPropertyDescriptor(Element.prototype,"localName").get,namespaceURI:Object.getOwnPropertyDescriptor(Element.prototype,"namespaceURI").get}}var A=class t{static{this.docStyle="u">typeof window&&window.document?.documentElement.style}static{this.selectProp=!t.docStyle||"userSelect"in t.docStyle?"userSelect":"webkitUserSelect"}static create(t,i,r){let a=window.document.createElement(t);return void 0!==i&&(a.className=i),r&&r.appendChild(a),a}static createNS(t,i){return window.document.createElementNS(t,i)}static disableDrag(){t.docStyle&&t.selectProp&&(t.userSelect=t.docStyle[t.selectProp],t.docStyle[t.selectProp]="none")}static enableDrag(){t.docStyle&&t.selectProp&&(t.docStyle[t.selectProp]=t.userSelect)}static suppressClickInternal(i){i.preventDefault(),i.stopPropagation(),window.removeEventListener("click",t.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",t.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",t.suppressClickInternal,!0)},0)}static getScale(t){let i=t.getBoundingClientRect();return{x:i.width/t.offsetWidth||1,y:i.height/t.offsetHeight||1,boundingClientRect:i}}static getPoint(t,i,r){let a=i.boundingClientRect;return new P.Li((r.clientX-a.left)/i.x-t.clientLeft,(r.clientY-a.top)/i.y-t.clientTop)}static mousePos(i,r){let a=t.getScale(i);return t.getPoint(i,a,r)}static touchPos(i,r){let a=[],o=t.getScale(i);for(let s of r)a.push(t.getPoint(i,o,s));return a}static sanitize(i){let r=new DOMParser().parseFromString(i,"text/html").body,{querySelectorAll:a,remove:o}=L();for(let i of Array.from(a.call(r,"*")))t.isAllowedElement(i)?t.removeDisallowedAttributes(i):o.call(i);let s=document.createDocumentFragment();return s.append(...r.childNodes),s}static isAllowedElement(t){let{namespaceURI:i,localName:r}=L();return"http://www.w3.org/1999/xhtml"===i.call(t)&&E.has(r.call(t))}static removeDisallowedAttributes(i){let{getAttributeNames:r,getAttribute:a,removeAttribute:o}=L();for(let s of r.call(i))t.isAllowedAttribute(s,a.call(i,s))||o.call(i,s)}static isAllowedAttribute(t,i){if(!z.has(t)&&!t.startsWith("aria-"))return!1;if(!R.has(t))return!0;
1try{return D.has(new URL(i,"https://maplibre.invalid/").protocol)}catch{return!1}}};(T=l||={}).resetRequestQueue=()=>{f=[],g=0,v=0,y={}},T.addThrottleControl=t=>{let i=v++;return y[i]=t,i},T.removeThrottleControl=t=>{delete y[t],b()},T.transformAndGetImage=async function(t,i,r,a,o=!0,s){let n=await t.transformRequest(i,r);return(0,P.Nn)(a.signal),l.getImage(n,a,o,s)},T.getImage=(t,i,r=!0,a)=>new Promise((o,s)=>{t.headers||={},t.headers.accept="image/webp,*/*",(0,P.er)(t,{type:"image"}),f.push({abortController:i,requestParameters:t,supportImageRefresh:r,imageBitmapOptions:a,state:"queued",onError:t=>{s(t)},onSuccess:t=>{o(t)}}),b()}),x=async t=>{t.state="running";let{requestParameters:i,supportImageRefresh:r,imageBitmapOptions:a,onError:o,onSuccess:s,abortController:n}=t,l=!1===r&&!a&&!(0,P.pr)(self)&&!(0,P.On)(i.url)&&(!i.headers||Object.keys(i.headers).reduce((t,i)=>t&&"accept"===i,!0));g++;let h=l?w(i,n):(0,P.Tn)(i,n);try{let i,r=await h;delete t.abortController,t.state="completed",r.data instanceof HTMLImageElement||(0,P.cr)(r.data)?s(r):s(r.data&&0!==r.data.byteLength?{data:await (i=r.data,"function"==typeof createImageBitmap?(0,P.Rn)(i,a):(0,P.Ln)(i)),cacheControl:r.cacheControl,expires:r.expires}:{data:null,cacheControl:r.cacheControl,expires:r.expires})}catch(i){delete t.abortController,o((0,P.Qn)(i))}finally{g--,b()}},b=()=>{let t=(()=>{for(let t of Object.keys(y))if(y[t]())return!0;return!1})()?P.An.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:P.An.MAX_PARALLEL_IMAGE_REQUESTS;for(let i=g;i<t&&f.length>0;i++){let t=f.shift();if(t.abortController.signal.aborted){i--;continue}x(t)}},w=(t,i)=>new Promise((r,a)=>{let o=new Image,s=t.url,n=t.credentials;n&&"include"===n?o.crossOrigin="use-credentials":(n&&"same-origin"===n||!(0,P.En)(s))&&(o.crossOrigin="anonymous"),i.signal.addEventListener("abort",()=>{o.src="",a(new P.jn(i.signal.reason))}),o.fetchPriority="high",o.onload=()=>{o.onerror=o.onload=null,r({data:o})},o.onerror=()=>{o.onerror=o.onload=null,i.signal.aborted||a(Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."))},o.src=s}),l.resetRequestQueue();var F=class{constructor(t){this._transformRequestFn=t??null}transformRequest(t,i){return this._transformRequestFn&&this._transformRequestFn(t,i)||{url:t}}setTransformRequest(t){this._transformRequestFn=t}},k=class extends P._n{},B=class extends k{},O=class extends k{constructor(t={}){super("style.load",t)}},j=class extends k{constructor(t,i={}){super(t,i),this.dataType="style"}},N=class extends k{constructor(t,i={}){super(t,i),this.dataType="source"}},Z=class extends k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,i,r,a={}){r=r instanceof MouseEvent?r:new MouseEvent(t,r);let o=A.mousePos(i.getCanvas(),r),s=i.unproject(o);super(t,(0,P.er)({point:o,lngLat:s,originalEvent:r},a)),this._defaultPrevented=!1,this.target=i}},U=class extends k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,i,r){let a="touchend"===t?r.changedTouches:r.touches,o=A.touchPos(i.getCanvasContainer(),a),s=o.map(t=>i.unproject(t)),n=o.reduce((t,i,r,a)=>t.add(i.div(a.length)),new P.Li(0,0)),l=i.unproject(n);super(t,{points:o,point:n,lngLats:s,lngLat:l,originalEvent:r}),this._defaultPrevented=!1}},G=class extends k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,i){super("wheel",{originalEvent:i}),this._defaultPrevented=!1}},V=class extends k{},q=class extends k{constructor(t={}){super("terrain",t)}},W=class extends k{constructor(t={}){super("projectiontransition",t)}},$=class extends k{},H=class extends k{constructor(t={}){super("styleimagemissing",t)}};function X(t){t=t.slice();let i=Object.create(null);for(let r=0;r<t.length;r++)i[t[r].id]=t[r];for(let r=0;r<t.length;r++)"ref"in t[r]&&(t[r]=function(t,i){let r={};for(let i in t)"ref"!==i&&(r[i]=t[i]);return P.mn.forEach(t=>{t in i&&(r[t]=i[t])}),r}(t[r],i[t[r].ref]));return t}function Y(t,i){if(Array.isArray(t)){if(!Array.isArray(i)||t.length!==i.length)return!1;for(let r=0;r<t.length;r++)if(!Y(t[r],i[r]))return!1;return!0}if("object"==typeof t&&t&&null!==i){if("object"!=typeof i||Object.keys(t).length!==Object.keys(i).length)return!1;for(let r in t)if(!Y(t[r],i[r]))return!1;return!0}return t===i}function K(t,i){t.push(i)}function J(t,i,r){K(r,{command:"addSource",args:[t,i[t]]})}function Q(t,i,r){K(i,{command:"removeSource",args:[t]}),r[t]=!0}function ee(t,i,r,a,o){K(i,{command:o,args:[r,a,t[a]]})}function et(t,i,r,a,o){for(let s in i||={},t||={})Object.prototype.hasOwnProperty.call(t,s)&&(Y(t[s],i[s])||ee(i,r,a,s,o));for(let s in i)Object.prototype.hasOwnProperty.call(i,s)&&!Object.prototype.hasOwnProperty.call(t,s)&&(Y(t[s],i[s])||ee(i,r,a,s,o))}function ei(t){return t.id}function er(t,i){return t[i.id]=i,t}function ea(t){let i=[];if("string"==typeof t)i.push({id:"default",url:t});else if(t&&t.length>0){let r=[];for(let{id:a,url:o}of t){let t=`${a}${o}`;r.includes(t)||(r.push(t),i.push({id:a,url:o}))}}return i}function eo(t,i,r){try{let a=new URL(t);return a.pathname+=`${i}${r}`,a.toString()}catch{throw Error(`Invalid sprite URL "${t}", must be absolute. Modify style specification directly or use TransformStyleFunction to correct the issue dynamically`)}}async function es(t,i,r,a){let o=ea(t),s=r>1?"@2x":"",n={},h={};for(let{id:t,url:r}of o){let o=await i.transformRequest(eo(r,s,".json"),"SpriteJSON");n[t]=(0,P.Sn)(o,a);let c=await i.transformRequest(eo(r,s,".png"),"SpriteImage");h[t]=l.getImage(c,a)}return await Promise.all([...Object.values(n),...Object.values(h)]),en(n,h)}async function en(t,i){let r={};for(let a in t){r[a]={};let o=(await i[a]).data;if(!o)throw Error(`Could not load sprite image for ${a}: the response is empty`);let s=C.getImageCanvasContext(o),n=(await t[a]).data;for(let t in n){let{width:i,height:o,x:l,y:h,sdf:c,pixelRatio:u,stretchX:d,stretchY:_,content:p,textFitWidth:m,textFitHeight:f}=n[t],g={width:i,height:o,x:l,y:h,context:s};r[a][t]={data:null,pixelRatio:u,sdf:c,stretchX:d,stretchY:_,content:p,textFitWidth:m,textFitHeight:f,spriteData:g}}}return r}var el=class extends P.vn{constructor(){super(),this.images={},this.updateVersion=0,this.loaded=!1,this.requestors=[],this.missingImageResolver=null,this._spriteImagesIds={},this._imagesIds=null,this._renderCallbacksDispatchedThisFrame={}}destroy(){for(let t of Object.keys(this.images))this.removeImage(t);this._spriteImagesIds={}}isLoaded(){return this.loaded}setLoaded(t){if(this.loaded!==t&&(this.loaded=t,t)){for(let{ids:t,promiseResolve:i}of this.requestors)i(this._getImagesForIds(t));this.requestors=[]}}getImage(t){let i=this.images[t];if(i&&!i.data&&i.spriteData){let t=i.spriteData;i.data=new P.Dt({width:t.width,height:t.height},t.context.getImageData(t.x,t.y,t.width,t.height).data),i.spriteData=null}return i}addImage(t,i){if(this.images[t])throw Error(`Image id ${t} already exist, use updateImage instead`);
1this._validate(t,i)&&(this.images[t]=i,this._imagesIds=null,i.isWebGLImage&&this.updateImage(t,i,!1))}_validate(t,i){let r=!0,a=i.data||i.spriteData;return this._validateStretch(i.stretchX,a?.width)||(this.fire(new P.gn(Error(`Image "${t}" has invalid "stretchX" value`))),r=!1),this._validateStretch(i.stretchY,a?.height)||(this.fire(new P.gn(Error(`Image "${t}" has invalid "stretchY" value`))),r=!1),this._validateContent(i.content,i)||(this.fire(new P.gn(Error(`Image "${t}" has invalid "content" value`))),r=!1),r}_validateStretch(t,i){if(!t)return!0;let r=0;for(let a of t){if(a[0]<r||a[1]<a[0]||i<a[1])return!1;r=a[1]}return!0}_validateContent(t,i){if(!t)return!0;if(4!==t.length)return!1;let r=i.spriteData,a=r?.width||i.data.width,o=r?.height||i.data.height;return!(t[0]<0)&&!(a<t[0])&&!(t[1]<0)&&!(o<t[1])&&!(t[2]<0)&&!(a<t[2])&&!(t[3]<0)&&!(o<t[3])&&!(t[2]<t[0])&&t[3]>=t[1]}updateImage(t,i,r=!0){let a=this.images[t];if(r){let t=a.data||a.spriteData;if(t.width!==i.data.width||t.height!==i.data.height)throw Error(`size mismatch between old image (${t.width}x${t.height}) and new image (${i.data.width}x${i.data.height}).`)}i.version=(a.version??0)+1,this.images[t]=i,this.updateVersion++}removeImage(t){let i=this.images[t];i&&(delete this.images[t],this._imagesIds=null,i.userImage?.onRemove&&i.userImage.onRemove())}listImages(){return this._imagesIds??=Object.keys(this.images),this._imagesIds}_getSpriteImageId(t,i){return"default"===t?i:`${t}:${i}`}setSpriteImages(t,i){let r=this._spriteImagesIds[t]??[],a=[];for(let r in i){let o=this._getSpriteImageId(t,r);a.push(o),o in this.images?this.updateImage(o,i[r],!1):this.addImage(o,i[r])}let o=new Set(a),s=r.filter(t=>!o.has(t));for(let t of s)this.removeImage(t);return this._spriteImagesIds[t]=a,{loaded:a,removed:s}}removeSpriteImages(t){let i=this._spriteImagesIds[t]??[];for(let t of i)this.removeImage(t);return delete this._spriteImagesIds[t],i}removeAllSpriteImages(){let t=Object.values(this._spriteImagesIds).flat();for(let i of t)this.removeImage(i);return this._spriteImagesIds={},t}setMissingImageResolver(t){this.missingImageResolver=t}getImages(t){return new Promise((i,r)=>{let a=!0;if(!this.isLoaded())for(let i of t)this.images[i]||(a=!1);this.isLoaded()||a?i(this._getImagesForIds(t)):this.requestors.push({ids:t,promiseResolve:i})})}async _getImagesForIds(t){let i=new Set(t.filter(t=>!this.getImage(t))),r=this.missingImageResolver;r&&await Promise.allSettled(Array.from(i,t=>r(t)));let a={};for(let r of t){let t=this.getImage(r);t&&(i.delete(r),a[r]={data:t.data.clone(),pixelRatio:t.pixelRatio,sdf:t.sdf,version:t.version,stretchX:t.stretchX,stretchY:t.stretchY,content:t.content,textFitWidth:t.textFitWidth,textFitHeight:t.textFitHeight,hasRenderCallback:!!t.userImage?.render,isWebGLImage:t.isWebGLImage})}for(let t of i)this.fire(new H({id:t})),(0,P.Nr)(`Image "${t}" could not be loaded. Please make sure you have added the image before it is needed with map.addImage(), resolved it with map.setMissingStyleImageResolver(), or included it in a "sprite" property in your style.`);return a}beginFrame(){this._renderCallbacksDispatchedThisFrame={}}dispatchRenderCallbacks(t){for(let i of t){if(this._renderCallbacksDispatchedThisFrame[i])continue;this._renderCallbacksDispatchedThisFrame[i]=!0;let t=this.getImage(i);t||(0,P.Nr)(`Image with ID: "${i}" was not found`),(0,P.L)(t)&&this.updateImage(i,t)}}cloneImages(){let t={};for(let i in this.images){let r=this.images[i];t[i]={...r,data:r.data?r.data.clone():null}}return t}},eh=class{constructor(t){this._imageManager=t,this._entries={},this._image=new P.Dt({width:1,height:1}),this._dirty=!0}destroy(){this._texture&&=(this._texture.destroy(),null),this._entries={},this._image=new P.Dt({width:1,height:1}),this._dirty=!0}getPixelSize(){let{width:t,height:i}=this._image;return{width:t,height:i}}getPattern(t){let i=this._imageManager.getImage(t);if(!i)return null;let r=this._entries[t];
1if(r?.image!==i){let r={w:i.data.width+2,h:i.data.height+2,x:0,y:0};this._entries[t]={bin:r,position:new P.P(r,i),image:i}}else{if(r.position.version===i.version)return r.position;r.position.version=i.version}return this._update(),this._entries[t].position}bind(t){let i=t.gl;this._texture?this._dirty&&=(this._texture.update(this._image),!1):(this._texture=new P.xt(t,this._image,i.RGBA),this._dirty=!1),this._texture.bind(i.LINEAR,i.CLAMP_TO_EDGE)}_update(){for(let t in this._entries)this._imageManager.getImage(t)||delete this._entries[t];let t=[];for(let i in this._entries)t.push(this._entries[i].bin);let{w:i,h:r}=(0,P.F)(t),a=this._image;for(let t in a.resize({width:i||1,height:r||1}),this._entries){let{bin:i}=this._entries[t],r=i.x+1,o=i.y+1,s=this._entries[t].image.data,n=s.width,l=s.height;P.Dt.copy(s,a,{x:0,y:0},{x:r,y:o},{width:n,height:l}),P.Dt.copy(s,a,{x:0,y:l-1},{x:r,y:o-1},{width:n,height:1}),P.Dt.copy(s,a,{x:0,y:0},{x:r,y:o+l},{width:n,height:1}),P.Dt.copy(s,a,{x:n-1,y:0},{x:r-1,y:o},{width:1,height:l}),P.Dt.copy(s,a,{x:0,y:0},{x:r+n,y:o},{width:1,height:l})}this._dirty=!0}};let ec={start:0,end:1114111},eu=0;function ed(t,i){return t>i||t>1114111?null:{start:t,end:Math.min(i,1114111)}}var e_=class{constructor(t){this.requestManager=t,this._faces={},this._registered=new Set}setFontFaces(t){for(let[i,r]of(this._unregisterAll(),this._faces={},Object.entries(t??{}))){let t=Array.isArray(r)?r:[r];this._faces[i]=t.map(t=>this._declareFontFace(i,t)).filter(t=>null!==t)}}hasFontFaces(){return Object.keys(this._faces).length>0}async getFontFamily(t,i){for(let r of t.split(","))for(let t of this._faces[r.trim()]??[])if(function(t,i){return t.ranges.some(({start:t,end:r})=>i>=t&&i<=r)}(t,i)&&(t.loaded??=this._loadFontFace(t),await t.loaded))return t.family;return null}_declareFontFace(t,i){let r="string"==typeof i?{url:i}:i;if("string"!=typeof r?.url)return(0,P.Nr)(`Ignoring the font face declared for "${t}": it has no URL.`),null;let a=`maplibre-gl-font-face-${eu++}`,o=r["unicode-range"];if(!o?.length)return{url:r.url,ranges:[ec],family:a};let s=[];for(let t of o){let i=function(t){let i=/^u\+([0-9a-f]*)(\?+)$/i.exec(t);if(i){let[,t,r]=i;return t.length+r.length>6?null:ed(parseInt(`${t}${"0".repeat(r.length)}`,16),parseInt(`${t}${"f".repeat(r.length)}`,16))}let r=/^u\+([0-9a-f]{1,6})(?:-([0-9a-f]{1,6}))?$/i.exec(t);if(!r)return null;let a=parseInt(r[1],16);return ed(a,void 0===r[2]?a:parseInt(r[2],16))}(t);if(!i){(0,P.Nr)(`Ignoring the unicode range "${t}" of the font face at ${r.url}: it is not a valid range.`);continue}s.push(i)}return s.length?{url:r.url,ranges:s,family:a}:null}async _loadFontFace(t){let i;if(typeof FontFace>"u"||typeof document>"u"||!document.fonts)return(0,P.Nr)(`Ignoring the font face at ${t.url}: this environment has no CSS Font Loading API.`),!1;try{return i=new FontFace(t.family,await this._downloadFontFile(t.url)),!!Object.values(this._faces).some(i=>i.includes(t))&&(document.fonts.add(i),this._registered.add(i),await i.load(),!0)}catch(r){return i&&this._unregister(i),(0,P.Nr)(`Ignoring the font face at ${t.url}: ${(0,P.Qn)(r).message}`),!1}}async _downloadFontFile(t){let i=await this.requestManager.transformRequest(t,"Glyphs"),r=await (0,P.xn)(i,new AbortController);if(!r?.data)throw Error(`the response was empty for the font file at ${t}`);return r.data}_unregister(t){document.fonts?.delete(t),this._registered.delete(t)}_unregisterAll(){for(let t of this._registered)document.fonts?.delete(t);this._registered.clear()}destroy(){this._unregisterAll(),this._faces={}}};let ep=new Float64Array(256);for(let t=0;t<256;t++){let i=.5-(t/255)**(1/2.2);ep[t]=i*Math.abs(i)}ep[255]=-1e20;var em=class{constructor({fontSize:t=24,buffer:i=3,radius:r=8,cutoff:a=.25,fontFamily:o="sans-serif",fontWeight:s="normal",fontStyle:n="normal",lang:l=null}={}){this.buffer=i,this.radius=r,this.cutoff=a,this.lang=l;let h=this.size=t+4*i,c=this._createCanvas(h),u=this.ctx=c.getContext("2d",{willReadFrequently:!0});u.font=`${n} ${s} ${t}px ${o}`,u.textBaseline="alphabetic",u.textAlign="left",u.fillStyle="black",this.gridOuter=new Float64Array(h*h),this.gridInner=new Float64Array(h*h),this.f=new Float64Array(h),this.z=new Float64Array(h+1),this.v=new Uint16Array(h)}_createCanvas(t){if("u">typeof OffscreenCanvas)return new OffscreenCanvas(t,t);let i=document.createElement("canvas");return i.width=i.height=t,i}draw(t){let{width:i,actualBoundingBoxAscent:r,actualBoundingBoxDescent:a,actualBoundingBoxLeft:o,actualBoundingBoxRight:s}=this.ctx.measureText(t),n=Math.ceil(r),l=Math.floor(-o),h=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(s)-l)),c=Math.max(0,Math.min(this.size-this.buffer,n+Math.ceil(a))),u=h+2*this.buffer,d=c+2*this.buffer,_=Math.max(u*d,0),p=new Uint8ClampedArray(_),m={data:p,width:u,height:d,glyphWidth:h,glyphHeight:c,glyphTop:n,glyphLeft:l,glyphAdvance:i};if(0===h||0===c)return m;let{ctx:f,buffer:g,gridInner:v,gridOuter:y}=this;this.lang&&(f.lang=this.lang),f.clearRect(g,g,h,c),f.fillText(t,g-l,g+n);let x=f.getImageData(g,g,h,c);y.fill(1e20,0,_),v.fill(0,0,_);let b=3;for(let t=0;t<c;t++){let i=(t+g)*u+g;for(let t=0;t<h;t++,b+=4,i++){let t=x.data[b];if(0===t)continue;let r=ep[t];y[i]=Math.max(0,r),v[i]=Math.max(0,-r)}}ef(y,0,0,u,d,u,this.f,this.v,this.z);let w=Math.min(g,1);ef(v,g-w,g-w,h+2*w,c+2*w,u,this.f,this.v,this.z);let T=255/this.radius,P=255*(1-this.cutoff);for(let t=0;t<_;t++){let i=Math.sqrt(y[t])-Math.sqrt(v[t]);p[t]=Math.round(P-T*i)}return m}};function ef(t,i,r,a,o,s,n,l,h){for(let c=i;c<i+a;c++)eg(t,r*s+c,s,o,n,l,h);for(let c=r;c<r+o;c++)eg(t,c*s+i,1,a,n,l,h)}function eg(t,i,r,a,o,s,n){s[0]=0,n[0]=-1e20,n[1]=1e20,o[0]=t[i];for(let l=1,h=0,c=0;l<a;l++){o[l]=t[i+l*r];let a=l*l;do{let t=s[h];c=(o[l]-o[t]+a-t*t)/(l-t)/2}while(c<=n[h]&&--h>-1);s[++h]=l,n[h]=c,n[h+1]=1e20}for(let l=0,h=0;l<a;l++){for(;n[h+1]<l;)h++;let a=s[h],c=l-a;t[i+l*r]=o[a]+c*c}}let ev=P.hn.layout_symbol["text-font"].default.join(","),ey=(t,i)=>{let r=new em(t);return r.buffer=i,r};var ex=class{constructor(t,i,r,a=ey){this.requestManager=t,this.localIdeographFontFamily=i,this.entries={},this.lang=r,this.fontFaceManager=new e_(t),this.createRasterizer=a}setURL(t){this.url=t}setFontFaces(t){this.fontFaceManager.setFontFaces(t),this.entries={}}async getGlyphs(t){let i=[];for(let r in t)for(let a of t[r])i.push(this._getAndCacheGlyphsPromise(r,a));let r=await Promise.all(i),a={};for(let{stack:t,id:i,glyph:o}of r)a[t]||={},a[t][i]=o&&{id:o.id,bitmap:o.bitmap.clone(),metrics:o.metrics};return a}
1async _getAndCacheGlyphsPromise(t,i){this.entries[t]??={glyphs:{},requests:{},ranges:{}};let r=this.entries[t],a=r.glyphs[i];if(void 0!==a)return{stack:t,id:i,glyph:a};let o=i.codePointAt(0),s=this.fontFaceManager.hasFontFaces()?await this.fontFaceManager.getFontFamily(t,o):null;return s?(a=r.glyphs[i]=await this._drawGlyph(r,t,i,s),{stack:t,id:i,glyph:a}):!this.url||(0,P.B)(i)||this._charUsesLocalIdeographFontFamily(o)?(a=r.glyphs[i]=await this._drawGlyph(r,t,i),{stack:t,id:i,glyph:a}):await this._downloadAndCacheRangePromise(t,i)}async _downloadAndCacheRangePromise(t,i){let r=i.codePointAt(0),a=this.entries[t],o=Math.floor(r/256);if(a.ranges[o])return{stack:t,id:i,glyph:null};a.requests[o]||=this._loadGlyphRange(t,o);try{let s=await a.requests[o];for(let t in s)a.glyphs[String.fromCodePoint(+t)]=s[+t];return a.ranges[o]=!0,{stack:t,id:i,glyph:s[r]||null}}catch(n){let s=a.glyphs[i]=await this._drawGlyph(a,t,i);return this._warnOnMissingGlyphRange(s,o,r,(0,P.Qn)(n)),{stack:t,id:i,glyph:s}}}async _loadGlyphRange(t,i){let r=256*i,a=r+255,o=await this.requestManager.transformRequest(this.url.replace("{fontstack}",t).replace("{range}",`${r}-${a}`),"Glyphs"),s=await (0,P.xn)(o,new AbortController);if(!s?.data)throw Error(`Could not load glyph range. range: ${i}, ${r}-${a}`);let n={};for(let t of(0,P.R)(s.data))n[t.id]=t;return n}_warnOnMissingGlyphRange(t,i,r,a){let o=256*i,s=r.toString(16).padStart(4,"0").toUpperCase();(0,P.Nr)(`Unable to load glyph range ${i}, ${o}-${o+255}. Rendering codepoint U+${s} locally instead. ${a}`)}_charUsesLocalIdeographFontFamily(t){return!!this.localIdeographFontFamily&&(0,P.V)(t)}async _drawGlyph(t,i,r,a){let o=(await this._getTinySDF(t,i,r,a)).draw(r),s=/^\p{gc=Cf}+$/u.test(r);return{id:r.codePointAt(0),bitmap:new P.Et({width:o.width||60,height:o.height||60},o.data),metrics:{width:s?0:o.glyphWidth/2||24,height:o.glyphHeight/2||24,left:o.glyphLeft/2+.5||0,top:o.glyphTop/2-27.5||-8,advance:s?0:o.glyphAdvance/2||24,isDoubleResolution:!0}}}_getTinySDF(t,i,r,a){let o=(0,P.B)(r);if(a){let i=o?"clusterTinySDFs":"fontFaceTinySDFs";return t[i]??={},t[i][a]||=this._createTinySDF(a,!1,o?3:1),t[i][a]}let s=i===ev&&""!==this.localIdeographFontFamily&&this._charUsesLocalIdeographFontFamily(r.codePointAt(0)),n=s?this.localIdeographFontFamily:i;if(o)return t.clusterTinySDFs??={},t.clusterTinySDFs[n]||=this._createTinySDF(n,!0,3),t.clusterTinySDFs[n];let l=s?"ideographTinySDF":"tinySDF";return t[l]||=this._createTinySDF(n),t[l]}async _createTinySDF(t,i=!0,r=1){let a=t?t.split(","):[];a.push("sans-serif");let o=a.map(t=>/[-\w]+/.test(t)?t:`'${CSS.escape(t)}'`).join(","),s=i?this._fontWeight(a[0]):void 0,n=i?this._fontStyle(a[
10]):"normal";if("u">typeof document&&document.fonts?.load)try{await document.fonts.load(`${n} ${s||"normal"} 48px ${o}`)}catch(t){(0,P.Nr)(`Failed to load font "${o}": ${(0,P.Qn)(t).message}`)}return this.createRasterizer({fontSize:48,buffer:Math.max(6,Math.ceil(48*(r-1)/4)),radius:16,cutoff:.25,fontFamily:o,fontWeight:s,fontStyle:n,lang:this.lang},6)}_fontStyle(t){return/italic/i.test(t)?"italic":/oblique/i.test(t)?"oblique":"normal"}_fontWeight(t){let i;for(let[r,a]of Object.entries({thin:100,hairline:100,"extra light":200,"ultra light":200,light:300,normal:400,regular:400,medium:500,semibold:600,demibold:600,bold:700,"extra bold":800,"ultra bold":800,black:900,heavy:900,"extra black":950,"ultra black":950}))RegExp(`\\b${r}\\b`,"i").test(t)&&(i=`${a}`);return i}destroy(){for(let t in this.entries){let i=this.entries[t];i.tinySDF=null,i.ideographTinySDF=null,i.fontFaceTinySDFs={},i.glyphs={},i.requests={},i.ranges={}}this.entries={},this.fontFaceManager.destroy()}},eb=class extends P.vn{constructor(t,i){super(),this._transitionable=new P.$t(h||=new P.Qt({anchor:new P.Zt(P.hn.light.anchor,"anchor"),position:new P.Zt(P.hn.light.position,"position"),color:new P.Zt(P.hn.light.color,"color"),intensity:new P.Zt(P.hn.light.intensity,"intensity")}),"light",i),this.setLight(t),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}getCartesianPosition(){return(0,P.Or)(this.properties.get("position"))}setLight(t,i={}){this._validate(P.on.light,t,i)||this._transitionable.setValues(t)}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}applyGlobalStateChange(t,i,r){this._transitioning=this._transitionable.applyGlobalStateChange(t,i,this._transitioning,r)}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}_validate(t,i,r){return(0,P.an)(this,t,{value:i},r)}},ew=class extends P.vn{constructor(t,i){super(),this._transitionable=new P.$t(c||=new P.Qt({"sky-color":new P.Zt(P.hn.sky["sky-color"],"sky-color"),"horizon-color":new P.Zt(P.hn.sky["horizon-color"],"horizon-color"),"fog-color":new P.Zt(P.hn.sky["fog-color"],"fog-color"),"fog-ground-blend":new P.Zt(P.hn.sky["fog-ground-blend"],"fog-ground-blend"),"horizon-fog-blend":new P.Zt(P.hn.sky["horizon-fog-blend"],"horizon-fog-blend"),"sky-horizon-blend":new P.Zt(P.hn.sky["sky-horizon-blend"],"sky-horizon-blend"),"atmosphere-blend":new P.Zt(P.hn.sky["atmosphere-blend"],"atmosphere-blend")}),"sky",i),this.setSky(t),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new P.en(0))}setSky(t,i={}){return!this._validate(P.on.sky,t,i)&&(t||={"sky-color":"transparent","horizon-color":"transparent","fog-color":"transparent","fog-ground-blend":1,"atmosphere-blend":0},this._transitionable.setValues(t),!0)}getSky(){return this._transitionable.serialize()}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}applyGlobalStateChange(t,i,r){this._transitioning=this._transitionable.applyGlobalStateChange(t,i,this._transitioning,r)}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}_validate(t,i,r={}){return(0,P.an)(this,t,{value:i},r)}calculateFogBlendOpacity(t){return t<60?0:t<70?(t-60)/10:1}},eT=class{constructor(t,i){this.width=t,this.height=i,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(t,i){let r=t.join(",")+String(i);return this.dashEntry[r]||=this.addDash(t,i),this.dashEntry[r]}getDashRanges(t,i,r){let a=t.length%2==1,o=[],s=a?-t[t.length-1]*r:0,n=t[0]*r,l=!0;o.push({left:s,right:n,isDash:l,zeroLength:0===t[0]});let h=t[0];for(let i=1;i<t.length;i++){l=!l;let a=t[i];s=h*r,h+=a,n=h*r,o.push({left:s,right:n,isDash:l,zeroLength:0===a})}return o}addRoundDash(t,i,r){let a=i/2;for(let i=-r;i<=r;i++){let o=this.nextRow+r+i,s=this.width*o,n=0,l=t[0];for(let o=0;o<this.width;o++){o/l.right>1&&(l=t[++n]);let h=Math.min(Math.abs(o-l.left),Math.abs(o-l.right)),c,u=i/r*(a+1);if(l.isDash){let t=a-Math.abs(u);c=Math.sqrt(h*h+t*t)}else c=a-Math.sqrt(h*h+u*u);this.data[s+o]=Math.max(0,Math.min(255,c+128))}}}
1addRegularDash(t){for(let i=t.length-1;i>=0;--i){let r=t[i],a=t[i+1];r.zeroLength?t.splice(i,1):a?.isDash===r.isDash&&(a.left=r.left,t.splice(i,1))}let i=t[0],r=t[t.length-1];i.isDash===r.isDash&&(i.left=r.left-this.width,r.right=i.right+this.width);let a=this.width*this.nextRow,o=0,s=t[0];for(let i=0;i<this.width;i++){i/s.right>1&&(s=t[++o]);let r=Math.min(Math.abs(i-s.left),Math.abs(i-s.right)),n=s.isDash?r:-r;this.data[a+i]=Math.max(0,Math.min(255,n+128))}}addDash(t,i){let r=7*!!i,a=2*r+1;if(this.nextRow+a>this.height)return(0,P.Nr)("LineAtlas out of space"),null;let o=0;for(let i of t)o+=i;if(0!==o){let a=this.width/o,s=this.getDashRanges(t,this.width,a);i?this.addRoundDash(s,a,r):this.addRegularDash(s)}let s={y:this.nextRow+r,height:2*r,width:o};return this.nextRow+=a,this.dirty=!0,s}bind(t){let i=t.gl;this.texture?(i.bindTexture(i.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,i.texSubImage2D(i.TEXTURE_2D,0,0,0,this.width,this.height,i.ALPHA,i.UNSIGNED_BYTE,this.data))):(this.texture=i.createTexture(),i.bindTexture(i.TEXTURE_2D,this.texture),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.REPEAT),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.REPEAT),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.LINEAR),i.texImage2D(i.TEXTURE_2D,0,i.ALPHA,this.width,this.height,0,i.ALPHA,i.UNSIGNED_BYTE,this.data))}};function eP(t,i){if(i)try{return new Worker(t,{type:"module"})}catch(t){console.warn("Module worker not supported, falling back to classic worker",t)}return new Worker(t)}async function eM(t){let i=await fetch(t);if(!i.ok)throw Error(`Failed to fetch worker script (${i.status}): ${t}`);let r=new Blob([await i.text()],{type:"text/javascript"});return URL.createObjectURL(r)}async function eC(){let t=P.An.WORKER_URL||function(){let t="file:///codebuild/output/src1876391788/src/website/node_modules/maplibre-gl/dist/maplibre-gl.mjs";if(!/^https?:/.test(t))return"";let i=t.endsWith("-dev.mjs")?"maplibre-gl-worker-dev.mjs":"maplibre-gl-worker.mjs";return new URL(`./${i}`,t).href}(),i=!t?.endsWith(".cjs");if(!function(t){if(!t)return!1;let i=globalThis.location;if(!i)return!1;try{return new URL(t,i.href).origin!==i.origin}catch{return!1}}(t))return eP(t,i);if(i){let r,a=(r=new Blob([`import ${JSON.stringify(new URL(t,"file:///codebuild/output/src1876391788/src/website/node_modules/maplibre-gl/dist/maplibre-gl.mjs").href)}`],{type:"text/javascript"}),URL.createObjectURL(r));try{return eP(a,i)}finally{URL.revokeObjectURL(a)}}let r=await eM(t);try{return eP(r,i)}finally{URL.revokeObjectURL(r)}}var eI=class t{constructor(){this.active={},this.workersPromise=null}async acquire(i){if(this.active[i]=!0,!this.workersPromise){let i=[];for(;i.length<t.workerCount;)i.push(eC());this.workersPromise=Promise.all(i)}return(await this.workersPromise).slice()}release(t){if(delete this.active[t],0===this.numActive()&&this.workersPromise){let t=this.workersPromise;this.workersPromise=null,t.then(t=>{for(let i of t)i.terminate()})}}isPreloaded(){return!!this.active.maplibre_preloaded_worker_pool}numActive(){return Object.keys(this.active).length}};let eS=Math.floor(C.hardwareConcurrency/2);eI.workerCount=(0,P.ur)(globalThis)?Math.max(Math.min(eS,3),1):1;var eE=class extends P.vn{constructor(t,i){super(),this.workerPool=t,this.actors=[],this.currentActor=0,this.id=i,this.removed=!1,this.workerErrorSubscriptions=[],this.actorsPromise=this.initActors(i)}async initActors(t){let i=await this.workerPool.acquire(t);if(this.removed)return[];if(this.actors=i.map((i,r)=>{this.workerErrorSubscriptions.push((0,P.kr)(i,"error",()=>{this.fire(new P.gn(Error("Worker failed to load. Check that the worker URL is correct.")))},!1));let a=new P.g(i,t);return a.name=`Worker ${r}`,a}),!this.actors.length)throw Error("No actors found");return this.actors}async broadcast(t,i){return Promise.all((await this.actorsPromise).map(r=>r.sendAsync({type:t,data:i})))}async getActor(){let t=await this.actorsPromise;return this.currentActor=(this.currentActor+1)%t.length,t[this.currentActor]}async waitForInitComplete(){0===this.actors.length&&await this.actorsPromise}getReadyActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(t=!0){for(let t of(this.removed=!0,this.actors))t.remove();for(let t of this.workerErrorSubscriptions)t.unsubscribe();this.actors=[],this.workerErrorSubscriptions=[],this.setEventedParent(null),t&&this.workerPool.release(this.id
1)}async registerMessageHandler(t,i){for(let r of(await this.actorsPromise))r.registerMessageHandler(t,i)}async unregisterMessageHandler(t){for(let i of(await this.actorsPromise))i.unregisterMessageHandler(t)}};function ez(t,i){let r=t.tileID,a=i.tileID;return r.overscaledZ-a.overscaledZ||r.canonical.y-a.canonical.y||r.wrap-a.wrap||r.canonical.x-a.canonical.x}function eR(t,i){let r=t.feature,a=i.getFeatureState(r.layer["source-layer"],r.id);r.source=r.layer.source,r.layer["source-layer"]&&(r.sourceLayer=r.layer["source-layer"]),r.state=a}async function eD(t,i,r,a){let o=t;if(t.url?o=(await (0,P.Sn)(await i.transformRequest(t.url,"Source"),r)).data:await C.frameAsync(r,a),!o)return null;let s=(0,P.yr)((0,P.er)(o,t),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in o&&o.vector_layers&&(s.vectorLayerIds=o.vector_layers.map(t=>t.id)),s}var eL=class t{constructor(t,i){t&&(i?this.setSouthWest(t).setNorthEast(i):Array.isArray(t)&&(4===t.length?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1])))}setNorthEast(t){return this._ne=t instanceof P.lt?new P.lt(t.lng,t.lat):P.lt.convert(t),this}setSouthWest(t){return this._sw=t instanceof P.lt?new P.lt(t.lng,t.lat):P.lt.convert(t),this}extend(i){let r=this._sw,a=this._ne,o,s;if(i instanceof P.lt)o=i,s=i;else if(i instanceof t){if(o=i._sw,s=i._ne,!o||!s)return this}else return Array.isArray(i)?4===i.length||i.every(Array.isArray)?this.extend(t.convert(i)):this.extend(P.lt.convert(i)):i&&("lng"in i||"lon"in i)&&"lat"in i?this.extend(P.lt.convert(i)):this;return r||a?(r.lng=Math.min(o.lng,r.lng),r.lat=Math.min(o.lat,r.lat),a.lng=Math.max(s.lng,a.lng),a.lat=Math.max(s.lat,a.lat)):(this._sw=new P.lt(o.lng,o.lat),this._ne=new P.lt(s.lng,s.lat)),this}getCenter(){return new P.lt((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 P.lt(this.getWest(),this.getNorth())}getSouthEast(){return new P.lt(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(t){let{lng:i,lat:r}=P.lt.convert(t),a=this._sw.lat<=r&&r<=this._ne.lat,o=this._sw.lng<=i&&i<=this._ne.lng;return this._sw.lng>this._ne.lng&&(o=this._sw.lng>=i&&i>=this._ne.lng),a&&o}intersects(i){if(!((i=t.convert(i)).getNorth()>=this.getSouth()&&i.getSouth()<=this.getNorth()))return!1;let r=Math.abs(this.getEast()-this.getWest()),a=Math.abs(i.getEast()-i.getWest());if(r>=360||a>=360)return!0;let o=(0,P.Pr)(this.getWest(),-180,180),s=(0,P.Pr)(this.getEast(),-180,180),n=(0,P.Pr)(i.getWest(),-180,180),l=(0,P.Pr)(i.getEast(),-180,180),h=o>s,c=n>l;return!!h&&!!c||(h?l>=o||n<=s:c?s>=n||o<=l:n<=s&&l>=o)}static convert(i){return i instanceof t||!i?i:new t(i)}static fromLngLat(i,r=0){let a=360*r/0x2637f09,o=a/Math.cos(Math.PI/180*i.lat);return new t(new P.lt(i.lng-o,i.lat-a),new P.lt(i.lng+o,i.lat+a))}adjustAntiMeridian(){let i=new P.lt(this._sw.lng,this._sw.lat),r=new P.lt(this._ne.lng,this._ne.lat);return i.lng>r.lng?new t(i,new P.lt(r.lng+360,r.lat)):new t(i,r)}},eA=class{constructor(t,i,r){this.bounds=eL.convert(this.validateBounds(t)),this.minzoom=i||0,this.maxzoom=r||24}validateBounds(t){return Array.isArray(t)&&4===t.length?[Math.max(-180,t[0]),Math.max(-90,t[1]),Math.min(180,t[2]),Math.min(90,t[3])]:[-180,-90,180,90]}contains(t){let i=2**t.z,r={minX:Math.floor((0,P.ot)(this.bounds.getWest())*i),minY:Math.floor((0,P.st)(this.bounds.getNorth())*i),maxX:Math.ceil((0,P.ot)(this.bounds.getEast())*i),maxY:Math.ceil((0,P.st)(this.bounds.getSouth())*i)};return t.x>=r.minX&&t.x<r.maxX&&t.y>=r.minY&&t.y<r.maxY}},eF=class extends P.vn{constructor(t,i,r,a){if(super(),this.id=t,this.dispatcher=r,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,(0,P.er)(this,(0,P.yr)(i,["url","scheme","tileSize","promoteId","encoding"])),this._options=(0,P.er)({type:"vector"},i),this._collectResourceTiming=i.collectResourceTiming,512!==this.tileSize)throw Error("vector tile sources must have a tileSize of 512");this.setEventedParent(a)}async load(t=!1){this._loaded=!1,this.fire(new N("dataloading")),this._tileJSONRequest=new AbortController;try{let i=await eD(this._options,this.map._requestManager,this._tileJSONRequest,this.map._ownerWindow);this._tileJSONRequest=null,this._loaded=!0,i&&((0,P.er)(this,i),i.bounds&&(this.tileBounds=new eA(i.bounds,this.minzoom,this.maxzoom)),this.fire(new N("data",{sourceDataType:"metadata"})),this.fire(new N("data",{sourceDataType:"content",sourceDataChanged:t})))}catch(t){this._tileJSONRequest=null,this._loaded=!0,(0,P.Mn)(t)||this.fire(new P.gn((0,P.Qn)(t)))}}loaded(){return this._loaded}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}onAdd(t){this.map=t,this.load()}setSourceProperty(t){this._tileJSONRequest&&this._tileJSONRequest.abort(),t(),this.load(!0)}setTiles(t){return this.setSourceProperty(()=>{this.tiles=t,this._options.tiles=t}),this}setUrl(t){return this.setSourceProperty(()=>{this.url=t,this._options.url=t}),this}onRemove(){this._tileJSONRequest&&=(this._tileJSONRequest.abort(),null)}serialize(){return(0,P.er)({},this._options)}
vendor: 2,054 bytes, line 1
1async loadTile(t){let i=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),r={request:await this.map._requestManager.transformRequest(i,"Tile"),uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,tileSize:this.tileSize*t.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity,encoding:this.encoding,overzoomParameters:await this._getOverzoomParameters(t),etag:t.etag};if(r.request.collectResourceTiming=this._collectResourceTiming,await this.dispatcher.waitForInitComplete(),t.aborted)return;let a="RT";if(t.actor&&"expired"!==t.state){if("loading"===t.state)return new Promise((i,r)=>{t.reloadPromise={resolve:i,reject:r}})}else t.actor=this.dispatcher.getReadyActor(),a="LT";t.abortController=new AbortController;try{let i=await t.actor.sendAsync({type:a,data:r},t.abortController);if(delete t.abortController,t.aborted)return;this._afterTileLoadWorkerResponse(t,i);let o={};return i?.etagUnmodified&&(o.unmodified=!0),o}catch(i){if(delete t.abortController,t.aborted||(0,P.Mn)(i))return;if(i&&404!==i.status)throw i;this._afterTileLoadWorkerResponse(t,null)}}async _getOverzoomParameters(t){if(t.tileID.canonical.z<=this.maxzoom||void 0===this.map._zoomLevelsToOverscale)return;let i=t.tileID.scaledTo(this.maxzoom).canonical,r=i.url(this.tiles,this.map.getPixelRatio(),this.scheme);return{maxZoomTileID:i,overzoomRequest:await this.map._requestManager.transformRequest(r,"Tile")}}_afterTileLoadWorkerResponse(t,i){if(i?.resourceTiming&&(t.resourceTiming=i.resourceTiming),i&&this.map._refreshExpiredTiles&&t.setExpiryData(i),t.etag=i?.etag,t.loadVectorData(i,this.map.painter),t.reloadPromise){let i=t.reloadPromise;t.reloadPromise=null,this.loadTile(t).then(i.resolve).catch(i.reject)}}async abortTile(t){t.abortController&&(t.abortController.abort(),delete t.abortController),t.actor&&await t.actor.sendAsync({type:"AT",data:{uid:t.uid,type:this.t
1ype,source:this.id}})}async unloadTile(t){t.unloadVectorData(),t.actor&&await t.actor.sendAsync({type:"RMT",data:{uid:t.uid,type:this.type,source:this.id}})}hasTransition(){return!1}},ek=class extends P.vn{constructor(t,i,r,a){super(),this.id=t,this.dispatcher=r,this.setEventedParent(a),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._premultiplyAlpha=!0,this._options=(0,P.er)({type:"raster"},i),(0,P.er)(this,(0,P.yr)(i,["url","scheme","tileSize"]))}async load(t=!1){this._loaded=!1,this.fire(new N("dataloading")),this._tileJSONRequest=new AbortController;try{let i=await eD(this._options,this.map._requestManager,this._tileJSONRequest,this.map._ownerWindow);this._tileJSONRequest=null,this._loaded=!0,i&&((0,P.er)(this,i),i.bounds&&(this.tileBounds=new eA(i.bounds,this.minzoom,this.maxzoom)),this.fire(new N("data",{sourceDataType:"metadata"})),this.fire(new N("data",{sourceDataType:"content",sourceDataChanged:t})))}catch(t){this._tileJSONRequest=null,this._loaded=!0,(0,P.Mn)(t)||this.fire(new P.gn((0,P.Qn)(t)))}}loaded(){return this._loaded}onAdd(t){this.map=t,this.load()}onRemove(){this._tileJSONRequest&&=(this._tileJSONRequest.abort(),null)}setSourceProperty(t){this._tileJSONRequest&&=(this._tileJSONRequest.abort(),null),t(),this.load(!0)}setTiles(t){return this.setSourceProperty(()=>{this.tiles=t,this._options.tiles=t}),this}setUrl(t){return this.setSourceProperty(()=>{this.url=t,this._options.url=t}),this}serialize(){return(0,P.er)({},this._options)}setPremultiplyAlpha(t){return this._premultiplyAlpha===t||this.setSourceProperty(()=>{this._premultiplyAlpha=t}),this}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}async loadTile(t){let i=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),r=this._premultiplyAlpha,a=r?void 0:{premultiplyAlpha:"none"};t.abortController=new AbortController;try{let o=await l.transformAndGetImage(this.map._requestManager,i,"Tile",t.abortController,this.map._refreshExpiredTiles,a);if(delete t.abortController,t.aborted){t.state="unloaded";return}if(o){this.map._refreshExpiredTiles&&(o.cacheControl||o.expires)&&t.setExpiryData({cacheControl:o.cacheControl,expires:o.expires});let i=this.map.painter.context,a=i.gl,s=o.data??new P.Dt({width:1,height:1},new Uint8Array(4));t.texture=this.map.painter.getTileTexture(s.width),t.texture?t.texture.update(s,{useMipmap:!0,premultiply:r}):(t.texture=new P.xt(i,s,a.RGBA,{useMipmap:!0,premultiply:r}),t.texture.bind(a.LINEAR,a.CLAMP_TO_EDGE,a.LINEAR_MIPMAP_NEAREST)),t.state="loaded"}}catch(i){if(delete t.abortController,t.aborted)t.state="unloaded";else if(i)throw t.state="errored",i}}async abortTile(t){t.abortController&&(t.abortController.abort(),delete t.abortController)}async unloadTile(t){t.texture&&this.map.painter.saveTileTexture(t.texture)}hasTransition(){return!1}},eB=class extends ek{constructor(t,i,r,a){super(t,i,r,a),this.type="raster-dem",this.maxzoom=22,this._options=(0,P.er)({type:"raster-dem"},i),this.encoding=i.encoding||"mapbox",this.redFactor=i.redFactor,this.greenFactor=i.greenFactor,this.blueFactor=i.blueFactor,this.baseShift=i.baseShift}async loadTile(t){let i=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);t.neighboringTiles=this._getNeighboringTiles(t.tileID),t.abortController=new AbortController;try{let r=await l.transformAndGetImage(this.map._requestManager,i,"Tile",t.abortController,this.map._refreshExpiredTiles,{colorSpaceConversion:"none"});if(delete t.abortController,t.aborted){t.state="unloaded";return}if(r){if(this.map._refreshExpiredTiles&&(r.cacheControl||r.expires)&&t.setExpiryData({cacheControl:r.cacheControl,expires:r.expires}),!r.data){t.state="loaded";return}let i=r.data,a=(0,P.cr)(i)&&(0,P.Ii)()?i:await this.readImageNow(i),o={type:this.type,uid:t.uid,source:this.id,rawImageData:a,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(t.actor&&"expired"!==t.state&&"reloading"!==t.state)return;await this.dispatcher.waitForInitComplete(),t.actor&&"expired"!==t.state||(t.actor=this.dispatcher.getReadyActor()),t.dem=await t.actor.sendAsync({type:"LDT",data:o}
1),t.needsHillshadePrepare=!0,t.needsTerrainPrepare=!0,t.needsColorReliefPrepare=!0,t.state="loaded"}}catch(i){if(delete t.abortController,t.aborted)t.state="unloaded";else if(i)throw t.state="errored",i}}async readImageNow(t){if("u">typeof VideoFrame&&(0,P.Fi)()){let i=t.width+4,r=t.height+4;try{return new P.Dt({width:i,height:r},await (0,P.Cr)(t,-2,-2,i,r))}catch{}}return C.getImageData(t,2)}_getNeighboringTiles(t){let i=t.canonical,r=2**i.z,a=(i.x-1+r)%r,o=0===i.x?t.wrap-1:t.wrap,s=(i.x+1+r)%r,n=i.x+1===r?t.wrap+1:t.wrap,l={};return l[new P.d(t.overscaledZ,o,i.z,a,i.y).key]={backfilled:!1},l[new P.d(t.overscaledZ,n,i.z,s,i.y).key]={backfilled:!1},i.y>0&&(l[new P.d(t.overscaledZ,o,i.z,a,i.y-1).key]={backfilled:!1},l[new P.d(t.overscaledZ,t.wrap,i.z,i.x,i.y-1).key]={backfilled:!1},l[new P.d(t.overscaledZ,n,i.z,s,i.y-1).key]={backfilled:!1}),i.y+1<r&&(l[new P.d(t.overscaledZ,o,i.z,a,i.y+1).key]={backfilled:!1},l[new P.d(t.overscaledZ,t.wrap,i.z,i.x,i.y+1).key]={backfilled:!1},l[new P.d(t.overscaledZ,n,i.z,s,i.y+1).key]={backfilled:!1}),l}async unloadTile(t){t.demTexture&&this.map.painter.saveTileTexture(t.demTexture),t.fbo&&(t.fbo.destroy(),delete t.fbo),t.dem&&delete t.dem,delete t.neighboringTiles,t.state="unloaded",t.actor&&await t.actor.sendAsync({type:"RDT",data:{type:this.type,uid:t.uid,source:this.id}})}};function eO(t,i){return i?t.properties[i]:t.id}function ej(t,i){if(!t)return{};let r={};return r.removeAll=t.removeAll,r.remove=new Set(t.remove||[]),r.add=new Map(t.add?.map(t=>[eO(t,i),t])),r.update=new Map(t.update?.map(t=>[t.id,t])),r}function eN(t){return"GeometryCollection"===t.type?t.geometries.flatMap(t=>eN(t)):function t(i){return i&&0!==i.length?"number"==typeof i[0]?[i]:i.flatMap(i=>t(i)):[]}(t.coordinates)}function eZ(t){let i=new eL,r;switch(t.type){case"FeatureCollection":r=t.features.flatMap(t=>eN(t.geometry));break;case"Feature":r=eN(t.geometry);break;default:r=eN(t)}if(0===r.length)return i;for(let t of r){let[r,a]=t;i.extend([r,a])}return i}var eU=class extends P.vn{constructor(t,i,r,a){super(),this.id=t,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._isUpdatingWorker=!1,this._pendingWorkerUpdate={data:i.data},this.actorPromise=r.getActor(),this.setEventedParent(a),this._data="string"==typeof i.data?{url:i.data}:{geojson:i.data},this._options=(0,P.er)({},i),this._collectResourceTiming=i.collectResourceTiming,void 0!==i.maxzoom&&(this.maxzoom=i.maxzoom),i.type&&(this.type=i.type),i.attribution&&(this.attribution=i.attribution),this.promoteId=i.promoteId,void 0!==i.clusterMaxZoom&&this.maxzoom<=i.clusterMaxZoom&&(0,P.Nr)(`The maxzoom value "${this.maxzoom}" is expected to be greater than the clusterMaxZoom value "${i.clusterMaxZoom}".`),this.workerOptions=(0,P.er)({source:this.id,geojsonVtOptions:{buffer:this._pixelsToTileUnits(void 0===i.buffer?128:i.buffer),tolerance:this._pixelsToTileUnits(void 0===i.tolerance?.375:i.tolerance),extent:P.Lr,maxZoom:this.maxzoom,lineMetrics:i.lineMetrics||!1,generateId:i.generateId||!1,promoteId:this._promoteIdKey,cluster:i.cluster||!1,clusterOptions:{maxZoom:this._getClusterMaxZoom(i.clusterMaxZoom),minPoints:Math.max(2,i.clusterMinPoints||2),extent:P.Lr,radius:this._pixelsToTileUnits(i.clusterRadius||50),log:!1,generateId:i.generateId||!1}},clusterProperties:i.clusterProperties,filter:i.filter},i.workerOptions)}get _promoteIdKey(){return"string"==typeof this.promoteId?this.promoteId:void 0}_hasPendingWorkerUpdate(){return void 0!==this._pendingWorkerUpdate.data||void 0!==this._pendingWorkerUpdate.diff||this._pendingWorkerUpdate.updateCluster}_pixelsToTileUnits(t){return t*(P.Lr/this.tileSize)}_tileUnitsToPixels(t){return t/(P.Lr/this.tileSize)}_getClusterMaxZoom(t){let i=t?Math.round(t):this.maxzoom-1;return Number.isInteger(t)||void 0===t||(0,P.Nr)(`Integer expected for option 'clusterMaxZoom': provided value "${t}" rounded to "${i}"`),i}async load(){await this._updateWorkerData()}onAdd(t){this.map=t,this.load()}setData(t){return this._data="string"==typeof t?{url:t}:{geojson:t},this._pendingWorkerUpdate={data:t},this._updateWorkerData()}updateData(t){return this._pendingWorkerUpdate.diff=function(t,i,r){let a;if(!t)return i||{};if(!i)return t||{};let o=ej(t,r),s=ej(i,r);var n,l=o,h=s;for(let t of(h.removeAll&&(l.add.clear(),l.update.clear(),l.remove.clear(),h.remove.clear()),h.remove))l.add.delete(t),l.update.delete(t);for(let[t,i]of h.update){let r=l.update.get(t);r&&(h.update.set(t,function(t,i){let r={id:t.id};if(i.removeAllProperties&&(delete t.removeProperties,delete t.addOrUpdateProperties,delete i.removeProperties),i.removeProperties&&t.addOrUpdateProperties){let r=new Set(i.removeProperties);t.addOrUpdateProperties=t.addOrUpdateProperties.filter(t=>!r.has(t.key))}return(t.removeAllProperties||i.removeAllProperties)&&(r.removeAllProperties=!0),(t.removeProperties||i.removeProperties)&&(r.removeProperties=[...t.removeProperties||[],...i.removeProperties||[]]),(t.addOrUpdateProperties||i.addOrUpdateProperties)&&(r.addOrUpdateProperties=[...t.addOrUpdateProperties||[],...i.addOrUpdateProperties||[]]),(t.newGeometry||i.newGeometry)&&(r.newGeometry=i.newGeometry||t.newGeometry),r}(r,i)),l.update.delete(t))}let c={};
vendor: 4,836 bytes, line 1
1if((o.removeAll||s.removeAll)&&(c.removeAll=!0),c.remove=new Set([...o.remove,...s.remove]),c.add=new Map([...o.add,...s.add]),c.update=new Map([...o.update,...s.update]),c.remove.size&&c.add.size)for(let t of c.add.keys())c.remove.delete(t);return a={},(n=c).removeAll&&(a.removeAll=n.removeAll),n.remove&&(a.remove=Array.from(n.remove)),n.add&&(a.add=Array.from(n.add.values())),n.update&&(a.update=Array.from(n.update.values())),a}(this._pendingWorkerUpdate.diff,t,this._promoteIdKey),this._updateWorkerData()}async getData(){return this._data.url&&await this.once("data"),this._data.geojson?this._data.geojson:{type:"FeatureCollection",features:Array.from(this._data.updateable.values())}}async getBounds(){return eZ(await this.getData())}setClusterOptions(t){return this.workerOptions.geojsonVtOptions.cluster=t.cluster,void 0!==t.clusterRadius&&(this.workerOptions.geojsonVtOptions.clusterOptions.radius=this._pixelsToTileUnits(t.clusterRadius)),void 0!==t.clusterMaxZoom&&(this.workerOptions.geojsonVtOptions.clusterOptions.maxZoom=this._getClusterMaxZoom(t.clusterMaxZoom)),this._pendingWorkerUpdate.updateCluster=!0,this._updateWorkerData()}getClusterOptions(){let{cluster:t,clusterOptions:i}=this.workerOptions.geojsonVtOptions;return{cluster:t,clusterMaxZoom:i.maxZoom,clusterRadius:this._tileUnitsToPixels(i.radius)}}async getClusterExpansionZoom(t){return(await this.actorPromise).sendAsync({type:"GCEZ",data:{type:this.type,clusterId:t,source:this.id}})}async getClusterChildren(t){return(await this.actorPromise).sendAsync({type:"GCC",data:{type:this.type,clusterId:t,source:this.id}})}async getClusterLeaves(t,i,r){return(await this.actorPromise).sendAsync({type:"GCL",data:{type:this.type,source:this.id,clusterId:t,limit:i,offset:r}})}async _updateWorkerData(){if(this._isUpdatingWorker)return this._updatePromise;if(!this._hasPendingWorkerUpdate())return void(0,P.Nr)(`No pending worker updates for GeoJSONSource ${this.id}.`);let{data:t,diff:i,updateCluster:r}=this._pendingWorkerUpdate,a=this._getLoadGeoJSONParameters(t,i,r);void 0===t?i?this._pendingWorkerUpdate.diff=void 0:r&&(this._pendingWorkerUpdate.updateCluster=void 0):this._pendingWorkerUpdate.data=void 0,this._updatePromise=this._dispatchWorkerUpdate(a),await this._updatePromise}async _getLoadGeoJSONParameters(t,i,r){let a=(0,P.er)({type:this.type,source:this.id},this.workerOptions);return"string"==typeof t?(a.request=await this.map._requestManager.transformRequest(C.resolveURL(t),"Source"),a.request.collectResourceTiming=this._collectResourceTiming,a):void 0!==t?(a.data=t,a):i?(a.dataDiff=i,a):r?(a.updateCluster=!0,a):void 0}async _dispatchWorkerUpdate(t){this._isUpdatingWorker=!0,this.fire(new N("dataloading"));try{let i=await t,r=await (await this.actorPromise).sendAsync({type:"LD",data:i});if(this._isUpdatingWorker=!1,this._removed||r.abandoned)return void this.fire(new N("dataabort"));r.data&&(this._data={geojson:r.data});let a=this._applyDiffToSource(i.dataDiff),o=this._getShouldReloadTileOptions(a),s={};this._applyResourceTiming(s,r),this.fire(new N("data",{...s,sourceDataType:"metadata"})),this.fire(new N("data",{...s,sourceDataType:"content",shouldReloadTileOptions:o}))}catch(t){if(this._isUpdatingWorker=!1,this._removed)return void this.fire(new N("dataabort"));this.fire(new P.gn((0,P.Qn)(t)))}finally{this._hasPendingWorkerUpdate()&&await this._updateWorkerData()}}_applyResourceTiming(t,i){if(!this._collectResourceTiming)return;let r=i.resourceTiming?.[this.id];if(!r)return;let a=r.slice(0);a?.length&&(0,P.er)(t,{resourceTiming:a})}_applyDiffToSource(t){if(!t)return;let i=this._promoteIdKey;if(!this._data.url&&!this._data.updateable){let t=function(t,i){let r=new Map;if(null==t||null==t.type)return r;if("Feature"===t.type){let a=eO(t,i);return null==a?void 0:(r.set(a,t),r)}if("FeatureCollection"===t.type){let a=new Set;for(let o of t.features){let t=eO(o,i);if(null==t||a.has(t))return;a.add(t),r.set(t,o)}return r}}(this._data.geojson,i);if(!t)throw Error(`GeoJSONSource "${this.id}": GeoJSON data is not compatible with updateData`);this._data={updateable:t}}if(!this._data.updateable)return;let r=function(t,i,r){let a=[];if(i.removeAll)t.clear();else if(i.remove)for(let r of i.remove){let i=t.get(r);i&&(a.push(i.geometry),t.delete(r))}if(i.add)for(let o of i.add){let i=eO(o,r);if(null==i)continue;let s=t.get(i);s&&a.push(s.geometry),a.push(o.geometry),t.set(i,o)}if(i.update)for(let r of i.update){let i=t.get(r.id);if(!i)continue;let o=!!r.newGeometry,s=r.removeAllProperties||r.removeProperties?.length>0||r.addOrUpdateProperties?.length>0;if(!o&&!s)continue;a.push(i.geometry);let n={...i};if(t.set(r.id,n),o&&(a.push(r.newGeometry),n.geometry=r.newGeometry),s){if(n.properties=r.removeAllProperties?{}:{...n.properties||{}},r.removeProperties)for(let t of r.removeProperties)delete n.properties[t];
1if(r.addOrUpdateProperties)for(let{key:t,value:i}of r.addOrUpdateProperties)n.properties[t]=i}}return a}(this._data.updateable,t,i);if(!(t.removeAll||this._options.cluster))return r}_getShouldReloadTileOptions(t){if(t)return{affectedBounds:t.filter(Boolean).map(t=>eZ(t))}}shouldReloadTile(t,{affectedBounds:i}){if("loading"===t.state)return!0;if("unloaded"===t.state)return!1;let{buffer:r,extent:a}=this.workerOptions.geojsonVtOptions,o=function({x:t,y:i,z:r},a=0){return new eL([(0,P.at)((t-a)/2**r),(0,P.it)((i+1+a)/2**r)],[(0,P.at)((t+1+a)/2**r),(0,P.it)((i-a)/2**r)])}(t.tileID.canonical,r/a);for(let t of i)if(o.intersects(t))return!0;return!1}loaded(){return!this._isUpdatingWorker&&!this._hasPendingWorkerUpdate()}async loadTile(t){let i=t.actor?"RT":"LT";t.actor=await this.actorPromise;let r={type:this.type,uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity};t.abortController=new AbortController;try{let a=await (await this.actorPromise).sendAsync({type:i,data:r},t.abortController);delete t.abortController,t.unloadVectorData(),t.aborted||t.loadVectorData(a,this.map.painter,"RT"===i)}catch(i){if(delete t.abortController,t.aborted||(0,P.Mn)(i))return;throw i}}async abortTile(t){t.abortController&&(t.abortController.abort(),delete t.abortController),t.aborted=!0}async unloadTile(t){t.unloadVectorData(),await (await this.actorPromise).sendAsync({type:"RMT",data:{uid:t.uid,type:this.t
1ype,source:this.id}})}onRemove(){this._removed=!0,this.actorPromise.then(t=>t.sendAsync({type:"RS",data:{type:this.type,source:this.id}}))}serialize(){return(0,P.er)({},this._options,{type:this.type,data:this._data.updateable?{type:"FeatureCollection",features:Array.from(this._data.updateable.values())}:this._data.url||this._data.geojson})}hasTransition(){return!1}};let eG=[0,0,1],eV=(t,i,r,a,o,s)=>{var n,l,h;let c,u;return{u_tl_parent:t,u_scale_parent:i,u_buffer_scale:1,u_image_warp:s,u_fade_t:r.mix,u_opacity:r.opacity*a.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:a.paint.get("raster-brightness-min"),u_brightness_high:a.paint.get("raster-brightness-max"),u_saturation_factor:(n=a.paint.get("raster-saturation"))>0?1-1/(1.001-n):-n,u_contrast_factor:(l=a.paint.get("raster-contrast"))>0?1/(1-l):1+l,u_spin_weights:(c=Math.sin(h=a.paint.get("raster-hue-rotate")*(Math.PI/180)),[(2*(u=Math.cos(h))+1)/3,(-Math.sqrt(3)*c-u+1)/3,(Math.sqrt(3)*c-u+1)/3]),u_coords_top:[o[0].x,o[0].y,o[1].x,o[1].y],u_coords_bottom:[o[3].x,o[3].y,o[2].x,o[2].y]}};var eq=class{constructor(t,i,r){this.vertexBuffer=t,this.indexBuffer=i,this.segments=r}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}};let eW=(0,P.Yt)([{name:"a_pos",type:"Int16",components:2}]),e$=P.Lr/128;function eH(t,i){let r=function(t,i){let r=void 0===t.granularity?1:Math.max(t.granularity,1),a=r+2*!!t.generateBorders,o=r+(t.extendToNorthPole||t.generateBorders?1:0)+(t.extendToSouthPole||t.generateBorders?1:0),s=a+1,n=o+1,l=t.generateBorders?-1:0,h=t.generateBorders||t.extendToNorthPole?-1:0,c=r+ +!!t.generateBorders,u=r+(t.generateBorders||t.extendToSouthPole?1:0),d=a*o*6,_=s*n>65536;if(_&&"16bit"===i)throw Error("Granularity is too large and meshes would not fit inside 16 bit vertex indices.");let p=_||"32bit"===i,m=new Int16Array(s*n*2),f=0;for(let i=h;i<=u;i++)for(let a=l;a<=c;a++){let o=a/r*P.Lr;-1===a&&(o=-e$),a===r+1&&(o=P.Lr+e$);let s=i/r*P.Lr;-1===i&&(s=t.extendToNorthPole?P.ht:-e$),i===r+1&&(s=t.extendToSouthPole?P.gt:P.Lr+e$),m[f++]=o,m[f++]=s}let g=p?new Uint32Array(d):new Uint16Array(d),v=0;for(let t=0;t<o;t++)for(let i=0;i<a;i++){let r=i+t*s,a=i+1+t*s,o=i+(t+1)*s,n=i+1+(t+1)*s;g[v++]=r,g[v++]=o,g[v++]=a,g[v++]=a,g[v++]=o,g[v++]=n}return{vertices:m.buffer.slice(0),indices:g.buffer.slice(0),uses32bitIndices:p}}(i,"16bit"),a=P.Gt.deserialize({arrayBuffer:r.vertices,length:r.vertices.byteLength/2/2}),o=P.Jt.deserialize({arrayBuffer:r.indices,length:r.indices.byteLength/2/3});return new eq(t.createVertexBuffer(a,eW.members),t.createIndexBuffer(o),P.Bt.simpleSegment(0,0,a.length,o.length))}var eX=class extends P.vn{constructor(t,i,r,a){super(),this.imageWarp=eG,this.flippedWindingOrder=!1,this._warp="auto",this._imageDirty=!1,this._subdividedQuad=!1,this._subdividedMesh=null,this.id=t,this.dispatcher=r,this.coordinates=i.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(a),this.options=i}async load(t){if(void 0===this.options.url){this._loaded=!0,this._finishLoading();return}this._loaded=!1,this.fire(new N("dataloading")),this.url=this.options.url,this._abortController=new AbortController;try{let i=await l.transformAndGetImage(this.map._requestManager,this.url,"Image",this._abortController);this._abortController=null,this._loaded=!0,i?.data?(this._setImage(i.data),t&&(this.coordinates=t),this._finishLoading()):this.fire(new P.gn(Error(`Could not load image ${this.url}: the response is empty`)))}catch(t){if((0,P.Mn)(t))return;this._abortController=null,this._loaded=!0,this.fire(new P.gn((0,P.Qn)(t)))}}loaded(){return this._loaded}updateImage(t){return this._abortController&&=(this._abortController.abort(),null),"image"in t?(this._loaded=!0,this._setImage(t.image),t.coordinates&&(this.coordinates=t.coordinates),this._finishLoading()):t.url&&(this.options.url=t.url,this.load(t.coordinates)),this}_setImage(t){this.image=t,this._imageDirty=!0}getMesh(t,i){return!this._subdividedQuad||i?null:(this._subdividedMesh??=eH(t,{granularity:16}),this._subdividedMesh)}_disposeTexture(){this.texture?.destroy(),this.texture=null}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new N("data",{sourceDataType:"metadata"})))}onAdd(t){this.map=t,this.load()}onRemove(){this._abortController&&=(this._abortController.abort(),null),this._disposeTexture(),this._subdividedMesh?.destroy(),this._subdividedMesh=null,this.image=null,this.tiles={}}setWarp(t){return this._warp===t||(this._warp=t,this.tileCoords&&this.setCoordinates(this.coordinates)),this}getWarp(){return this._warp}setCoordinates(t){var i,r;let a,o,s,n,l,h;this.coordinates=t;let c=t.map(P.nt.fromLngLat);return this.tileID=(i=c,o=Math.max(0,Math.floor(-Math.log(Math.max((a=P.pt.fromPoints(i)).width(),a.height()))/Math.LN2)),s=2**o,new P.u(o,Math.floor((a.minX+a.maxX)/2*s),Math.floor((a.minY+a.maxY)/2*s))),this.terrainTileRanges=this._getOverlappingTileRanges(c),this.minzoom=this.maxzoom=this.tileID.z,this.tileCoords=c.map(t=>
1this.tileID.getTilePoint(t)._round()),this.imageWarp=function(t,i){if("flat"===i||eY(t))return eG;let[r,a,o,s]=t,n=r.x-a.x+o.x-s.x,l=r.y-a.y+o.y-s.y,h=[a.x-o.x,a.y-o.y,s.x-o.x,s.y-o.y],[c,u,d,_]=h,p=h[0]*h[3]-h[2]*h[1],m=(n*_-d*l)/p,f=(c*l-n*u)/p,g=[1,1+m,1+m+f,1+f],v=Math.max(...g)/Math.min(...g),y="perspective"===i?0:Math.max(0,(1-4/v)/(1-4/512));return!(v>=1&&v<=512)||y>=1?eG:[m,f,y]}(this.tileCoords,this._warp),this._subdividedQuad=this.imageWarp[2]>0&&!eY(this.tileCoords),this.flippedWindingOrder=(n=(r=this.tileCoords)[1].x-r[0].x,l=r[1].y-r[0].y,h=r[2].x-r[0].x,n*(r[2].y-r[0].y)-l*h<0),this.fire(new N("data",{sourceDataType:"content"})),this}prepare(){if(0===Object.keys(this.tiles).length||!this.image)return;let t=this.map.painter.context,i=t.gl;this.texture?this._imageDirty&&(this.texture.update(this.image),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE)):(this.texture=new P.xt(t,this.image,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE)),this._imageDirty=!1;let r=!1;for(let t in this.tiles){let i=this.tiles[t];"loaded"!==i.state&&(i.state="loaded",i.texture=this.texture,r=!0)}r&&this.fire(new N("data",{sourceDataType:"idle",sourceId:this.id}))}async loadTile(t){this.tileID?.equals(t.tileID.canonical)?(this.tiles[String(t.tileID.wrap)]=t,t.buckets={}):t.state="errored"}serialize(){let t={type:"image",coordinates:this.coordinates};return void 0!==this.options.url&&(t.url=this.options.url),t}hasTransition(){return!1}_getOverlappingTileRanges(t){let{minX:i,minY:r,maxX:a,maxY:o}=P.pt.fromPoints(t),s={};for(let t=0;t<=25;t++){let n=2**t,l=Math.floor(i*n),h=Math.floor(r*n),c=Math.floor(a*n),u=Math.floor(o*n),d=(l%n+n)%n,_=c%n,p=Math.floor(l/n),m=Math.floor(c/n);s[t]={minWrap:p,maxWrap:m,minTileXWrapped:d,maxTileXWrapped:_,minTileY:h,maxTileY:u}}return s}};function eY(t){let[i,r,a,o]=t;return i.x+a.x===r.x+o.x&&i.y+a.y===r.y+o.y}var eK=class extends eX{constructor(t,i,r,a){super(t,i,r,a),this._onPlayingHandler=()=>{this.map?.triggerRepaint()},this.roundZoom=!0,this.type="video",this.options=i}async load(){this._loaded=!1;let t=this.options;for(let i of(this.urls=[],t.urls))this.urls.push((await this.map._requestManager.transformRequest(i,"Source")).url);try{let t=await (0,P.wn)(this.urls);if(this._loaded=!0,!t)return;this.video=t,this.video.loop=!0,this.video.addEventListener("playing",this._onPlayingHandler),this.map&&this.video.play(),this._finishLoading()}catch(t){this.fire(new P.gn((0,P.Qn)(t)))}}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(t){if(this.video){let i=this.video.seekable;t<i.start(0)||t>i.end(0)?this.fire(new P.gn(new P.pn(`sources.${this.id}`,null,`Playback for this video can be set only between the ${i.start(0)} and ${i.end(0)}-second mark.`))):this.video.currentTime=t}}getVideo(){return this.video}onAdd(t){this.map||(this.map=t,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}onRemove(){super.onRemove(),this.video&&(this.video.removeEventListener("playing",this._onPlayingHandler),this.video.pause())}prepare(){if(0===Object.keys(this.tiles).length||this.video.readyState<2)return;let t=this.map.painter.context,i=t.gl;this.texture?this.video.paused||(this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE),i.texSubImage2D(i.TEXTURE_2D,0,0,0,i.RGBA,i.UNSIGNED_BYTE,this.video)):(this.texture=new P.xt(t,this.video,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE));let r=!1;for(let t in this.tiles){let i=this.tiles[t];"loaded"!==i.state&&(i.state="loaded",i.texture=this.texture,r=!0)}r&&this.fire(new N("data",{sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}},eJ=class extends eX{constructor(t,i,r,a){super(t,i,r,a),i.coordinates?(!Array.isArray(i.coordinates)||4!==i.coordinates.length||i.coordinates.some(t=>!Array.isArray(t)||2!==t.length||t.some(t=>"number"!=typeof t)))&&this.fire(new P.gn(new P.pn(`sources.${t}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new P.gn(new P.pn(`sources.${t}`,null,'missing required property "coordinates"'))),i.animate&&"boolean"!=typeof i.animate&&this.fire(new P.gn(new P.pn(`sources.${t}
1`,null,'optional "animate" property must be a boolean value'))),i.canvas?"string"==typeof i.canvas||i.canvas instanceof HTMLCanvasElement||this.fire(new P.gn(new P.pn(`sources.${t}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new P.gn(new P.pn(`sources.${t}`,null,'missing required property "canvas"'))),this.options=i,this.animate=void 0===i.animate||i.animate}async load(){(this._loaded=!0,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 P.gn(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(),!1)},this._finishLoading())}getCanvas(){return this.canvas}onAdd(t){this.map=t,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this._playing=!1,super.onRemove()}prepare(){let t=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,t=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,t=!0),this._hasInvalidDimensions()||0===Object.keys(this.tiles).length)return;let i=this.map.painter.context,r=i.gl;this.texture?(t||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):(this.texture=new P.xt(i,this.canvas,r.RGBA,{premultiply:!0}),this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE));let a=!1;for(let t in this.tiles){let i=this.tiles[t];"loaded"!==i.state&&(i.state="loaded",i.texture=this.texture,a=!0)}a&&this.fire(new N("data",{sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",animate:this.animate,canvas:this.options.canvas,coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(let t of[this.canvas.width,this.canvas.height])if(isNaN(t)||t<=0)return!0;return!1}};let eQ={},e0="RTLPluginLoaded";var e1=class extends P.vn{constructor(...t){super(...t),this.status="unavailable",this.url=null,this.dispatcher=(d||(d=new eE(u||=new eI,P.bn)).registerMessageHandler("GR",(t,i,r)=>(0,P.Tn)(i,r)),d)}_syncState(t){return this.status=t,this.dispatcher.broadcast("SRPS",{pluginStatus:t,pluginURL:this.url}).catch(t=>{throw this.status="error",t})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}async setRTLTextPlugin(t,i=!1){if(this.url)throw Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=C.resolveURL(t),!this.url)throw Error(`requested url ${t} is invalid`);if("unavailable"===this.status)if(!i)return this._requestImport();else this.status="deferred",this._syncState(this.status);else if("requested"===this.status)return this._requestImport()}async _requestImport(){await this._syncState("loading"),this.status="loaded",this.fire(new P._n(e0))}lazyLoad(){"unavailable"===this.status?this.status="requested":"deferred"===this.status&&this._requestImport()}};let e2=null;function e4(){return e2||=new e1}var e3=class{constructor(t,i){this.timeAdded=0,this.fadeEndTime=0,this.fadeOpacity=1,this.tileID=t,this.uid=(0,P.Mr)(),this.uses=0,this.tileSize=i,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rttObjects=[],this.rttFingerprint={},this.expiredRequestCount=0,this.state="loading",this.featureStateRevision=-1}isRenderable(t){return this.hasData()&&(!this.fadeEndTime||0!==this.fadingDirection||this.fadeOpacity>0)&&(t||!this.holdingForSymbolFade())}setCrossFadeLogic({fadingRole:t,fadingDirection:i,fadingParentID:r,fadeEndTime:a}){this.resetFadeLogic(),this.fadingRole=t,this.fadingDirection=i,this.fadingParentID=r,this.fadeEndTime=a}setSelfFadeLogic(t){this.resetFadeLogic(),this.selfFading=!0,this.fadeEndTime=t}resetFadeLogic(){this.fadingRole=null,this.fadingDirection=null,this.fadingParentID=null,this.selfFading=!1,this.timeAdded=S(),this.fadeEndTime=0,this.fadeOpacity=1}wasRequested(){return"errored"===this.state||"loaded"===this.state||"reloading"===this.state}clearTextures(t){this.demTexture&&t.saveTileTexture(this.demTexture),this.demTexture=null}getRTT(t){return this.rttObjects[t]}acquireRTT(t,i,r){return this.rttObjects[i]=t.acquireRTT(r)}releaseRTT(t){if(0!==this.rttObjects.length){for(let i of this.rttObjects)i&&t.releaseRTT(i);this.rttObjects.length=0}}loadVectorData(t,i,r){if(t?.etagUnmodified===!0){this.state="loaded";return}if(this.hasData()&&this.unloadVectorData(),this.state="loaded",!t){this.collisionBoxArray=new P.Vt;return}for(let a in t.featureIndex&&(this.latestFeatureIndex=t.featureIndex,t.rawTileData?(this.latestRawTileData=t.rawTileData,this.latestEncoding=t.encoding,this.latestFeatureIndex.rawTileData=t.rawTileData,this.latestFeatureIndex.encoding=t.encoding):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData,this.latestFeatureIndex.encoding=this.latestEncoding)),this.collisionBoxArray=t.collisionBoxArray,this.buckets=function(t,i){let r={};if(!i)return r;for(let a of t){let t=a.layerIds.map(t=>
1i.getLayer(t)).filter(Boolean);if(0!==t.length)for(let i of(a.layers=t,a.stateDependentLayerIds&&(a.stateDependentLayers=a.stateDependentLayerIds.map(i=>t.filter(t=>t.id===i)[0])),t))r[i.id]=a}return r}(t.buckets,i?.style),this.hasSymbolBuckets=!1,this.buckets){let t=this.buckets[a];if(t instanceof P.S)if(this.hasSymbolBuckets=!0,r)t.justReloaded=!0;else break}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(let t in this.buckets){let i=this.buckets[t];if(i instanceof P.S&&i.hasRTLText){this.hasRTLText=!0,e4().lazyLoad();break}}for(let t in this.queryPadding=0,this.buckets){let r=this.buckets[t];this.queryPadding=Math.max(this.queryPadding,i.style.getLayer(t).queryRadius(r))}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage),this.dashPositions=t.dashPositions}unloadVectorData(){for(let t in this.buckets)this.buckets[t].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.imageAtlas=null,this.dashPositions=null,this.latestFeatureIndex=null,this.state="unloaded"}getBucket(t){return this.buckets[t.id]}upload(t){for(let i in this.buckets){let r=this.buckets[i];r.uploadPending()&&r.upload(t)}let i=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new P.xt(t,this.imageAtlas.image,i.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&=(this.glyphAtlasTexture=new P.xt(t,this.glyphAtlasImage,i.ALPHA),null)}prepare(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture)}queryRenderedFeatures(t,i,r,a,o,s,n,l,h,c,u){return this.latestFeatureIndex?.rawTileData?this.latestFeatureIndex.query({queryGeometry:a,cameraQueryGeometry:o,scale:s,tileSize:this.tileSize,pixelPosMatrix:c,transform:l,params:n,queryPadding:this.queryPadding*h,getElevation:u},t,i,r):{}}querySourceFeatures(t,i){let r=this.latestFeatureIndex;if(!r?.rawTileData)return;let a=r.loadVTLayers(),o=i?.sourceLayer?i.sourceLayer:"",s=a._geojsonTileLayer||a[o];if(!s)return;let n=(0,P.cn)(i?.filter,`querySourceFeatures[${o}].filter`,i?.globalState),{z:l,x:h,y:c}=this.tileID.canonical,u={z:l,x:h,y:c};for(let i=0;i<s.length;i++){let a=s.feature(i);if(n.needGeometry){let t=(0,P.At)(a,!0);if(!n.filter(new P.en(this.tileID.overscaledZ),t,this.tileID.canonical))continue}else if(!n.filter(new P.en(this.tileID.overscaledZ),a))continue;let d=r.getId(a,o),_=new P.a(a,l,h,c,d);_.tile=u,t.push(_)}}hasData(){return"loaded"===this.state||"reloading"===this.state||"expired"===this.state}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(t){let i=this.expirationTime;if(t.cacheControl){let i=(0,P.vr)(t.cacheControl);i["max-age"]&&(this.expirationTime=Date.now()+1e3*i["max-age"])}else t.expires&&(this.expirationTime=new Date(t.expires).getTime());if(this.expirationTime){let t=Date.now(),r=!1;if(this.expirationTime>t)r=!1;else if(i)if(this.expirationTime<i)r=!0;else{let a=this.expirationTime-i;a?this.expirationTime=t+Math.max(a,3e4):r=!0}else r=!0;r?(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(),0x80000000-1)}setFeatureState(t,i,r){if(!this.latestFeatureIndex?.rawTileData||0===Object.keys(t).length||this.featureStateRevision===r)return;this.featureStateRevision=r;let a=this.latestFeatureIndex.loadVTLayers();for(let r in this.buckets){if(!i.style.hasLayer(r))continue;let o=this.buckets[r],s=o.layers[0].sourceLayer||"_geojsonTileLayer",n=a[s],l=t[s];if(!n||!l||0===l.length)continue;o.update(l,n,this.imageAtlas?.patternPositions||{},this.dashPositions||{});let h=i?.style?.getLayer(r);h&&(this.queryPadding=Math.max(this.queryPadding,h.queryRadius(o)))}}holdingForSymbolFade(){return void 0!==this.symbolFadeHoldUntil}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<S()}clearSymbolFadeHold(){this.symbolFadeHoldUntil=void 0}setSymbolHoldDuration(t){this.symbolFadeHoldUntil=S()+t}
1setDependencies(t,i){let r={};for(let t of i)r[t]=!0;this.dependencies[t]=r}hasDependency(t,i){for(let r of t){let t=this.dependencies[r];if(t){for(let r of i)if(t[r])return!0}}return!1}};function e5(t){let i=[];for(let r in t)i.push({id:r,state:t[r]});return i}var e6=class{constructor(){this.state={},this.stateChanges={},this.deletedStates={},this.revision=0}updateState(t,i,r){let a=String(i);if(this.stateChanges[t]||={},this.stateChanges[t][a]||={},(0,P.er)(this.stateChanges[t][a],r),null===this.deletedStates[t])for(let i in this.deletedStates[t]={},this.state[t])if(i===a)for(let o in this.deletedStates[t][a]={},this.state[t][i])void 0===r[o]&&(this.deletedStates[t][a][o]=null);else this.deletedStates[t][i]=null;else if(this.deletedStates[t]?.[a]===null)for(let i in this.deletedStates[t][a]={},this.state[t][a])void 0===r[i]&&(this.deletedStates[t][a][i]=null);else for(let i in r)this.deletedStates[t]?.[a]?.[i]===null&&delete this.deletedStates[t][a][i]}removeFeatureState(t,i,r){if(null===this.deletedStates[t])return;let a=String(i);if(this.deletedStates[t]||={},r&&void 0!==i)null!==this.deletedStates[t][a]&&(this.deletedStates[t][a]||={},this.deletedStates[t][a][r]=null);else if(void 0!==i)if(this.stateChanges[t]?.[a])for(r in this.deletedStates[t][a]={},this.stateChanges[t][a])this.deletedStates[t][a][r]=null;else this.deletedStates[t][a]=null;else this.deletedStates[t]=null}getState(t,i){let r=String(i),a=this.state[t]||{},o=this.stateChanges[t]||{},s=(0,P.er)({},a[r],o[r]);if(null===this.deletedStates[t])return{};if(this.deletedStates[t]){let r=this.deletedStates[t][i];if(null===r)return{};for(let t in r)delete s[t]}return s}initializeTileState(t,i){let r={};for(let t in this.state)r[t]=e5(this.state[t]);t.setFeatureState(r,i,this.revision)}coalesceChanges(t,i){let r={};for(let t in this.stateChanges)for(let i in this.state[t]||={},r[t]||={},this.stateChanges[t])this.state[t][i]||={},(0,P.er)(this.state[t][i],this.stateChanges[t][i]),r[t][i]=this.state[t][i];for(let t in this.deletedStates)if(this.state[t]||={},r[t]||={},null===this.deletedStates[t])for(let i in this.state[t])this.state[t][i]={},r[t][i]={};else for(let i in this.deletedStates[t]){if(null===this.deletedStates[t][i])this.state[t][i]={};else for(let r of Object.keys(this.deletedStates[t][i]))delete this.state[t][i][r];r[t][i]=this.state[t][i]}if(this.stateChanges={},this.deletedStates={},0===Object.keys(r).length)return;this.revision++;let a={};for(let t in r)a[t]=e5(r[t]);t.setFeatureState(a,i,this.revision)}},e8=class t{constructor(t,i){this.min=t,this.max=i,this.center=(0,P.ci)([],(0,P.Xr)([],this.min,this.max),.5)}quadrant(i){let r=[i%2==0,i<2],a=(0,P.Zr)(this.min),o=(0,P.Zr)(this.max);for(let t=0;t<r.length;t++)a[t]=r[t]?this.min[t]:this.center[t],o[t]=r[t]?this.center[t]:this.max[t];return o[2]=this.max[2],new t(a,o)}distanceX(t){return Math.max(Math.min(this.max[0],t[0]),this.min[0])-t[0]}distanceY(t){return Math.max(Math.min(this.max[1],t[1]),this.min[1])-t[1]}intersectsFrustum(t){let i=!0;for(let r of t.planes){let t=this.intersectsPlane(r);if(0===t)return 0;1===t&&(i=!1)}return i?2:t.aabb.min[0]>this.max[0]||t.aabb.min[1]>this.max[1]||t.aabb.min[2]>this.max[2]||t.aabb.max[0]<this.min[0]||t.aabb.max[1]<this.min[1]||t.aabb.max[2]<this.min[2]?0:1}intersectsPlane(t){let i=t[3],r=t[3];for(let a=0;a<3;a++)t[a]>0?(i+=t[a]*this.min[a],r+=t[a]*this.max[a]):(r+=t[a]*this.min[a],i+=t[a]*this.max[a]);return i>=0?2:r<0?0:1}},e9=class t{constructor(t,i,r){this.points=t,this.planes=i,this.aabb=r}static fromInvProjectionMatrix(i,r=1,a=0,o,s){let n=s?[[6,5,4],[0,1,2],[0,3,7],[2,1,5],[3,2,6],[0,4,5]]:[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]],l=2**a,h=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map(t=>{var a,o,s,n;let h,c;return a=t,o=i,s=r,n=l,c=1/(h=(0,P.Yr)([],a,o))[3]/s*n,(0,P.qr)(h,h,[c,c,1/h[3],c])});o&&function(t,i,r,a){var o,s;let n,l,h,c=4*!!a,u=4*!a,d=0,_=[],p=[];for(let i=0;i<4;i++){let r=(0,P.ui)([],t[i+u],t[i+c]),a=(0,P.ni)(r);(0,P.ci)(r,r,1/a),_.push(a),p.push(r)}for(let i=0;i<4;i++){let a=(0,P.Sr)(t[i+c],p[i],r);d=null!==a&&a>=0?Math.max(d,a):Math.max(d,_[i])}let m=(o=t,s=i,n=(0,P.ui)([],o[s[0]],o[s[1]]),l=(0,P.ui)([],o[s[2]],o[s[1]]),h=[0,0,0,0],(0,P.ii)(h,(0,P.Qr)([],n,l)),h[3]=-(0,P.ei)(h,o[s[0]]),h),f=function(t,i){let r=(0,P.ti)(t),a=(0,P.Jr)([],t,1/r),o=(0,P.ui)([],i,(0,P.ci)([],a,(0,P.ei)(i,a))),s=(0,P.ti)(o);if(s>0){let t=Math.sqrt(1-a[3]*a[3]),r=(0,P.ci)([],a,-a[3]),n=(0,P.Xr)([],r,(0,P.ci)([],o,t/s));return(0,P.br)(i,n)}return null}(r,m);null!==f&&(d=Math.min(d,f/(0,P.ei)(p[0],m)));for(let i=0;i<4;i++){let r=Math.min(d,_[i]);t[i+u]=[t[i+c][0]+p[i][0]*r,t[i+c][1]+p[i][1]*r,t[i+c][2]+p[i][2]*r,1]}}(h,n[0],o,s);let c=n.map(t=>{let i=(0,P.ui)([],h[t[0]],h[t[1]]),r=(0,P.ui)([],h[t[2]],h[t[1]]),a=(0,P.ii)([],(0,P.Qr)([],i,r)),o=-(0,P.ei)(a,h[t[1]]);return a.concat(o)}),u=[1/0,1/0,1/0],d=[-1/0,-1/0,-1/0];for(let t of h)for(let i=0;i<3;i++)u[i]=Math.min(u[i],t[i]),d[i]=Math.max(d[i],t[i]);return new t(h,c,new e8(u,d))}};function e7(t,i,r){let a=0,o=(r-i)/10;for(let s=0;s<10;s++){let n=i+(s+.5)/10*(r-i);a+=o*Math.cos(n)**t}return a}function te(t,i){return function(r,a,o,s,n){let l=2*((t-1)/(0,P.Dr)(Math.cos((0,P.Yn)(P.Q-n))/Math.cos((0,P.Yn)(P.Q)))-1),h=Math.acos(o/s),c=2*e7(l-1,0,(0,P.Yn)(n/2)),u=Math.min((0,P.Yn)(P.Q),h+(0,P.Yn)(n/2)),d=e7(l-1,Math.min(u,h-(0,P.Yn)(n/2)),u),_=Math.atan(a/o),p=Math.hypot(a,o),m=r;return m+=(0,P.Dr)(s/p/Math.max(.5,Math.cos((0,P.Yn)(n/2)))),m+=l*(0,P.Dr)(Math.cos(_))/2,m-=(0,P.Dr)(Math.max(1,d/c/i))/2}}let tt=te(9.314,3);function ti(t,i){return Math.max(0,(i.roundZoom?Math.round:Math.floor)(t.zoom+(0,P.Dr)(t.tileSize/i.tileSize)))}function tr(t,i){var r;let a,o,s,n=t.getCameraFrustum(),l=t.getClippingPlane();l&&i.maxContentElevation>0&&({frustum:n,plane:l}=function(t,i,r,a){let o=Math.hypot(i[0],i[1],i[2]);if(0===o)return{frustum:t,plane:i};let s=1+a/P.ut,n=Math.cos(Math.acos((0,P.Bn)(-i[3]/o,-1,1))+Math.acos(1/s));return{frustum:function(t,i,r){let a=t.planes[1],o=t.points.map(t=>{if(Math.abs(a[0]*t[0]+a[1]*t[1]+a[2]*t[2]+a[3])>1e-6)return t;
1let o=[t[0]-r[0],t[1]-r[1],t[2]-r[2]],s=a[0]*o[0]+a[1]*o[1]+a[2]*o[2];if(s>=-1e-9)return t;let n=-(i/s);return[t[0]+o[0]*n,t[1]+o[1]*n,t[2]+o[2]*n,t[3]]}),s=t.planes.map((t,r)=>1===r?[t[0],t[1],t[2],t[3]+i]:t),n=[1/0,1/0,1/0],l=[-1/0,-1/0,-1/0];for(let t of o)for(let i=0;i<3;i++)n[i]=Math.min(n[i],t[i]),l[i]=Math.max(l[i],t[i]);return new e9(o,s,new e8(n,l))}(t,Math.sqrt(s*s-1),r),plane:[i[0],i[1],i[2],-n*o]}}(n,l,t.cameraPosition,i.maxContentElevation));let h=(0,P.Y)(t),c=P.nt.fromLngLat(t.center,t.elevation),u=(r=i.maxContentElevation,a=P.Q-t.pitch-t.fov/2,o=(0,P.Bn)((15-a)/15,0,1),s=Math.max(500,r??0),t.elevation+o*s),d=t.getCoveringTilesDetailsProvider(),_=d.allowVariableZoom(t,i),p=ti(t,i),m=i.minzoom||0,f=void 0===i.maxzoom?t.maxZoom:i.maxzoom,g=Math.min(Math.max(0,p),f),v=2**g,y=[v*h.x,v*h.y,0],x=[v*c.x,v*c.y,0],b=Math.hypot(c.x-h.x,c.y-h.y),w=Math.abs(c.z-h.z),T=Math.hypot(b,w),M=t=>({zoom:0,x:0,y:0,wrap:t,fullyVisible:!1}),C=[],I=[];if(t.renderWorldCopies&&d.allowWorldCopies())for(let t=1;t<=3;t++)C.push(M(-t)),C.push(M(t));for(C.push(M(0));C.length>0;){let r=C.pop(),a=r.x,o=r.y,s=r.fullyVisible,v={x:a,y:o,z:r.zoom},b=d.getTileBoundingVolume(v,r.wrap,u,i);if(!s){let t=function(t,i,r){let a=i.intersectsFrustum(t);if(!r||0===a)return a;let o=i.intersectsPlane(r);return 0===o?0:2===a&&2===o?2:1}(n,b,l);if(0===t)continue;s=2===t}let M=d.distanceToTile2d(h.x,h.y,v,b),S=p;_&&(S=(i.calculateTileZoom||tt)(t.zoom+(0,P.Dr)(t.tileSize/i.tileSize),M,w,T,t.fov));let E=Math.min(S=Math.max(0,S=(i.roundZoom?Math.round:Math.floor)(S)),f);if(r.wrap=d.getWrap(c,v,r.wrap),r.zoom>=E){if(r.zoom<m)continue;let t=g-r.zoom,s=y[0]-.5-(a<<t),n=y[1]-.5-(o<<t),l=i.reparseOverscaled?Math.max(r.zoom,S):r.zoom;I.push({tileID:new P.d(r.zoom===f?l:r.zoom,r.wrap,r.zoom,a,o),distanceSq:(0,P.Vr)([x[0]-.5-a,x[1]-.5-o]),tileDistanceToCamera:Math.sqrt(s*s+n*n)});continue}for(let t=0;t<4;t++){let i=(a<<1)+t%2,n=(o<<1)+(t>>1),l=r.zoom+1;C.push({zoom:l,x:i,y:n,wrap:r.wrap,fullyVisible:s})}}return I.sort((t,i)=>t.distanceSq-i.distanceSq).map(t=>t.tileID)}function ta(t){return"raster"===t||"image"===t||"video"===t}function to(t,i,r,a,o,s,n){if(r[0].overscaledZ>=s)return!1;let l=!1;for(let s of r){let r=t.getLoadedTile(s);if(!r)continue;let{fadingRole:h,fadingDirection:c,fadingParentID:u}=r;0===h&&0===c&&u||(r.setCrossFadeLogic({fadingRole:0,fadingDirection:0,fadingParentID:i.tileID,fadeEndTime:o+n}),i.setCrossFadeLogic({fadingRole:1,fadingDirection:1,fadeEndTime:o+n})),a[s.key]=s,l=!0}return l}function ts(t,i){t.needsHillshadePrepare=!0,t.needsTerrainPrepare=!0,t.needsColorReliefPrepare=!0;let r=i.tileID.canonical.x-t.tileID.canonical.x,a=i.tileID.canonical.y-t.tileID.canonical.y,o=2**t.tileID.canonical.z,s=i.tileID.key;(0!==r||0!==a)&&(Math.abs(a)>1||(Math.abs(r)>1&&(1===Math.abs(r+o)?r+=o:1===Math.abs(r-o)&&(r-=o)),i.dem&&t.dem&&(t.dem.backfillBorder(i.dem,r,a),t.neighboringTiles?.[s]&&(t.neighboringTiles[s].backfilled=!0))))}var tn=class{constructor(){this._tiles={}}handleWrapJump(t){let i={};for(let r in this._tiles){let a=this._tiles[r];a.tileID=a.tileID.unwrapTo(a.tileID.wrap+t),i[a.tileID.key]=a}this._tiles=i}setFeatureState(t,i,r){for(let a in this._tiles)this._tiles[a].setFeatureState(t,i,r)}getAllTiles(){return Object.values(this._tiles)}getAllIds(t=!1){return t?Object.values(this._tiles).map(t=>t.tileID).sort(P.m).map(t=>t.key):Object.keys(this._tiles)}getTileById(t){return this._tiles[t]}setTile(t,i){this._tiles[t]=i}deleteTileById(t){delete this._tiles[t]}getLoadedTile(t){let i=this.getTileById(t.key);return i?.hasData()?i:null}isIdRenderable(t,i=!1){return this.getTileById(t)?.isRenderable(i)}getRenderableIds(t=0,i){let r=[];for(let t of this.getAllIds())this.isIdRenderable(t,i)&&r.push(this.getTileById(t));return i?r.sort((i,r)=>{let a=i.tileID,o=r.tileID,s=new P.Li(a.canonical.x,a.canonical.y)._rotate(-t),n=new P.Li(o.canonical.x,o.canonical.y)._rotate(-t);return a.overscaledZ-o.overscaledZ||n.y-s.y||n.x-s.x}).map(t=>t.tileID.key):r.map(t=>t.tileID).sort(P.m).map(t=>t.key)}},tl=class t extends P.vn{static{this.maxUnderzooming=10}static{this.maxOverzooming=3}constructor(t,i,r){super(),this._maxContentElevationSeen=0,this.id=t,this.dispatcher=r,this.on("data",t=>{this._dataHandler(t)}),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((t,i,r,a)=>{let o=new((t=>{switch(t){case"geojson":return eU;case"image":return eX;case"raster":return ek;case"raster-dem":return eB;case"vector":return eF;case"video":return eK;case"canvas":return eJ}return eQ[t]})(i.type))(t,i,r,a);if(o.id!==t)throw Error(`Expected Source id to be ${t} instead of ${o.id}`);return o}
1)(t,i,r,this),this._inViewTiles=new tn,this._outOfViewCache=new P.n(0,t=>this._unloadTile(t)),this._timers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._rasterFadeDuration=0,this._maxFadingAncestorLevels=5,this._state=new e6,this._didEmitContent=!1,this._updated=!1}onAdd(t){this.map=t,this._maxTileCacheSize=t?t._maxTileCacheSize:null,this._maxTileCacheZoomLevels=t?t._maxTileCacheZoomLevels:null,this._source?.onAdd&&this._source.onAdd(t)}onRemove(t){for(let t of this._inViewTiles.getAllTiles())t.unloadVectorData();this.clearTiles(),this._source?.onRemove&&this._source.onRemove(t),this._inViewTiles=new tn}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;if((void 0!==this.used||void 0!==this.usedForTerrain)&&!this.used&&!this.usedForTerrain)return!0;if(!this._updated)return!1;for(let t of this._inViewTiles.getAllTiles())if("loaded"!==t.state&&"errored"!==t.state)return!1;return!0}getSource(){return this._source}getState(){return this._state}pause(){this._paused=!0}resume(){if(!this._paused)return;let t=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,t&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}async _loadTile(t,i,r,a){try{let o=await this._source.loadTile(t);this._tileLoaded(t,i,r,a,o)}catch(i){t.state="errored",404===i.status?this.update(this.transform,this.terrain):this._source.fire(new P.gn((0,P.Qn)(i),{tile:t}))}}_unloadTile(t){this._source.unloadTile&&this._source.unloadTile(t)}_abortTile(t){this._source.abortTile&&this._source.abortTile(t),this._source.fire(new N("dataabort",{tile:t,coord:t.tileID}))}serialize(){return this._source.serialize()}prepare(t){for(let i of(this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._inViewTiles,this.map?this.map.painter:null),this._inViewTiles.getAllTiles()))i.upload(t),i.prepare(this.map.style.imageManager)}getIds(){return this._inViewTiles.getAllIds(!0)}getRenderableIds(t){return this._inViewTiles.getRenderableIds(this.transform?.bearingInRadians,t)}hasRenderableParent(t){let i=t.overscaledZ-1;if(i>=this._source.minzoom){let r=this.getLoadedTile(t.scaledTo(i));if(r)return this._inViewTiles.isIdRenderable(r.tileID.key)}return!1}reload(t,i){if(this._paused){this._shouldReloadOnResume=!0;return}for(let r of(this._outOfViewCache.reset(),this._inViewTiles.getAllIds())){let a=this._inViewTiles.getTileById(r);(!i||this._source.shouldReloadTile(a,i))&&(t?this._reloadTile(r,"errored"===a.state?"loading":"expired"):"errored"!==a.state&&this._reloadTile(r,"reloading"))}}async _reloadTile(t,i){let r=this._inViewTiles.getTileById(t);if(!r)return;let a=r.hasData();"loading"!==r.state&&(r.state=i),await this._loadTile(r,t,i,a)}_tileLoaded(t,i,r,a,o){a||(t.timeAdded=S(),t.selfFading&&(t.fadeEndTime=t.timeAdded+this._rasterFadeDuration)),"expired"===r&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(i,t),!o?.unmodified&&("raster-dem"===this.getSource().type&&t.dem&&function(t,i){for(let r of i.getRenderableIds()){if(!t.neighboringTiles?.[r])continue;let a=i.getTileById(r);t.neighboringTiles[r].backfilled||ts(t,a),a.neighboringTiles?.[t.tileID.key]?.backfilled||ts(a,t)}}(t,this._inViewTiles),t.featureStateRevision=-1,this._state.initializeTileState(t,this.map?this.map.painter:null),t.aborted||this._source.fire(new N("data",{tile:t,coord:t.tileID})))}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._inViewTiles.getTileById(t)}_retainLoadedChildren(i,r){let a=this._getLoadedDescendents(r),o=new Set;for(let s of r){let r=a[s.key];if(!r?.length){o.add(s);continue}let n=s.overscaledZ+t.maxOverzooming,l=r.filter(t=>t.tileID.overscaledZ<=n);if(!l.length){o.add(s);continue}let h=Math.min(...l.map(t=>t.tileID.overscaledZ)),c=l.filter(t=>t.tileID.overscaledZ===h).map(t=>t.tileID);for(let t of c)i[t.key]=t;this._areDescendentsComplete(c,h,s.overscaledZ)||o.add(s)}return o}_getLoadedDescendents(t){let i={};for(let r of this._inViewTiles.getAllTiles().filter(t=>t.hasData()))for(let a of t)r.tileID.isChildOf(a)&&(i[a.key]||=[],i[a.key].push(r));return i}_areDescendentsComplete(t,i,r){return 1===t.length&&t[0].isOverscaled()?t[0].overscaledZ===i:4**(i-r)===t.length}getLoadedTile(t){return this._inViewTiles.getLoadedTile(t)}updateCacheSize(t){let i=Math.floor((Math.ceil(t.width/this._source.tileSize)+1)*(Math.ceil(t.height/this._source.tileSize)+1)*(null===this._maxTileC
1acheZoomLevels?P.An.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),r="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,i):i;this._outOfViewCache.setMaxSize(r)}handleWrapJump(t){let i=Math.round((t-(void 0===this._prevLng?t:this._prevLng))/360);this._prevLng=t,i&&(this._inViewTiles.handleWrapJump(i),this._resetTileReloadTimers())}_updateMaxContentElevation(){let t=this._maxContentElevationSeen,i=this.map?.style?._layers;if(!i)return t;let r=this._inViewTiles.getAllTiles();for(let a in i){let o=i[a];if("symbol"!==o.type||o.source!==this.id||o.isHidden(this.transform.zoom)||!o.layout)continue;let s=o.layout.get("symbol-height-offset");if(t=Math.max(t,s.constantOr(0)),!s.isConstant())for(let i of r){let r=i.getBucket(o);r&&r.maxHeightOffset>t&&(t=r.maxHeightOffset)}}return this._maxContentElevationSeen=t,t}update(t,i){let r;if(!this._sourceLoaded||this._paused)return;this.transform=t,this.terrain=i,this.updateCacheSize(t),this.handleWrapJump(this.transform.center.lng),this.used||this.usedForTerrain?this._source.tileID?r=t.getVisibleUnwrappedCoordinates(this._source.tileID).map(t=>new P.d(t.canonical.z,t.wrap,t.canonical.z,t.canonical.x,t.canonical.y)):(r=tr(t,{tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:"vector"===this._source.type&&void 0!==this.map._zoomLevelsToOverscale?Math.max(this._source.maxzoom,t.maxZoom-this.map._zoomLevelsToOverscale):this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:i,calculateTileZoom:this._source.calculateTileZoom,maxContentElevation:this._updateMaxContentElevation()}),this._source.hasTile&&(r=r.filter(t=>this._source.hasTile(t)))):r=[],this.usedForTerrain&&(r=this._addTerrainIdealTiles(r));let a=0===r.length&&!this._updated&&this._didEmitContent;this._updated=!0,a&&this.fire(new N("data",{sourceDataType:"idle",sourceId:this.id}));let o=ti(t,this._source),s=this._updateRetainedTiles(r,o),n=ta(this._source.type);n&&this._rasterFadeDuration>0&&!i&&function(t,i,r,a,o,s,n){let l=S(),h=(0,P.ar)(i);for(let c of i){let i=t.getTileById(c.key);(0===i.fadingDirection||0===i.fadeOpacity)&&i.resetFadeLogic(),!function(t,i,r,a,o,s,n){if(!i.hasData())return!1;let{tileID:l,fadingRole:h,fadingDirection:c,fadingParentID:u}=i;if(0===h&&1===c&&u)return r[u.key]=u,!0;let d=Math.max(l.overscaledZ-o,s);for(let o=l.overscaledZ-1;o>=d;o--){let s=l.scaledTo(o),h=t.getLoadedTile(s);if(h)return i.setCrossFadeLogic({fadingRole:0,fadingDirection:1,fadingParentID:h.tileID,fadeEndTime:a+n}),h.setCrossFadeLogic({fadingRole:1,fadingDirection:0,fadeEndTime:a+n}),r[s.key]=s,!0}return!1}(t,i,r,l,a,o,n)&&(function(t,i,r,a,o,s){if(!i.hasData())return!1;let n=i.tileID.children(o),l=to(t,i,n,r,a,o,s);if(l)return!0;for(let h of n)to(t,i,h.children(o),r,a,o,s)&&(l=!0);return l}(t,i,r,l,s,n)||function(t,i,r,a){let o=t.tileID;return!!t.selfFading||!t.hasData()&&!!i.has(o)&&(t.setSelfFadeLogic(r+a),!0)}(i,h,l,n)||i.resetFadeLogic())}}(this._inViewTiles,r,s,this._maxFadingAncestorLevels,this._source.minzoom,this._source.maxzoom,this._rasterFadeDuration),n?this._cleanUpRasterTiles(s):this._cleanUpVectorTiles(s)}_cleanUpRasterTiles(t){for(let i of this._inViewTiles.getAllIds())t[i]||this._removeTile(i)}_cleanUpVectorTiles(t){for(let i of this._inViewTiles.getAllIds()){let r=this._inViewTiles.getTileById(i);if(t[i]){r.clearSymbolFadeHold();continue}if(!r.hasSymbolBuckets){this._removeTile(i);continue}r.holdingForSymbolFade()?r.symbolFadeFinished()&&this._removeTile(i):r.setSymbolHoldDuration(this.map._fadeDuration)}}_addTerrainIdealTiles(t){let i=[];for(let r of t)if(r.canonical.z>this._source.minzoom){let t=r.scaledTo(r.canonical.z-1);i.push(t);let a=r.scaledTo(Math.max(this._source.minzoom,Math.min(r.canonical.z,5)));i.push(a)}return t.concat(i)}releaseSymbolFadeTiles(){for(let t of this._inViewTiles.getAllIds())this._inViewTiles.getTileById(t).holdingForSymbolFade()&&this._removeTile(t)}_updateRetainedTiles(i,r){let a=new Set;for(let t of i)this._addTile(t).hasData()||a.add(t);let o=i.reduce((t,i)=>(t[i.key]=i,t),{}),s=this._retainLoadedChildren(o,a),n={},l=Math.max(r-t.maxUnderzooming,this._source.minzoom);for(let t of s){let i=this._inViewTiles.getTileById(t.key),r=i?.wasRequested();for(let a=t.overscaledZ-1;a>=l;--a){let s=t.scaledTo(a);if(n[s.key])break;if(n[s.key]=!0,(i=this.getTile(s))||!r||(i=this._addTile(s)),i){let t=i.hasData();if((t||!this.map?.cancelPendingTileRequestsWhileZooming||r)&&(o[s.key]=s),r=i.wasRequested(),t)break}}}return o}_addTile(t){let i=this._inViewTiles.getTileById(t.key);if(i)return i;(i=this._outOfViewCache.getAndRemove(t))&&(i.resetFadeLogic(),this._setTileReloadTimer(t.key,i),i.tileID=t,this._state.initializeTileState(i,this.map?this.map.painter:null));let r=i;
1return i||(i=new e3(t,this._source.tileSize*t.overscaleFactor()),this._loadTile(i,t.key,i.state,!1)),i.uses++,this._inViewTiles.setTile(t.key,i),r||this._source.fire(new N("dataloading",{tile:i,coord:i.tileID})),i}_setTileReloadTimer(t,i){this._clearTileReloadTimer(t);let r=i.getExpiryTimeout();if(r){let i=()=>{this._reloadTile(t,"expired"),delete this._timers[t]};this._timers[t]=setTimeout(i,r)}}_clearTileReloadTimer(t){let i=this._timers[t];i&&(clearTimeout(i),delete this._timers[t])}_resetTileReloadTimers(){for(let t in this._timers)clearTimeout(this._timers[t]),delete this._timers[t];for(let t of this._inViewTiles.getAllIds()){let i=this._inViewTiles.getTileById(t);this._setTileReloadTimer(t,i)}}refreshTiles(t){for(let i of this._inViewTiles.getAllIds()){let r=this._inViewTiles.getTileById(i);(this._inViewTiles.isIdRenderable(i)||"errored"==r.state)&&t.some(t=>t.equals(r.tileID.canonical))&&this._reloadTile(i,"expired")}}_removeTile(t){let i=this._inViewTiles.getTileById(t);i&&(i.uses--,this._inViewTiles.deleteTileById(t),this._clearTileReloadTimer(t),i.uses>0||(i.hasData()&&"reloading"!==i.state?this._outOfViewCache.add(i.tileID,i,i.getExpiryTimeout()):(i.aborted=!0,this._abortTile(i),this._unloadTile(i))))}_dataHandler(t){if("source"===t.dataType){if("metadata"===t.sourceDataType){this._sourceLoaded=!0;return}"content"===t.sourceDataType&&this._sourceLoaded&&!this._paused&&(this.reload(t.sourceDataChanged,t.shouldReloadTileOptions),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}}resetMaxContentElevation(){this._maxContentElevationSeen=0}clearTiles(){for(let t of(this._shouldReloadOnResume=!1,this._paused=!1,this.resetMaxContentElevation(),this._inViewTiles.getAllIds()))this._removeTile(t);this._outOfViewCache.reset()}tilesIn(t,i,r){let a=[],o=this.transform;if(!o)return a;let s=o.getCoveringTilesDetailsProvider().allowWorldCopies(),n=r?o.getCameraQueryGeometry(t):t,l=t=>o.screenPointToMercatorCoordinate(t,this.terrain),h=this.transformBbox(t,l,!s),c=this.transformBbox(n,l,!s),u=this.getIds(),d=P.pt.fromPoints(c);for(let t of u){let r=this._inViewTiles.getTileById(t);if(r.holdingForSymbolFade())continue;let n=s?[r.tileID]:[r.tileID.unwrapTo(-1),r.tileID.unwrapTo(0)],l=2**(o.zoom-r.tileID.overscaledZ),u=i*r.queryPadding*P.Lr/r.tileSize/l;for(let t of n){let i=d.map(i=>t.getTilePoint(new P.nt(i.x,i.y)));if(i.expandBy(u),i.intersects(P.ft)){let i=h.map(i=>t.getTilePoint(i)),o=c.map(i=>t.getTilePoint(i));a.push({tile:r,tileID:s?t:t.unwrapTo(0),queryGeometry:i,cameraQueryGeometry:o,scale:l})}}}return a}transformBbox(t,i,r){let a=t.map(i);if(r){let r=P.pt.fromPoints(t);r.shrinkBy(.001*Math.min(r.width(),r.height()));let o=r.map(i);P.pt.fromPoints(a).covers(o)||(a=a.map(t=>t.x>.5?new P.nt(t.x-1,t.y,t.z):t))}return a}getVisibleCoordinates(t){let i=this.getRenderableIds(t).map(t=>this._inViewTiles.getTileById(t).tileID);return this.transform&&this.transform.populateCache(i),i}hasTransition(){return!!this._source.hasTransition()||ta(this._source.type)&&function(t,i){if(i<=0)return!1;let r=S();for(let i of t.getAllTiles())if(i.fadeEndTime>=r)return!0;return!1}(this._inViewTiles,this._rasterFadeDuration)}setRasterFadeDuration(t){this._rasterFadeDuration=t}setFeatureState(t,i,r){t||=P.s,this._state.updateState(t,i,r)}removeFeatureState(t,i,r){t||=P.s,this._state.removeFeatureState(t,i,r)}getFeatureState(t,i){return t||=P.s,this._state.getState(t,i)}setDependencies(t,i,r){let a=this._inViewTiles.getTileById(t);a&&a.setDependencies(i,r)}reloadTilesForDependencies(t,i){for(let r of this._inViewTiles.getAllIds())this._inViewTiles.getTileById(r).hasDependency(t,i)&&this._reloadTile(r,"reloading");this._outOfViewCache.filter(r=>!r.hasDependency(t,i))}areTilesLoaded(){for(let t of this._inViewTiles.getAllTiles())if("loaded"!==t.state&&"errored"!==t.state)return!1;return!0}},th=class{constructor(t,i){this.reset(t,i)}reset(t,i){this.points=t||[],this._distances=[0];for(let t=1;t<this.points.length;t++)this._distances[t]=this._distances[t-1]+this.points[t].dist(this.points[t-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(i||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(t){if(1===this.points.length)return this.points[0];t=(0,P.Bn)(t,0,1);let i=1,r=this._distances[i],a=t*this.paddedLength+this.padding;
1for(;r<a&&i<this._distances.length;)r=this._distances[++i];let o=i-1,s=this._distances[o],n=r-s,l=n>0?(a-s)/n:0;return this.points[o].mult(1-l).add(this.points[i].mult(l))}};function tc(t,i,r,a,o){return o?t?t(i,r)+a:0===a?void 0:a:a}function tu(t,i){let r=!0;return"always"===t||("never"===t||"never"===i)&&(r=!1),r}var td=class{constructor(t,i,r){let a=this.boxCells=[],o=this.circleCells=[];this.xCellCount=Math.ceil(t/r),this.yCellCount=Math.ceil(i/r);for(let t=0;t<this.xCellCount*this.yCellCount;t++)a.push([]),o.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=t,this.height=i,this.xScale=this.xCellCount/t,this.yScale=this.yCellCount/i,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(t,i,r,a,o){this._forEachCell(i,r,a,o,this._insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(i),this.bboxes.push(r),this.bboxes.push(a),this.bboxes.push(o)}insertCircle(t,i,r,a){this._forEachCell(i-a,r-a,i+a,r+a,this._insertCircleCell,this.circleUid++),this.circleKeys.push(t),this.circles.push(i),this.circles.push(r),this.circles.push(a)}_insertBoxCell(t,i,r,a,o,s){this.boxCells[o].push(s)}_insertCircleCell(t,i,r,a,o,s){this.circleCells[o].push(s)}_query(t,i,r,a,o,s,n){if(r<0||t>this.width||a<0||i>this.height)return[];let l=[];if(t<=0&&i<=0&&this.width<=r&&this.height<=a){if(o)return[{key:null,x1:t,y1:i,x2:r,y2:a}];for(let t=0;t<this.boxKeys.length;t++)l.push({key:this.boxKeys[t],x1:this.bboxes[4*t],y1:this.bboxes[4*t+1],x2:this.bboxes[4*t+2],y2:this.bboxes[4*t+3]});for(let t=0;t<this.circleKeys.length;t++){let i=this.circles[3*t],r=this.circles[3*t+1],a=this.circles[3*t+2];l.push({key:this.circleKeys[t],x1:i-a,y1:r-a,x2:i+a,y2:r+a})}}else this._forEachCell(t,i,r,a,this._queryCell,l,{hitTest:o,overlapMode:s,seenUids:{box:{},circle:{}}},n);return l}query(t,i,r,a){return this._query(t,i,r,a,!1,null)}hitTest(t,i,r,a,o,s){return this._query(t,i,r,a,!0,o,s).length>0}hitTestCircle(t,i,r,a,o){let s=t-r,n=t+r,l=i-r,h=i+r;if(n<0||s>this.width||h<0||l>this.height)return!1;let c=[];return this._forEachCell(s,l,n,h,this._queryCellCircle,c,{hitTest:!0,overlapMode:a,circle:{x:t,y:i,radius:r},seenUids:{box:{},circle:{}}},o),c.length>0}_queryCell(t,i,r,a,o,s,n,l){let{seenUids:h,hitTest:c,overlapMode:u}=n,d=this.boxCells[o];if(null!==d){let o=this.bboxes;for(let n of d)if(!h.box[n]){h.box[n]=!0;let d=4*n,_=this.boxKeys[n];if(t<=o[d+2]+1e-6&&i<=o[d+3]+1e-6&&r>=o[d+0]-1e-6&&a>=o[d+1]-1e-6&&(!l||l(_))&&(!c||!tu(u,_.overlapMode))&&(s.push({key:_,x1:o[d],y1:o[d+1],x2:o[d+2],y2:o[d+3]}),c))return!0}}let _=this.circleCells[o];if(null!==_){let o=this.circles;for(let n of _)if(!h.circle[n]){h.circle[n]=!0;let d=3*n,_=this.circleKeys[n];if(this._circleAndRectCollide(o[d],o[d+1],o[d+2],t,i,r,a)&&(!l||l(_))&&(!c||!tu(u,_.overlapMode))){let t=o[d],i=o[d+1],r=o[d+2];if(s.push({key:_,x1:t-r,y1:i-r,x2:t+r,y2:i+r}),c)return!0}}}return!1}_queryCellCircle(t,i,r,a,o,s,n,l){let{circle:h,seenUids:c,overlapMode:u}=n,d=this.boxCells[o];if(null!==d){let t=this.bboxes;for(let i of d)if(!c.box[i]){c.box[i]=!0;let r=4*i,a=this.boxKeys[i];if(this._circleAndRectCollide(h.x,h.y,h.radius,t[r+0],t[r+1],t[r+2],t[r+3])&&(!l||l(a))&&!tu(u,a.overlapMode))return s.push(!0),!0}}let _=this.circleCells[o];if(null!==_){let t=this.circles;for(let i of _)if(!c.circle[i]){c.circle[i]=!0;let r=3*i,a=this.circleKeys[i];if(this._circlesCollide(t[r],t[r+1],t[r+2],h.x,h.y,h.radius)&&(!l||l(a))&&!tu(u,a.overlapMode))return s.push(!0),!0}}}_forEachCell(t,i,r,a,o,s,n,l){let h=this._convertToXCellCoord(t),c=this._convertToYCellCoord(i),u=this._convertToXCellCoord(r),d=this._convertToYCellCoord(a);for(let _=h;_<=u;_++)for(let h=c;h<=d;h++){let c=this.xCellCount*h+_;if(o.call(this,t,i,r,a,c,s,n,l))return}}_convertToXCellCoord(t){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(t*this.xScale)))}_convertToYCellCoord(t){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(t*this.yScale)))}_circlesCollide(t,i,r,a,o,s){let n=a-t,l=o-i,h=r+s;return h*h>n*n+l*l}_circleAndRectCollide(t,i,r,a,o,s,n){let l=(s-a)/2,h=Math.abs(t-(a+l));if(h>l+r)return!1;let c=(n-o)/2,u=Math.abs(i-(o+c));if(u>c+r)return!1;if(h<=l||u<=c)return!0;let d=h-l,_=u-c;return d*d+_*_<=r*r}};let t_=(0,P.vi)();function tp(t,i,r){let a=(0,P.vi)();if(!t){var o,s,n,l,h;let{vecSouth:t,vecEast:r}=tm(i),c=M();c[0]=r[0],c[1]=r[1],c[2]=t[0],c[3]=t[1],o=c[0],s=c[1],n=c[2],(h=o*(l=c[3])-n*s)&&(h=1/h,c[0]=l*h,c[1]=-s*h,c[2]=-n*h,c[3]=o*h),a[0]=c[0],a[1]=c[1],a[4]=c[2],a[5]=c[3]}return(0,P.Ai)(a,a,[1/r,1/r,1]),a}function tm(t){let i=Math.cos(t.rollInRadians),r=Math.sin(t.rollInRadians),a=Math.cos(t.pitchInRadians),o=Math.cos(t.bearingInRadians),s=Math.sin(t.bearingInRadians),n=(0,P.Rr)();n[0]=-o*a*r-s*i,n[1]=-s*a*r+o*i;let l=(0,P.zr)(n);l<1e-9?(0,P.Hr)(n):(0,P.Br)(n,n,1/l);let h=(0,P.Rr)();h[0]=o*a*i-s*r,h[1]=s*a*i+o*r;
1let c=(0,P.zr)(h);return c<1e-9?(0,P.Hr)(h):(0,P.Br)(h,h,1/c),{vecEast:h,vecSouth:n}}function tf(t,i,r){return tc(t.getElevation,i,r,t.heightOffset??0,t.heightAnchorGround??!0)}function tg(t,i,r,a){let o;null==a?tz(o=[t,i,0,1],o,r):(o=[t,i,a,1],(0,P.Yr)(o,o,r));let s=o[3];return{point:new P.Li(o[0]/s,o[1]/s),signedDistanceFromCamera:s,isOccluded:!1}}function tv(t,i,r,a,o,s,n,l){let h=s.glyphStartIndex+s.numGlyphs,c=s.lineStartIndex,u=s.lineStartIndex+s.lineLength,d=i.getoffsetX(s.glyphStartIndex),_=i.getoffsetX(h-1),p=tI(t*d,r,a,o,s.segment,c,u,l,n);if(!p)return null;let m=tI(t*_,r,a,o,s.segment,c,u,l,n);return!m||l.projectionCache.anyProjectionOccluded?null:{first:p,last:m}}function ty(t,i,r,a){return 1===t&&Math.abs(r.y-i.y)>Math.abs(r.x-i.x)*a?{useVertical:!0}:(2===t?i.y<r.y:i.x>r.x)?{needsFlipping:!0}:null}function tx(t){let{projectionContext:i,pitchedLabelPlaneMatrixInverse:r,symbol:a,fontSize:o,flip:s,keepUpright:n,glyphOffsetArray:l,dynamicLayoutVertexArray:h,aspectRatio:c,rotateToLine:u}=t,d=o/24,_=a.lineOffsetX*d,p=a.lineOffsetY*d,m;if(a.numGlyphs>1){let t=a.glyphStartIndex+a.numGlyphs,o=a.lineStartIndex,h=a.lineStartIndex+a.lineLength,f=tv(d,l,_,p,s,a,u,i);if(!f)return{notEnoughRoom:!0};let g=tP(f.first.point.x,f.first.point.y,i,r),v=tP(f.last.point.x,f.last.point.y,i,r);if(n&&!s){let t=ty(a.writingMode,g,v,c);if(t)return t}m=[f.first];for(let r=a.glyphStartIndex+1;r<t-1;r++){let t=tI(d*l.getoffsetX(r),_,p,s,a.segment,o,h,i,u);if(!t)return{notEnoughRoom:!0};m.push(t)}m.push(f.last)}else{if(n&&!s){let t=tT(i.tileAnchorPoint.x,i.tileAnchorPoint.y,i).point,o=a.lineStartIndex+a.segment+1,s=new P.Li(i.lineVertexArray.getx(o),i.lineVertexArray.gety(o)),n=tT(s.x,s.y,i),l=n.signedDistanceFromCamera>0?n.point:tb(i.tileAnchorPoint,s,t,1,i),h=tP(t.x,t.y,i,r),u=tP(l.x,l.y,i,r),d=ty(a.writingMode,h,u,c);if(d)return d}let t=tI(d*l.getoffsetX(a.glyphStartIndex),_,p,s,a.segment,a.lineStartIndex,a.lineStartIndex+a.lineLength,i,u);if(!t||i.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};m=[t]}for(let t of m)(0,P.C)(h,t.point,t.angle);return{}}function tb(t,i,r,a,o){let s=t.add(t.sub(i)._unit()),n=tT(s.x,s.y,o).point,l=r.sub(n);return r.add(l._mult(a/l.mag()))}function tw(t,i,r){let a=i.projectionCache;if(a.projections[t])return a.projections[t];let o=new P.Li(i.lineVertexArray.getx(t),i.lineVertexArray.gety(t)),s=tT(o.x,o.y,i);if(s.signedDistanceFromCamera>0)return a.projections[t]=s.point,a.anyProjectionOccluded||=s.isOccluded,s.point;let n=t-r.direction,l=0===r.distanceFromAnchor?i.tileAnchorPoint:new P.Li(i.lineVertexArray.getx(n),i.lineVertexArray.gety(n)),h=r.absOffsetX-r.distanceFromAnchor+1;return tb(l,o,r.previousVertex,h,i)}function tT(t,i,r){let a=t+r.translation[0],o=i+r.translation[1],s;return r.pitchWithMap?(s=tg(a,o,r.pitchedLabelPlaneMatrix,tf(r,a,o))).isOccluded=!1:((s=r.transform.projectTileCoordinates(a,o,r.unwrappedTileID,tf(r,a,o))).point.x=(.5*s.point.x+.5)*r.width,s.point.y=(-(.5*s.point.y)+.5)*r.height),s}function tP(t,i,r,a){if(r.pitchWithMap){let o=[t,i,0,1];(0,P.Yr)(o,o,a);let s=o[0]/o[3],n=o[1]/o[3];return r.transform.projectTileCoordinates(s,n,r.unwrappedTileID,tf(r,s,n)).point}return{x:t/r.width*2-1,y:1-i/r.height*2}}function tM(t,i,r){return r.transform.projectTileCoordinates(t,i,r.unwrappedTileID,tf(r,t,i))}function tC(t,i,r){return t._unit()._perp()._mult(i*r)}function tI(t,i,r,a,o,s,n,l,h){let c=a?t-i:t+i,u=c>0?1:-1,d=0;a&&(u*=-1,d=Math.PI),u<0&&(d+=Math.PI);let _=u>0?s+o:s+o+1,p;l.projectionCache.cachedAnchorPoint?p=l.projectionCache.cachedAnchorPoint:(p=tT(l.tileAnchorPoint.x,l.tileAnchorPoint.y,l).point,l.projectionCache.cachedAnchorPoint=p);let m=p,f=p,g,v,y=0,x=0,b=Math.abs(c),w=[],T;for(;y+x<=b;){if((_+=u)<s||_>=n)return null;y+=x,f=m,v=g;let t={absOffsetX:b,direction:u,distanceFromAnchor:y,previousVertex:f};if(m=tw(_,l,t),0===r)w.push(f),T=m.sub(f);else{let i,a=m.sub(f);i=0===a.mag()?tC(tw(_+u,l,t).sub(m),r,u):tC(a,r,u),v||=f.add(i),g=function(t,i,r,a,o,s,n,l,h){if(l.projectionCache.offsets[t])return l.projectionCache.offsets[t];let c=r.add(i);if(t+h.direction<a||t+h.direction>=o)return l.projectionCache.offsets[t]=c,c;let u=tw(t+h.direction,l,h),d=tC(u.sub(r),n,h.direction),_=r.add(d),p=u.add(d);return l.projectionCache.offsets[t]=(0,P.nr)(s,c,_,p)||c,l.projectionCache.offsets[t]}(_,i,m,s,n,v,r,l,t),w.push(v),T=g.sub(v)}x=T.mag()}let M=(b-y)/x,C=T._mult(M)._add(v||f),I=d+Math.atan2(m.y-f.y,m.x-f.x);return w.push(C),{point:C,angle:h?I:0,path:w}}let tS=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function tE(t,i){for(let r=0;r<t;r++){let t=i.length;i.resize(t+4),i.float32.set(tS,3*t)}}function tz(t,i,r){let a=i[0],o=i[1];return t[0]=r[0]*a+r[4]*o+r[12],t[1]=r[1]*a+r[5]*o+r[13],t[3]=r[3]*a+r[7]*o+r[15],t}var tR=class{constructor(t,i=new td(t.width+200,t.height+200,25),r=new td(t.width+200,t.height+200,25)){this.transform=t,this.grid=i,this.ignoredGrid=r,this.pitchFactor=Math.cos(t.pitch*Math.PI/180)*t.cameraToCenterDistance,this.screenRightBoundary=t.width+100,this.screenBottomBoundary=t.height+100,this.gridRightBoundary=t.width+200,this.gridBottomBoundary=t.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(t,i,r,a,o,s,n,l,h,c,u,d,_=0,p=!0){let m=t.anchorPointX+l[0],f=t.anchorPointY+l[1],g=this.projectAndGetPerspectiveRatio(m,f,o,tc(c,m,f,_,p),d),v=r*g.perspectiveRatio,y;if(s||n)y=this._projectCollisionBox(t,v,a,o,s,n,l,g,c,u,d,_,p);else{let i=g.x+(u?u.x*v:0),r=g.y+(u?u.y*v:0);y={allPointsOccluded:!1,box:[i+t.x1*v,r+t.y1*v,i+t.x2*v,r+t.y2*v]}}let[x,b,w,T]=y.box,P=s?y.allPointsOccluded:g.isOccluded,M=P;return M||=g.perspectiveRatio<this.perspectiveRatioCutoff,(M||=!this.isInsideGrid(x,b,w,T))||"always"!==i&&this.grid.hitTest(x,b,w,T,i,h)?{box:[x,b,w,T],placeable:!1,offscreen:!1,occluded:P}:{box:[x,b,w,T],placeable:!0,offscreen:this.isOffscreen(x,b,w,T),occluded:P}}placeCollisionCircles(t,i,r,a,o,s,n,l,h,c,u,d,_,p){let m=[],f=new P.Li(i.anchorX,i.anchorY),g=this.getPerspectiveRatio(f.x,f.y,s,p?.(f.x,f.y)),v=(h?o*this.transform.getPitchedTextCorrection(i.anchorX,i.anchorY,s)/g:o*g)/24,y=i.lineOffsetX*v,x=i.lineOffsetY*v,b={getElevation:p,pitchedLabelPlaneMatr
1ix:n,lineVertexArray:r,pitchWithMap:h,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:this.transform,tileAnchorPoint:f,unwrappedTileID:s,width:this.transform.width,height:this.transform.height,translation:_},w=tv(v,a,y,x,!1,i,!1,b),T=!1,M=!1,C=!0;if(w){let i=.5*u*g+d,r=new P.Li(-100,-100),a=new P.Li(this.screenRightBoundary,this.screenBottomBoundary),o=new th,s=w.first,n=w.last,_=[];for(let t=s.path.length-1;t>=1;t--)_.push(s.path[t]);for(let t=1;t<n.path.length;t++)_.push(n.path[t]);let p=2.5*i;if(h){let t=this.projectPathToScreenSpace(_,b);_=t.some(t=>t.signedDistanceFromCamera<=0)?[]:t.map(t=>t.point)}let f=[];if(_.length>0){let t=_[0].clone(),i=_[0].clone();for(let r=1;r<_.length;r++)t.x=Math.min(t.x,_[r].x),t.y=Math.min(t.y,_[r].y),i.x=Math.max(i.x,_[r].x),i.y=Math.max(i.y,_[r].y);f=t.x>=r.x&&i.x<=a.x&&t.y>=r.y&&i.y<=a.y?[_]:i.x<r.x||t.x>a.x||i.y<r.y||t.y>a.y?[]:(0,P.O)([_],r.x,r.y,a.x,a.y)}for(let r of f){o.reset(r,.25*i);let a=0;a=o.length<=.5*i?1:Math.ceil(o.paddedLength/p)+1;for(let r=0;r<a;r++){let s=r/Math.max(a-1,1),n=o.lerp(s),h=n.x+100,u=n.y+100;m.push(h,u,i,0);let d=h-i,_=u-i,p=h+i,f=u+i;if(C&&=this.isOffscreen(d,_,p,f),M||=this.isInsideGrid(d,_,p,f),"always"!==t&&this.grid.hitTestCircle(h,u,i,t,c)&&(T=!0,!l))return{circles:[],offscreen:!1,collisionDetected:T}}}}return{circles:!l&&T||!M||g<this.perspectiveRatioCutoff?[]:m,offscreen:C,collisionDetected:T}}projectPathToScreenSpace(t,i){var r;let a;return function(t){let i=0,r=0,a=0,o=0;for(let s=0;s<t.length;s++)t[s].isOccluded?(a=s+1,o=0):++o>r&&(r=o,i=a);return t.slice(i,i+r)}((a=1/((r=i.pitchedLabelPlaneMatrix)[0]*r[5]-r[1]*r[4]),t_[0]=r[5]*a,t_[1]=-r[1]*a,t_[2]=0,t_[3]=0,t_[4]=-r[4]*a,t_[5]=r[0]*a,t_[6]=0,t_[7]=0,t_[8]=0,t_[9]=0,t_[10]=1/r[10],t_[11]=0,t_[12]=0,t_[13]=0,t_[14]=0,t_[15]=1/r[15],t.map(t=>{let r=tg(t.x,t.y,t_,tf(i,t.x,t.y)),a=i.transform.projectTileCoordinates(r.point.x,r.point.y,i.unwrappedTileID,tf(i,r.point.x,r.point.y));return a.point.x=(.5*a.point.x+.5)*i.width,a.point.y=(-(.5*a.point.y)+.5)*i.height,a})))}queryRenderedSymbols(t){if(0===t.length||0===this.grid.keysLength()&&0===this.ignoredGrid.keysLength())return{};let i=[],r=new P.pt;for(let a of t){let t=new P.Li(a.x+100,a.y+100);r.extend(t),i.push(t)}let{minX:a,minY:o,maxX:s,maxY:n}=r,l=this.grid.query(a,o,s,n).concat(this.ignoredGrid.query(a,o,s,n)),h={},c={};for(let t of l){let r=t.key;if(void 0===h[r.bucketInstanceId]&&(h[r.bucketInstanceId]={}),h[r.bucketInstanceId][r.featureIndex])continue;let a=[new P.Li(t.x1,t.y1),new P.Li(t.x2,t.y1),new P.Li(t.x2,t.y2),new P.Li(t.x1,t.y2)];(0,P.kt)(i,a)&&(h[r.bucketInstanceId][r.featureIndex]=!0,void 0===c[r.bucketInstanceId]&&(c[r.bucketInstanceId]=[]),c[r.bucketInstanceId].push(r.featureIndex))}return c}insertCollisionBox(t,i,r,a,o,s){(r?this.ignoredGrid:this.grid).insert({bucketInstanceId:a,featureIndex:o,collisionGroupID:s,overlapMode:i},t[0],t[1],t[2],t[3])}insertCollisionCircles(t,i,r,a,o,s){let n=r?this.ignoredGrid:this.grid,l={bucketInstanceId:a,featureIndex:o,collisionGroupID:s,overlapMode:i};for(let i=0;i<t.length;i+=4)n.insertCircle(l,t[i],t[i+1],t[i+2])}projectAndGetPerspectiveRatio(t,i,r,a,o){if(o){let r;null==a?tz(r=[t,i,0,1],r,o):(r=[t,i,a,1],(0,P.Yr)(r,r,o));let s=r[3];return{x:(r[0]/s+1)/2*this.transform.width+100,y:(-r[1]/s+1)/2*this.transform.height+100,perspectiveRatio:.5+.5*(this.transform.cameraToCenterDistance/s),isOccluded:!1,signedDistanceFromCamera:s}}{let o=this.transform.projectTileCoordinates(t,i,r,a);return{x:(o.point.x+1)/2*this.transform.width+100,y:(-o.point.y+1)/2*this.transform.height+100,perspectiveRatio:.5+.5*(this.transform.cameraToCenterDistance/o.signedDistanceFromCamera),isOccluded:o.isOccluded,signedDistanceFromCamera:o.signedDistanceFromCamera}}}getPerspectiveRatio(t,i,r,a){let o=this.transform.projectTileCoordinates(t,i,r,a);return .5+.5*(this.transform.cameraToCenterDistance/o.signedDistanceFromCamera)}isOffscreen(t,i,r,a){return r<100||t>=this.screenRightBoundary||a<100||i>this.screenBottomBoundary}isInsideGrid(t,i,r,a){return r>=0&&t<this.gridRightBoundary&&a>=0&&i<this.gridBottomBoundary}getViewportMatrix(){let t=(0,P.Si)([]);return(0,P.ji)(t,t,[-100,-100,0]),t}_projectCollisionBox(t,i,r,a,o,s,n,l,h,c,u,d=0,_=!0){let p=1,m=0,f=0,g=1,v=t.anchorPointX+n[0],y=t.anchorPointY+n[1];if(s&&!o){let t=this.projectAndGetPerspectiveRatio(v+1,y,a,tc(h,v+1,y,d,_),u),i=t.x-l.x,r=Math.atan((t.y-l.y)/i)+(i<0?Math.PI:0),o=Math.sin(r),s=Math.cos(r);p=s,m=o,f=-o,g=s}else if(!s&&o){let t=tm(this.transform);p=t.vecEast[0],m=t.vecEast[1],f=t.vecSouth[0],g=t.vecSouth[1]}let x=l.x,b=l.y,w=i;
1if(o&&(x=v,b=y,w=2**-(this.transform.zoom-r.overscaledZ)*this.transform.getPitchedTextCorrection(v,y,a),!c)){let t=l.signedDistanceFromCamera/this.transform.cameraToCenterDistance;w*=(0,P.Bn)(.5+.5*t,0,4)}c&&(x+=p*c.x*w+f*c.y*w,b+=m*c.x*w+g*c.y*w);let T=t.x1*w,M=t.x2*w,C=(T+M)/2,I=t.y1*w,S=t.y2*w,E=(I+S)/2,z=[];for(let{offsetX:t,offsetY:i}of[{offsetX:T,offsetY:I},{offsetX:C,offsetY:I},{offsetX:M,offsetY:I},{offsetX:M,offsetY:E},{offsetX:M,offsetY:S},{offsetX:C,offsetY:S},{offsetX:T,offsetY:S},{offsetX:T,offsetY:E}])z.push(new P.Li(x+p*t+f*i,b+m*t+g*i));let R=!1;if(o){let t=z.map(t=>this.projectAndGetPerspectiveRatio(t.x,t.y,a,tc(h,t.x,t.y,d,_),u));R=t.some(t=>!t.isOccluded),z=t.map(t=>new P.Li(t.x,t.y))}else R=!0;return{box:(0,P.rr)(z),allPointsOccluded:!R}}},tD=class{constructor(t,i,r,a){this.opacity=t?Math.max(0,Math.min(1,t.opacity+(t.placed?i:-i))):a&&r?1:0,this.placed=r}isHidden(){return 0===this.opacity&&!this.placed}},tL=class{constructor(t,i,r,a,o){this.text=new tD(t?t.text:null,i,r,o),this.icon=new tD(t?t.icon:null,i,a,o)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}},tA=class{constructor(t,i,r){this.text=t,this.icon=i,this.skipFade=r}},tF=class{constructor(t,i,r,a,o){this.bucketInstanceId=t,this.featureIndex=i,this.sourceLayerIndex=r,this.bucketIndex=a,this.tileID=o}},tk=class{constructor(t){this.crossSourceCollisions=t,this.maxGroupID=0,this.collisionGroups={}}get(t){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[t]){let i=++this.maxGroupID;this.collisionGroups[t]={ID:i,predicate:t=>t.collisionGroupID===i}}return this.collisionGroups[t]}};function tB(t,i,r,a,o){let{horizontalAlign:s,verticalAlign:n}=(0,P.M)(t);return new P.Li(-(s-.5)*i+a[0]*o,-(n-.5)*r+a[1]*o)}var tO=class{constructor(t,i,r,a,o){this.transform=t.clone(),this.terrain=i,this.collisionIndex=new tR(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=r,this.retainedQueryData={},this.collisionGroups=new tk(a),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=o,o&&(o.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(t){let i=this.terrain;if(i)return(r,a)=>i.getElevation(t,r,a)}getBucketParts(t,i,r,a){let o=r.getBucket(i),s=r.latestFeatureIndex;if(!o||!s||i.id!==o.layerIds[0])return;let n=r.collisionBoxArray,l=o.layers[0].layout,h=o.layers[0].paint,c=2**(this.transform.zoom-r.tileID.overscaledZ),u=r.tileSize/P.Lr,d=r.tileID.toUnwrapped(),_="map"===l.get("text-rotation-alignment"),p=(0,P.Ir)(r,1,this.transform.zoom),m=(0,P.jr)(this.collisionIndex.transform,r,h.get("text-translate"),h.get("text-translate-anchor")),f=(0,P.jr)(this.collisionIndex.transform,r,h.get("icon-translate"),h.get("icon-translate-anchor")),g=tp(_,this.transform,p);this.retainedQueryData[o.bucketInstanceId]=new tF(o.bucketInstanceId,s,o.sourceLayerIndex,o.index,r.tileID);let v={bucket:o,layout:l,translationText:m,translationIcon:f,unwrappedTileID:d,pitchedLabelPlaneMatrix:g,scale:c,textPixelRatio:u,holdingForFade:r.holdingForSymbolFade(),collisionBoxArray:n,partiallyEvaluatedTextSize:(0,P.A)(o.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(o.sourceID)};if(a)for(let i of o.sortKeyRanges){let{sortKey:r,symbolInstanceStart:a,symbolInstanceEnd:o}=i;t.push({sortKey:r,symbolInstanceStart:a,symbolInstanceEnd:o,parameters:v})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:o.symbolInstances.length,parameters:v})}attemptAnchorPlacement(t,i,r,a,o,s,n,l,h,c,u,d,_,p,m,f,g,v,y,x,b,w){let T=P.E[t.textAnchor],M=[t.textOffset0,t.textOffset1],C=tB(T,r,a,M,o),I=this.collisionIndex.placeCollisionBox(i,d,l,h,c,n,s,f,u.predicate,y,C,x,b,w);if((!v||this.collisionIndex.placeCollisionBox(v,d,l,h,c,n,s,g,u.predicate,y,C,x,b,w).placeable)&&I.placeable){let t;if(this.prevPlacement?.variableOffsets[_.crossTileID]&&this.prevPlacement?.placements[_.crossTileID]?.text&&(t=this.prevPlacement.variableOffsets[_.crossTileID].anchor),0===_.crossTileID)throw Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[_.crossTileID]={textOffset:M,width:r,height:a,anchor:T,textBoxScale:o,prevAnchor:t},this.markUsedJustification(p,T,_,m),p.allowVerticalPlacement&&(this.markUsedOrientation(p,m,_),this.placedOrientations[_.crossTileID]=m),{shift:C,placedGlyphBoxes:I}}}placeLayerBucketPart(t,i,r){let{bucket:a,layout:o,translationText:s,translationIcon:n,unwrappedTileID:l,pitchedLabelPlaneMatr
1ix:h,textPixelRatio:c,holdingForFade:u,collisionBoxArray:d,partiallyEvaluatedTextSize:_,collisionGroup:p}=t.parameters,m=o.get("text-optional"),f=o.get("icon-optional"),g=(0,P.w)(o,"text-overlap","text-allow-overlap"),v="always"===g,y=(0,P.w)(o,"icon-overlap","icon-allow-overlap"),x="always"===y,b="map"===o.get("text-rotation-alignment"),w="map"===o.get("text-pitch-alignment"),T="none"!==o.get("icon-text-fit"),M="viewport-y"===o.get("symbol-z-order"),C="ground"===o.get("symbol-height-anchor"),I=v&&(x||!a.hasIconData()||f),S=x&&(v||!a.hasTextData()||m);!a.collisionArrays&&d&&a.deserializeCollisionBoxes(d);let E=this.retainedQueryData[a.bucketInstanceId].tileID,z=this._getTerrainElevationFunc(E),R=this.transform.getFastPathSimpleProjectionMatrix(E),D=(t,d,x)=>{if(i[t.crossTileID])return;if(u){this.placements[t.crossTileID]=new tA(!1,!1,!1);return}let M=t.heightOffset,D=!1,L=!1,A=!0,F=null,k={box:null,placeable:!1,offscreen:null,occluded:!1},B={box:null,placeable:!1,offscreen:null},O=null,j=null,N=null,Z=0,U=0,G=0;d.textFeatureIndex?Z=d.textFeatureIndex:t.useRuntimeCollisionCircles&&(Z=t.featureIndex),d.verticalTextFeatureIndex&&(U=d.verticalTextFeatureIndex);let V=d.textBox;if(V){let i=i=>{let r=1;if(a.allowVerticalPlacement&&!i&&this.prevPlacement){let i=this.prevPlacement.placedOrientations[t.crossTileID];i&&(this.placedOrientations[t.crossTileID]=i,r=i,this.markUsedOrientation(a,r,t))}return r},o=(i,r)=>{if(a.allowVerticalPlacement&&t.numVerticalGlyphVertices>0&&d.verticalTextBox){for(let t of a.writingModes)if(2===t?B=k=r():k=i(),k?.placeable)break}else k=i()},h=t.textAnchorOffsetStartIndex,u=t.textAnchorOffsetEndIndex;if(u===h){let r=(i,r)=>{let o=this.collisionIndex.placeCollisionBox(i,g,c,E,l,w,b,s,p.predicate,z,void 0,R,M,C);return o?.placeable&&(this.markUsedOrientation(a,r,t),this.placedOrientations[t.crossTileID]=r),o};o(()=>r(V,1),()=>{let i=d.verticalTextBox;return a.allowVerticalPlacement&&t.numVerticalGlyphVertices>0&&i?r(i,2):{box:null,offscreen:null}}),i(k?.placeable)}else{let _=P.E[this.prevPlacement?.variableOffsets[t.crossTileID]?.anchor],m=(i,o,d)=>{let m=i.x2-i.x1,f=i.y2-i.y1,v=t.textBoxScale,x=T&&"never"===y?o:null,P=null,I="never"===g?1:2,S="never";_&&I++;for(let r=0;r<I;r++){for(let r=h;r<u;r++){let o=a.textAnchorOffsets.get(r);if(_&&o.textAnchor!==_)continue;let h=this.attemptAnchorPlacement(o,i,m,f,v,b,w,c,E,l,p,S,t,a,d,s,n,x,z,R,M,C);if(h&&(P=h.placedGlyphBoxes,P?.placeable))return D=!0,F=h.shift,P}_?_=null:S=g}return r&&!P&&(P={box:this.collisionIndex.placeCollisionBox(V,"always",c,E,l,w,b,s,p.predicate,z,void 0,R,M,C).box,offscreen:!1,placeable:!1,occluded:!1}),P};o(()=>m(V,d.iconBox,1),()=>{let i=d.verticalTextBox,r=k?.placeable;return a.allowVerticalPlacement&&!r&&t.numVerticalGlyphVertices>0&&i?m(i,d.verticalIconBox,2):{box:null,occluded:!0,offscreen:null}}),k&&(D=k.placeable,A=k.offscreen);let f=i(k?.placeable);if(!D&&this.prevPlacement){let i=this.prevPlacement.variableOffsets[t.crossTileID];i&&(this.variableOffsets[t.crossTileID]=i,this.markUsedJustification(a,i.anchor,t,f))}}}if(O=k,D=O?.placeable,A=O?.offscreen,t.useRuntimeCollisionCircles&&t.centerJustifiedTextSymbolIndex>=0){let i=a.text.placedSymbolArray.get(t.centerJustifiedTextSymbolIndex),n=(0,P.k)(a.textSizeData,_,i),c=o.get("text-padding"),u=t.collisionCircleDiameter;(j=this.collisionIndex.placeCollisionCircles(g,i,a.lineVertexArray,a.glyphOffsetArray,n,l,h,r,w,p.predicate,u,c,s,z)).circles.length&&j.collisionDetected&&!r&&(0,P.Nr)("Collisions detected, but collision boxes are not shown"),D=v||j.circles.length>0&&!j.collisionDetected,A&&=j.offscreen}if(d.iconFeatureIndex&&(G=d.iconFeatureIndex),d.iconBox){let t=t=>this.collisionIndex.placeCollisionBox(t,y,c,E,l,w,b,n,p.predicate,z,T&&F?F:void 0,R,M,C);L=B&&B.placeable&&d.verticalIconBox?(N=t(d.verticalIconBox)).placeable:(N=t(d.iconBox)).placeable,A&&=N.offscreen}let q=m||0===t.numHorizontalGlyphVertices&&0===t.numVerticalGlyphVertices,W=f||0===t.numIconVertices;q||W?W?q||(L&&=D):D=L&&D:L=D=L&&D;let $=D&&O.placeable,H=L&&N.placeable;if($&&(B&&B.placeable&&U?this.collisionIndex.insertCollisionBox(O.box,g,o.get("text-ignore-placement"),a.bucketInstanceId,U,p.ID):this.collisionIndex.insertCollisionBox(O.box,g,o.get("text-ignore-placement"),a.bucketInstanceId,Z,p.ID)),H&&this.collisionIndex.insertCollisionBox(N.box,y,o.get("icon-ignore-placement"),a.bucketInstanceId,G,p.ID),j&&D&&this.collisionIndex.insertCollisionCircles(j.circles,g,o.get("text-ignore-placement"),a.bucketInstanceId,Z,p.ID),r&&this.storeCollisionData(a.bucketInstanceId,x,d,O,N,j),0===t.crossTileID)throw Error("symbolInstance.crossTileID can't be 0");if(0===a.bucketInstanceId)throw Error("bucket.bucketInstanceId can't be 0");let X=(D||I)&&!O?.occluded,Y=(L||S)&&!N?.occluded;this.placements[t.crossTileID]=new tA(X,Y,A||a.justReloaded),i[t.crossTileID]=!0};if(M){if(0!==t.symbolInstanceStart)throw Error("bucket.bucketInstanceId should be 0");
1let i=a.getSortedSymbolIndexes(-this.transform.bearingInRadians);for(let t=i.length-1;t>=0;--t){let r=i[t];D(a.symbolInstances.get(r),a.collisionArrays[r],r)}}else for(let i=t.symbolInstanceStart;i<t.symbolInstanceEnd;i++)D(a.symbolInstances.get(i),a.collisionArrays[i],i);a.justReloaded=!1}storeCollisionData(t,i,r,a,o,s){if(r.textBox||r.iconBox){let s,n;this.collisionBoxArrays.has(t)?s=this.collisionBoxArrays.get(t):(s=new Map,this.collisionBoxArrays.set(t,s)),s.has(i)?n=s.get(i):(n={text:null,icon:null},s.set(i,n)),r.textBox&&(n.text=a.box),r.iconBox&&(n.icon=o.box)}if(s){let i=this.collisionCircleArrays[t];void 0===i&&(i=this.collisionCircleArrays[t]=[]);for(let t=0;t<s.circles.length;t+=4)i.push(s.circles[t+0]-100),i.push(s.circles[t+1]-100),i.push(s.circles[t+2]),i.push(+!!s.collisionDetected)}}markUsedJustification(t,i,r,a){let o={left:r.leftJustifiedTextSymbolIndex,center:r.centerJustifiedTextSymbolIndex,right:r.rightJustifiedTextSymbolIndex},s;for(let n of(s=2===a?r.verticalPlacedTextSymbolIndex:o[(0,P.T)(i)],[r.leftJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.rightJustifiedTextSymbolIndex,r.verticalPlacedTextSymbolIndex]))n>=0&&(s>=0&&n!==s?t.text.placedSymbolArray.get(n).crossTileID=0:t.text.placedSymbolArray.get(n).crossTileID=r.crossTileID)}markUsedOrientation(t,i,r){let a=1===i||3===i?i:0;for(let i of[r.leftJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.rightJustifiedTextSymbolIndex])t.text.placedSymbolArray.get(i).placedOrientation=a;r.verticalPlacedTextSymbolIndex&&(t.text.placedSymbolArray.get(r.verticalPlacedTextSymbolIndex).placedOrientation=2===i?i:0)}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;let i=this.prevPlacement,r=!1;this.prevZoomAdjustment=i?i.zoomAdjustment(this.transform.zoom):0;let a=i?i.symbolFadeChange(t):1,o=i?i.opacities:{},s=i?i.variableOffsets:{},n=i?i.placedOrientations:{};for(let t in this.placements){let i=this.placements[t],s=o[t];s?(this.opacities[t]=new tL(s,a,i.text,i.icon),r||=i.text!==s.text.placed,r||=i.icon!==s.icon.placed):(this.opacities[t]=new tL(null,a,i.text,i.icon,i.skipFade),r||=i.text||i.icon)}for(let t in o){let i=o[t];if(!this.opacities[t]){let o=new tL(i,a,!1,!1);o.isHidden()||(this.opacities[t]=o,r||=i.text.placed,r||=i.icon.placed)}}for(let t in s)this.variableOffsets[t]||!this.opacities[t]||this.opacities[t].isHidden()||(this.variableOffsets[t]=s[t]);for(let t in n)this.placedOrientations[t]||!this.opacities[t]||this.opacities[t].isHidden()||(this.placedOrientations[t]=n[t]);if(i&&void 0===i.lastPlacementChangeTime)throw Error("Last placement time for previous placement is not defined");r?this.lastPlacementChangeTime=t:"number"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=i?i.lastPlacementChangeTime:t)}updateLayerOpacities(t,i){let r={};for(let a of i){let i=a.getBucket(t);i&&a.latestFeatureIndex&&t.id===i.layerIds[0]&&this.updateBucketOpacities(i,a.tileID,r,a.collisionBoxArray)}}updateBucketOpacities(t,i,r,a){t.hasTextData()&&(t.text.opacityVertexArray.clear(),t.text.hasVisibleVertices=!1),t.hasIconData()&&(t.icon.opacityVertexArray.clear(),t.icon.hasVisibleVertices=!1),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexArray.clear(),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexArray.clear();let o=t.layers[0],s=o.layout,n=new tL(null,0,!1,!1,!0),l=s.get("text-allow-overlap"),h=s.get("icon-allow-overlap"),c=o._unevaluatedLayout.hasValue("text-variable-anchor")||o._unevaluatedLayout.hasValue("text-variable-anchor-offset"),u="map"===s.get("text-rotation-alignment"),d="map"===s.get("text-pitch-alignment"),_="none"!==s.get("icon-text-fit"),p=new tL(null,0,l&&(h||!t.hasIconData()||s.get("icon-optional")),h&&(l||!t.hasTextData()||s.get("text-optional")),!0);!t.collisionArrays&&a&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(a);let m=(t,i,r)=>{for(let a=0;a<i/4;a++)t.opacityVertexArray.emplaceBack(r);t.hasVisibleVertices||=r!==tZ},f=this.collisionBoxArrays.get(t.bucketInstanceId);for(let i=0;i<t.symbolInstances.length;i++){let a=t.symbolInstances.get(i),{numHorizontalGlyphVertices:o,numVerticalGlyphVertices:s,crossTileID:l}=a,h=r[l],g=this.opacities[l];h?g=n:g||(g=p,this.opacities[l]=g),r[l]=!0;let v=o>0||s>0,y=a.numIconVertices>0,x=this.placedOrientations[a.crossTileID],b=2===x,w=1===x||3===x;if(v){let i=tN(g.text),r=b?tZ:i;m(t.text,o,r);let n=w?tZ:i;m(t.text,s,n);let l=g.text.isHidden();for(let i of[a.rightJustifiedTextSymbolIndex,a.centerJustifiedTextSymbolIndex,a.leftJustifiedTextSymbolIndex])i>=0&&(t.text.placedSymbolArray.get(i).hidden=l||b?1:0);a.verticalPlacedTextSymbolIndex>=0&&(t.text.placedSymbolArray.get(a.verticalPlacedTextSymbolIndex).hidden=l||w?1:0);let h=this.variableOffsets[a.crossTileID];h&&this.markUsedJustification(t,h.anchor,a,x);let c=this.placedOrientations[a.crossTileID];c&&(this.markUsedJustification(t,"left",a,c),this.markUsedOrientation(t,c,a))}if(y){let i=tN(g.icon),r=!(_&&a.verticalPlacedIconSymbolIndex&&b);if(a.placedIconSymbolIndex>=0){let o=r?i:tZ;m(t.icon,a.numIconVertices,o),t.icon.placedSymbolArray.get(a.placedIconSymbolIndex).hidden=g.icon.isHidden()}
vendor: 13,851 bytes, lines 1-25
1if(a.verticalPlacedIconSymbolIndex>=0){let o=r?tZ:i;m(t.icon,a.numVerticalIconVertices,o),t.icon.placedSymbolArray.get(a.verticalPlacedIconSymbolIndex).hidden=g.icon.isHidden()}}let T=f?.has(i)?f.get(i):{text:null,icon:null};if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){let r=t.collisionArrays[i];if(r){let i=new P.Li(0,0);if(r.textBox||r.verticalTextBox){let a=!0;if(c){let t=this.variableOffsets[l];t?(i=tB(t.anchor,t.width,t.height,t.textOffset,t.textBoxScale),u&&i._rotate(d?-this.transform.bearingInRadians:this.transform.bearingInRadians)):a=!1}if(r.textBox||r.verticalTextBox){let o;r.textBox&&(o=b),r.verticalTextBox&&(o=w),tj(t.textCollisionBox.collisionVertexArray,g.text.placed,!a||o,T.text,i.x,i.y)}}if(r.iconBox||r.verticalIconBox){let a=!(w||!r.verticalIconBox),o;r.iconBox&&(o=a),r.verticalIconBox&&(o=!a),tj(t.iconCollisionBox.collisionVertexArray,g.icon.placed,o,T.icon,_?i.x:0,_?i.y:0)}}}}if(t.sortFeatures(-this.transform.bearingInRadians),this.retainedQueryData[t.bucketInstanceId]&&(this.retainedQueryData[t.bucketInstanceId].featureSortOrder=t.featureSortOrder),t.hasTextData()&&t.text.opacityVertexBuffer&&t.text.opacityVertexBuffer.updateData(t.text.opacityVertexArray),t.hasIconData()&&t.icon.opacityVertexBuffer&&t.icon.opacityVertexBuffer.updateData(t.icon.opacityVertexArray),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexBuffer&&t.iconCollisionBox.collisionVertexBuffer.updateData(t.iconCollisionBox.collisionVertexArray),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexBuffer&&t.textCollisionBox.collisionVertexBuffer.updateData(t.textCollisionBox.collisionVertexArray),t.text.opacityVertexArray.length!==t.text.layoutVertexArray.length/4)throw Error(`bucket.text.opacityVertexArray.length (= ${t.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${t.text.layoutVertexArray.length}) / 4`);if(t.icon.opacityVertexArray.length!==t.icon.layoutVertexArray.length/4)throw Error(`bucket.icon.opacityVertexArray.length (= ${t.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${t.icon.layoutVertexArray.length}) / 4`);t.bucketInstanceId in this.collisionCircleArrays&&(t.collisionCircleArray=this.collisionCircleArrays[t.bucketInstanceId],delete this.collisionCircleArrays[t.bucketInstanceId])}symbolFadeChange(t){return 0===this.fadeDuration?1:(t-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(t){return Math.max(0,(this.transform.zoom-t)/1.5)}hasTransitions(t){return this.stale||t-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(t,i){let r=this.zoomAtLastRecencyCheck===i?1-this.zoomAdjustment(i):1;return this.zoomAtLastRecencyCheck=i,this.commitTime+this.fadeDuration*r>t}setStale(){this.stale=!0}};function tj(t,i,r,a,o,s){a&&0!==a.length||(a=[0,0,0,0]);let n=a[0]-100,l=a[1]-100,h=a[2]-100,c=a[3]-100;t.emplaceBack(+!!i,+!!r,o||0,s||0,n,l),t.emplaceBack(+!!i,+!!r,o||0,s||0,h,l),t.emplaceBack(+!!i,+!!r,o||0,s||0,h,c),t.emplaceBack(+!!i,+!!r,o||0,s||0,n,c)}function tN(t){if(0===t.opacity&&!t.placed)return 0;if(1===t.opacity&&t.placed)return 0xffffffff;let i=+!!t.placed,r=Math.floor(127*t.opacity);return 0x2000000*r+0x1000000*i+131072*r+65536*i+512*r+256*i+2*r+i}let tZ=0;var tU=class{constructor(t){this._sortAcrossTiles="viewport-y"!==t.layout.get("symbol-z-order")&&!t.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(t,i,r,a,o){let s=this._bucketParts;for(;this._currentTileIndex<t.length;){let r=t[this._currentTileIndex];if(i.getBucketParts(s,a,r,this._sortAcrossTiles),this._currentTileIndex++,o())return!0}for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,s.sort((t,i)=>t.sortKey-i.sortKey));this._currentPartIndex<s.length;){let t=s[this._currentPartIndex];if(i.placeLayerBucketPart(t,this._seenCrossTileIDs,r),this._currentPartIndex++,o())return!0}return!1}},tG=class{constructor(t,i,r,a,o,s,n,l){this.placement=new tO(t,i,s,n,l),this._currentPlacementIndex=r.length-1,this._forceFullPlacement=a,this._showCollisionBoxes=o,this._done=!1}isDone(){return this._done}continuePlacement(t,i,r){let a=S(),o=()=>!this._forceFullPlacement&&S()-a>2;for(;this._currentPlacementIndex>=0;){let a=i[t[this._currentPlacementIndex]],s=this.placement.collisionIndex.transform.zoom;if((0,P.x)(a)&&a.layout&&(!a.minzoom||a.minzoom<=s)&&(!a.maxzoom||a.maxzoom>s)){if(this._inProgressLayer||=new tU(a),this._inProgressLayer.continuePlacement(r[a.source],this.placement,this._showCollisionBoxes,a,o))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(t){return this.placement.commit(t),this.placement}};let tV=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],tq=new Uint32Array(96);var tW=class t{static from(i){if(!i||void 0===i.byteLength||i.buffer)throw Error("Data must be an instance of ArrayBuffer or SharedArrayBuffer.");let[r,a]=new Uint8Array(i,0,2);if(219!==r)throw Error("Data does not appear to be in a KDBush format.");let o=a>>4;if(1!==o)throw Error(`Got v${o} data when expected v1.`);let s=tV[15&a];if(!s)throw Error("Unrecognized array type.");let[n]=new Uint16Array(i,2,1),[l]=new Uint32Array(i,4,1);return new t(l,n,s,void 0,i)}constructor(t,i=64,r=Float64Array,a=ArrayBuffer,o){if(isNaN(t)||t<0)throw Error(`Unexpected numItems value: ${t}.`);this.numItems=+t,this.nodeSize=Math.min(Math.max(+i,2),65535),this.ArrayType=r,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;let s=tV.indexOf(this.ArrayType),n=2*t*this.ArrayType.BYTES_PER_ELEMENT,l=t*this.IndexArrayType.BYTES_PER_ELEMENT,h=(8-l%8)%8;if(s<0)throw Error(`Unexpected typed array class: ${r}.`);if(o)this.data=o,this.ids=new this.IndexArrayType(o,8,t),this.coords=new r(o,8+l+h,2*t),this._pos=2*t,this._finished=!0;else{let o=this.data=new a(8+n+l+h);this.ids=new this.IndexArrayType(o,8,t),this.coords=new r(o,8+l+h,2*t),this._pos=0,this._finished=!1,new Uint8Array(o,0,2).set([219,16+s]),new Uint16Array(o,2,1)[0]=i,new Uint32Array(o,4,1)[0]=t}}add(t,i){let r=this._pos>>1;return this.ids[r]=r,this.coords[this._pos++]=t,this.coords[this._pos++]=i,r}finish(){let t=this._pos>>1;if(t!==this.numItems)throw Error(`Added ${t} items when expected ${this.numItems}.`);return function t(i,r,a,o,s,n){if(s-o<=a)return;let l=o+s>>1;(function t(i,r,a,o,s,n){for(;s>o;){if(s-o>600){let l=s-o+1,h=a-o+1,c=Math.log(l),u=.5*Math.exp(2*c/3),d=.5*Math.sqrt(c*u*(l-u)/l)*(h-l/2<0?-1:1);t(i,r,a,Math.max(o,Math.floor(a-h*u/l+d)),Math.min(s,Math.floor(a+(l-h)*u/l+d)),n)}let l=r[2*a+n],h=o,c=s;for(t$(i,r,o,a),r[2*s+n]>l&&t$(i,r,o,s);h<c;){for(t$(i,r,h,c),h++,c--;r[2*h+n]<l;)h++;for(;r[2*c+n]>l;)c--}r[2*o+n]===l?t$(i,r,o,c):t$(i,r,++c,s),c<=a&&(o=c+1),a<=c&&(s=c-1)}})(i,r,l,o,s,n),t(i,r,a,o,l-1,1-n),t(i,r,a,l+1,s,1-n)}(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,i,r,a){if(!this._finished)throw Error("Data not yet indexed - call index.finish().");let{ids:o,coords:s,nodeSize:n}=this;tq[0]=0,tq[1]=o.length-1,tq[2]=0;let l=3,h=[];for(;l>0;){let c=tq[--l],u=tq[--l],d=tq[--l];if(u-d<=n){for(let n=d;n<=u;n++){let l=s[2*n],c=s[2*n+1];l>=t&&l<=r&&c>=i&&c<=a&&h.push(o[n])}continue}let _=d+u>>1,p=s[2*_],m=s[2*_+1];p>=t&&p<=r&&m>=i&&m<=a&&h.push(o[_]),(0===c?t<=p:i<=m)&&(tq[l++]=d,tq[l++]=_-1,tq[l++]=1-c),(0===c?r>=p:a>=m)&&(tq[l++]=_+1,tq[l++]=u,tq[l++]=1-c)}return h}within(t,i,r){let a=[];return this.withinInto(t,i,r,a),a}withinInto(t,i,r,a){if(!this._finished)throw Error("Data not yet indexed - call index.finish().");let{ids:o,coords:s,nodeSize:n}=this;tq[0]=0,tq[1]=o.length-1,tq[2]=0;let l=3,h=0,c=r*r;for(;l>0;){let u=tq[--l],d=tq[--l],_=tq[--l];if(d-_<=n){for(let r=_;r<=d;r++)tX(s[2*r],s[2*r+1],t,i)<=c&&(a[h++]=o[r]);continue}let p=_+d>>1,m=s[2*p],f=s[2*p+1];tX(m,f,t,i)<=c&&(a[h++]=o[p]),(0===u?t-r<=m:i-r<=f)&&(tq[l++]=_,tq[l++]=p-1,tq[l++]=1-u),(0===u?t+r>=m:i+r>=f)&&(tq[l++]=p+1,tq[l++]=d,tq[l++]=1-u)}return h}};function t$(t,i,r,a){tH(t,r,a),tH(i,2*r,2*a),tH(i,2*r+1,2*a+1)}function tH(t,i,r){let a=t[i];t[i]=t[r],t[r]=a}function tX(t,i,r,a){let o=t-r,s=i-a;return o*o+s*s}let tY=512/P.Lr/2;var tK=class{constructor(t,i,r){this.tileID=t,this.bucketInstanceId=r,this._symbolsByKey={};let a=new Map;for(let t=0;t<i.length;t++){let r=i.get(t),o=r.key,s=a.get(o);s?s.push(r):a.set(o,[r])}for(let[t,i]of a){let r={positions:i.map(t=>({x:Math.floor(t.anchorX*tY),y:Math.floor(t.anchorY*tY)})),crossTileIDs:i.map(t=>t.crossTileID)};if(r.positions.length>128){let t=new tW(r.positions.length,16,Uint16Array);for(let{x:i,y:a}of r.positions)t.add(i,a);t.finish(),delete r.positions,r.index=t}this._symbolsByKey[t]=r}}getScaledCoordinates(t,i){let{x:r,y:a,z:o}=this.tileID.canonical,{x:s,y:n,z:l}=i.canonical,h=tY/2**(l-o),c=(s*P.Lr+t.anchorX)*h,u=(n*P.Lr+t.anchorY)*h;return{x:Math.floor(c-r*P.Lr*tY),y:Math.floor(u-a*P.Lr*tY)}}findMatches(t,i,r){let a=this.tileID.canonical.z<i.canonical.z?1:2**(this.tileID.canonical.z-i.canonical.z);for(let o=0;o<t.length;o++){let s=t.get(o);if(s.crossTileID)continue;let n=this._symbolsByKey[s.key];if(!n)continue;let l=this.getScaledCoordinates(s,i);n.index?this.findMatchesForIndexedEntry(n,s,l,a,r):n.positions&&this.findMatchesForNonIndexedEntry(n,s,l,a,r)}}findMatchesForIndexedEntry(t,i,r,a,o){let s=t.index.range(r.x-a,r.y-a,r.x+a,r.y+a),n=1/0;for(let i of s)i<n&&!o[t.crossTileIDs[i]]&&(n=i);if(n!==1/0){let r=t.crossTileIDs[n];o[r]=!0,i.crossTileID=r}}findMatchesForNonIndexedEntry(t,i,r,a,o){for(let s=0;s<t.positions.length;s++){let n=t.positions[s],l=t.crossTileIDs[s];if(Math.abs(n.x-r.x)<=a&&Math.abs(n.y-r.y)<=a&&!o[l]){o[l]=!0,i.crossTileID=l;break}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map(({crossTileIDs:t})=>t)}},tJ=class{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}},tQ=class{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(t){let i=Math.round((t-this.lng)/360);if(0!==i)for(let t in this.indexes){let r=this.indexes[t],a={};for(let t in r){let o=r[t];o.tileID=o.tileID.unwrapTo(o.tileID.wrap+i),a[o.tileID.key]=o}this.indexes[t]=a}this.lng=t}addBucket(t,i,r){if(this.indexes[t.overscaledZ]?.[t.key]){if(this.indexes[t.overscaledZ][t.key].bucketInstanceId===i.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(t.overscaledZ,this.indexes[t.overscaledZ][t.key])}for(let t=0;t<i.symbolInstances.length;t++)i.symbolInstances.get(t).crossTileID=0;this.usedCrossTileIDs[t.overscaledZ]||={};let a=this.usedCrossTileIDs[t.overscaledZ];for(let r in this.indexes){let o=this.indexes[r];if(Number(r)>t.overscaledZ)for(let r in o){let s=o[r];s.tileID.isChildOf(t)&&s.findMatches(i.symbolInstances,t,a)}else{let s=o[t.scaledTo(Number(r)).key];s&&s.findMatches(i.symbolInstances,t,a)}}for(let t=0;t<i.symbolInstances.length;t++){let o=i.symbolInstances.get(t);o.crossTileID||(o.crossTileID=r.generate(),a[o.crossTileID]=!0)}return void 0===this.indexes[t.overscaledZ]&&(this.indexes[t.overscaledZ]={}),this.indexes[t.overscaledZ][t.key]=new tK(t,i.symbolInstances,i.bucketInstanceId),!0}removeBucketCrossTileIDs(t,i){for(let r of i.getCrossTileIDsLists())for(let i of r)delete this.usedCrossTileIDs[t][i]}removeStaleBuckets(t){let i=!1;for(let r in this.indexes){let a=this.indexes[r];for(let o in a)t[a[o].bucketInstanceId]||(this.removeBucketCrossTileIDs(r,a[o]),delete a[o],i=!0)}return i}},t0=class{constructor(){this.layerIndexes={},this.crossTileIDs=new tJ,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(t,i,r){let a=this.layerIndexes[t.id];void 0===a&&(a=this.layerIndexes[t.id]=new tQ);let o=!1,s={};for(let n of(a.handleWrapJump(r),i)){let i=n.getBucket(t);t.id===i?.layerIds[0]&&(i.bucketInstanceId||=(this.maxBucketInstanceId+=1,this.maxBucketInstanceId),a.addBucket(n.tileID,i,this.crossTileIDs)&&(o=!0),s[i.bucketInstanceId]=!0)}return a.removeStaleBuckets(s)&&(o=!0),o}pruneUnusedLayers(t){let i={};for(let r of t)i[r]=!0;for(let t in this.layerIndexes)i[t]||delete this.layerIndexes[t]}},t1=`uniform vec4 u_color;uniform float u_opacity;void main() {fragColor=u_color*u_opacity; 2#ifdef OVERDRAW_INSPECTOR 3fragColor=vec4(1.0); 4#endif 5}`,t2=`uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);fragColor=mix(color1,color2,u_mix)*u_opacity; 6#ifdef OVERDRAW_INSPECTOR 7fragColor=vec4(1.0); 8#endif 9}`,t4=`in vec3 v_data;flat in float v_visibility; 10#pragma maplibre: define highp vec4 color 11#pragma maplibre: define mediump float radius 12#pragma maplibre: define lowp float blur 13#pragma maplibre: define lowp float opacity 14#pragma maplibre: define highp vec4 stroke_color 15#pragma maplibre: define mediump float stroke_width 16#pragma maplibre: define lowp float stroke_opacity 17void main() { 18#pragma maplibre: initialize highp vec4 color 19#pragma maplibre: initialize mediump float radius 20#pragma maplibre: initialize lowp float blur 21#pragma maplibre: initialize lowp float opacity 22#pragma maplibre: initialize highp vec4 stroke_color 23#pragma maplibre: initialize mediump float stroke_width 24#pragma maplibre: initialize lowp float stroke_opacity 25vec2 extrude=v_data.xy;float extrude_length=length(extrude);float antialiased_blur=v_data.z;float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius
25/(radius+stroke_width));fragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);const float epsilon=0.5/255.0;if (fragColor.r < epsilon && fragColor.g < epsilon && fragColor.b < epsilon && fragColor.a < epsilon) {discard;} 26#ifdef OVERDRAW_INSPECTOR 27fragColor=vec4(1.0); 28#endif 29}`,t3=`uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform highp float u_globe_extrude_scale;uniform vec2 u_translate;layout(location=0) in ivec2 a_pos;out vec3 v_data;flat out float v_visibility; 30#pragma maplibre: define highp vec4 color 31#pragma maplibre: define mediump float radius 32#pragma maplibre: define lowp float blur 33#pragma maplibre: define lowp float opacity 34#pragma maplibre: define highp vec4 stroke_color 35#pragma maplibre: define mediump float stroke_width 36#pragma maplibre: define lowp float stroke_opacity 37void main(void) { 38#pragma maplibre: initialize highp vec4 color 39#pragma maplibre: initialize mediump float radius 40#pragma maplibre: initialize lowp float blur 41#pragma maplibre: initialize lowp float opacity 42#pragma maplibre: initialize highp vec4 stroke_color 43#pragma maplibre: initialize mediump float stroke_width 44#pragma maplibre: initialize lowp float stroke_opacity 45ivec2 pos_raw=a_pos+32768;vec2 extrude=vec2(pos_raw & 7)/7.0*2.0-1.0;vec2 circle_center=vec2(pos_raw >> 3)+u_translate;float ele=get_elevation(circle_center);v_visibility=calculate_visibility(projectTileWithElevation(circle_center,ele));if (u_pitch_with_map) { 46#ifdef GLOBE 47vec3 center_vector=projectToSphere(circle_center); 48#endif 49float angle_scale=u_globe_extrude_scale;vec2 corner_position=circle_center;if (u_scale_with_map) {angle_scale*=(radius+stroke_width);corner_position+=extrude*u_extrude_scale*(radius+stroke_width);} else { 50#ifdef GLOBE 51vec4 projected_center=interpolateProjection(circle_center,center_vector,ele); 52#else 53vec4 projected_center=projectTileWithElevation(circle_center,ele); 54#endif 55corner_position+=extrude*u_extrude_scale*(radius+stroke_width)*(projected_center.w/u_camera_to_center_distance);angle_scale*=(radius+stroke_width)*(projected_center.w/u_camera_to_center_distance);} 56#ifdef GLOBE 57vec2 angles=extrude*angle_scale;vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(corner_position,corner_vector,ele); 58#else 59gl_Position=projectTileWithElevation(corner_position,ele); 60#endif 61} else {gl_Position=projectTileWithElevation(circle_center,ele);if (gl_Position.z/gl_Position.w > 1.0) {gl_Position.xy=vec2(10000.0);}if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}float antialiasblur=-max(1.0/u_device_pixel_ratio/(radius+stroke_width),blur);v_data=vec3(extrude.x,extrude.y,antialiasblur);}`,t5="void main() {fragColor=vec4(1.0);}";let t6={prelude:t8(`#ifdef GL_ES 62precision mediump float; 63#else 64#if !defined(lowp) 65#define lowp 66#endif 67#if !defined(mediump) 68#define mediump 69#endif 70#if !defined(highp) 71#define highp 72#endif 73#endif 74out highp vec4 fragColor;layout(std140) uniform ProjectionUBO {highp mat4 u_projection_matrix;highp mat4 u_projection_fallback_matrix;highp vec4 u_projection_tile_mercator_coords;highp vec4 u_projection_clipping_plane;highp float u_projection_transition;highp int u_projection_clip_antimeridian;};layout(std140) uniform FrameUBO {highp vec2 u_units_to_pixels;highp vec2 u_world_size;highp float u_camera_to_center_distance;highp float u_symbol_fade_change;highp float u_aspect_ratio;highp float u_device_pixel_ratio;highp vec2 u_viewport_size;highp vec2 u_pixel_extrude_scale;highp float u_pitch;};`,`#ifdef GL_ES 75precision highp float; 76#else 77#if !defined(lowp) 78#define lowp 79#endif 80#if !defined(mediump) 81#define mediump 82#endif 83#if !defined(highp) 84#define highp 85#endif 86#endif 87vec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const uint packedOpacity) {return vec2(float(packedOpacity >> 1u)/127.0,float(packedOpacity & 1u));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0 88);}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);
88return (tile_units_to_pixels*pos+offset)/pattern_size;}mat3 rotationMatrixFromAxisAngle(vec3 u,float angle) {float c=cos(angle);float s=sin(angle);float c2=1.0-c;return mat3(u.x*u.x*c2+ c,u.x*u.y*c2-u.z*s,u.x*u.z*c2+u.y*s,u.y*u.x*c2+u.z*s,u.y*u.y*c2+ c,u.y*u.z*c2-u.x*s,u.z*u.x*c2-u.y*s,u.z*u.y*c2+u.x*s,u.z*u.z*c2+ c 89);} 90#ifdef TERRAIN3D 91uniform sampler2D u_terrain;uniform highp sampler2D u_depth;layout(std140) uniform TerrainUBO {highp mat4 u_terrain_matrix;highp vec4 u_terrain_unpack;highp float u_terrain_dim;highp float u_terrain_exaggeration;}; 92#endif 93const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitShifts=vec4(1.)/bitSh;highp float unpack(highp vec4 color) {return dot(color,bitShifts);}highp float depthOpacity(vec3 frag) { 94#ifdef TERRAIN3D 95highp float d=unpack(texture(u_depth,frag.xy*0.5+0.5))+0.0001-frag.z;return 1.0-max(0.0,min(1.0,-d*500.0)); 96#else 97return 1.0; 98#endif 99}float calculate_visibility(vec4 pos) { 100#ifdef TERRAIN3D 101vec3 frag=pos.xyz/pos.w;highp float d=depthOpacity(frag);if (d > 0.95) return 1.0;return (d+depthOpacity(frag+vec3(0.0,0.01,0.0)))/2.0; 102#else 103return 1.0; 104#endif 105}float ele(ivec2 pos) { 106#ifdef TERRAIN3D 107vec4 rgb=(texelFetch(u_terrain,pos,0)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a; 108#else 109return 0.0; 110#endif 111}float get_elevation(vec2 pos) { 112#ifdef TERRAIN3D 113#ifdef GLOBE 114if ((pos.y <-32767.5) || (pos.y > 32766.5)) {return 0.0;} 115#endif 116vec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.5;vec2 f=fract(coord);ivec2 c=ivec2(floor(coord));ivec2 hi=textureSize(u_terrain,0)-1;float tl=ele(clamp(c,ivec2(0),hi));float tr=ele(clamp(c+ivec2(1,0),ivec2(0),hi));float bl=ele(clamp(c+ivec2(0,1),ivec2(0),hi));float br=ele(clamp(c+ivec2(1,1),ivec2(0),hi));float elevation=mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);return elevation*u_terrain_exaggeration; 117#else 118return 0.0; 119#endif 120}const float PI=3.141592653589793; 121#define PROJECTION_UBO 122layout(std140) uniform ProjectionUBO {highp mat4 u_projection_matrix;highp mat4 u_projection_fallback_matrix;highp vec4 u_projection_tile_mercator_coords;highp vec4 u_projection_clipping_plane;highp float u_projection_transition;highp int u_projection_clip_antimeridian;};layout(std140) uniform FrameUBO {highp vec2 u_units_to_pixels;highp vec2 u_world_size;highp float u_camera_to_center_distance;highp float u_symbol_fade_change;highp float u_aspect_ratio;highp float u_device_pixel_ratio;highp vec2 u_viewport_size;highp vec2 u_pixel_extrude_scale;highp float u_pitch;};`),projectionMercator:t8(` 123void clipAntimeridian() {}`,"float projectLineThickness(float tileY) {return 1.0;}float projectCircleRadius(float tileY) {return 1.0;}vec4 projectTile(vec2 p) {vec4 result=u_projection_matrix*vec4(p,0.0,1.0);return result;}vec4 projectTile(vec2 p,vec2 rawPos) {vec4 result=u_projection_matrix*vec4(p,0.0,1.0);if (rawPos.y <-32767.5 || rawPos.y > 32766.5) {result.z=-10000000.0;}return result;}vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_projection_matrix*vec4(posInTile,elevation,1.0);}vec4 projectTileFor3D(vec2 posInTile,float elevation) {return projectTileWithElevation(posInTile,elevation);}"),projectionGlobe:t8("in highp float v_projection_tile_x;void clipAntimeridian() {if (u_projection_clip_antimeridian !=0 && (v_projection_tile_x < 0.0 || v_projection_tile_x >=8192.0)) {discard;}}",`#define GLOBE_RADIUS 6371008.8 124#ifndef PROJECTION_UBO 125uniform highp vec4 u_projection_tile_mercator_coords;uniform highp vec4 u_projection_clipping_plane;uniform highp float u_projection_transition;uniform mat4 u_projection_fallback_matrix; 126#endif 127out highp float v_projection_tile_x;vec3 globeRotateVector(vec3 vec,vec2 angles) {vec3 axisRight=vec3(vec.z,0.0,-vec.x);vec3 axisUp=cross(axisRight,vec);axisRight=normalize(axisRight);axisUp=normalize(axisUp);vec2 t=tan(angles);return normalize(vec+axisRight*t.x+axisUp*t.y);}mat3 globeGetRotationMatrix(vec3 spherePos) {vec3 axisRight=vec3(spherePos.z,0.0,-spherePos.x);vec3 axisDown=cross(axisRight,spherePos);axisRight=normalize(axisRight);axisDown=normalize(axisDown);return mat3(axisRight,axisDown,spherePos 128);}float circumferenceRatioAtTileY(float tileY) {float mercator_pos_y=u_projection_tile_mercator_coords.y+u_projection_tile_mercator_coords.w*tileY;float t=exp(PI-(mercator_pos_y*PI*2.0));return (2.0*t)/(t*t+1.0);}float projectLineThickness(float tileY) {float thickness=1.0/circumferenceRatioAtTileY(tileY);if (u_projection_transition < 0.999) {return mix(1.0,thickness,u_projection_transition);} else {return thickness;}}vec3 projectToSphere(vec2 translatedPos,vec2 rawPos) {vec2 mercator_pos=u_projection_tile_mercator_coords.xy+u_projection_tile_mercator_coords.zw*translatedPos;float spherical_x=mercator_pos.x*PI*2.0+PI;float t=exp(PI-(mercator_pos.y*PI*2.0));
128float t2=t*t;float denom=t2+1.0;float sin_sy=(t2-1.0)/denom;float cos_sy=(2.0*t)/denom;vec3 pos=vec3(sin(spherical_x)*cos_sy,sin_sy,cos(spherical_x)*cos_sy 129);if (rawPos.y <-32767.5) {pos=vec3(0.0,1.0,0.0);}if (rawPos.y > 32766.5) {pos=vec3(0.0,-1.0,0.0);}return pos;}vec3 projectToSphere(vec2 posInTile) {return projectToSphere(posInTile,vec2(0.0,0.0));}float globeComputeClippingZ(vec3 spherePos) {return (1.0-(dot(spherePos,u_projection_clipping_plane.xyz)+u_projection_clipping_plane.w));}vec4 interpolateProjection(vec2 posInTile,vec3 spherePos,float elevation) {v_projection_tile_x=posInTile.x;vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);globePosition.z=globeComputeClippingZ(elevatedPos)*globePosition.w;if (u_projection_transition > 0.999) {return globePosition;}vec4 flatPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);const float z_globeness_threshold=0.2;vec4 result=globePosition;result.z=mix(0.0,globePosition.z,clamp((u_projection_transition-z_globeness_threshold)/(1.0-z_globeness_threshold),0.0,1.0));result.xyw=mix(flatPosition.xyw,globePosition.xyw,u_projection_transition);if ((posInTile.y <-32767.5) || (posInTile.y > 32766.5)) {result=globePosition;const float poles_hidden_anim_percentage=0.02;result.z=mix(globePosition.z,100.0,pow(max((1.0-u_projection_transition)/poles_hidden_anim_percentage,0.0),8.0));}return result;}vec4 interpolateProjectionFor3D(vec2 posInTile,vec3 spherePos,float elevation) {v_projection_tile_x=posInTile.x;vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);if (u_projection_transition > 0.999) {return globePosition;}vec4 fallbackPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);return mix(fallbackPosition,globePosition,u_projection_transition);}vec4 projectTile(vec2 posInTile) {return interpolateProjection(posInTile,projectToSphere(posInTile),0.0);}vec4 projectTile(vec2 posInTile,vec2 rawPos) {return interpolateProjection(posInTile,projectToSphere(posInTile,rawPos),0.0);}vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return interpolateProjection(posInTile,projectToSphere(posInTile),elevation);}vec4 projectTileFor3D(vec2 posInTile,float elevation) {vec3 spherePos=projectToSphere(posInTile,posInTile);return interpolateProjectionFor3D(posInTile,spherePos,elevation);}`),background:t8(t1,"layout(location=0) in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),backgroundPattern:t8(t2,"uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;layout(location=0) in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;void main() {gl_Position=projectTile(a_pos);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}"),circle:t8(t4,t3),clippingMask:t8(t5,"layout(location=0) in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),heatmap:t8(`uniform highp float u_intensity;in vec2 v_extrude; 130#pragma maplibre: define highp float weight 131#define GAUSS_COEF 0.3989422804014327 132void main() { 133#pragma maplibre: initialize highp float weight 134float d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);fragColor=vec4(val,1.0,1.0,1.0); 135#ifdef OVERDRAW_INSPECTOR 136fragColor=vec4(1.0); 137#endif 138}`,`uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;uniform highp float u_globe_extrude_scale;layout(location=0) in ivec2 a_pos;out vec2 v_extrude; 139#pragma maplibre: define highp float weight 140#pragma maplibre: define mediump float radius 141const highp float ZERO=1.0/255.0/16.0; 142#define GAUSS_COEF 0.3989422804014327 143void main(void) { 144#pragma maplibre: initialize highp float weight 145#pragma maplibre: initialize mediump float radius 146ivec2 pos_raw=a_pos+32768;vec2 unscaled_extrude=vec2(pos_raw & 7)/7.0*2.0-1.0;float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec2 circle_center=vec2(pos_raw >> 3); 147#ifdef GLOBE 148vec2 angles=v_extrude*radius*u_globe_extrude_scale;vec3 center_vector=projectToSphere(circle_center);vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(circle_center+extrude,corner_vector,0.0); 149#else 150gl_Position=projectTileFor3D(circle_center+extrude,get_elevation(circle_center)); 151#endif 152}`),heatmapTexture:t8(`uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;in vec2 v_pos;void main() {float t=texture(u_image,v_pos).r;vec4 color=texture(u_color_ramp,vec2(t,0.5));fragColor=color*u_opacity; 153#ifdef OVERDRAW_INSPECTOR 154fragColor=vec4(0.0); 155#endif 156}`,"uniform mat4 u_matrix;layout(location=0) in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world_size,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"),collisionBox:t8("flat in float v_placed;flat in float v_notUsed;void main() {float alpha=0.5;fragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {fragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {fragColor*=.1;}}","layout(location=0) in vec2 a_anchor_pos;layout(location=1) in vec2 a_placed;layout(location=2) in vec2 a_box_real;flat out float v_placed;flat out float v_notUsed;void main() {gl_Position=projectTileWithElevation(a_anchor_pos,get_elevation(a_anchor_pos));gl_Position.xy=((a_box_real+0.5)*u_pixel_extrude_scale*2.0-1.0)*vec2(1.0,-1.0)*gl_Position.w;if (gl_Position.z/gl_Position.w < 1.1) {gl_Position.z=0.5;}v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:t8("flat in float v_radius;in vec2 v_extrude;flat in float v_collision;void main() {float alpha=0.5;float stroke_radius=0.9;float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);fragColor=color*alpha*opacity_t;}","layout(location=0) in vec2 a_pos;layout(location=1) in float a_radius;layout(location=2) in vec2 a_flags;flat out float v_radius;out vec2 v_extrude;flat out float v_collision;void main() {float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_collision=collision;gl_Position=vec4((a_pos/u_viewport_size*2.0-1.0)*vec2(1.0,-1.0),0.0,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),colorRelief:t8(`#ifdef GL_ES 157precision highp float; 158#endif 159uniform sampler2D u_image;uniform vec4 u_unpack;uniform sampler2D u_elevation_stops;uniform sampler2D u_color_stops;uniform int u_color_ramp_size;uniform float u_opacity;in vec2 v_pos;float getElevation(vec2 coord) {vec4 data=texture(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack);}float getElevationStop(int stop) {vec4 data=texelFetch(u_elevation_stops,ivec2(stop,0),0)*255.0;data.a=-1.0;return dot(data,u_unpack);}void main() {float el=getElevation(v_pos);int r=(u_color_ramp_size-1);int l=0;float el_l=getElevationStop(l);float el_r=getElevationStop(r);while(r-l > 1){int m=(r+l)/2;float el_m=getElevationStop(m);if(el < el_m){r=m;el_r=el_m;}else 160{l=m;el_l=el_m;}}float x=(float(l)+(el-el_l)/(el_r-el_l)+0.5)/float(u_color_ramp_size);fragColor=u_opacity*texture(u_color_stops,vec2(x,0)); 161#ifdef OVERDRAW_INSPECTOR 162fragColor=vec4(1.0); 163#endif 164}`,"uniform vec2 u_dimension;layout(location=0) in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=projectTile(a_pos,a_pos);highp vec2 epsilon=2.0/u_dimension;float scale=(u_dimension.x-4.0)/u_dimension.x;v_pos=(a_pos/8192.0)*scale+epsilon;if (a_pos.y <-32767.5) {v_pos.y=0.0;}if (a_pos.y > 32766.5) {v_pos.y=1.0;}}"),debug:t8("uniform highp vec4 u_color;uniform sampler2D u_overlay;in vec2 v_uv;void main() {vec4 overlay_color=texture(u_overlay,v_uv);fragColor=mix(u_color,overlay_color,overlay_color.a);}","layout(location=0) in vec2 a_pos;out vec2 v_uv;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=projectTileWithElevation(a_pos*u_overlay_scale,get_elevation(a_pos));}"),depth:t8(t5,`layout(location=0) in vec2 a_pos;void main() { 165#ifdef GLOBE 166gl_Position=projectTileFor3D(a_pos,0.0); 167#else 168gl_Position=u_projection_matrix*vec4(a_pos,0.0,1.0); 169#endif 170}`),fill:t8(`#pragma maplibre: define highp vec4 color 171#pragma maplibre: define lowp float opacity 172void main() { 173#pragma maplibre: initialize highp vec4 color 174#pragma maplibre: initialize lowp float opacity 175fragColor=color*opacity; 176#ifdef OVERDRAW_INSPECTOR 177fragColor=vec4(1.0); 178#endif 179}`,`uniform vec2 u_fill_translate;layout(location=0) in vec2 a_pos; 180#pragma maplibre: define highp vec4 color 181#pragma maplibre: define lowp float opacity 182void main() { 183#pragma maplibre: initialize highp vec4 color 184#pragma maplibre: initialize lowp float opacity 185if (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}gl_Position=projectTile(a_pos+u_fill_translate,a_pos);}`),fillOutline:t8(`in vec2 v_pos; 186#ifdef GLOBE 187in float v_depth; 188#endif 189#pragma maplibre: define highp vec4 outline_color 190#pragma maplibre: define lowp float opacity 191void main() { 192#pragma maplibre: initialize highp vec4 outline_color 193#pragma maplibre: initialize lowp float opacity 194float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=outline_color*(alpha*opacity); 195#ifdef GLOBE 196if (v_depth > 1.0) {discard;} 197#endif 198#ifdef OVERDRAW_INSPECTOR 199fragColor=vec4(1.0); 200#endif 201}`,`uniform vec2 u_fill_translate;layout(location=0) in vec2 a_pos;out vec2 v_pos; 202#ifdef GLOBE 203out float v_depth; 204#endif 205#pragma maplibre: define highp vec4 outline_color 206#pragma maplibre: define lowp float opacity 207void main() { 208#pragma maplibre: initialize highp vec4 outline_color 209#pragma maplibre: initialize lowp float opacity 210if (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}gl_Position=projectTile(a_pos+u_fill_translate,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world_size; 211#ifdef GLOBE 212v_depth=gl_Position.z/gl_Position.w; 213#endif 214}`),fillOutlinePattern:t8(`uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;uniform bool u_sdf_pattern;in vec2 v_pos_a;in vec2 v_pos_b;in vec2 v_pos; 215#ifdef GLOBE 216in float v_depth; 217#endif 218#pragma maplibre: define lowp float opacity 219#pragma maplibre: define highp vec4 color 220#pragma maplibre: define lowp vec4 pattern_from 221#pragma maplibre: define lowp vec4 pattern_to 222void main() { 223#pragma maplibre: initialize lowp float opacity 224#pragma maplibre: initialize highp vec4 color 225#pragma maplibre: initialize mediump vec4 pattern_from 226#pragma maplibre: initialize mediump vec4 pattern_to 227vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);if (u_sdf_pattern) {highp float sdf_edge=(256.0-64.0)/256.0;highp float sdf_gamma_a=max(fwidth(color1.a)*0.5,1.0/255.0/16.0);highp float sdf_gamma_b=max(fwidth(color2.a)*0.5,1.0/255.0/16.0);float sdf_alpha_a=smoothstep(sdf_edge-sdf_gamma_a,sdf_edge+sdf_gamma_a,color1.a);float sdf_alpha_b=smoothstep(sdf_edge-sdf_gamma_b,sdf_edge+sdf_gamma_b,color2.a);fragColor=mix(color*sdf_alpha_a,color*sdf_alpha_b,u_fade)*alpha*opacity;} else {fragColor=mix(color1,color2,u_fade)*alpha*opacity;} 228#ifdef GLOBE 229if (v_depth > 1.0) {discard;} 230#endif 231#ifdef OVERDRAW_INSPECTOR 232fragColor=vec4(1.0); 233#endif 234}`,`uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;layout(location=0) in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;out vec2 v_pos; 235#ifdef GLOBE 236out float v_depth; 237#endif 238#pragma maplibre: define lowp float opacity 239#pragma maplibre: define highp vec4 color 240#pragma maplibre: define lowp vec4 pattern_from 241#pragma maplibre: define lowp vec4 pattern_to 242#pragma maplibre: define lowp float pixel_ratio_from 243#pragma maplibre: define lowp float pixel_ratio_to 244void main() { 245#pragma maplibre: initialize lowp float opacity 246#pragma maplibre: initialize highp vec4 color 247#pragma maplibre: initialize mediump vec4 pattern_from 248#pragma maplibre: initialize mediump vec4 pattern_to 249#pragma maplibre: initialize lowp float pixel_ratio_from 250#pragma maplibre: initialize lowp float pixel_ratio_to 251if (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=projectTile(a_pos+u_fill_translate,a_pos);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world_size; 252#ifdef GLOBE 253v_depth=gl_Position.z/gl_Position.w; 254#endif 255}`),fillPattern:t8(`#ifdef GL_ES 256precision highp float; 257#endif 258uniform vec2 u_texsize;uniform float u_fade;uniform bool u_sdf_pattern;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b; 259#pragma maplibre: define lowp float opacity 260#pragma maplibre: define highp vec4 color 261#pragma maplibre: define lowp vec4 pattern_from 262#pragma maplibre: define lowp vec4 pattern_to 263void main() { 264#pragma maplibre: initialize lowp float opacity 265#pragma maplibre: initialize highp vec4 color 266#pragma maplibre: initialize mediump vec4 pattern_from 267#pragma maplibre: initialize mediump vec4 pattern_to 268vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);if (u_sdf_pattern) {highp float sdf_edge=(256.0-64.0)/256.0;highp float sdf_gamma_a=max(fwidth(color1.a)*0.5,1.0/255.0/16.0);highp float sdf_gamma_b=max(fwidth(color2.a)*0.5,1.0/255.0/16.0);float sdf_alpha_a=smoothstep(sdf_edge-sdf_gamma_a,sdf_edge+sdf_gamma_a,color1.a);float sdf_alpha_b=smoothstep(sdf_edge-sdf_gamma_b,sdf_edge+sdf_gamma_b,color2.a);fragColor=mix(color*sdf_alpha_a,color*sdf_alpha_b,u_fade)*opacity;} else {fragColor=mix(color1,color2,u_fade)*opacity;} 269#ifdef OVERDRAW_INSPECTOR 270fragColor=vec4(1.0); 271#endif 272}`,`uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;layout(location=0) in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b; 273#pragma maplibre: define lowp float opacity 274#pragma maplibre: define highp vec4 color 275#pragma maplibre: define lowp vec4 pattern_from 276#pragma maplibre: define lowp vec4 pattern_to 277#pragma maplibre: define lowp float pixel_ratio_from 278#pragma maplibre: define lowp float pixel_ratio_to 279void main() { 280#pragma maplibre: initialize lowp float opacity 281#pragma maplibre: initialize highp vec4 color 282#pragma maplibre: initialize mediump vec4 pattern_from 283#pragma maplibre: initialize mediump vec4 pattern_to 284#pragma maplibre: initialize lowp float pixel_ratio_from 285#pragma maplibre: initialize lowp float pixel_ratio_to 286if (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float to
286Scale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=projectTile(a_pos+u_fill_translate,a_pos);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}`),fillExtrusion:t8(`in vec4 v_color;void main() {fragColor=v_color; 287#ifdef OVERDRAW_INSPECTOR 288fragColor=vec4(1.0); 289#endif 290}`,`uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec2 u_fill_translate;layout(location=0) in vec2 a_pos;layout(location=1) in ivec4 a_normal_ed; 291#ifdef TERRAIN3D 292layout(location=2) in vec2 a_centroid; 293#endif 294out vec4 v_color; 295#pragma maplibre: define highp float base 296#pragma maplibre: define highp float height 297#pragma maplibre: define highp vec4 color 298void main() { 299#pragma maplibre: initialize highp float base 300#pragma maplibre: initialize highp float height 301#pragma maplibre: initialize highp vec4 color 302vec3 normal=vec3(a_normal_ed.xyz);float gradient_base=max(0.0,base);float gradient_height=max(0.0,height); 303#ifdef TERRAIN3D 304float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0); 305#else 306float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0; 307#endif 308base=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=float(a_normal_ed.x & 1);float elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate; 309#ifdef GLOBE 310vec3 spherePos=projectToSphere(posInTile,a_pos);gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation); 311#else 312gl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0); 313#endif 314float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;vec3 normalForLighting=normal/16384.0;float directional=clamp(dot(normalForLighting,u_lightpos),0.0,1.0); 315#ifdef GLOBE 316mat3 rotMatrix=globeGetRotationMatrix(spherePos);normalForLighting=rotMatrix*normalForLighting;directional=mix(directional,clamp(dot(normalForLighting,u_lightpos_globe),0.0,1.0),u_projection_transition); 317#endif 318directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+gradient_base)*pow(gradient_height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}`),fillExtrusionPattern:t8(`uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;in vec4 v_lighting; 319#pragma maplibre: define lowp float base 320#pragma maplibre: define lowp float height 321#pragma maplibre: define lowp vec4 pattern_from 322#pragma maplibre: define lowp vec4 pattern_to 323#pragma maplibre: define lowp float pixel_ratio_from 324#pragma maplibre: define lowp float pixel_ratio_to 325void main() { 326#pragma maplibre: initialize lowp float base 327#pragma maplibre: initialize lowp float height 328#pragma maplibre: initialize mediump vec4 pattern_from 329#pragma maplibre: initialize mediump vec4 pattern_to 330#pragma maplibre: initialize lowp float pixel_ratio_from 331#pragma maplibre: initialize lowp float pixel_ratio_to 332vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);fragColor=mixedColor*v_lighting; 333#ifdef OVERDRAW_INSPECTOR 334fragColor=vec4(1.0); 335#endif 336}`,`uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec2 u_fill_translate;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;layout(location=0) in vec2 a_pos;layout(location=1) in ivec4 a_normal_ed; 337#ifdef TERRAIN3D 338layout(location=2) in vec2 a_centroid; 339#endif 340#ifdef GLOBE 341out vec3 v_sphere_pos; 342#endif 343out vec2 v_pos_a;out vec2 v_pos_b;out vec4 v_lighting; 344#pragma maplibre: define lowp float base 345#pragma maplibre: define lowp float height 346#pragma maplibre: define lowp vec4 pattern_from 347#pragma maplibre: define lowp vec4 pattern_to 348#pragma maplibre: define lowp float pixel_ratio_from 349#pragma maplibre: define lowp float pixel_ratio_to 350void main() { 351#pragma maplibre: initialize lowp float base 352#pragma maplibre: initialize lowp float height 353#pragma maplibre: initialize mediump vec4 pattern_from 354#pragma maplibre: initialize mediump vec4 pattern_to 355#pragma maplibre: initialize lowp float pixel_ratio_from 356#pragma maplibre: initialize lowp float pixel_ratio_to 357vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=vec3(a_normal_ed.xyz);float edgedistance=float(a_normal_ed.w);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;float gradient_base=max(0.0,base);float gradient_height=max(0.0,height); 358#ifdef TERRAIN3D 359float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0); 360#else 361float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0; 362#endif 363base=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=float(a_normal_ed.x & 1);float elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate; 364#ifdef GLOBE 365vec3 spherePos=projectToSphere(posInTile,a_pos);vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);v_sphere_pos=elevatedPos;gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation); 366#else 367gl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0); 368#endif 369vec2 pos=a_normal_ed.x==1 && a_normal_ed.y==0 && a_normal_ed.z==16384 370? a_pos 371: vec2(edgedistance,elevation*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+gradient_base)*pow(gradient_height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}`),hillshadePrepare:t8(`#ifdef GL_ES 372precision highp float; 373#endif 374uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(ivec2 texel) {vec4 data=texelFetch(u_image,texel,0)*255.0;data.a=-1.0;return dot(data,u_unpack);}void main() {ivec2 pos=ivec2(gl_FragCoord.xy)+ivec2(1);float tileSize=u_dimension.x-4.0;float a=getElevation(pos+ivec2(-1,-1));float b=getElevation(pos+ivec2(0,-1));float c=getElevation(pos+ivec2(1,-1));float d=getElevation(pos+ivec2(-1,0));float e=getElevation(pos);float f=getElevation(pos+ivec2(1,0));float g=getElevation(pos+ivec2(-1,1));float h=getElevation(pos+ivec2(0,1));float i=getElevation(pos+ivec2(1,1));float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))*tileSize/p
374ow(2.0,exaggeration+(28.2562-u_zoom));fragColor=clamp(vec4(deriv.x/8.0+0.5,deriv.y/8.0+0.5,1.0,1.0),0.0,1.0); 375#ifdef OVERDRAW_INSPECTOR 376fragColor=vec4(1.0); 377#endif 378}`,"uniform mat4 u_matrix;uniform vec2 u_dimension;layout(location=0) in vec2 a_pos;layout(location=1) 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:t8(`uniform sampler2D u_image;in highp vec2 v_pos;uniform vec2 u_latrange;uniform float u_exaggeration;uniform vec4 u_accent;uniform int u_method;uniform float u_altitudes[NUM_ILLUMINATION_SOURCES];uniform float u_azimuths[NUM_ILLUMINATION_SOURCES];uniform vec4 u_shadows[NUM_ILLUMINATION_SOURCES];uniform vec4 u_highlights[NUM_ILLUMINATION_SOURCES]; 379#define PI 3.141592653589793 380#define STANDARD 0 381#define COMBINED 1 382#define IGOR 2 383#define MULTIDIRECTIONAL 3 384#define BASIC 4 385float get_aspect(vec2 deriv){return deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);}void igor_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float aspect=get_aspect(deriv);float azimuth=u_azimuths[0]+PI;float slope_stength=atan(length(deriv))*2.0/PI;float aspect_strength=1.0-abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);float shadow_strength=slope_stength*aspect_strength;float highlight_strength=slope_stength*(1.0-aspect_strength);fragColor=u_shadows[0]*shadow_strength+u_highlights[0]*highlight_strength;}void standard_hillshade(vec2 deriv){float azimuth=u_azimuths[0]+PI;float slope=atan(0.625*length(deriv));float aspect=get_aspect(deriv);float intensity=u_exaggeration;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadows[0],u_highlights[0],shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);fragColor=accent_color*(1.0-shade_color.a)+shade_color;}void basic_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float azimuth=u_azimuths[0]+PI;float cos_az=cos(azimuth);float sin_az=sin(azimuth);float cos_alt=cos(u_altitudes[0]);float sin_alt=sin(u_altitudes[0]);float cang=(sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv));float shade=clamp(cang,0.0,1.0);if(shade > 0.5){fragColor=u_highlights[0]*(2.0*shade-1.0);}else 386{fragColor=u_shadows[0]*(1.0-2.0*shade);}}void multidirectional_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;fragColor=vec4(0,0,0,0);for(int i=0; i < NUM_ILLUMINATION_SOURCES; i++){float cos_alt=cos(u_altitudes[i]);float sin_alt=sin(u_altitudes[i]);float cos_az=-cos(u_azimuths[i]);float sin_az=-sin(u_azimuths[i]);float cang=(sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv));float shade=clamp(cang,0.0,1.0);if(shade > 0.5){fragColor+=u_highlights[i]*(2.0*shade-1.0)/float(NUM_ILLUMINATION_SOURCES);}else 387{fragColor+=u_shadows[i]*(1.0-2.0*shade)/float(NUM_ILLUMINATION_SOURCES);}}}void combined_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float azimuth=u_azimuths[0]+PI;float cos_az=cos(azimuth);float sin_az=sin(azimuth);float cos_alt=cos(u_altitudes[0]);float sin_alt=sin(u_altitudes[0]);float cang=acos((sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv)));cang=clamp(cang,0.0,PI/2.0);float shade=cang*atan(length(deriv))*4.0/PI/PI;float highlight=(PI/2.0-cang)*atan(length(deriv))*4.0/PI/PI;fragColor=u_shadows[0]*shade+u_highlights[0]*highlight;}void main() {highp vec2 size=vec2(textureSize(u_image,0));highp vec2 texturePos=(v_pos*(size-2.0)+1.0)/size;vec4 pixel=texture(u_image,texturePos);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));vec2 deriv=((pixel.rg*8.0)-4.0)/scaleFactor;if (u_method==BASIC) {basic_hillshade(deriv);} else if (u_method==COMBINED) {combined_hillshade(deriv);} else if (u_method==IGOR) {igor_hillshade(deriv);} else if (u_method==MULTIDIRECTIONAL) {multidirectional_hillshade(deriv);} else if (u_method==STANDARD) {standard_hillshade(deriv);} else {standard_hillshade(deriv);} 388#ifdef OVERDRAW_INSPECTOR 389fragColor=vec4(1.0); 390#endif 391}`,"uniform mat4 u_matrix;layout(location=0) in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=projectTile(a_pos,a_pos);v_pos=a_pos/8192.0;if (a_pos.y <-32767.5) {v_pos.y=0.0;}if (a_pos.y > 32766.5) {v_pos.y=1.0;}}"),line:t8(`flat in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale; 392#ifdef GLOBE 393in float v_depth; 394#endif 395#pragma maplibre: define highp vec4 color 396#pragma maplibre: define lowp float blur 397#pragma maplibre: define lowp float opacity 398void main() { 399#pragma maplibre: initialize highp vec4 color 400#pragma maplibre: initialize lowp float blur 401#pragma maplibre: initialize lowp float opacity 402clipAntimeridian();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);fragColor=color*(alpha*opacity); 403#ifdef GLOBE 404if (v_depth > 1.0) {discard;} 405#endif 406#ifdef OVERDRAW_INSPECTOR 407fragColor=vec4(1.0); 408#endif 409}`,` 410#define scale 0.015873016 411layout(location=0) in ivec2 a_pos_normal;layout(location=1) in uvec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;out vec2 v_normal;flat out vec2 v_width2;out float v_gamma_scale;out highp float v_linesofar; 412#ifdef GLOBE 413out float v_depth; 414#endif 415#pragma maplibre: define highp vec4 color 416#pragma maplibre: define lowp float blur 417#pragma maplibre: define lowp float opacity 418#pragma maplibre: define mediump float gapwidth 419#pragma maplibre: define lowp float offset 420#pragma maplibre: define mediump float width 421void main() { 422#pragma maplibre: initialize highp vec4 color 423#pragma maplibre: initialize lowp float blur 424#pragma maplibre: initialize lowp float opacity 425#pragma maplibre: initialize mediump float gapwidth 426#pragma maplibre: initialize lowp float offset 427#pragma maplibre: initialize mediump float width 428if (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=vec2(ivec2(a_data.xy)-128);float a_direction=float(int(a_data.z & 3u)-1);v_linesofar=float((a_data.z >> 2u)+a_data.w*64u)*2.0;vec2 pos=vec2(a_pos_normal >> 1);mediump vec2 normal=vec2(a_pos_normal & 1);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);
428float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude; 429#ifdef GLOBE 430v_depth=gl_Position.z/gl_Position.w; 431#endif 432#ifdef TERRAIN3D 433v_gamma_scale=1.0; 434#else 435float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective; 436#endif 437v_width2=vec2(outset,inset);}`),lineGradient:t8(`uniform sampler2D u_image;flat in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;in highp vec2 v_uv; 438#ifdef GLOBE 439in float v_depth; 440#endif 441#pragma maplibre: define lowp float blur 442#pragma maplibre: define lowp float opacity 443void main() { 444#pragma maplibre: initialize lowp float blur 445#pragma maplibre: initialize lowp float opacity 446clipAntimeridian();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);vec4 color=texture(u_image,v_uv);fragColor=color*(alpha*opacity); 447#ifdef GLOBE 448if (v_depth > 1.0) {discard;} 449#endif 450#ifdef OVERDRAW_INSPECTOR 451fragColor=vec4(1.0); 452#endif 453}`,` 454#define scale 0.015873016 455layout(location=0) in ivec2 a_pos_normal;layout(location=1) in uvec4 a_data;layout(location=2) in float a_uv_x;layout(location=3) in float a_split_index;uniform vec2 u_translation;uniform mediump float u_ratio;uniform float u_image_height;out vec2 v_normal;flat out vec2 v_width2;out float v_gamma_scale;out highp vec2 v_uv; 456#ifdef GLOBE 457out float v_depth; 458#endif 459#pragma maplibre: define lowp float blur 460#pragma maplibre: define lowp float opacity 461#pragma maplibre: define mediump float gapwidth 462#pragma maplibre: define lowp float offset 463#pragma maplibre: define mediump float width 464void main() { 465#pragma maplibre: initialize lowp float blur 466#pragma maplibre: initialize lowp float opacity 467#pragma maplibre: initialize mediump float gapwidth 468#pragma maplibre: initialize lowp float offset 469#pragma maplibre: initialize mediump float width 470if (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=vec2(ivec2(a_data.xy)-128);float a_direction=float(int(a_data.z & 3u)-1);highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=vec2(a_pos_normal >> 1);mediump vec2 normal=vec2(a_pos_normal & 1);normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude; 471#ifdef GLOBE 472v_depth=gl_Position.z/gl_Position.w; 473#endif 474#ifdef TERRAIN3D 475v_gamma_scale=1.0; 476#else 477float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective; 478#endif 479v_width2=vec2(outset,inset);}`),linePattern:t8(`#ifdef GL_ES 480precision highp float; 481#endif 482uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;in vec2 v_normal;flat in vec2 v_width2;in float v_linesofar;in float v_gamma_scale;flat in float v_width; 483#ifdef GLOBE 484in float v_depth; 485#endif 486#pragma maplibre: define lowp vec4 pattern_from 487#pragma maplibre: define lowp vec4 pattern_to 488#pragma maplibre: define lowp float pixel_ratio_from 489#pragma maplibre: define lowp float pixel_ratio_to 490#pragma maplibre: define lowp float blur 491#pragma maplibre: define lowp float opacity 492void main() { 493#pragma maplibre: initialize mediump vec4 pattern_from 494#pragma maplibre: initialize mediump vec4 pattern_to 495#pragma maplibre: initialize lowp float pixel_ratio_from 496#pragma maplibre: initialize lowp float pixel_ratio_to 497#pragma maplibre: initialize lowp float blur 498#pragma maplibre: initialize lowp float opacity 499clipAntimeridian();vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture(u_image,pos_a),texture(u_image,pos_b),u_fade);fragColor=color*alpha*opacity; 500#ifdef GLOBE 501if (v_depth > 1.0) {discard;} 502#endif 503#ifdef OVERDRAW_INSPECTOR 504fragColor=vec4(1.0); 505#endif 506}`,` 507#define scale 0.015873016 508#define LINE_DISTANCE_SCALE 2.0 509layout(location=0) in ivec2 a_pos_normal;layout(location=1) in uvec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;out vec2 v_normal;flat out vec2 v_width2;out float v_linesofar;out float v_gamma_scale;flat out float v_width; 510#ifdef GLOBE 511out float v_depth; 512#endif 513#pragma maplibre: define lowp float blur 514#pragma maplibre: define lowp float opacity 515#pragma maplibre: define lowp float offset 516#pragma maplibre: define mediump float gapwidth 517#pragma maplibre: define mediump float width 518#pragma maplibre: define lowp float floorwidth 519#pragma maplibre: define lowp vec4 pattern_from 520#pragma maplibre: define lowp vec4 pattern_to 521#pragma maplibre: define lowp float pixel_ratio_from 522#pragma maplibre: define lowp float pixel_ratio_to 523void main() { 524#pragma maplibre: initialize lowp float blur 525#pragma maplibre: initialize lowp float opacity 526#pragma maplibre: initialize lowp float offset 527#pragma maplibre: initialize mediump float gapwidth 528#pragma maplibre: initialize mediump float width 529#pragma maplibre: initialize lowp float floorwidth 530#pragma maplibre: initialize mediump vec4 pattern_from 531#pragma maplibre: initialize mediump vec4 pattern_to 532#pragma maplibre: initialize lowp float pixel_ratio_from 533#pragma maplibre: initialize lowp float pixel_ratio_to 534if (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=vec2(ivec2(a_data.xy)-128);float a_direction=float(int(a_data.z & 3u)-1);float a_linesofar=float((a_data.z >> 2u)+a_data.w*64u)*LINE_DISTANCE_SCALE;vec2 pos=vec2(a_pos_normal >> 1);mediump vec2 normal=vec2(a_pos_normal & 1);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);
534float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude; 535#ifdef GLOBE 536v_depth=gl_Position.z/gl_Position.w; 537#endif 538#ifdef TERRAIN3D 539v_gamma_scale=1.0; 540#else 541float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective; 542#endif 543v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}`),lineSDF:t8(`uniform lowp float u_lineatlas_width;uniform sampler2D u_image;uniform float u_mix;in vec2 v_normal;flat in vec2 v_width2;in vec2 v_tex_a;in vec2 v_tex_b;in float v_gamma_scale; 544#ifdef GLOBE 545in float v_depth; 546#endif 547#pragma maplibre: define highp vec4 color 548#pragma maplibre: define lowp float blur 549#pragma maplibre: define lowp float opacity 550#pragma maplibre: define mediump float width 551#pragma maplibre: define lowp float floorwidth 552#pragma maplibre: define mediump vec4 dasharray_from 553#pragma maplibre: define mediump vec4 dasharray_to 554void main() { 555#pragma maplibre: initialize highp vec4 color 556#pragma maplibre: initialize lowp float blur 557#pragma maplibre: initialize lowp float opacity 558#pragma maplibre: initialize mediump float width 559#pragma maplibre: initialize lowp float floorwidth 560#pragma maplibre: initialize mediump vec4 dasharray_from 561#pragma maplibre: initialize mediump vec4 dasharray_to 562clipAntimeridian();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 sdfdist_a=texture(u_image,v_tex_a).a;float sdfdist_b=texture(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);
562float sdfgamma=(u_lineatlas_width/256.0/u_device_pixel_ratio)/min(dasharray_from.w,dasharray_to.w);alpha*=smoothstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);fragColor=color*(alpha*opacity); 563#ifdef GLOBE 564if (v_depth > 1.0) {discard;} 565#endif 566#ifdef OVERDRAW_INSPECTOR 567fragColor=vec4(1.0); 568#endif 569}`,` 570#define scale 0.015873016 571#define LINE_DISTANCE_SCALE 2.0 572layout(location=0) in ivec2 a_pos_normal;layout(location=1) in uvec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;uniform float u_tileratio;uniform float u_crossfade_from;uniform float u_crossfade_to;uniform float u_lineatlas_height;out vec2 v_normal;flat out vec2 v_width2;out vec2 v_tex_a;out vec2 v_tex_b;out float v_gamma_scale; 573#ifdef GLOBE 574out float v_depth; 575#endif 576#pragma maplibre: define highp vec4 color 577#pragma maplibre: define lowp float blur 578#pragma maplibre: define lowp float opacity 579#pragma maplibre: define mediump float gapwidth 580#pragma maplibre: define lowp float offset 581#pragma maplibre: define mediump float width 582#pragma maplibre: define lowp float floorwidth 583#pragma maplibre: define mediump vec4 dasharray_from 584#pragma maplibre: define mediump vec4 dasharray_to 585void main() { 586#pragma maplibre: initialize highp vec4 color 587#pragma maplibre: initialize lowp float blur 588#pragma maplibre: initialize lowp float opacity 589#pragma maplibre: initialize mediump float gapwidth 590#pragma maplibre: initialize lowp float offset 591#pragma maplibre: initialize mediump float width 592#pragma maplibre: initialize lowp float floorwidth 593#pragma maplibre: initialize mediump vec4 dasharray_from 594#pragma maplibre: initialize mediump vec4 dasharray_to 595if (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=vec2(ivec2(a_data.xy)-128);float a_direction=float(int(a_data.z & 3u)-1);float a_linesofar=float((a_data.z >> 2u)+a_data.w*64u)*LINE_DISTANCE_SCALE;vec2 pos=vec2(a_pos_normal >> 1);mediump vec2 normal=vec2(a_pos_normal & 1);normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude; 596#ifdef GLOBE 597v_depth=gl_Position.z/gl_Position.w; 598#endif 599#ifdef TERRAIN3D 600v_gamma_scale=1.0; 601#else 602float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective; 603#endif 604float u_patternscale_a_x=u_tileratio/dasharray_from.w/u_crossfade_from;float u_patternscale_a_y=-dasharray_from.z/2.0/u_lineatlas_height;float u_patternscale_b_x=u_tileratio/dasharray_to.w/u_crossfade_to;float u_patternscale_b_y=-dasharray_to.z/2.0/u_lineatlas_height;v_tex_a=vec2(a_linesofar*u_patternscale_a_x/floorwidth,normal.y*u_patternscale_a_y+(float(dasharray_from.y)+0.5)/u_lineatlas_height);v_tex_b=vec2(a_linesofar*u_patternscale_b_x/floorwidth,normal.y*u_patternscale_b_y+(float(dasharray_to.y)+0.5)/u_lineatlas_height);v_width2=vec2(outset,inset);}`),lineGradientSDF:t8(`uniform sampler2D u_image;uniform sampler2D u_image_dash;uniform float u_mix;uniform lowp float u_lineatlas_width;in vec2 v_normal;flat in vec2 v_width2;in vec2 v_tex_a;in vec2 v_tex_b;in float v_gamma_scale;in highp vec2 v_uv; 605#ifdef GLOBE 606in float v_depth; 607#endif 608#pragma maplibre: define lowp float blur 609#pragma maplibre: define lowp float opacity 610#pragma maplibre: define mediump float width 611#pragma maplibre: define lowp float floorwidth 612#pragma maplibre: define mediump vec4 dasharray_from 613#pragma maplibre: define mediump vec4 dasharray_to 614void main() { 615#pragma maplibre: initialize lowp float blur 616#pragma maplibre: initialize lowp float opacity 617#pragma maplibre: initialize mediump float width 618#pragma maplibre: initialize lowp float floorwidth 619#pragma maplibre: initialize mediump vec4 dasharray_from 620#pragma maplibre: initialize mediump vec4 dasharray_to 621clipAntimeridian();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);vec4 color=texture(u_image,v_uv);float sdfdist_a=texture(u_image_dash,v_tex_a).a;float sdfdist_b=texture(u_image_dash,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);
621float sdfgamma=(u_lineatlas_width/256.0)/min(dasharray_from.w,dasharray_to.w);float dash_alpha=smoothstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);fragColor=color*(alpha*dash_alpha*opacity); 622#ifdef GLOBE 623if (v_depth > 1.0) {discard;} 624#endif 625#ifdef OVERDRAW_INSPECTOR 626fragColor=vec4(1.0); 627#endif 628}`,` 629#define scale 0.015873016 630#define LINE_DISTANCE_SCALE 2.0 631layout(location=0) in ivec2 a_pos_normal;layout(location=1) in uvec4 a_data;layout(location=2) in float a_uv_x;layout(location=3) in float a_split_index;uniform vec2 u_translation;uniform mediump float u_ratio;uniform float u_image_height;uniform float u_tileratio;uniform float u_crossfade_from;uniform float u_crossfade_to;uniform float u_lineatlas_height;out vec2 v_normal;flat out vec2 v_width2;out float v_gamma_scale;out highp vec2 v_uv;out vec2 v_tex_a;out vec2 v_tex_b; 632#ifdef GLOBE 633out float v_depth; 634#endif 635#pragma maplibre: define lowp float blur 636#pragma maplibre: define lowp float opacity 637#pragma maplibre: define mediump float gapwidth 638#pragma maplibre: define lowp float offset 639#pragma maplibre: define mediump float width 640#pragma maplibre: define lowp float floorwidth 641#pragma maplibre: define mediump vec4 dasharray_from 642#pragma maplibre: define mediump vec4 dasharray_to 643void main() { 644#pragma maplibre: initialize lowp float blur 645#pragma maplibre: initialize lowp float opacity 646#pragma maplibre: initialize mediump float gapwidth 647#pragma maplibre: initialize lowp float offset 648#pragma maplibre: initialize mediump float width 649#pragma maplibre: initialize lowp float floorwidth 650#pragma maplibre: initialize mediump vec4 dasharray_from 651#pragma maplibre: initialize mediump vec4 dasharray_to 652if (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=vec2(ivec2(a_data.xy)-128);float a_direction=float(int(a_data.z & 3u)-1);float a_linesofar=float((a_data.z >> 2u)+a_data.w*64u)*LINE_DISTANCE_SCALE;float texel_height=1.0/u_image_height;float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=vec2(a_pos_normal >> 1);mediump vec2 normal=vec2(a_pos_normal & 1);normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude; 653#ifdef GLOBE 654v_depth=gl_Position.z/gl_Position.w; 655#endif 656#ifdef TERRAIN3D 657v_gamma_scale=1.0; 658#else 659float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective; 660#endif 661float u_patternscale_a_x=u_tileratio/dasharray_from.w/u_crossfade_from;float u_patternscale_a_y=-dasharray_from.z/2.0/u_lineatlas_height;float u_patternscale_b_x=u_tileratio/dasharray_to.w/u_crossfade_to;float u_patternscale_b_y=-dasharray_to.z/2.0/u_lineatlas_height;v_tex_a=vec2(a_linesofar*u_patternscale_a_x/floorwidth,normal.y*u_patternscale_a_y+(float(dasharray_from.y)+0.5)/u_lineatlas_height);v_tex_b=vec2(a_linesofar*u_patternscale_b_x/floorwidth,normal.y*u_patternscale_b_y+(float(dasharray_to.y)+0.5)/u_lineatlas_height);v_width2=vec2(outset,inset);}`),layerOpacity:t8(`uniform sampler2D u_image;uniform float u_opacity;in vec2 v_pos;void main() {fragColor=texture(u_image,v_pos)*u_opacity; 662#ifdef OVERDRAW_INSPECTOR 663fragColor=vec4(0.0); 664#endif 665}`,"layout(location=0) in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=vec4(a_pos.x*2.0-1.0,1.0-a_pos.y*2.0,0.0,1.0);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"),raster:t8(`uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;in vec3 v_pos0;in vec3 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture(u_image0,v_pos0.xy/v_pos0.z);vec4 color1=texture(u_image1,v_pos1.xy/v_pos1.z);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);fragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a); 666#ifdef OVERDRAW_INSPECTOR 667fragColor=vec4(1.0); 668#endif 669}`,`uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;uniform vec3 u_image_warp;uniform vec4 u_coords_top;uniform vec4 u_coords_bottom;layout(location=0) in vec2 a_pos;out vec3 v_pos0;out vec3 v_pos1;void main() {vec2 fractionalPos=a_pos/8192.0;vec2 topLeft=u_coords_top.xy;vec2 topRight=u_coords_top.zw;vec2 bottomLeft=u_coords_bottom.xy;vec2 bottomRight=u_coords_bottom.zw;
669vec2 bilinearPos=mix(mix(topLeft,topRight,fractionalPos.x),mix(bottomLeft,bottomRight,fractionalPos.x),fractionalPos.y);float denominator=dot(u_image_warp.xy,fractionalPos)+1.0;vec2 acrossTop=topRight-topLeft+u_image_warp.x*topRight;vec2 downLeft=bottomLeft-topLeft+u_image_warp.y*bottomLeft;vec2 projectivePos=(acrossTop*fractionalPos.x+downLeft*fractionalPos.y+topLeft)/denominator;vec2 position=mix(projectivePos,bilinearPos,u_image_warp.z);gl_Position=projectTile(position,position);vec2 texturePos=((fractionalPos-0.5)/u_buffer_scale)+0.5; 670#ifdef GLOBE 671if (a_pos.y <-32767.5) {texturePos.y=0.0;}if (a_pos.y > 32766.5) {texturePos.y=1.0;} 672#endif 673float perspectiveRatio=mix(1.0/denominator,1.0,u_image_warp.z);v_pos0=vec3(texturePos*perspectiveRatio,perspectiveRatio);vec2 parentPos=(texturePos*u_scale_parent)+u_tl_parent;v_pos1=vec3(parentPos*perspectiveRatio,perspectiveRatio);}`),symbolIcon:t8(`uniform sampler2D u_texture;in vec2 v_tex;flat in float v_total_opacity;void main() {fragColor=texture(u_texture,v_tex)*v_total_opacity; 674#ifdef OVERDRAW_INSPECTOR 675fragColor=vec4(1.0); 676#endif 677}`,`layout(location=0) in vec4 a_pos_offset;layout(location=1) in uvec4 a_data;layout(location=2) in vec4 a_pixeloffset;layout(location=3) in vec3 a_projected_pos;layout(location=4) in uint a_fade_opacity;layout(location=5) in float a_height_offset;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform bool u_rotate_symbol;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;uniform bool u_is_offset;uniform bool u_height_anchor_ground;out vec2 v_tex;flat out float v_total_opacity; 678#pragma maplibre: define lowp float opacity 679void main() { 680#pragma maplibre: initialize lowp float opacity 681vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=vec2(a_data.xy);vec2 a_size=vec2(a_data.zw);float a_size_min=float(a_data.z >> 1u);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=a_height_offset+(u_height_anchor_ground ? get_elevation(a_pos) : 0.0);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_symbol_fade_change :-u_symbol_fade_change;float visibility=calculate_visibility(projectedPoint);v_total_opacity=opacity*max(0.0,min(visibility,fade_opacity[0]+fade_change));if (v_total_opacity < 0.1){gl_Position=vec4(-2.,-2.,-2.,1.);return;}highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ? 682camera_to_anchor_distance/u_camera_to_center_distance : 683u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);if (!u_is_offset) {size*=perspective_ratio;}float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0; 684#ifdef GLOBE 685if(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);} 686#endif 687vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}gl_Position=finalPos;v_tex=a_tex/u_texsize;}`),symbolSDF:t8(`#define SDF_PX 8.0 688uniform bool u_is_halo;uniform bool u_is_plain;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform bool u_is_text;in vec2 v_data0;in vec3 v_data1; 689#pragma maplibre: define highp vec4 fill_color 690#pragma maplibre: define highp vec4 halo_color 691#pragma maplibre: define lowp float halo_width 692#pragma maplibre: define lowp float halo_blur 693void main() { 694#pragma maplibre: initialize highp vec4 fill_color 695#pragma maplibre: initialize highp vec4 halo_color 696#pragma maplibre: initialize lowp float halo_width 697#pragma maplibre: initialize lowp float halo_blur 698float EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float total_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float inner_edge=(256.0-64.0)/256.0;lowp float dist=texture(u_texture,tex).a;lowp vec4 color_alpha_out_text,color_alpha_out_halo;if (u_is_plain){highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(inner_edge-gamma_scaled,inner_edge+gamma_scaled,dist);color_alpha_out_text=total_opacity*alpha*fill_color;}if (u_is_halo) {float gamma_halo=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);float inner_edge_halo=inner_edge+gamma_halo*gamma_scale;highp float gamma_scaled_halo=gamma_halo*gamma_scale;highp float alpha_halo=smoothstep(inner_edge_halo-gamma_scaled_halo,inner_edge_halo+gamma_scaled_halo,dist);highp float halo_edge=(6.0-halo_width/fontScale)/SDF_PX;alpha_halo= min(smoothstep(halo_edge-gamma_scaled_halo,halo_edge+gamma_scaled_halo,dist),1.0-alpha_halo);color_alpha_out_halo=total_opacity*alpha_halo*halo_color;}if (u_is_plain && u_is_halo) {fragColor=color_alpha_out_text+(1.-color_alpha_out_text.a)*color_alpha_out_halo;} else if (u_is_halo){fragColor=color_alpha_out_halo;} else {fragColor=color_alpha_out_text;} 699#ifdef OVERDRAW_INSPECTOR 700fragColor=vec4(1.0); 701#endif 702}`,`layout(location=0) in vec4 a_pos_offset;layout(location=1) in uvec4 a_data;layout(location=2) in vec4 a_pixeloffset;layout(location=3) in vec3 a_projected_pos;layout(location=4) in uint a_fade_opacity;layout(location=5) in float a_height_offset;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform bool u_rotate_symbol;uniform vec2 u_texsize;uniform vec2 u_translation;uniform float u_pitched_scale;uniform bool u_is_offset;uniform bool u_height_anchor_ground;out vec2 v_data0;out vec3 v_data1; 703#pragma maplibre: define highp vec4 fill_color 704#pragma maplibre: define highp vec4 halo_color 705#pragma maplibre: define lowp float opacity 706#pragma maplibre: define lowp float halo_width 707#pragma maplibre: define lowp float halo_blur 708void main() { 709#pragma maplibre: initialize highp vec4 fill_color 710#pragma maplibre: initialize highp vec4 halo_color 711#pragma maplibre: initialize lowp float opacity 712#pragma maplibre: initialize lowp float halo_width 713#pragma maplibre: initialize lowp float halo_blur 714vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=vec2(a_data.xy);vec2 a_size=vec2(a_data.zw);float a_size_min=float(a_data.z >> 1u);vec2 a_pxoffset=a_pixeloffset.xy/16.0;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=a_height_offset+(u_height_anchor_ground ? get_elevation(a_pos) : 0.0);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_symbol_fade_change :-u_symbol_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));float total_opacity=opacity*interpolated_fade_opacity;if (total_opacity < 0.1){gl_Position=vec4(-2.,-2.,-2.,1.);return;}highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ? 715camera_to_anchor_distance/u_camera_to_center_distance : 716u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);if (!u_is_offset) {size*=perspective_ratio;}float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0; 717#ifdef GLOBE 718if(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);} 719#endif 720vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,total_opacity);}`),symbolTextAndIcon:t8(`#define SDF_PX 8.0 721#define SDF 1.0 722#define ICON 0.0 723uniform bool u_is_halo;uniform bool u_is_text;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;in vec4 v_data0;in vec3 v_data1;flat in float v_is_sdf; 724#pragma maplibre: define highp vec4 fill_color 725#pragma maplibre: define highp vec4 halo_color 726#pragma maplibre: define lowp float halo_width 727#pragma maplibre: define lowp float halo_blur 728void main() { 729#pragma maplibre: initialize highp vec4 fill_color 730#pragma maplibre: initialize highp vec4 halo_color 731#pragma maplibre: initialize lowp float halo_width 732#pragma maplibre: initialize lowp float halo_blur 733float total_opacity=v_data1[2];if (v_is_sdf==ICON) {vec2 tex_icon=v_data0.zw;
733fragColor=texture(u_texture_icon,tex_icon)*total_opacity; 734#ifdef OVERDRAW_INSPECTOR 735fragColor=vec4(1.0); 736#endif 737return;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;lowp float dist=texture(u_texture,tex).a;lowp vec4 color_alpha_out,color_alpha_out_halo;if (u_is_text) {highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);color_alpha_out=fill_color*(alpha*total_opacity);}if (u_is_halo) {highp float gamma_halo=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);lowp float buff_halo=(6.0-halo_width/fontScale)/SDF_PX;highp float gamma_scaled_halo=gamma_halo*gamma_scale;highp float alpha_halo=smoothstep(buff_halo-gamma_scaled_halo,buff_halo+gamma_scaled_halo,dist);color_alpha_out_halo=halo_color*(alpha_halo*total_opacity);}if (u_is_text && u_is_halo) {fragColor=color_alpha_out+(1.-color_alpha_out.a)*color_alpha_out_halo;} else if (u_is_halo) {fragColor=color_alpha_out_halo;} else {fragColor=color_alpha_out;} 738#ifdef OVERDRAW_INSPECTOR 739fragColor=vec4(1.0); 740#endif 741}`,`layout(location=0) in vec4 a_pos_offset;layout(location=1) in uvec4 a_data;layout(location=2) in vec3 a_projected_pos;layout(location=3) in uint a_fade_opacity;layout(location=4) in float a_height_offset;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_rotate_symbol;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;uniform bool u_is_offset;uniform bool u_height_anchor_ground;out vec4 v_data0;out vec3 v_data1;flat out float v_is_sdf; 742#pragma maplibre: define highp vec4 fill_color 743#pragma maplibre: define highp vec4 halo_color 744#pragma maplibre: define lowp float opacity 745#pragma maplibre: define lowp float halo_width 746#pragma maplibre: define lowp float halo_blur 747void main() { 748#pragma maplibre: initialize highp vec4 fill_color 749#pragma maplibre: initialize highp vec4 halo_color 750#pragma maplibre: initialize lowp float opacity 751#pragma maplibre: initialize lowp float halo_width 752#pragma maplibre: initialize lowp float halo_blur 753vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=vec2(a_data.xy);vec2 a_size=vec2(a_data.zw);float a_size_min=float(a_data.z >> 1u);float is_sdf=float(a_data.z & 1u);float ele=a_height_offset+(u_height_anchor_ground ? get_elevation(a_pos) : 0.0);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_symbol_fade_change :-u_symbol_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));float total_opacity=opacity*interpolated_fade_opacity;if (total_opacity < 0.1){gl_Position=vec4(-2.,-2.,-2.,1.);return;}highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ? 754camera_to_anchor_distance/u_camera_to_center_distance : 755u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);if (!u_is_offset) {size*=perspective_ratio;}float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0; 756#ifdef GLOBE 757if(u_pitch_with_map && !u_is_along_line) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);} 758#endif 759vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec3(gamma_scale,size,total_opacity);v_is_sdf=is_sdf;}`),terrain:t8("uniform sampler2D u_texture;uniform vec4 u_fog_color;uniform vec4 u_horizon_color;uniform float u_fog_ground_blend;uniform float u_fog_ground_blend_opacity;uniform float u_horizon_fog_blend;uniform bool u_is_globe_mode;in vec2 v_texture_pos;in float v_fog_depth;const float gamma=2.2;vec4 gammaToLinear(vec4 color) {return pow(color,vec4(gamma));}vec4 linearToGamma(vec4 color) {return pow(color,vec4(1.0/gamma));}void main() {vec4 surface_color=texture(u_texture,vec2(v_texture_pos.x,1.0-v_texture_pos.y));if (!u_is_globe_mode && u_fog_ground_blend_opacity > 0.0 && v_fog_depth > u_fog_ground_blend) {vec4 surface_color_linear=gammaToLinear(surface_color);float blend_color=smoothstep(0.0,1.0,max((v_fog_depth-u_horizon_fog_blend)/(1.0-u_horizon_fog_blend),0.0));vec4 fog_horizon_color_linear=mix(gammaToLinear(u_fog_color),gammaToLinear(u_horizon_color),blend_color);
759float factor_fog=max(v_fog_depth-u_fog_ground_blend,0.0)/(1.0-u_fog_ground_blend);fragColor=linearToGamma(mix(surface_color_linear,fog_horizon_color_linear,pow(factor_fog,2.0)*u_fog_ground_blend_opacity));} else {fragColor=surface_color;}}","layout(location=0) in vec3 a_pos3d;uniform mat4 u_fog_matrix;uniform float u_ele_delta;out vec2 v_texture_pos;out float v_fog_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);vec4 pos=u_fog_matrix*vec4(a_pos3d.xy,ele,1.0);v_fog_depth=pos.z/pos.w*0.5+0.5;}"),terrainDepth:t8("in float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {fragColor=pack(v_depth);}","layout(location=0) in vec3 a_pos3d;uniform float u_ele_delta;out float v_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);v_depth=gl_Position.z/gl_Position.w;}"),atmosphere:t8(`#ifdef GL_ES 760precision highp float; 761#endif 762in vec3 view_direction;uniform vec3 u_sun_pos;uniform vec3 u_globe_position;uniform float u_globe_radius;uniform float u_atmosphere_blend;/**Shader use from https:*Made some change to adapt to MapLibre Globe geometry*/const float PI=3.141592653589793;const int iSteps=5;const int jSteps=3;/*radius of the planet*/const float EARTH_RADIUS=6371e3;/*radius of the atmosphere*/const float ATMOS_RADIUS=6471e3;vec2 rsi(vec3 r0,vec3 rd,float sr) {float a=dot(rd,rd);float b=2.0*dot(rd,r0);float c=dot(r0,r0)-(sr*sr);float d=(b*b)-4.0*a*c;if (d < 0.0) return vec2(1e5,-1e5);return vec2((-b-sqrt(d))/(2.0*a),(-b+sqrt(d))/(2.0*a));}vec4 atmosphere(vec3 r,vec3 r0,vec3 pSun,float iSun,float rPlanet,float rAtmos,vec3 kRlh,float kMie,float shRlh,float shMie,float g) {pSun=normalize(pSun);r=normalize(r);vec2 p=rsi(r0,r,rAtmos);if (p.x > p.y) {return vec4(0.0,0.0,0.0,1.0);}if (p.x < 0.0) {p.x=0.0;}vec3 pos=r0+r*p.x;vec2 p2=rsi(r0,r,rPlanet);if (p2.x <=p2.y && p2.x > 0.0) {p.y=min(p.y,p2.x);}float iStepSize=(p.y-p.x)/float(iSteps);float iTime=p.x+iStepSize*0.5;vec3 totalRlh=vec3(0,0,0);vec3 totalMie=vec3(0,0,0);float iOdRlh=0.0;float iOdMie=0.0;float mu=dot(r,pSun);float mumu=mu*mu;float gg=g*g;float pRlh=3.0/(16.0*PI)*(1.0+mumu);float pMie=3.0/(8.0*PI)*((1.0-gg)*(mumu+1.0))/(pow(1.0+gg-2.0*mu*g,1.5)*(2.0+gg));for (int i=0; i < iSteps; i++) {vec3 iPos=r0+r*iTime;float iHeight=length(iPos)-rPlanet;float odStepRlh=exp(-iHeight/shRlh)*iStepSize;float odStepMie=exp(-iHeight/shMie)*iStepSize;iOdRlh+=odStepRlh;iOdMie+=odStepMie;float jStepSize=rsi(iPos,pSun,rAtmos).y/float(jSteps);float jTime=jStepSize*0.5;float jOdRlh=0.0;float jOdMie=0.0;for (int j=0; j < jSteps; j++) {vec3 jPos=iPos+pSun*jTime;float jHeight=length(jPos)-rPlanet;jOdRlh+=exp(-jHeight/shRlh)*jStepSize;jOdMie+=exp(-jHeight/shMie)*jStepSize;jTime+=jStepSize;}vec3 attn=exp(-(kMie*(iOdMie+jOdMie)+kRlh*(iOdRlh+jOdRlh)));totalRlh+=odStepRlh*attn;totalMie+=odStepMie*attn;iTime+=iStepSize;}float opacity=exp(-(length(kRlh)*length(totalRlh)+kMie*length(totalMie)));vec3 color=iSun*(pRlh*kRlh*totalRlh+pMie*kMie*totalMie);return vec4(color,opacity);}void main() {vec3 scale_camera_pos=-u_globe_position*EARTH_RADIUS/u_globe_radius;vec4 color=atmosphere(normalize(view_direction),scale_camera_pos,u_sun_pos,22.0,EARTH_RADIUS,ATMOS_RADIUS,vec3(5.5e-6,13.0e-6,22.4e-6),21e-6,8e3,1.2e3,0.758 763);color.rgb=1.0-exp(-1.0*color.rgb);color=pow(color,vec4(1.0/2.2));fragColor=vec4(color.rgb,1.0-color.a)*u_atmosphere_blend;}`,"layout(location=0) in vec2 a_pos;uniform mat4 u_inv_proj_matrix;out vec3 view_direction;void main() {view_direction=(u_inv_proj_matrix*vec4(a_pos,0.0,1.0)).xyz;gl_Position=vec4(a_pos,0.0,1.0);}"),sky:t8("uniform vec4 u_sky_color;uniform vec4 u_horizon_color;uniform vec2 u_horizon;uniform vec2 u_horizon_normal;uniform float u_sky_horizon_blend;uniform float u_sky_blend;uniform vec3 u_globe_position;uniform float u_globe_radius;uniform float u_atmosphere_blend;in vec3 v_view_direction;const float ATMOSPHERE_HEIGHT_TO_GLOBE_RADIUS=100000.0/6371000.0;void main() {float x=gl_FragCoord.x;float y=gl_FragCoord.y;float blend=(y-u_horizon.y)*u_horizon_normal.y+(x-u_horizon.x)*u_horizon_normal.x;float opacity=1.0;if (u_sky_blend > 0.0) {vec3 ray=normalize(v_view_direction);float globe_distance=length(u_globe_position);float angle_to_globe_center=acos(clamp(dot(ray,u_globe_position)/globe_distance,-1.0,1.0));float horizon_angle=asin(min(u_globe_radius/globe_distance,1.0));blend=mix(blend,((angle_to_globe_center-horizon_angle)*u_camera_to_center_distance+1.0)*u_device_pixel_ratio,u_sky_blend);float closest_approach=max(dot(ray,u_globe_position),0.0);
763float lowest_altitude=sqrt(max(globe_distance*globe_distance-closest_approach*closest_approach,0.0))-u_globe_radius;float atmosphere_height=u_globe_radius*ATMOSPHERE_HEIGHT_TO_GLOBE_RADIUS;float inside_atmosphere=1.0-smoothstep(atmosphere_height,10.0*atmosphere_height,globe_distance-u_globe_radius);float through_atmosphere=1.0-smoothstep(0.0,atmosphere_height,lowest_altitude);opacity=inside_atmosphere*through_atmosphere*(1.0-u_atmosphere_blend);}if (blend > 0.0) {if (blend < u_sky_horizon_blend) {fragColor=mix(u_sky_color,u_horizon_color,pow(1.0-blend/u_sky_horizon_blend,2.0));} else {fragColor=u_sky_color;}}fragColor*=mix(1.0,opacity,u_sky_blend);}","layout(location=0) in vec2 a_pos;uniform mat4 u_inv_proj_matrix;out vec3 v_view_direction;void main() {v_view_direction=(u_inv_proj_matrix*vec4(a_pos,0.0,1.0)).xyz;gl_Position=vec4(a_pos,1.0,1.0);}")};function t8(t,i){let r=/#pragma maplibre: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,a=i.match(/in ([\w]+) ([\w]+)/g),o=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),s=i.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),n=s?s.concat(o):o,l=a?a.length:0,h={};return{fragmentSource:t=t.replace(r,(t,i,r,a,o)=>(h[o]=!0,"define"===i?` 764#ifndef HAS_UNIFORM_u_${o} 765in ${r} ${a} ${o}; 766#else 767uniform ${r} ${a} u_${o}; 768#endif 769`:` 770#ifdef HAS_UNIFORM_u_${o} 771 ${r} ${a} ${o} = u_${o}; 772#endif 773`)),vertexSource:i=i.replace(r,(t,i,r,a,o)=>{let s="float"===a?"vec2":"vec4",n=o.match(/color/)?"color":s;return h[o]?"define"===i?` 774#ifndef HAS_UNIFORM_u_${o} 775uniform lowp float u_${o}_t; 776layout(location = ${l++}) in ${r} ${s} a_${o}; 777out ${r} ${a} ${o}; 778#else 779uniform ${r} ${a} u_${o}; 780#endif 781`:"vec4"===n?` 782#ifndef HAS_UNIFORM_u_${o} 783 ${o} = a_${o}; 784#else 785 ${r} ${a} ${o} = u_${o}; 786#endif 787`:` 788#ifndef HAS_UNIFORM_u_${o} 789 ${o} = unpack_mix_${n}(a_${o}, u_${o}_t); 790#else 791 ${r} ${a} ${o} = u_${o}; 792#endif 793`:"define"===i?` 794#ifndef HAS_UNIFORM_u_${o} 795uniform lowp float u_${o}_t; 796layout(location = ${l++}) in ${r} ${s} a_${o}; 797#else 798uniform ${r} ${a} u_${o}; 799#endif 800`:"vec4"===n?` 801#ifndef HAS_UNIFORM_u_${o} 802 ${r} ${a} ${o} = a_${o}; 803#else 804 ${r} ${a} ${o} = u_${o}; 805#endif 806`:` 807#ifndef HAS_UNIFORM_u_${o} 808 ${r} ${a} ${o} = unpack_mix_${n}(a_${o}, u_${o}_t); 809#else 810 ${r} ${a} ${o} = u_${o}; 811#endif 812`}),staticAttributes:a,staticUniforms:n}}let t9="#define PROJECTION_MERCATOR",t7="mercator";var ie=class{constructor(){this._cachedMesh=null}get name(){return"mercator"}get useSubdivision(){return!1}get shaderVariantName(){return t7}get shaderDefine(){return t9}get shaderPreludeCode(){return t6.projectionMercator}get vertexShaderPreludeCode(){return t6.projectionMercator.vertexSource}get subdivisionGranularity(){return P.vt.noSubdivision}get useGlobeControls(){return!1}get transitionState(){return 0}destroy(){}getMeshFromTileID(t,i,r,a,o){if(this._cachedMesh)return this._cachedMesh;let s=new P.Gt;s.emplaceBack(0,0),s.emplaceBack(P.Lr,0),s.emplaceBack(0,P.Lr),s.emplaceBack(P.Lr,P.Lr);let n=t.createVertexBuffer(s,eW.members),l=P.Bt.simpleSegment(0,0,4,2),h=new P.Jt;h.emplaceBack(1,0,2),h.emplaceBack(1,2,3);let c=t.createIndexBuffer(h);return this._cachedMesh=new eq(n,c,l),this._cachedMesh}recalculate(){}hasTransition(){return!1}},it=class t{constructor(t=0,i=0,r=0,a=0){if(isNaN(t)||t<0||isNaN(i)||i<0||isNaN(r)||r<0||isNaN(a)||a<0)throw Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=i,this.left=r,this.right=a}interpolate(t,i,r){return null!=i.top&&null!=t.top&&(this.top=P.un.number(t.top,i.top,r)),null!=i.bottom&&null!=t.bottom&&(this.bottom=P.un.number(t.bottom,i.bottom,r)),null!=i.left&&null!=t.left&&(this.left=P.un.number(t.left,i.left,r)),null!=i.right&&null!=t.right&&(this.right=P.un.number(t.right,i.right,r)),this}getCenter(t,i){let r=(0,P.Bn)((this.left+t-this.right)/2,0,t),a=(0,P.Bn)((this.top+i-this.bottom)/2,0,i);return new P.Li(r,a)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new t(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}};function ii(t,i){if(!t.renderWorldCopies||t.lngRange)return;let r=i.lng-t.center.lng;i.lng+=r>180?-360:360*(r<-180)}function ir(t){return Math.max(0,Math.floor(t))}var ia=class{constructor(t,i){this.applyConstrain=(t,i)=>null===this._constrainOverride?this._callbacks.defaultConstrain(t,i):this._constrainOverride(t,i),this._callbacks=t,this._tileSize=512,this._renderWorldCopies=i?.renderWorldCopies===void 0||!!i?.renderWorldCopies,this._minZoom=i?.minZoom||0,this._maxZoom=i?.maxZoom||22,this._minPitch=i?.minPitch===void 0||i?.minPitch===null?0:i?.minPitch,this._maxPitch=i?.maxPitch===void 0||i?.maxPitch===null?60:i?.maxPitch,this._constrainOverride=i?.constrainOverride??null,this.setMaxBounds(),this._width=0,this._height=0,this._center=new P.lt(0,0),this._elevation=0,this._zoom=0,this._tileZoom=ir(this._zoom),this._scale=(0,P.Fr)(this._zoom),this._bearingInRadians=0,this._fovInRadians=.6435011087932844,this._pitchInRadians=0,this._rollInRadians=0,this._unmodified=!0,this._edgeInsets=new it,this._minElevationForCurrentTile=0,this._autoCalculateNearFarZ=!0}apply(t,i){this._constrainOverride=t.constrainOverride,this._latRange=t.latRange,this._lngRange=t.lngRange,this._width=t.width,this._height=t.height,this._center=t.center,this._elevation=t.elevation,this._minElevationForCurrentTile=t.minElevationForCurrentTile,this._zoom=t.zoom,this._tileZoom=ir(this._zoom),this._scale=(0,P.Fr)(this._zoom),this._bearingInRadians=t.bearingInRadians,this._fovInRadians=t.fovInRadians,this._pitchInRadians=t.pitchInRadians,this._rollInRadians=t.rollInRadians,this._unmodified=t.unmodified,this._edgeInsets=new it(t.padding.top,t.padding.bottom,t.padding.left,t.padding.right),this._minZoom=t.minZoom,this._maxZoom=t.maxZoom,this._minPitch=t.minPitch,this._maxPitch=t.maxPitch,this._renderWorldCopies=t.renderWorldCopies,this._cameraToCenterDistance=t.cameraToCenterDistance,this._nearZ=t.nearZ,this._farZ=t.farZ,this._autoCalculateNearFarZ=t.autoCalculateNearFarZ,i&&this.constrainInternal(),this._calcMatrices()}
812get pixelsToClipSpaceMatrix(){return this._pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._clipSpaceToPixelsMatrix}get minElevationForCurrentTile(){return this._minElevationForCurrentTile}setMinElevationForCurrentTile(t){this._minElevationForCurrentTile=t}get tileSize(){return this._tileSize}get tileZoom(){return this._tileZoom}get scale(){return this._scale}get width(){return this._width}get height(){return this._height}get bearingInRadians(){return this._bearingInRadians}get lngRange(){return this._lngRange}get latRange(){return this._latRange}get pixelsToGLUnits(){return this._pixelsToGLUnits}get minZoom(){return this._minZoom}setMinZoom(t){if(this._minZoom===t)return;this._minZoom=t;let i=this._unmodified;this.setZoom(this.applyConstrain(this._center,this.zoom).zoom),this._unmodified=i}get maxZoom(){return this._maxZoom}setMaxZoom(t){if(this._maxZoom===t)return;this._maxZoom=t;let i=this._unmodified;this.setZoom(this.applyConstrain(this._center,this.zoom).zoom),this._unmodified=i}get minPitch(){return this._minPitch}setMinPitch(t){if(this._minPitch===t)return;this._minPitch=t;let i=this._unmodified;this.setPitch(Math.max(this.pitch,t)),this._unmodified=i}get maxPitch(){return this._maxPitch}setMaxPitch(t){if(this._maxPitch===t)return;this._maxPitch=t;let i=this._unmodified;this.setPitch(Math.min(this.pitch,t)),this._unmodified=i}get renderWorldCopies(){return this._renderWorldCopies}setRenderWorldCopies(t){void 0===t?t=!0:null===t&&(t=!1),this._renderWorldCopies=t}get constrainOverride(){return this._constrainOverride}setConstrainOverride(t){void 0===t&&(t=null),this._constrainOverride!==t&&(this._constrainOverride=t,this.constrainInternal(),this._calcMatrices())}get worldSize(){return this._tileSize*this._scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new P.Li(this._width,this._height)}get bearing(){return this._bearingInRadians/Math.PI*180}setBearing(t){var i,r,a,o,s,n,l,h,c;let u=(0,P.Pr)(t,-180,180)*Math.PI/180;this._bearingInRadians!==u&&(this._unmodified=!1,this._bearingInRadians=u,this._calcMatrices(),this._rotationMatrix=M(),i=this._rotationMatrix,r=this._rotationMatrix,a=-this._bearingInRadians,o=r[0],s=r[1],n=r[2],l=r[3],h=Math.sin(a),c=Math.cos(a),i[0]=o*c+n*h,i[1]=s*c+l*h,i[2]=-(o*h)+n*c,i[3]=-(s*h)+l*c)}get rotationMatrix(){return this._rotationMatrix}get pitchInRadians(){return this._pitchInRadians}get pitch(){return this._pitchInRadians/Math.PI*180}setPitch(t){let i=(0,P.Bn)(t,this.minPitch,this.maxPitch)/180*Math.PI;this._pitchInRadians!==i&&(this._unmodified=!1,this._pitchInRadians=i,this._calcMatrices())}get rollInRadians(){return this._rollInRadians}get roll(){return this._rollInRadians/Math.PI*180}setRoll(t){let i=t/180*Math.PI;this._rollInRadians!==i&&(this._unmodified=!1,this._rollInRadians=i,this._calcMatrices())}get fovInRadians(){return this._fovInRadians}get fov(){return(0,P.xr)(this._fovInRadians)}setFov(t){t=(0,P.Bn)(t,.1,150),this.fov!==t&&(this._unmodified=!1,this._fovInRadians=(0,P.Yn)(t),this._calcMatrices())}get zoom(){return this._zoom}setZoom(t){let i=this.applyConstrain(this._center,t).zoom;this._zoom!==i&&(this._unmodified=!1,this._zoom=i,this._tileZoom=Math.max(0,Math.floor(i)),this._scale=(0,P.Fr)(i),this.constrainInternal(),this._calcMatrices())}get center(){return this._center}setCenter(t){(t.lat!==this._center.lat||t.lng!==this._center.lng)&&(this._unmodified=!1,this._center=t,this.constrainInternal(),this._calcMatrices())}get elevation(){return this._elevation}setElevation(t){t!==this._elevation&&(this._elevation=t,this.constrainInternal(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}setPadding(t){this._edgeInsets.equals(t)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,t,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this._width,this._height)}get pixelsPerMeter(){return this._pixelPerMeter}get unmodified(){return this._unmodified}get cameraToCenterDistance(){return this._cameraToCenterDistance}get nearZ(){return this._nearZ}get farZ(){return this._farZ}get autoCalculateNearFarZ(){return this._autoCalculateNearFarZ}overrideNearFarZ(t,i){this._autoCalculateNearFarZ=!1,this._nearZ=t,this._farZ=i,this._calcMatrices()}clearNearFarZOverride(){this._autoCalculateNearFarZ=!0,this._calcMatrices()}isPaddingEqual(t){return this._edgeInsets.equals(t)}interpolatePadding(t,i,r){this._unmodified=!1,this._edgeInsets.interpolate(t,i,r),this.constrainInternal(),this._calcMatrices()}resize(t,i,r=!0){this._width=t,this._height=i,r&&this.constrainInternal(),this._calcMatrices()}getMaxBounds(){return this._latRange?.length!==2||this._lngRange?.length!==2?null:new eL([this._lngRange[0],this._latRange[0]],[this._lngRange[1],this._latRange[1]])}setMaxBounds(t){t?(this._lngRange=[t.getWest(),t.getEast()],this._latRange=[t.getSouth(),t.getNorth()],this.constrainInternal()):(this._lngRange=null,this._latRange=[-P.Fn,P.Fn])}getCameraQueryGeometry(t,i){if(1===i.length)return[i[0],t];{let{minX:r,minY:a,maxX:o,maxY:s}=P.pt.fromPoints(i).extend(t);return[new P.Li(r,a),new P.Li(o,a),new P.Li(o,s),new P.Li(r,s),new P.Li(r,a)]}}constrainInternal(){if(!this.center||!this._width||!this._height||this._constraining)return;this._constraining=!0;let t=this._unmodified,{center:i,zoom:r}=this.applyConstrain(this.center,this.zoom);this.setCenter(i),this.setZoom(r),this._unmodified=t,this._constraining=!1}
812_calcMatrices(){if(this._pixelPerMeter=(0,P.ct)(1,this.center.lat)*this.worldSize,!this._width||!this._height)return;this._pixelsToGLUnits=[2/this._width,-2/this._height];let t=(0,P.Si)(new Float64Array(16));(0,P.Ai)(t,t,[this._width/2,-this._height/2,1]),(0,P.ji)(t,t,[1,-1,0]),this._clipSpaceToPixelsMatrix=t,t=(0,P.Si)(new Float64Array(16)),(0,P.Ai)(t,t,[1,-1,1]),(0,P.ji)(t,t,[-1,-1,0]),(0,P.Ai)(t,t,[2/this._width,2/this._height,1]),this._pixelsToClipSpaceMatrix=t;let i=this.fovInRadians/2;this._cameraToCenterDistance=.5/Math.tan(i)*this._height,this._callbacks.calcMatrices()}calculateCenterFromCameraLngLatAlt(t,i,r,a){let o=void 0===r?this.bearing:r,s=a=void 0===a?this.pitch:a,{distanceToCenter:n,clampedElevation:l}=this._distanceToCenterFromAltElevationPitch(i,this.elevation,s),{x:h,y:c}=(0,P.J)(s,o),u=P.nt.fromLngLat(t,i),d=(0,P.rt)(1,u.y),_,p,m=0;do{if((m+=1)>10)break;let t=h*(p=n/d),i=c*p;d=1/(_=new P.nt(u.x+t,u.y+i)).meterInMercatorCoordinateUnits()}while(Math.abs(n-p*d)>1e-12);return{center:_.toLngLat(),elevation:l,zoom:(0,P.Dr)(this.height/2/Math.tan(this.fovInRadians/2)/p/this.tileSize)}}recalculateZoomAndCenter(t){if(this.elevation-t==0)return;let i=1/this.worldSize,r=(0,P.ct)(1,this.center.lat)*this.worldSize,a=P.nt.fromLngLat(this.center,this.elevation),o=a.x/i,s=a.y/i,n=a.z/i,l=this.pitch,h=this.bearing,{x:c,y:u,z:d}=(0,P.J)(l,h),_=this.cameraToCenterDistance,{distanceToCenter:p,clampedElevation:m}=this._distanceToCenterFromAltElevationPitch((n+_*d)/r,t,l),f=p*r,g=new P.nt((o+-(_*c)+c*f)*i,(s+-(_*u)+u*f)*i,0).toLngLat(),v=(0,P.ct)(1,g.lat),y=(0,P.Dr)(this.height/2/Math.tan(this.fovInRadians/2)/p/v/this.tileSize);this._elevation=m,this._center=g,this.setZoom(y)}_distanceToCenterFromAltElevationPitch(t,i,r){let a=-Math.cos((0,P.Yn)(r)),o=t-i,s,n=i;return a*o>=0||.1>Math.abs(a)?n=t+(s=1e4)*a:s=-o/a,{distanceToCenter:s,clampedElevation:n}}getCameraPoint(){let t=Math.tan(this.pitchInRadians)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new P.Li(t*Math.sin(this.rollInRadians),t*Math.cos(this.rollInRadians)))}getMercatorTileCoordinates(t){if(!t)return[0,0,1,1];let i=t.canonical.z>=0?1<<t.canonical.z:2**t.canonical.z;return[t.canonical.x/i,t.canonical.y/i,1/i/P.Lr,1/i/P.Lr]}},io=class{distanceToTile2d(t,i,r,a){return Math.hypot(a.distanceX([t,i]),a.distanceY([t,i]))}getWrap(t,i,r){return r}getTileBoundingVolume(t,i,r,a){let o=Math.min(0,r),s=Math.max(0,r);if(a?.terrain){let r=new P.d(t.z,i,t.z,t.x,t.y),n=a.terrain.getMinMaxElevation(r);o=n.minElevation??o,s=n.maxElevation??s}let n=1<<t.z;return new e8([i+t.x/n,t.y/n,o],[i+(t.x+1)/n,(t.y+1)/n,s])}allowVariableZoom(t,i){let r=t.fov*(Math.abs(Math.cos(t.rollInRadians))*t.height+Math.abs(Math.sin(t.rollInRadians))*t.width)/t.height,a=(0,P.Bn)(78.5-r/2,0,60);return!!i.terrain||t.pitch>a}allowWorldCopies(){return!0}prepareNextFrame(){}};let is=(0,P.Yt)([{name:"a_pos3d",type:"Int16",components:3}]);var il=class extends P.vn{constructor(t){super(),this._lastTilesetChange=S(),this.tileManager=t,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.deltaZoom=1,this.tileSize=t._source.tileSize*2**this.deltaZoom,t.usedForTerrain=!0,t.tileSize=this.tileSize}destruct(){this.tileManager.usedForTerrain=!1,this.tileManager.tileSize=null,this.releaseAllRTT()}getSource(){return this.tileManager._source}update(t,i){this.tileManager.update(t,i),this._renderableTilesKeys=[];let r={},a=!1;for(let o of tr(t,{tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:i}))r[o.key]=!0,this._renderableTilesKeys.push(o.key),this._tiles[o.key]||(o.terrainRttPosMatrix32f=new Float32Array(16),(0,P.Ti)(o.terrainRttPosMatrix32f,0,P.Lr,P.Lr,0,0,1),this._tiles[o.key]=new e3(o,this.tileSize),this._lastTilesetChange=S(),a=!0);for(let t in this._tiles)r[t]||(this._tiles[t].releaseRTT(this.tileManager.map.painter),delete this._tiles[t],a=!0);return a}releaseRTT(t){for(let i in this._tiles){let r=this._tiles[i];(r.tileID.equals(t)||r.tileID.isChildOf(t)||t.isChildOf(r.tileID))&&r.releaseRTT(this.tileManager.map.painter)}}releaseAllRTT(){for(let t in this._tiles)this._tiles[t].releaseRTT(this.tileManager.map.painter)}getRenderableTiles(){return this._renderableTilesKeys.map(t=>this.getTileByID(t))}getTileByID(t){return this._tiles[t]}getTerrainCoords(t,i){return i?this._getTerrainCoordsForTileRanges(t,i):this._getTerrainCoordsForRegularTile(t)}_getTerrainCoordsForRegularTile(t){let i={};for(let r of this._renderableTilesKeys){let a=this._tiles[r].tileID,o=t.clone(),s=(0,P.Wn)();if(a.canonical.equals(t.canonical))(0,P.Ti)(s,0,P.Lr,P.Lr,0,0,1);else if(a.canonical.isChildOf(t.canonical)){let i=a.canonical.z-t.canonical.z,r=a.canonical.x-(a.canonical.x>>i<<i),o=a.canonical.y-(a.canonical.y>>i<<i),n=P.Lr>>i;(0,P.Ti)(s,0,n,n,0,0,1),(0,P.ji)(s,s,[-r*n,-o*n,0])}else{if(!t.canonical.isChildOf(a.canonical))continue;let i=t.canonical.z-a.canonical.z,r=t.canonical.x-(t.canonical.x>>i<<i),o=t.canonical.y-(t.canonical.y>>i<<i),n=P.Lr>>i;(0,P.Ti)(s,0,P.Lr,P.Lr,0,0,1),(0,P.ji)(s,s,[r*n,o*n,0]),(0,P.Ai)(s,s,[1/2**i,1/2**i,0])}o.terrainRttPosMatrix32f=new Float32Array(s),i[r]=o}return i}_getTerrainCoordsForTileRanges(t,i){let r={};for(let a of this._renderableTilesKeys){let o=this._tiles[a].tileID;if(!this._isWithinTileRanges(o,i))continue;let s=t.clone(),n=(0,P.Wn)();if(o.canonical.z===t.canonical.z){let i=t.canonical.x-o.canonical.x+t.wrap*(1<<t.canonical.z),r=t.canonical.y-o.canonical.y;(0,P.Ti)(n,0,P.Lr,P.Lr,0,0,1),(0,P.ji)(n,n,[i*P.Lr,r*P.Lr,0])}else if(o.canonical.z>t.canonical.z){let i=o.canonical.z-t.canonical.z,r=o.canonical.x-(o.canonical.x>>i<<i)+t.wrap*(1<<o.canonical.z),a=o.canonical.y-(o.canonical.y>>i<<i),s=t.canonical.x-(o.canonical.x>>i),l=t.canonical.y-(o.canonical.y>>i),h=P.Lr>>i;(0,P.Ti)(n,0,h,h,0,0,1),(0,P.ji)(n,n,[-r*h+s*P.Lr,-a*h+l*P.Lr,0])}else{let i=t.canonical.z-o.canonical.z,r=t.canonical.x-(t.canonical.x>>i<<i)+t.wrap*(1<<t.canonical.z),a=t.canonical.y-(t.canonical.y>>i<<i),s=(t.canonical.x>>i)-o.canonical.x,l=(t.canonical.y>>i)-o.canonical.y,h=P.Lr<<i;(0,P.Ti)(n,0,h,h,0,0,1),(0,P.ji)(n,n,[r*P.Lr+s*h,a*P.Lr+l*h,0])}s.terrainRttPosMatrix32f=new Float32Array(n),r[a]=s}return r}getSourceTile(t,i){let r=this.tileManager._source,a=t.overscaledZ-this.deltaZoom;if(a>r.maxzoom&&(a=r.maxzoom),a<r.minzoom)return;this._sourceTileCache[t.key]||=t.scaledTo(a).key;let o=this.findTileInCaches(this._sourceTileCache[t.key]);if(!o?.dem&&i)for(;a>=r.minzoom&&!o?.dem;)o=this.findTileInCaches(t.scaledTo(a--).key);return o}findTileInCaches(t){let i=this.tileManager.getTileByID(t);
812return i||(i=this.tileManager._outOfViewCache.getByKey(t))}anyTilesAfterTime(t=S()){return this._lastTilesetChange>=t}_isWithinTileRanges(t,i){let r=i[t.canonical.z];return!!r&&(t.wrap>r.minWrap||t.wrap<r.maxWrap||t.canonical.x>=r.minTileXWrapped&&t.canonical.x<=r.maxTileXWrapped&&t.canonical.y>=r.minTileY&&t.canonical.y<=r.maxTileY)}};let ih=P.Lr*(1-1e-12);var ic=class{constructor(t,i,r,a="auto"){this._meshCache={},this.painter=t,this.tileManager=new il(i),this.options=r,this.exaggeration="number"==typeof r.exaggeration?r.exaggeration:1,this._terrainSkirtLength=a,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache=new Map,this._elevationSamplerCache=new Map}destroy(){for(let t in this._fbo&&=(this._fbo.destroy(),null),this._fboDepthTexture&&=(this._fboDepthTexture.destroy(),null),this._emptyDemTexture&&=(this._emptyDemTexture.destroy(),null),this._emptyDepthTexture&&=(this._emptyDepthTexture.destroy(),null),this._meshCache)this._meshCache[t].destroy();this._meshCache={},this.tileManager.destruct()}getDEMElevation(t,i,r,a=P.Lr){let o=t.normalizeCoordinates(i,r,a);if(!o)return 0;let s=this.getElevationSampler(o.tileID);return s?s(o.x,o.y,a):0}getElevationForLngLatZoom(t,i){if(!(0,P.h)(i,t.wrap()))return 0;let{tileID:r,mercatorX:a,mercatorY:o}=this._getOverscaledTileIDFromLngLatZoom(t,i);return this.getElevation(r,a%P.Lr,o%P.Lr,P.Lr)}getElevationForLngLat(t,i){let r=this.getCoverageIndex();if(r){let i=P.nt.fromLngLat(t),a=id(r,this.exaggeration,i.x,i.y);if(a.demLoaded)return a.elevation}let a=tr(i,{maxzoom:this.tileManager.maxzoom,minzoom:this.tileManager.minzoom,tileSize:512,terrain:this}),o=0;for(let t of a)t.canonical.z>o&&(o=Math.min(t.canonical.z,this.tileManager.maxzoom));return this.getElevationForLngLatZoom(t,o)}getElevation(t,i,r,a=P.Lr){return this.getDEMElevation(t,i,r,a)*this.exaggeration}resetElevationCache(){this._elevationSamplerCache.clear(),this._coverageIndex=void 0}getCoverageIndex(){return void 0===this._coverageIndex&&(this._coverageIndex=this._buildCoverageIndex()),this._coverageIndex}_buildCoverageIndex(){let t=[],i=new Map,r=0,a=0;for(let o of this.tileManager.getRenderableTiles()){if(!o)continue;let{canonical:s,wrap:n}=o.tileID;t.includes(s.z)||t.push(s.z);let l=this.getElevationSampler(o.tileID);i.set(`${n}/${s.z}/${s.x}/${s.y}`,l);let{minElevation:h,maxElevation:c}=this.getMinMaxElevation(o.tileID);r=Math.min(r,h??0),a=Math.max(a,c??0)}return 0===i.size?null:(t.sort((t,i)=>i-t),{zooms:t,samplerPerTile:i,minElevation:r-10,maxElevation:a+10})}getElevationSampler(t){let i=t.key,r=this._elevationSamplerCache.get(i);if(r)return r;let a=this.tileManager.getSourceTile(t,!0),o=a?.dem;if(!a||!o)return null;let s=this._getDEMTileMatrix(t,a),n=s[0]*o.dim,l=s[5]*o.dim,h=s[12]*o.dim+-.5,c=s[13]*o.dim+-.5,u=(t,i,r)=>{let a=8192===r?1:P.Lr/r;return o.sampleBilinear(t*a*n+h,i*a*l+c)};return this._elevationSamplerCache.set(i,u),u}_getDEMTileMatrix(t,i){let r=`${i.tileID.key}/${t.key}`,a=this._demMatrixCache.get(r);if(a)return a;let o=t.canonical.z-i.tileID.canonical.z,s=t.canonical.x-(t.canonical.x>>o<<o),n=t.canonical.y-(t.canonical.y>>o<<o),l=(0,P.xi)(new Float64Array(16),[1/(P.Lr<<o),1/(P.Lr<<o),0]);return(0,P.ji)(l,l,[s*P.Lr,n*P.Lr,0]),this._demMatrixCache.set(r,l),l}getTerrainData(t){if(!this._emptyDemTexture){let t=this.painter.context,i=new P.Dt({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new P.xt(t,i,t.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new P.xt(t,new P.Dt({width:1,height:1}),t.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=(0,P.Si)([])}let i=this.tileManager.getSourceTile(t,!0);if(i?.dem&&(!i.demTexture||i.needsTerrainPrepare)){let t=this.painter.context;i.demTexture||=this.painter.getTileTexture(i.dem.stride),i.demTexture?i.demTexture.update(i.dem.getPixels(),{premultiply:!1}):i.demTexture=new P.xt(t,i.dem.getPixels(),t.gl.RGBA,{premultiply:!1}),i.demTexture.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),i.needsTerrainPrepare=!1}let r=i?this._getDEMTileMatrix(t,i):this._emptyDemMatrix;return{u_depth:2,u_terrain:3,u_terrain_dim:i?.dem?.dim||1,u_terrain_matrix:r,u_terrain_unpack:i?.dem?.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(i?.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:i}}getFramebuffer(){let t=this.painter,i=t.width/devicePixelRatio,r=t.height/devicePixelRatio;return this._fbo&&(this._fbo.width!==i||this._fbo.height!==r)&&(this._fbo.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture),this._fboDepthTexture||(this._fboDepthTexture=new P.xt(t.context,{width:i,height:r,data:null},t.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(t.context.gl.NEAREST,t.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=t.context.createFramebuffer(i,r,!0,!1),this._fbo.depthAttachment.set(t.context.createRenderbuffer(t.context.gl.DEPTH_COMPONENT16,i,r))),this._fbo.colorAttachment.set(this._fboDepthTexture.texture),this._fbo}getTerrainMesh(t){let i=this.painter.style.projection?.transitionState>0,r=i&&0===t.canonical.y,a=i&&t.canonical.y===(1<<t.canonical.z)-1,o=`m_${r?"n":""}_${a?"s":""}`;if(this._meshCache[o])return this._meshCache[o];let s=this.painter.context,n=new P.Wt,l=new P.Jt,h=this.meshSize,c=P.Lr/h,u=h*h;for(let t=0;t<=h;t++)for(let i=0;
812i<=h;i++)n.emplaceBack(i*c,t*c,0);for(let t=0;t<u;t+=h+1)for(let i=0;i<h;i++)l.emplaceBack(i+t,h+i+t+1,h+i+t+2),l.emplaceBack(i+t,h+i+t+2,i+t+1);"none"!==this._terrainSkirtLength&&this._buildSkirts(n,l,h,c,r,a);let d=new eq(s.createVertexBuffer(n,is.members),s.createIndexBuffer(l),P.Bt.simpleSegment(0,0,n.length,l.length));return this._meshCache[o]=d,d}getSkirtLength(t){return 2*Math.PI*P.ut/2**Math.max(t,0)/5}getMinTileElevationForLngLatZoom(t,i){if(!(0,P.h)(i,t.wrap()))return 0;let{tileID:r}=this._getOverscaledTileIDFromLngLatZoom(t,i);return this.getMinMaxElevation(r).minElevation??0}getMinMaxElevation(t){let i=this.tileManager.getSourceTile(t,!0),r={minElevation:null,maxElevation:null};return i?.dem&&(r.minElevation=i.dem.min*this.exaggeration,r.maxElevation=i.dem.max*this.exaggeration),r}_getOverscaledTileIDFromLngLatZoom(t,i){let r=P.nt.fromLngLat(t.wrap()),a=(1<<i)*P.Lr,o=r.x*a,s=r.y*a,n=Math.floor(o/P.Lr),l=Math.floor(s/P.Lr);return{tileID:new P.d(i,0,i,n,l),mercatorX:o,mercatorY:s}}_buildSkirts(t,i,r,a,o,s){let n=t.length,l=n+(r+1),h=(r+1)*r,c=o?P.ht:0,u=+!o,d=s?P.gt:P.Lr,_=+!s;for(let i=0;i<=r;i++)t.emplaceBack(i*a,c,u);for(let i=0;i<=r;i++)t.emplaceBack(i*a,d,_);for(let t=0;t<r;t++)i.emplaceBack(h+t,l+t,l+t+1),i.emplaceBack(h+t,l+t+1,h+t+1),i.emplaceBack(0+t,n+t+1,n+t),i.emplaceBack(0+t,0+t+1,n+t+1);let p=t.length,m=p+(r+1)*2;for(let i of[0,1])for(let o=0;o<=r;o++)for(let r of[0,1])t.emplaceBack(i*P.Lr,o*a,r);for(let t=0;t<2*r;t+=2)i.emplaceBack(p+t,p+t+1,p+t+3),i.emplaceBack(p+t,p+t+3,p+t+2),i.emplaceBack(m+t,m+t+3,m+t+1),i.emplaceBack(m+t,m+t+2,m+t+3)}};let iu={covered:!1,demLoaded:!1,elevation:0};function id(t,i,r,a){if(a<0||a>=1)return iu;let o=Math.floor(r),s=r-o;for(let r of t.zooms){let n=1<<r,l=s*n,h=a*n,c=Math.floor(l),u=Math.floor(h),d=`${o}/${r}/${c}/${u}`;if(!t.samplerPerTile.has(d))continue;let _=t.samplerPerTile.get(d);return _?{covered:!0,demLoaded:!0,elevation:_(Math.min((l-c)*P.Lr,ih),Math.min((h-u)*P.Lr,ih),P.Lr)*i}:{covered:!0,demLoaded:!1,elevation:0}}return iu}function i_(t,i){return t.covered&&i<=t.elevation+1e-6}function ip(t,i,r,a,o){for(let s=0;s<40&&a-r>o;s++){let o=(r+a)/2;i(t,o)?a=o:r=o}return{lo:r,hi:a}}var im=class t{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(t){this._helper.setMinZoom(t)}setMaxZoom(t){this._helper.setMaxZoom(t)}setMinPitch(t){this._helper.setMinPitch(t)}setMaxPitch(t){this._helper.setMaxPitch(t)}setRenderWorldCopies(t){this._helper.setRenderWorldCopies(t)}setBearing(t){this._helper.setBearing(t)}setPitch(t){this._helper.setPitch(t)}setRoll(t){this._helper.setRoll(t)}setFov(t){this._helper.setFov(t)}setZoom(t){this._helper.setZoom(t)}setCenter(t){this._helper.setCenter(t)}setElevation(t){this._helper.setElevation(t)}setMinElevationForCurrentTile(t){this._helper.setMinElevationForCurrentTile(t)}setPadding(t){this._helper.setPadding(t)}interpolatePadding(t,i,r){this._helper.interpolatePadding(t,i,r)}isPaddingEqual(t){return this._helper.isPaddingEqual(t)}resize(t,i,r=!0){this._helper.resize(t,i,r)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(t){this._helper.setMaxBounds(t)}setConstrainOverride(t){this._helper.setConstrainOverride(t)}overrideNearFarZ(t,i){this._helper.overrideNearFarZ(t,i)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(t){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),t)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}get constrainOverride(){return this._helper.constrainOverride}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(t){}constructor(t,i){this._posMatrixCache=new Map,this._alignedPosMatrixCache=new Map,this._fogMatrixCacheF32=new Map,this.defaultConstrain=(t,i)=>{i=(0,P.Bn)(+i,this.minZoom,this.maxZoom);let r={center:new P.lt(t.lng,t.lat),zoom:i},a=this._helper._lngRange;this._helper._renderWorldCopies||null!==a||(a=[-179.9999999999,180-1e-10]);let o=this.tileSize*(0,P.Fr)(r.zoom),s=0,n=o,l=0,h=o,c=0,u=0,{x:d,y:_}=this.size;if(this._helper._latRange){let t=this._helper._latRange;s=(0,P.st)(t[1])*o,(n=(0,P.st)(t[0])*o)-s<_&&(c=_/(n-s))}a&&(l=(0,P.Pr)((0,P.ot)(a[0])*o,0,o),(h=(0,P.Pr)((0,P.ot)(a[1])*o,0,o))<l&&(h+=o),h-l<d&&(u=d/(h-l)));let{x:p,y:m}=(0,P.$)(o,t),f,g,v=Math.max(u||0,c||0);if(v){let t=new P.Li(u?(h+l)/2:p,c?(n+s)/2:m);return r.center=(0,P.tt)(o,t).wrap(),r.zoom+=(0,P.Dr)(v),r}if(this._helper._latRange){let t=_/2;m-t<s&&(g=s+t),m+t>n&&(g=n-t)}if(a){let t=(l+h)/2,i=p;
812this._helper._renderWorldCopies&&(i=(0,P.Pr)(p,t-o/2,t+o/2));let r=d/2;i-r<l&&(f=l+r),i+r>h&&(f=h-r)}if(void 0!==f||void 0!==g){let t=new P.Li(f??p,g??m);r.center=(0,P.tt)(o,t).wrap()}return r},this.applyConstrain=(t,i)=>this._helper.applyConstrain(t,i),this._helper=i??new ia({calcMatrices:()=>this._calcMatrices(),defaultConstrain:(t,i)=>this.defaultConstrain(t,i)},t),this._coveringTilesDetailsProvider=new io}clone(){let i=new t;return i.apply(this,!1),i}apply(t,i){this._helper.apply(t,i)}get cameraPosition(){return this._cameraPosition}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._viewProjMatrix}get inverseProjectionMatrix(){return this._invProjMatrix}get mercatorMatrix(){return this._mercatorMatrix}getVisibleUnwrappedCoordinates(t){let i=[new P.f(0,t)];if(this._helper._renderWorldCopies){let r=this.screenPointToMercatorCoordinate(new P.Li(0,0)),a=this.screenPointToMercatorCoordinate(new P.Li(this._helper._width,0)),o=this.screenPointToMercatorCoordinate(new P.Li(this._helper._width,this._helper._height)),s=this.screenPointToMercatorCoordinate(new P.Li(0,this._helper._height)),n=Math.floor(Math.min(r.x,a.x,o.x,s.x)),l=Math.floor(Math.max(r.x,a.x,o.x,s.x));for(let r=n-1;r<=l+1;r++)0!==r&&i.push(new P.f(r,t))}return i}getCameraFrustum(){return e9.fromInvProjectionMatrix(this._invViewProjMatrix,this.worldSize)}getClippingPlane(){return null}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(t){let i=this.screenPointToLocation(this.centerPoint,t),r=t?t.getElevationForLngLat(i,this):0;this._helper.recalculateZoomAndCenter(r)}setLocationAtPoint(t,i,r=this.elevation){let a=r-this.elevation,o=this.screenPointToMercatorCoordinateAtZ(i,a),s=this.screenPointToMercatorCoordinateAtZ(this.centerPoint,0),n=P.nt.fromLngLat(t),l=new P.nt(n.x-(o.x-s.x),n.y-(o.y-s.y));this.setCenter(l?.toLngLat()),this._helper._renderWorldCopies&&this.setCenter(this.center.wrap())}locationToScreenPoint(t,i){return i?this.coordinatePoint(P.nt.fromLngLat(t),i.getElevationForLngLat(t,this),this._pixelMatrix3D):this.coordinatePoint(P.nt.fromLngLat(t))}screenPointToLocation(t,i){return this.screenPointToMercatorCoordinate(t,i)?.toLngLat()}screenPointToLocationAtElevation(t,i){return this.screenPointToMercatorCoordinateAtZ(t,i-this.elevation)?.toLngLat()}screenPointToMercatorCoordinate(t,i){if(i){let r=this.screenTerrainPointToMercatorCoordinate(t,i);if(null!=r)return r}return this.screenPointToMercatorCoordinateAtZ(t)}screenTerrainPointToMercatorCoordinate(t,i){let r=i.getCoverageIndex();if(!r)return null;let{near:a,far:o}=this.getRaySegmentFromPixel(t),s=this.worldSize,n=o[0]-a[0],l=o[1]-a[1],h=o[2]-a[2],c={index:r,exaggeration:i.exaggeration,near:a,dx:n,dy:l,dz:h,worldSize:s},u=0,d=1;if(0===h){if(a[2]>r.maxElevation||a[2]<r.minElevation)return null}else{let t=(r.maxElevation-a[2])/h,i=(r.minElevation-a[2])/h;if((u=Math.max(u,Math.min(t,i)))>(d=Math.min(d,Math.max(t,i))))return null}let _=Math.hypot(n,l),p=(0,P.Bn)(Math.ceil(_*(d-u)/4),1,512),m=0,f=!iv(c,0);for(let t=0;t<=p;t++){let i=u+(d-u)*t/p;if(f){if(iv(c,i)){let{lo:t,hi:r}=ip(c,iv,m,i,.001/_),o=ig(c,t),u=ig(c,r),d=a[2]+t*h-o.elevation,p=a[2]+r*h-u.elevation,f=o.covered&&d>p?(0,P.Bn)(t+d*(r-t)/(d-p),t,r):r;return new P.nt((a[0]+f*n)/s,(a[1]+f*l)/s,ig(c,f).elevation)}}else f=!iv(c,i);m=i}return null}getRaySegmentFromPixel(t){let i=[t.x,t.y,0,1],r=[t.x,t.y,1,1];(0,P.Yr)(i,i,this._pixelMatrixInverse),(0,P.Yr)(r,r,this._pixelMatrixInverse);let a=i[3],o=r[3],s=this.elevation;return{near:[i[0]/a,i[1]/a,i[2]/a+s],far:[r[0]/o,r[1]/o,r[2]/o+s]}}screenPointToMercatorCoordinateAtZ(t,i){let r=i||0,{near:a,far:o}=this.getRaySegmentFromPixel(t),s=a[2]===o[2]?0:(r+this.elevation-a[2])/(o[2]-a[2]);return new P.nt(P.un.number(a[0],o[0],s)/this.worldSize,P.un.number(a[1],o[1],s)/this.worldSize,r)}coordinatePoint(t,i=0,r=this._pixelMatrix){let a=this._coordinateClipPoint(t,i,r),o=a[3];return o>0?new P.Li(a[0]/o,a[1]/o):this._offScreenPointBehindCamera(a[0],a[1],o)}_coordinateClipPoint(t,i,r){let a=[t.x*this.worldSize,t.y*this.worldSize,i,1];return(0,P.Yr)(a,a,r)}_offScreenPointBehindCamera(t,i,r){let a=this.width/2,o=this.height/2,s=t-a*r,n=i-o*r;0===s&&0===n&&(n=1);let l=a+this.width,h=o+this.height,c=Math.min(0===s?1/0:l/Math.abs(s),0===n?1/0:h/Math.abs(n));return new P.Li(a+s*c,o+n*c)}getBounds(){let t=Math.max(0,this._helper._height/2-(0,P.Z)(this));return new eL().extend(this.screenPointToLocation(new P.Li(0,t))).extend(this.screenPointToLocation(new P.Li(this._helper._width,t))).extend(this.screenPointToLocation(new P.Li(this._helper._width,this._helper._height))).extend(this.screenPointToLocation(new P.Li(0,this._helper._height)))}
812isPointOnMapSurface(t,i){return i?null!=this.screenTerrainPointToMercatorCoordinate(t,i):t.y>this.height/2-(0,P.Z)(this)}calculatePosMatrix(t,i=!1,r=!1){let a=t.key??(0,P.p)(t.wrap,t.canonical.z,t.canonical.z,t.canonical.x,t.canonical.y),o=i?this._alignedPosMatrixCache:this._posMatrixCache;if(o.has(a)){let t=o.get(a);return r?t.f32:t.f64}let s=(0,P.q)(t,this.worldSize);(0,P.wi)(s,i?this._alignedProjMatrix:this._viewProjMatrix,s);let n={f64:s,f32:new Float32Array(s)};return o.set(a,n),r?n.f32:n.f64}calculateFogMatrix(t){let i=t.key,r=this._fogMatrixCacheF32;if(r.has(i))return r.get(i);let a=(0,P.q)(t,this.worldSize);return(0,P.wi)(a,this._fogMatrix,a),r.set(i,new Float32Array(a)),r.get(i)}calculateCenterFromCameraLngLatAlt(t,i,r,a){return this._helper.calculateCenterFromCameraLngLatAlt(t,i,r,a)}calculateCameraOptionsFromTo(t,i,r,a){let o=P.nt.fromLngLat(t,i),s=P.nt.fromLngLat(r,a),n=s.x-o.x,l=s.y-o.y,h=s.z-o.z,c=Math.hypot(n,l,h);if(0===c)throw Error("Can't calculate camera options with same From and To");let u=Math.hypot(n,l),d=(0,P.Dr)(this.cameraToCenterDistance/c/this.tileSize),_=(0,P.xr)(Math.atan2(n,-l)),p=(0,P.xr)(Math.acos(u/c));return p=h<0?90-p:90+p,{center:s.toLngLat(),elevation:a,zoom:d,pitch:p,bearing:_}}_calculateNearFarZ(t,i,r){let a=Math.min(this.elevation,this.minElevationForCurrentTile,this.getCameraAltitude()-100),o=t-a*this._helper._pixelPerMeter/Math.cos(i),s=a<0?o:t,n=Math.PI/2+this.pitchInRadians,l=(0,P.Yn)(this.fov)*(Math.abs(Math.cos((0,P.Yn)(this.roll)))*this.height+Math.abs(Math.sin((0,P.Yn)(this.roll)))*this.width)/this.height*(.5+r.y/this.height),h=Math.sin(l)*s/Math.sin((0,P.Bn)(Math.PI-n-l,.01,Math.PI-.01)),c=(0,P.Z)(this),u=Math.atan(c/this._helper.cameraToCenterDistance),d=(0,P.Yn)(90-P.Q),_=u>d?2*u*(.5+r.y/(2*c)):d,p=Math.min(h,Math.sin(_)*s/Math.sin((0,P.Bn)(Math.PI-n-_,.01,Math.PI-.01)));this._helper._farZ=(Math.cos(Math.PI/2-i)*p+s)*1.01,this._helper._nearZ=this._helper._height/50}_calcMatrices(t=this._helper.autoCalculateNearFarZ){var i,r;let a,o=this.centerOffset,s=(0,P.$)(this.worldSize,this.center),n=s.x,l=s.y,h=(0,P.Yn)(Math.min(this.pitch,P.Q)),c=Math.max(this._helper.cameraToCenterDistance/2,this._helper.cameraToCenterDistance+this._helper._elevation*this._helper._pixelPerMeter/Math.cos(h));t&&this._calculateNearFarZ(c,h,o),a=new Float64Array(16),(0,P.Ei)(a,this.fovInRadians,this._helper._width/this._helper._height,this._helper._nearZ,this._helper._farZ),this._invProjMatrix=new Float64Array(16),i=this._invProjMatrix,r=a,i[0]=1/r[0],i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=1/r[5],i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=0,i[11]=1/r[14],i[12]=0,i[13]=0,i[14]=-1,i[15]=r[10]/r[14],a[8]=-(2*o.x)/this._helper._width,a[9]=2*o.y/this._helper._height,this._projectionMatrix=(0,P.gi)(a),(0,P.Ai)(a,a,[1,-1,1]),(0,P.ji)(a,a,[0,0,-this._helper.cameraToCenterDistance]),(0,P.ki)(a,a,-this.rollInRadians),(0,P.Di)(a,a,this.pitchInRadians),(0,P.ki)(a,a,-this.bearingInRadians),(0,P.ji)(a,a,[-n,-l,0]),this._mercatorMatrix=(0,P.Ai)([],a,[this.worldSize,this.worldSize,this.worldSize]),(0,P.Ai)(a,a,[1,1,this._helper._pixelPerMeter]),this._pixelMatrix=(0,P.wi)(new Float64Array(16),this.clipSpaceToPixelsMatrix,a),(0,P.ji)(a,a,[0,0,-this.elevation]),this._viewProjMatrix=a,this._invViewProjMatrix=(0,P.Ci)([],a);let u=[0,0,-1,1];(0,P.Yr)(u,u,this._invViewProjMatrix),this._cameraPosition=[u[0]/u[3],u[1]/u[3],u[2]/u[3]],this._fogMatrix=new Float64Array(16),(0,P.Ei)(this._fogMatrix,this.fovInRadians,this.width/this.height,c,this._helper._farZ),this._fogMatrix[8]=-(2*o.x)/this.width,this._fogMatrix[9]=2*o.y/this.height,(0,P.Ai)(this._fogMatrix,this._fogMatrix,[1,-1,1]),(0,P.ji)(this._fogMatrix,this._fogMatrix,[0,0,-this.cameraToCenterDistance]),(0,P.ki)(this._fogMatrix,this._fogMatrix,-this.rollInRadians),(0,P.Di)(this._fogMatrix,this._fogMatrix,this.pitchInRadians),(0,P.ki)(this._fogMatrix,this._fogMatrix,-this.bearingInRadians),(0,P.ji)(this._fogMatrix,this._fogMatrix,[-n,-l,0]),(0,P.Ai)(this._fogMatrix,this._fogMatrix,[1,1,this._helper._pixelPerMeter]),(0,P.ji)(this._fogMatrix,this._fogMatrix,[0,0,-this.elevation]),this._pixelMatrix3D=(0,P.wi)(new Float64Array(16),this.clipSpaceToPixelsMatrix,a);let d=this._helper._width%2/2,_=this._helper._height%2/2,p=Math.cos(this.bearingInRadians),m=Math.sin(-this.bearingInRadians),f=n-Math.round(n)+p*d+m*_,g=l-M
812ath.round(l)+p*_+m*d,v=new Float64Array(a);if((0,P.ji)(v,v,[f>.5?f-1:f,g>.5?g-1:g,0]),this._alignedProjMatrix=v,!(a=(0,P.Ci)(new Float64Array(16),this._pixelMatrix)))throw Error("failed to invert matrix");this._pixelMatrixInverse=a,this._clearMatrixCaches()}_clearMatrixCaches(){this._posMatrixCache.clear(),this._alignedPosMatrixCache.clear(),this._fogMatrixCacheF32.clear()}maxPitchScaleFactor(){if(!this._pixelMatrixInverse)return 1;let t=this.screenPointToMercatorCoordinate(new P.Li(0,0)),i=[t.x*this.worldSize,t.y*this.worldSize,0,1];return(0,P.Yr)(i,i,this._pixelMatrix)[3]/this._helper.cameraToCenterDistance}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return Math.cos(this.pitchInRadians)*this.cameraToCenterDistance/this.pixelsPerMeter+this.elevation}getCameraLngLat(){let t=(0,P.ct)(1,this.center.lat)*this.worldSize,i=this._helper.cameraToCenterDistance/t;return(0,P.X)(this.center,this.elevation,this.pitch,this.bearing,i).toLngLat()}getProjectionData(t){let{overscaledTileID:i,aligned:r,applyTerrainMatrix:a}=t,o=this._helper.getMercatorTileCoordinates(i),s=i?this.calculatePosMatrix(i,r,!0):null,n;return{mainMatrix:n=i?.terrainRttPosMatrix32f&&a?i.terrainRttPosMatrix32f:s||(0,P.Hn)(),tileMercatorCoords:o,clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:n,clipAntimeridian:!1}}isLocationOccluded(t,i,r){if(!i?.getCoverageIndex())return!1;let a=P.nt.fromLngLat(t);r??=i.getElevationForLngLat(t,this);let o=this._coordinateClipPoint(a,r,this._pixelMatrix3D),s=o[3];if(s<=0||o[2]>s)return!0;let n=new P.Li(o[0]/s,o[1]/s),l=this.screenTerrainPointToMercatorCoordinate(n,i);if(null==l)return!1;let h=this.getRaySegmentFromPixel(n),c=iy(h,a.x*this.worldSize,a.y*this.worldSize,r);return iy(h,l.x*this.worldSize,l.y*this.worldSize,l.z)<.99*c}getPixelScale(){return 1}getCircleRadiusCorrection(){return 1}getPitchedTextCorrection(t,i,r){return 1}transformLightDirection(t){return(0,P.Zr)(t)}getRayDirectionFromPixel(t){throw Error("Not implemented.")}projectTileCoordinates(t,i,r,a){let o=this.calculatePosMatrix(r),s;null==a?tz(s=[t,i,0,1],s,o):(s=[t,i,a,1],(0,P.Yr)(s,s,o));let n=s[3];return{point:new P.Li(s[0]/n,s[1]/n),signedDistanceFromCamera:n,isOccluded:!1}}populateCache(t){for(let i of t)this.calculatePosMatrix(i)}getProjectionDataForCustomLayer(t=!0){let i=new P.d(0,0,0,0,0),r=this.getProjectionData({overscaledTileID:i,applyGlobeMatrix:t}),a=(0,P.q)(i,this.worldSize);(0,P.wi)(a,this._viewProjMatrix,a);let o=[P.Lr,P.Lr,this.worldSize/this._helper.pixelsPerMeter],s=(0,P.Wn)();return(0,P.Ai)(s,a,o),{...r,tileMercatorCoords:[0,0,1,1],fallbackMatrix:s,mainMatrix:s}}getFastPathSimpleProjectionMatrix(t){return this.calculatePosMatrix(t)}};function ig(t,i){return id(t.index,t.exaggeration,(t.near[0]+i*t.dx)/t.worldSize,(t.near[1]+i*t.dy)/t.worldSize)}function iv(t,i){return i_(ig(t,i),t.near[2]+i*t.dz)}function iy({near:t,far:i},r,a,o){let s=i[0]-t[0],n=i[1]-t[1],l=i[2]-t[2];return((r-t[0])*s+(a-t[1])*n+(o-t[2])*l)/(s*s+n*n+l*l)}function ix(){(0,P.Nr)("Map cannot fit within canvas with the given bounds, padding, and/or offset.")}function ib(t){if(t.useSlerp)if(t.k<1){let i=(0,P.Er)(t.startEulerAngles.roll,t.startEulerAngles.pitch,t.startEulerAngles.bearing),r=(0,P.Er)(t.endEulerAngles.roll,t.endEulerAngles.pitch,t.endEulerAngles.bearing),a=new Float64Array(4);(0,P.Kr)(a,i,r,t.k);let o=(0,P.sr)(a);t.tr.setRoll(o.roll),t.tr.setPitch(o.pitch),t.tr.setBearing(o.bearing)}else t.tr.setRoll(t.endEulerAngles.roll),t.tr.setPitch(t.endEulerAngles.pitch),t.tr.setBearing(t.endEulerAngles.bearing);else t.tr.setRoll(P.un.number(t.startEulerAngles.roll,t.endEulerAngles.roll,t.k)),t.tr.setPitch(P.un.number(t.startEulerAngles.pitch,t.endEulerAngles.pitch,t.k)),t.tr.setBearing(P.un.number(t.startEulerAngles.bearing,t.endEulerAngles.bearing,t.k))}function iw(t,i,r,a,o){let s=o.padding,n=(0,P.$)(o.worldSize,r.getNorthWest()),l=(0,P.$)(o.worldSize,r.getNorthEast()),h=(0,P.$)(o.worldSize,r.getSouthEast()),c=(0,P.$)(o.worldSize,r.getSouthWest
812()),u=(0,P.Yn)(-a),d=n.rotate(u),_=l.rotate(u),p=h.rotate(u),m=c.rotate(u),f=new P.Li(Math.max(d.x,_.x,m.x,p.x),Math.max(d.y,_.y,m.y,p.y)),g=new P.Li(Math.min(d.x,_.x,m.x,p.x),Math.min(d.y,_.y,m.y,p.y)),v=f.sub(g),y=o.width-(s.left+s.right+i.left+i.right),x=o.height-(s.top+s.bottom+i.top+i.bottom),b=y/v.x,w=x/v.y;if(w<0||b<0)return void ix();let T=Math.min((0,P.Dr)(o.scale*Math.min(b,w)),t.maxZoom),M=P.Li.convert(t.offset),C=(i.left-i.right)/2,I=(i.top-i.bottom)/2,S=new P.Li(C,I).rotate((0,P.Yn)(a)),E=M.add(S).mult(o.scale/(0,P.Fr)(T));return{center:(0,P.tt)(o.worldSize,n.add(h).div(2).sub(E)),zoom:T,bearing:a}}var iT=class{get useGlobeControls(){return!1}handlePanInertia(t,i){let r=t.mag(),a=Math.abs((0,P.Z)(i));return{easingOffset:t.mult(Math.min(.75*a/r,1)),easingCenter:i.center}}handleMapControlsRollPitchBearingZoom(t,i){t.bearingDelta&&i.setBearing(i.bearing+t.bearingDelta),t.pitchDelta&&i.setPitch(i.pitch+t.pitchDelta),t.rollDelta&&i.setRoll(i.roll+t.rollDelta),t.zoomDelta&&i.setZoom(i.zoom+t.zoomDelta)}handleMapControlsPan(t,i,r){.01>t.around.distSqr(i.centerPoint)||i.setLocationAtPoint(r,t.around,t.aroundElevation)}cameraForBoxAndBearing(t,i,r,a,o){return iw(t,i,r,a,o)}handleJumpToCenterZoom(t,i){let r=void 0===i.zoom?t.zoom:+i.zoom;t.zoom!==r&&t.setZoom(+i.zoom),void 0!==i.center&&t.setCenter(P.lt.convert(i.center))}handleEaseTo(t,i){let r=t.zoom,a=t.padding,o={roll:t.roll,pitch:t.pitch,bearing:t.bearing},s={roll:void 0===i.roll?t.roll:i.roll,pitch:void 0===i.pitch?t.pitch:i.pitch,bearing:void 0===i.bearing?t.bearing:i.bearing},n=void 0!==i.zoom,l=!t.isPaddingEqual(i.padding),h=!1,c=n?+i.zoom:t.zoom,u=t.centerPoint.add(i.offsetAsPoint),d=t.screenPointToLocation(u),{center:_,zoom:p}=t.applyConstrain(P.lt.convert(i.center||d),c??r);ii(t,_);let m=(0,P.$)(t.worldSize,d),f=(0,P.$)(t.worldSize,_).sub(m),g=(0,P.Fr)(p-r);return{easeFunc:n=>{if(h&&t.setZoom(P.un.number(r,p,n)),(0,P.Tr)(o,s)||ib({startEulerAngles:o,endEulerAngles:s,tr:t,k:n,useSlerp:o.roll!=s.roll}),l&&(t.interpolatePadding(a,i.padding,n),u=t.centerPoint.add(i.offsetAsPoint)),i.around)t.setLocationAtPoint(i.around,i.aroundPoint);else{let i=(0,P.Fr)(t.zoom-r),a=(p>r?Math.min(2,g):Math.max(.5,g))**(1-n),o=(0,P.tt)(t.worldSize,m.add(f.mult(n*a)).mult(i));t.setLocationAtPoint(t.renderWorldCopies?o.wrap():o,u)}},isZooming:h=p!==r,elevationCenter:_}}handleFlyTo(t,i){let r=void 0!==i.zoom,a=t.zoom,o=t.applyConstrain(P.lt.convert(i.center||i.locationAtOffset),r?+i.zoom:a),s=o.center,n=o.zoom;ii(t,s);let l=t.worldSize,h=(0,P.$)(l,i.locationAtOffset),c=(0,P.$)(l,s).sub(h),u=c.mag(),d=(0,P.Fr)(n-a),_=Math.min(Math.max(void 0===i.minZoom?t.minZoom:+i.minZoom,t.minZoom),a,n),p=t.applyConstrain(s,_).zoom;return{easeFunc:(i,r,o,u)=>{t.setZoom(1===i?n:a+(0,P.Dr)(r));let d=1===i?s:(0,P.tt)(l,h.add(c.mult(o)));t.setLocationAtPoint(t.renderWorldCopies?d.wrap():d,u)},scaleOfZoom:d,targetCenter:s,scaleOfMinZoom:(0,P.Fr)(p-a),pixelPathLength:u}}};let iP=new P.vt({fill:new P._t(128,2),line:new P._t(512,0),tile:new P._t(128,32),stencil:new P._t(128,1),circle:3});var iM=class{constructor(){this._tileMeshCache={}}get name(){return"vertical-perspective"}get transitionState(){return 1}get useSubdivision(){return!0}get shaderVariantName(){return"globe"}get shaderDefine(){return"#define GLOBE"}get shaderPreludeCode(){return t6.projectionGlobe}get vertexShaderPreludeCode(){return t6.projectionMercator.vertexSource}get subdivisionGranularity(){return iP}get useGlobeControls(){return!0}destroy(){}_getMeshKey(t){return`${t.granularity.toString(36)}_${t.generateBorders?"b":""}${t.extendToNorthPole?"n":""}${t.extendToSouthPole?"s":""}`}getMeshFromTileID(t,i,r,a,o){let s=("stencil"===o?iP.stencil:iP.tile).getGranularityForZoomLevel(i.z),n=0===i.y&&a,l=i.y===(1<<i.z)-1&&a;return this._getMesh(t,{granularity:s,generateBorders:r,extendToNorthPole:n,extendToSouthPole:l})}_getMesh(t,i){let r=this._getMeshKey(i);if(r in this._tileMeshCache)return this._tileMeshCache[r];let a=eH(t,i);return this._tileMeshCache[r]=a,a}recalculate(t){}hasTransition(){return!1}},iC=class extends P.vn{constructor(t,i){super(),this._transitionable=new P.$t(_||=new P.Qt({type:new P.Zt(P.hn.projection.type,"type")}),"projection",i),this.setProjection(t),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new P.en(0)),this._mercatorProjection=new ie,this._verticalPerspectiveProjection=new iM}get transitionState(){let t=this.properties.get("type");if("string"==typeof t&&"mercator"===t)return 0;if("string"==typeof t&&"vertical-perspective"===t)return 1;if(t instanceof P.dn){if(t.from===t.to)return+("mercator"!==t.from);if("vertical-perspective"===t.from&&"mercator"===t.to)return 1-t.transition;if("mercator"===t.from&&"vertical-perspective"===t.to)return t.transition}return 1}get useGlobeRendering(){return this.transitionState>0}get currentProjection(){return this.useGlobeRendering?this._verticalPerspectiveProjection:this._mercatorProjection}get name(){return"globe"}get useSubdivision(){return this.currentProjection.useSubdivision}get shaderVariantName(){return this.currentProjection.shaderVariantName}get shaderDefine(){return this.currentProjection.shaderDefine}get shaderPreludeCode(){return this.currentProjection.shaderPreludeCode}get vertexShaderPreludeCode(){return this.currentProjection.vertexShaderPreludeCode}get subdivisionGranularity(){return this.currentProjection.subdivisionGranularity}get useGlobeControls(){return this.transitionState>0}destroy(){this._mercatorProjection.destroy(),this._verticalPerspectiveProjection.destroy()}getMeshFromTileID(t,i,r,a,o){return this.currentProjection.getMeshFromTileID(t,i,r,a,o)}setProjection(t){this._transitionable.setValue("type",t?.type||"mercator")}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()||this.currentProjection.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}};function iI(t){return 2*Math.PI*iz(t.worldSize,t.center.lat)}function iS(t,i,r,a,o){let s=1/(1<<o),n=t/P.Lr*s+r*s,l=i/P.Lr*s+a*s,h=(0,P.gr)(n*Math.PI*2+Math.PI,2*Math.PI),c=2*Math.atan(Math.exp(Math.PI-l*Math.PI*2))-.5*Math.PI,u=Math.cos(c),d=new Float64Array(3);return d[0]=Math.sin(h)*u,d[1]=Math.sin(c),d[2]=Math.cos(h)*u,d}function iE(t){var i,r;let a,o;return i=t.lng*Math.PI/180,a=Math.cos(r=t.lat*Math.PI/180),(o=new Float64Array(3))[0]=Math.sin(i)*a,o[1]=Math.sin(r),o[2]=Math.cos(i)*a,o}function iz(t,i){return t/(2*Math.PI)/Math.cos(i*Math.PI/180)}function iR(t){let i=(0,P.Yr)((0,P.Kn)(),[0,0,0,1],t.modelViewProjectionMatrix);return(0,P.Yr)(i,i,t.inverseProjectionMatrix),[i[0]/i[3],i[1]/i[3],i[2]/i[3]]}function iD(t){let i=Math.asin(t[1])/Math.PI*180,r=Math.sqrt(t[0]*t[0]+t[2]*t[2]);if(r>1e-6){let a=t[0]/r,o=Math.acos(t[2]/r),s=(a>0?o:-o)/Math.PI*180;return new P.lt((0,P.Pr)(s,-180,180),i)}return new P.lt(0,i)}let iL=.98*Math.PI;function iA(t,i){let r=t.cameraPosition,a=(0,P.ni)(r);if(a<=1)return t.screenPointToLocation(i);let o=(0,P.Gn)();(0,P.ii)(o,r);let s=t.getRayDirectionFromPixel(i),n=-(0,P.ei)(s,o),l=(0,P.Gn)();(0,P.li)(l,s,o,n);let h=(0,P.ni)(l);if(h<1e-9)return t.screenPointToLocation(i);let c=Math.atan2(h,n),u=.9*Math.asin(1/a);if(c<u)return t.screenPointToLocation(i);let d=a*Math.sin(u),_=Math.asin((0,P.Bn)(d,-1,1))-u,p=a*Math.cos(u)/Math.sqrt(Math.max(1-d*d,1e-12))-1,m=iL-_,f=c-u,g=_+p*f*m/(m+p*f),v=(0,P.Gn)();(0,P.ci)(v,l,1/h);let y=(0,P.Gn)();return(0,P.ci)(y,o,Math.cos((0,P.Bn)(g,0,iL))),(0,P.li)(y,y,v,Math.sin((0,P.Bn)(g,0,iL))),(0,P.ii)(y,y),iD(y)}function iF(t){return Math.cos(t*Math.PI/180)}function ik(t,i){let r=iF(t),a=iF(i);return(0,P.Dr)(a/r)}function iB(t){let i=.5*t,r=Math.sin(i),a=Math.cos(i);return Math.log(r+a)-Math.log(a-r)}function iO(t,i,r,a){let o=t.lat+r*a;if(Math.abs(r)>1){let s=(Math.sign(t.lat+r)===Math.sign(t.lat)?Math.abs(t.lat):-Math.abs(t.lat))*Math.PI/180,n=Math.abs(t.lat+r)*Math.PI/180,l=iB(s+a
812*(n-s)),h=iB(s),c=iB(n),u=t.lng+(l-h)/(c-h)*i;return new P.lt(u,o)}{let r=t.lng+i*a;return new P.lt(r,o)}}function ij(t,i,r=1){let a=(0,P.ei)(t,i),o=r*r,s=(0,P.Gn)(),n=(0,P.Gn)();(0,P.ci)(n,i,a),(0,P.ui)(s,t,n);let l=o-(0,P.ei)(s,s);if(l<0)return null;let h=(0,P.ei)(t,t)-o,c=-a+(a<0?1:-1)*Math.sqrt(l),u=h/c;return{tMin:Math.min(u,c),tMax:Math.max(u,c)}}function iN(t,i){let r=.01569612305760477*i,a=(0,P.Bn)((t-r)/(9*r),0,1);return a*a*(3-2*a)}var iZ=class{constructor(t){this._cachePrevious=new Map,this._cache=new Map,this._hadAnyChanges=!1,this._boundingVolumeFactory=t}swapBuffers(){if(!this._hadAnyChanges)return;let t=this._cachePrevious;this._cachePrevious=this._cache,this._cache=t,this._cache.clear(),this._hadAnyChanges=!1}getTileBoundingVolume(t,i,r,a){let o=`${t.z}_${t.x}_${t.y}_${a?.terrain?"t":""}_${Math.round(r)}`,s=this._cache.get(o);if(s)return s;let n=this._cachePrevious.get(o);if(n)return this._cache.set(o,n),n;let l=this._boundingVolumeFactory(t,i,r,a);return this._cache.set(o,l),this._hadAnyChanges=!0,l}},iU=class t{constructor(t,i,r,a){this.min=r,this.max=a,this.points=t,this.planes=i}static fromAabb(i,r){let a=[];for(let t=0;t<8;t++)a.push([(1&t)==1?r[0]:i[0],(t>>1&1)==1?r[1]:i[1],(t>>2&1)==1?r[2]:i[2]]);return new t(a,[[-1,0,0,r[0]],[1,0,0,-i[0]],[0,-1,0,r[1]],[0,1,0,-i[1]],[0,0,-1,r[2]],[0,0,1,-i[2]]],i,r)}static fromCenterSizeAngles(i,r,a){let o=(0,P.Ur)([],a[0],a[1],a[2]),s=(0,P.mi)([],[r[0],0,0],o),n=(0,P.mi)([],[0,r[1],0],o),l=(0,P.mi)([],[0,0,r[2]],o),h=[...i],c=[...i];for(let t=0;t<8;t++)for(let r=0;r<3;r++){let a=i[r]+s[r]*((1&t)==1?1:-1)+n[r]*((t>>1&1)==1?1:-1)+l[r]*((t>>2&1)==1?1:-1);h[r]=Math.min(h[r],a),c[r]=Math.max(c[r],a)}let u=[];for(let t=0;t<8;t++){let r=[...i];(0,P.Xr)(r,r,(0,P.ci)([],s,(1&t)==1?1:-1)),(0,P.Xr)(r,r,(0,P.ci)([],n,(t>>1&1)==1?1:-1)),(0,P.Xr)(r,r,(0,P.ci)([],l,(t>>2&1)==1?1:-1)),u.push(r)}return new t(u,[[...s,-(0,P.ei)(s,u[0])],[...n,-(0,P.ei)(n,u[0])],[...l,-(0,P.ei)(l,u[0])],[-s[0],-s[1],-s[2],-(0,P.ei)(s,u[7])],[-n[0],-n[1],-n[2],-(0,P.ei)(n,u[7])],[-l[0],-l[1],-l[2],-(0,P.ei)(l,u[7])]],h,c)}intersectsFrustum(t){let i=!0,r=this.points.length,a=this.planes.length,o=t.planes.length,s=t.points.length;for(let a=0;a<o;a++){let o=t.planes[a],s=0;for(let t=0;t<r;t++){let i=this.points[t];o[0]*i[0]+o[1]*i[1]+o[2]*i[2]+o[3]>=0&&s++}if(0===s)return 0;s<r&&(i=!1)}if(i)return 2;for(let i=0;i<a;i++){let r=this.planes[i],a=0;for(let i=0;i<s;i++){let o=t.points[i];r[0]*o[0]+r[1]*o[1]+r[2]*o[2]+r[3]>=0&&a++}if(0===a)return 0}return 1}intersectsPlane(t){let i=this.points.length,r=0;for(let a=0;a<i;a++){let i=this.points[a];t[0]*i[0]+t[1]*i[1]+t[2]*i[2]+t[3]>=0&&r++}return r===i?2:+(0!==r)}};function iG(t,i,r){let a=t-i;return a<0?-a:Math.max(0,a-r)}function iV(t,i,r,a,o){let s=t-r;return Math.max(s<0?Math.min(-s,1+s-o):s>o?Math.min(Math.max(s-o,0),1-s):0,iG(i,a,o))}var iq=class{constructor(){this._boundingVolumeCache=new iZ(this._computeTileBoundingVolume)}prepareNextFrame(){this._boundingVolumeCache.swapBuffers()}distanceToTile2d(t,i,r,a){let o=1<<r.z,s=1/o,n=r.x/o,l=r.y/o;return Math.min(Math.min(Math.min(2,iV(t,i,n,l,s)),iV(t,i,n+.5,-l-s,s)),iV(t,i,n+.5,2-l-s,s))}getWrap(t,i,r){let a=1<<i.z,o=1/a,s=i.x/a,n=iG(t.x,s,o),l=iG(t.x,s-1,o),h=iG(t.x,s+1,o),c=Math.min(n,l,h);return c===h?1:c===l?-1:0}allowVariableZoom(t,i){return ti(t,i)>4}allowWorldCopies(){return!1}getTileBoundingVolume(t,i,r,a){return this._boundingVolumeCache.getTileBoundingVolume(t,i,r,a)}_computeTileBoundingVolume(t,i,r,a){let o=Math.min(0,r),s=Math.max(0,r);if(a?.terrain){let r=new P.d(t.z,i,t.z,t.x,t.y),n=a.terrain.getMinMaxElevation(r);o=n.minElevation??o,s=Math.max(n.maxElevation??s,s)}if(o/=P.ut,s/=P.ut,o+=1,s+=1,t.z<=0)return iU.fromAabb([-s,-s,-s],[s,s,s]);if(1===t.z)return iU.fromAabb([0===t.x?-s:0,0===t.y?0:-s,-s],[0===t.x?0:s,0===t.y?s:0,s]);{let i=[iS(0,0,t.x,t.y,t.z),iS(P.Lr,0,t.x,t.y,t.z),iS(P.Lr,P.Lr,t.x,t.y,t.z),iS(0,P.Lr,t.x,t.y,t.z)],r=[];for(let t of i)r.push((0,P.ci)([],t,s));if(s!==o)for(let t of i)r.push((0,P.ci)([],t,o));0===t.y&&r.push([0,1,0]),t.y===(1<<t.z)-1&&r.push([0,-1,0]);let a=[1,1,1],n=[-1,-1,-1];for(let t of r)for(let i=0;i<3;i++)a[i]=Math.min(a[i],t[i]),n[i]=Math.max(n[i],t[i]);let l=iS(P.Lr/2,P.Lr/2,t.x,t.y,t.z),h=(0,P.Qr)([],[0,1,0],l);(0,P.ii)(h,h);let c=(0,P.Qr)([],l,h);(0,P.ii)(c,c);let u=(0,P.Qr)([],i[2],i[1]);(0,P.ii)(u,u);let d=(0,P.Qr)([],i[0],i[3]);(0,P.ii)(d,d),r.push((0,P.ci)([],l,s)),t.y>=(1<<t.z)/2&&r.push((0,P.ci)([],iS(P.Lr/2,0,t.x,t.y,t.z),s)),t.y<(1<<t.z)/2&&r.push((0,P.ci)([],iS(P.Lr/2,P.Lr,t.x,t.y,t.z),s));let _=iW(l,r),p=iW(c,r),m=[-l[0],-l[1],-l[2],_.max],f=[l[0],l[1],l[2],-_.min],g=[-c[0],-c[1],-c[2],p.max],v=[c[0],c[
8121],c[2],-p.min],y=[...u,0],x=[...d,0],b=[];return 0===t.y?b.push((0,P.Ar)(x,y,m),(0,P.Ar)(x,y,f)):b.push((0,P.Ar)(g,y,m),(0,P.Ar)(g,y,f),(0,P.Ar)(g,x,m),(0,P.Ar)(g,x,f)),t.y===(1<<t.z)-1?b.push((0,P.Ar)(x,y,m),(0,P.Ar)(x,y,f)):b.push((0,P.Ar)(v,y,m),(0,P.Ar)(v,y,f),(0,P.Ar)(v,x,m),(0,P.Ar)(v,x,f)),new iU(b,[m,f,g,v,y,x],a,n)}}};function iW(t,i){let r=1/0,a=-1/0;for(let o of i){let i=(0,P.ei)(t,o);r=Math.min(r,i),a=Math.max(a,i)}return{min:r,max:a}}var i$=class t{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(t){this._helper.setMinZoom(t)}setMaxZoom(t){this._helper.setMaxZoom(t)}setMinPitch(t){this._helper.setMinPitch(t)}setMaxPitch(t){this._helper.setMaxPitch(t)}setRenderWorldCopies(t){this._helper.setRenderWorldCopies(t)}setBearing(t){this._helper.setBearing(t)}setPitch(t){this._helper.setPitch(t)}setRoll(t){this._helper.setRoll(t)}setFov(t){this._helper.setFov(t)}setZoom(t){this._helper.setZoom(t)}setCenter(t){this._helper.setCenter(t)}setElevation(t){this._helper.setElevation(t)}setMinElevationForCurrentTile(t){this._helper.setMinElevationForCurrentTile(t)}setPadding(t){this._helper.setPadding(t)}interpolatePadding(t,i,r){this._helper.interpolatePadding(t,i,r)}isPaddingEqual(t){return this._helper.isPaddingEqual(t)}resize(t,i){this._helper.resize(t,i)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(t){this._helper.setMaxBounds(t)}setConstrainOverride(t){this._helper.setConstrainOverride(t)}overrideNearFarZ(t,i){this._helper.overrideNearFarZ(t,i)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(t){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),t)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get constrainOverride(){return this._helper.constrainOverride}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(t){}constructor(t,i){this._cachedClippingPlane=(0,P.Kn)(),this._projectionMatrix=(0,P.Un)(),this._globeViewProjMatrix32f=(0,P.Hn)(),this._globeViewProjMatrixF64=(0,P.Un)(),this._globeViewProjMatrixF64Inverted=(0,P.Un)(),this._globeProjMatrixInverted=(0,P.Un)(),this._cameraPosition=(0,P.Gn)(),this.defaultConstrain=(t,i)=>{let r=(0,P.Bn)(t.lat,-P.Fn,P.Fn),a=(0,P.Bn)(+i,this.minZoom+ik(0,r),this.maxZoom);return{center:new P.lt(t.lng,r),zoom:a}},this.applyConstrain=(t,i)=>this._helper.applyConstrain(t,i),this._helper=i??new ia({calcMatrices:()=>this._calcMatrices(),defaultConstrain:(t,i)=>this.defaultConstrain(t,i)},t),this._coveringTilesDetailsProvider=new iq}clone(){let i=new t;return i.apply(this,!1),i}apply(t,i){this._helper.apply(t,i)}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._globeViewProjMatrixF64}get inverseProjectionMatrix(){return this._globeProjMatrixInverted}get cameraPosition(){let t=(0,P.Gn)();return t[0]=this._cameraPosition[0],t[1]=this._cameraPosition[1],t[2]=this._cameraPosition[2],t}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}getProjectionData(t){let{overscaledTileID:i,applyGlobeMatrix:r}=t,a=this._helper.getMercatorTileCoordinates(i);return{mainMatrix:this._globeViewProjMatrix32f,tileMercatorCoords:a,clippingPlane:this._cachedClippingPlane,projectionTransition:+!!r,fallbackMatrix:this._globeViewProjMatrix32f,clipAntimeridian:i?.canonical.z===0}}_computeClippingPlane(t){let i=this.pitchInRadians,r=this.cameraToCenterDistance/t,a=Math.sin(i)*r,o=Math.cos(i)*r+1,s=1/Math.sqrt(a*a+o*o)*1,n=-a,l=o,h=Math.sqrt(n*n+l*l),c=[0,n/=h,l/=h];(0,P.si)(c,c,[0,0,0],-this.bearingInRadians),(0,P.ai)(c,c,[0,0,0],-1*this.center.lat*Math.PI/180),(0,P.oi)(c,c,[0,0,0],this.center.lng*Math.PI/180);let u=1/(0,P.ni)(c);return(0,P.ci)(c,c,u),[...c,-s*u]}isLocationOccluded(t,i,r){let a=i?.getCoverageIndex();r??=a?i.getElevationForLngLat(t,this):0;let o=iY(t,r);
812if(!this.isSurfacePointVisible(o))return!0;if(!a)return!1;let s=this._projectSurfacePointToScreen(o),n=this.cameraPosition,l=this.getRayDirectionFromPixel(s),h=iK(n,l,o);if(h<=0)return!0;let c=this.screenTerrainPointToMercatorCoordinate(s,i);return null!=c&&iK(n,l,iY(c.toLngLat(),c.z))<.99*h}transformLightDirection(t){let i=this._helper._center.lng*Math.PI/180,r=this._helper._center.lat*Math.PI/180,a=Math.cos(r),o=[Math.sin(i)*a,Math.sin(r),Math.cos(i)*a],s=[o[2],0,-o[0]],n=[0,0,0];(0,P.Qr)(n,s,o),(0,P.ii)(s,s),(0,P.ii)(n,n);let l=[s[0]*t[0]+n[0]*t[1]+o[0]*t[2],s[1]*t[0]+n[1]*t[1]+o[1]*t[2],s[2]*t[0]+n[2]*t[1]+o[2]*t[2]],h=[0,0,0];return(0,P.ii)(h,l),h}getPixelScale(){return 1/Math.cos(this._helper._center.lat*Math.PI/180)}getCircleRadiusCorrection(){return Math.cos(this._helper._center.lat*Math.PI/180)}getPitchedTextCorrection(t,i,r){var a,o;let s=(0,P.et)(t,i,r.canonical),n=(a=s.x,o=s.y,[(0,P.gr)(a*Math.PI*2+Math.PI,2*Math.PI),2*Math.atan(Math.exp(Math.PI-o*Math.PI*2))-.5*Math.PI]);return this.getCircleRadiusCorrection()/Math.cos(n[1])}projectTileCoordinates(t,i,r,a){let o,s=r.canonical,n=iS(t,i,s.x,s.y,s.z),l=1+(a??0)/P.ut,h=n[0]*l,c=n[1]*l,u=n[2]*l,d=[h,c,u,1];if((0,P.Yr)(d,d,this._globeViewProjMatrixF64),l<=1){let t=this._cachedClippingPlane;o=t[0]*n[0]+t[1]*n[1]+t[2]*n[2]+t[3]<0}else o=this._isLineOfSightBlocked(h,c,u);return{point:new P.Li(d[0]/d[3],d[1]/d[3]),signedDistanceFromCamera:d[3],isOccluded:o}}_isLineOfSightBlocked(t,i,r){let a=this._cameraPosition,o=t-a[0],s=i-a[1],n=r-a[2],l=o*o+s*s+n*n;if(0===l)return!1;let h=(0,P.Bn)(-(a[0]*o+a[1]*s+a[2]*n)/l,0,1),c=a[0]+h*o,u=a[1]+h*s,d=a[2]+h*n;return c*c+u*u+d*d<1}_calcMatrices(t=this._helper.autoCalculateNearFarZ){let i=iz(this.worldSize,this.center.lat),r=(0,P.Wn)();t&&(this._helper._nearZ=.5,this._helper._farZ=this.cameraToCenterDistance+2*i),(0,P.Ei)(r,this.fovInRadians,this.width/this.height,this._helper._nearZ,this._helper._farZ);let a=this.centerOffset;r[8]=-(2*a.x)/this._helper._width,r[9]=2*a.y/this._helper._height,this._projectionMatrix=(0,P.gi)(r),this._globeProjMatrixInverted=(0,P.Wn)(),(0,P.Ci)(this._globeProjMatrixInverted,r),(0,P.ji)(r,r,[0,0,-this.cameraToCenterDistance]),(0,P.ki)(r,r,this.rollInRadians),(0,P.Di)(r,r,-this.pitchInRadians),(0,P.ki)(r,r,this.bearingInRadians),(0,P.ji)(r,r,[0,0,-i]);let o=(0,P.Gn)();o[0]=i,o[1]=i,o[2]=i,(0,P.Di)(r,r,this.center.lat*Math.PI/180),(0,P.Oi)(r,r,-this.center.lng*Math.PI/180),(0,P.Ai)(r,r,o),this._globeViewProjMatrixF64=r,this._globeViewProjMatrix32f=new Float32Array(r),this._globeViewProjMatrixF64Inverted=(0,P.Wn)(),(0,P.Ci)(this._globeViewProjMatrixF64Inverted,r);let s=(0,P.Gn)();this._cameraPosition=(0,P.Gn)(),this._cameraPosition[2]=this.cameraToCenterDistance/i,(0,P.si)(this._cameraPosition,this._cameraPosition,s,-this.rollInRadians),(0,P.ai)(this._cameraPosition,this._cameraPosition,s,this.pitchInRadians),(0,P.si)(this._cameraPosition,this._cameraPosition,s,-this.bearingInRadians),(0,P.Xr)(this._cameraPosition,this._cameraPosition,[0,0,1]),(0,P.ai)(this._cameraPosition,this._cameraPosition,s,-this.center.lat*Math.PI/180),(0,P.oi)(this._cameraPosition,this._cameraPosition,s,this.center.lng*Math.PI/180),this._cachedClippingPlane=this._computeClippingPlane(i);let n=(0,P.gi)(this._globeViewProjMatrixF64Inverted);(0,P.Ai)(n,n,[1,1,-1]),this._cachedFrustum=e9.fromInvProjectionMatrix(n,1,0,this._cachedClippingPlane,!0)}calculateFogMatrix(t){(0,P.Nr)("calculateFogMatrix is not supported on globe projection.");let i=(0,P.Wn)();return(0,P.Si)(i),i}getVisibleUnwrappedCoordinates(t){return[new P.f(0,t)]}getCameraFrustum(){return this._cachedFrustum}getClippingPlane(){return this._cachedClippingPlane}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(t){t?(0,P.Nr)("terrain is not fully supported on vertical perspective projection."):this._helper.recalculateZoomAndCenter(0)}maxPitchScaleFactor(){return 1}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return((0,P.ni)(this._cameraPosition)-1)*P.ut}getCameraLngLat(){let t=(0,P.Gn)();return(0,P.ii)(t,this._cameraPosition),iD(t)}populateCache(t){}getBounds(){let t=.5*this.width,i=.5*this.height,r=[new P.Li(0,0),new P.Li(t,0),new P.Li(this.width,0),new P.Li(this.width,i),new P.Li(this.width,this.height),new P.Li(t,this.height),new P.Li(0,this.height),new P.Li(0,i)],a=[];for(let t of r)a.push(this.unprojectScreenPoint(t));let o=0,s=0,n=0,l=0,h=this.center;for(let t of a){let i=(0,P.Xn)(h.lng,t.lng),r=(0,P.Xn)(h.lat,t.lat);
812i<s&&(s=i),i>o&&(o=i),r<l&&(l=r),r>n&&(n=r)}let c=[h.lng+s,h.lat+l,h.lng+o,h.lat+n];return this.isSurfacePointOnScreen([0,1,0])&&(c[3]=90,c[0]=-180,c[2]=180),this.isSurfacePointOnScreen([0,-1,0])&&(c[1]=-90,c[0]=-180,c[2]=180),new eL(c)}calculateCenterFromCameraLngLatAlt(t,i,r,a){return this._helper.calculateCenterFromCameraLngLatAlt(t,i,r,a)}calculateCameraOptionsFromTo(t,i,r,a){let o=P.lt.convert(r),s=iE(P.lt.convert(t));(0,P.ci)(s,s,1+i/P.ut);let n=iE(o),l=(0,P.ci)((0,P.Gn)(),n,1+a/P.ut),h=(0,P.di)((0,P.Gn)(),s,n),c=(0,P.ni)(h);if(c<1e-12||1e-12>(0,P.$r)(s,l))throw Error("Can't calculate camera options with same From and To");let u=(0,P.Gn)();(0,P.oi)(h,h,u,-(0,P.Yn)(o.lng)),(0,P.ai)(h,h,u,(0,P.Yn)(o.lat));let d=(0,P.xr)(Math.acos((0,P.Bn)(h[2]/c,-1,1))),_=Math.hypot(h[0],h[1])<1e-9*c?this.bearing:(0,P.xr)(Math.atan2(-h[0],-h[1]));return{center:o,elevation:a,zoom:(0,P.Dr)(this.cameraToCenterDistance/c/iz(this.tileSize,o.lat)),pitch:d,bearing:_}}setLocationAtPoint(t,i,r){let a=iE(this.unprojectScreenPoint(i)),o=iE(t),s=(0,P.Gn)();(0,P.hi)(s);let n=(0,P.Gn)();(0,P.oi)(n,a,s,-this.center.lng*Math.PI/180),(0,P.ai)(n,n,s,this.center.lat*Math.PI/180);let l=o[0]*o[0]+o[2]*o[2],h=n[0]*n[0];if(l<h)return;let c=Math.sqrt(l-h),u=(0,P.In)(o[0],o[2],n[0],c),d=(0,P.In)(o[0],o[2],n[0],-c),_=(0,P.Gn)();(0,P.oi)(_,o,s,-u);let p=(0,P.In)(_[1],_[2],n[1],n[2]),m=(0,P.Gn)();(0,P.oi)(m,o,s,-d);let f=(0,P.In)(m[1],m[2],n[1],n[2]),g=.5*Math.PI,v=p>=-g&&p<=g,y=f>=-g&&f<=g,x,b;if(v&&y){let t=this.center.lng*Math.PI/180,i=this.center.lat*Math.PI/180;(0,P.Zn)(u,t)+(0,P.Zn)(p,i)<(0,P.Zn)(d,t)+(0,P.Zn)(f,i)?(x=u,b=p):(x=d,b=f)}else if(v)x=u,b=p;else{if(!y)return;x=d,b=f}let w=x/Math.PI*180,T=b/Math.PI*180,M=this.center.lat;this.setCenter(new P.lt(w,(0,P.Bn)(T,-90,90))),this.setZoom(this.zoom+ik(M,this.center.lat))}locationToScreenPoint(t,i){let r=iE(t);if(i){let a=i.getElevationForLngLatZoom(t,this._helper._tileZoom);(0,P.ci)(r,r,1+a/P.ut)}return this._projectSurfacePointToScreen(r)}_projectSurfacePointToScreen(t){let i=(0,P.Kn)();return(0,P.Yr)(i,[...t,1],this._globeViewProjMatrixF64),i[0]/=i[3],i[1]/=i[3],new P.Li((.5*i[0]+.5)*this.width,(-(.5*i[1])+.5)*this.height)}screenPointToMercatorCoordinate(t,i){if(i){let r=this.screenTerrainPointToMercatorCoordinate(t,i);if(r)return r}return P.nt.fromLngLat(this.unprojectScreenPoint(t))}screenTerrainPointToMercatorCoordinate(t,i){let r=i.getCoverageIndex();if(!r)return null;let a=this.cameraPosition,o=this.getRayDirectionFromPixel(t),s=ij(a,o,1+r.maxElevation/P.ut);if(!s)return null;let n=ij(a,o,1+r.minElevation/P.ut),l=Math.max(s.tMin,0),h=n?n.tMin:s.tMax;if(h<=l)return null;let c={index:r,exaggeration:i.exaggeration,origin:a,direction:o},u=0;for(let t=0;t<=256;t++){let i=l+(h-l)*t/256;if(iX(c,i)){let{hi:t}=ip(c,iX,u,i,1e-12),{sample:r,mercator:a}=iH(c,t);return new P.nt(a.x,a.y,r.elevation)}u=i}return null}screenPointToLocation(t,i){return this.screenPointToMercatorCoordinate(t,i)?.toLngLat()}screenPointToLocationAtElevation(t,i){return this.screenPointToLocation(t)}isPointOnMapSurface(t,i){return!!ij(this._cameraPosition,this.getRayDirectionFromPixel(t))}getRayDirectionFromPixel(t){let i=(0,P.Kn)();i[0]=t.x/this.width*2-1,i[1]=-((t.y/this.height*2-1)*1),i[2]=1,i[3]=1,(0,P.Yr)(i,i,this._globeViewProjMatrixF64Inverted),i[0]/=i[3],i[1]/=i[3],i[2]/=i[3];let r=(0,P.Gn)();r[0]=i[0]-this._cameraPosition[0],r[1]=i[1]-this._cameraPosition[1],r[2]=i[2]-this._cameraPosition[2];let a=(0,P.Gn)();return(0,P.ii)(a,r),a}isSurfacePointVisible(t){let i=this._cachedClippingPlane;return i[0]*t[0]+i[1]*t[1]+i[2]*t[2]+i[3]>=0}isSurfacePointOnScreen(t){if(!this.isSurfacePointVisible(t))return!1;let i=(0,P.Kn)();return(0,P.Yr)(i,[...t,1],this._globeViewProjMatrixF64),i[0]/=i[3],i[1]/=i[3],i[2]/=i[3],i[0]>-1&&i[0]<1&&i[1]>-1&&i[1]<1&&i[2]>-1&&i[2]<1}unprojectScreenPoint(t){var i,r;let a,o,s,n=this._cameraPosition,l=this.getRayDirectionFromPixel(t),h=ij(n,l);if(h){let t=(0,P.Gn)();(0,P.Xr)(t,n,[l[0]*h.tMin,l[1]*h.tMin,l[2]*h.tMin]);let i=(0,P.Gn)();return(0,P.ii)(i,t),iD(i)}let c=this._cachedClippingPlane,u=c[0]*l[0]+c[1]*l[1]+c[2]*l[2],d=-(0,P.br)(c,n)/u,_=(0,P.Gn)();if(d>
8120)(0,P.Xr)(_,n,[l[0]*d,l[1]*d,l[2]*d]);else{let t=(0,P.Gn)();(0,P.Xr)(t,n,[2*l[0],2*l[1],2*l[2]]);let i=(0,P.br)(this._cachedClippingPlane,t);(0,P.ui)(_,t,[this._cachedClippingPlane[0]*i,this._cachedClippingPlane[1]*i,this._cachedClippingPlane[2]*i])}let p=((a=(0,P.Gn)())[0]=-(c[0]*c[3]),a[1]=-(c[1]*c[3]),a[2]=-(c[2]*c[3]),{center:a,radius:Math.sqrt(1-c[3]*c[3])});return iD((i=p.center,r=p.radius,o=(0,P.Gn)(),(0,P.ui)(o,_,i),s=(0,P.Gn)(),(0,P.li)(s,i,o,r/(0,P.ti)(o)),s))}getProjectionDataForCustomLayer(t=!0){let i=this.getProjectionData({overscaledTileID:new P.d(0,0,0,0,0),applyGlobeMatrix:t});return i.tileMercatorCoords=[0,0,1,1],i}getFastPathSimpleProjectionMatrix(t){}};function iH(t,i){let r=(0,P.Gn)();(0,P.li)(r,t.origin,t.direction,i);let a=(0,P.ni)(r),o=(0,P.Gn)();(0,P.ci)(o,r,1/a);let s=iD(o),n=P.nt.fromLngLat(s),l=new P.nt(n.x,(0,P.Bn)(n.y,0,.999999999)),h=id(t.index,t.exaggeration,l.x,l.y),c=Math.abs(s.lat)>85.051129?0:h.elevation;return{sample:{...h,elevation:c},radius:a,mercator:l}}function iX(t,i){let{sample:r,radius:a}=iH(t,i);return i_(r,(a-1)*P.ut)}function iY(t,i){let r=iE(t);return(0,P.ci)(r,r,1+i/P.ut)}function iK(t,i,r){let a=(0,P.di)((0,P.Gn)(),r,t);return(0,P.ei)(a,i)}var iJ=class t{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(t){this._helper.setMinZoom(t)}setMaxZoom(t){this._helper.setMaxZoom(t)}setMinPitch(t){this._helper.setMinPitch(t)}setMaxPitch(t){this._helper.setMaxPitch(t)}setRenderWorldCopies(t){this._helper.setRenderWorldCopies(t)}setBearing(t){this._helper.setBearing(t)}setPitch(t){this._helper.setPitch(t)}setRoll(t){this._helper.setRoll(t)}setFov(t){this._helper.setFov(t)}setZoom(t){this._helper.setZoom(t)}setCenter(t){this._helper.setCenter(t)}setElevation(t){this._helper.setElevation(t)}setMinElevationForCurrentTile(t){this._helper.setMinElevationForCurrentTile(t)}setPadding(t){this._helper.setPadding(t)}interpolatePadding(t,i,r){this._helper.interpolatePadding(t,i,r)}isPaddingEqual(t){return this._helper.isPaddingEqual(t)}resize(t,i,r=!0){this._helper.resize(t,i,r)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(t){this._helper.setMaxBounds(t)}setConstrainOverride(t){this._helper.setConstrainOverride(t)}overrideNearFarZ(t,i){this._helper.overrideNearFarZ(t,i)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(t){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),t)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}get constrainOverride(){return this._helper.constrainOverride}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}get isGlobeRendering(){return this._globeness>0}setTransitionState(t){this._globeness=t,this._calcMatrices(),this._verticalPerspectiveTransform.getCoveringTilesDetailsProvider().prepareNextFrame(),this._mercatorTransform.getCoveringTilesDetailsProvider().prepareNextFrame()}get currentTransform(){return this.isGlobeRendering?this._verticalPerspectiveTransform:this._mercatorTransform}constructor(t){this._globeness=1,this.defaultConstrain=(t,i)=>this.currentTransform.defaultConstrain(t,i),this.applyConstrain=(t,i)=>this._helper.applyConstrain(t,i),this._helper=new ia({calcMatrices:()=>this._calcMatrices(),defaultConstrain:(t,i)=>this.defaultConstrain(t,i)},t),this._globeness=1,this._mercatorTransform=new im(void 0,this._helper),this._verticalPerspectiveTransform=new i$(void 0,this._helper)}clone(){let i=new t;return i._globeness=this._globeness,i.apply(this,!1),i}apply(t,i){this._helper.apply(t,i)}get projectionMatrix(){return this.currentTransform.projectionMatrix}get modelViewProjectionMatrix(){return this.currentTransform.modelViewProjectionMatrix}get inverseProjectionMatrix(){return this.currentTransform.inverseProjectionMatrix}get cameraPosition(){return this.currentTransform.cameraPosition}getProjectionData(t){let i=this._mercatorTransform.getProjectionData(t),r=this._verticalPerspectiveTransform.getProjectionData(t);return{mainMatrix:this.isGlobeRendering?r.mainMatrix:i.mainMatrix,clippingPlane:r.clippingPlane,tileMercatorCoords:r.tileMercatorCoords,projectionTransition:t.applyGlobeMatrix?this._globeness:0,fallbackMatrix:i.fallbackMatrix,clipAntimeridian:r.clipAntimeridian}}isLocationOccluded(t,i,r){return this.currentTransform.isLocationOccluded(t,i,r)}transformLightDirection(t){return this.currentTransform.transformLightDirection(t)}getPixelScale(){return(0,P.mr)(this._mercatorTransform.getPixelScale(),this._verticalPerspectiveTransform.getPixelScale(),this._globeness)}getCircleRadiusCorrection(){return(0,P.mr)(this._mercatorTransform.getCircleRadiusCorrection(),this._verticalPerspectiveTransform.getCircleRadiusCorrection(),this._globeness)}getPitchedTextCorrection(t,i,r){let a=this._mercatorTransform.getPitchedTextCorrection(t,i,r),o=this._verticalPerspectiveTransform.getPitchedTextCorrection(t,i,r);return(0,P.mr)(a,o,this._globeness)}projectTileCoordinates(t,i,r,a){return this.currentTransform.projectTileCoordinates(t,i,r,a)}_calcMatrices(){this._helper._width&&this._helper._height&&(this._verticalPerspectiveTransform._calcMatrices(),this._mercatorTransform._calcMatrices(this.autoCalculateNearFarZ&&!this.isGlobeRendering))}calculateFogMatrix(t){return this.currentTransform.calculateFogMatrix(t)}getVisibleUnwrappedCoordinates(t){return this.currentTransform.getVisibleUnwrappedCoordinates(t)}getCameraFrustum(){return this.currentTransform.getCameraFrustum()}getClippingPlane(){return this.currentTransform.getClippingPlane()}getCoveringTilesDetailsProvider(){return this.currentTransform.getCoveringTilesDetailsProvider()}recalculateZoomAndCenter(t){this.currentTransform.recalculateZoomAndCenter(t)}maxPitchScaleFactor(){return this._mercatorTransform.maxPitchScaleFactor()}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this.currentTransform.getCameraAltitude()}getCameraLngLat(){return this.currentTransform.getCameraLngLat()}populateCache(t){this._mercatorTransform.populateCache(t),this._verticalPerspectiveTransform.populateCache(t)}getBounds(){return this.currentTransform.getBounds()}calculateCenterFromCameraLngLatAlt(t,i,r,a){return this._helper.calculateCenterFromCameraLngLatAlt(t,i,r,a)}calculateCameraOptionsFromTo(t,i,r,a){return this.currentTransform.calculateCameraOptionsFromTo(t,i,r,a)}setLocationAtPoint(t,i,r){this.currentTransform.setLocationAtPoint(t,i,r)}locationToScreenPoint(t,i){return this.currentTransform.locationToScreenPoint(t,i)}screenPointToMercatorCoordinate(t,i){return this.currentTransform.screenPointToMercatorCoordinate(t,i)}screenTerrainPointToMercatorCoordinate(t,i){return this.currentTransform.screenTerrainPointToMercatorCoordinate(t,i)}screenPointToLocation(t,i){return this.currentTransform.screenPointToLocation(t,i)}screenPointToLocationAtElevation(t,i){return this.currentTransform.screenPointToLocationAtElevation(t,i)}
812isPointOnMapSurface(t,i){return this.currentTransform.isPointOnMapSurface(t,i)}getRayDirectionFromPixel(t){return this._verticalPerspectiveTransform.getRayDirectionFromPixel(t)}getProjectionDataForCustomLayer(t=!0){let i=this._mercatorTransform.getProjectionDataForCustomLayer(t);if(!this.isGlobeRendering)return i;let r=this._verticalPerspectiveTransform.getProjectionDataForCustomLayer(t);return r.fallbackMatrix=i.mainMatrix,r.projectionTransition=this._globeness,r}getFastPathSimpleProjectionMatrix(t){return this.currentTransform.getFastPathSimpleProjectionMatrix(t)}},iQ=class t{get useGlobeControls(){return!0}handlePanInertia(t,i){let r,a,o,s,n=(r=t.rotate(i.bearingInRadians),a=i.zoom+ik(i.center.lat,0),o=(0,P.mr)(1/iF(i.center.lat),1/iF(Math.min(Math.abs(i.center.lat),60)),(0,P.wr)(a,7,3,0,1)),s=360/iI({worldSize:i.worldSize,center:{lat:i.center.lat}}),new P.lt(i.center.lng-r.x*s*o,(0,P.Bn)(i.center.lat+r.y*s,-P.Fn,P.Fn)));return Math.abs(n.lng-i.center.lng)>180&&(n.lng=i.center.lng+179.5*Math.sign(n.lng-i.center.lng)),{easingCenter:n,easingOffset:new P.Li(0,0)}}handleMapControlsRollPitchBearingZoom(t,i){let r=t.around,a=i.screenPointToLocation(r);t.bearingDelta&&i.setBearing(i.bearing+t.bearingDelta),t.pitchDelta&&i.setPitch(i.pitch+t.pitchDelta),t.rollDelta&&i.setRoll(i.roll+t.rollDelta);let o=i.zoom;t.zoomDelta&&i.setZoom(i.zoom+t.zoomDelta);let s=i.zoom-o;if(0===s)return;let n=(0,P.Xn)(i.center.lng,a.lng),l=n/(Math.abs(n/180)+1),h=(0,P.Xn)(i.center.lat,a.lat),c=i.getRayDirectionFromPixel(r),u=i.cameraPosition,d=-1*(0,P.ei)(u,c),_=(0,P.Gn)();(0,P.Xr)(_,u,[c[0]*d,c[1]*d,c[2]*d]);let p=(0,P.ni)(_),m=Math.exp(-(.5*Math.max(p-1-.3,0))),f=(0,P.wr)(p,.95,.999,0,1),g=iz(i.worldSize,i.center.lat)/Math.min(i.width,i.height),v=(0,P.wr)(g,.9,.5,1,.25),y=Math.min(m,(0,P.mr)(1,v,f)),x=(1-(0,P.Fr)(-s))*y,b=i.center.lat,w=i.zoom,T=new P.lt(i.center.lng+l*x,(0,P.Bn)(i.center.lat+h*x,-P.Fn,P.Fn));i.setLocationAtPoint(a,r);let M=i.center,C=Math.max((0,P.wr)(Math.abs(n),45,85,0,1),f)**.25,I=(0,P.Xn)(M.lng,T.lng),S=(0,P.Xn)(M.lat,T.lat);i.setCenter(new P.lt(M.lng+I*C,M.lat+S*C).wrap()),i.setZoom(w+ik(b,i.center.lat))}handleMapControlsPan(t,i,r){t.panDelta&&function(t,i,r,a,o=!0){var s,n,l,h,c,u,d;let _,p,m,f,g,v,y,x,b,w,T,M,C,I,S=iA(t,r),E=i;if(a)E=iA(t,r.sub(a));else if(!t.isPointOnMapSurface(r))return;let z=iE(S),R=iE(E),D=(s=t.center,n=t.bearing,(0,P.Ur)((0,P.Kn)(),-s.lng,-s.lat,n)),L=(0,P.Qr)((0,P.Gn)(),R,z),A=Math.sqrt((0,P.ei)(L,L)),F=Math.acos((0,P.Bn)((0,P.ei)(R,z),-1,1))/2,k=Math.sin(F),B=A?(0,P.Wr)(L[1]/A*k,-L[0]/A*k,L[2]/A*k,Math.cos(F)):(0,P.Wr)(0,0,0,1),{lng:O,lat:j,bearing:N}=(T=(l=(0,P.Gr)((0,P.Kn)(),D,B))[0],M=l[1],C=l[2],{lng:-(180*Math.atan2(2*((I=l[3])*T+M*C),1-2*(T*T+M*M)))/Math.PI,lat:-(180*Math.asin((0,P.Bn)(2*(I*M-C*T),-1,1)))/Math.PI,bearing:180*Math.atan2(2*(I*C+T*M),1-2*(M*M+C*C))/Math.PI}),Z=t.center.lat,U=t.zoom,G=(0,P.Bn)(j,-90,90),V=o?(h=t,c=r,u=a,d=O,_=h.center.lng,m=(p=h.center.lat)>=0?90:-90,f=h.locationToScreenPoint(new P.lt(0,m)),g=c.x-f.x,v=c.y-f.y,x=(y=(0,P.Bn)(1-(P.Fn-Math.abs(p))/12,0,1))*y*(3-2*y),b=(0,P.gr)(d-_+180,360)-180,w=0,x>0&&u&&(w=(m>0?1:-1)*((g*u.y-v*u.x)/Math.max(g*g+v*v,400))*180/Math.PI),_+(1-x)*b+x*w):O;t.setCenter(new P.lt((0,P.Pr)(V,-180,180),G)),o||t.setBearing(N),t.setZoom(U+ik(Z,t.center.lat))}(i,r,i.isPointOnMapSurface(t.around)?t.around:i.centerPoint,t.panDelta)}cameraForBoxAndBearing(i,r,a,o,s){let n=iw(i,r,a,o,s),l=r.left/s.width*2-1,h=(s.width-r.right)/s.width*2-1,c=-(r.top/s.height*2)+1,u=-((s.height-r.bottom)/s.height*2)+1,d=0>(0,P.Xn)(a.getWest(),a.getEast()),_=d?a.getEast():a.getWest(),p=d?a.getWest():a.getEast(),m=Math.max(a.getNorth(),a.getSouth()),f=Math.min(a.getNorth(),a.getSouth()),g=_+.5*(0,P.Xn)(_,p),v=m+.5*(0,P.Xn)(m,f),y=s.clone();y.setCenter(n.center),y.setBearing(n.bearing),y.setPitch(0),y.setRoll(0),y.setZoom(n.zoom);let x=y.modelViewProjectionMatrix,b=[iE(a.getNorthWest()),iE(a.getNorthEast()),iE(a.getSouthWest
812()),iE(a.getSouthEast()),iE(new P.lt(p,v)),iE(new P.lt(_,v)),iE(new P.lt(g,m)),iE(new P.lt(g,f))],w=iE(n.center),T=1/0;for(let i of b)l<0&&(T=t.getLesserNonNegativeNonNull(T,t.solveVectorScale(i,w,x,"x",l))),h>0&&(T=t.getLesserNonNegativeNonNull(T,t.solveVectorScale(i,w,x,"x",h))),c>0&&(T=t.getLesserNonNegativeNonNull(T,t.solveVectorScale(i,w,x,"y",c))),u<0&&(T=t.getLesserNonNegativeNonNull(T,t.solveVectorScale(i,w,x,"y",u)));return Number.isFinite(T)&&0!==T?(n.zoom=Math.min(y.zoom+(0,P.Dr)(T),i.maxZoom),n):void ix()}handleJumpToCenterZoom(t,i){let r=t.center.lat,a=t.applyConstrain(i.center?P.lt.convert(i.center):t.center,t.zoom).center;t.setCenter(a.wrap());let o=void 0===i.zoom?t.zoom+ik(r,a.lat):+i.zoom;t.zoom!==o&&t.setZoom(o)}handleEaseTo(t,i){let r=t.zoom,a=t.center,o=t.padding,s={roll:t.roll,pitch:t.pitch,bearing:t.bearing},n={roll:void 0===i.roll?t.roll:i.roll,pitch:void 0===i.pitch?t.pitch:i.pitch,bearing:void 0===i.bearing?t.bearing:i.bearing},l=void 0!==i.zoom,h=!t.isPaddingEqual(i.padding),c=!1,u=i.center?P.lt.convert(i.center):a,d=t.applyConstrain(u,r).center;ii(t,d);let _=t.clone();_.setCenter(d),_.setZoom(l?+i.zoom:r+ik(a.lat,u.lat)),_.setBearing(i.bearing);let p=new P.Li((0,P.Bn)(t.centerPoint.x+i.offsetAsPoint.x,0,t.width),(0,P.Bn)(t.centerPoint.y+i.offsetAsPoint.y,0,t.height));_.setLocationAtPoint(d,p);let m=(i.offset&&i.offsetAsPoint.mag())>0?_.center:d,f=l?+i.zoom:r+ik(a.lat,m.lat),g=r+ik(a.lat,0),v=f+ik(m.lat,0),y=(0,P.Xn)(a.lng,m.lng),x=(0,P.Xn)(a.lat,m.lat),b=(0,P.Fr)(v-g);return{easeFunc:r=>{if((0,P.Tr)(s,n)||ib({startEulerAngles:s,endEulerAngles:n,tr:t,k:r,useSlerp:s.roll!=n.roll}),h&&t.interpolatePadding(o,i.padding,r),i.around)(0,P.Nr)("Easing around a point is not supported under globe projection."),t.setLocationAtPoint(i.around,i.aroundPoint);else{let i=iO(a,y,x,r*(v>g?Math.min(2,b):Math.max(.5,b))**(1-r));t.setCenter(i.wrap())}if(c){let i=P.un.number(g,v,r)+ik(0,t.center.lat);t.setZoom(i)}},isZooming:c=f!==r,elevationCenter:m}}handleFlyTo(t,i){let r,a,o=void 0!==i.zoom,s=t.center,n=t.zoom,l=t.padding,h=!t.isPaddingEqual(i.padding),c=t.applyConstrain(P.lt.convert(i.center||i.locationAtOffset),n).center,u=o?+i.zoom:t.zoom+ik(t.center.lat,c.lat),d=t.clone();d.setCenter(c),d.setZoom(u),d.setBearing(i.bearing);let _=new P.Li((0,P.Bn)(t.centerPoint.x+i.offsetAsPoint.x,0,t.width),(0,P.Bn)(t.centerPoint.y+i.offsetAsPoint.y,0,t.height));d.setLocationAtPoint(c,_);let p=d.center;ii(t,p);let m=(r=iE(s),a=iE(p),Math.acos((0,P.ei)(r,a))/(2*Math.PI)*iI(t)),f=n+ik(s.lat,0),g=u+ik(p.lat,0),v=(0,P.Fr)(g-f),y=Math.min(Math.max("number"==typeof i.minZoom?+i.minZoom:t.minZoom,t.minZoom)+ik(p.lat,0),f,g)+ik(0,p.lat),x=t.applyConstrain(p,y).zoom+ik(p.lat,0),b=(0,P.Fr)(x-f),w=(0,P.Xn)(s.lng,p.lng),T=(0,P.Xn)(s.lat,p.lat);return{easeFunc:(r,a,o,n)=>{let c=iO(s,w,T,o);h&&t.interpolatePadding(l,i.padding,r);let d=1===r?p:c;t.setCenter(d.wrap());let _=f+(0,P.Dr)(a);t.setZoom(1===r?u:_+ik(0,d.lat))},scaleOfZoom:v,targetCenter:p,scaleOfMinZoom:b,pixelPathLength:m}}static solveVectorScale(t,i,r,a,o){let s="x"===a?[r[0],r[4],r[8],r[12]]:[r[1],r[5],r[9],r[13]],n=[r[3],r[7],r[11],r[15]],l=t[0]*s[0]+t[1]*s[1]+t[2]*s[2],h=t[0]*n[0]+t[1]*n[1]+t[2]*n[2],c=i[0]*s[0]+i[1]*s[1]+i[2]*s[2],u=i[0]*n[0]+i[1]*n[1]+i[2]*n[2],d=(c+s[3]-o*u-o*n[3])/(c-l-o*u+o*h);return c+o*h===l+o*u||n[3]*(l-c)+s[3]*(u-h)+l*u==c*h?null:d}static getLesserNonNegativeNonNull(t,i){return null!==i&&i>=0&&i<t?i:t}},i0=class{constructor(t){this._globe=t,this._mercatorCameraHelper=new iT,this._verticalPerspectiveCameraHelper=new iQ}get useGlobeControls(){return this._globe.useGlobeRendering}get currentHelper(){return this.useGlobeControls?this._verticalPerspectiveCameraHelper:this._mercatorCameraHelper}handlePanInertia(t,i){return this.currentHelper.handlePanInertia(t,i)}handleMapControlsRollPitchBearingZoom(t,i){this.currentHelper.handleMapControlsRollPitchBearingZoom(t,i)}handleMapControlsPan(t,i,r){this.currentHelper.handleMapControlsPan(t,i,r)}cameraForBoxAndBearing(t,i,r,a,o){return this.currentHelper.cameraForBoxAndBearing(t,i,r,a,o)}handleJumpToCenterZoom(t,i){this.currentHelper.handleJumpToCenterZoom(t,i)}handleEaseTo(t,i){return this.currentHelper.handleEaseTo(t,i)}handleFlyTo(t,i){return this.currentHelper.handleFlyTo(t,i)}};let i1=function(){let t={},i=P.hn.$version;for(let r in P.hn.$root){let a=P.hn.$root[r];if(a.required){let o=null;null!=(o="version"===r?i:"array"===a.type?[]:{})&&(t[r]=o)}}return t}();var i2=class extends P.vn{constructor(t,i={}){super(),this._rtlPluginLoaded=()=>{for(let t in this.tileManagers){let i=this.tileManagers[t].getSource().type;("vector"===i||"geojson"===i)&&this.tileManagers[t].reload()}},this.map=t,this.dispatcher=new eE(u||=new eI,t._getMapId()).setEventedParent(this),this.dispatcher.registerMessageHandler("GG",(t,i)=>this.getGlyphs(t,i)),this.dispatcher.registerMessageHandler("GI",(t,i)=>this.getImages(t,i)),this.dispatcher.registerMessageHandler("GDA",(t,i)=>this.getDashes(t,i)),this.imageManager=new el,this.imageManager.setEventedParent(this),this.imageManager.setMissingImageResolver(t._missingStyleImageResolver),this.patternAtlas=new eh(this.imageManager);let r=t._container?.lang||"u">typeof document&&document.documentElement?.lang||void 0;this.glyphManager=new ex(t._requestManager,i.localIdeographFontFamily,r),this.lineAtlas=new eT(256,512),this.crossTileSymbolIndex=new t0,this._setInitialValues(),this._resetUpdates(),this.dispatcher.broadcast("SR",(0,P.Cn)()),e4().on(e0,this._rtlPluginLoaded),this.on("data",t=>{if("source"!==t.dataType||"metadata"!==t.sourceDataType)return;let i=this.tileManagers[t.sourceId];if(!i)return;let r=i.getSource();if(r?.vectorLayerIds)for(let t in this._layers){let i=this._layers[t];
812i.source===r.id&&this._validateLayer(i)}})}_setInitialValues(){this._layers={},this._order=[],this.tileManagers={},this.zoomHistory=new P.tn,this._imagesListDirty=!1,this._globalState={},this._serializedLayers={},this.stylesheet=null,this.light=null,this.sky=null,this.projection&&(this.projection.destroy(),delete this.projection),this._loaded=!1,this._changed=!1,this._updatedLayers={},this._updatedSources={},this._changedImages={},this._glyphsDidChange=!1,this._updatedPaintProps={},this._layerOrderChanged=!1,this._symbolPlacementTriggered=!1,this._placedProjectionTransition=void 0,this.crossTileSymbolIndex=new(this.crossTileSymbolIndex?.constructor||Object),this.pauseablePlacement=void 0,this.placement=void 0,this.z=0}setGlobalStateProperty(t,i){this._checkLoaded();let r=null===i?this.stylesheet.state?.[t]?.default??null:i;return this._setGlobalStateValues({[t]:r}),this}getGlobalState(){return this._globalState}setGlobalState(t){this._checkLoaded();let i={};for(let r in t)i[r]=t[r].default;this._setGlobalStateValues(i)}_setGlobalStateValues(t){let i=[];for(let r in t)(0,P.qn)(t[r],this._globalState[r])||i.push(r);if(0===i.length)return;let r={...this._globalState};for(let r of i)this._globalState[r]=t[r];this._applyGlobalStateChanges(i,r)}_applyGlobalStateChanges(t,i){let r=new Set,a={};for(let i of t)a[i]=this._globalState[i];for(let a in this._layers){let o=this._layers[a];o.retainPriorGlobalState(t,i);let s=o.getLayoutAffectingGlobalStateRefs(),n=o.getPaintAffectingGlobalStateRefs(),l=o.getVisibilityAffectingGlobalStateRefs();for(let i of t){if(s.has(i)&&r.add(o.source),n.has(i))for(let{name:t,value:r}of n.get(i))this._updatePaintProperty(o,t,r,{validate:!1});l?.has(i)&&(o.recalculateVisibility(),this._updateLayer(o))}}let o={now:S(),transition:this.getTransition()};for(let s in this.light?.applyGlobalStateChange(t,i,o),this.sky?.applyGlobalStateChange(t,i,o),this.dispatcher.broadcast("UGS",a),this.tileManagers)r.has(s)&&(this._reloadSource(s),this._changed=!0)}async loadURL(t,i={},r){this.fire(new j("dataloading")),i.validate="boolean"!=typeof i.validate||i.validate,this._loadStyleRequest=new AbortController;let a=this._loadStyleRequest;try{let o=await this.map._requestManager.transformRequest(t,"Style");(0,P.Nn)(a.signal);let s=await (0,P.Sn)(o,a);this._loadStyleRequest===a&&(this._loadStyleRequest=null),this._load(s.data,i,r)}catch(t){this._loadStyleRequest===a&&(this._loadStyleRequest=null),t&&!a.signal.aborted&&this.fire(new P.gn((0,P.Qn)(t)))}}loadJSON(t,i={},r){this.fire(new j("dataloading")),this._frameRequest=new AbortController,C.frameAsync(this._frameRequest,this.map._ownerWindow).then(()=>{this._frameRequest=null,i.validate=!1!==i.validate,this._load(t,i,r)}).catch(()=>{})}loadEmpty(){this.fire(new j("dataloading")),this._load(i1,{validate:!1})}_load(t,i,r){let a=i.transformStyle?i.transformStyle(r,t):t;if(!(i.validate&&(0,P.sn)(this,a))){for(let t in a={...a},this._loaded=!0,this.stylesheet=a,a.sources)this.addSource(t,a.sources[t],{validate:!1});a.sprite?this._loadSprite(a.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(a.glyphs),this.glyphManager.setFontFaces(a["font-faces"]),this._createLayers(),this.light=new eb(this.stylesheet.light??{},this._globalState),this._setProjectionInternal(this.stylesheet.projection?.type||"mercator"),this.sky=new ew(this.stylesheet.sky,this._globalState),this.sky.setEventedParent(this),this.map.setTerrain(this.stylesheet.terrain??null,{validate:!1}),this.fire(new j("data")),this.fire(new O)}}_createLayers(){let t=X(this.stylesheet.layers);for(let i of(this.setGlobalState(this.stylesheet.state??null),this.dispatcher.broadcast("SL",t),this._order=t.map(t=>t.id),this._layers={},this._serializedLayers=null,t)){let t=(0,P._)(i,this._globalState);if(t.setEventedParent(this,{layer:{id:i.id}}),this._layers[i.id]=t,(0,P.Xt)(t)&&this.tileManagers[t.source]){let r=i.paint?.["raster-fade-duration"]??t.paint.get("raster-fade-duration");this.tileManagers[t.source].setRasterFadeDuration(r)}}}async _loadSprite(t,i=!1,r){let a;this.imageManager.setLoaded(!1);let o=new AbortController;this._spriteRequest=o;try{let r=await es(t,this.map._requestManager,this.map.getPixelRatio(),o);if(!r)return;for(let t in r){let{loaded:a,removed:o}=this.imageManager.setSpriteImages(t,r[t]);this._markImagesChanged(o),i&&this._markImagesChanged(a)}}catch(t){a=t,o.signal.aborted||this.fire(new P.gn(a))}finally{this._spriteRequest=null,this.imageManager.setLoaded(!0),i&&(this._changed=!0),this.dispatcher.broadcast("SI",this.imageManager.listImages()),this.fire(new j("data")),r?.(a)}}_unloadSprite(){this._markImagesChanged(this.imageManager.removeAllSpriteImages()),this._imagesListDirty=!0,this._changed=!0,this.fire(new j("data"))}_validateLayer(t){let i=this.tileManagers[t.source];if(!i)return;let r=t.sourceLayer;if(!r)return;let a=i.getSource();("geojson"===a.type||a.vectorLayerIds&&!a.vectorLayerIds.includes(r))&&this.fire(new P.gn(Error(`Source layer "${r}" does not exist on source "${a.id}" as specified by style layer "${t.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(let t in this.tileManagers)if(!this.tileManagers[t].loaded())return!1;return this.imageManager.isLoaded()}_serializeByIds(t,i=!1){let r=this._serializedAllLayers();if(!t||0===t.length)return Object.values(i?(0,P.Vn)(r):r);let a=[];for(let o of t)if(r[o]){let t=i?(0,P.Vn)(r[o]):r[o];a.push(t)}return a}_serializedAllLayers(){let t=this._serializedLayers;if(t)return t;for(let i of(t=this._serializedLayers={},Object.keys(this._layers))){let r=this._layers[i];"custom"!==r.type&&(t[i]=r.serialize())}return t}hasTransitions(){if(this.light?.hasTransition()||this.sky?.hasTransition()||this.projection?.hasTransition())return!0;for(let t in this.tileManagers)if(this.tileManagers[t].hasTransition())return!0;for(let t in this._layers)if(this._layers[t].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw Error("Style is not done loading.")}update(t){if(!this._loaded)return;let i=this._changed;if(i){this._imagesListDirty&&=(this.dispatcher.broadcast("SI",this.imageManager.listImages()),!1);let i=Object.keys(this._updatedLayers),r=Object.keys(this._removedLayers);for(let t in(i.length||r.length)&&this._updateWorkerLayers(i,r),this._updatedSources){let i=this._updatedSources[t];if("reload"===i)this._reloadSource(t);else if("clear"===i)this._clearSource(t);else throw Error(`Invalid action ${i}`)}for(let i in this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs(),this._updatedPaintProps)this._layers[i].updateTransitions(t);this._resetUpdates()}let r={};for(let t in this.tileManagers){let i=this.tileManagers[t];r[t]=i.used,i.used=!1}let a=this.imageManager.listImages();for(let i of this._order){let r=this._layers[i];r.recalculate(t,a),!r.isHidden(t.zoom)&&r.source&&(this.tileManagers[r.source].used=!0)}for(let t in r){let i=this.tileManagers[t];!!r[t]!=!!i.used&&i.fire(new N("data",{sourceDataType:"visibility",sourceId:t}))}this.light.recalculate(t),this.sky.recalculate(t),this.projection.recalculate(t),this.z=t.zoom,i&&this.fire(new j("data"))}_updateTilesForChangedImages(){let t=Object.keys(this._changedImages);if(t.length){for(let i in this.tileManagers)this.tileManagers[i].reloadTilesForDependencies(["icons","patterns"],t);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(let t in this.tileManagers)this.tileManagers[t].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(t,i){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(t,!1),removedIds:i})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(t,i={}){this._checkLoaded();let r=this.serialize();if(t=i.transformStyle?i.transformStyle(r,t):t,(i.validate??!0)&&(0,P.sn)(this,t))return!1;(t=(0,P.Vn)(t)).layers=X(t.layers);let a=function(t,i){if(!t)return[{command:"setStyle",args:[i]}];let r=[];try{if(!Y(t.version,i.version))return[{command:"setStyle",args:[i]}];Y(t.center,i.center)||r.push({command:"setCenter",args:[i.center]}),Y(t.state,i.state)||r.push({command:"setGlobalState",args:[i.state]}),Y(t.centerAltitude,i.centerAltitude)||r.push({command:"setCenterAltitude",args:[i.centerAltitude]}),Y(t.zoom,i.zoom)||r.push({command:"setZoom",args:[i.zoom]}),Y(t.bearing,i.bearing)||r.push({command:"setBearing",args:[i.bearing]}),Y(t.pitch,i.pitch)||r.push({command:"setPitch",args:[i.pitch]}),Y(t.roll,i.roll)||r.push({command:"setRoll",args:[i.roll]}),Y(t.sprite,i.sprite)||r.push({command:"setSprite",args:[i.sprite]}),Y(t.glyphs,i.glyphs)||r.push({command:"setGlyphs",args:[i.glyphs]}),Y(t["font-faces"],i["font-faces"])||r.push({command:"setFontFaces",args:[i["font-faces"]]}),Y(t.transition,i.transition)||r.push({command:"setTransition",args:[i.transition]}),Y(t.light,i.light)||r.push({command:"setLight",args:[i.light]});let a=!Y(t.terrain,i.terrain);a&&!i.terrain&&r.push({command:"setTerrain",args:[void 0]}),Y(t.sky,i.sky)||r.push({command:"setSky",args:[i.sky]}),Y(t.projection,i.projection)||r.push({command:"setProjection",args:[i.projection]});let o={},s=[];!function(t,i,r,a){let o;for(o in t||={},i||={},t)Object.prototype.hasOwnProperty.call(t,o)&&(Object.prototype.hasOwnProperty.call(i,o)||Q(o,r,a));for(o in i){var s;Object.prototype.hasOwnProperty.call(i,o)&&(Object.prototype.hasOwnProperty.call(t,o)?Y(t[o],i[o])||("geojson"===t[o].type&&"geojson"===i[o].type&&function(t,i,r){let a;for(a in t[r])if(Object.prototype.hasOwnProperty.call(t[r],a)&&"data"!==a&&!Y(t[r][a],i[r][a]))return!1;for(a in i[r])if(Object.prototype.hasOwnProperty.call(i[r],a)&&"data"!==a&&!Y(t[r][a],i[r][a]))return!1;return!0}(t,i,o)?K(r,{command:"setGeoJSONSourceData",args:[o,i[o].data]}):(s=i,Q(o,r,a),J(o,s,r))):J(o,i,r))}}(t.sources,i.sources,s,o);let n=[];
812t.layers&&t.layers.forEach(t=>{"source"in t&&o[t.source]?r.push({command:"removeLayer",args:[t.id]}):n.push(t)}),r=r.concat(s),function(t,i,r){t||=[],i||=[];let a=t.map(ei),o=i.map(ei),s=t.reduce(er,{}),n=i.reduce(er,{}),l=a.slice(),h=Object.create(null),c,u,d,_,p;for(let t=0,i=0;t<a.length;t++)c=a[t],Object.prototype.hasOwnProperty.call(n,c)?i++:(K(r,{command:"removeLayer",args:[c]}),l.splice(l.indexOf(c,i),1));for(let t=0,i=0;t<o.length;t++)c=o[o.length-1-t],l[l.length-1-t]!==c&&(Object.prototype.hasOwnProperty.call(s,c)?(K(r,{command:"removeLayer",args:[c]}),l.splice(l.lastIndexOf(c,l.length-i),1)):i++,_=l[l.length-t],K(r,{command:"addLayer",args:[n[c],_]}),l.splice(l.length-t,0,c),h[c]=!0);for(let t=0;t<o.length;t++)if(u=s[c=o[t]],d=n[c],!(h[c]||Y(u,d))){if(!Y(u.source,d.source)||!Y(u["source-layer"],d["source-layer"])||!Y(u.type,d.type)){K(r,{command:"removeLayer",args:[c]}),K(r,{command:"addLayer",args:[d,_=l[l.lastIndexOf(c)+1]]});continue}for(p in et(u.layout,d.layout,r,c,"setLayoutProperty"),et(u.paint,d.paint,r,c,"setPaintProperty"),Y(u.filter,d.filter)||K(r,{command:"setFilter",args:[c,d.filter]}),Y(u.minzoom,d.minzoom)&&Y(u.maxzoom,d.maxzoom)||K(r,{command:"setLayerZoomRange",args:[c,d.minzoom,d.maxzoom]}),u)Object.prototype.hasOwnProperty.call(u,p)&&"layout"!==p&&"paint"!==p&&"filter"!==p&&"metadata"!==p&&"minzoom"!==p&&"maxzoom"!==p&&(0===p.indexOf("paint.")?et(u[p],d[p],r,c,"setPaintProperty"):Y(u[p],d[p])||K(r,{command:"setLayerProperty",args:[c,p,d[p]]}));for(p in d)Object.prototype.hasOwnProperty.call(d,p)&&!Object.prototype.hasOwnProperty.call(u,p)&&"layout"!==p&&"paint"!==p&&"filter"!==p&&"metadata"!==p&&"minzoom"!==p&&"maxzoom"!==p&&(0===p.indexOf("paint.")?et(u[p],d[p],r,c,"setPaintProperty"):Y(u[p],d[p])||K(r,{command:"setLayerProperty",args:[c,p,d[p]]}))}}(n,i.layers,r),a&&i.terrain&&r.push({command:"setTerrain",args:[i.terrain]})}catch(t){console.warn("Unable to compute style diff:",t),r=[{command:"setStyle",args:[i]}]}return r}(r,t),o=this._getOperationsToPerform(a);if(o.unimplemented.length>0)throw Error(`Unimplemented: ${o.unimplemented.join(", ")}.`);if(0===o.operations.length)return!1;for(let t of o.operations)t();return this.stylesheet=t,this._serializedLayers=null,this.fire(new O({style:this})),!0}_getOperationsToPerform(t){let i=[],r=[];for(let a of t)switch(a.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":case"setRoll":continue;case"addLayer":{let[t,r]=a.args;i.push(()=>this.addLayer(t,r));break}case"removeLayer":{let[t]=a.args;i.push(()=>this.removeLayer(t));break}case"setPaintProperty":{let[t,r,o]=a.args;i.push(()=>this.setPaintProperty(t,r,o));break}case"setLayoutProperty":{let[t,r,o]=a.args;i.push(()=>this.setLayoutProperty(t,r,o));break}case"setFilter":{let[t,r]=a.args;i.push(()=>this.setFilter(t,r));break}case"addSource":{let[t,r]=a.args;i.push(()=>this.addSource(t,r));break}case"removeSource":{let[t]=a.args;i.push(()=>this.removeSource(t));break}case"setLayerZoomRange":{let[t,r,o]=a.args;i.push(()=>this.setLayerZoomRange(t,r,o));break}case"setLight":{let[t]=a.args;i.push(()=>this.setLight(t));break}case"setGeoJSONSourceData":{let[t,r]=a.args;i.push(()=>this.setGeoJSONSourceData(t,r));break}case"setGlyphs":{let[t]=a.args;i.push(()=>this.setGlyphs(t));break}case"setFontFaces":{let[t]=a.args;i.push(()=>this.setFontFaces(t));break}case"setSprite":{let[t]=a.args;i.push(()=>this.setSprite(t));break}case"setTerrain":{let[t]=a.args;i.push(()=>this.map.setTerrain(t));break}case"setSky":{let[t]=a.args;i.push(()=>this.setSky(t));break}case"setProjection":{let[t]=a.args;i.push(()=>this.setProjection(t));break}case"setGlobalState":{let[t]=a.args;i.push(()=>this.setGlobalState(t));break}case"setTransition":i.push(()=>{});break;default:r.push(a.command)}return{operations:i,unimplemented:r}}addImage(t,i){this.getImage(t)?this.fire(new P.gn(Error(`An image named "${t}" already exists.`))):(this.imageManager.addImage(t,i),this._afterImageUpdated(t))}updateImage(t,i){this.imageManager.updateImage(t,i)}getImage(t){return this.imageManager.getImage(t)}setMissingImageResolver(t){this.imageManager.setMissingImageResolver(t)}removeImage(t){this.getImage(t)?(this.imageManager.removeImage(t),this._afterImageUpdated(t)):this.fire(new P.gn(Error(`An image named "${t}" does not exist.`)))}_markImagesChanged(t){for(let i of t)this._changedImages[i]=!0}_afterImageUpdated(t){this._changedImages[t]=!0,this._imagesListDirty=!0,this._changed=!0,this.fire(new j("data"))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(t,i,r={}){if(this._checkLoaded(),void 0!==this.tileManagers[t])throw Error(`Source "${t}" already exists.`);if(!i.type)throw Error(`The type property must be defined, but only the following properties were given: ${Ob
812ject.keys(i).join(", ")}.`);if(P.rn.has(i.type)&&this._validate(P.on.source,`sources.${t}`,i,null,r))return;this.map?._collectResourceTiming&&(i.collectResourceTiming=!0);let a=this.tileManagers[t]=new tl(t,i,this.dispatcher);a.style=this,a.setEventedParent(this,()=>({isSourceLoaded:a.loaded(),source:a.serialize(),sourceId:t})),a.onAdd(this.map),this._changed=!0}removeSource(t){if(this._checkLoaded(),void 0===this.tileManagers[t])throw Error(`There is no source with this ID=${t}`);for(let i in this._layers)if(this._layers[i].source===t)return this.fire(new P.gn(Error(`Source "${t}" cannot be removed while layer "${i}" is using it.`)));let i=this.tileManagers[t];delete this.tileManagers[t],delete this._updatedSources[t],i.fire(new N("data",{sourceDataType:"metadata",sourceId:t})),i.setEventedParent(null),i.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(t,i){if(this._checkLoaded(),void 0===this.tileManagers[t])throw Error(`There is no source with this ID=${t}`);let r=this.tileManagers[t].getSource();if("geojson"!==r.type)throw Error(`geojsonSource.type is ${r.type}, which is !== 'geojson`);r.setData(i),this._changed=!0}getSource(t){return this.tileManagers[t]?.getSource()}addLayer(t,i,r={}){let a;this._checkLoaded();let o=t.id;if(this.getLayer(o))return void this.fire(new P.gn(Error(`Layer "${o}" already exists on this map.`)));if("custom"===t.type){if((0,P.in)(this,(0,P.y)(t)))return;a=(0,P._)(t,this._globalState)}else{if("source"in t&&"object"==typeof t.source&&(this.addSource(o,t.source),t=(0,P.Vn)(t),t=(0,P.er)(t,{source:o})),this._validate(P.on.layer,`layers.${o}`,t,{arrayIndex:-1},r))return;a=(0,P._)(t,this._globalState),this._validateLayer(a),a.setEventedParent(this,{layer:{id:o}})}let s=i?this._order.indexOf(i):this._order.length;if(i&&-1===s)return void this.fire(new P.gn(Error(`Cannot add layer "${o}" before non-existing layer "${i}".`)));if(this._order.splice(s,0,o),this._layerOrderChanged=!0,this._layers[o]=a,this._removedLayers[o]&&a.source&&"custom"!==a.type){let t=this._removedLayers[o];delete this._removedLayers[o],t.type===a.type?(this._updatedSources[a.source]="reload",this.tileManagers[a.source].pause()):this._updatedSources[a.source]="clear"}this._updateLayer(a),a.onAdd&&a.onAdd(this.map)}moveLayer(t,i){if(this._checkLoaded(),this._changed=!0,!this._layers[t])return void this.fire(new P.gn(Error(`The layer '${t}' does not exist in the map's style and cannot be moved.`)));if(t===i)return;if(i&&!this._order.includes(i))return void this.fire(new P.gn(Error(`Cannot move layer "${t}" before non-existing layer "${i}".`)));let r=this._order.indexOf(t);this._order.splice(r,1);let a=i?this._order.indexOf(i):this._order.length;this._order.splice(a,0,t),this._layerOrderChanged=!0}removeLayer(t){this._checkLoaded();let i=this._layers[t];if(!i)return void this.fire(new P.gn(Error(`Cannot remove non-existing layer "${t}".`)));i.setEventedParent(null);let r=this._order.indexOf(t);this._order.splice(r,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[t]=i,delete this._layers[t],this._serializedLayers&&delete this._serializedLayers[t],delete this._updatedLayers[t],delete this._updatedPaintProps[t],"symbol"===i.type&&i.source&&this.tileManagers[i.source]?.resetMaxContentElevation(),i.onRemove&&i.onRemove(this.map)}getLayer(t){return this._layers[t]}getLayersOrder(){return[...this._order]}hasLayer(t){return t in this._layers}setLayerZoomRange(t,i,r){this._checkLoaded();let a=this.getLayer(t);a?(a.minzoom!==i||a.maxzoom!==r)&&(null!=i&&(a.minzoom=i),null!=r&&(a.maxzoom=r),this._updateLayer(a)):this.fire(new P.gn(Error(`Cannot set the zoom range of non-existing layer "${t}".`)))}setFilter(t,i,r={}){this._checkLoaded();let a=this.getLayer(t);if(!a)return void this.fire(new P.gn(Error(`Cannot filter non-existing layer "${t}".`)));if(!(0,P.qn)(a.filter,i)){if(null==i){a.setFilter(void 0),this._updateLayer(a);return}
812this._validate(P.on.filter,`layers.${a.id}.filter`,i,null,r)||(a.setFilter((0,P.Vn)(i)),this._updateLayer(a))}}getFilter(t){return(0,P.Vn)(this.getLayer(t).filter)}setLayoutProperty(t,i,r,a={}){this._checkLoaded();let o=this.getLayer(t);o?(0,P.qn)(o.getLayoutProperty(i),r)||(o.setLayoutProperty(i,r,a),this._updateLayer(o)):this.fire(new P.gn(Error(`Cannot style non-existing layer "${t}".`)))}getLayoutProperty(t,i){let r=this.getLayer(t);return r?r.getLayoutProperty(i):void this.fire(new P.gn(Error(`Cannot get style of non-existing layer "${t}".`)))}setPaintProperty(t,i,r,a={}){this._checkLoaded();let o=this.getLayer(t);o?(0,P.qn)(o.getPaintProperty(i),r)||this._updatePaintProperty(o,i,r,a):this.fire(new P.gn(Error(`Cannot style non-existing layer "${t}".`)))}_updatePaintProperty(t,i,r,a={}){t.setPaintProperty(i,r,a)&&this._updateLayer(t),(0,P.Xt)(t)&&"raster-fade-duration"===i&&this.tileManagers[t.source].setRasterFadeDuration(r),this._changed=!0,this._updatedPaintProps[t.id]=!0,"symbol"===t.type&&this.triggerSymbolPlacement(),this._serializedLayers=null}getPaintProperty(t,i){return this.getLayer(t).getPaintProperty(i)}setFeatureState(t,i){this._checkLoaded();let r=t.source,a=t.sourceLayer,o=this.tileManagers[r];if(void 0===o)return void this.fire(new P.gn(Error(`The source '${r}' does not exist in the map's style.`)));let s=o.getSource().type;if("geojson"===s&&a)return void this.fire(new P.gn(Error("GeoJSON sources cannot have a sourceLayer parameter.")));if("vector"===s&&!a)return void this.fire(new P.gn(Error("The sourceLayer parameter must be provided for vector source types.")));if(void 0===t.id)return void this.fire(new P.gn(Error("The feature id parameter must be provided.")));let n=["__proto__","constructor","prototype"];i&&Object.keys(i).some(t=>n.includes(t))?this.fire(new P.gn(Error(`The feature state should not include one of the following keys: ${n}`))):o.setFeatureState(a,t.id,i)}removeFeatureState(t,i){this._checkLoaded();let r=t.source,a=this.tileManagers[r];if(void 0===a)return void this.fire(new P.gn(Error(`The source '${r}' does not exist in the map's style.`)));let o=a.getSource().type,s="vector"===o?t.sourceLayer:void 0;"vector"!==o||s?i&&"string"!=typeof t.id&&"number"!=typeof t.id?this.fire(new P.gn(Error("A feature id is required to remove its specific state property."))):a.removeFeatureState(s,t.id,i):this.fire(new P.gn(Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(t){this._checkLoaded();let i=t.source,r=t.sourceLayer,a=this.tileManagers[i];return void 0===a?void this.fire(new P.gn(Error(`The source '${i}' does not exist in the map's style.`))):"vector"!==a.getSource().type||r?(void 0===t.id&&this.fire(new P.gn(Error("The feature id parameter must be provided."))),a.getFeatureState(r,t.id)):void this.fire(new P.gn(Error("The sourceLayer parameter must be provided for vector source types.")))}getTransition(){return(0,P.er)({duration:300,delay:0},this.stylesheet?.transition)}serialize(){if(!this._loaded)return;let t=(0,P.hr)(this.tileManagers,t=>t.serialize()),i=this._serializeByIds(this._order,!0),r=this.map.getTerrain()||void 0,a=this.stylesheet;return(0,P.tr)({version:a.version,name:a.name,metadata:a.metadata,light:a.light,sky:a.sky,center:a.center,zoom:a.zoom,bearing:a.bearing,pitch:a.pitch,sprite:a.sprite,glyphs:a.glyphs,"font-faces":a["font-faces"],transition:a.transition,projection:a.projection,state:a.state,sources:t,layers:i,terrain:r},t=>void 0!==t)}_updateLayer(t){this._updatedLayers[t.id]=!0,t.source&&!this._updatedSources[t.source]&&"raster"!==this.tileManagers[t.source].getSource().type&&(this._updatedSources[t.source]="reload",this.tileManagers[t.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(t){let i=t=>"fill-extrusion"===this._layers[t].type,r={},a=[];for(let o=this._order.length-1;o>=0;o--){let s=this._order[o];if(i(s))for(let i of(r[s]=o,t)){let t=i[s];if(t)for(let i of t)a.push(i)}}a.sort((t,i)=>i.intersectionZ-t.intersectionZ);let o=[];for(let s=this._order.length-1;s>=0;s--){let n=this._order[s];if(i(n))for(let t=a.length-1;t>=0;t--){let i=a[t].feature;if(r[i.layer.id]<s)break;o.push(i),a.pop()}else for(let i of t){let t=i[n];if(t)for(let i of t)o.push(i.feature)}}return o}
812queryRenderedFeatures(t,i,r){i?.filter&&this._validate(P.on.filter,"queryRenderedFeatures.filter",i.filter,null,i);let a={};if(i?.layers){if(!(Array.isArray(i.layers)||i.layers instanceof Set))return this.fire(new P.gn(Error("parameters.layers must be an Array or a Set of strings"))),[];for(let t of i.layers){let i=this._layers[t];if(!i)return this.fire(new P.gn(Error(`The layer '${t}' does not exist in the map's style and cannot be queried for features.`))),[];a[i.source]=!0}}let o=[];i.availableImages=this.imageManager.listImages();let s=this._serializedAllLayers(),n=i.layers instanceof Set?i.layers:Array.isArray(i.layers)?new Set(i.layers):null,l={...i,layers:n,globalState:this._globalState};for(let n in this.tileManagers)(!i.layers||a[n])&&o.push(function(t,i,r,a,o,s,n){let l=function(t,i,r){if(t)for(let a of t){let t=i[a];if(t?.source===r&&"fill-extrusion"===t.type)return!0}else for(let t in i){let a=i[t];if(a.source===r&&"fill-extrusion"===a.type)return!0}return!1}(o?.layers??null,i,t.id),h=s.maxPitchScaleFactor(),c=t.tilesIn(a,h,l);c.sort(ez);let u=[];for(let a of c)u.push({wrappedTileID:a.tileID.wrapped().key,queryResults:a.tile.queryRenderedFeatures(i,r,t.getState(),a.queryGeometry,a.cameraQueryGeometry,a.scale,o,s,h,function(t,i){let r=(0,P.vi)();return(0,P.ji)(r,r,[1,1,0]),(0,P.Ai)(r,r,[.5*t.width,.5*t.height,1]),t.calculatePosMatrix?(0,P.wi)(r,r,t.calculatePosMatrix(i.toUnwrapped())):r}(s,a.tileID),n?(t,i)=>n(a.tileID,t,i):void 0)});var d=function(t){let i={},r={};for(let{queryResults:a,wrappedTileID:o}of t){r[o]||={};let t=r[o];for(let r in a){let o=a[r];t[r]||={};let s=t[r];for(let t of(i[r]||=[],o))s[t.featureIndex]||(s[t.featureIndex]=!0,i[r].push(t))}}return i}(u),_=t;for(let t in d)for(let i of d[t])eR(i,_);return d}(this.tileManagers[n],this._layers,s,t,l,r,this.map.terrain?(t,i,r)=>this.map.terrain.getElevation(t,i,r):void 0));return this.placement&&o.push(function(t,i,r,a,o,s,n){let l={},h=s.queryRenderedSymbols(a),c=[];for(let t of Object.keys(h).map(Number))c.push(n[t]);for(let r of(c.sort(ez),c)){let a=r.featureIndex.lookupSymbolFeatures(h[r.bucketInstanceId],i,r.bucketIndex,r.sourceLayerIndex,{filterSpec:o.filter,globalState:o.globalState},o.layers,o.availableImages,t);for(let t in a){l[t]||=[];let i=a[t];for(let a of(i.sort((t,i)=>{let a=r.featureSortOrder;if(a){let r=a.indexOf(t.featureIndex);return a.indexOf(i.featureIndex)-r}return i.featureIndex-t.featureIndex}),i))l[t].push(a)}}var u=l,d=t,_=r;for(let t in u)for(let i of u[t])eR(i,_[d[t].source]);return u}(this._layers,s,this.tileManagers,t,l,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(o)}querySourceFeatures(t,i){i?.filter&&this._validate(P.on.filter,"querySourceFeatures.filter",i.filter,null,i);let r=this.tileManagers[t];return r?function(t,i){let r=t.getRenderableIds().map(i=>t.getTileByID(i)),a=[],o={};for(let t of r){let r=t.tileID.canonical.key;o[r]||(o[r]=!0,t.querySourceFeatures(a,i))}return a}(r,i?{...i,globalState:this._globalState}:{globalState:this._globalState}):[]}getLight(){return this.light.getLight()}setLight(t,i={}){this._checkLoaded();let r=this.light.getLight(),a=!1;for(let i in t)if(!(0,P.qn)(t[i],r[i])){a=!0;break}if(!a)return;let o={now:S(),transition:(0,P.er)({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(t,i),this.light.updateTransitions(o)}getProjection(){return this.stylesheet?.projection}setProjection(t){this._checkLoaded();let i=t??{type:"mercator"};if(this.stylesheet.projection=t,this.projection){if(this.projection.name===i.type)return;this.projection.destroy(),delete this.projection}this._setProjectionInternal(i.type)}getSky(){return this.stylesheet?.sky}setSky(t,i={}){this._checkLoaded();let r=this.getSky(),a=!1;if(!t&&!r)return;if(t&&!r)a=!0;else if(!t&&r)a=!0;else for(let i in t)if(!(0,P.qn)(t[i],r[i])){a=!0;break}if(!a)return;let o={now:S(),transition:(0,P.er)({duration:300,delay:0},this.stylesheet.transition)};this.sky.setSky(t,i)&&(this.stylesheet.sky=t,this.sky.updateTransitions(o))}_setProjectionInternal(t){let i=function(t,i,r){let a={constrainOverride:i};if(Array.isArray(t)){let i=new iC({type:t},r);return{projection:i,transform:new iJ(a),cameraHelper:new i0(i)}}switch(t){case"mercator":return{projection:new ie,transform:new im(a),cameraHelper:new iT};case"globe":{let t=new iC({type:["interpolate",["linear"],["zoom"],11,"vertical-perspective",12,"mercator"]},{});return{projection:t,transform:new iJ(a),cameraHelper:new i0(t)}}case"vertical-perspective":return{projection:new iM,transform:new i$(a),cameraHelper:new iQ};default:return(0,P.Nr)(`Unknown projection name: ${t}. Falling back to mercator projection.`),{projection:new ie,transform:new im(a),cameraHelper:new iT}}}(t,this.map._camera?.transform.constrainOverride,this._globalState);for(let t in this.projection=i.projection,this.map.migrateProjection(i.transform,i.cameraHelper),this.tileManagers)this.tileManagers[t].reload()}_validate(t,i,r,a,o={}
vendor: 4,472 bytes, line 812
812){return!1!==o.validate&&(0,P.an)(this,t,{key:i,style:this.serialize(),value:r,...a},o)}_remove(t=!0){for(let t in this._frameRequest&&=(this._frameRequest.abort(),null),this._loadStyleRequest&&=(this._loadStyleRequest.abort(),null),this._spriteRequest&&=(this._spriteRequest.abort(),null),e4().off(e0,this._rtlPluginLoaded),this._layers)this._layers[t].setEventedParent(null);for(let t in this.tileManagers){let i=this.tileManagers[t];i.setEventedParent(null),i.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),t&&this.dispatcher.broadcast("RM",void 0),this.dispatcher.remove(t)}_clearSource(t){this.tileManagers[t].clearTiles()}_reloadSource(t){this.tileManagers[t].resume(),this.tileManagers[t].reload()}_updateSources(t){for(let i in this.tileManagers)this.tileManagers[i].update(t,this.map.terrain)}_generateCollisionBoxes(){for(let t in this.tileManagers)this._reloadSource(t)}triggerSymbolPlacement(){this._symbolPlacementTriggered=!0}_placementInputsChanged(t,i,r){let a=this.pauseablePlacement;return!a||this._symbolPlacementTriggered||this._placedProjectionTransition!==this.projection?.transitionState||a._showCollisionBoxes!==i||a.placement.collisionGroups.crossSourceCollisions!==r||a.placement.transform.renderWorldCopies!==t.renderWorldCopies||!(0,P.bi)(a.placement.transform.modelViewProjectionMatrix,t.modelViewProjectionMatrix)}_updatePlacement(t,i,r,a,o=!1){let s=!1,n=!1,l={};for(let i of this._order){let r=this._layers[i];if("symbol"!==r.type)continue;if(!l[r.source]){let t=this.tileManagers[r.source];l[r.source]=t.getRenderableIds(!0).map(i=>t.getTileByID(i)).sort((t,i)=>i.tileID.overscaledZ-t.tileID.overscaledZ||(t.tileID.isLessThan(i.tileID)?-1:1))}let a=this.crossTileSymbolIndex.addLayer(r,l[r.source],t.center.lng);s||=a}this.crossTileSymbolIndex.pruneUnusedLayers(this._order),o||=this._layerOrderChanged||0===r;let h=s||this._placementInputsChanged(t,i,a),c=this.pauseablePlacement?.isDone()&&!this.placement.stillRecent(S(),t.zoom);if((o||!this.pauseablePlacement||c&&(h||this.placement.stale))&&(this._symbolPlacementTriggered=!1,this._placedProjectionTransition=this.projection?.transitionState,this.pauseablePlacement=new tG(t,this.map.terrain,this._order,o,i,r,a,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?h&&this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,l),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(S()),n=!0),s&&this.pauseablePlacement.placement.setStale()),n||s)for(let t of this._order){let i=this._layers[t];"symbol"===i.type&&this.placement.updateLayerOpacities(i,l[i.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(S())}_releaseSymbolFadeTiles(){for(let t in this.tileManagers)this.tileManagers[t].releaseSymbolFadeTiles()}async getImages(t,i){let r=await this.imageManager.getImages(i.icons);this._updateTilesForChangedImages();let a=this.tileManagers[i.source];return a&&a.setDependencies(i.tileID.key,i.type,i.icons),r}async getGlyphs(t,i){let r=await this.glyphManager.getGlyphs(i.stacks),a=this.tileManagers[i.source];return a&&a.setDependencies(i.tileID.key,i.type,[""]),r}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(t,i={}){this._checkLoaded(),t&&this._validate(P.on.glyphs,"glyphs",t,null,i)||(this._changed=!0,this._glyphsDidChange=!0,this.stylesheet.glyphs=t,this.glyphManager.entries={},this.glyphManager.setURL(t))}getFontFaces(){return this.stylesheet["font-faces"]||null}setFontFaces(t){this._checkLoaded(),this._changed=!0,this._glyphsDidChange=!0,this.stylesheet["font-faces"]=t,this.glyphManager.setFontFaces(t)}async getDashes(t,i){let r={};for(let[t,a]of Object.entries(i.dashes))r[t]=this.lineAtlas.getDash(a.dasharray,a.round);return r}addSprite(t,i,r={},a){this._checkLoaded();let o=[{id:t,url:i}],s=[...ea(this.stylesheet.sprite),...o];this._validate(P.on.sprite,"sprite",s,null,r)||(this.stylesheet.sprite=s,this._loadSprite(o,!0,a))}removeSprite(t){this._checkLoaded();let i=ea(this.stylesheet.sprite);if(!i.find(i=>i.id===t))return void this.fire(new P.gn(Error(`Sprite "${t}" doesn't exists on this map.`)));let r=this.imageManager.removeSpriteImages(t);this._markImagesChanged(r),i.splice(i.findIndex(i=>i.id===t),1),this.stylesheet.sprite=i.length>0?i:void 0,this._imagesListDirty=!0,this._changed=!0,this.fire(new j("data"))}getSprite(){return ea(this.stylesheet.sprite)}setSprite(t,i={}
812,r){this._checkLoaded(),!(t&&this._validate(P.on.sprite,"sprite",t,null,i))&&(this.stylesheet.sprite=t,t?this._loadSprite(t,!0,r):(this._unloadSprite(),r&&r(null)))}destroy(){for(let t in this._frameRequest&&=(this._frameRequest.abort(),null),this._loadStyleRequest&&=(this._loadStyleRequest.abort(),null),this._spriteRequest&&=(this._spriteRequest.abort(),null),this.tileManagers){let i=this.tileManagers[t];i.setEventedParent(null),i.onRemove(this.map)}for(let t in this.tileManagers={},this.imageManager&&(this.imageManager.setEventedParent(null),this.imageManager.destroy(),this.patternAtlas.destroy()),this.glyphManager&&this.glyphManager.destroy(),this._layers){let i=this._layers[t];i.setEventedParent(null),i.onRemove&&i.onRemove(this.map)}this._setInitialValues(),this.setEventedParent(null),this.dispatcher.unregisterMessageHandler("GG"),this.dispatcher.unregisterMessageHandler("GI"),this.dispatcher.unregisterMessageHandler("GDA"),this.dispatcher.remove(!0),this._listeners={},this._oneTimeListeners={}}};let i4=(0,P.Yt)([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);var i3=class{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(t,i,r,a,o,s,n,l,h){this.context=t;let c=this.boundPaintVertexBuffers.length!==a.length;for(let t=0;!c&&t<a.length;t++)this.boundPaintVertexBuffers[t]!==a[t]&&(c=!0);!this.vao||this.boundProgram!==i||this.boundLayoutVertexBuffer!==r||c||this.boundIndexBuffer!==o||this.boundVertexOffset!==s||this.boundDynamicVertexBuffer!==n||this.boundDynamicVertexBuffer2!==l||this.boundDynamicVertexBuffer3!==h?this.freshBind(i,r,a,o,s,n,l,h):t.bindVertexArray.set(this.vao)}freshBind(t,i,r,a,o,s,n,l){let h=t.numAttributes,c=this.context,u=c.gl;for(let h of(this.vao&&this.destroy(),this.vao=c.createVertexArray(),c.bindVertexArray.set(this.vao),this.boundProgram=t,this.boundLayoutVertexBuffer=i,this.boundPaintVertexBuffers=r,this.boundIndexBuffer=a,this.boundVertexOffset=o,this.boundDynamicVertexBuffer=s,this.boundDynamicVertexBuffer2=n,this.boundDynamicVertexBuffer3=l,i.enableAttributes(u,t),r))h.enableAttributes(u,t);for(let a of(s&&s.enableAttributes(u,t),n&&n.enableAttributes(u,t),l&&l.enableAttributes(u,t),i.bind(),i.setVertexAttribPointers(u,t,o),r))a.bind(),a.setVertexAttribPointers(u,t,o);s&&(s.bind(),s.setVertexAttribPointers(u,t,o)),a&&a.bind(),n&&(n.bind(),n.setVertexAttribPointers(u,t,o)),l&&(l.bind(),l.setVertexAttribPointers(u,t,o)),c.currentNumAttributes=h}destroy(){this.vao&&=(this.context.deleteVertexArray(this.vao),null)}};let i5=(t,i,r,a,o)=>({u_texture:0,u_ele_delta:t,u_fog_matrix:i,u_fog_color:r?r.properties.get("fog-color"):P.fn.white,u_fog_ground_blend:r?r.properties.get("fog-ground-blend"):1,u_fog_ground_blend_opacity:o?0:r?r.calculateFogBlendOpacity(a):0,u_horizon_color:r?r.properties.get("horizon-color"):P.fn.white,u_horizon_fog_blend:r?r.properties.get("horizon-fog-blend"):1,u_is_globe_mode:+!!o}),i6=t=>({u_ele_delta:t}),i8={ProjectionUBO:0,TerrainUBO:1,FrameUBO:2},i9={float:[1,1],int:[1,1],vec2:[2,2],vec4:[4,4],mat4:[16,4]};function i7(t){let i={},r=0;for(let{name:a,type:o}of t){let[t,s]=i9[o];r=Math.ceil(r/s)*s,i[a]=r,r+=t}return{offsets:i,contentWords:r,sizeWords:4*Math.ceil(r/4)}}var re=class{constructor(t,i,r){this.context=t,this.binding=i,this.contentWords=r.contentWords;let a=t.gl;this.buffer=a.createBuffer(),a.bindBuffer(a.UNIFORM_BUFFER,this.buffer),a.bufferData(a.UNIFORM_BUFFER,4*r.sizeWords,a.DYNAMIC_DRAW),a.bindBufferBase(a.UNIFORM_BUFFER,i,this.buffer),this.uploaded=new Float32Array(r.sizeWords),this.pending=new Float32Array(r.sizeWords),this.uploadedWords=new Uint32Array(this.uploaded.buffer),this.pendingWords=new Uint32Array(this.pending.buffer),this.hasData=!1,this.bindingDirty=!1}upload(){let t=this.context.gl,i=!this.hasData;if(!i){let t=this.pendingWords,r=this.uploadedWords;for(let a=0;a<this.contentWords;a++)if(t[a]!==r[a]){i=!0;break}}this.bind(),i&&(t.bindBufferBase(t.UNIFORM_BUFFER,this.binding,this.buffer),t.bufferData(t.UNIFORM_BUFFER,this.pending,t.DYNAMIC_DRAW),this.uploaded.set(this.pending),this.hasData=!0)}bind(){if(!this.bindingDirty)return;let t=this.context.gl;t.bindBufferBase(t.UNIFORM_BUFFER,this.binding,this.buffer),this.bindingDirty=!1}destroy(){let t=this.context.gl;this.buffer&&(t.deleteBuffer(this.buffer),delete this.buffer)}};let rt=i7([{name:"u_projection_matrix",type:"mat4"},{name:"u_projection_fallback_matrix",type:"mat4"},{name:"u_projection_tile_mercator_coords",type:"vec4"},{name:"u_projection_clipping_plane",type:"vec4"},{name:"u_projection_transition",type:"float"},{name:"u_projection_clip_antimeridian",type:"int"}]),ri=rt.offsets,rr=i7([{name:"u_terrain_matrix",type:"mat4"},{name:"u_terrain_unpack",type:"vec4"},{name:"u_terrain_dim",type:"float"},{name:"u_terrain_exaggeration",type:"float"}]),ra=rr.offsets;function ro(t){let i=[];for(let r of t){if(null===r)continue;let t=r.split(" ");i.push(t.pop())}return i}
812var rs=class{constructor(t,i,r,a,o,s,n,l,h=[]){let c=t.gl;this.program=c.createProgram();let u=ro(i.staticAttributes),d=r?r.getBinderAttributes():[],_=u.concat(d),p=t6.prelude.staticUniforms?ro(t6.prelude.staticUniforms):[],m=i.staticUniforms?ro(i.staticUniforms):[],f=r?r.getBinderUniforms():[],g=p.concat(m).concat(f),v=[];for(let t of g)v.includes(t)||v.push(t);let y=r?r.defines():[];y.unshift("#version 300 es"),o&&y.push("#define OVERDRAW_INSPECTOR;"),s&&y.push("#define TERRAIN3D;"),l&&y.push(l),h&&y.push(...h);let x=y.concat(t6.prelude.fragmentSource,n.fragmentSource,i.fragmentSource).join(` 813`),b=y.concat(t6.prelude.vertexSource,n.vertexSource,i.vertexSource).join(` 814`),w=c.createShader(c.FRAGMENT_SHADER);if(c.isContextLost()){this.failedToCreate=!0;return}c.shaderSource(w,x),c.compileShader(w),c.attachShader(this.program,w);let T=c.createShader(c.VERTEX_SHADER);if(c.isContextLost()){this.failedToCreate=!0;return}c.shaderSource(T,b),c.compileShader(T),c.attachShader(this.program,T),this.attributes={};let M={};if(this.numAttributes=_.length,c.linkProgram(this.program),!c.getProgramParameter(this.program,c.LINK_STATUS)){if(c.isContextLost()){this.failedToCreate=!0;return}throw c.getShaderParameter(w,c.COMPILE_STATUS)?c.getShaderParameter(T,c.COMPILE_STATUS)?Error(`Program failed to link: ${c.getProgramInfoLog(this.program)}`):Error(`Could not compile vertex shader: ${c.getShaderInfoLog(T)}`):Error(`Could not compile fragment shader: ${c.getShaderInfoLog(w)}`)}!function(t,i){for(let[r,a]of Object.entries(i8)){let o=t.getUniformBlockIndex(i,r);o!==t.INVALID_INDEX&&t.uniformBlockBinding(i,o,a)}}(c,this.program);let C=function(t,i){let r=new Set([t.INT,t.INT_VEC2,t.INT_VEC3,t.INT_VEC4,t.UNSIGNED_INT,t.UNSIGNED_INT_VEC2,t.UNSIGNED_INT_VEC3,t.UNSIGNED_INT_VEC4]),a=new Set,o=t.getProgramParameter(i,t.ACTIVE_ATTRIBUTES);for(let s=0;s<o;s++){let o=t.getActiveAttrib(i,s);o&&r.has(o.type)&&a.add(o.name)}return a}(c,this.program);for(let t of _){if(!t)continue;let i=c.getAttribLocation(this.program,t);i>=0&&(this.attributes[t]={location:i,isInteger:C.has(t)})}for(let t of(c.deleteShader(T),c.deleteShader(w),v))if(t&&!M[t]){let i=c.getUniformLocation(this.program,t);i&&(M[t]=i)}this.fixedUniforms=a(t,M),this.terrainUniforms=((t,i)=>({u_depth:new P.Mt(t,i.u_depth),u_terrain:new P.Mt(t,i.u_terrain)}))(t,M),this.binderUniforms=r?r.getUniforms(t,M):[]}draw(t,i,r,a,o,s,n,l,h,c,u,d,_,p,m,f,g,v,y){var x,b;let w,T=t.gl;if(this.failedToCreate)return;if(t.program.set(this.program),t.projectionUniformBuffer.bind(),t.terrainUniformBuffer.bind(),t.frameUniformBuffer.bind(),t.setDepthMode(r),t.setStencilMode(a),t.setColorMode(o),t.setCullFace(s),l){let i;for(let i in t.activeTexture.set(T.TEXTURE2),T.bindTexture(T.TEXTURE_2D,l.depthTexture),t.activeTexture.set(T.TEXTURE3),T.bindTexture(T.TEXTURE_2D,l.texture),this.terrainUniforms)this.terrainUniforms[i].set(l[i]);x=t.terrainUniformBuffer,(i=x.pending).set(l.u_terrain_matrix,ra.u_terrain_matrix),i.set(l.u_terrain_unpack,ra.u_terrain_unpack),i[ra.u_terrain_dim]=l.u_terrain_dim,i[ra.u_terrain_exaggeration]=l.u_terrain_exaggeration,x.upload()}if(h&&(b=t.projectionUniformBuffer,(w=b.pending).set(h.mainMatrix,ri.u_projection_matrix),w.set(h.fallbackMatrix,ri.u_projection_fallback_matrix),w.set(h.tileMercatorCoords,ri.u_projection_tile_mercator_coords),w.set(h.clippingPlane,ri.u_projection_clipping_plane),w[ri.u_projection_transition]=h.projectionTransition,b.pendingWords[ri.u_projection_clip_antimeridian]=+!!h.clipAntimeridian,b.upload()),n)for(let t in this.fixedUniforms)this.fixedUniforms[t].set(n[t]);f&&f.setUniforms(t,this.binderUniforms,p,{zoom:m});let P=0;switch(i){case T.LINES:P=2;break;case T.TRIANGLES:P=3;break;case T.LINE_STRIP:P=1}for(let r of _.get())r.vaos||={},r.vaos[c]||=new i3,r.vaos[c].bind(t,this,u,f?f.getPaintVertexBuffers():[],d,r.vertexOffset,g,v,y),T.drawElements(i,r.primitiveLength*P,T.UNSIGNED_SHORT,r.primitiveOffset*P*2)}};function rn(t,i,r){let a=1/(0,P.Ir)(r,1,i.transform.tileZoom),o=2**r.tileID.overscaledZ,s=r.tileSize*2**i.transform.tileZoom/o,n=s*(r.tileID.canonical.x+r.tileID.wrap*o),l=s*r.tileID.canonical.y;return{u_image:0,u_texsize:r.imageAtlasTexture.size,u_scale:[a,t.fromScale,t.toScale],u_fade:t.t,u_pixel_coord_upper:[n>>16,l>>16],u_pixel_coord_lower:[65535&n,65535&l]}}let rl=(t,i,r,a)=>{let o=t.style.light,s=o.getCartesianPosition(),n=(0,P.Mi)();
814"viewport"===o.properties.get("anchor")&&(0,P.Ni)(n,t.transform.bearingInRadians),(0,P.fi)(s,s,n);let l=t.transform.transformLightDirection(s),h=o.properties.get("color");return{u_lightpos:s,u_lightpos_globe:l,u_lightintensity:o.properties.get("intensity"),u_lightcolor:[h.r,h.g,h.b],u_vertical_gradient:+i,u_opacity:r,u_fill_translate:a}},rh=(t,i,r,a,o,s,n)=>(0,P.er)(rl(t,i,r,a),rn(s,t,n),{u_height_factor:-(2**o.overscaledZ)/n.tileSize/8}),rc=(t,i,r,a,o)=>(0,P.er)(rn(i,t,r),{u_fill_translate:a,u_sdf_pattern:+!!o}),ru=t=>({u_fill_translate:t}),rd=t=>({u_fill_translate:t}),r_=(t,i,r,a,o)=>rc(t,i,r,a,o),rp=(t,i,r,a,o)=>{let s=t.transform,n,l,h=0;if("map"===r.paint.get("circle-pitch-alignment")){let t=(0,P.Ir)(i,1,s.zoom);n=!0,l=[t,t],h=t/(P.Lr*2**i.tileID.overscaledZ)*2*Math.PI*o}else n=!1,l=s.pixelsToGLUnits;return{u_scale_with_map:+("map"===r.paint.get("circle-pitch-scale")),u_pitch_with_map:+n,u_extrude_scale:l,u_globe_extrude_scale:h,u_translate:a}},rm=(t,i=1)=>({u_color:t,u_overlay:0,u_overlay_scale:i}),rf=(t,i,r,a)=>{let o=(0,P.Ir)(t,1,i)/(P.Lr*2**t.tileID.overscaledZ)*2*Math.PI*a;return{u_extrude_scale:(0,P.Ir)(t,1,i),u_intensity:r,u_globe_extrude_scale:o}},rg=(t,i,r,a)=>{let o=(0,P.vi)();return(0,P.Ti)(o,0,t.width,t.height,0,0,1),{u_matrix:o,u_image:r,u_color_ramp:a,u_opacity:i.paint.get("heatmap-opacity")}},rv=(t,i,r)=>{var a;let o,s,n=r.paint.get("hillshade-accent-color"),l;switch(r.paint.get("hillshade-method")){case"basic":l=4;break;case"combined":l=1;break;case"igor":l=2;break;case"multidirectional":l=3;break;default:l=0}let h=r.getIlluminationProperties();for(let i=0;i<h.directionRadians.length;i++)"viewport"===r.paint.get("hillshade-illumination-anchor")&&(h.directionRadians[i]+=t.transform.bearingInRadians);return{u_image:0,u_latrange:(a=i.tileID,o=2**a.canonical.z,s=a.canonical.y,[new P.nt(0,s/o).toLngLat().lat,new P.nt(0,(s+1)/o).toLngLat().lat]),u_exaggeration:r.paint.get("hillshade-exaggeration"),u_altitudes:h.altitudeRadians,u_azimuths:h.directionRadians,u_accent:n,u_method:l,u_highlights:h.highlightColor,u_shadows:h.shadowColor}},ry=(t,i)=>{let r=i.stride,a=(0,P.vi)();return(0,P.Ti)(a,0,P.Lr,-P.Lr,0,0,1),(0,P.ji)(a,a,[0,-P.Lr,0]),{u_matrix:a,u_image:1,u_dimension:[r,r],u_zoom:t.overscaledZ,u_unpack:i.getUnpackVector()}},rx=(t,i,r=0)=>({u_image:0,u_unpack:i.getUnpackVector(),u_dimension:[i.stride,i.stride],u_elevation_stops:1,u_color_stops:4,u_color_ramp_size:r,u_opacity:t.paint.get("color-relief-opacity")}),rb=(t,i,r,a)=>{let o=t.transform;return{u_translation:rI(t,i,r),u_ratio:a/(0,P.Ir)(i,1,o.zoom)}},rw=(t,i,r,a,o)=>(0,P.er)(rb(t,i,r,a),{u_image:0,u_image_height:o}),rT=(t,i,r,a,o)=>{let s=t.transform,n=rC(i,s);return{u_translation:rI(t,i,r),u_texsize:i.imageAtlasTexture.size,u_ratio:a/(0,P.Ir)(i,1,s.zoom),u_image:0,u_scale:[n,o.fromScale,o.toScale],u_fade:o.t}},rP=(t,i,r,a,o)=>{let s=rC(i,t.transform);return(0,P.er)(rb(t,i,r,a),{u_tileratio:s,u_crossfade_from:o.fromScale,u_crossfade_to:o.toScale,u_image:0,u_mix:o.t,u_lineatlas_width:t.lineAtlas.width,u_lineatlas_height:t.lineAtlas.height})},rM=(t,i,r,a,o,s)=>{let n=rC(i,t.transform);return(0,P.er)(rb(t,i,r,a),{u_image:0,u_image_height:s,u_tileratio:n,u_crossfade_from:o.fromScale,u_crossfade_to:o.toScale,u_image_dash:1,u_mix:o.t,u_lineatlas_width:t.lineAtlas.width,u_lineatlas_height:t.lineAtlas.height})};function rC(t,i){return 1/(0,P.Ir)(t,1,i.tileZoom)}function rI(t,i,r){return(0,P.jr)(t.transform,i,r.paint.get("line-translate"),r.paint.get("line-translate-anchor"))}let rS=(t,i,r,a,o,s,n,l,h,c,u,d,_,p,m)=>({u_is_size_zoom_constant:+("constant"===t||"source"===t),u_is_size_feature_constant:+("constant"===t||"camera"===t),u_size_t:i?i.uSizeT:0,u_size:i?i.uSize:0,u_rotate_symbol:+r,u_label_plane_matrix:l,u_coord_matrix:h,u_is_text:+u,u_pitch_with_map:+a,u_is_along_line:o,u_is_variable_anchor:s,u_texsize:d,u_texture:0,u_translation:c,u_pitched_scale:_,u_is_offset:p,u_height_anchor_ground:+m}),rE=(t,i,r,a,o,s,n,l,h,c,u,d,_,p,m,f)=>{let g=n.transform;return(0,P.er)(rS(t,i,r,a,o,s,n,l,h,c,u,d,p,m,f),{u_gamma_scale:a?Math.cos(g.pitch*Math.PI/180)*g.cameraToCenterDistance:1,u_is_halo:+!!_,u_is_plain:1})},rz=(t,i,r,a,o,s,n,l,h,c,u,d,_,p,m)=>(0,P.er)(rE(t,i,r,a,o,s,n,l,h,c,!0,u,!0,_,p,m),{u_texsize_icon:d,u_texture_icon:1}),rR=(t,i)=>({u_opacity:t,u_color:i}),rD=(t,i,r,a,o)=>(0,P.er)(function(t,i,r,a){let o=r.patternAtlas.getPattern(t.from.toString()),s=r.patternAtlas.getPattern(t.to.toString()),{width:n,height:l}=r.patternAtlas.getPixelSize(),h=2**a.tileID.overscaledZ,c=a.tileSize*2**r.transform.tileZoom/h,u=c*(a.tileID.canonical.x+a.tileID.wrap*h),d=c*a.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:o.tl,u_pattern_br_a:o.br,u_pattern_tl_b:s.tl,u_pattern_br_b:s.br,u_texsize:[n,l],u_mix:i.t,u_pattern_size_a:o.displaySize,u_pattern_size_b:s.displaySize,u_scale_a:i.fromScale,u_scale_b:i.toScale,u_tile_units_to_pixels:1/(0,P.Ir)(a,1,r.transform.tileZoom),u_pixel_coord_upper:[u>>16,d>>16],u_pixel_coord_lower:[65535&u,65535&d]}}(r,o,i,a),{u_opacity:t}),rL=(t,i)=>({}),rA={fillExtrusion:(t,i)=>({u_lightpos:new P.Pt(t,i.u_lightpos),u_lightpos_globe:new P.Pt(t,i.u_lightpos_globe),u_lightintensity:new P.jt(t,i.u_lightintensity),u_lightcolor:new P.Pt(t,i.u_lightcolor),u_vertical_gradient:new P.jt(t,i.u_vertical_gradient),u_opacity:new P.jt(t,i.u_opacity),u_fill_translate:new P.Nt(t,i.u_fill_translate)}),fillExtrusionPattern:(t,i)=>({u_lightpos:new P.Pt(t,i.u_lightpos),u_lightpos_globe:new P.Pt(t,i.u_lightpos_globe),u_lightintensity:new P.jt(t,i.u_lightintensity),u_lightcolor:new P.Pt(t,i.u_lightcolor),u_vertical_gradient:new P.jt(t,i.u_vertical_gradient),u_height_factor:new P.jt(t,i.u_height_factor),u_opacity:new P.jt(t,i.u_opacity),u_fill_translate:new P.Nt(t,i.u_fill_translate),u_image:new P.Mt(t,i.u_image),u_texsize:new P.Nt(t,i.u_texsize),u_pixel_coord_upper:new P.Nt(t,i.u_pixel_coord_upper),u_pixel_coord_lower:new P.Nt(t,i.u_pixel_coord_lower),u_scale:new P.Pt(t,i.u_scale),u_fade:new P.jt(t,i.u_fade)}),fill:(t,i)=>({u_fill_translate:new P.Nt(t,i.u_fill_translate)}),fillPattern:(t,i)=>({u_image:new P.Mt(t,i.u_image),u_texsize:new P.Nt(t,i.u_texsize),u_pixel_coord_upper:new P.Nt(t,i.u_pixel_coord_upper),u_pixel_coord_lower:new P.Nt(t,i.u_pixel_coord_lower),u_scale:new P.Pt(t,i.u_scale),u_fade:new P.jt(t,i.u_fade),u_sdf_pattern:new P.Mt(t,i.u_sdf_pattern),u_fill_translate:new P.Nt(t,i.u_fill_translate)}),fillOutline:(t,i)=>({u_fill_translate:new P.Nt(t,i.u_fill_translate)}),fillOutlinePattern:(t,i)=>({u_image:new P.Mt(t,i.u_image),u_texsize:new P.Nt(t,i.u_texsize),u_pixel_coord_upper:new P.Nt(t,i.u_pixel_coord_upper),u_pixel_coord_lower:new P.Nt(t,i.u_pixel_coord_lower),u_scale:new P.Pt(t,i.u_scale),u_fade:new P.jt(t,i.u_fade),u_sdf_pattern:new P.Mt(t,i.u_sdf_pattern),u_fill_translate:new P.Nt(t,i.u_fill_translate)}),circle:(t,i)=>({u_scale_with_map:new P.Mt(t,i.u_scale_with_map),u_pitch_with_map:new P.Mt(t,i.u_pitch_with_map),u_extrude_scale:new P.Nt(t,i.u_extrude_scale),u_globe_extrude_scale:new P.jt(t,i.u_globe_extrude_scale),u_translate:new P.Nt(t,i.u_translate)}),collisionBox:rL,collisionCircle:rL,debug:(t,i)=>({u_color:new P.It(t,i.u_color),u_overlay:new P.Mt(t,i.u_overlay),u_overlay_scale:new P.jt(t,i.u_overlay_scale)}),depth:rL,clippingMask:rL,heatmap:(t,i)=>({u_extrude_scale:new P.jt(t,i.u_extrude_scale),u_intensity:new P.jt(t,i.u_intensity),u_globe_extrude_scale:new P.jt(t,i.u_globe_extrude_scale)}),heatmapTexture:(t,i)=>({u_matrix:new P.zt(t,i.u_matrix),u_image:new P.Mt(t,i.u_image),u_color_ramp:new P.Mt(t,i.u_color_ramp),u_opacity:new P.jt(t,i.u_opacity)}),hillshade:(t,i)=>({u_image:new P.Mt(t,i.u_image),u_latrange:new P.Nt(t,i.u_latrange),u_exaggeration:new P.jt(t,i.u_exaggeration),u_altitudes:new P.Rt(t,i.u_altitudes),u_azimuths:new P.Rt(t,i.u_azimuths),u_accent:new P.It(t,i.u_accent),u_method:new P.Mt(t,i.u_method),u_shadows:new P.Lt(t,i.u_shadows),u_highlights:new P.Lt(t,i.u_highlights)}),hillshadePrepare:(t,i)=>({u_matrix:new P.zt(t,i.u_matrix),u_image:new P.Mt(t,i.u_image),u_dimension:new P.Nt(t,i.u_dimension),u_zoom:new P.jt(t,i.u_zoom),u_unpack:new P.Ft(t,i.u_unpack)}),colorRelief:(t,i)=>({u_image:new P.Mt(t,i.u_image),u_unpack:new P.Ft(t,i.u_unpack),u_dimension:new P.Nt(t,i.u_dimension),u_elevation_stops:new P.Mt(t,i.u_elevation_stops),u_color_stops:new P.Mt(t,i.u_color_stops),u_color_ramp_size:new P.Mt(t,i.u_color_ramp_size),u_opacity:new P.jt(t,i.u_opacity)}),line:(t,i)=>({u_translation:new P.Nt(t,i.u_translation),u_ratio:new P.jt(t,i.u_ratio)}),lineGradient:(t,i)=>({u_translation:new P.Nt(t,i.u_translation),u_ratio:new P.jt(t,i.u_ratio),u_image:new P.Mt(t,i.u_image),u_image_height:new P.jt(t,i.u_image_height)}),linePattern:(t,i)=>({u_translation:new P.Nt(t,i.u_translation),u_texsize:new P.Nt(t,i.u_texsize),u_ratio:new P.jt(t,i.u_ratio),u_image:new P.Mt(t,i.u_image),u_scale:new P.Pt(t,i.u_scale),u_fade:new P.jt(t,i.u_fade)}),lineSDF:(t,i)=>({u_translation:new P.Nt(t,i.u_translation),u_ratio:new P.jt(t,i.u_ratio),u_image:new P.Mt(t,i.u_image),u_mix:new P.jt(t,i.u_mix),u_tileratio:new P.jt(t,i.u_tileratio),u_crossfade_from:new P.jt(t,i.u_crossfade_from),u_crossfade_to:new P.jt(t,i.u_crossfade_to),u_lineatlas_width:new P.jt(t,i.u_lineatlas_width),u_lineatlas_height:new P.jt(t,i.u_lineatlas_height)}),lineGradientSDF:(t,i)=>({u_translation:new P.Nt(t,i.u_translation),u_ratio:new P.jt(t,i.u_ratio),u_image:new P.Mt(t,i.u_image),u_image_height:new P.jt(t,i.u_image_height),u_tileratio:new P.jt(t,i.u_tileratio),u_crossfade_from:new P.jt(t,i.u_crossfade_from),u_crossfade_to:new P.jt(t,i.u_crossfade_to),u_image_dash:new P.Mt(t,i.u_image_dash),u_mix:new P.jt(t,i.u_mix),u_lineatlas_width:new P.jt(t,i.u_lineatlas_width),u_lineatlas_height:new P.jt(t,i.u_lineatlas_height)}),layerOpacity:(t,i)=>({u_image:new P.Mt(t,i.u_image),u_opacity:new P.jt(t,i.u_opacity)}),raster:(t,i)=>({u_tl_parent:new P.Nt(t,i.u_tl_parent),u_scale_parent:new P.jt(t,i.u_scale_parent),u_buffer_scale:new P.jt(t,i.u_buffer_scale),u_image_warp:new P.Pt(t,i.u_image_warp),u_fade_t:new P.jt(t,i.u_fade_t),u_opacity:new P.jt(t,i.u_opacity),u_image0:new P.Mt(t,i.u_image0),u_image1:new P.Mt(t,i.u_image1),u_brightness_low:new P.jt(t,i.u_brightness_low),u_brightness_high:new P.jt(t,i.u_brightness_high),u_saturation_factor:new P.jt(t,i.u_saturation_factor),u_contrast_factor:new P.jt(t,i.u_contrast_factor),u_spin_weights:new P.Pt(t,i.u_spin_weights),u_coords_top:new P.Ft(t,i.u_coords_top),u_coords_bottom:new P.Ft(t,i.u_coords_bottom)}),symbolIcon:(t,i)=>({u_is_size_zoom_constant:new P.Mt(t,i.u_is_size_zoom_constant),u_is_size_feature_constant:new P.Mt(t,i.u_is_size_feature_constant),u_size_t:new P.jt(t,i.u_size_t),u_size:new P.jt(t,i.u_size),u_rotate_symbol:new P.Mt(t,i.u_rotate_symbol),u_label_plane_matrix:new P.zt(t,i.u_label_plane_matrix
814),u_coord_matrix:new P.zt(t,i.u_coord_matrix),u_is_text:new P.Mt(t,i.u_is_text),u_pitch_with_map:new P.Mt(t,i.u_pitch_with_map),u_is_along_line:new P.Mt(t,i.u_is_along_line),u_is_variable_anchor:new P.Mt(t,i.u_is_variable_anchor),u_texsize:new P.Nt(t,i.u_texsize),u_texture:new P.Mt(t,i.u_texture),u_translation:new P.Nt(t,i.u_translation),u_pitched_scale:new P.jt(t,i.u_pitched_scale),u_is_offset:new P.Mt(t,i.u_is_offset),u_height_anchor_ground:new P.Mt(t,i.u_height_anchor_ground)}),symbolSDF:(t,i)=>({u_is_size_zoom_constant:new P.Mt(t,i.u_is_size_zoom_constant),u_is_size_feature_constant:new P.Mt(t,i.u_is_size_feature_constant),u_size_t:new P.jt(t,i.u_size_t),u_size:new P.jt(t,i.u_size),u_rotate_symbol:new P.Mt(t,i.u_rotate_symbol),u_label_plane_matrix:new P.zt(t,i.u_label_plane_matrix),u_coord_matrix:new P.zt(t,i.u_coord_matrix),u_is_text:new P.Mt(t,i.u_is_text),u_pitch_with_map:new P.Mt(t,i.u_pitch_with_map),u_is_along_line:new P.Mt(t,i.u_is_along_line),u_is_variable_anchor:new P.Mt(t,i.u_is_variable_anchor),u_texsize:new P.Nt(t,i.u_texsize),u_texture:new P.Mt(t,i.u_texture),u_gamma_scale:new P.jt(t,i.u_gamma_scale),u_is_halo:new P.Mt(t,i.u_is_halo),u_is_plain:new P.Mt(t,i.u_is_plain),u_translation:new P.Nt(t,i.u_translation),u_pitched_scale:new P.jt(t,i.u_pitched_scale),u_is_offset:new P.Mt(t,i.u_is_offset),u_height_anchor_ground:new P.Mt(t,i.u_height_anchor_ground)}),symbolTextAndIcon:(t,i)=>({u_is_size_zoom_constant:new P.Mt(t,i.u_is_size_zoom_constant),u_is_size_feature_constant:new P.Mt(t,i.u_is_size_feature_constant),u_size_t:new P.jt(t,i.u_size_t),u_size:new P.jt(t,i.u_size),u_rotate_symbol:new P.Mt(t,i.u_rotate_symbol),u_label_plane_matrix:new P.zt(t,i.u_label_plane_matrix),u_coord_matrix:new P.zt(t,i.u_coord_matrix),u_is_text:new P.Mt(t,i.u_is_text),u_pitch_with_map:new P.Mt(t,i.u_pitch_with_map),u_is_along_line:new P.Mt(t,i.u_is_along_line),u_is_variable_anchor:new P.Mt(t,i.u_is_variable_anchor),u_texsize:new P.Nt(t,i.u_texsize),u_texsize_icon:new P.Nt(t,i.u_texsize_icon),u_texture:new P.Mt(t,i.u_texture),u_texture_icon:new P.Mt(t,i.u_texture_icon),u_gamma_scale:new P.jt(t,i.u_gamma_scale),u_is_halo:new P.Mt(t,i.u_is_halo),u_translation:new P.Nt(t,i.u_translation),u_pitched_scale:new P.jt(t,i.u_pitched_scale),u_is_offset:new P.Mt(t,i.u_is_offset),u_height_anchor_ground:new P.Mt(t,i.u_height_anchor_ground)}),background:(t,i)=>({u_opacity:new P.jt(t,i.u_opacity),u_color:new P.It(t,i.u_color)}),backgroundPattern:(t,i)=>({u_opacity:new P.jt(t,i.u_opacity),u_image:new P.Mt(t,i.u_image),u_pattern_tl_a:new P.Nt(t,i.u_pattern_tl_a),u_pattern_br_a:new P.Nt(t,i.u_pattern_br_a),u_pattern_tl_b:new P.Nt(t,i.u_pattern_tl_b),u_pattern_br_b:new P.Nt(t,i.u_pattern_br_b),u_texsize:new P.Nt(t,i.u_texsize),u_mix:new P.jt(t,i.u_mix),u_pattern_size_a:new P.Nt(t,i.u_pattern_size_a),u_pattern_size_b:new P.Nt(t,i.u_pattern_size_b),u_scale_a:new P.jt(t,i.u_scale_a),u_scale_b:new P.jt(t,i.u_scale_b),u_pixel_coord_upper:new P.Nt(t,i.u_pixel_coord_upper),u_pixel_coord_lower:new P.Nt(t,i.u_pixel_coord_lower),u_tile_units_to_pixels:new P.jt(t,i.u_tile_units_to_pixels)}),terrain:(t,i)=>({u_texture:new P.Mt(t,i.u_texture),u_ele_delta:new P.jt(t,i.u_ele_delta),u_fog_matrix:new P.zt(t,i.u_fog_matrix),u_fog_color:new P.It(t,i.u_fog_color),u_fog_ground_blend:new P.jt(t,i.u_fog_ground_blend),u_fog_ground_blend_opacity:new P.jt(t,i.u_fog_ground_blend_opacity),u_horizon_color:new P.It(t,i.u_horizon_color),u_horizon_fog_blend:new P.jt(t,i.u_horizon_fog_blend),u_is_globe_mode:new P.jt(t,i.u_is_globe_mode)}),terrainDepth:(t,i)=>({u_ele_delta:new P.jt(t,i.u_ele_delta)}),atmosphere:(t,i)=>({u_sun_pos:new P.Pt(t,i.u_sun_pos),u_atmosphere_blend:new P.jt(t,i.u_atmosphere_blend),u_globe_position:new P.Pt(t,i.u_globe_position),u_globe_radius:new P.jt(t,i.u_globe_radius),u_inv_proj_matrix:new P.zt(t,i.u_inv_proj_matrix)}),sky:(t,i)=>({u_sky_color:new P.It(t,i.u_sky_color),u_horizon_color:new P.It(t,i.u_horizon_color),u_horizon:new P.Nt(t,i.u_horizon),u_horizon_normal:new P.Nt(t,i.u_horizon_normal),u_sky_horizon_blend:new P.jt(t,i.u_sky_horizon_blend),u_sky_blend:new P.jt(t,i.u_sky_blend),u_inv_proj_matrix:new P.zt(t,i.u_inv_proj_matrix),u_globe_position:new P.Pt(t,i.u_globe_position),u_globe_radius:new P.jt(t,i.u_globe_radius),u_atmosphere_blend:new P.jt(t,i.u_atmosphere_blend)})};var rF=class{constructor(t,i,r){this.context=t;let a=t.gl;this.buffer=a.createBuffer(),this.dynamicDraw=!!r,this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),a.bufferData(a.ELEMENT_ARRAY_BUFFER,i.arrayBuffer,this.dynamicDraw?a.DYNAMIC_DRAW:a.STATIC_DRAW),this.dynamicDraw||i.freeBufferAfterUpload()}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(t){let i=this.context.gl;if(!this.dynamicDraw)throw Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),i.bufferSubData(i.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)}destroy(){let t=this.context.gl;this.buffer&&(t.deleteBuffer(this.buffer),delete this.buffer)}};let rk={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};var rB=class{constructor(t,i,r,a){this.length=i.length,this.attributes=r,this.itemSize=i.bytesPerElement,this.dynamicDraw=a,this.context=t;let o=t.gl;this.buffer=o.createBuffer(),t.bindVertexBuffer.set(this.buffer),o.bufferData(o.ARRAY_BUFFER,i.arrayBuffer,this.dynamicDraw?o.DYNAMIC_DRAW:o.STATIC_DRAW),this.dynamicDraw||i.freeBufferAfterUpload()}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(t){if(t.length!==this.length)throw Error(`Length of new data is ${t.length}, which doesn't match current length of ${this.length}`);let i=this.context.gl;this.bind(),i.bufferSubData(i.ARRAY_BUFFER,0,t.arrayBuffer)}
vendor: 7,090 bytes, line 814
814enableAttributes(t,i){for(let r of this.attributes){let a=i.attributes[r.name];void 0!==a&&t.enableVertexAttribArray(a.location)}}setVertexAttribPointers(t,i,r){for(let a of this.attributes){let o=i.attributes[a.name];if(void 0!==o){let i=a.offset+this.itemSize*(r||0);o.isInteger?t.vertexAttribIPointer(o.location,a.components,t[rk[a.type]],this.itemSize,i):t.vertexAttribPointer(o.location,a.components,t[rk[a.type]],!1,this.itemSize,i)}}}destroy(){let t=this.context.gl;this.buffer&&(t.deleteBuffer(this.buffer),delete this.buffer)}},rO=class{constructor(t){this.gl=t.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(t){}getDefault(){return this.default}setDefault(){this.set(this.default)}},rj=class extends rO{getDefault(){return P.fn.transparent}set(t){let i=this.current;(t.r!==i.r||t.g!==i.g||t.b!==i.b||t.a!==i.a||this.dirty)&&(this.gl.clearColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}},rN=class extends rO{getDefault(){return 1}set(t){(t!==this.current||this.dirty)&&(this.gl.clearDepth(t),this.current=t,this.dirty=!1)}},rZ=class extends rO{getDefault(){return 0}set(t){(t!==this.current||this.dirty)&&(this.gl.clearStencil(t),this.current=t,this.dirty=!1)}},rU=class extends rO{getDefault(){return[!0,!0,!0,!0]}set(t){let i=this.current;(t[0]!==i[0]||t[1]!==i[1]||t[2]!==i[2]||t[3]!==i[3]||this.dirty)&&(this.gl.colorMask(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}},rG=class extends rO{getDefault(){return!0}set(t){(t!==this.current||this.dirty)&&(this.gl.depthMask(t),this.current=t,this.dirty=!1)}},rV=class extends rO{getDefault(){return 255}set(t){(t!==this.current||this.dirty)&&(this.gl.stencilMask(t),this.current=t,this.dirty=!1)}},rq=class extends rO{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(t){let i=this.current;(t.func!==i.func||t.ref!==i.ref||t.mask!==i.mask||this.dirty)&&(this.gl.stencilFunc(t.func,t.ref,t.mask),this.current=t,this.dirty=!1)}},rW=class extends rO{getDefault(){let t=this.gl;return[t.KEEP,t.KEEP,t.KEEP]}set(t){let i=this.current;(t[0]!==i[0]||t[1]!==i[1]||t[2]!==i[2]||this.dirty)&&(this.gl.stencilOp(t[0],t[1],t[2]),this.current=t,this.dirty=!1)}},r$=class extends rO{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;let i=this.gl;t?i.enable(i.STENCIL_TEST):i.disable(i.STENCIL_TEST),this.current=t,this.dirty=!1}},rH=class extends rO{getDefault(){return[0,1]}set(t){let i=this.current;(t[0]!==i[0]||t[1]!==i[1]||this.dirty)&&(this.gl.depthRange(t[0],t[1]),this.current=t,this.dirty=!1)}},rX=class extends rO{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;let i=this.gl;t?i.enable(i.DEPTH_TEST):i.disable(i.DEPTH_TEST),this.current=t,this.dirty=!1}},rY=class extends rO{getDefault(){return this.gl.LESS}set(t){(t!==this.current||this.dirty)&&(this.gl.depthFunc(t),this.current=t,this.dirty=!1)}},rK=class extends rO{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;let i=this.gl;t?i.enable(i.BLEND):i.disable(i.BLEND),this.current=t,this.dirty=!1}},rJ=class extends rO{getDefault(){let t=this.gl;return[t.ONE,t.ZERO]}set(t){let i=this.current;(t[0]!==i[0]||t[1]!==i[1]||this.dirty)&&(this.gl.blendFunc(t[0],t[1]),this.current=t,this.dirty=!1)}},rQ=class extends rO{getDefault(){return P.fn.transparent}set(t){let i=this.current;(t.r!==i.r||t.g!==i.g||t.b!==i.b||t.a!==i.a||this.dirty)&&(this.gl.blendColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}},r0=class extends rO{getDefault(){return this.gl.FUNC_ADD}set(t){(t!==this.current||this.dirty)&&(this.gl.blendEquation(t),this.current=t,this.dirty=!1)}},r1=class extends rO{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;let i=this.gl;t?i.enable(i.CULL_FACE):i.disable(i.CULL_FACE),this.current=t,this.dirty=!1}},r2=class extends rO{getDefault(){return this.gl.BACK}set(t){(t!==this.current||this.dirty)&&(this.gl.cullFace(t),this.current=t,this.dirty=!1)}},r4=class extends rO{getDefault(){return this.gl.CCW}set(t){(t!==this.current||this.dirty)&&(this.gl.frontFace(t),this.current=t,this.dirty=!1)}},r3=class extends rO{getDefault(){return null}set(t){(t!==this.current||this.dirty)&&(this.gl.useProgram(t),this.current=t,this.dirty=!1)}},r5=class extends rO{getDefault(){return this.gl.TEXTURE0}set(t){(t!==this.current||this.dirty)&&(this.gl.activeTexture(t),this.current=t,this.dirty=!1)}},r6=class extends rO{getDefault(){let t=this.gl;return[0,0,t.drawingBufferWidth,t.drawingBufferHeight]}set(t){let i=this.current;(t[0]!==i[0]||t[1]!==i[1]||t[2]!==i[2]||t[3]!==i[3]||this.dirty)&&(this.gl.viewport(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}},r8=class extends rO{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;let i=this.gl;i.bindFramebuffer(i.FRAMEBUFFER,t),this.current=t,this.dirty=!1}},r9=class extends rO{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;let i=this.gl;i.bindRenderbuffer(i.RENDERBUFFER,t),this.current=t,this.dirty=!1}},r7=class extends rO{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;let i=this.gl;i.bindTexture(i.TEXTURE_2D,t),this.current=t,this.dirty=!1}},ae=class extends rO{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;let i=this.gl;i.bindBuffer(i.ARRAY_BUFFER,t),this.current=t,this.dirty=!1}},at=class extends rO{getDefault(){return null}set(t){let i=this.gl;i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,t),this.current=t,this.dirty=!1}},ai=class extends rO{getDefault(){return null}set(t){(t!==this.current||this.dirty)&&(this.gl.bindVertexArray(t),this.current=t,this.dirty=!1)}},ar=class extends rO{getDefault(){return 4}set(t){if(t===this.current&&!this.dirty)return;let i=this.gl;i.pixelStorei(i.UNPACK_ALIGNMENT,t),this.current=t,this.dirty=!1}},aa=class extends rO{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;let i=this.gl;i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t),this.current=t,this.dirty=!1}},ao=class extends rO{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;let i=this.gl;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,t),this.current=t,this.dirty=!1}},as=class extends rO{constructor(t,i){super(t),this.context=t,this.parent=i}getDefault(){return null}},an=class extends as{setDirty(){this.dirty=!0}set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let i=this.gl;i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,t,0),this.current=t,this.dirty=!1}},al=class extends as{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let i=this.gl;i.framebufferRenderbuffer(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.RENDERBUFFER,t),this.current=t,this.dirty=!1}},ah=class extends as{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let i=this.gl;i.framebufferRenderbuffer(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.RENDERBUFFER,t),this.current=t,this.dirty=!1}},ac=class{constructor(t,i,r,a,o){this.context=t,this.width=i,this.height=r;let s=t.gl,n=this.framebuffer=s.createFramebuffer();
vendor: 7,028 bytes, line 814
814if(this.colorAttachment=new an(t,n),a)this.depthAttachment=o?new ah(t,n):new al(t,n);else if(o)throw Error("Stencil cannot be set without depth")}destroy(){let t=this.context.gl,i=this.colorAttachment.get();if(i&&t.deleteTexture(i),this.depthAttachment){let i=this.depthAttachment.get();i&&t.deleteRenderbuffer(i)}t.deleteFramebuffer(this.framebuffer)}};let au=i7([{name:"u_units_to_pixels",type:"vec2"},{name:"u_world_size",type:"vec2"},{name:"u_camera_to_center_distance",type:"float"},{name:"u_symbol_fade_change",type:"float"},{name:"u_aspect_ratio",type:"float"},{name:"u_device_pixel_ratio",type:"float"},{name:"u_viewport_size",type:"vec2"},{name:"u_pixel_extrude_scale",type:"vec2"},{name:"u_pitch",type:"float"}]),ad=au.offsets;var a_=class{constructor(t,i,r){this.blendFunction=t,this.blendColor=i,this.mask=r}};a_.Replace=[1,0],a_.disabled=new a_(a_.Replace,P.fn.transparent,[!1,!1,!1,!1]),a_.unblended=new a_(a_.Replace,P.fn.transparent,[!0,!0,!0,!0]),a_.alphaBlended=new a_([1,771],P.fn.transparent,[!0,!0,!0,!0]);var ap=class{constructor(t){this.gl=t,this.clearColor=new rj(this),this.clearDepth=new rN(this),this.clearStencil=new rZ(this),this.colorMask=new rU(this),this.depthMask=new rG(this),this.stencilMask=new rV(this),this.stencilFunc=new rq(this),this.stencilOp=new rW(this),this.stencilTest=new r$(this),this.depthRange=new rH(this),this.depthTest=new rX(this),this.depthFunc=new rY(this),this.blend=new rK(this),this.blendFunc=new rJ(this),this.blendColor=new rQ(this),this.blendEquation=new r0(this),this.cullFace=new r1(this),this.cullFaceSide=new r2(this),this.frontFace=new r4(this),this.program=new r3(this),this.activeTexture=new r5(this),this.viewport=new r6(this),this.bindFramebuffer=new r8(this),this.bindRenderbuffer=new r9(this),this.bindTexture=new r7(this),this.bindVertexBuffer=new ae(this),this.bindElementBuffer=new at(this),this.bindVertexArray=new ai(this),this.pixelStoreUnpack=new ar(this),this.pixelStoreUnpackPremultiplyAlpha=new aa(this),this.pixelStoreUnpackFlipY=new ao(this),this.extTextureFilterAnisotropic=t.getExtension("EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=t.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=t.getParameter(t.MAX_TEXTURE_SIZE),t.getExtension("EXT_color_buffer_half_float"),t.getExtension("EXT_color_buffer_float"),this.projectionUniformBuffer=function(t){return new re(t,i8.ProjectionUBO,rt)}(this),this.terrainUniformBuffer=function(t){return new re(t,i8.TerrainUBO,rr)}(this),this.frameUniformBuffer=function(t){return new re(t,i8.FrameUBO,au)}(this)}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.bindVertexArray.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0,this.projectionUniformBuffer.bindingDirty=!0,this.terrainUniformBuffer.bindingDirty=!0,this.frameUniformBuffer.bindingDirty=!0}setCustomLayerDefaults(){this.unbindVAO(),this.cullFace.setDefault(),this.activeTexture.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}createIndexBuffer(t,i){return new rF(this,t,i)}createVertexBuffer(t,i,r){return new rB(this,t,i,r)}createRenderbuffer(t,i,r){let a=this.gl,o=a.createRenderbuffer();return this.bindRenderbuffer.set(o),a.renderbufferStorage(a.RENDERBUFFER,t,i,r),this.bindRenderbuffer.set(null),o}createFramebuffer(t,i,r,a){return new ac(this,t,i,r,a)}clear({color:t,depth:i,stencil:r}){let a=this.gl,o=0;t&&(o|=a.COLOR_BUFFER_BIT,this.clearColor.set(t),this.colorMask.set([!0,!0,!0,!0])),void 0!==i&&(o|=a.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(i),this.depthMask.set(!0)),void 0!==r&&(o|=a.STENCIL_BUFFER_BIT,this.clearStencil.set(r),this.stencilMask.set(255)),a.clear(o)}setCullFace(t){!1===t.enable?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(t.mode),this.frontFace.set(t.frontFace))}setDepthMode(t){t.func!==this.gl.ALWAYS||t.mask?(this.depthTest.set(!0),this.depthFunc.set(t.func),this.depthMask.set(t.mask),this.depthRange.set(t.range)):this.depthTest.set(!1)}setStencilMode(t){t.test.func!==this.gl.ALWAYS||t.mask?(this.stencilTest.set(!0),this.stencilMask.set(t.mask),this.stencilOp.set([t.fail,t.depthFail,t.pass]),this.stencilFunc.set({func:t.test.func,ref:t.ref,mask:t.test.mask})):this.stencilTest.set(!1)}setColorMode(t){(0,P.qn)(t.blendFunction,a_.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(t.blendFunction),this.blendColor.set(t.blendColor)),this.colorMask.set(t.mask)}createVertexArray(){return this.gl.createVertexArray()}deleteVertexArray(t){this.gl.deleteVertexArray(t)}unbindVAO(){this.bindVertexArray.set(null)}},am=class{constructor(t,i,r){this.func=t,this.mask=i,this.range=r}};am.ReadOnly=!1,am.ReadWrite=!0,am.disabled=new am(519,am.ReadOnly,[0,1]);var af=class{constructor(t,i,r,a,o,s){this.test=t,this.ref=i,this.mask=r,this.fail=a,this.depthFail=o,this.pass=s}};af.disabled=new af({func:519,mask:0},0,0,7680,7680,7680);var ag=class{constructor(t,i,r){this.enable=t,this.mode=i,this.frontFace=r}};function av(t,i,r={}){return t.transform.getProjectionData({overscaledTileID:i,aligned:r.aligned,applyGlobeMatrix:!t.isRenderingToTexture,applyTerrainMatrix:r.applyTerrainMatrix??!0})}function ay(t,i){return t.isRenderingToTexture?null:t.terrain?.getTerrainData(i)??null}function ax(t,i,r,a,o,s){let n=t.context,l=n.gl,h=t.useProgram("collisionBox"),c=[],u=0,d=0;for(let _ of a){let a=i.getTile(_).getBucket(r);
814if(!a)continue;let p=o?a.textCollisionBox:a.iconCollisionBox,m=a.collisionCircleArray;m.length>0&&(c.push({circleArray:m,circleOffset:d,coord:_}),u+=m.length/4,d=u),p&&h.draw(n,l.LINES,am.disabled,af.disabled,t.colorModeForRenderPass(),ag.disabled,null,ay(s,_),av(s,_),r.id,p.layoutVertexBuffer,p.indexBuffer,p.segments,null,t.transform.zoom,null,null,p.collisionVertexBuffer)}if(!o||!c.length)return;let _=t.useProgram("collisionCircle"),m=new P.Ht;m.resize(4*u),m._trim();let f=0;for(let t of c)for(let i=0;i<t.circleArray.length/4;i++){let r=4*i,a=t.circleArray[r+0],o=t.circleArray[r+1],s=t.circleArray[r+2],n=t.circleArray[r+3];m.emplace(f++,a,o,s,n,0),m.emplace(f++,a,o,s,n,1),m.emplace(f++,a,o,s,n,2),m.emplace(f++,a,o,s,n,3)}(!p||p.length<2*u)&&(p=function(t){let i=2*t,r=new P.Kt;r.resize(i),r._trim();for(let t=0;t<i;t++){let i=6*t;r.uint16[i+0]=4*t+0,r.uint16[i+1]=4*t+1,r.uint16[i+2]=4*t+2,r.uint16[i+3]=4*t+2,r.uint16[i+4]=4*t+3,r.uint16[i+5]=4*t+0}return r}(u));let g=n.createIndexBuffer(p,!0),v=n.createVertexBuffer(m,P.U.members,!0);for(let i of c)_.draw(n,l.TRIANGLES,am.disabled,af.disabled,t.colorModeForRenderPass(),ag.disabled,null,ay(s,i.coord),null,r.id,v,g,P.Bt.simpleSegment(0,2*i.circleOffset,i.circleArray.length,i.circleArray.length/2),null,t.transform.zoom,null,null,null);v.destroy(),g.destroy()}ag.disabled=new ag(!1,1029,2305),ag.backCCW=new ag(!0,1029,2305),ag.frontCCW=new ag(!0,1028,2305);let ab=(0,P.Si)(new Float32Array(16));function aw(t,i,r,a,o,s,n,l,h,c,u,d,_){let p=t.context,m=p.gl,f=t.transform,g="map"===l,v="map"===h,y="viewport"!==l&&"point"!==r.layout.get("symbol-placement"),x=g&&!v&&!y,b=!r.layout.get("symbol-sort-key").isConstant(),w=!1,T=t.getDepthModeForSublayer(0,am.ReadOnly),M=r._unevaluatedLayout.hasValue("text-variable-anchor")||r._unevaluatedLayout.hasValue("text-variable-anchor-offset"),C=[],I=f.getCircleRadiusCorrection();for(let l of a){let a=i.getTile(l),h=a.getBucket(r);if(!h)continue;let u=o?h.text:h.icon;if(!u?.segments.get().length||!u.hasVisibleVertices)continue;let d=u.programConfigurations.get(r.id),p=o||h.sdfIcons,T=o?h.textSizeData:h.iconSizeData,S=v||0!==f.pitch,E=t.useProgram(h.iconsInText&&o?"symbolTextAndIcon":p?"symbolSDF":"symbolIcon",d),z=(0,P.A)(T,f.zoom),R=ay(_,l),D,L=[0,0],A,F,k=null,B;if(o){if(A=a.glyphAtlasTexture,F=m.LINEAR,D=a.glyphAtlasTexture.size,h.iconsInText){L=a.imageAtlasTexture.size,k=a.imageAtlasTexture;let i="composite"===T.kind||"camera"===T.kind;B=S||t.options.rotating||t.options.zooming||i?m.LINEAR:m.NEAREST}}else{let i=1!==r.layout.get("icon-size").constantOr(0)||h.iconsNeedLinear;A=a.imageAtlasTexture,F=p||t.options.rotating||t.options.zooming||i||S?m.LINEAR:m.NEAREST,D=a.imageAtlasTexture.size}let O=(0,P.Ir)(a,1,t.transform.zoom),j=tp(g,t.transform,O),N=function(t,i,r,a){if(t){let t=(0,P.vi)();if(!i){let{vecSouth:i,vecEast:a}=tm(r);t[0]=a[0],t[1]=a[1],t[4]=i[0],t[5]=i[1]}return(0,P.Ai)(t,t,[a,a,1]),t}return r.pixelsToClipSpaceMatrix}(v,g,t.transform,O),Z=(0,P.jr)(f,a,s,n),U=av(_,l),G=M&&h.hasTextData(),V="none"!==r.layout.get("icon-text-fit")&&G&&h.hasIconData(),q=r._unevaluatedLayout.hasValue("icon-offset"),W="ground"===r.layout.get("symbol-height-anchor");if(y){let i=(0,P.vi)();!function(t,i){let r=1/(i[0]*i[0]+i[1]*i[1]+i[2]*i[2]),a=1/(i[8]*i[8]+i[9]*i[9]+i[10]*i[10]),o=i[0]*r,s=i[4]*r,n=i[8]*a,l=i[1]*r,h=i[5]*r,c=i[9]*a,u=i[2]*r,d=i[6]*r,_=i[10]*a;t[0]=o,t[1]=s,t[2]=n,t[4]=l,t[5]=h,t[6]=c,t[8]=u,t[9]=d,t[10]=_;let p=i[12],m=i[13],f=i[14];t[12]=-o*p-l*m-u*f,t[13]=-s*p-h*m-d*f,t[14]=-n*p-c*m-_*f,t[3]=0,t[7]=0,t[11]=0,t[15]=1}(i,j);let a=t.style.map.terrain?(i,r)=>t.style.map.terrain.getElevation(l,i,r):void 0;!function(t,i,r,a,o,s,n,l,h,c,u,d,_){let p=r?t.textSizeData:t.iconSizeData,m=(0,P.A)(p,i.transform.zoom),f=[256/i.width*2+1,256/i.height*2+1],g=r?t.text.dynamicLayoutVertexArray:t.icon.dynamicLayoutVertexArray;g.clear();let v=t.lineVertexArray,y=r?t.text.placedSymbolArray:t.icon.placedSymbolArray,x=i.transform.width/i.transform.height,b=!1;for(let r=0;r<y.length;r++){var w;let T=y.get(r);if(T.hidden||2===T.writingMode&&!b){tE(T.numGlyphs,g);continue}b=!1;let M=new P.Li(T.anchorX,T.anchorY),C={getElevation:_,pitchedLabelPlaneMatr
814ix:a,lineVertexArray:v,pitchWithMap:s,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:i.transform,tileAnchorPoint:M,unwrappedTileID:h,width:c,height:u,translation:d},I=tM(T.anchorX,T.anchorY,C);if(w=I.point,!(w.x>=-f[0]&&w.x<=f[0]&&w.y>=-f[1])||!(w.y<=f[1])){tE(T.numGlyphs,g);continue}let S=I.signedDistanceFromCamera,E=.5+i.transform.cameraToCenterDistance/S*.5,z=(0,P.k)(p,m,T),R=s?z*i.transform.getPitchedTextCorrection(T.anchorX,T.anchorY,h)/E:z*E,D=tx({projectionContext:C,pitchedLabelPlaneMatrixInverse:o,symbol:T,fontSize:R,flip:!1,keepUpright:n,glyphOffsetArray:t.glyphOffsetArray,dynamicLayoutVertexArray:g,aspectRatio:x,rotateToLine:l});b=D.useVertical,(D.notEnoughRoom||b||D.needsFlipping&&tx({projectionContext:C,pitchedLabelPlaneMatrixInverse:o,symbol:T,fontSize:R,flip:!0,keepUpright:n,glyphOffsetArray:t.glyphOffsetArray,dynamicLayoutVertexArray:g,aspectRatio:x,rotateToLine:l}).notEnoughRoom)&&tE(T.numGlyphs,g)}r?t.text.dynamicLayoutVertexBuffer.updateData(g):t.icon.dynamicLayoutVertexBuffer.updateData(g)}(h,t,o,j,i,v,c,"map"===r.layout.get("text-rotation-alignment"),l.toUnwrapped(),f.width,f.height,Z,a)}let $=o&&M||V,H=v?j:t.transform.clipSpaceToPixelsMatrix,X=y||$?ab:H,Y=p&&0!==r.paint.get(o?"text-halo-width":"icon-halo-width").constantOr(1),K={program:E,buffers:u,uniformValues:p?h.iconsInText?rz(T.kind,z,x,v,y,$,t,X,N,Z,D,L,I,q,W):rE(T.kind,z,x,v,y,$,t,X,N,Z,o,D,Y,I,q,W):rS(T.kind,z,x,v,y,$,t,X,N,Z,o,D,I,q,W),projectionData:U,atlasTexture:A,atlasTextureIcon:k,atlasInterpolation:F,atlasInterpolationIcon:B,isSDF:p,hasHalo:Y};if(b&&h.canOverlap)for(let t of(w=!0,u.segments.get()))C.push({segments:new P.Bt([t]),sortKey:t.sortKey,state:K,terrainData:R});else C.push({segments:u.segments,sortKey:0,state:K,terrainData:R})}w&&C.sort((t,i)=>t.sortKey-i.sortKey);let S=r.paint.get(o?"text-halo-width":"icon-halo-width").constantOr(null)??1/0,E=24*r.layout.get("text-letter-spacing").constantOr(0)<0||S>1;for(let i of C){let a=i.state;p.activeTexture.set(m.TEXTURE0),a.atlasTexture.bind(a.atlasInterpolation,m.CLAMP_TO_EDGE),a.atlasTextureIcon&&(p.activeTexture.set(m.TEXTURE1),a.atlasTextureIcon&&a.atlasTextureIcon.bind(a.atlasInterpolationIcon,m.CLAMP_TO_EDGE));let o=a.isSDF&&a.hasHalo;if(o){let o=a.uniformValues;o.u_is_halo=1,E&&(o.u_is_plain=0,aT(a.buffers,i.segments,r,t,a.program,T,u,d,o,a.projectionData,i.terrainData),o.u_is_halo=0,o.u_is_plain=1)}aT(a.buffers,i.segments,r,t,a.program,T,u,d,a.uniformValues,a.projectionData,i.terrainData),o&&!E&&(a.uniformValues.u_is_halo=0)}}function aT(t,i,r,a,o,s,n,l,h,c,u){let d=a.context,_=d.gl;o.draw(d,_.TRIANGLES,s,n,l,ag.backCCW,h,u,c,r.id,t.layoutVertexBuffer,t.indexBuffer,i,r.paint,a.transform.zoom,t.programConfigurations.get(r.id),t.dynamicLayoutVertexBuffer,t.opacityVertexBuffer)}function aP(t,i,r){let a=t.gl,o=a.createTexture();a.bindTexture(a.TEXTURE_2D,o),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.LINEAR),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.LINEAR),a.texStorage2D(a.TEXTURE_2D,1,a.RGBA16F,i,r);let s=t.createFramebuffer(i,r,!1,!1);return s.colorAttachment.set(o),s}function aM(t,i){return i.colorRampTexture||=new P.xt(t,i.colorRamp,t.gl.RGBA),i.colorRampTexture}function aC(t,i,r){let a=t.context,o=a.bindFramebuffer.get(),s=a.viewport.get(),[,,n,l]=s;return function(t,i,r){let a=t.context.gl;if(!t.layerOpacityFbo){let o=t.context.createFramebuffer(i,r,!0,!0),s=a.createTexture();a.bindTexture(a.TEXTURE_2D,s),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.LINEAR),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.LINEAR),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,i,r,0,a.RGBA,a.UNSIGNED_BYTE,null),o.colorAttachment.set(s),o.depthAttachment.set(t.context.createRenderbuffer(a.DEPTH_STENCIL,i,r)),t.layerOpacityFbo=o,t.context.bindFramebuffer.set(t.layerOpacityFbo.framebuffer);return}if(t.layerOpacityFbo.width===i&&t.layerOpacityFbo.height===r)return t.context.bindFramebuffer.set(t.layerOpacityFbo.framebuffer);let o=t.layerOpacityFbo;a.bindTexture(a.TEXTURE_2D,o.colorAttachment.get()),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,i,r,0,a.RGBA,a.UNSIGNED_BYTE,null),t.context.bindRenderbuffer.set(o.depthAttachment.get()),a.renderbufferStorage(a.RENDERBUFFER,a.DEPTH_STENCIL,i,r),t.context.bindRenderbuffer.set(null),o.width=i,o.height=r,t.context.bindFramebuffer.set(o.framebuffer)}(t,n,l),a.viewport.set([0,0,n,l]),a.clear({color:P.fn.transparent,depth:1,stencil:0}),t.currentStencilSource=void 0,t.renderTileClippingMasks(i,r),{compositeTarget:o,compositeViewport:s}}function aI(t,i,r,a){let o=t.context,s=o.gl;o.bindFramebuffer.set(r.compositeTarget),o.viewport.set(r.compositeViewport),o.activeTexture.set(s.TEXTURE0),s.bindTexture(s.TEXTURE_2D,t.layerOpacityFbo.colorAttachment.get()),t.useProgram("layerOpacity").draw(o,s.TRIANGLES,am.disabled,af.disabled,t.colorModeForRenderPass(),ag.disabled,{u_image:0,u_opacity:i},null,null,a.id,t.viewportBuffer,t.quadTriangleIndexBuffer,t.viewportSegments,a.paint,t.transform.zoom),t.currentStencilSource=void 0}function aS(t,i,r,a,o,s,n,l){let h=256;if(o.stepInterpolant){let a=i.getSource().maxzoom,o=n.canonical.z===a?Math.
814ceil(1<<t.transform.maxZoom-n.canonical.z):1,l=s.maxLineLength/P.Lr*1024*o;h=(0,P.Bn)((0,P._r)(l),256,r.maxTextureSize)}return l.gradient=(0,P.Tt)({expression:o.gradientExpression(),evaluationKey:"lineProgress",resolution:h,image:l.gradient||void 0,clips:s.lineClipsArray}),l.texture?l.texture.update(l.gradient):l.texture=new P.xt(r,l.gradient,a.RGBA),l.version=o.gradientVersion,l.texture}function aE(t,i,r,a,o){let s=t.getDepthModeForSublayer(0,am.ReadOnly),n=t.colorModeForRenderPass(),l=r.paint.get("line-dasharray"),h=l.constantOr(1),c=r.paint.get("line-pattern"),u=c.constantOr(1),d=r.paint.get("line-gradient"),_=r.getCrossfadeParameters(),p;p=u?"linePattern":h&&d?"lineGradientSDF":h?"lineSDF":d?"lineGradient":"line";let m=t.context,f=m.gl,g=t.transform,v=!0;for(let y of a){let a=i.getTile(y);if(u&&!a.patternsLoaded())continue;let x=a.getBucket(r);if(!x)continue;let b=x.programConfigurations.get(r.id),w=t.context.program.get(),T=t.useProgram(p,b),P=v||T.program!==w,M=ay(o,y),C=c.constantOr(null),I=l?.constantOr(null);if(C&&a.imageAtlas){let t=a.imageAtlas,i=t.patternPositions[C.to.toString()],r=t.patternPositions[C.from.toString()];i&&r&&b.setConstantPatternPositions(i,r)}else if(I){let i="round"===r.layout.get("line-cap").constantOr(null),a=t.lineAtlas.getDash(I.to,i),o=t.lineAtlas.getDash(I.from,i);b.setConstantDashPositions(a,o)}let S=av(o,y),E=g.getPixelScale(),z;u?(z=rT(t,a,r,E,_),m.activeTexture.set(f.TEXTURE0),a.imageAtlasTexture.bind(f.LINEAR,f.CLAMP_TO_EDGE),b.updatePaintBuffers(_)):h&&d?(z=rM(t,a,r,E,_,x.lineClipsArray.length),function(t,i,r,a,o,s,n,l,h){let c=s.gradients[o.id],u=c.texture;o.gradientVersion!==c.version&&(u=aS(t,i,r,a,o,s,n,c)),r.activeTexture.set(a.TEXTURE0),u.bind(o.stepInterpolant?a.NEAREST:a.LINEAR,a.CLAMP_TO_EDGE),r.activeTexture.set(a.TEXTURE1),t.lineAtlas.bind(r),l.updatePaintBuffers(h)}(t,i,m,f,r,x,y,b,_)):h?(z=rP(t,a,r,E,_),(P||t.lineAtlas.dirty)&&(m.activeTexture.set(f.TEXTURE0),t.lineAtlas.bind(m)),b.updatePaintBuffers(_)):d?(z=rw(t,a,r,E,x.lineClipsArray.length),function(t,i,r,a,o,s,n){let l=s.gradients[o.id],h=l.texture;o.gradientVersion!==l.version&&(h=aS(t,i,r,a,o,s,n,l)),r.activeTexture.set(a.TEXTURE0),h.bind(o.stepInterpolant?a.NEAREST:a.LINEAR,a.CLAMP_TO_EDGE)}(t,i,m,f,r,x,y)):z=rb(t,a,r,E);let R=t.stencilModeForClipping(y);T.draw(m,f.TRIANGLES,s,R,n,ag.disabled,z,M,S,r.id,x.layoutVertexBuffer,x.indexBuffer,x.segments,r.paint,t.transform.zoom,b,x.layoutVertexBuffer2),v=!1}}function az(t,i,r,a,o){if(!r||!a?.imageAtlas)return;let s=a.imageAtlas.patternPositions,n=s[r.to.toString()],l=s[r.from.toString()];if(!n&&l&&(n=l),!l&&n&&(l=n),!n||!l){let t=o.getPaintProperty(i);n=s[t],l=s[t]}n&&l&&t.setConstantPatternPositions(n,l)}function aR(t,i,r,a,o){let s=t.colorModeForRenderPass();aL(t,i,r,a,t.getDepthModeForSublayer(1,am.ReadOnly),s,!1,o),aD(t,i,r,a,o)}function aD(t,i,r,a,o){if(!r.paint.get("fill-antialias"))return;let s=t.colorModeForRenderPass();aL(t,i,r,a,t.getDepthModeForSublayer(2*!!r.getPaintProperty("fill-outline-color"),am.ReadOnly),s,!0,o)}function aL(t,i,r,a,o,s,n,l){let h=t.context.gl,c="fill-pattern",u=r.paint.get(c),d=u?.constantOr(1),_=r.getCrossfadeParameters(),p,m,f,g,v,y=t.transform,x=r.paint.get("fill-translate"),b=r.paint.get("fill-translate-anchor");n?(m=d&&!r.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",p=h.LINES):(m=d?"fillPattern":"fill",p=h.TRIANGLES);let w=u.constantOr(null);for(let u of a){let a=i.getTile(u);if(d&&!a.patternsLoaded())continue;let T=a.getBucket(r);if(!T)continue;let M=T.sdfPatterns[r.id]??!1,C=T.programConfigurations.get(r.id),I=t.useProgram(m,C),S=ay(l,u);d&&(t.context.activeTexture.set(h.TEXTURE0),a.imageAtlasTexture.bind(h.LINEAR,h.CLAMP_TO_EDGE),C.updatePaintBuffers(_)),az(C,c,w,a,r);let E=av(l,u),z=(0,P.jr)(y,a,x,b);n?(g=T.indexBuffer2,v=T.segments2,f="fillOutlinePattern"===m&&d?r_(t,_,a,z,M):rd(z)):(g=T.indexBuffer,v=T.segments,f=d?rc(t,_,a,z,M):ru(z));let R=t.stencilModeForClipping(u);I.draw(t.context,p,o,R,s,ag.backCCW,f,S,E,r.id,T.layoutVertexBuffer,g,v,r.paint,t.transform.zoom,C)}}function aA(t,i,r,a,o,s,n,l){let h=t.context,c=h.gl,u="fill-extrusion-pattern",d=r.paint.get(u),_=d.constantOr(1),p=r.getCrossfadeParameters(),m=r.paint.get("fill-extrusion-opacity"),f=d.constantOr(null),g=t.transform;
814for(let d of a){let a=i.getTile(d),v=a.getBucket(r);if(!v)continue;let y=ay(l,d),x=v.programConfigurations.get(r.id),b=t.useProgram(_?"fillExtrusionPattern":"fillExtrusion",x);_&&(t.context.activeTexture.set(c.TEXTURE0),a.imageAtlasTexture.bind(c.LINEAR,c.CLAMP_TO_EDGE),x.updatePaintBuffers(p));let w=av(l,d);az(x,u,f,a,r);let T=(0,P.jr)(g,a,r.paint.get("fill-extrusion-translate"),r.paint.get("fill-extrusion-translate-anchor")),M=r.paint.get("fill-extrusion-vertical-gradient"),C=_?rh(t,M,m,T,d,p,a):rl(t,M,m,T);b.draw(h,h.gl.TRIANGLES,o,s,n,ag.backCCW,C,y,w,r.id,v.layoutVertexBuffer,v.indexBuffer,v.segments,r.paint,t.transform.zoom,x,t.style.map.terrain&&v.centroidVertexBuffer)}}function aF(t,i,r,a,o,s,n,l,h){let c=t.style.projection,u=t.context,d=u.gl,_=[`#define NUM_ILLUMINATION_SOURCES ${r.paint.get("hillshade-highlight-color").values.length}`],p=t.useProgram("hillshade",null,!1,_),m=!t.options.moving;for(let _ of a){let a=i.getTile(_),f=a.fbo;if(!f)continue;let g=c.getMeshFromTileID(u,_.canonical,l,!0,"raster"),v=ay(h,_);u.activeTexture.set(d.TEXTURE0),d.bindTexture(d.TEXTURE_2D,f.colorAttachment.get());let y=av(h,_,{aligned:m});p.draw(u,d.TRIANGLES,s,o[_.overscaledZ],n,ag.backCCW,rv(t,a,r),v,y,r.id,g.vertexBuffer,g.indexBuffer,g.segments)}}let ak=0;function aB(t,i,r,a,o,s,n,l,h){let c=t.style.projection,u=t.context,d=u.gl,_=t.useProgram("colorRelief"),p=!t.options.moving,m="nearest"===r.paint.get("resampling")?d.NEAREST:d.LINEAR,f=!0,g=0;for(let v of a){let a=i.getTile(v),y=a.dem;if(!y?.data)continue;if(f){let t=ak||=d.getParameter(d.MAX_TEXTURE_SIZE),{elevationTexture:i,colorTexture:a}=r.getColorRampTextures(u,t,y.getUnpackVector());u.activeTexture.set(d.TEXTURE1),i.bind(d.NEAREST,d.CLAMP_TO_EDGE),u.activeTexture.set(d.TEXTURE4),a.bind(d.LINEAR,d.CLAMP_TO_EDGE),f=!1,g=i.size[0]}let x=y.stride;u.activeTexture.set(d.TEXTURE0),(!a.demTexture||a.needsColorReliefPrepare)&&(u.pixelStoreUnpackPremultiplyAlpha.set(!1),a.demTexture||=t.getTileTexture(x)??new P.xt(u,{width:x,height:x,data:null},d.RGBA),a.demTexture.update(y.getPixels(),{premultiply:!1}),a.needsColorReliefPrepare=!1),a.demTexture.bind(m,d.CLAMP_TO_EDGE);let b=c.getMeshFromTileID(u,v.canonical,l,!0,"raster"),w=ay(h,v),T=av(h,v,{aligned:p});_.draw(u,d.TRIANGLES,s,o[v.overscaledZ],n,ag.backCCW,rx(r,a.dem,g),w,T,r.id,b.vertexBuffer,b.indexBuffer,b.segments)}}let aO=[new P.Li(0,0),new P.Li(P.Lr,0),new P.Li(P.Lr,P.Lr),new P.Li(0,P.Lr)];function aj(t,i,r,a,o,s,n,l,h,c=!1,u,d=null){let _=a[a.length-1].overscaledZ,p=t.context,m=p.gl,f=t.useProgram("raster"),g=t.style.projection,v=t.colorModeForRenderPass(),y=!t.options.moving,x=r.paint.get("raster-opacity"),b="nearest"===r.paint.get("resampling")||"nearest"===r.paint.get("raster-resampling")?m.NEAREST:m.LINEAR,w=r.paint.get("raster-fade-duration"),T=!!t.style.map.terrain;for(let M of a){let a=t.getDepthModeForSublayer(M.overscaledZ-_,1===x?am.ReadWrite:am.ReadOnly,m.LESS),C=i.getTile(M);p.activeTexture.set(m.TEXTURE0),C.texture.bind(b,m.CLAMP_TO_EDGE,m.LINEAR_MIPMAP_NEAREST),p.activeTexture.set(m.TEXTURE1);let{parentTile:I,parentScaleBy:E,parentTopLeft:z,fadeValues:R}=function(t,i,r,a){let o={parentTile:null,parentScaleBy:1,parentTopLeft:[0,0],fadeValues:{tileOpacity:1,parentTileOpacity:1,fadeMix:{opacity:1,mix:0}}};if(0===r||a)return o;if(t.fadingParentID){let a=i.getLoadedTile(t.fadingParentID);if(!a)return o;let s=2**(a.tileID.overscaledZ-t.tileID.overscaledZ);return{parentTile:a,parentScaleBy:s,parentTopLeft:[t.tileID.canonical.x*s%1,t.tileID.canonical.y*s%1],fadeValues:function(t,i,r){let a=S(),o=(a-t.timeAdded)/r,s=(a-i.timeAdded)/r,n=1===t.fadingDirection,l=(0,P.Bn)(o,0,1),h=(0,P.Bn)(1-s,0,1),c=n?l:h;return{tileOpacity:c,parentTileOpacity:n?h:l,fadeMix:{opacity:1,mix:1-c}}}(t,a,r)}}return t.selfFading?{parentTile:null,parentScaleBy:1,parentTopLeft:[0,0],fadeValues:function(t,i){let r=(S()-t.timeAdded)/i,a=(0,P.Bn)(r,0,1);return{tileOpacity:a,fadeMix:{opacity:a,mix:0}}}(t,r)}:o}(C,i,w,T);C.fadeOpacity=R.tileOpacity,I?(I.fadeOpacity=R.parentTileOpacity,I.texture.bind(b,m.CLAMP_TO_EDGE,m.LINEAR_MIPMAP_NEAREST)):C.texture.bind(b,m.CLAMP_TO_EDGE,m.LINEAR_MIPMAP_NEAREST),C.texture.useMipmap&&p.extTextureFilterAnisotropic&&t.transform.pitch>t.options.anisotropicFilterPitch&&m.texParameterf(m.TEXTURE_2D,p.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,p.extTextureFilterAnisotropicMax);let D=ay(u,M),L=av(u,M,{aligned:y}),A=eV(z,E,R.fadeMix,r,l,h),F=d??g.getMeshFromTileID(p,M.canonical,s,n,"raster"),k=o?o[M.overscaledZ]:af.disabled;f.draw(p,m.TRIANGLES,a,k,v,c?ag.frontCCW:ag.backCCW,A,D,L,r.id,F.vertexBuffer,F.indexBuffer,F.segments)}}
814let aN=new P.fn(1,0,0,1),aZ=new P.fn(0,1,0,1),aU=new P.fn(0,0,1,1),aG=new P.fn(1,0,1,1),aV=new P.fn(0,1,1,1);function aq(t,i,r,a){a$(t,0,i+r/2,t.transform.width,r,a)}function aW(t,i,r,a){a$(t,i-r/2,0,r,t.transform.height,a)}function a$(t,i,r,a,o,s){let n=t.context,l=n.gl;l.enable(l.SCISSOR_TEST),l.scissor(i*t.pixelRatio,r*t.pixelRatio,a*t.pixelRatio,o*t.pixelRatio),n.clear({color:s}),l.disable(l.SCISSOR_TEST)}function aH(t,i){if(!i.mesh){let r=new P.Gt;r.emplaceBack(-1,-1),r.emplaceBack(1,-1),r.emplaceBack(1,1),r.emplaceBack(-1,1);let a=new P.Jt;a.emplaceBack(0,1,2),a.emplaceBack(0,2,3),i.mesh=new eq(t.createVertexBuffer(r,eW.members),t.createIndexBuffer(a),P.Bt.simpleSegment(0,0,r.length,a.length))}return i.mesh}let aX={symbol:function(t,i,r,a,o,s){if("translucent"!==s.currentPass)return;let n=af.disabled,l=t.colorModeForRenderPass();(r._unevaluatedLayout.hasValue("text-variable-anchor")||r._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(t,i,r,a,o,s,n,l,h){let c=i.transform,u=i.style.map.terrain,d="map"===o,_="map"===s;for(let o of t){let t=a.getTile(o),s=t.getBucket(r);if(!s?.text?.segments.get().length)continue;let p=s.textSizeData,m=(0,P.A)(p,c.zoom),f=(0,P.Ir)(t,1,i.transform.zoom),g=tp(d,i.transform,f),v="none"!==r.layout.get("icon-text-fit")&&s.hasIconData();if(m){let i=2**(c.zoom-t.tileID.overscaledZ),a=u?(t,i)=>u.getElevation(o,t,i):void 0;!function(t,i,r,a,o,s,n,l,h,c,u,d,_){let p=t.text.placedSymbolArray,m=t.text.dynamicLayoutVertexArray,f=t.icon.dynamicLayoutVertexArray,g={};m.clear();for(let f=0;f<p.length;f++){let v=p.get(f),y=t.allowVerticalPlacement&&!v.placedOrientation,x=v.hidden||!v.crossTileID||y?null:a[v.crossTileID];if(x){let a=new P.Li(v.anchorX,v.anchorY),p={getElevation:d,heightOffset:v.heightOffset,heightAnchorGround:_,width:o.width,height:o.height,pitchedLabelPlaneMatrix:s,lineVertexArray:null,pitchWithMap:r,transform:o,projectionCache:null,tileAnchorPoint:a,translation:c,unwrappedTileID:u},f=r?tM(a.x,a.y,p):tT(a.x,a.y,p),y=.5+o.cameraToCenterDistance/f.signedDistanceFromCamera*.5,b=(0,P.k)(t.textSizeData,l,v)*y/24;r&&(b*=t.tilePixelRatio/n);let{width:w,height:T,anchor:M,textOffset:C,textBoxScale:I}=x,S=function(t,i,r,a,o,s){let{horizontalAlign:n,verticalAlign:l}=(0,P.M)(t);return new P.Li((-(n-.5)*i/o+a[0])*s,(-(l-.5)*r/o+a[1])*s)}(M,w,T,C,I,b),E=o.getPitchedTextCorrection(a.x+c[0],a.y+c[1],u),z=function(t,i,r,a,o,s){let n=i.tileAnchorPoint.add(new P.Li(i.translation[0],i.translation[1]));if(i.pitchWithMap){let t=a.mult(s);r||(t=t.rotate(-o));let l=n.add(t);return tg(l.x,l.y,i.pitchedLabelPlaneMatrix,tf(i,l.x,l.y)).point}if(r){let r=tT(i.tileAnchorPoint.x+1,i.tileAnchorPoint.y,i).point.sub(t),o=Math.atan(r.y/r.x)+(r.x<0?Math.PI:0);return t.add(a.rotate(o))}return t.add(a)}(f.point,p,i,S,-o.bearingInRadians,E),R=t.allowVerticalPlacement&&2===v.placedOrientation?Math.PI/2:0;for(let t=0;t<v.numGlyphs;t++)(0,P.C)(m,z,R);h&&v.associatedIconIndex>=0&&(g[v.associatedIconIndex]={shiftedAnchor:z,angle:R})}else tE(v.numGlyphs,m)}if(h){f.clear();let i=t.icon.placedSymbolArray;for(let t=0;t<i.length;t++){let r=i.get(t);if(r.hidden)tE(r.numGlyphs,f);else{let i=g[t];if(i)for(let t=0;t<r.numGlyphs;t++)(0,P.C)(f,i.shiftedAnchor,i.angle);else tE(r.numGlyphs,f)}}t.icon.dynamicLayoutVertexBuffer.updateData(f)}t.text.dynamicLayoutVertexBuffer.updateData(m)}(s,d,_,h,c,g,i,m,v,(0,P.jr)(c,t,n,l),o.toUnwrapped(),a,"ground"===r.layout.get("symbol-height-anchor"))}}}(a,t,r,i,r.layout.get("text-rotation-alignment"),r.layout.get("text-pitch-alignment"),r.paint.get("text-translate"),r.paint.get("text-translate-anchor"),o),0!==r.paint.get("icon-opacity").constantOr(1)&&aw(t,i,r,a,!1,r.paint.get("icon-translate"),r.paint.get("icon-translate-anchor"),r.layout.get("icon-rotation-alignment").constantOr("viewport"),r.layout.get("icon-pitch-alignment"),r.layout.get("icon-keep-upright"),n,l,s),0!==r.paint.get("text-opacity").constantOr(1)&&aw(t,i,r,a,!0,r.paint.get("text-translate"),r.paint.get("text-translate-anchor"),r.layout.get("text-rotation-alignment"),r.layout.get("text-pitch-alignment"),r.layout.get("text-keep-upright"),n,l,s),i.map.showCollisionBoxes&&(ax(t,i,r,a,!0,s),ax(t,i,r,a,!1,s))},circle:function(t,i,r,a,o){if("translucent"!==o.currentPass)return;let s=r.paint.get("circle-opacity"),n=r.paint.get("circle-stroke-width"),l=r.paint.get("circle-stroke-opacity"),h=!r.layout.get("
814circle-sort-key").isConstant();if(0===s.constantOr(1)&&(0===n.constantOr(1)||0===l.constantOr(1)))return;let c=t.context,u=c.gl,d=t.transform,_=t.getDepthModeForSublayer(0,am.ReadOnly),p=af.disabled,m=t.colorModeForRenderPass(),f=[],g=d.getCircleRadiusCorrection();for(let s of a){let a=i.getTile(s),n=a.getBucket(r);if(!n)continue;let l=r.paint.get("circle-translate"),c=r.paint.get("circle-translate-anchor"),u=(0,P.jr)(d,a,l,c),_=n.programConfigurations.get(r.id),p=t.useProgram("circle",_),m=n.layoutVertexBuffer,v=n.indexBuffer,y=ay(o,s),x={programConfiguration:_,program:p,layoutVertexBuffer:m,indexBuffer:v,uniformValues:rp(t,a,r,u,g),terrainData:y,projectionData:av(o,s)};if(h)for(let t of n.segments.get())f.push({segments:new P.Bt([t]),sortKey:t.sortKey,state:x});else f.push({segments:n.segments,sortKey:0,state:x})}for(let i of(h&&f.sort((t,i)=>t.sortKey-i.sortKey),f)){let{programConfiguration:a,program:o,layoutVertexBuffer:s,indexBuffer:n,uniformValues:l,terrainData:h,projectionData:d}=i.state,f=i.segments;o.draw(c,u.TRIANGLES,_,p,m,ag.backCCW,l,h,d,r.id,s,n,f,r.paint,t.transform.zoom,a)}},heatmap:function(t,i,r,a,o){if(0===r.paint.get("heatmap-opacity"))return;let s=t.context;if(t.style.map.terrain){for(let s of a){let a=i.getTile(s);i.hasRenderableParent(s)||("offscreen"===o.currentPass?function(t,i,r,a,o){let s=t.context,n=s.gl,l=af.disabled,h=new a_([n.ONE,n.ONE],P.fn.transparent,[!0,!0,!0,!0]),c=i.getBucket(r);if(!c)return;let u=a.key,d=r.heatmapFbos.get(u);d||(d=aP(s,i.tileSize,i.tileSize),r.heatmapFbos.set(u,d)),s.bindFramebuffer.set(d.framebuffer),s.viewport.set([0,0,i.tileSize,i.tileSize]),s.clear({color:P.fn.transparent});let _=c.programConfigurations.get(r.id),p=t.useProgram("heatmap",_,!o.isRenderingGlobe),m=av(o,i.tileID),f=ay(o,a);p.draw(s,n.TRIANGLES,am.disabled,l,h,ag.disabled,rf(i,t.transform.zoom,r.paint.get("heatmap-intensity"),1),f,m,r.id,c.layoutVertexBuffer,c.indexBuffer,c.segments,r.paint,t.transform.zoom,_)}(t,a,r,s,o):"translucent"===o.currentPass&&function(t,i,r,a){let o=t.context,s=o.gl,n=t.transform;o.setColorMode(t.colorModeForRenderPass());let l=aM(o,i),h=r.key,c=i.heatmapFbos.get(h);if(!c)return;o.activeTexture.set(s.TEXTURE0),s.bindTexture(s.TEXTURE_2D,c.colorAttachment.get()),o.activeTexture.set(s.TEXTURE1),l.bind(s.LINEAR,s.CLAMP_TO_EDGE);let u=av(a,r,{applyTerrainMatrix:a.isRenderingGlobe});t.useProgram("heatmapTexture").draw(o,s.TRIANGLES,am.disabled,af.disabled,t.colorModeForRenderPass(),ag.disabled,rg(t,i,0,1),null,u,i.id,t.rasterBoundsBuffer,t.quadTriangleIndexBuffer,t.rasterBoundsSegments,i.paint,n.zoom),c.destroy(),i.heatmapFbos.delete(h)}(t,r,s,o))}s.viewport.set([0,0,t.width,t.height])}else{var n,l;let s,h,c;"offscreen"===o.currentPass?function(t,i,r,a,o){var s,n,l;let h,c,u=t.context,d=u.gl,_=t.transform,p=af.disabled,m=new a_([d.ONE,d.ONE],P.fn.transparent,[!0,!0,!0,!0]);for(let f of(s=u,n=t,l=r,h=s.gl,s.activeTexture.set(h.TEXTURE1),s.viewport.set([0,0,n.width/4,n.height/4]),(c=l.heatmapFbos.get(P.Ct))?(h.bindTexture(h.TEXTURE_2D,c.colorAttachment.get()),s.bindFramebuffer.set(c.framebuffer)):(c=aP(s,n.width/4,n.height/4),l.heatmapFbos.set(P.Ct,c)),u.clear({color:P.fn.transparent}),a)){if(i.hasRenderableParent(f))continue;let a=i.getTile(f),s=a.getBucket(r);if(!s)continue;let n=s.programConfigurations.get(r.id),l=t.useProgram("heatmap",n),h=av(o,f,{applyTerrainMatrix:!1}),c=_.getCircleRadiusCorrection();l.draw(u,d.TRIANGLES,am.disabled,p,m,ag.backCCW,rf(a,_.zoom,r.paint.get("heatmap-intensity"),c),null,h,r.id,s.layoutVertexBuffer,s.indexBuffer,s.segments,r.paint,_.zoom,n)}u.viewport.set([0,0,t.width,t.height])}(t,i,r,a,o):"translucent"===o.currentPass&&(n=t,l=r,h=(s=n.context).gl,s.setColorMode(n.colorModeForRenderPass()),(c=l.heatmapFbos.get(P.Ct))&&(s.activeTexture.set(h.TEXTURE0),h.bindTexture(h.TEXTURE_2D,c.colorAttachment.get()),s.activeTexture.set(h.TEXTURE1),aM(s,l).bind(h.LINEAR,h.CLAMP_TO_EDGE),n.useProgram("heatmapTexture").draw(s,h.TRIANGLES,am.disabled,af.disabled,n.colorModeForRenderPass(),ag.disabled,rg(n,l,0,1),null,null,l.id,n.viewportBuffer,n.quadTriangleIndexBuffer,n.viewportSegments,l.paint,n.transform.zoom)))}},line:function(t,i,r,a,o){if("translucent"!==o.currentPass)return;let s=r.paint.get("line-opacity"),n=r.paint.get("line-width"),l=r.paint.get("line-layer-opacity");if(0!==s.constantOr(1)&&0!==n.constantOr(1)&&0!==l){if(l<1){let s=aC(t,r,a);aE(t,i,r,a,o),aI(t,l,s,r);return}aE(t,i,r,a,o)}},fill:function(t,i,r,a,o){let s=r.paint.get("fill-color"),n=r.paint.get("fill-opacity"),l=r.paint.get("fill-layer
814-opacity");if(0===n.constantOr(1)||0===l)return;if(l<1){if("translucent"!==o.currentPass)return;let s=aC(t,r,a);aR(t,i,r,a,o),aI(t,l,s,r);return}let h=r.paint.get("fill-pattern"),c=t.opaquePassEnabledForLayer()&&!h.constantOr(1)&&1===s.constantOr(P.fn.transparent).a&&1===n.constantOr(0);if(c&&"opaque"===o.currentPass){let s=t.colorModeForRenderPass();aL(t,i,r,a,t.getDepthModeForSublayer(1,am.ReadWrite),s,!1,o);return}c&&"translucent"===o.currentPass?aD(t,i,r,a,o):"translucent"===o.currentPass&&aR(t,i,r,a,o)},fillExtrusion:function(t,i,r,a,o){let s=r.paint.get("fill-extrusion-opacity");if(0!==s&&"translucent"===o.currentPass){let n=new am(t.context.gl.LEQUAL,am.ReadWrite,o.depthRangeFor3D);if(1!==s||r.paint.get("fill-extrusion-pattern").constantOr(1))aA(t,i,r,a,n,af.disabled,a_.disabled,o),aA(t,i,r,a,n,t.stencilModeFor3D(),t.colorModeForRenderPass(),o);else{let s=t.colorModeForRenderPass();aA(t,i,r,a,n,af.disabled,s,o)}}},hillshade:function(t,i,r,a,o){if("offscreen"!==o.currentPass&&"translucent"!==o.currentPass)return;let s=t.context,n=t.style.projection.useSubdivision,l=t.getDepthModeForSublayer(0,am.ReadOnly),h=t.colorModeForRenderPass();if("offscreen"===o.currentPass)(function(t,i,r,a,o,s,n){let l=t.context,h=l.gl,c="nearest"===a.paint.get("resampling")?h.NEAREST:h.LINEAR;for(let u of r){let r=i.getTile(u),d=r.dem;if(!d?.data||!r.needsHillshadePrepare)continue;let _=d.dim+2,p=d.stride,m=d.getPixels();if(l.activeTexture.set(h.TEXTURE1),l.pixelStoreUnpackPremultiplyAlpha.set(!1),r.demTexture||=t.getTileTexture(p),r.demTexture){let t=r.demTexture;t.update(m,{premultiply:!1}),t.bind(h.NEAREST,h.CLAMP_TO_EDGE)}else r.demTexture=new P.xt(l,m,h.RGBA,{premultiply:!1}),r.demTexture.bind(h.NEAREST,h.CLAMP_TO_EDGE);l.activeTexture.set(h.TEXTURE0);let f=r.fbo;if(!f){let t=new P.xt(l,{width:_,height:_,data:null},h.RGBA);t.bind(c,h.CLAMP_TO_EDGE),(f=r.fbo=l.createFramebuffer(_,_,!0,!1)).colorAttachment.set(t.texture)}l.bindFramebuffer.set(f.framebuffer),l.viewport.set([0,0,_,_]),t.useProgram("hillshadePrepare").draw(l,h.TRIANGLES,o,s,n,ag.disabled,ry(r.tileID,d),null,null,a.id,t.rasterBoundsBuffer,t.quadTriangleIndexBuffer,t.rasterBoundsSegments),r.needsHillshadePrepare=!1}})(t,i,a,r,l,af.disabled,h),s.viewport.set([0,0,t.width,t.height]);else if("translucent"===o.currentPass)if(n){let[s,n,c]=t.stencilConfigForOverlapTwoPass(a);aF(t,i,r,c,s,l,h,!1,o),aF(t,i,r,c,n,l,h,!0,o)}else{let[s,n]=t.getStencilConfigForOverlapAndUpdateStencilID(a);aF(t,i,r,n,s,l,h,!1,o)}},colorRelief:function(t,i,r,a,o){if("translucent"!==o.currentPass||!a.length)return;let s=t.style.projection.useSubdivision,n=t.getDepthModeForSublayer(0,am.ReadOnly),l=t.colorModeForRenderPass();if(s){let[s,h,c]=t.stencilConfigForOverlapTwoPass(a);aB(t,i,r,c,s,n,l,!1,o),aB(t,i,r,c,h,n,l,!0,o)}else{let[s,h]=t.getStencilConfigForOverlapAndUpdateStencilID(a);aB(t,i,r,h,s,n,l,!1,o)}},raster:function(t,i,r,a,o){if("translucent"!==o.currentPass||0===r.paint.get("raster-opacity")||!a.length)return;let s=i.getSource(),n=t.style.projection.useSubdivision;if(s instanceof eX)aj(t,i,r,a,null,!1,!1,s.tileCoords,s.imageWarp,s.flippedWindingOrder,o,s.getMesh(t.context,n));else if(n){let[s,n,l]=t.stencilConfigForOverlapTwoPass(a);aj(t,i,r,l,s,!1,!0,aO,eG,!1,o),aj(t,i,r,l,n,!0,!0,aO,eG,!1,o)}else{let[s,n]=t.getStencilConfigForOverlapAndUpdateStencilID(a);aj(t,i,r,n,s,!1,!0,aO,eG,!1,o)}},background:function(t,i,r,a,o){let s=r.paint.get("background-color"),n=r.paint.get("background-opacity");if(0===n)return;let l=t.context,h=l.gl,c=t.style.projection,u=t.transform,d=u.tileSize,_=r.paint.get("background-pattern");if(t.isPatternMissing(_))return;let p=!_&&1===s.a&&1===n&&t.opaquePassEnabledForLayer()?"opaque":"translucent";if(o.currentPass!==p)return;let m=af.disabled,f=t.getDepthModeForSublayer(0,"opaque"===p?am.ReadWrite:am.ReadOnly),g=t.colorModeForRenderPass(),v=t.useProgram(_?"backgroundPattern":"background"),y=a||tr(u,{tileSize:d,terrain:t.style.map.terrain});_&&(l.activeTexture.set(h.TEXTURE0),t.patternAtlas.bind(t.context));let x=r.getCrossfadeParameters();for(let i of y){let a=av(o,i),u=_?rD(n,t,_,{tileID:i,tileSize:d},x):rR(n,s),p=ay(o,i),y=c.getMeshFromTileID(l,i.canonical,!1,!0,"raster");v.draw(l,h.TRIANGLES,f,m,g,ag.backCCW,u,p,a,r.id,y.vertexBuffer,y.indexBuffer,y.segments)}},sky:function(t,i){var r,a;let o,s,n,l,h,c,u=t.context,d=u.gl,_=(r=t.transform,a=t.pixelRatio,o=Math.cos(r.rollInRadians),s=Math.sin(r.rollInRadians),n=(0,P.Z)(r),l=r.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}).projectionTransition,h=iR(r),c=iz(r.worldSize,r.center.lat),{u_sky_color:i.properties.get("sky-color"),u_horizon_color:i.properties.get("horizon-color"),u_horizon:[(r.width/2-n*s)*a,(r.height/2+n*o)*a],u_horizon_normal:[-s,o],u_sky_horizon_blend:i.properties.get("sky-horizon-blend")*r.height/2*a,u_sky_blend:l,u_inv_proj_matrix:r.inverseProjectionMatrix,u_globe_position:h,u_globe_radius:c,u_atmosphere_blend:i.properties.get("atmosphere-blend")*iN((0,P.ni)(h)-c,c)}),p=new am(d.LEQUAL,am.ReadWrite,[0,1]),m=af.disabled,f=t.colorModeForRenderPass(),g=t.useProgram("sky"),v=aH(u,i);g.draw(u,d.TRIANGLES,p,m,f,ag.disabled,_,null,void 0,"sky",v.vertexBuffer,v.indexBuffer,v.segments)},atmosphere:function(t,i,r){var a;let o,s,n=t.context,l=n.gl,h=t.useProgram("atmosphere"),c=new am(l.LEQUAL,am.ReadOnly,[0,1]),u=t.transform,d=(a=t.transform,o=r.getCartesianPosition(),(0,P.ri)(o,o),s=(0,P.Si)(new Float64Array(16)),"map"===r.properties.get("anchor")&&((0,P.ki)(s,s,a.rollInRadians),(0,P.Di)(s,s,-a.pitchInRadians),(0,P.ki)(s,s,a.bearingInRadians),(0,P.Di)(s,s,a.center.lat*Math.PI/180),(0,P.Oi)(s,s,-a.center.lng*Math.PI/180)
814),(0,P.pi)(o,o,s),o),_=u.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),p=iz(u.worldSize,u.center.lat),m=iR(u),f=iN((0,P.ni)(m)-p,p),g=i.properties.get("atmosphere-blend")*_.projectionTransition*f;if(0===g)return;let v={u_sun_pos:d,u_atmosphere_blend:g,u_globe_position:m,u_globe_radius:p,u_inv_proj_matrix:u.inverseProjectionMatrix},y=aH(n,i);h.draw(n,l.TRIANGLES,c,af.disabled,a_.alphaBlended,ag.disabled,v,null,null,"atmosphere",y.vertexBuffer,y.indexBuffer,y.segments)},custom:function(t,i,r,a){let{isRenderingGlobe:o}=a,s=t.context,n=r.implementation,l=t.style.projection,h=t.transform,c=h.getProjectionDataForCustomLayer(o),u={farZ:h.farZ,nearZ:h.nearZ,fov:h.fov*Math.PI/180,modelViewProjectionMatrix:h.modelViewProjectionMatrix,projectionMatrix:h.projectionMatrix,shaderData:{variantName:l.shaderVariantName,vertexShaderPrelude:`const float PI = 3.141592653589793; 815uniform mat4 u_projection_matrix; 816${l.shaderPreludeCode.vertexSource}`,define:l.shaderDefine},defaultProjectionData:c,getProjectionData:t=>h.getProjectionData({overscaledTileID:new P.d(t.tileID.canonical.z,t.tileID.wrap??0,t.tileID.canonical.z,t.tileID.canonical.x,t.tileID.canonical.y),aligned:t.aligned,applyGlobeMatrix:t.applyGlobeMatrix,applyTerrainMatrix:t.applyTerrainMatrix})},d=n.renderingMode?n.renderingMode:"2d";if("offscreen"===a.currentPass){let i=n.prerender;i&&(t.setCustomLayerDefaults(),s.setColorMode(t.colorModeForRenderPass()),i.call(n,s.gl,u),s.setDirty(),t.setBaseState())}else if("translucent"===a.currentPass){t.setCustomLayerDefaults(),s.setColorMode(t.colorModeForRenderPass()),s.setStencilMode(af.disabled);let i="3d"===d?t.getDepthModeFor3D():t.getDepthModeForSublayer(0,am.ReadOnly);s.setDepthMode(i),n.render(s.gl,u),s.setDirty(),t.setBaseState(),s.bindFramebuffer.set(null)}},debug:function(t,i,r,a){for(let o of r)!function(t,i,r,a){let o=t.context,s=o.gl,n=t.useProgram("debug"),l=am.disabled,h=af.disabled,c=t.colorModeForRenderPass(),u="$debug",d=ay(a,r);o.activeTexture.set(s.TEXTURE0);let _=Math.floor((i.getTileByID(r.key).latestRawTileData?.byteLength||0)/1024),p=512/Math.min(i.getTile(r).tileSize,512)*(r.overscaledZ/t.transform.zoom)*.5,m=r.canonical.toString();r.overscaledZ!==r.canonical.z&&(m+=` => ${r.overscaledZ}`),function(t,i){t.initDebugOverlayCanvas();let r=t.debugOverlayCanvas,a=t.context.gl,o=t.debugOverlayCanvas.getContext("2d");o.clearRect(0,0,r.width,r.height),o.shadowColor="white",o.shadowBlur=2,o.lineWidth=1.5,o.strokeStyle="white",o.textBaseline="top",o.font="bold 36px Open Sans, sans-serif",o.fillText(i,5,5),o.strokeText(i,5,5),t.debugOverlayTexture.update(r),t.debugOverlayTexture.bind(a.LINEAR,a.CLAMP_TO_EDGE)}(t,`${m} ${_}kB`);let f=av(a,r);n.draw(o,s.TRIANGLES,l,h,a_.alphaBlended,ag.disabled,rm(P.fn.transparent,p),null,f,u,t.debugBuffer,t.quadTriangleIndexBuffer,t.debugSegments),n.draw(o,s.LINE_STRIP,l,h,c,ag.disabled,rm(P.fn.red),d,f,u,t.debugBuffer,t.tileBorderIndexBuffer,t.debugSegments)}(t,i,o,a)},debugPadding:function(t){var i,r,a,o;let s=t.transform.padding;aq(t,t.transform.height-(s.top||0),3,aN),aq(t,s.bottom||0,3,aZ),aW(t,s.left||0,3,aU),aW(t,t.transform.width-(s.right||0),3,aG);let n=t.transform.centerPoint;i=t,r=n.x,a=t.transform.height-n.y,a$(i,r-1,a-10,2,20,o=aV),a$(i,r-10,a-1,20,2,o)},terrainDepth:function(t,i){let r=t.context,a=r.gl,o=t.transform,s=a_.unblended,n=new am(a.LEQUAL,am.ReadWrite,[0,1]),l=i.tileManager.getRenderableTiles(),h=t.useProgram("terrainDepth");for(let c of(r.bindFramebuffer.set(i.getFramebuffer().framebuffer),r.viewport.set([0,0,t.width/devicePixelRatio,t.height/devicePixelRatio]),r.clear({color:P.fn.white,depth:1}),l)){let t=i.getTerrainMesh(c.tileID),l=i.getTerrainData(c.tileID),u=o.getProjectionData({overscaledTileID:c.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0}),d=i6(i.getSkirtLength(o.zoom));h.draw(r,a.TRIANGLES,n,af.disabled,s,ag.backCCW,d,l,u,"terrain",t.vertexBuffer,t.indexBuffer,t.segments)}r.bindFramebuffer.set(null),r.viewport.set([0,0,t.width,t.height])}};var aY=class t{constructor(t,i){this.drawFunctions=aX,this.context=new ap(t),this.transform=i,this.layerOpacityFbo=null,this._tileTextures={},this._rttObjectRecyclePool=[],this._rttSharedFbo=null,this.terrainFacilitator={depthDirty:!0,matrix:(0,P.Si)(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=tl.maxOverzooming+tl.maxUnderzooming+1,this.depthEpsilon=1/65536,this.crossTileSymbolIndex=new t0}resize(t,i,r){if(this.width=Math.floor(t*r),this.height=Math.floor(i*r),this.pixelRatio=r,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(let t of this.style._order)this.style._layers[t].resize()}setup(){let t=this.context,i=new P.Gt;i.emplaceBack(0,0),i.emplaceBack(P.Lr,0),i.emplaceBack(0,P.Lr),i.emplaceBack(P.Lr,P.Lr),this.tileExtentBuffer=t.createVertexBuffer(i,eW.members),this.tileExtentSegments=P.Bt.simpleSegment(0,0,4,2);let r=new P.Gt;r.emplaceBack(0,0),r.emplaceBack(P.Lr,0),r.emplaceBack(0,P.Lr),r.emplaceBack(P.Lr,P.Lr),this.debugBuffer=t.createVertexBuffer(r,eW.members),this.debugSegments=P.Bt.simpleSegment(0,0,4,5);let a=new P.qt;a.emplaceBack(0,0,0,0),a.emplaceBack(P.Lr,0,P.Lr,0),a.emplaceBack(0,P.Lr,0,P.Lr),a.emplaceBack(P.Lr,P.Lr,P.Lr,P.Lr),this.rasterBoundsBuffer=t.createVertexBuffer(a,i4.members),this.rasterBoundsSegments=P.Bt.simpleSegment(0,0,4,2);let o=new P.Gt;o.emplaceBack(0,0),o.emplaceBack(P.Lr,0),o.emplaceBack(0,P.Lr),o.emplaceBack(P.Lr,P.Lr),this.rasterBoundsBufferPosOnly=t.createVertexBuffer(o,eW.members),this.rasterBoundsSegmentsPosOnly=P.Bt.simpleSegment(0,0,4,5);let s=new P.Gt;
816s.emplaceBack(0,0),s.emplaceBack(1,0),s.emplaceBack(0,1),s.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(s,eW.members),this.viewportSegments=P.Bt.simpleSegment(0,0,4,2);let n=new P.Ut;n.emplaceBack(0),n.emplaceBack(1),n.emplaceBack(3),n.emplaceBack(2),n.emplaceBack(0),this.tileBorderIndexBuffer=t.createIndexBuffer(n);let l=new P.Jt;l.emplaceBack(1,0,2),l.emplaceBack(1,2,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(l);let h=this.context.gl;this.stencilClearMode=new af({func:h.ALWAYS,mask:0},0,255,h.ZERO,h.ZERO,h.ZERO),this.tileExtentMesh=new eq(this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}clearStencil(){let t=this.context,i=t.gl;this.nextStencilID=1,this.currentStencilSource=void 0;let r=(0,P.vi)();(0,P.Ti)(r,0,this.width,this.height,0,0,1),(0,P.Ai)(r,r,[i.drawingBufferWidth,i.drawingBufferHeight,0]),this.useProgram("clippingMask",null,!0).draw(t,i.TRIANGLES,am.disabled,this.stencilClearMode,a_.disabled,ag.disabled,null,null,{mainMatrix:r,tileMercatorCoords:[0,0,1,1],clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:r,clipAntimeridian:!1},"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}renderTileClippingMasks(t,i){if(this.currentStencilSource===t.source||!t.isTileClipped()||!i?.length)return;this.currentStencilSource=t.source,this.nextStencilID+i.length>256&&this.clearStencil();let r=this.context;r.setColorMode(a_.disabled),r.setDepthMode(am.disabled);let a={};for(let t of i)a[t.key]=this.nextStencilID++;this.style.projection.useSubdivision&&this._renderTileMasks(a,i,!0),this._renderTileMasks(a,i,!1),this._tileClippingMaskIDs=a}_renderTileMasks(t,i,r){let a=this.context,o=a.gl,s=this.style.projection,n=this.renderContext,l=this.useProgram("clippingMask");for(let h of i){let i=t[h.key],c=ay(n,h),u=s.getMeshFromTileID(this.context,h.canonical,r,!0,"stencil"),d=av(n,h);l.draw(a,o.TRIANGLES,am.disabled,new af({func:o.ALWAYS,mask:0},i,255,o.KEEP,o.KEEP,o.REPLACE),a_.disabled,n.isRenderingToTexture?ag.disabled:ag.backCCW,null,c,d,"$clipping",u.vertexBuffer,u.indexBuffer,u.segments)}}_renderTilesDepthBuffer(){let t=this.context,i=t.gl,r=this.style.projection,a=this.transform,o=this.useProgram("depth"),s=this.getDepthModeFor3D();for(let n of tr(a,{tileSize:a.tileSize})){let a=ay(this.renderContext,n),l=r.getMeshFromTileID(this.context,n.canonical,!0,!0,"raster"),h=av(this.renderContext,n);o.draw(t,i.TRIANGLES,s,af.disabled,a_.disabled,ag.backCCW,null,a,h,"$clipping",l.vertexBuffer,l.indexBuffer,l.segments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();let t=this.nextStencilID++,i=this.context.gl;return new af({func:i.NOTEQUAL,mask:255},t,255,i.KEEP,i.KEEP,i.REPLACE)}stencilModeForClipping(t){let i=this.context.gl;return new af({func:i.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,i.KEEP,i.KEEP,i.REPLACE)}getStencilConfigForOverlapAndUpdateStencilID(t){let i=this.context.gl,r=t.sort((t,i)=>i.overscaledZ-t.overscaledZ),a=r[r.length-1].overscaledZ,o=r[0].overscaledZ-a+1;if(o>1){this.currentStencilSource=void 0,this.nextStencilID+o>256&&this.clearStencil();let t={};for(let r=0;r<o;r++)t[r+a]=new af({func:i.GEQUAL,mask:255},r+this.nextStencilID,255,i.KEEP,i.KEEP,i.REPLACE);return this.nextStencilID+=o,[t,r]}return[{[a]:af.disabled},r]}stencilConfigForOverlapTwoPass(t){let i=this.context.gl,r=t.sort((t,i)=>i.overscaledZ-t.overscaledZ),a=r[r.length-1].overscaledZ,o=r[0].overscaledZ-a+1;if(this.clearStencil(),o>1){let t={},s={};for(let r=0;r<o;r++)t[r+a]=new af({func:i.GREATER,mask:255},o+1+r,255,i.KEEP,i.KEEP,i.REPLACE),s[r+a]=new af({func:i.GREATER,mask:255},1+r,255,i.KEEP,i.KEEP,i.REPLACE);return this.nextStencilID=2*o+1,[t,s,r]}return this.nextStencilID=3,[{[a]:new af({func:i.GREATER,mask:255},2,255,i.KEEP,i.KEEP,i.REPLACE)},{[a]:new af({func:i.GREATER,mask:255},1,255,i.KEEP,i.KEEP,i.REPLACE)},r]}colorModeForRenderPass(){let t=this.context.gl;if(this._showOverdrawInspector){let i=1/8;return new a_([t.CONSTANT_COLOR,t.ONE],new P.fn(i,i,i,0),[!0,!0,!0,!0])}return"opaque"===this.renderContext.currentPass?a_.unblended:a_.alphaBlended}getDepthModeForSublayer(t,i,r){if(!this.opaquePassEnabledForLayer())return am.disabled;let a=1-((1+this.renderContext.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new am(r||this.context.gl.LEQUAL,i,[a,a])}getDepthModeFor3D(){return new am(this.context.gl.LEQUAL,am.ReadWrite,this.renderContext.depthRangeFor3D)}opaquePassEnabledForLayer(){return this.renderContext.currentLayer<this.renderContext.opaquePassCutoff}render(t,i){var r,a;let o;this.style=t,this.options=i;let s=this.renderContext=(r=this.transform,a=t.projection,{currentPass:"offscreen",currentLayer:0,opaquePassCutoff:1/0,depthRangeFor3D:[0,1],isRenderingToTexture:!1,transform:r,terrain:t.map.terrain??null,projectionTransition:o=a?.transitionState??0,isRenderingGlobe:o>0});this.lineAtlas=t.lineAtlas,this.imageManager=t.imageManager,this.patternAtlas=t.patternAtlas,this.glyphManager=t.glyphManager,this.symbolFadeChange=t.placement.symbolFadeChange(S()),function(t,i){let r=t.pending,{transform:a}=i,o=i.context.gl;r[ad.u_units_to_pixels]=1/a.pixelsToGLUnits[0],r[ad.u_units_to_pixels+1]=1/a.pixelsToGLUnits[1],r[ad.u_world_size]=o.drawingBufferWidth,r[ad.u_world_size+1]=o.drawingBufferHeight,r[ad.u_camera_to_center_distance]=a.cameraToCenterDistance,r[ad.u_symbol_fade_change]=i.options.fadeDuration?i.symbolFadeChange:1,r[ad.u_aspect_ratio]=a.width/a.height,r[ad.u_device_pixel_ratio]=i.pixelRatio,r[ad.u_viewport_size]=a.width,r[ad.u_viewport_size+1]=a.height,r[ad.u_pixel_extrude_scale]=1/a.width,r[ad.u_pixel_extrude_scale+1]=1/a.height,r[ad.u_pitch]=a.pitch/360*2*Math.PI,t.upload()}(this.context.frameUniformBuffer,this),this.imageManager.beginFrame();let n=this.style._order,l=this.style.tileManagers,h={},c={},u={};for(let t in l){let i=l[t];i.used&&i.prepare(this.context),h[t]=i.getVisibleCoordinates(!1),c[t]=h[t].slice().reverse(),u[t]=i.getVisibleCoordinates(!0).reverse()}s.opaquePassCutoff=1/0;for(let t=0;t<n.length;t++){let i=n[t];if(this.style._layers[i].is3D()){s.opaquePassCutoff=t;break}}for(let t of(this.maybeDrawDepth(),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),s.opaquePassCutoff=0),s.currentPass="offscreen",n)){let i=this.style._layers[t];
816if(!i.hasOffscreenPass()||i.isHidden(this.transform.zoom))continue;let r=c[i.source];("custom"===i.type||r.length)&&this.renderLayer(this,l[i.source],i,r,s)}if(this.context.viewport.set([0,0,this.width,this.height]),this.context.bindFramebuffer.set(null),this.context.clear({color:i.showOverdrawInspector?P.fn.black:P.fn.transparent,depth:1}),this.clearStencil(),this.style.sky&&this.drawFunctions.sky(this,this.style.sky),this._showOverdrawInspector=i.showOverdrawInspector,s.depthRangeFor3D=[0,1-(t._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(s.currentPass="opaque",s.currentLayer=n.length-1;s.currentLayer>=0;s.currentLayer--){let t=this.style._layers[n[s.currentLayer]];if(t.isHidden(this.transform.zoom))continue;let i=l[t.source],r=h[t.source];this.renderTileClippingMasks(t,r),this.renderLayer(this,i,t,r,s)}s.currentPass="translucent";let d=!1;for(s.currentLayer=0;s.currentLayer<n.length;s.currentLayer++){let t=this.style._layers[n[s.currentLayer]];if(t.isHidden(this.transform.zoom))continue;let i=l[t.source];if(this.renderToTexture?.renderLayer(t,s))continue;this.opaquePassEnabledForLayer()||d||(d=!0,s.isRenderingGlobe&&!this.style.map.terrain&&this._renderTilesDepthBuffer());let r=("symbol"===t.type?u:c)[t.source];this.renderTileClippingMasks(t,h[t.source]),this.renderLayer(this,i,t,r,s)}if(s.isRenderingGlobe&&this.drawFunctions.atmosphere(this,this.style.sky,this.style.light),this.options.showTileBoundaries){let t=function(t,i){let r=null,a=Object.values(t._layers).flatMap(r=>r.source&&!r.isHidden(i)?[t.tileManagers[r.source]]:[]),o=a.filter(t=>"vector"===t.getSource().type),s=a.filter(t=>"vector"!==t.getSource().type),n=t=>{(!r||r.getSource().maxzoom<t.getSource().maxzoom)&&(r=t)};for(let t of o)n(t);if(!r)for(let t of s)n(t);return r}(this.style,this.transform.zoom);t&&this.drawFunctions.debug(this,t,t.getVisibleCoordinates(),s)}this.options.showPadding&&this.drawFunctions.debugPadding(this),this.renderToTexture&&!this.options.moving&&this.clearRTTPool(),this.context.setDefault()}markTerrainDepthDirty(){this.terrainFacilitator.depthDirty=!0}maybeDrawDepth(){if(!this.style?.projection||!this.style.map?.terrain)return;let t=this.terrainFacilitator.matrix,i=this.transform.modelViewProjectionMatrix,r=this.terrainFacilitator.depthDirty;r||=!(0,P.yi)(t,i),(r||=this.style.map.terrain.tileManager.anyTilesAfterTime(this.terrainFacilitator.renderTime))&&((0,P._i)(t,i),this.terrainFacilitator.renderTime=S(),this.terrainFacilitator.depthDirty=!1,this.drawFunctions.terrainDepth(this,this.style.map.terrain))}renderLayer(t,i,r,a,o){if(r.isHidden(this.transform.zoom)||"background"!==r.type&&"custom"!==r.type&&!(a||[]).length)return;this.id=r.id;let s=this.drawFunctions;(0,P.x)(r)?s.symbol(t,i,r,a,this.style.placement.variableOffsets,o):(0,P.Ot)(r)?s.circle(t,i,r,a,o):(0,P.wt)(r)?s.heatmap(t,i,r,a,o):(0,P.W)(r)?s.line(t,i,r,a,o):(0,P.mt)(r)?s.fill(t,i,r,a,o):(0,P.K)(r)?s.fillExtrusion(t,i,r,a,o):(0,P.St)(r)?s.hillshade(t,i,r,a,o):(0,P.yt)(r)?s.colorRelief(t,i,r,a,o):(0,P.Xt)(r)?s.raster(t,i,r,a,o):(0,P.b)(r)?s.background(t,i,r,a,o):(0,P.v)(r)&&s.custom(t,i,r,o)}static{this.MAX_TEXTURE_POOL_SIZE_PER_BUCKET=50}saveTileTexture(i){let r=this._tileTextures[i.size[0]];r?r.length<t.MAX_TEXTURE_POOL_SIZE_PER_BUCKET?r.push(i):i.destroy():this._tileTextures[i.size[0]]=[i]}getTileTexture(t){let i=this._tileTextures[t];return i&&i.length>0?i.pop():null}acquireRTT(t){let i=this.context.gl,r=this._rttObjectRecyclePool.pop();if(r)return r.size!==t&&(r.texture.update({width:t,height:t,data:null},{premultiply:!1,useMipmap:!0}),r.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE,i.LINEAR_MIPMAP_LINEAR),this.context.extTextureFilterAnisotropic&&i.texParameterf(i.TEXTURE_2D,this.context.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,this.context.extTextureFilterAnisotropicMax),r.size=t),r;let a=new P.xt(this.context,{width:t,height:t,data:null},i.RGBA,{premultiply:!1,useMipmap:!0});return a.bind(i.LINEAR,i.CLAMP_TO_EDGE,i.LINEAR_MIPMAP_LINEAR),this.context.extTextureFilterAnisotropic&&i.texParameterf(i.TEXTURE_2D,this.context.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,this.context.extTextureFilterAnisotropicMax),{texture:a,size:t}}bindRTT(t){let i=this.context.gl,r=t.size;if(!this._rttSharedFbo){let t=this.context.createFramebuffer(r,r,!0,!0),a=this.context.createRenderbuffer(i.DEPTH_STENCIL,r,r);t.depthAttachment.set(a),this._rttSharedFbo={fbo:t,depthRenderbuffer:a,size:r}}this._rttSharedFbo.size!==r&&(this.context.bindRenderbuffer.set(this._rttSharedFbo.depthRenderbuffer),i.renderbufferStorage(i.RENDERBUFFER,i.DEPTH_STENCIL,r,r),this.context.bindRenderbuffer.set(null),this._rttSharedFbo.fbo.width=r,this._rttSharedFbo.fbo.height=r,this._rttSharedFbo.size=r),this._rttSharedFbo.fbo.colorAttachment.set(t.texture.texture),this.context.bindFramebuffer.set(this._rttSharedFbo.fbo.framebuffer)}releaseRTT(t){this._rttObjectRecyclePool.push(t)}clearRTTPool(){for(let t of this._rttObjectRecyclePool)t.texture.destroy();this._rttObjectRecyclePool.length=0}destroyRTTResources(){if(this.clearRTTPool(),!this._rttSharedFbo)return;this._rttSharedFbo.fbo.colorAttachment.set(null),this._rttSharedFbo.fbo.depthAttachment.set(null);let t=this.context.gl;t.deleteRenderbuffer(this._rttSharedFbo.depthRenderbuffer),t.deleteFramebuffer(this._rttSharedFbo.fbo.framebuffer),this._rttSharedFbo=null}isPatternMissing(t){if(!t)return!1;if(!t.from||!t.to)return!0;let i=this.patternAtlas.getPattern(t.from.toString()),r=this.patternAtlas.getPattern(t.to.toString());return!i||!r}useProgram(t,i,r=!1,a=[]){this.cache||={};let o=!!this.style.map.terrain,s=this.style.projection,n=r?t6.projectionMercator:s.shaderPreludeCode,l=r?t9:s.shaderDefine,h=`/${r?t7:s.shaderVariantName}`,c=t+(i?i.cacheKey:"")+h+(this._showOverdrawInspector?"/overdraw":"")+(o?"/terrain":"")+(a?`/${a.join("/")}`:"");return this.cache[c]||=new rs(this.context,t6[t],i,rA[t],this._showOverdrawInspector,o,n,l,a),this.cache[c]}setCustomLayerDefaults(){this.context.setCustomLayerDefaults()}setBaseState(){let t=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t.FUNC_ADD)}initDebugOverlayCanvas(){if(null==this.debugOverlayCanvas){this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512;let t=this.context.gl;this.debugOverlayTexture=new P.xt(this.context,this.debugOverlayCanvas,t.RGBA)}}destroy(){if(this._tileTextures){for(let t in this._tileTextures){let i=this._tileTextures[t];
vendor: 5,109 bytes, line 816
816if(i)for(let t of i)t.destroy()}this._tileTextures={}}if(this.destroyRTTResources(),this.layerOpacityFbo?.destroy(),this.layerOpacityFbo=null,this.tileExtentBuffer&&this.tileExtentBuffer.destroy(),this.debugBuffer&&this.debugBuffer.destroy(),this.rasterBoundsBuffer&&this.rasterBoundsBuffer.destroy(),this.rasterBoundsBufferPosOnly&&this.rasterBoundsBufferPosOnly.destroy(),this.viewportBuffer&&this.viewportBuffer.destroy(),this.tileBorderIndexBuffer&&this.tileBorderIndexBuffer.destroy(),this.quadTriangleIndexBuffer&&this.quadTriangleIndexBuffer.destroy(),this.tileExtentMesh&&this.tileExtentMesh.vertexBuffer?.destroy(),this.tileExtentMesh&&this.tileExtentMesh.indexBuffer?.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this.context.projectionUniformBuffer.destroy(),this.context.terrainUniformBuffer.destroy(),this.context.frameUniformBuffer.destroy(),this.cache){for(let t in this.cache){let i=this.cache[t];i?.program&&this.context.gl.deleteProgram(i.program)}this.cache={}}this.context&&this.context.setDefault()}overLimit(){let{drawingBufferWidth:t,drawingBufferHeight:i}=this.context.gl;return this.width!==t||this.height!==i}},aK=class extends Error{constructor(t,i){super("WebGL2 is required to display this map. We are sorry, but it seems that your browser does not support WebGL2, a technology for rendering 3D graphics on the web. Read more on https://wiki.openstreetmap.org/wiki/This_map_requires_WebGL"),this.name="GPUInitializationError",this.requestedAttributes=t,this.statusMessage=i?.statusMessage??null}};function aJ(t,i){let r=!1,a=null,o,s=()=>{a=null,r&&=(t(...o),a=setTimeout(s,i),!1)};return(...t)=>(r=!0,o=t,a||s(),a)}var aQ=class{constructor(t){this._getHashParams=()=>new URLSearchParams(window.location.hash.replace("#","")),this._getCurrentHash=()=>{let t=this._getHashParams();return this._hashName?(t.get(this._hashName)||"").split("/"):([...t.keys()][0]??"").split("/")},this._onHashChange=()=>{let t=this._getCurrentHash();if(!this._isValidHash(t))return!1;let i=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(t[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:i,pitch:+(t[4]||0)}),!0},this._updateHashUnthrottled=()=>{let t=window.location.href.replace(/(#.*)?$/,this.getHashString());window.history.replaceState(window.history.state,null,t)},this._removeHash=()=>{let t=this._getHashParams();if(this._hashName)t.delete(this._hashName);else{let i=Array.from(t.keys());i.length>0&&t.delete(i[0])}let i=decodeURIComponent(t.toString()).replace(/=&/g,"&").replace(/=$/g,""),r=i?`#${i}`:"",a=window.location.href.replace(/(#.+)?$/,r);a=a.replace("&&","&"),window.history.replaceState(window.history.state,null,a)},this._updateHash=aJ(this._updateHashUnthrottled,300),this._hashName=t&&encodeURIComponent(t)}addTo(t){return this._map=t,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),this._removeHash(),delete this._map,this}getHashString(t){let i=this._map.getCenter(),r=Math.round(100*this._map.getZoom())/100,a=10**Math.ceil((r*Math.LN2+Math.log(512/360/.5))/Math.LN10),o=Math.round(i.lng*a)/a,s=Math.round(i.lat*a)/a,n=this._map.getBearing(),l=this._map.getPitch(),h="";if(h+=t?`/${o}/${s}/${r}`:`${r}/${s}/${o}`,(n||l)&&(h+=`/${Math.round(10*n)/10}`),l&&(h+=`/${Math.round(l)}`),this._hashName){let t=this._getHashParams();return t.set(this._hashName,h),`#${decodeURIComponent(t.toString()).replace(/=&/g,"&").replace(/=$/g,"")}`}return`#${h}`}_isValidHash(t){if(t.length<3||t.some(t=>isNaN(+t)))return!1;try{new P.lt(+t[2],+t[1])}catch{return!1}let i=+t[0],r=+(t[3]||0),a=+(t[4]||0);return i>=this._map.getMinZoom()&&i<=this._map.getMaxZoom()&&r>=-180&&r<=180&&a>=this._map.getMinPitch()&&a<=this._map.getMaxPitch()}};let a0={linearity:.3,easing:(0,P.zn)(0,0,.3,1)},a1=(0,P.er)({deceleration:2500,maxSpeed:1400},a0),a2=(0,P.er)({deceleration:20,maxSpeed:1400},a0),a4=(0,P.er)({deceleration:1e3,maxSpeed:360},a0),a3=(0,P.er)({deceleration:1e3,maxSpeed:90},a0),a5=(0,P.er)({deceleration:1e3,maxSpeed:360},a0);var a6=class{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:S(),settings:t})}_drainInertiaBuffer(){let t=this._inertiaBuffer,i=S();for(;t.length>0&&i-t[0].time>160;)t.shift()}_getVelocityEntries(){let t=this._inertiaBuffer,i=S()-60,r=Math.max(0,t.length-2);for(;r>0&&t[r-1].time>=i;)r--;return t.slice(r)}_onMoveEnd(t){this._drainInertiaBuffer();let i=this._getVelocityEntries();if(i.length<2)return void this.clear();let r={zoom:0,bearing:0,pitch:0,roll:0,pan:new P.Li(0,0),pinchAround:void 0,around:void 0};for(let{settings:t}of i)t.around&&(r.around=t.around),t.pinchAround&&(r.pinchAround=t.pinchAround);for(let{settings:t}of i.slice(1))r.zoom+=t.zoomDelta||0,r.bearing+=t.bearingDelta||0,r.pitch+=t.pitchDelta||0,r.roll+=t.rollDelta||0,t.panDelta&&r.pan._add(t.panDelta);
816if(!r.pan.mag()&&!r.zoom&&!r.bearing&&!r.pitch&&!r.roll)return void this.clear();let a=S()-i[0].time,o={};if(r.pan.mag()){let i=a9(r.pan.mag(),a,(0,P.er)({},a1,t||{})),s=r.pan.mult(i.amount/r.pan.mag()),n=this._map._camera.cameraHelper.handlePanInertia(s,this._map._camera.transform);o.center=n.easingCenter,o.offset=n.easingOffset,a8(o,i)}if(r.zoom){let t=a9(r.zoom,a,a2);o.zoom=(0,P.$n)(this._map.getZoom()+t.amount,this._map.getZoomSnap(),t.amount),a8(o,t)}if(r.bearing){let t=a9(r.bearing,a,a4);o.bearing=this._map.getBearing()+(0,P.Bn)(t.amount,-179,179),a8(o,t)}if(r.pitch){let t=a9(r.pitch,a,a3);o.pitch=this._map.getPitch()+t.amount,a8(o,t)}if(r.roll){let t=a9(r.roll,a,a5);o.roll=this._map.getRoll()+(0,P.Bn)(t.amount,-179,179),a8(o,t)}if(o.zoom||o.bearing){let t=void 0===r.pinchAround?r.around:r.pinchAround;o.around=t?this._map.unproject(t):this._map.getCenter()}return this.clear(),(0,P.er)(o,{noMoveStart:!0})}};function a8(t,i){(!t.duration||t.duration<i.duration)&&(t.duration=i.duration,t.easing=i.easing)}function a9(t,i,r){let{maxSpeed:a,linearity:o,deceleration:s}=r,n=(0,P.Bn)(t*o/(i/1e3),-a,a),l=Math.abs(n)/(s*o);return{easing:r.easing,duration:1e3*l,amount:l/2*n}}var a7=class{constructor(t,i){this._map=t,this._clickTolerance=i.clickTolerance}reset(){delete this._mousedownPos}wheel(t){return this._firePreventable(new G(this._map,t))}mousedown(t,i){return this._mousedownPos=i,this._firePreventable(new Z(t.type,this._map,t))}mouseup(t){this._map.fire(new Z(t.type,this._map,t))}click(t,i){this._mousedownPos&&this._mousedownPos.dist(i)>=this._clickTolerance||this._map.fire(new Z(t.type,this._map,t))}dblclick(t){return this._firePreventable(new Z(t.type,this._map,t))}mouseover(t){this._map.fire(new Z(t.type,this._map,t))}mouseout(t){this._map.fire(new Z(t.type,this._map,t))}touchstart(t){return this._firePreventable(new U(t.type,this._map,t))}touchmove(t){this._map.fire(new U(t.type,this._map,t))}touchend(t){this._map.fire(new U(t.type,this._map,t))}touchcancel(t){this._map.fire(new U(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}},oe=class{constructor(t,i){this._map=t,this._clickTolerance=i.clickTolerance}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent,this._clearLongPress(),this._touchActive=!1}mousemove(t){this._map.fire(new Z(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Z("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}touchstart(t,i,r){if(this._clearLongPress(),this._touchActive=r.length>0,1!==r.length)return;this._longPressStart=i[0];let a=r[0];this._longPressTimer=setTimeout(()=>{this._longPressTimer=void 0;let t=new MouseEvent("contextmenu",{clientX:a.clientX,clientY:a.clientY,button:2,bubbles:!0,cancelable:!0});this._map.fire(new Z("contextmenu",this._map,t))},500)}touchmove(t,i,r){this._longPressTimer&&(1!==r.length||!this._longPressStart||i[0].dist(this._longPressStart)>this._clickTolerance)&&this._clearLongPress()}touchend(){this._touchActive=!1,this._clearLongPress()}touchcancel(){this._touchActive=!1,this._clearLongPress()}_clearLongPress(){this._longPressTimer&&=void clearTimeout(this._longPressTimer),this._longPressStart=void 0}contextmenu(t){this._touchActive?t.preventDefault():(this._delayContextMenu?this._contextMenuEvent=t:this._ignoreContextMenu||this._map.fire(new Z(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault())}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}},ot=class{constructor(t,i,r){this._map=t,this._tr=r,this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=i.clickTolerance||1,i.boxZoom&&"object"==typeof i.boxZoom&&(this._boxZoomEnd=i.boxZoom.boxZoomEnd)}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(t,i){this.isEnabled()&&t.shiftKey&&0===t.button&&(A.disableDrag(),this._startPos=this._lastPos=i,this._active=!0)}mousemoveWindow(t,i){if(!this._active||this._lastPos.equals(i)||!this._box&&i.dist(this._startPos)<this._clickTolerance)return;let r=this._startPos;this._lastPos=i,this._box||(this._box=A.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",t));let a=Math.min(r.x,i.x),o=Math.max(r.x,i.x),s=Math.min(r.y,i.y),n=Math.max(r.y,i.y);this._box.style.transform=`translate(${a}px,${s}px)`,this._box.style.width=`${o-a}px`,this._box.style.height=`${n-s}px`}mouseupWindow(t,i){if(!this._active||0!==t.button)return;let r=this._startPos;if(this.reset(),A.suppressClick(),r.x!==i.x||r.y!==i.y)return(this._map.fire(new V("boxzoomend",{originalEvent:t})),this._boxZoomEnd)?void this._boxZoomEnd(this._map,r,i,t):{cameraAnimation:t=>t.fitScreenCoordinates(r,i,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",t)}keydown(t){this._active&&27===t.keyCode&&(this.reset(),this._fireEvent("boxzoomcancel",t))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&=(this._box.remove(),null),A.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(t,i){return this._map.fire(new V(t,{originalEvent:i}))}};function oi(t,i){if(t.length!==i.length)throw Error(`The number of touches and points are not equal - touches ${t.length}, points ${i.length}`);let r={};for(let a=0;a<t.length;a++)r[t[a].identifier]=i[a];return r}var or=class{constructor(t){this.reset(),this.numTouches=t.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(t,i,r){(this.centroid||r.length>this.numTouches)&&(this.aborted=!0),this.aborted||(void 0===this.startTime&&(this.startTime=t.timeStamp),r.length===this.numTouches&&(this.centroid=function(t){let i=new P.Li(0,0);for(let r of t)i._add(r);return i.div(t.length)}(i),this.touches=oi(r,i)))}touchmove(t,i,r){if(this.aborted||!this.centroid)return;let a=oi(r,i);for(let t in this.touches){let i=this.touches[t],r=a[t];(!r||r.dist(i)>30)&&(this.aborted=!0)}}touchend(t,i,r){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),0===r.length){let t=!this.aborted&&this.centroid;if(this.reset(),t)return t}}},oa=class{constructor(t){this.singleTap=new or(t),this.numTaps=t.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(t,i,r){this.singleTap.touchstart(t,i,r)}touchmove(t,i,r){this.singleTap.touchmove(t,i,r)}touchend(t,i,r){let a=this.singleTap.touchend(t,i,r);
816if(a){let i=t.timeStamp-this.lastTime<500,r=!this.lastTap||30>this.lastTap.dist(a);if(i&&r||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=a,this.count===this.numTaps)return this.reset(),a}}},oo=class{constructor(t,i){this._tr=i,this._zoomIn=new oa({numTouches:1,numTaps:2}),this._zoomOut=new oa({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(t,i,r){this._zoomIn.touchstart(t,i,r),this._zoomOut.touchstart(t,i,r)}touchmove(t,i,r){this._zoomIn.touchmove(t,i,r),this._zoomOut.touchmove(t,i,r)}touchend(t,i,r){let a=this._zoomIn.touchend(t,i,r),o=this._zoomOut.touchend(t,i,r),s=this._tr;return a?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:i=>i.easeTo({duration:300,zoom:(0,P.$n)(s.zoom+1,i.getZoomSnap()),around:s.unproject(a)},{originalEvent:t})}):o?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:i=>i.easeTo({duration:300,zoom:(0,P.$n)(s.zoom-1,i.getZoomSnap()),around:s.unproject(o)},{originalEvent:t})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}},os=class{constructor(t){this._enabled=!!t.enable,this._moveStateManager=t.moveStateManager,this._clickTolerance=t.clickTolerance||1,this._moveFunction=t.move,this._activateOnStart=!!t.activateOnStart,t.assignEvents(this),this.reset()}reset(t){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(t)}_move(...t){let i=this._moveFunction(...t);if(i.bearingDelta||i.pitchDelta||i.rollDelta||i.around||i.panDelta)return this._active=!0,i}dragStart(t,i){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(t)&&(this._moveStateManager.startMove(t),this._lastPoint=Array.isArray(i)?i[0]:i,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(t,i){if(!this.isEnabled())return;let r=this._lastPoint;if(!r)return;if(t.preventDefault(),!this._moveStateManager.isValidMoveEvent(t))return void this.reset(t);let a=Array.isArray(i)?i[0]:i;if(!(!this._moved&&a.dist(r)<this._clickTolerance))return this._moved=!0,this._lastPoint=a,this._move(r,a)}dragEnd(t){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(t)&&(this._moved&&A.suppressClick(),this.reset(t))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}};let on={0:1,2:2};var ol=class{constructor(t){this._correctEvent=t.checkCorrectEvent}startMove(t){this._eventButton=t.button}endMove(t){delete this._eventButton}isValidStartEvent(t){return this._correctEvent(t)}isValidMoveEvent(t){let i;return i=on[this._eventButton],void 0!==t.buttons&&(t.buttons&i)===i}isValidEndEvent(t){return t.button===this._eventButton}},oh=class{constructor(){this._firstTouch=void 0}_isOneFingerTouch(t){return 1===t.targetTouches.length}_isSameTouchEvent(t){return t.targetTouches[0].identifier===this._firstTouch}startMove(t){this._firstTouch=t.targetTouches[0].identifier}endMove(t){delete this._firstTouch}isValidStartEvent(t){return this._isOneFingerTouch(t)}isValidMoveEvent(t){return this._isOneFingerTouch(t)&&this._isSameTouchEvent(t)}isValidEndEvent(t){return this._isOneFingerTouch(t)&&this._isSameTouchEvent(t)}},oc=class{constructor(t=new ol({checkCorrectEvent:()=>!0}),i=new oh){this.mouseMoveStateManager=t,this.oneFingerTouchMoveStateManager=i}_executeRelevantHandler(t,i,r){return t instanceof MouseEvent?i(t):"u">typeof TouchEvent&&t instanceof TouchEvent?r(t):void 0}startMove(t){this._executeRelevantHandler(t,t=>{this.mouseMoveStateManager.startMove(t)},t=>{this.oneFingerTouchMoveStateManager.startMove(t)})}endMove(t){this._executeRelevantHandler(t,t=>{this.mouseMoveStateManager.endMove(t)},t=>{this.oneFingerTouchMoveStateManager.endMove(t)})}isValidStartEvent(t){return!!this._executeRelevantHandler(t,t=>this.mouseMoveStateManager.isValidStartEvent(t),t=>this.oneFingerTouchMoveStateManager.isValidStartEvent(t))}isValidMoveEvent(t){return!!this._executeRelevantHandler(t,t=>this.mouseMoveStateManager.isValidMoveEvent(t),t=>this.oneFingerTouchMoveStateManager.isValidMoveEvent(t))}isValidEndEvent(t){return!!this._executeRelevantHandler(t,t=>this.mouseMoveStateManager.isValidEndEvent(t),t=>this.oneFingerTouchMoveStateManager.isValidEndEvent(t))}};let ou=t=>{t.mousedown=t.dragStart,t.mousemoveWindow=t.dragMove,t.mouseup=t.dragEnd,t.contextmenu=t=>{t.preventDefault()}};var od=class{constructor(t,i){this._clickTolerance=t.clickTolerance||1,this._map=i,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new P.Li(0,0)}_shouldBePrevented(t){return t<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(t,i,r){return this._calculateTransform(t,i,r)}touchmove(t,i,r){if(this._active)return this._shouldBePrevented(r.length)?void this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",t):(t.preventDefault(),this._calculateTransform(t,i,r))}touchend(t,i,r){this._calculateTransform(t,i,r),this._active&&this._shouldBePrevented(r.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(t,i,r){r.length>0&&(this._active=!0);let a=oi(r,i),o=new P.Li(0,0),s=new P.Li(0,0),n=0;for(let t in a){let i=a[t],r=this._touches[t];r&&(o._add(i),s._add(i.sub(r)),n++,a[t]=i)}if(this._touches=a,this._shouldBePrevented(n)||!s.mag())return;let l=s.div(n);if(this._sum._add(l),!(this._sum.mag()<this._clickTolerance))return{around:o.div(n),panDelta:l}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}},o_=class{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(t,i,r){this._firstTwoTouches||r.length<2||(this._firstTwoTouches=[r[0].identifier,r[1].identifier],this._start([i[0],i[1]]))}touchmove(t,i,r){if(!this._firstTwoTouches)return;t.preventDefault();let[a,o]=this._firstTwoTouches,s=op(r,i,a),n=op(r,i,o);if(!s||!n)return;let l=this._aroundCenter?null:s.add(n).div(2);return this._move([s,n],l,t)}touchend(t,i,r){if(!this._firstTwoTouches)return;let[a,o]=this._firstTwoTouches,s=op(r,i,a),n=op(r,i,o);s&&n||(this._active&&A.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(t){this._enabled=!0,this._aroundCenter=!!t&&"center"===t.around}disable(){this._enabled=!1,this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}};function op(t,i,r){for(let a=0;a<t.length;a++)if(t[a].identifier===r)return i[a]}function om(t,i){return Math.log(t/i)/Math.LN2}var of=class extends o_{constructor(){super(),this._zoomRate=1,this._zoomThreshold=.1}setZoomRate(t){this._zoomRate=t??1}setZoomThreshold(t){this._zoomThreshold=t??.1}reset(){super.reset(),delete this._distance,delete this._startDistance}_start(t){this._startDistance=this._distance=t[0].dist(t[1])}_move(t,i){let r=this._distance;if(this._distance=t[0].dist(t[1]),!(!this._active&&Math.abs(om(this._distance,this._startDistance))<this._zoomThreshold))return this._active=!0,{zoomDelta:om(this._distance,r)*this._zoomRate,pinchAround:i}}};function og(t,i){return 180*t.angleWith(i)/Math.PI}var ov=class extends o_{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(t){this._startVector=this._vector=t[0].sub(t[1]),this._minDiameter=t[0].dist(t[1])}_move(t,i,r){let a=this._vector;if(this._vector=t[0].sub(t[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:og(this._vector,a),pinchAround:i}}_isBelowThreshold(t){this._minDiameter=Math.min(this._minDiameter,t.mag());let i=25/(Math.PI*this._minDiameter)*360;return Math.abs(og(t,this._startVector))<i}};function oy(t){return Math.abs(t.y)>Math.abs(t.x)}var ox=class extends o_{constructor(t){super(),this._currentTouchCount=0,this._map=t}
816reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(t,i,r){super.touchstart(t,i,r),this._currentTouchCount=r.length}_start(t){this._lastPoints=t,oy(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,i,r){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;let a=t[0].sub(this._lastPoints[0]),o=t[1].sub(this._lastPoints[1]);if(this._valid=this.gestureBeginsVertically(a,o,r.timeStamp),this._valid)return this._lastPoints=t,this._active=!0,{pitchDelta:-((a.y+o.y)/2*.5)}}gestureBeginsVertically(t,i,r){if(void 0!==this._valid)return this._valid;let a=t.mag()>=2,o=i.mag()>=2;if(!a&&!o)return;if(!a||!o)return void 0===this._firstMove&&(this._firstMove=r),r-this._firstMove<100&&void 0;let s=t.y>0==i.y>0;return oy(t)&&oy(i)&&s}};let ob=100,ow=15,oT=10;var oP=class{constructor(t,i){this._tr=i,this._panStep=ob,this._bearingStep=ow,this._pitchStep=oT,this._rotationDisabled=!1}reset(){this._active=!1}keydown(t){if(t.altKey||t.ctrlKey||t.metaKey)return;let i=0,r=0,a=0,o=0,s=0;switch(t.keyCode){case 61:case 107:case 171:case 187:i=1;break;case 189:case 109:case 173:i=-1;break;case 37:t.shiftKey?r=-1:(t.preventDefault(),o=-1);break;case 39:t.shiftKey?r=1:(t.preventDefault(),o=1);break;case 38:t.shiftKey?a=1:(t.preventDefault(),s=-1);break;case 40:t.shiftKey?a=-1:(t.preventDefault(),s=1);break;default:return}return this._rotationDisabled&&(r=0,a=0),{cameraAnimation:n=>{let l=this._tr;n.easeTo({duration:300,easeId:"keyboardHandler",easing:oM,zoom:i?(0,P.$n)(l.zoom+i*(t.shiftKey?2:1),n.getZoomSnap()):l.zoom,bearing:l.bearing+r*this._bearingStep,pitch:l.pitch+a*this._pitchStep,offset:[-o*this._panStep,-s*this._panStep],center:l.center},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}};function oM(t){return t*(2-t)}var oC=class{constructor(t,i,r){this._onTimeout=t=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(t)},this._map=t,this._tr=r,this._triggerRenderFrame=i,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(t){this._defaultZoomRate=t}setWheelZoomRate(t){this._wheelZoomRate=t}isEnabled(){return!!this._enabled}isActive(){return!!this._active||void 0!==this._finishTimeout}isZooming(){return!!this._zooming}enable(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!t&&"center"===t.around)}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(t){return!!this._map.cooperativeGestures.isEnabled()&&!(t.ctrlKey||this._map.cooperativeGestures.isBypassed(t))}wheel(t){if(!this.isEnabled())return;if(this._shouldBePrevented(t))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",t);let i=t.deltaMode===WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY,r=S(),a=r-(this._lastWheelEventTime||0);this._lastWheelEventTime=r,0!==i&&i%4.000244140625==0?this._type="wheel":0!==i&&4>Math.abs(i)?this._type="trackpad":a>400?(this._type=null,this._lastValue=i,this._timeout=setTimeout(this._onTimeout,40,t)):this._type||(this._type=200>Math.abs(a*i)?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,i+=this._lastValue)),t.shiftKey&&i&&(i/=4),this._type&&(this._lastWheelEvent=t,this._delta-=i,this._active||this._start(t)),t.preventDefault()}_start(t){if(!this._delta)return;this._needsRerender=!1,this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);let i=A.mousePos(this._map.getCanvas(),t),r=this._tr;this._aroundPoint=this._aroundCenter?r.transform.locationToScreenPoint(P.lt.convert(r.center)):i,this._needsRerender||(this._needsRerender=!0,this._triggerRenderFrame())}renderFrame(){if(!this._needsRerender||(this._needsRerender=!1,!this.isActive()))return;let t=this._tr.transform;if("number"==typeof this._lastExpectedZoom){let i=t.zoom-this._lastExpectedZoom;"number"==typeof this._startZoom&&(this._startZoom+=i),"number"==typeof this._targetZoom&&(this._targetZoom+=i)}if(0!==this._delta){let i="wheel"===this._type&&Math.abs(this._delta)>4.000244140625?this._wheelZoomRate:this._defaultZoomRate,r=2/(1+Math.exp(-Math.abs(this._delta*i)));this._delta<0&&0!==r&&(r=1/r);let a="number"==typeof this._targetZoom?(0,P.Fr)(this._targetZoom):t.scale,o=t.applyConstrain(t.getCameraLngLat(),(0,P.Dr)(a*r)).zoom,s=this._map.getZoomSnap();if("wheel"===this._type&&s>0){let i=(0,P.$n)(t.zoom,s);this._targetZoom=(0,P.$n)(o,s,o-i)}else this._targetZoom=o;"wheel"===this._type&&(this._startZoom=t.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}let i="number"==typeof this._targetZoom?this._targetZoom:t.zoom,r=this._startZoom,a=this._easing,o=!1,s;if("wheel"===this._type&&r&&a){let t=Math.min((S()-this._lastWheelEventTime+5)/200,1),n=a(t);s=P.un.number(r,i,n),t<1?this._needsRerender=!0:o=!0}else s=i,o=!0;return this._active=!0,o&&(this._active=!1,this._finishTimeout=setTimeout(()=>
vendor: 7,264 bytes, line 816
816{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._lastExpectedZoom,delete this._finishTimeout},200)),this._lastExpectedZoom=s,{noInertia:!0,needsRenderFrame:!o,zoomDelta:s-t.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let i=P.Jn;if(this._prevEase){let t=this._prevEase,r=(S()-t.start)/t.duration,a=t.easing(r+.01)-t.easing(r),o=.27/Math.sqrt(a*a+1e-4)*.01,s=Math.sqrt(.0729-o*o);i=(0,P.zn)(o,s,.25,1)}return this._prevEase={start:S(),duration:t,easing:i},i}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,delete this._lastExpectedZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}},oI=class{constructor(t,i){this._clickZoom=t,this._tapZoom=i}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}},oS=class{constructor(t,i){this._tr=i,this.reset()}reset(){this._active=!1}dblclick(t,i){return t.preventDefault(),{cameraAnimation:r=>{r.easeTo({duration:300,zoom:(0,P.$n)(this._tr.zoom+(t.shiftKey?-1:1),r.getZoomSnap()),around:this._tr.unproject(i)},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}},oE=class{constructor(){this._tap=new oa({numTouches:1,numTaps:1}),this._zoomRate=1,this.reset()}setZoomRate(t){this._zoomRate=t??1}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(t,i,r){if(!this._swipePoint)if(this._tapTime){let a=i[0],o=t.timeStamp-this._tapTime<500,s=30>this._tapPoint.dist(a);o&&s?r.length>0&&(this._swipePoint=a,this._swipeTouch=r[0].identifier):this.reset()}else this._tap.touchstart(t,i,r)}touchmove(t,i,r){if(this._tapTime){if(this._swipePoint){if(r[0].identifier!==this._swipeTouch)return;let a=i[0],o=a.y-this._swipePoint.y;return this._swipePoint=a,t.preventDefault(),this._active=!0,{zoomDelta:o/128*this._zoomRate}}}else this._tap.touchmove(t,i,r)}touchend(t,i,r){if(this._tapTime)this._swipePoint&&0===r.length&&this.reset();else{let a=this._tap.touchend(t,i,r);a&&(this._tapTime=t.timeStamp,this._tapPoint=a)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}},oz=class{constructor(t,i,r){this._el=t,this._mousePan=i,this._touchPan=r}enable(t){this._inertiaOptions=t||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}},oR=class{constructor(t,i,r,a){this._pitchWithRotate=t.pitchWithRotate,this._rollEnabled=t.rollEnabled,this._mouseRotate=i,this._mousePitch=r,this._mouseRoll=a}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable(),this._rollEnabled&&this._mouseRoll.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable(),this._mouseRoll.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())&&(!this._rollEnabled||this._mouseRoll.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()||this._mouseRoll.isActive()}},oD=class{constructor(t,i,r,a){this._el=t,this._touchZoom=i,this._touchRotate=r,this._tapDragZoom=a,this._rotationDisabled=!1,this._enabled=!0}enable(t){this._touchZoom.enable(t),this._rotationDisabled||this._touchRotate.enable(t),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}setZoomRate(t){this._touchZoom.setZoomRate(t),this._tapDragZoom.setZoomRate(t)}setZoomThreshold(t){this._touchZoom.setZoomThreshold(t)}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}},oL=class{constructor(t,i){this._bypassKey=navigator.userAgent.includes("Mac")?"metaKey":"ctrlKey",this._map=t,this._options=i,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;let t=this._map.getCanvasContainer();t.classList.add("maplibregl-cooperative-gestures"),this._container=A.create("div","maplibregl-cooperative-gesture-screen",t);let i=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");"metaKey"===this._bypassKey&&(i=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));let r=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),a=document.createElement("div");a.className="maplibregl-desktop-message",a.textContent=i,this._container.appendChild(a);let o=document.createElement("div");o.className="maplibregl-mobile-message",o.textContent=r,this._container.appendChild(o),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(this._container.remove(),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destroyUI()}isEnabled(){return this._enabled}isBypassed(t){return t[this._bypassKey]}notifyGestureBlocked(t,i){this._enabled&&(this._map.fire(new k("cooperativegestureprevented",{gestureType:t,originalEvent:i})),this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}},oA=class{constructor(t){this._camera=t}get transform(){return this._camera._requestedCameraState||this._camera.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(t){return this.transform.screenPointToLocation(P.Li.convert(t),this._camera.terrain)}};let oF=t=>t.zoom||t.drag||t.roll||t.pitch||t.rotate;var ok=class extends P._n{};function oB(t){return t.panDelta?.mag()||t.zoomDelta||t.bearingDelta||t.pitchDelta||t.rollDelta}var oO=class{get _ownerDocument(){return this._el?.ownerDocument||document}get _ownerWindow(){return this._el?.ownerDocument?.defaultView||window}constructor(t,i,r){this._terrainGesture={inFlight:!1,anchorElevation:null},this.handleWindowEvent=t=>{this.handleEvent(t,`${t.type}Window`)},this.handleEvent=(t,i)=>{if("blur"===t.type)return void this.stop(!0);this._updatingCamera=!0;let r="renderFrame"===t.type?void 0:t,a={needsRenderFrame:!1},o={},s={};for(let{handlerName:n,handler:l,allowed:h}of this._handlers){let c;
816if(l.isEnabled()){if(this._blockedByActive(s,h,n))l.reset();else if(l[i||t.type]){if((0,P.lr)(t,i||t.type)){let r=A.mousePos(this._map.getCanvas(),t);c=l[i||t.type](t,r)}else if((0,P.dr)(t,i||t.type)){let r=t.touches,a=this._getMapTouches(r),o=A.touchPos(this._map.getCanvas(),a);c=l[i||t.type](t,o,a)}else(0,P.fr)(i||t.type)||(c=l[i||t.type](t));this.mergeHandlerResult(a,o,c,n,r),c?.needsRenderFrame&&this._triggerRenderFrame()}(c||l.isActive())&&(s[n]=l)}}let n={};for(let t in this._previousActiveHandlers)s[t]||(n[t]=r);this._previousActiveHandlers=s,(Object.keys(n).length||oB(a))&&(this._changes.push([a,o,n]),this._triggerRenderFrame()),(Object.keys(s).length||oB(a))&&this._camera.stop(!0),this._updatingCamera=!1;let{cameraAnimation:l}=a;l&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],l(this._map))},this._map=t,this._camera=i,this._transformProvider=new oA(this._camera),this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new a6(t),this._bearingSnap=r.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(r);let a=this._el;for(let[t,i,r]of(this._listeners=[[a,"touchstart",{passive:!0}],[a,"touchmove",{passive:!1}],[a,"touchend",void 0],[a,"touchcancel",void 0],[a,"mousedown",void 0],[a,"mousemove",void 0],[a,"mouseup",void 0],[this._ownerDocument,"mousemove",{capture:!0}],[this._ownerDocument,"mouseup",void 0],[a,"mouseover",void 0],[a,"mouseout",void 0],[a,"dblclick",void 0],[a,"click",void 0],[a,"keydown",{capture:!1}],[a,"keyup",void 0],[a,"wheel",{passive:!1}],[a,"contextmenu",void 0],[this._ownerWindow,"blur",void 0]],this._listeners))t.addEventListener(i,t===this._ownerDocument?this.handleWindowEvent:this.handleEvent,r)}destroy(){for(let[t,i,r]of this._listeners)t.removeEventListener(i,t===this._ownerDocument?this.handleWindowEvent:this.handleEvent,r)}_addDefaultHandlers(t){let i=this._map,r=i.getCanvasContainer();this._add("mapEvent",new a7(i,t));let a=i.boxZoom=new ot(i,t,this._transformProvider);this._add("boxZoom",a),t.interactive&&t.boxZoom&&a.enable();let o=i.cooperativeGestures=new oL(i,t.cooperativeGestures);this._add("cooperativeGestures",o),t.cooperativeGestures&&o.enable();let s=new oo(i,this._transformProvider),n=new oS(i,this._transformProvider);i.doubleClickZoom=new oI(n,s),this._add("tapZoom",s),this._add("clickZoom",n),t.interactive&&t.doubleClickZoom&&i.doubleClickZoom.enable();let l=new oE;this._add("tapDragZoom",l);let h=i.touchPitch=new ox(i);this._add("touchPitch",h),t.interactive&&t.touchPitch&&i.touchPitch.enable(t.touchPitch);let c=()=>this._camera.transform.centerPoint,u=function({enable:t,clickTolerance:i,aroundCenter:r=!0,minPixelCenterThreshold:a=100,rotateSpeed:o=.8},s){return new os({clickTolerance:i,move:(t,i)=>{let n=s();if(r&&Math.abs(n.y-t.y)>a)return{bearingDelta:(0,P.ir)(new P.Li(t.x,i.y),i,n)};let l=(i.x-t.x)*o;return r&&i.y<n.y&&(l=-l),{bearingDelta:l}},moveStateManager:new ol({checkCorrectEvent:t=>0===t.button&&t.ctrlKey||2===t.button&&!t.ctrlKey}),enable:t,assignEvents:ou})}(t,c),d=function({enable:t,clickTolerance:i,pitchSpeed:r=-.5}){return new os({clickTolerance:i,move:(t,i)=>({pitchDelta:(i.y-t.y)*r}),moveStateManager:new ol({checkCorrectEvent:t=>0===t.button&&t.ctrlKey||2===t.button}),enable:t,assignEvents:ou})}(t),_=function({enable:t,clickTolerance:i,rollDegreesPerPixelMoved:r=.3},a){return new os({clickTolerance:i,move:(t,i)=>{let o=a(),s=(i.x-t.x)*r;return i.y<o.y&&(s=-s),{rollDelta:s}},moveStateManager:new ol({checkCorrectEvent:t=>2===t.button&&t.ctrlKey}),enable:t,assignEvents:ou})}(t,c);i.dragRotate=new oR(t,u,d,_),this._add("mouseRotate",u,["mousePitch"]),this._add("mousePitch",d,["mouseRotate","mouseRoll"]),this._add("mouseRoll",_,["mousePitch"]),t.interactive&&t.dragRotate&&i.dragRotate.enable();let p=function({enable:t,clickTolerance:i}){return new os({clickTolerance:i,move:(t,i)=>({around:i,panDelta:i.sub(t)}),activateOnStart:!0,moveStateManager:new ol({checkCorrectEvent:t=>0===t.button&&!t.ctrlKey}),enable:t,assignEvents:ou})}(t),m=new od(t,i);i.dragPan=new oz(r,p,m),this._add("mousePan",p),this._add("touchPan",m,["touchZoom","touchRotate"]),t.interactive&&t.dragPan&&i.dragPan.enable(t.dragPan);let f=new ov,g=new of;i.touchZoomRotate=new oD(r,g,f,l),this._add("touchRotate",f,["touchPan","touchZoom"]),this._add("touchZoom",g,["touchPan","touchRotate"]),t.interactive&&t.touchZoomRotate&&i.touchZoomRotate.enable(t.touchZoomRotate),this._add("blockableMapEvent",new oe(i,t),["touchPan"]);let v=i.scrollZoom=new oC(i,()=>
816this._triggerRenderFrame(),this._transformProvider);this._add("scrollZoom",v,["mousePan"]),t.interactive&&t.scrollZoom&&i.scrollZoom.enable(t.scrollZoom);let y=i.keyboard=new oP(i,this._transformProvider);this._add("keyboard",y),t.interactive&&t.keyboard&&i.keyboard.enable()}_add(t,i,r){this._handlers.push({handlerName:t,handler:i,allowed:r}),this._handlersById[t]=i}stop(t){if(!this._updatingCamera){for(let{handler:t}of this._handlers)t.reset();this._inertia.clear(),this._fireEvents({},{},t),this._changes=[]}}isActive(){for(let{handler:t}of this._handlers)if(t.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!oF(this._eventsInProgress)||this.isZooming()}_blockedByActive(t,i,r){for(let a in t)if(a!==r&&!i?.includes(a))return!0;return!1}_getMapTouches(t){let i=[];for(let r of t){let t=r.target;this._el.contains(t)&&i.push(r)}return i}mergeHandlerResult(t,i,r,a,o){if(!r)return;(0,P.er)(t,r);let s={handlerName:a,originalEvent:r.originalEvent||o};void 0!==r.zoomDelta&&(i.zoom=s),void 0!==r.panDelta&&(i.drag=s),void 0!==r.rollDelta&&(i.roll=s),void 0!==r.pitchDelta&&(i.pitch=s),void 0!==r.bearingDelta&&(i.rotate=s)}_applyChanges(){let t={},i={},r={};for(let[a,o,s]of this._changes)a.panDelta&&(t.panDelta=(t.panDelta||new P.Li(0,0))._add(a.panDelta)),a.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+a.zoomDelta),a.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+a.bearingDelta),a.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+a.pitchDelta),a.rollDelta&&(t.rollDelta=(t.rollDelta||0)+a.rollDelta),void 0!==a.around&&(t.around=a.around),void 0!==a.pinchAround&&(t.pinchAround=a.pinchAround),a.noInertia&&(t.noInertia=a.noInertia),(0,P.er)(i,o),(0,P.er)(r,s);this._updateMapTransform(t,i,r),this._changes=[]}_updateMapTransform(t,i,r){let a=this._map.terrain;if(!oB(t))return void this._fireEvents(i,r,!0);let o=this._camera.getTransformForUpdate();this._camera.stop(!0);let{panDelta:s,zoomDelta:n,bearingDelta:l,pitchDelta:h,rollDelta:c}=t,{around:u,aroundOnSurface:d}=this._resolveAround(t,a,o),_=a?this._terrainGestureElevation(a,u,d,o,i):void 0,p={panDelta:s,zoomDelta:n,rollDelta:c,pitchDelta:h,bearingDelta:l,around:u,aroundElevation:_};this._camera.cameraHelper.useGlobeControls&&!o.isPointOnMapSurface(u)&&(u=o.centerPoint);let m=this._computePreZoomAroundLoc(o,u,s,_);this._handleMapControls({terrain:a,tr:o,deltasForHelper:p,preZoomAroundLoc:m,combinedEventsInProgress:i,panDelta:s}),this._camera.applyUpdatedTransform(o),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(i,r,!0)}_resolveAround(t,i,r){let a=void 0===t.pinchAround?t.around:t.pinchAround;return a||=this._camera.transform.centerPoint,i&&!r.isPointOnMapSurface(a)?{around:r.centerPoint,aroundOnSurface:!1}:{around:a,aroundOnSurface:!0}}_terrainGestureElevation(t,i,r,a,o){if(!r)return;if(null===this._terrainGesture.anchorElevation&&(o.drag||o.zoom)){let r=a.screenTerrainPointToMercatorCoordinate(i,t);this._terrainGesture.anchorElevation=r?r.z:void 0}let s=this._terrainGesture.anchorElevation;if(null!=s&&!(.01>i.distSqr(a.centerPoint))&&!(s-a.elevation>=.9*(a.getCameraAltitude()-a.elevation)))return s}_computePreZoomAroundLoc(t,i,r,a){if(.01>i.distSqr(t.centerPoint))return t.center;let o=r?i.sub(r):i;return void 0===a?t.screenPointToLocation(o):t.screenPointToLocationAtElevation(o,a)}_handleMapControls({terrain:t,tr:i,deltasForHelper:r,preZoomAroundLoc:a,combinedEventsInProgress:o,panDelta:s}){let n=this._camera.cameraHelper;if(n.handleMapControlsRollPitchBearingZoom(r,i),!t)return void n.handleMapControlsPan(r,i,a);if(!this._terrainGesture.inFlight){this._terrainGesture.inFlight=!0,this._camera.elevationFreeze=!0,n.handleMapControlsPan(r,i,a);return}!n.useGlobeControls&&void 0===r.aroundElevation&&o.drag&&s?i.setCenter(i.screenPointToLocation(i.centerPoint.sub(s))):n.handleMapControlsPan(r,i,a)}_fireEvents(t,i,r){let a=oF(this._eventsInProgress),o=oF(t),s={};for(let i in t){let{originalEvent:r}=t[i];this._eventsInProgress[i]||(s[`${i}start`]=r),this._eventsInProgress[i]=t[i]}for(let t in!a&&o&&this._fireEvent("movestart",o.originalEvent),s)this._fireEvent(t,s[t]);for(let i in o&&this._fireEvent("move",o.originalEvent),t){let{originalEvent:r}=t[i];this._fireEvent(i,r)}let n={},l;for(let t in this._eventsInProgress){let{handlerName:r,originalEvent:a}=this._eventsInProgress[t];this._handlersById[r].isActive()||(delete this._eventsInProgress[t],l=i[r]||a,n[`${t}end`]=l)}for(let t in n)this._fireEvent(t,n[t]);let h=oF(this._eventsInProgress),c=(a||o)&&!h;if(c&&this._terrainGesture.inFlight){this._camera.elevationFreeze=!1,this._terrainGesture={inFlight:!1,anchorElevation:null};let t=this._camera.getTransformForUpdate();
816this._map.getCenterClampedToGround()&&t.recalculateZoomAndCenter(this._map.terrain),this._camera.applyUpdatedTransform(t)}if(r&&c){this._updatingCamera=!0;let t=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),i=t=>0!==t&&-this._bearingSnap<t&&t<this._bearingSnap;t&&(t.essential||!C.prefersReducedMotion)?(i(t.bearing||this._map.getBearing())&&(t.bearing=0),t.freezeElevation=!0,this._map.easeTo(t,{originalEvent:l})):(this._fireEvent("moveend",l),i(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(t,i){this._camera.fire(new B(t,i?{originalEvent:i}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(t=>{delete this._frameId,this.handleEvent(new ok("renderFrame",{timeStamp:t})),this._applyChanges()})}_triggerRenderFrame(){void 0===this._frameId&&(this._frameId=this._requestFrame())}},oj=class extends P.vn{constructor(t){super(),this._renderFrameCallback=()=>{let t=Math.min((S()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(t)),t<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this.transform=new im,this.cameraHelper=new iT,void 0!==t.minZoom&&this.transform.setMinZoom(t.minZoom),void 0!==t.maxZoom&&this.transform.setMaxZoom(t.maxZoom),void 0!==t.minPitch&&this.transform.setMinPitch(t.minPitch),void 0!==t.maxPitch&&this.transform.setMaxPitch(t.maxPitch),void 0!==t.renderWorldCopies&&this.transform.setRenderWorldCopies(t.renderWorldCopies),null!==t.transformConstrain&&this.transform.setConstrainOverride(t.transformConstrain),this._moving=!1,this._zooming=!1,this._bearingSnap=t.bearingSnap,this._zoomSnap=t.zoomSnap,this._requestRenderFrame=t.requestRenderFrame,this._cancelRenderFrame=t.cancelRenderFrame,this.terrain=t.terrain,this._centerClampedToGround=t.centerClampedToGround??!0,this.transformCameraUpdate=t.transformCameraUpdate??null,this._stopHandlers=t.stopHandlers??(()=>{}),this.on("moveend",()=>{delete this._requestedCameraState})}setTerrain(t){this.terrain=t,this.applyTerrainChange()}migrateProjection(t,i){if(t.apply(this.transform,!0),this.transform=t,this.cameraHelper=i,this._requestedCameraState){let i=t.clone();i.apply(this._requestedCameraState,!0),this._requestedCameraState=i}}getCenter(){return new P.lt(this.transform.center.lng,this.transform.center.lat)}setCenter(t,i){return this.jumpTo({center:t},i)}getCenterElevation(){return this.transform.elevation}setCenterElevation(t,i){return this.jumpTo({elevation:t},i),this}getCenterClampedToGround(){return this._centerClampedToGround}setCenterClampedToGround(t){this._centerClampedToGround=t}panBy(t,i,r){return t=P.Li.convert(t).mult(-1),this.panTo(this.transform.center,(0,P.er)({offset:t},i),r)}panTo(t,i,r){return this.easeTo((0,P.er)({center:t},i),r)}getZoom(){return this.transform.zoom}setZoom(t,i){return this.jumpTo({zoom:t},i),this}zoomTo(t,i,r){return this.easeTo((0,P.er)({zoom:t},i),r)}zoomIn(t,i){return this.zoomTo((0,P.$n)(this.getZoom()+1,this._zoomSnap),t,i),this}zoomOut(t,i){return this.zoomTo((0,P.$n)(this.getZoom()-1,this._zoomSnap),t,i),this}getVerticalFieldOfView(){return this.transform.fov}setVerticalFieldOfView(t,i){return t!=this.transform.fov&&(this.transform.setFov(t),this.fire(new B("movestart",i)).fire(new B("move",i)).fire(new B("moveend",i))),this}getBearing(){return this.transform.bearing}setZoomSnap(t){return this._zoomSnap=t,this}getZoomSnap(){return this._zoomSnap}setBearing(t,i){return this.jumpTo({bearing:t},i),this}getPadding(){return this.transform.padding}setPadding(t,i){return this.jumpTo({padding:t},i),this}rotateTo(t,i,r){return this.easeTo((0,P.er)({bearing:t},i),r)}resetNorth(t,i){return this.rotateTo(0,(0,P.er)({duration:1e3},t),i),this}resetNorthPitch(t,i){return this.easeTo((0,P.er)({bearing:0,pitch:0,roll:0,duration:1e3},t),i),this}snapToNorth(t,i){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(t,i):this}getPitch(){return this.transform.pitch}setPitch(t,i){return this.jumpTo({pitch:t},i),this}getRoll(){return this.transform.roll}setRoll(t,i){return this.jumpTo({roll:t},i),this}cameraForBounds(t,i){t=eL.convert(t).adjustAntiMeridian();let r=i?.bearing||0;return this._cameraForBoxAndBearing(t.getNorthWest(),t.getSouthEast(),r,i)}_cameraForBoxAndBearing(t,i,r,a){let o={top:0,bottom:0,right:0,left:0};if("number"==typeof(a=(0,P.er)({padding:o,offset:[0,0],maxZoom:this.transform.maxZoom},a)).padding){let t=a.padding;a.padding={top:t,bottom:t,right:t,left:t}}let s=(0,P.er)(o,a.padding);a.padding=s;let n=this.transform,l=new eL(t,i),h=this.cameraHelper.cameraForBoxAndBearing(a,s,l,r,n);return h&&this._zoomSnap&&(h.zoom=(0,P.$n)(h.zoom,this._zoomSnap,-1)),h}fitBounds(t,i,r){return this._fitInternal(this.cameraForBounds(t,i),i,r)}fitScreenCoordinates(t,i,r,a,o){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.screenPointToLocation(P.Li.convert(t)),this.transform.screenPointToLocation(P.Li.convert(i)),r,a),a,o)}_fitInternal(t,i,r){return t?(i=(0,P.er)(t,i),delete i.padding,i.linear?this.easeTo(i,r):this.flyTo(i,r)):this}jumpTo(t,i){this.stop(),void 0!==t.zoom&&this._zoomSnap&&(t.zoom=(0,P.$n)(t.zoom,this._zoomSnap));let r=this.getTransformForUpdate(),a=!1,o=!1,s=!1,n=r.zoom;this.terrain&&r.setElevation(this.terrain.getElevationForLngLat(t.center?P.lt.convert(t.center):r.center,r)),this.cameraHelper.handleJumpToCenterZoom(r,t);let l=r.zoom!==n;return void 0!==t.elevation&&r.elevation!==+t.elevation&&r.setElevation(+t.elevation),void 0!==t.bearing&&r.bearing!==+t.bearing&&(a=!0,r.setBearing(+t.bearing)),void 0!==t.pitch&&r.pitch!==+t.pitch&&(o=!0,r.setPitch(+t.pitch)),void 0!==t.roll&&r.roll!==+t.roll&&(s=!0,r.setRoll(+t.roll)),null==t.padding||r.isPaddingEqual(t.padding)||r.setPadding(t.padding),this.applyUpdatedTransform(r),this.fire(new B("movestart",i)).fire(new B("move",i)),l&&this.fire(new B("zoomstart",i)).fire(new B("zoom",i)).fire(new B("zoomend",i)),a&&this.fire(new B("rotatestart",i)).fire(new B("rotate",i)).fire(new B("rotateend",i)),o&&this.fire(new B("pitchstart",i)).fire(new B("pitch",i)).fire(new B("pitchend",
816i)),s&&this.fire(new B("rollstart",i)).fire(new B("roll",i)).fire(new B("rollend",i)),this.fire(new B("moveend",i))}calculateAnchoredCameraOptions(t){let i=this.transform.clone(),r=P.lt.convert(t.anchorLocation),a=P.Li.convert(t.anchorScreenPoint),o={panDelta:a.sub(this.transform.locationToScreenPoint(r,this.terrain)),zoomDelta:void 0===t.zoom?0:t.zoom-i.zoom,bearingDelta:0,pitchDelta:0,rollDelta:0,around:a,aroundElevation:this.terrain?.getElevationForLngLat(r,i)};return this.cameraHelper.handleMapControlsRollPitchBearingZoom(o,i),this.cameraHelper.handleMapControlsPan(o,i,r),{center:i.center,zoom:i.zoom}}calculateCameraOptionsFromCameraLngLatAltRotation(t,i,r,a,o){let s=this.transform.calculateCenterFromCameraLngLatAlt(t,i,r,a);return{center:s.center,elevation:s.elevation,zoom:s.zoom,bearing:r,pitch:a,roll:o}}easeTo(t,i){this._stop(!1,t.easeId),void 0!==(t=(0,P.er)({offset:[0,0],duration:500,easing:P.Jn},t)).zoom&&this._zoomSnap&&(t.zoom=(0,P.$n)(t.zoom,this._zoomSnap)),(!1===t.animate||!t.essential&&C.prefersReducedMotion)&&(t.duration=0);let r=this.getTransformForUpdate(),a=this.getBearing(),o=r.pitch,s=r.roll,n=void 0===t.bearing?a:this._normalizeBearing(t.bearing,a),l=void 0===t.pitch?o:+t.pitch,h=void 0===t.roll?s:this._normalizeBearing(t.roll,s),c=void 0===t.padding?r.padding:t.padding,u=P.Li.convert(t.offset),d,_;t.around&&(d=P.lt.convert(t.around),_=r.locationToScreenPoint(d));let p={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching,rolling:this._rolling},m=this.cameraHelper.handleEaseTo(r,{bearing:n,pitch:l,roll:h,padding:c,around:d,aroundPoint:_,offsetAsPoint:u,offset:t.offset,zoom:t.zoom,center:t.center});return this._rotating||=a!==n,this._pitching||=l!==o,this._rolling||=h!==s,this._padding=!r.isPaddingEqual(c),this._zooming||=m.isZooming,this._easeId=t.easeId,this._prepareEase(i,t.noMoveStart,p),this.terrain&&this._prepareElevation(m.elevationCenter),this._ease(a=>
816{m.easeFunc(a),this.terrain&&!t.freezeElevation&&this._updateElevation(a),this.applyUpdatedTransform(r),this._fireMoveEvents(i)},r=>{this.terrain&&t.freezeElevation?this._finalizeElevation():this.elevationFreeze=!1,this._afterEase(i,r)},t),this}_prepareEase(t,i,r={}){this._moving=!0,i||r.moving||this.fire(new B("movestart",t)),this._zooming&&!r.zooming&&this.fire(new B("zoomstart",t)),this._rotating&&!r.rotating&&this.fire(new B("rotatestart",t)),this._pitching&&!r.pitching&&this.fire(new B("pitchstart",t)),this._rolling&&!r.rolling&&this.fire(new B("rollstart",t))}_prepareElevation(t){this._elevationCenter=t,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLat(t,this.transform),this.elevationFreeze=!0}_updateElevation(t){(void 0===this._elevationStart||void 0===this._elevationCenter)&&this._prepareElevation(this.transform.center),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom));let i=this.terrain.getElevationForLngLat(this._elevationCenter,this.transform);if(t<1&&i!==this._elevationTarget){let r=this._elevationTarget-this._elevationStart,a=(i-(r*t+this._elevationStart))/(1-t);this._elevationStart+=t*(r-a),this._elevationTarget=i}this.transform.setElevation(P.un.number(this._elevationStart,this._elevationTarget,t))}_finalizeElevation(){this.elevationFreeze=!1,this.getCenterClampedToGround()&&this.transform.recalculateZoomAndCenter(this.terrain)}applyTerrainChange(){if(this.elevationFreeze)return;let t=this.transform;t.setMinElevationForCurrentTile(this.terrain?this.terrain.getMinTileElevationForLngLatZoom(t.center,t.tileZoom):0),this.getCenterClampedToGround()&&t.setElevation(this.terrain?this.terrain.getElevationForLngLat(t.center,t):0)}getTransformForUpdate(){return this.transformCameraUpdate||this.terrain?(this._requestedCameraState||=this.transform.clone(),this._requestedCameraState):this.transform}_elevateCameraIfInsideTerrain(t){if(!this.terrain&&t.elevation>=0&&t.pitch<=90)return{};let i=t.getCameraLngLat(),r=t.getCameraAltitude(),a=this.terrain?this.terrain.getElevationForLngLatZoom(i,t.zoom):0;if(r<a){let r=t.calculateCameraOptionsFromTo(i,a,t.center,t.elevation);return{pitch:r.pitch,zoom:r.zoom}}return{}}applyUpdatedTransform(t){let i=[];if(i.push(t=>this._elevateCameraIfInsideTerrain(t)),this.transformCameraUpdate&&i.push(t=>this.transformCameraUpdate(t)),!i.length)return;let r=t.clone();for(let t of i){let i=r.clone(),{center:a,zoom:o,roll:s,pitch:n,bearing:l,elevation:h}=t(i);a&&i.setCenter(a),void 0!==h&&i.setElevation(h),void 0!==o&&i.setZoom(o),void 0!==s&&i.setRoll(s),void 0!==n&&i.setPitch(n),void 0!==l&&i.setBearing(l),r.apply(i,!1)}this.transform.apply(r,!1)}_fireMoveEvents(t){this.fire(new B("move",t)),this._zooming&&this.fire(new B("zoom",t)),this._rotating&&this.fire(new B("rotate",t)),this._pitching&&this.fire(new B("pitch",t)),this._rolling&&this.fire(new B("roll",t))}_afterEase(t,i){if(this._easeId&&i&&this._easeId===i)return;delete this._easeId;let r=this._zooming,a=this._rotating,o=this._pitching,s=this._rolling;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._rolling=!1,this._padding=!1,r&&this.fire(new B("zoomend",t)),a&&this.fire(new B("rotateend",t)),o&&this.fire(new B("pitchend",t)),s&&this.fire(new B("rollend",t)),this.fire(new B("moveend",t))}flyTo(t,i){if(!t.essential&&C.prefersReducedMotion){let r=(0,P.yr)(t,["center","zoom","bearing","pitch","roll","elevation","padding"]);return this.jumpTo(r,i)}this.stop(),void 0!==(t=(0,P.er)({offset:[0,0],speed:1.2,curve:1.42,easing:P.Jn},t)).zoom&&this._zoomSnap&&(t.zoom=(0,P.$n)(t.zoom,this._zoomSnap));let r=this.getTransformForUpdate(),a=r.bearing,o=r.pitch,s=r.roll,n=r.padding,l=void 0===t.bearing?a:this._normalizeBearing(t.bearing,a),h=void 0===t.pitch?o:+t.pitch,c=void 0===t.roll?s:this._normalizeBearing(t.roll,s),u=void 0===t.padding?r.padding:t.padding,d=P.Li.convert(t.offset),_=r.centerPoint.add(d),p=r.screenPointToLocation(_),m=this.cameraHelper.handleFlyTo(r,{bearing:l,pitch:h,roll:c,padding:u,locationAtOffset:p,offsetAsPoint:d,center:t.center,minZoom:t.minZoom,zoom:t.zoom}),f=t.curve,g=Math.max(r.width,r.height),v=g/m.scaleOfZoom,y=m.pixelPathLength,x=g/m.scaleOfMinZoom,b=(f=Math.min(f,Math.sqrt(x/y*2)))*f;function w(t){let i=(v*v-g*g+(t?-1:1)*b*b*y*y)/(2*(t?v:g)*b*y);return Math.log(Math.sqrt(i*i+1)-i)}function T(t){return(Math.exp(t)-Math.exp(-t))/2}function M(t){return(Math.exp(t)+Math.exp(-t))/2}let I=w(!1),S=function(t){return M(I)/M(I+f*t)},E=function(t){var i;return g*((M(I)*(T(i=I+f*t)/M(i))-T(I))/b)/y},z=(w(!0)-I)/f;if(2e-6>Math.abs(y)||!isFinite(z)){if(1e-6>Math.abs(g-v))return this.easeTo(t,i);let r=v<g?-1:1;z=Math.abs(Math.log(v/g))/f,E=()=>0,S=t=>Math.exp(r*f*t)}if(void 0!==t.duration)t.duration=+t.duration;else{let i=void 0===t.screenSpeed?+t.speed:t.screenSpeed/f;t.duration=1e3*z/i}return t.maxDuration&&t.duration>t.maxDuration&&(t.duration=0),this._zooming=!0,this._rotating=a!==l,this._pitching=h!==o,this._rolling=c!==s,this._padding=!r.isPaddingEqual(u),this._prepareEase(i,!1),this.terrain&&this._prepareElevation(m.targetCenter),this._ease(p=>{let f=p*z,g=1/S(f),v=E(f);this._rotating&&r.setBearing(P.un.number(a,l,p)),this._pitching&&r.setPitch(P.un.number(o,h,p)),this._rolling&&r.setRoll(P.un.number(s,c,p)),this._padding&&(r.interpolatePadding(n,u,p),_=r.centerPoint.add(d)),m.easeFu
816nc(p,g,v,_),this.terrain&&!t.freezeElevation&&this._updateElevation(p),this.applyUpdatedTransform(r),this._fireMoveEvents(i)},()=>{this.terrain&&t.freezeElevation?this._finalizeElevation():this.elevationFreeze=!1,this._afterEase(i)},t),this}isEasing(){return!!this._easeFrameId}stop(t){return this._stop(t)}_stop(t,i){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){let t=this._onEaseEnd;delete this._onEaseEnd,t.call(this,i)}return t||this._stopHandlers(),this}_ease(t,i,r){!1===r.animate||0===r.duration?(t(1),i()):(this._easeStart=S(),this._easeOptions=r,this._onEaseFrame=t,this._onEaseEnd=i,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(t,i){let r=Math.abs((t=(0,P.Pr)(t,-180,180))-i);return Math.abs(t-360-i)<r&&(t-=360),Math.abs(t+360-i)<r&&(t+=360),t}isMoving(){return this._moving}isZooming(){return this._zooming}isRotating(){return this._rotating}};let oN={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};var oZ=class{constructor(t=oN){this._toggleAttribution=()=>{this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))},this._updateData=t=>{t&&("terrain"===t.type||"style"===t.dataType||"source"===t.dataType&&("metadata"===t.sourceDataType||"visibility"===t.sourceDataType))&&this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?!1===this._compact?this._container.setAttribute("open",""):this._container.classList.contains("maplibregl-compact")||this._container.classList.contains("maplibregl-attrib-empty")||(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"))},this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},this.options=t}getDefaultPosition(){return"bottom-right"}onAdd(t){return this._map=t,this._compact=this.options.compact,this._container=A.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=A.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=A.create("div","maplibregl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("terrain",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container}onRemove(){this._container.remove(),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(t,i){let r=this._map._getUIString(`AttributionControl.${i}`);t.title=r,t.setAttribute("aria-label",r)}_updateAttributions(){if(!this._map.style)return;let t=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=t.concat(this.options.customAttribution.map(t=>"string"==typeof t?t:"")):"string"==typeof this.options.customAttribution&&t.push(this.options.customAttribution)),this._map.style.stylesheet){let t=this._map.style.stylesheet;this.styleOwner=t.owner,this.styleId=t.id}let i=this._map.style.tileManagers;for(let r in i){let a=i[r];if(a.used||a.usedForTerrain){let i=a.getSource();i.attribution&&!t.includes(i.attribution)&&t.push(i.attribution)}}(t=t.filter(t=>String(t).trim())).sort((t,i)=>t.length-i.length);let r=(t=t.filter((i,r)=>{for(let a=r+1;a<t.length;a++)if(t[a].includes(i))return!1;return!0})).join(" | ");r!==this._attribHTML&&(this._attribHTML=r,t.length?(this._innerContainer.replaceChildren(A.sanitize(r)),this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}},oU=class{constructor(t={}){this._updateCompact=()=>{let t=this._container.children;if(t.length){let i=t[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?!1!==this._compact&&i.classList.add("maplibregl-compact"):i.classList.remove("maplibregl-compact")}},this.options=t}getDefaultPosition(){return"bottom-left"}onAdd(t){this._map=t,this._compact=this.options?.compact,this._container=A.create("div","maplibregl-ctrl");let i=A.create("a","maplibregl-ctrl-logo");return i.target="_blank",i.rel="noopener nofollow",i.href="https://maplibre.org/",i.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),i.setAttribute("rel","noopener nofollow"),this._container.appendChild(i),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){this._container.remove(),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}},oG=class{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(t){let i=++this._id;return this._queue.push({callback:t,id:i,cancelled:!1}),i}remove(t){let i=this._currentlyRunning;for(let r of i?this._queue.concat(i):this._queue)if(r.id===t){r.cancelled=!0;return}}run(t=0){if(this._currentlyRunning)throw Error("Attempting to run(), but is already running.");let i=this._currentlyRunning=this._queue;this._queue=[];let r=!1,a;for(let o of i)if(!o.cancelled){try{o.callback(t)}catch(t){r||(r=!0,a=t)}if(this._cleared)break}if(this._cleared=!1,this._currentlyRunning=!1,r)throw a}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}};let oV=["none","zoom","sourceTiles","visibleLayers","revision"];var oq=class{constructor(t,i,r,a){this._tileKeys=t.map(t=>t.key).sort().join(),this._revision=i,this._zoom=r,this._visibleLayerIds=a}difference(t){return this._revision===t?._revision?this._visibleLayerIds===t._visibleLayerIds?this._tileKeys===t._tileKeys?this._zoom===t._zoom?"none":"zoom":"sourceTiles":"visibleLayers":"revision"}};let oW={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0,"color-relief":!0};var o$=class{constructor(t,i){this.needsFollowUpFrame=!1,this.painter=t,this.terrain=i,this.rttSize=i.tileManager.tileSize*i.qualityFactor}getTexture(t){return t.getRTT(this._stacks.length-1).texture}
816prepareForRender(t,i){let r=i!==this._lastPrepareZoom;this._lastPrepareZoom=i,this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.tileManager.getRenderableTiles(),this._renderableLayerIds=t._order.filter(r=>!t._layers[r].isHidden(i));let a=this._renderableLayerIds.join(),o=new Set;for(let i of this._renderableLayerIds){let r=t._layers[i],a=r.source;a&&oW[r.type]&&o.add(a)}for(let r of(this._coordsAscending={},this._rttFingerprints={},o)){let o=t.tileManagers[r];if(!o)continue;this._coordsAscending[r]={};let s=this._coordsAscending[r],n=o.getSource(),l=n instanceof eX?n.terrainTileRanges:null;for(let t of o.getVisibleCoordinates()){let i=this.terrain.tileManager.getTerrainCoords(t,l);for(let t in i)s[t]||=[],s[t].push(i[t])}this._rttFingerprints[r]={};let h=this._rttFingerprints[r],c=o.getState().revision;for(let t in s)h[t]=new oq(s[t],c,i,a)}this.needsFollowUpFrame=!1;let s=r||this.painter.options.moving,n=!1;for(let t of this._renderableTiles){let i=this._textureDifference(t);"none"!==i&&("zoom"===i&&s||"visibleLayers"===i&&r?this.needsFollowUpFrame=!0:"zoom"===i||"sourceTiles"===i?(n?this.needsFollowUpFrame=!0:t.releaseRTT(this.painter),n=!0):t.releaseRTT(this.painter))}}_textureDifference(t){let i="none";for(let r in this._rttFingerprints){let a=this._rttFingerprints[r][t.tileID.key];if(!a)continue;let o=a.difference(t.rttFingerprint[r]);oV.indexOf(o)>oV.indexOf(i)&&(i=o)}return i}renderLayer(t,i){if(t.isHidden(this.painter.transform.zoom))return!1;let r=t.type,a=this.painter,o=this._renderableLayerIds[this._renderableLayerIds.length-1]===t.id;if(oW[r]&&(this._prevType&&oW[this._prevType]||this._stacks.push([]),this._prevType=r,this._stacks[this._stacks.length-1].push(t.id),!o))return!0;if(oW[this._prevType]||oW[r]&&o){this._prevType=r;let t=this._stacks.length-1,o=this._stacks[t]||[];for(let r of(i.isRenderingToTexture=!0,this._renderableTiles)){if(this._rttTiles.push(r),r.getRTT(t))continue;let s=r.acquireRTT(a,t,this.rttSize);for(let t of(a.bindRTT(s),a.context.clear({color:P.fn.transparent,stencil:0}),a.currentStencilSource=void 0,o)){let o=a.style._layers[t],s=o.source?this._coordsAscending[o.source][r.tileID.key]:[r.tileID];a.context.viewport.set([0,0,this.rttSize,this.rttSize]),a.renderTileClippingMasks(o,s),a.renderLayer(a,a.style.tileManagers[o.source],o,s,i),o.source&&(r.rttFingerprint[o.source]=this._rttFingerprints[o.source][r.tileID.key])}s.texture.generateMipmap()}return i.isRenderingToTexture=!1,function(t,i,r,a){let{isRenderingGlobe:o}=a,s=t.context,n=s.gl,l=t.transform,h=t.colorModeForRenderPass(),c=t.getDepthModeFor3D(),u=t.useProgram("terrain");for(let d of(s.bindFramebuffer.set(null),s.viewport.set([0,0,t.width,t.height]),r)){let r=i.getTerrainMesh(d.tileID),_=t.renderToTexture.getTexture(d),p=i.getTerrainData(d.tileID);s.activeTexture.set(n.TEXTURE0),_.bind(n.LINEAR,n.CLAMP_TO_EDGE,n.LINEAR_MIPMAP_LINEAR);let m=i5(i.getSkirtLength(l.zoom),l.calculateFogMatrix(d.tileID.toUnwrapped()),t.style.sky,l.pitch,o),f=av(a,d.tileID,{applyTerrainMatrix:!1});u.draw(s,n.TRIANGLES,c,af.disabled,h,ag.backCCW,m,p,f,"terrain",r.vertexBuffer,r.indexBuffer,r.segments)}}(this.painter,this.terrain,this._rttTiles,i),this._rttTiles=[],oW[r]}return!1}};let oH={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"MapLibre logo","Map.Title":"Map","Marker.Title":"Map marker","NavigationControl.ResetBearing":"Drag to rotate map, click to reset north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","Popup.Close":"Close popup","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","GlobeControl.Enable":"Enable globe","GlobeControl.Disable":"Disable globe","TerrainControl.Enable":"Enable terrain","TerrainControl.Disable":"Disable terrain","CooperativeGesturesHandler.WindowsHelpText":"Use Ctrl + scroll to zoom the map","CooperativeGesturesHandler.MacHelpText":"Use ⌘ + scroll to zoom the map","CooperativeGesturesHandler.MobileHelpText":"Use two fingers to move the map"},oX={hash:!1,interactive:!0,bearingSnap:7,zoomSnap:0,attributionControl:oN,maplibreLogo:!1,refreshExpiredTiles:!0,canvasContextAttributes:{antialias:!1,preserveDrawingBuffer:!1,powerPreference:"high-performance",failIfMajorPerformanceCaveat:!1,desynchronized:!1,contextType:void 0},scrollZoom:!0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,trackResize:!0,center:[0,0],elevation:0,zoom:0,bearing:0,pitch:0,roll:0,renderWorldCopies:!0,maxTileC
816acheSize:null,maxTileCacheZoomLevels:P.An.MAX_TILE_CACHE_ZOOM_LEVELS,transformRequest:null,transformCameraUpdate:null,transformConstrain:null,fadeDuration:300,crossSourceCollisions:!0,clickTolerance:3,localIdeographFontFamily:"sans-serif",pitchWithRotate:!0,rollEnabled:!1,rotateSpeed:.8,pitchSpeed:-.5,reduceMotion:void 0,validateStyle:!0,maxCanvasSize:[4096,4096],cancelPendingTileRequestsWhileZooming:!0,centerClampedToGround:!0,terrainSkirtLength:"auto",zoomLevelsToOverscale:4,anisotropicFilterPitch:20};var oY=class extends P.vn{get _ownerWindow(){return this._container?.ownerDocument?.defaultView||window}constructor(t){super(),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new oG,this._controls=[],this._mapId=(0,P.Mr)(),this._styleUrl=null,this._missingStyleImageResolver=null,this._lostContextStyle={style:null,images:null},this._contextLost=t=>{if(t.preventDefault(),this._frameRequest&&=(this._frameRequest.abort(),null),this.painter.destroy(),this._lostContextStyle=this._getStyleAndImages(),!this.style)return void this.fire(new $("webglcontextlost",{originalEvent:t}));for(let t of Object.values(this.style._layers))if("custom"===t.type&&console.warn(`Custom layer with id '${t.id}' cannot be restored after WebGL context loss. You will need to re-add it manually after context restoration.`),t._listeners)for(let[i]of Object.entries(t._listeners))console.warn(`Custom layer with id '${t.id}' had event listeners for event '${i}' which cannot be restored after WebGL context loss. You will need to re-add them manually after context restoration.`);this.style.destroy(),this.style=null,this.fire(new $("webglcontextlost",{originalEvent:t}))},this._contextRestored=t=>{if(this._lostContextStyle.style&&this.setStyle(this._lostContextStyle.style,{diff:!1}),this._lostContextStyle.images&&this.style)for(let t in this.style.imageManager.images=this._lostContextStyle.images,this._lostContextStyle.images){let i=this._lostContextStyle.images[t];i.isWebGLImage&&this.style.imageManager.updateImage(t,i,!1)}this._lostContextStyle={style:null,images:null};try{this._setupPainter()}catch(t){this.fire(new P.gn(t));return}this.resize(),this._update(),this._resizeInternal(),this.fire(new $("webglcontextrestored",{originalEvent:t}))},this._onMapScroll=t=>{if(t.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()};let i={...oX,...t,canvasContextAttributes:{...oX.canvasContextAttributes,...t.canvasContextAttributes}};if(null!=i.minZoom&&null!=i.maxZoom&&i.minZoom>i.maxZoom)throw Error("maxZoom must be greater than or equal to minZoom");if(null!=i.minPitch&&null!=i.maxPitch&&i.minPitch>i.maxPitch)throw Error("maxPitch must be greater than or equal to minPitch");if(null!=i.minPitch&&i.minPitch<0)throw Error("minPitch must be greater than or equal to 0");if(null!=i.maxPitch&&i.maxPitch>180)throw Error("maxPitch must be less than or equal to 180");this._camera=new oj({minZoom:i.minZoom,maxZoom:i.maxZoom,minPitch:i.minPitch,maxPitch:i.maxPitch,bearingSnap:i.bearingSnap,zoomSnap:i.zoomSnap,renderWorldCopies:i.renderWorldCopies,centerClampedToGround:i.centerClampedToGround,terrain:this.terrain,transformConstrain:i.transformConstrain,requestRenderFrame:t=>this._requestRenderFrame(t),cancelRenderFrame:t=>this._cancelRenderFrame(t),transformCameraUpdate:i.transformCameraUpdate,stopHandlers:()=>this._handlers?.stop(!1)}),this._camera.setEventedParent(this),this._interactive=i.interactive,this._maxTileCacheSize=i.maxTileCacheSize,this._maxTileCacheZoomLevels=i.maxTileCacheZoomLevels,this._canvasContextAttributes={...i.canvasContextAttributes},this._trackResize=!0===i.trackResize,this._terrainSkirtLength=i.terrainSkirtLength,this._refreshExpiredTiles=!0===i.refreshExpiredTiles,this._fadeDuration=i.fadeDuration,this._crossSourceCollisions=!0===i.crossSourceCollisions,this._collectResourceTiming=!0===i.collectResourceTiming,this._locale={...oH,...i.locale},this._clickTolerance=i.clickTolerance,this._overridePixelRatio=i.pixelRatio,this._maxCanvasSize=i.maxCanvasSize,this._zoomLevelsToOverscale=i.zoomLevelsToOverscale,this.cancelPendingTileRequestsWhileZooming=!0===i.cancelPendingTileRequestsWhileZooming,this.setAnisotropicFilterPitch(i.anisotropicFilterPitch),void 0!==i.reduceMotion&&(C.prefersReducedMotion=i.reduceMotion),this._requestManager=new F(i.transformRequest),this._container=this._resolveContainer(i.container),i.maxBounds&&this.setMaxBounds(i.maxBounds),this._setupContainer();try{this._setupPainter()}catch(t){throw this._cleanupContainer(),t}this._imageQueueHandle=l.addThrottleControl(()=>this.isMoving()),this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this.on("terrain",()=>{this.painter.markTerrainDepthDirty(),this._update(!0)}),this.once("idle",()=>this._idleTriggered=!0),this._handlers=new oO(this,this._camera,i),"u">typeof window&&(this._ownerWindow.addEventListener("online",this._onWindowOnline,!1),this._setupResizeObserver());let r="string"==typeof i.hash&&i.hash||void 0;this._hash=i.hash?new aQ(r).addTo(this):void 0,this._hash?._onHashChange()||(this.jumpTo({center:i.center,elevation:i.elevation,zoom:i.zoom,bearing:i.bearing,pitch:i.pitch,roll:i.roll}),i.bounds&&(this.resize(),this.fitBounds(i.bounds,(0,P.er)({},i.fitBoundsOptions,{duration:0}))));let a="string"==typeof i.style||i.style?.projection?.type!=="globe";this.resize(null,a),this._localIdeographFontFamily=i.localIdeographFontFamily,this._val
vendor: 4,131 bytes, line 816
816idateStyle=i.validateStyle,i.style&&this.setStyle(i.style,{localIdeographFontFamily:i.localIdeographFontFamily}),i.attributionControl&&this.addControl(new oZ("boolean"==typeof i.attributionControl?void 0:i.attributionControl)),i.maplibreLogo&&this.addControl(new oU,i.logoPosition),this.on("style.load",()=>{if(a||this._resizeTransform(),this._camera.transform.unmodified){let t=(0,P.yr)(this.style.stylesheet,["center","zoom","bearing","pitch","roll"]);this.jumpTo(t)}}),this.on("data",t=>{this._update("style"===t.dataType),this.fire("style"===t.dataType?new j("styledata",t):new N("sourcedata",t))}),this.on("dataloading",t=>{this.fire("style"===t.dataType?new j("styledataloading",t):new N("sourcedataloading",t))}),this.on("dataabort",t=>{this.fire(new N("sourcedataabort",t))})}_getMapId(){return this._mapId}setGlobalStateProperty(t,i){return this.style.setGlobalStateProperty(t,i),this._update(!0)}getGlobalState(){return this.style.getGlobalState()}addControl(t,i){if(void 0===i&&(i=t.getDefaultPosition?t.getDefaultPosition():"top-right"),!t?.onAdd)return this.fire(new P.gn(Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));let r=t.onAdd(this);this._controls.push(t);let a=this._controlPositions[i];return i.includes("bottom")?a.insertBefore(r,a.firstChild):a.appendChild(r),this}removeControl(t){if(!t?.onRemove)return this.fire(new P.gn(Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));let i=this._controls.indexOf(t);return i>-1&&this._controls.splice(i,1),t.onRemove(this),this}hasControl(t){return this._controls.includes(t)}coveringTiles(t){return tr(this._camera.transform,t)}setTransformCameraUpdate(t){this._camera.transformCameraUpdate=t}getCenter(){return new P.lt(this._camera.transform.center.lng,this._camera.transform.center.lat)}setCenter(t,i){return this._camera.setCenter(t,i),this}getCenterElevation(){return this._camera.transform.elevation}setCenterElevation(t,i){return this._camera.setCenterElevation(t,i),this}setCenterClampedToGround(t){this._camera.setCenterClampedToGround(t)}panBy(t,i,r){return this._camera.panBy(t,i,r),this}panTo(t,i,r){return this._camera.panTo(t,i,r),this}getZoom(){return this._camera.transform.zoom}setZoom(t,i){return this._camera.setZoom(t,i),this}zoomTo(t,i,r){return this._camera.zoomTo(t,i,r),this}zoomIn(t,i){return this._camera.zoomIn(t,i),this}zoomOut(t,i){return this._camera.zoomOut(t,i),this}getVerticalFieldOfView(){return this._camera.transform.fov}setVerticalFieldOfView(t,i){return this._camera.setVerticalFieldOfView(t,i),this}getBearing(){return this._camera.transform.bearing}setBearing(t,i){return this._camera.setBearing(t,i),this}getZoomSnap(){return this._camera.getZoomSnap()}setZoomSnap(t){return this._camera.setZoomSnap(t),this}getPadding(){return this._camera.transform.padding}setPadding(t,i){return this._camera.setPadding(t,i),this}rotateTo(t,i,r){return this._camera.rotateTo(t,i,r),this}resetNorth(t,i){return this._camera.resetNorth(t,i),this}resetNorthPitch(t,i){return this._camera.resetNorthPitch(t,i),this}snapToNorth(t,i){return this._camera.snapToNorth(t,i),this}getPitch(){return this._camera.transform.pitch}setPitch(t,i){return this._camera.setPitch(t,i),this}getRoll(){return this._camera.transform.roll}setRoll(t,i){return this._camera.setRoll(t,i),this}cameraForBounds(t,i){return this._camera.cameraForBounds(t,i)}fitBounds(t,i,r){return this._camera.fitBounds(t,i,r),this}fitScreenCoordinates(t,i,r,a,o){return this._camera.fitScreenCoordinates(t,i,r,a,o),this}jumpTo(t,i){return this._camera.jumpTo(t,i),this}calculateAnchoredCameraOptions(t){return this._camera.calculateAnchoredCameraOptions(t)}calculateCameraOptionsFromCameraLngLatAltRotation(t,i,r,a,o){return this._camera.calculateCameraOptionsFromCameraLngLatAltRotation(t,i,r,a,o)}easeTo(t,i){return this._camera.easeTo(t,i),this}flyTo(t,i){return this._camera.flyTo(t,i),this}stop(){return this._camera.stop(),this}queryTerrainElevation(t){return this.terrain?this.terrain.getElevationForLngLat(P.lt.convert(t),this._camera.transform):null}
816getCenterClampedToGround(){return this._camera.getCenterClampedToGround()}calculateCameraOptionsFromTo(t,i,r,a){return null==a&&this.terrain&&(a=this.terrain.getElevationForLngLat(r,this._camera.transform)),this._camera.transform.calculateCameraOptionsFromTo(t,i,r,a??0)}resize(t,i=!0){if(null!==this._lostContextStyle.style)return this;this._resizeInternal(i);let r=!this._camera._moving;return r&&(this.stop(),this.fire(new B("movestart",t)).fire(new B("move",t))),this.fire(new k("resize",t)),r&&this.fire(new B("moveend",t)),this}_resizeInternal(t=!0){let[i,r]=this._containerDimensions(),a=this._getClampedPixelRatio(i,r);if(this._resizeCanvas(i,r,a),this.painter.resize(i,r,a),this.painter.overLimit()){let t=this.painter.context.gl;this._maxCanvasSize=[t.drawingBufferWidth,t.drawingBufferHeight];let a=this._getClampedPixelRatio(i,r);this._resizeCanvas(i,r,a),this.painter.resize(i,r,a)}this._resizeTransform(t)}_resizeTransform(t=!0){let[i,r]=this._containerDimensions();this._camera.transform.resize(i,r,t),this._camera._requestedCameraState?.resize(i,r,t)}_getClampedPixelRatio(t,i){let{0:r,1:a}=this._maxCanvasSize,o=this.getPixelRatio(),s=t*o,n=i*o,l=Math.min(s>r?r/s:1,n>a?a/n:1);return l<1&&(0,P.Nr)("The canvas is larger than maxCanvasSize and is rendered at a lower pixel ratio to fit. Increase maxCanvasSize, within MAX_TEXTURE_SIZE, to render at full resolution."),l*o}getPixelRatio(){return this._overridePixelRatio??devicePixelRatio}setPixelRatio(t){this._overridePixelRatio=t,this.resize()}getBounds(){return this._camera.transform.getBounds()}getMaxBounds(){return this._camera.transform.getMaxBounds()}setMaxBounds(t){return this._camera.transform.setMaxBounds(eL.convert(t)),this._update()}setMinZoom(t){if((t??=-2)>=-2&&t<=this._camera.transform.maxZoom){let i=this._camera.transform.zoom,r=this._camera.getTransformForUpdate();return r.setMinZoom(t),this._camera.applyUpdatedTransform(r),this._update(),i!==this._camera.transform.zoom&&this.fire(new B("zoomstart")).fire(new B("zoom")).fire(new B("zoomend")).fire(new B("movestart")).fire(new B("move")).fire(new B("moveend")),this}throw Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(t=!1){let i=this._camera.transform;return t?i.applyConstrain(i.center,i.minZoom).zoom:i.minZoom}setMaxZoom(t){if((t??=22)>=this._camera.transform.minZoom){let i=this._camera.transform.zoom,r=this._camera.getTransformForUpdate();return r.setMaxZoom(t),this._camera.applyUpdatedTransform(r),this._update(),i!==this._camera.transform.zoom&&this.fire(new B("zoomstart")).fire(new B("zoom")).fire(new B("zoomend")).fire(new B("movestart")).fire(new B("move")).fire(new B("moveend")),this}throw Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this._camera.transform.maxZoom}setMinPitch(t){if((t??=0)<0)throw Error("minPitch must be greater than or equal to 0");if(t>=0&&t<=this._camera.transform.maxPitch){let i=this._camera.transform.pitch,r=this._camera.getTransformForUpdate();return r.setMinPitch(t),this._camera.applyUpdatedTransform(r),this._update(),i!==this._camera.transform.pitch&&this.fire(new B("pitchstart")).fire(new B("pitch")).fire(new B("pitchend")).fire(new B("movestart")).fire(new B("move")).fire(new B("moveend")),this}throw Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this._camera.transform.minPitch}setMaxPitch(t){if((t??=60)>180)throw Error("maxPitch must be less than or equal to 180");if(t>=this._camera.transform.minPitch){let i=this._camera.transform.pitch,r=this._camera.getTransformForUpdate();return r.setMaxPitch(t),this._camera.applyUpdatedTransform(r),this._update(),i!==this._camera.transform.pitch&&this.fire(new B("pitchstart")).fire(new B("pitch")).fire(new B("pitchend")).fire(new B("movestart")).fire(new B("move")).fire(new B("moveend")),this}throw Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this._camera.transform.maxPitch}getAnisotropicFilterPitch(){return this._anisotropicFilterPitch}setAnisotropicFilterPitch(t){if((t??=20)>180)throw Error("anisotropicFilterPitch must be less than or equal to 180");if(t<0)throw Error("anisotropicFilterPitch must be greater than or equal to 0");return this._anisotropicFilterPitch=t,this._update()}getRenderWorldCopies(){return this._camera.transform.renderWorldCopies}setRenderWorldCopies(t){return this._camera.transform.setRenderWorldCopies(t),this._update()}setTransformConstrain(t){return this._camera.transform.setConstrainOverride(t),this._update()}project(t){return this._camera.transform.locationToScreenPoint(P.lt.convert(t),this.style&&this.terrain)}unproject(t){return this._camera.transform.screenPointToLocation(P.Li.convert(t),this.terrain)}isMoving(){return this._camera.isMoving()||this._handlers?.isMoving()||!1}isZooming(){return this._camera.isZooming()||this._handlers?.isZooming()||!1}isRotating(){return this._camera.isRotating()||this._handlers?.isRotating()||!1}
816_createDelegatedListener(t,i,r){if("mouseenter"===t||"mouseover"===t){let a=!1;return{layers:i,listener:r,delegates:{mousemove:o=>{let s=i.filter(t=>this.getLayer(t)),n=0===s.length?[]:this.queryRenderedFeatures(o.point,{layers:s});n.length?a||(a=!0,r.call(this,new Z(t,this,o.originalEvent,{features:n}))):a=!1},mouseout:()=>{a=!1}}}}if("mouseleave"===t||"mouseout"===t){let a=!1;return{layers:i,listener:r,delegates:{mousemove:o=>{let s=i.filter(t=>this.getLayer(t));(0===s.length?[]:this.queryRenderedFeatures(o.point,{layers:s})).length?a=!0:a&&(a=!1,r.call(this,new Z(t,this,o.originalEvent)))},mouseout:i=>{a&&(a=!1,r.call(this,new Z(t,this,i.originalEvent)))}}}}{let a=t=>{let a=i.filter(t=>this.getLayer(t)),o=0===a.length?[]:this.queryRenderedFeatures(t.point,{layers:a});o.length&&(t.features=o,r.call(this,t),delete t.features)};return{layers:i,listener:r,delegates:{[t]:a}}}}_saveDelegatedListener(t,i){this._delegatedListeners||={},this._delegatedListeners[t]||=[],this._delegatedListeners[t].push(i)}_removeDelegatedListener(t,i,r){if(!this._delegatedListeners?.[t])return;let a=this._delegatedListeners[t];for(let t=0;t<a.length;t++){let o=a[t];if(o.listener===r&&o.layers.length===i.length&&o.layers.every(t=>i.includes(t))){for(let t in o.delegates)this.off(t,o.delegates[t]);a.splice(t,1);return}}}on(t,i,r){if(void 0===r)return super.on(t,i);let a="string"==typeof i?[i]:i,o=this._createDelegatedListener(t,a,r);for(let i in this._saveDelegatedListener(t,o),o.delegates)this.on(i,o.delegates[i]);return{unsubscribe:()=>{this._removeDelegatedListener(t,a,r)}}}once(t,i,r){if(void 0===r)return super.once(t,i);let a="string"==typeof i?[i]:i,o=this._createDelegatedListener(t,a,r);for(let i in o.delegates){let s=o.delegates[i];o.delegates[i]=(...i)=>{this._removeDelegatedListener(t,a,r),s(...i)}}for(let i in this._saveDelegatedListener(t,o),o.delegates)this.once(i,o.delegates[i]);return this}off(t,i,r){if(void 0===r)return super.off(t,i);let a="string"==typeof i?[i]:i;return this._removeDelegatedListener(t,a,r),this}queryRenderedFeatures(t,i){if(!this.style)return[];let r,a=t instanceof P.Li||Array.isArray(t),o=a?t:[[0,0],[this._camera.transform.width,this._camera.transform.height]];if(i||=(a?{}:t)||{},o instanceof P.Li||"number"==typeof o[0])r=[P.Li.convert(o)];else{let t=P.Li.convert(o[0]),i=P.Li.convert(o[1]);r=[t,new P.Li(i.x,t.y),i,new P.Li(t.x,i.y),t]}return this.style.queryRenderedFeatures(r,i,this._camera.transform)}querySourceFeatures(t,i){return this.style.querySourceFeatures(t,i)}setStyle(t,i){return i=(0,P.er)({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._val
816idateStyle},i),this._styleUrl="string"==typeof t?t:null,!1!==i.diff&&i.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&t?(this._diffStyle(t,i),this):(this._localIdeographFontFamily=i.localIdeographFontFamily,this._updateStyle(t,i))}setTransformRequest(t){return this._requestManager.setTransformRequest(t),this}_getUIString(t){let i=this._locale[t];if(null==i)throw Error(`Missing UI string '${t}'`);return i}_updateStyle(t,i){if(this._diffStyleRequest?.abort(),this._diffStyleRequest=null,i.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",()=>this._updateStyle(t,i));let r=this.style&&i.transformStyle?this.style.serialize():void 0;return(this.style&&(this.style.setEventedParent(null),this.style._remove(!t)),t)?(this.style=new i2(this,i||{}),this.style.setEventedParent(this,{style:this.style}),"string"==typeof t?this.style.loadURL(t,i,r):this.style.loadJSON(t,i,r)):(this._frameRequest&&=(this._frameRequest.abort(),null),this.style?.projection?.destroy(),delete this.style),this}_lazyInitEmptyStyle(){this.style||(this.style=new i2(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}async _diffStyle(t,i){if(this._diffStyleRequest?.abort(),"string"==typeof t){this._diffStyleRequest=new AbortController;let r=this._diffStyleRequest;try{let a=await this._requestManager.transformRequest(t,"Style");if(r.signal.aborted){this._diffStyleRequest=null;return}let o=await (0,P.Sn)(a,r);this._diffStyleRequest=null,this._updateDiff(o.data,i)}catch(t){this._diffStyleRequest=null,(0,P.Mn)(t)||this.fire(new P.gn((0,P.Qn)(t)))}}else"object"==typeof t&&(this._diffStyleRequest=null,this._updateDiff(t,i))}_updateDiff(t,i){try{this.style.setState(t,i)&&this._update(!0)}catch(r){(0,P.Nr)(`Unable to perform style diff: ${(0,P.Qn)(r).message}. Rebuilding the style from scratch.`),this._updateStyle(t,i)}}getStyle(){if(this.style)return this.style.serialize()}getStyleUrl(){return this._styleUrl}_getStyleAndImages(){return this.style?{style:this.style.serialize(),images:this.style.imageManager.cloneImages()}:{style:null,images:{}}}isStyleLoaded(){return this.style?this.style.loaded():void(0,P.Nr)("There is no style added to the map.")}addSource(t,i){return this._lazyInitEmptyStyle(),this.style.addSource(t,i),this._update(!0)}isSourceLoaded(t){let i=this.style?.tileManagers[t];return void 0===i?void this.fire(new P.gn(Error(`There is no tile manager with ID '${t}'`))):i.loaded()}setTerrain(t,i={}){if(this.style._checkLoaded(),t&&(0,P.an)(this,P.on.terrain,{value:t},i))return this;if(this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),t){let i=this.style.tileManagers[t.source];if(!i)throw Error(`cannot load terrain, because there exists no source with ID: ${t.source}`);for(let r in null===this.terrain&&i.reload(),this.style._layers){let i=this.style._layers[r];"hillshade"===i.type&&i.source===t.source&&(0,P.Nr)("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality."),"color-relief"===i.type&&i.source===t.source&&(0,P.Nr)("You are using the same source for a color-relief layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain&&this.terrain.destroy(),this.terrain=new ic(this.painter,i,t,this._terrainSkirtLength),this.painter.renderToTexture=new o$(this.painter,this.terrain),this._camera.setTerrain(this.terrain),this._terrainDataCallback=i=>this._handleTerrainDataEvent(i,t.source),this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.destroy(),this.terrain=null,this.painter.renderToTexture=null,this.painter.destroyRTTResources(),this._camera.setTerrain(null);return this.style.triggerSymbolPlacement(),this.fire(new q({terrain:t})),this}_handleTerrainDataEvent(t,i){if("style"===t.dataType)return void this.terrain.tileManager.releaseAllRTT();let r=t.sourceId===i;if(r&&(this.terrain.resetElevationCache(),this.style.triggerSymbolPlacement()),r&&t.tile&&(this.painter.markTerrainDepthDirty(),this._camera.applyTerrainChange()),t.tile){if(t.source?.type==="image")return void this.terrain.tileManager.releaseAllRTT();this.terrain.tileManager.releaseRTT(t.tile.tileID)}}getTerrain(){return this.terrain?.options??null}areTilesLoaded(){for(let t of Object.values(this.style?.tileManagers))if(!t.areTilesLoaded())return!1;return!0}removeSource(t){return this.style.removeSource(t),this._update(!0)}getSource(t){return this.style?.getSource(t)}setSourceTileLodParams(t,i,r){if(r){let a=this.getSource(r);if(!a)throw Error(`There is no source with ID "${r}", cannot set LOD parameters`);a.calculateTileZoom=te(Math.max(1,t),Math.max(1,i))}else for(let r in this.style.tileManagers)this.style.tileManagers[r].getSource().calculateTileZoom=te(Math.max(1,t),Math.max(1,i));return this._update(!0),this}refreshTiles(t,i){let r=this.style.tileManagers[t];if(!r)throw Error(`There is no tile manager with ID "${t}", cannot refresh tile`);void 0===i?r.reload(!0):r.refreshTiles(i.map(t=>new P.u(t.z,t.x,t.y)))}addImage(t,i,r={}){this._lazyInitEmptyStyle();let a=this._createStyleImage(i,r);return a&&(this.style.addImage(t,a),a.userImage?.onAdd&&a.userImage.onAdd(this,t)),this}setMissingStyleImageResolver(t){return this._missingStyleImageResolver=t,this.style?.setMissingImageResolver(t),this}_createStyleImage(t,i={}){let{pixelRatio:r=1,sdf:a=!1,stretchX:o,stretchY:s,content:n,textFitWidth:l,textFitHeight:h}=i;if(t instanceof HTMLImageElement||(0,P.cr)(t)){let{width:i,height:c,data:u}=C.getImageData(t);return{data:new P.Dt({width:i,height:c},u),pixelRatio:r,stretchX:o,stretchY:s,content:n,textFitWidth:l,textFitHeight:h,sdf:a,version:0}}if(void 0===t.width||void 0===t.height)return this.fire(new P.gn(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`"))),null;{let{width:i,height:c,data:u}=t,d=(0,P.I)(t.data);return{data:d?new P.Dt({width:i,height:c}):new P.Dt({width:i,height:c},new Uint8Array(u)),pixelRatio:r,stretchX:o,stretchY:s,content:n,textFitWidth:l,textFitHeight:h,sdf:a,version:0,isWebG
816LImage:d,userImage:t}}}updateImage(t,i){let r=this.style.getImage(t);if(!r)return this.fire(new P.gn(Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));let{width:a,height:o,data:s}=i instanceof HTMLImageElement||(0,P.cr)(i)?C.getImageData(i):i;if(void 0===a||void 0===o)return this.fire(new P.gn(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(a!==r.data.width||o!==r.data.height)return this.fire(new P.gn(Error("The width and height of the updated image must be that same as the previous version of the image")));if(r.isWebGLImage=(0,P.I)(s),r.isWebGLImage)r.userImage=i;else{let t=!(i instanceof HTMLImageElement||(0,P.cr)(i));r.data.replace(s,t)}return this.style.updateImage(t,r),this}getImage(t){return this.style.getImage(t)}hasImage(t){return t?!!this.style.getImage(t):(this.fire(new P.gn(Error("Missing required image id"))),!1)}removeImage(t){this.style.removeImage(t)}async loadImage(t){let i=await l.getImage(await this._requestManager.transformRequest(t,"Image"),new AbortController);if(!i.data)throw Error(`Could not load image ${t}: the response is empty`);return i}listImages(){return this.style?.listImages()??[]}addLayer(t,i){return this._lazyInitEmptyStyle(),this.style.addLayer(t,i),this._update(!0)}moveLayer(t,i){return this.style.moveLayer(t,i),this._update(!0)}removeLayer(t){return this.style.removeLayer(t),this._update(!0)}getLayer(t){return this.style?.getLayer(t)}getLayersOrder(){return this.style?.getLayersOrder()??[]}setLayerZoomRange(t,i,r){return this.style.setLayerZoomRange(t,i,r),this._update(!0)}setFilter(t,i,r={}){return this.style?.setFilter(t,i,r),this._update(!0)}getFilter(t){return this.style.getFilter(t)}setPaintProperty(t,i,r,a={}){return this.style?.setPaintProperty(t,i,r,a),this._update(!0)}getPaintProperty(t,i){return this.style.getPaintProperty(t,i)}setLayoutProperty(t,i,r,a={}){return this.style.setLayoutProperty(t,i,r,a),this._update(!0)}getLayoutProperty(t,i){return this.style.getLayoutProperty(t,i)}setGlyphs(t,i={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(t,i),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}setFontFaces(t){return this._lazyInitEmptyStyle(),this.style.setFontFaces(t),this._update(!0)}getFontFaces(){return this.style.getFontFaces()}addSprite(t,i,r={}){return this._lazyInitEmptyStyle(),this.style.addSprite(t,i,r,t=>{t||this._update(!0)}),this}removeSprite(t){return this._lazyInitEmptyStyle(),this.style.removeSprite(t),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(t,i={}){return this._lazyInitEmptyStyle(),this.style.setSprite(t,i,t=>{t||this._update(!0)}),this}setLight(t,i={}){return this._lazyInitEmptyStyle(),this.style.setLight(t,i),this._update(!0)}getLight(){return this.style.getLight()}setSky(t,i={}){return this._lazyInitEmptyStyle(),this.style.setSky(t,i),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(t,i){return this.style.setFeatureState(t,i),this._update()}removeFeatureState(t,i){return this.style.removeFeatureState(t,i),this._update()}getFeatureState(t){return this.style.getFeatureState(t)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let t=0,i=0;return this._container&&(t=this._container.clientWidth||400,i=this._container.clientHeight||300),[t,i]}_shouldHandleInitialResize(){if(!this._container?.clientWidth||!this._container.clientHeight)return!1;let[t,i]=this._containerDimensions();return t!==this._camera.transform.width||i!==this._camera.transform.height}_setupResizeObserver(){let t=!1,i=aJ(t=>{this._trackResize&&!this._removed&&(this.resize(t),this.redraw())},50),r=this._ownerWindow.ResizeObserver??ResizeObserver;this._resizeObserver=new r(r=>{(t||(t=!0,this._shouldHandleInitialResize()))&&i(r)}),this._resizeObserver.observe(this._container)}_resolveContainer(t){if("string"==typeof t){let i=document.getElementById(t);if(!i)throw Error(`Container '${t}' not found.`);return i}if(t instanceof HTMLElement||t&&"object"==typeof t&&1===t.nodeType)return t;throw Error("Invalid type: 'container' must be a String or HTMLElement.")}_setupContainer(){let t=this._containerDimensions(),i=this._getClampedPixelRatio(t[0],t[1]),r=this._container;r.classList.add("maplibregl-map");let a=this._canvasContainer=A.create("div","maplibregl-canvas-container",r);this._interactive&&a.classList.add("maplibregl-interactive"),this._canvas=A.create("canvas","maplibregl-canvas",a),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex",this._interactive?"0":"-1"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","regi
816on"),this._resizeCanvas(t[0],t[1],i);let o=this._controlContainer=A.create("div","maplibregl-control-container",r),s=this._controlPositions={};for(let t of["top-left","top-right","bottom-left","bottom-right"])s[t]=A.create("div",`maplibregl-ctrl-${t} `,o);this._container.addEventListener("scroll",this._onMapScroll,!1)}_cleanupContainer(){this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),this._canvasContainer.remove(),this._controlContainer.remove(),this._container.removeEventListener("scroll",this._onMapScroll,!1),this._container.classList.remove("maplibregl-map")}_resizeCanvas(t,i,r){this._canvas.width=Math.floor(r*t),this._canvas.height=Math.floor(r*i),this._canvas.style.width=`${t}px`,this._canvas.style.height=`${i}px`}_setupPainter(){let t={...this._canvasContextAttributes,alpha:!0,depth:!0,stencil:!0,premultipliedAlpha:!0},i=null;this._canvas.addEventListener("webglcontextcreationerror",t=>{i=t},{once:!0});let r=this._canvas.getContext("webgl2",t);if(!r)throw new aK(t,i);this.painter=new aY(r,this._camera.transform)}migrateProjection(t,i){this._camera.migrateProjection(t,i),this.painter.transform=t,this.fire(new W({newProjection:this.style.projection.name}))}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(t){return this.style?._loaded&&(this._styleDirty||=t,this._sourcesDirty=!0,this.triggerRepaint()),this}_requestRenderFrame(t){return this._update(),this._renderTaskQueue.add(t)}_cancelRenderFrame(t){this._renderTaskQueue.remove(t)}_render(t){let i=this._idleTriggered?this._fadeDuration:0,r=this.style.projection?.transitionState>0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(t),this._removed)return;let a=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;let t=this._camera.transform.zoom,r=S();this.style.zoomHistory.update(t,r);let o=new P.en(t,{now:r,fadeDuration:i,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),s=o.crossFadingFactor();(1!==s||s!==this._crossFadingFactor)&&(a=!0,this._crossFadingFactor=s),this.style.update(o)}let o=this.style.projection?.transitionState>0!==r;this._camera.transform.setTransitionState(this.style.projection?.transitionState),this.style&&(this._sourcesDirty||o)&&(this._sourcesDirty=!1,this.style._updateSources(this._camera.transform)),this.terrain?(this.terrain.tileManager.update(this._camera.transform,this.terrain)&&this.terrain.resetElevationCache(),this._camera.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._camera.transform.center,this._camera.transform.tileZoom)),!this._camera.elevationFreeze&&this.getCenterClampedToGround()&&this._camera.transform.setElevation(this.terrain.getElevationForLngLat(this._camera.transform.center,this._camera.transform))):(this._camera.transform.setMinElevationForCurrentTile(0),this.getCenterClampedToGround()&&this._camera.transform.setElevation(0)),this._placementDirty=this.style?._updatePlacement(this._camera.transform,this.showCollisionBoxes,i,this._crossSourceCollisions,o),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:i,showPadding:this.showPadding,anisotropicFilterPitch:this.getAnisotropicFilterPitch()}),this.fire(new k("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,this.fire(new k("load"))),this.style&&(this.style.hasTransitions()||a)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();let s=this._sourcesDirty||this._styleDirty||this._placementDirty||this.painter.renderToTexture?.needsFollowUpFrame;return s||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new k("idle")),!this._loaded||this._fullyLoaded||s||(this._fullyLoaded=!0),this}redraw(){return this.style&&(this._frameRequest&&=(this._frameRequest.abort(),null),this._render(0)),this}remove(){for(let t of(this._hash&&this._hash.remove(),this._controls))t.onRemove(this);this._controls=[],this._frameRequest&&=(this._frameRequest.abort(),null),this._renderTaskQueue.clear(),this._diffStyleRequest?.abort(),this.painter.destroy(),this._handlers.destroy(),this.setStyle(null),"u">typeof window&&this._ownerWindow.removeEventListener("online",this._onWindowOnline,!1),l.removeThrottleControl(this._imageQueueHandle),this._resizeObserver?.disconnect();let t=this.painter.context.gl.getExtension("WEBGL_lose_context");t?.loseContext&&t.loseContext(),this._cleanupContainer(),this._removed=!0,this.fire(new k("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,C.frame(this._frameRequest,t=>{this._frameRequest=null;try{this._render(t)}catch(t){if(!(0,P.Mn)(t))throw t}},()=>{},this._ownerWindow))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(t){this._showTileBoundaries!==t&&(this._showTileBoundaries=t,this._update())}get showPadding(){return!!this._showPadding}set showPadding(t){this._showPadding!==t&&(this._showPadding=t,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(t){this._showCollisionBoxes!==t&&(this._showCollisionBoxes=t,t?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(t){this._showOverdrawInspector!==t&&(this._showOverdrawInspector=t,this._update())}get repaint(){return!!this._repaint}set repaint(t){this._repaint!==t&&(this._repaint=t,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(t){this._vertices=t,this._update()}get version(){return"6.11.1"}getCameraTargetElevation(){return this._camera.transform.elevation}getProjection(){return this.style.getProjection()}setProjection(t){return this._lazyInitEmptyStyle(),this.style.setProjection(t),this._update(!0)}};let oK={showCompass:!0,showZoom:!0,visualizePitch:!1,visualizeRoll:!0};var oJ=class{constructor(t){this._updateZoomButtons=()=>{let t=this._map.getZoom(),i=t===this._map.getMaxZoom(),r=t===this._map.getMinZoom(!0);this._zoomInButton.disabled=i,this._zoomOutButton.disabled=r,this._zoomInButton.setAttribute("aria-disabled",i.toString()),this._zoomOutButton.setAttribute("aria-disabled",r.toString())},this._rotateCompassArrow=()=>{let t=this._map.getPitch(),i=this._map.getRoll(),r=this._map.getBearing(),a=1/Math.cos((0,P.Yn)(t))**.5;if(this.options.visualizePitch&&this.options.visualizeRoll){this._compassIcon.style.transform=`scale(${a}) rotateZ(${-i}deg) rotateX(${t}deg) rotateZ(${-r}deg)`;return}if(this.options.visualizePitch){this._compassIcon.style.transform=`scale(${a}) rotateX(${t}deg) rotateZ(${-r}deg)`;return}if(this.options.visualizeRoll){this._compassIcon.style.transform=`rotate(${-r-i}deg)`;return}this._compassIcon.style.transform=`rotate(${-r}deg)`},this._setButtonTitle=(t,i)=>{let r=this._map._getUIString(`NavigationControl.${i}`);t.title=r,t.setAttribute("aria-label",r)},this.options=(0,P.er)({},oK,t),this._container=A.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",t=>t.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",t=>this._map.zoomIn({},{originalEvent:t})),A.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",t=>this._map.zoomOut({},{originalEvent:t})),A.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",t=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:t}):this._map.resetNorth({},{originalEvent:t})}),this._compassIcon=A.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(t){return this._map=t,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("move",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this.options.visualizeRoll&&this._map.on("roll",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new oQ(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){this._container.remove(),this.options.showZoom&&this._map.off("move",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this.options.visualizeRoll&&this._map.off("roll",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(t,i){let r=A.create("button",t,this._container);return r.type="button",r.addEventListener("click",i),r}},oQ=class{constructor(t,i,r=!1){this.mousedown=t=>{this.startMove(t,A.mousePos(this.element,t)),window.addEventListener("mousemove",this.mousemove),window.addEventListener("mouseup",this.mouseup)},this.mousemove=t=>{this.move(t,A.mousePos(this.element,t))},this.mouseup=t=>{this._rotatePitchHandler.dragEnd(t),this.offTemp()},this.touchstart=t=>{1===t.targetTouches.length?(this._startPos=this._lastPos=A.touchPos(this.element,t.targetTouches)[0],this.startMove(t,this._startPos),window.addEventListener("touchmove",this.touchmove,{passive:!1}),window.addEventListener("touchend",this.touchend)):this.reset()},this.touchmove=t=>{1===t.targetTouches.length?(this._lastPos=A.touchPos(this.element,t.targetTouches)[0],this.move(t,this._lastPos)):this.reset()},this.touchend=t=>{0===t.targetTouches.length&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),delete this._startPos,delete this._lastPos,this.offTemp()},this.reset=()=>{this._rotatePitchHandler.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10,this.element=i;let a=new oc;this._rotatePitchHandler=new os({clickTolerance:3,move:(t,a)=>{let o=i.getBoundingClientRect(),s=new P.Li((o.bottom-o.top)/2,(o.right-o.left)/2);return{bearingDelta:(0,P.ir)(new P.Li(t.x,a.y),a,s),pitchDelta:r?-((a.y-t.y)*.5):void 0}},moveStateManager:a,enable:!0,assignEvents:()=>{}}),this.map=t,i.addEventListener("mousedown",this.mousedown),i.addEventListener("touchstart",this.touchstart,{passive:!1}),i.addEventListener("touchcancel",this.reset)}startMove(t,i){this._rotatePitchHandler.dragStart(t,i),A.disableDrag()}move(t,i){let r=this.map,{bearingDelta:a,pitchDelta:o}=this._rotatePitchHandler.dragMove(t,i)||{};a&&r.setBearing(r.getBearing()+a),o&&r.setPitch(r.getPitch()+o)}off(){let t=this.element;t.removeEventListener("mousedown",this.mousedown),t.removeEventListener("touchstart",this.touchstart),window.removeEventListener("touchmove",this.touchmove),window.removeEventListener("touchend",this.touchend),t.removeEventListener("touchcancel",this.reset),this.offTemp()}offTemp(){A.enableDrag(),window.removeEventListener("mousemove",this.mousemove),window.removeEventListener("mouseup",this.mouseup),window.removeEventListener("touchmove",this.touchmove),window.removeEventListener("touchend",this.touchend)}};function o0(t,i,r,a=!1){if(a||!r.getCoveringTilesDetailsProvider().allowWorldCopies())return t?.wrap();let o=new P.lt(t.lng,t.lat);
816if(t=new P.lt(t.lng,t.lat),i){let a=new P.lt(t.lng-360,t.lat),o=new P.lt(t.lng+360,t.lat),s=r.locationToScreenPoint(t).distSqr(i);r.locationToScreenPoint(a).distSqr(i)<s?t=a:r.locationToScreenPoint(o).distSqr(i)<s&&(t=o)}for(;Math.abs(t.lng-r.center.lng)>180;){let i=r.locationToScreenPoint(t);if(i.x>=0&&i.y>=0&&i.x<=r.width&&i.y<=r.height)break;t.lng>r.center.lng?t.lng-=360:t.lng+=360}return t.lng!==o.lng&&r.isPointOnMapSurface(r.locationToScreenPoint(t))?t:o}let o1={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"};function o2(t,i,r){let a=t.classList;for(let t in o1)a.remove(`maplibregl-${r}-anchor-${t}`);a.add(`maplibregl-${r}-anchor-${i}`)}let o4={ArrowLeft:[-1,0],ArrowRight:[1,0],ArrowUp:[0,-1],ArrowDown:[0,1]},o3="#3FB1CE";function o5(t,i,r=[]){let a=A.createNS("http://www.w3.org/2000/svg",t);for(let t in i)a.setAttributeNS(null,t,i[t]);for(let t of r)a.appendChild(t);return a}var o6=class extends P._n{},o8=class extends P._n{},o9=class extends P.vn{constructor(t){if(super(),this._onClick=t=>{this.fire(new o8("click",{originalEvent:t}))},this._onKeyPress=t=>{("Space"===t.code||"Enter"===t.code)&&this.togglePopup()},this._onKeyDown=t=>{if(!this._defaultMarker||!this._draggable||!this._map||!this._lngLat||t.composedPath()[0]!==this._element||t.altKey||t.ctrlKey||t.metaKey)return;let i=o4[t.key];if(!i)return;t.preventDefault(),t.stopPropagation();let r=t.shiftKey?10:1,a=this._map.project(this._lngLat);this.setLngLat(this._map.unproject(new P.Li(a.x+i[0]*r,a.y+i[1]*r))),this._keyboardDragActive||(this._keyboardDragActive=!0,this.fire(new o6("dragstart"))),this.fire(new o6("drag"))},this._onKeyUp=t=>{o4[t.key]&&this._endKeyboardDrag()},this._onBlur=()=>{this._endKeyboardDrag()},this._onMapClick=t=>{let i=t.originalEvent.target,r=this._element;this._popup&&(i===r||r.contains(i))&&this.togglePopup()},this._updateCoveredUnthrottled=()=>{let t=this._map?.terrain;if(!t||!this._isInViewport())return;let i=this._isCovered(t);i&&this._popup?.isOpen()&&this._popup.remove(),this._element.style.opacity=i?this._opacityWhenCovered:this._opacity,this._element.classList.toggle("maplibregl-marker-covered",i)},this._updateCovered=aJ(this._updateCoveredUnthrottled,100),this._update=t=>{if(!this._map)return;this._lngLat=o0(this._lngLat,this._flatPos,this._map._camera.transform),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map._camera.transform.locationToScreenPoint(this._lngLat)._add(this._offset));let i="";"viewport"===this._rotationAlignment||"auto"===this._rotationAlignment?i=`rotateZ(${this._rotation}deg)`:"map"===this._rotationAlignment&&(i=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let r="";"viewport"===this._pitchAlignment||"auto"===this._pitchAlignment?r="rotateX(0deg)":"map"===this._pitchAlignment&&(r=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||t?.type==="move"||(this._pos=this._pos.round()),this._element.style.transform=`${o1[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${r} ${i}`,this._updateOpacity()},this._onMove=t=>{if(!this._isDragging){let i=this._clickTolerance||this._map._clickTolerance;this._isDragging=t.point.dist(this._pointerdownPos)>=i}this._isDragging&&(this._pos=t.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none","pending"===this._state&&(this._state="active",this.fire(new o6("dragstart"))),this.fire(new o6("drag")))},this._onUp=()=>{this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),"active"===this._state&&this.fire(new o6("dragend")),this._state="inactive"},this._addDragHandler=t=>{this._element.contains(t.originalEvent.target)&&(t.preventDefault(),this._positionDelta=t.point.sub(this._pos).add(this._offset),this._pointerdownPos=t.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},this._anchor=t?.anchor||"center",this._color=t?.color||o3,this._scale=t?.scale||1,this._draggable=t?.draggable||!1,this._clickTolerance=t?.clickTolerance||0,this._subpixelPositioning=t?.subpixelPositioning||!1,this._isDragging=!1,this._roleManaged=!1,this._tabIndexManaged=!1,this._keyboardDragActive=!1,this._state="inactive",this._rotation=t?.rotation||0,this._rotationAlignment=t?.rotationAlignment||"auto",this._pitchAlignment=t?.pitchAlignment&&"auto"!==t.pitchAlignment?t.pitchAlignment:this._rotationAlignment,this.setOpacity(t?.opacity,t?.opacityWhenCovered),t?.element)this._element=t.element,this._offset=P.Li.convert(t?.offset||[0,0]);else{this._defaultMarker=!0,this._element=A.create("div");let i=(m||(m=o5("svg",{display:"block",height:"41px",width:"27px",viewBox:"0 0 27 41"},[o5("g",{"fill-rule":"nonzero"},[o5("g",{transform:"translate(3.0, 29.0)",fill:"#000000"},[["10.5","5.25002273"],["10.5","5.25002273"],["9.5","4.77275007"],["8.5","4.29549936"],["7.5","3.81822308"],["6.5","3.34094679"],["5.5","2.86367051"],["4.5","2.38636864"]].map(([t,i])=>o5("ellipse",{opacity:"0.04",cx:"10.5",cy:"5.80029008",rx:t,ry:i}))),o5("g",{fill:o3},[o5("path",{d:"M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"})]),o5("g",{opacity:"0.25",fill:"#000000"},[o5("path",{d:"M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"})]),o5("g",{transform:"translate(6.0, 7.0)",fill:"#FFFFFF"}),o5("g",{transform:"translate(8.0, 8.0)"},[o5("circle",{fill:"#000000",opacity:"0.25",cx:"5.5",cy:"5.5",r:"5.4999962"}),o5("circle",{fill:"#FFFFFF",cx:"5.5",cy:"5.5",r:"5.4999962"})])])]))).cloneNode(!0);i.setAttributeNS(null,"height",`${41*this._scale}px`),i.setAttributeNS(null,"width",`${27*this._scale}px`),(function(t){return t.firstElementChild.children[1]})(i).setAttributeNS(null,"fill",this._color),this._element.appendChild(i),this._offset=P.Li.convert(t?.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",t=>{t.preventDefault()}),this._element.addEventListener("mousedown",t=>{t.preventDefault()}),o2(this._element,this._anchor,"marker"),t?.className)for(let i of t.className.split(" "))this._element.classList.add(i);this._popup=null}addTo(t){return this.remove(),this._map=t,this._defaultMarker&&!this._element.hasAttribute("aria-label")&&this._element.setAttribute("aria-label",t._getUIString("Marker.Title")),this._updateAccessibilityRole(),t.getCanvasContainer().appendChild(this._element),t.on("move",this._update),t.on("moveend",this._update),t.on("terrain",this._update),t.on("projectiontransition",this._update),t.on("idle",this._update),this._element.addEventListener("click",this._onClick),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("terrain",this._update),this._map.off("projectiontransition",this._update),this._map.off("idle",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),this._element.removeEventListener("click",this._onClick),this._element.removeEventListener("keydown",this._onKeyDown),this._element.removeEventListener("keyup",this._onKeyUp),this._element.removeEventListener("blur",this._onBlur),this._element.removeEventListener("keypress",this._onKeyPress),this._keyboardDragActive=!1,this._element.remove(),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=P.lt.convert(t),this._pos=null,this._update(),this._popup&&this._popup.setLngLat(this._lngLat),this}getElement(){return this._element}setPopup(t){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress)),t){if(!("offset"in t.options)){let i=13.5/Math.SQRT2;t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[
8160,-38.1],"bottom-left":[i,-((24.6+i)*1)],"bottom-right":[-i,-((24.6+i)*1)],left:[13.5,-24.6],right:[-13.5,-24.6]}:this._offset}this._popup=t,this._element.addEventListener("keypress",this._onKeyPress)}return this._updateTabIndex(),this._updateAccessibilityRole(),this}setSubpixelPositioning(t){return this._subpixelPositioning=t,this}_endKeyboardDrag(){this._keyboardDragActive&&(this._keyboardDragActive=!1,this.fire(new o6("dragend")))}getPopup(){return this._popup}togglePopup(){let t=this._popup;return this._element.style.opacity===this._opacityWhenCovered||t&&(t.isOpen()?t.remove():(t.setLngLat(this._lngLat),t.addTo(this._map))),this}_updateOpacity(){if(!this._isInViewport())return;let t=this._map?.terrain,i=this._map._camera.transform.isLocationOccluded(this._lngLat);if(!t||i){let t=i?this._opacityWhenCovered:this._opacity;this._element.style.opacity!==t&&(this._element.style.opacity=t,this._element.classList.toggle("maplibregl-marker-covered",i));return}this._updateCovered()}_isInViewport(){let{width:t,height:i}=this._map._camera.transform;return!!this._pos&&this._pos.x>=0&&this._pos.y>=0&&this._pos.x<=t&&this._pos.y<=i}_isCovered(t){let i=this._map._camera.transform,r=t.getElevationForLngLat(this._lngLat,i),a=Math.max(0,-this._offset.y)/i.pixelsPerMeter,o=Math.sin(this._map.getPitch()*Math.PI/180)*a;return i.isLocationOccluded(this._lngLat,t,r+o)}getOffset(){return this._offset}setOffset(t){return this._offset=P.Li.convert(t),this._update(),this}addClassName(t){this._element.classList.add(t)}removeClassName(t){this._element.classList.remove(t)}toggleClassName(t){return this._element.classList.toggle(t)}setDraggable(t){return this._draggable=!!t,this._element.classList.toggle("maplibregl-marker-draggable",this._draggable),this._map&&(t?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this._defaultMarker&&(this._draggable?(this._element.addEventListener("keydown",this._onKeyDown),this._element.addEventListener("keyup",this._onKeyUp),this._element.addEventListener("blur",this._onBlur)):(this._element.removeEventListener("keydown",this._onKeyDown),this._element.removeEventListener("keyup",this._onKeyUp),this._element.removeEventListener("blur",this._onBlur),this._endKeyboardDrag())),this._updateTabIndex(),this._updateAccessibilityRole(),this}isDraggable(){return this._draggable}_updateTabIndex(){this._popup||this._defaultMarker&&this._draggable?this._element.hasAttribute("tabindex")||(this._element.setAttribute("tabindex","0"),this._tabIndexManaged=!0):this._tabIndexManaged&&=("0"===this._element.getAttribute("tabindex")&&this._element.removeAttribute("tabindex"),!1)}_updateAccessibilityRole(){if(!this._defaultMarker||this._element.hasAttribute("role")&&!this._roleManaged)return;let t=this._draggable||this._popup?"button":"img";this._element.setAttribute("role",t),this._roleManaged=!0}setRotation(t){return this._rotation=t||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(t){return this._rotationAlignment=t||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(t){return this._pitchAlignment=t&&"auto"!==t?t:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(t,i){return(void 0===this._opacity||void 0===t&&void 0===i)&&(this._opacity="1",this._opacityWhenCovered="0.2"),void 0!==t&&(this._opacity=String(t)),void 0!==i&&(this._opacityWhenCovered=String(i)),this._map&&this._updateOpacity(),this}};P._n,P._n,P._n,P.vn,P._n,P.vn;let o7={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1,locationOccludedOpacity:void 0,padding:void 0};var se=class extends P._n{},st=class extends P.vn{constructor(t){super(),this._updateOpacity=()=>{void 0!==this.options.locationOccludedOpacity&&(this._map._camera.transform.isLocationOccluded(this.getLngLat())?this._container.style.opacity=`${this.options.locationOccludedOpacity}`:this._container.style.opacity="")},this.remove=()=>(this._content&&this._content.remove(),this._container&&(this._container.remove(),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("terrain",this._update),this._map.off("projectiontransition",this._update),this._map.off("idle",this._update),this._map.off("mousemove",this._update),this._map.off("mouseup",this._update),this._map.off("drag",this._update),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new se("close"))),this),this._update=t=>{let i,r=this._lngLat||this._trackPointer;if(!this._map||!r||!this._content)return;if(!this._container){if(this._container=A.create("div","maplibregl-popup",this._map.getContainer()),this._tip=A.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(let t of this.options.className.split(" "))this._container.classList.add(t);this._closeButton&&this._closeButton.setAttribute("aria-label",this._map._getUIString("Popup.Close")),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=o0(this._lngLat,this._flatPos,this._map._camera.transform,this._trackPointer),t&&"point"in t&&t.point&&(i=t.point),this._trackPointer&&!i)return;let a=this._flatPos=this._pos=this._trackPointer&&i?i:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&i?i:this._map._camera.transform.locationToScreenPoint(this._lngLat));let o=this.options.anchor,s=function t(i){if(!i)return t(new P.Li(0,0));if("number"==typeof i){let t=Math.round(Math.abs(i)/Math.SQRT2);return{center:new P.Li(0,0),top:new P.Li(0,i),"top-left":new P.Li(t,t),"top-right":new P.Li(-t,t),bottom:new P.Li(0,-i),"bottom-left":new P.Li(t,-t),"bottom-right":new P.Li(-t,-t),left:new P.Li(i,0),right:new P.Li(-i,0)}}if(i instanceof P.Li||Array.isArray(i)){let t=P.Li.convert(i);return{center:t,top:t,"top-left":t,"top-right":t,bottom:t,"bottom-left":t,"bottom-right":t,left:t,right:t}}return{center:P.Li.convert(i.center||[0,0]),top:P.Li.convert(i.top||[0,0]),"top-left":P.Li.convert(i["top-left"]||[0,0]),"top-right":P.Li.convert(i["top-right"]||[0,0]),bottom:P.Li.convert(i.bottom||[0,0]),"bottom-left":P.Li.convert(i["bottom-left"]||[0,0]),"bottom-right":P.Li.convert(i["bottom-right"]||[0,0]),left:P.Li.convert(i.left||[0,0]),right:P.Li.convert(i.right||[0,0])}}(this.options.offset);if(!o){var n;let t=this._container.offsetWidth,i=this._container.offsetHeight,r=(n=this.options.padding)?{top:n.top??0,right:n.right??0,bottom:n.bottom??0,left:n.left??0}:{top:0,right:0,bottom:0,left:0},l;l=a.y+s.bottom.y<i+r.top?["top"]:a.y>this._map._camera.transform.height-i-r.bottom?["bottom"]:[],a.x<t/2+r.left?l.push("left"):a.x>this._map._camera.transform.width-t/2-r.right&&l.push("right"),o=0===l.length?"bottom":l.join("-")}let l=a.add(s[o]);this.options.subpixelPositioning||(l=l.round()),this._container.style.transform=`${o1[o]} translate(${l.x}px,${l.y}px)`,o2(this._container,o,"popup"),this._updateOpacity()},this._onClose=()=>{this.remove()},this.options=(0,P.er)(Object.create(o7),t)}addTo(t){return this._map&&this.remove(),this._map=t,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._map.on("terrain",this._update),this._map.on("projectiontransition",this._update),this._map.on("idle",this._update),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._update),this._map.on("mouseup",this._update),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new se("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=P.lt.convert(t),this._pos=null,this._flatPos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._update),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._flatPos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._update),this._map.on("drag",this._update),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(t){return this.setDOMContent(document.createTextNode(t))}setHTML(t){let i=document.createDocumentFragment(),r=document.createElement("body"),a;for(r.innerHTML=t;a=r.firstChild;)i.appendChild(a);return this.setDOMContent(i)}getMaxWidth(){return this._container?.style.maxWidth}setMaxWidth(t){return this.options.maxWidth=t,this._update(),this}setDOMContent(t){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=A.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(t),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(t){return this._container&&this._container.classList.add(t),this}removeClassName(t){return this._container&&this._container.classList.remove(t),this}setOffset(t){return this.options.offset=t,this._update(),this}toggleClassName(t){if(this._container)return this._container.classList.toggle(t)}setSubpixelPositioning(t){this.options.subpixelPositioning=t}setPadding(t){this.options.padding=t,this._update()}_createCloseButton(){this.options.closeButton&&(this._closeButton=A.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;
816let t=this._container.querySelector("a[href], [tabindex]:not([tabindex='-1']), [contenteditable]:not([contenteditable='false']), button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])");t&&t.focus()}}}}]);
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.