@local-logic/sdks-app 2.0.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/index-legacy.0a642cb5.js +1 -0
- package/dist/assets/index-legacy.4e44eb64.js +1 -0
- package/dist/assets/index-legacy.7f6983e2.js +1 -0
- package/dist/assets/index-legacy.919f470f.js +1 -0
- package/dist/assets/{index-legacy.e333988e.js → index-legacy.95ccb44a.js} +14 -14
- package/dist/assets/index-legacy.c9e59904.js +23 -0
- package/dist/assets/index-legacy.fc3fe26b.js +1 -0
- package/dist/assets/{index.d89a7cee.js → index.1bb375cb.js} +13 -13
- package/dist/assets/index.621fb294.js +149 -0
- package/dist/assets/index.795111c8.js +1 -0
- package/dist/assets/index.7a7d9dc0.js +1 -0
- package/dist/assets/index.937af76a.js +247 -0
- package/dist/assets/{index.3eec99ca.js → index.9af49ac7.js} +151 -151
- package/dist/assets/index.f59985f7.js +35 -0
- package/dist/assets/{useIsMobile-legacy.7fb572d8.js → useIsMobile-legacy.ed5dee46.js} +1 -1
- package/dist/assets/{useIsMobile.b5e8d9ad.js → useIsMobile.456ed35b.js} +1 -1
- package/dist/assets/useQuery-legacy.97f1ad62.js +1 -0
- package/dist/assets/useQuery.83f2b67b.js +9 -0
- package/dist/index.html +2 -2
- package/dist/types/context/languageProvider/data-explorer/locales/en/index.d.ts.map +1 -1
- package/dist/types/context/languageProvider/data-explorer/locales/en/index.js +1 -0
- package/dist/types/context/languageProvider/data-explorer/locales/en/index.js.map +1 -1
- package/dist/types/context/languageProvider/data-explorer/locales/fr/index.d.ts.map +1 -1
- package/dist/types/context/languageProvider/data-explorer/locales/fr/index.js +1 -0
- package/dist/types/context/languageProvider/data-explorer/locales/fr/index.js.map +1 -1
- package/dist/types/context/languageProvider/data-explorer/types.d.ts +1 -1
- package/dist/types/context/languageProvider/data-explorer/types.d.ts.map +1 -1
- package/dist/types/context/languageProvider/index.d.ts +2 -2
- package/dist/types/context/languageProvider/index.d.ts.map +1 -1
- package/dist/types/sdks/DataExplorer/components/DataTable/index.d.ts +4 -0
- package/dist/types/sdks/DataExplorer/components/DataTable/index.d.ts.map +1 -0
- package/dist/types/sdks/DataExplorer/components/{Table → DataTable}/index.js +2 -2
- package/dist/types/sdks/DataExplorer/components/DataTable/index.js.map +1 -0
- package/dist/types/sdks/DataExplorer/components/DataTable/styles.d.ts.map +1 -0
- package/dist/types/sdks/DataExplorer/components/DataTable/styles.js.map +1 -0
- package/dist/types/sdks/DataExplorer/components/Export/index.d.ts.map +1 -1
- package/dist/types/sdks/DataExplorer/components/Export/index.js +7 -11
- package/dist/types/sdks/DataExplorer/components/Export/index.js.map +1 -1
- package/dist/types/sdks/DataExplorer/components/Filters/index.d.ts +4 -0
- package/dist/types/sdks/DataExplorer/components/Filters/index.d.ts.map +1 -0
- package/dist/types/sdks/DataExplorer/components/Filters/index.js +51 -0
- package/dist/types/sdks/DataExplorer/components/Filters/index.js.map +1 -0
- package/dist/types/sdks/DataExplorer/components/Filters/styles.d.ts +6 -0
- package/dist/types/sdks/DataExplorer/components/Filters/styles.d.ts.map +1 -0
- package/dist/types/sdks/DataExplorer/components/Filters/styles.js +12 -0
- package/dist/types/sdks/DataExplorer/components/Filters/styles.js.map +1 -0
- package/dist/types/sdks/DataExplorer/components/Section/index.d.ts +2 -4
- package/dist/types/sdks/DataExplorer/components/Section/index.d.ts.map +1 -1
- package/dist/types/sdks/DataExplorer/components/Section/index.js +6 -18
- package/dist/types/sdks/DataExplorer/components/Section/index.js.map +1 -1
- package/dist/types/sdks/DataExplorer/context.d.ts +1 -5
- package/dist/types/sdks/DataExplorer/context.d.ts.map +1 -1
- package/dist/types/sdks/DataExplorer/context.js +1 -5
- package/dist/types/sdks/DataExplorer/context.js.map +1 -1
- package/dist/types/sdks/DataExplorer/index.d.ts.map +1 -1
- package/dist/types/sdks/DataExplorer/index.js +10 -67
- package/dist/types/sdks/DataExplorer/index.js.map +1 -1
- package/dist/types/sdks/DataExplorer/styles.d.ts +3 -2
- package/dist/types/sdks/DataExplorer/styles.d.ts.map +1 -1
- package/dist/types/sdks/DataExplorer/styles.js +17 -7
- package/dist/types/sdks/DataExplorer/styles.js.map +1 -1
- package/package.json +1 -1
- package/dist/assets/index-legacy.5b5c89be.js +0 -1
- package/dist/assets/index-legacy.6f7be327.js +0 -1
- package/dist/assets/index-legacy.873d2f5f.js +0 -1
- package/dist/assets/index-legacy.8b48df8f.js +0 -1
- package/dist/assets/index-legacy.a2e5122a.js +0 -23
- package/dist/assets/index-legacy.b4a1ea09.js +0 -1
- package/dist/assets/index.1b34a15d.js +0 -35
- package/dist/assets/index.24661964.js +0 -247
- package/dist/assets/index.3039bacf.js +0 -161
- package/dist/assets/index.77b51154.js +0 -1
- package/dist/assets/index.aae000f4.js +0 -1
- package/dist/assets/keyFactory-legacy.782b8549.js +0 -1
- package/dist/assets/keyFactory.e1cd5707.js +0 -1
- package/dist/assets/useQuery-legacy.7e93cb2c.js +0 -1
- package/dist/assets/useQuery.19a6ca1c.js +0 -9
- package/dist/types/sdks/DataExplorer/components/Table/index.d.ts +0 -4
- package/dist/types/sdks/DataExplorer/components/Table/index.d.ts.map +0 -1
- package/dist/types/sdks/DataExplorer/components/Table/index.js.map +0 -1
- package/dist/types/sdks/DataExplorer/components/Table/styles.d.ts.map +0 -1
- package/dist/types/sdks/DataExplorer/components/Table/styles.js.map +0 -1
- /package/dist/types/sdks/DataExplorer/components/{Table → DataTable}/styles.d.ts +0 -0
- /package/dist/types/sdks/DataExplorer/components/{Table → DataTable}/styles.js +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{r as ge,_ as _p,j as Bi,x as bc,y as yp,R as lt,Y as xp,z as Ei,$ as vp,s as es,m as sh,C as vo,A as bp,a as wp,B as Ju,e as Tp,H as Ep,I as Yu}from"./index.3eec99ca.js";import{u as ah}from"./useQuery.19a6ca1c.js";const Sp=ge.exports.createContext(null);function Ip(P){const V=P.clone();return V.pixelsToGLUnits=P.pixelsToGLUnits,V}function Qu(P){return{longitude:P.center.lng,latitude:P.center.lat,zoom:P.zoom,pitch:P.pitch,bearing:P.bearing,padding:P.padding}}function eh(P,V){const q=V.viewState||V;let W=!1;if("longitude"in q&&"latitude"in q){const j=P.center;P.center=new j.constructor(q.longitude,q.latitude),W=W||j!==P.center}if("zoom"in q){const j=P.zoom;P.zoom=q.zoom,W=W||j!==P.zoom}if("bearing"in q){const j=P.bearing;P.bearing=q.bearing,W=W||j!==P.bearing}if("pitch"in q){const j=P.pitch;P.pitch=q.pitch,W=W||j!==P.pitch}return q.padding&&!P.isPaddingEqual(q.padding)&&(W=!0,P.padding=q.padding),W}const Ap=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function th(P){if(!P)return null;if(typeof P=="string"||("toJS"in P&&(P=P.toJS()),!P.layers))return P;const V={};for(const W of P.layers)V[W.id]=W;const q=P.layers.map(W=>{const j=V[W.ref];let Q=null;if("interactive"in W&&(Q={...W},delete Q.interactive),j){Q=Q||{...W},delete Q.ref;for(const xe of Ap)xe in j&&(Q[xe]=j[xe])}return Q||W});return{...P,layers:q}}function Cp(P,V){const q=Array.isArray(P)?P[0]:P?P.x:0,W=Array.isArray(P)?P[1]:P?P.y:0,j=Array.isArray(V)?V[0]:V?V.x:0,Q=Array.isArray(V)?V[1]:V?V.y:0;return q===j&&W===Q}function Un(P,V){if(P===V)return!0;if(!P||!V)return!1;if(Array.isArray(P)){if(!Array.isArray(V)||P.length!==V.length)return!1;for(let q=0;q<P.length;q++)if(!Un(P[q],V[q]))return!1;return!0}else if(Array.isArray(V))return!1;if(typeof P=="object"&&typeof V=="object"){const q=Object.keys(P),W=Object.keys(V);if(q.length!==W.length)return!1;for(const j of q)if(!V.hasOwnProperty(j)||!Un(P[j],V[j]))return!1;return!0}return!1}const ih={mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",click:"onClick",dblclick:"onDblClick",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",mouseout:"onMouseOut",contextmenu:"onContextMenu",touchstart:"onTouchStart",touchend:"onTouchEnd",touchmove:"onTouchMove",touchcancel:"onTouchCancel"},yc={movestart:"onMoveStart",move:"onMove",moveend:"onMoveEnd",dragstart:"onDragStart",drag:"onDrag",dragend:"onDragEnd",zoomstart:"onZoomStart",zoom:"onZoom",zoomend:"onZoomEnd",rotatestart:"onRotateStart",rotate:"onRotate",rotateend:"onRotateEnd",pitchstart:"onPitchStart",pitch:"onPitch",pitchend:"onPitchEnd"},rh={wheel:"onWheel",boxzoomstart:"onBoxZoomStart",boxzoomend:"onBoxZoomEnd",boxzoomcancel:"onBoxZoomCancel",resize:"onResize",load:"onLoad",render:"onRender",idle:"onIdle",remove:"onRemove",data:"onData",styledata:"onStyleData",sourcedata:"onSourceData",error:"onError"},Mp=["minZoom","maxZoom","minPitch","maxPitch","maxBounds","projection","renderWorldCopies"],zp=["scrollZoom","boxZoom","dragRotate","dragPan","keyboard","doubleClickZoom","touchZoomRotate","touchPitch"];class Qo{constructor(V,q,W){this._map=null,this._internalUpdate=!1,this._inRender=!1,this._hoveredFeatures=null,this._deferredEvents={move:!1,zoom:!1,pitch:!1,rotate:!1},this._onEvent=j=>{const Q=this.props[rh[j.type]];Q&&Q(j)},this._onPointerEvent=j=>{(j.type==="mousemove"||j.type==="mouseout")&&this._updateHover(j);const Q=this.props[ih[j.type]];if(Q){if(this.props.interactiveLayerIds&&j.type!=="mouseover"&&j.type!=="mouseout"){const xe=this._hoveredFeatures||this._map.queryRenderedFeatures(j.point,{layers:this.props.interactiveLayerIds});j.features=xe}Q(j),delete j.features}},this._onCameraEvent=j=>{if(!this._internalUpdate){const Q=this.props[yc[j.type]];Q&&Q(j)}j.type in this._deferredEvents&&(this._deferredEvents[j.type]=!1)},this._MapClass=V,this.props=q,this._initialize(W)}get map(){return this._map}get transform(){return this._renderTransform}setProps(V){const q=this.props;this.props=V;const W=this._updateSettings(V,q);W&&this._createShadowTransform(this._map);const j=this._updateSize(V),Q=this._updateViewState(V,!0);this._updateStyle(V,q),this._updateStyleComponents(V,q),this._updateHandlers(V,q),(W||j||Q&&!this._map.isMoving())&&this.redraw()}static reuse(V,q){const W=Qo.savedMaps.pop();if(!W)return null;const j=W.map,Q=j.getContainer();for(q.className=Q.className;Q.childNodes.length>0;)q.appendChild(Q.childNodes[0]);j._container=q,W.setProps({...V,styleDiffing:!1}),j.resize();const{initialViewState:xe}=V;return xe&&(xe.bounds?j.fitBounds(xe.bounds,{...xe.fitBoundsOptions,duration:0}):W._updateViewState(xe,!1)),j.isStyleLoaded()?j.fire("load"):j.once("styledata",()=>j.fire("load")),W}_initialize(V){const{props:q}=this,W={...q,...q.initialViewState,accessToken:q.mapboxAccessToken||Pp()||null,container:V,style:th(q.mapStyle)},j=W.initialViewState||W.viewState||W;if(Object.assign(W,{center:[j.longitude||0,j.latitude||0],zoom:j.zoom||0,pitch:j.pitch||0,bearing:j.bearing||0}),q.gl){const me=HTMLCanvasElement.prototype.getContext;HTMLCanvasElement.prototype.getContext=()=>(HTMLCanvasElement.prototype.getContext=me,q.gl)}const Q=new this._MapClass(W);j.padding&&Q.setPadding(j.padding),q.cursor&&(Q.getCanvas().style.cursor=q.cursor),this._createShadowTransform(Q);const xe=Q._render;Q._render=me=>{this._inRender=!0,xe.call(Q,me),this._inRender=!1};const l=Q._renderTaskQueue.run;Q._renderTaskQueue.run=me=>{l.call(Q._renderTaskQueue,me),this._onBeforeRepaint()},Q.on("render",()=>this._onAfterRepaint());const ve=Q.fire;Q.fire=this._fireEvent.bind(this,ve),Q.on("resize",()=>{this._renderTransform.resize(Q.transform.width,Q.transform.height)}),Q.on("styledata",()=>this._updateStyleComponents(this.props,{})),Q.on("sourcedata",()=>this._updateStyleComponents(this.props,{}));for(const me in ih)Q.on(me,this._onPointerEvent);for(const me in yc)Q.on(me,this._onCameraEvent);for(const me in rh)Q.on(me,this._onEvent);this._map=Q}recycle(){Qo.savedMaps.push(this)}destroy(){this._map.remove()}redraw(){const V=this._map;!this._inRender&&V.style&&(V._frame&&(V._frame.cancel(),V._frame=null),V._render())}_createShadowTransform(V){const q=Ip(V.transform);V.painter.transform=q,this._renderTransform=q}_updateSize(V){const{viewState:q}=V;if(q){const W=this._map;if(q.width!==W.transform.width||q.height!==W.transform.height)return W.resize(),!0}return!1}_updateViewState(V,q){if(this._internalUpdate)return!1;const W=this._map,j=this._renderTransform,{zoom:Q,pitch:xe,bearing:l}=j,ve=W.isMoving();ve&&(j.cameraElevationReference="sea");const me=eh(j,{...Qu(W.transform),...V});if(ve&&(j.cameraElevationReference="ground"),me&&q){const Ee=this._deferredEvents;Ee.move=!0,Ee.zoom||(Ee.zoom=Q!==j.zoom),Ee.rotate||(Ee.rotate=l!==j.bearing),Ee.pitch||(Ee.pitch=xe!==j.pitch)}return ve||eh(W.transform,V),me}_updateSettings(V,q){const W=this._map;let j=!1;for(const Q of Mp)Q in V&&!Un(V[Q],q[Q])&&(j=!0,W[`set${Q[0].toUpperCase()}${Q.slice(1)}`](V[Q]));return j}_updateStyle(V,q){if(V.cursor!==q.cursor&&(this._map.getCanvas().style.cursor=V.cursor),V.mapStyle!==q.mapStyle){const W={diff:V.styleDiffing};return"localIdeographFontFamily"in V&&(W.localIdeographFontFamily=V.localIdeographFontFamily),this._map.setStyle(th(V.mapStyle),W),!0}return!1}_updateStyleComponents(V,q){const W=this._map;let j=!1;return W.style.loaded()&&("light"in V&&!Un(V.light,q.light)&&(j=!0,W.setLight(V.light)),"fog"in V&&!Un(V.fog,q.fog)&&(j=!0,W.setFog(V.fog)),"terrain"in V&&!Un(V.terrain,q.terrain)&&(!V.terrain||W.getSource(V.terrain.source))&&(j=!0,W.setTerrain(V.terrain))),j}_updateHandlers(V,q){const W=this._map;let j=!1;for(const Q of zp){const xe=V[Q];Un(xe,q[Q])||(j=!0,xe?W[Q].enable(xe):W[Q].disable())}return j}_updateHover(V){var q;const{props:W}=this;if(W.interactiveLayerIds&&(W.onMouseMove||W.onMouseEnter||W.onMouseLeave)){const Q=V.type,xe=((q=this._hoveredFeatures)===null||q===void 0?void 0:q.length)>0;let l;if(Q==="mousemove")try{l=this._map.queryRenderedFeatures(V.point,{layers:W.interactiveLayerIds})}catch(me){l=[]}else l=[];const ve=l.length>0;!ve&&xe&&(V.type="mouseleave",this._onPointerEvent(V)),this._hoveredFeatures=l,ve&&!xe&&(V.type="mouseenter",this._onPointerEvent(V)),V.type=Q}else this._hoveredFeatures=null}_fireEvent(V,q,W){const j=this._map,Q=j.transform,xe=typeof q=="string"?q:q.type;return xe==="move"&&this._updateViewState(this.props,!1),xe in yc&&(typeof q=="object"&&(q.viewState=Qu(Q)),this._map.isMoving())?(j.transform=this._renderTransform,V.call(j,q,W),j.transform=Q,j):(V.call(j,q,W),j)}_onBeforeRepaint(){const V=this._map;this._internalUpdate=!0;for(const W in this._deferredEvents)this._deferredEvents[W]&&V.fire(W);this._internalUpdate=!1;const q=this._map.transform;this._map.transform=this._renderTransform,this._onAfterRepaint=()=>{this._map.transform=q}}}Qo.savedMaps=[];function Pp(){let P=null;if(typeof location<"u"){const V=/access_token=([^&\/]*)/.exec(location.search);P=V&&V[1]}try{P=P||process.env.MapboxAccessToken}catch(V){}try{P=P||process.env.REACT_APP_MAPBOX_ACCESS_TOKEN}catch(V){}return P}const kp=["setMaxBounds","setMinZoom","setMaxZoom","setMinPitch","setMaxPitch","setRenderWorldCopies","setProjection","setStyle","addSource","removeSource","addLayer","removeLayer","setLayerZoomRange","setFilter","setPaintProperty","setLayoutProperty","setLight","setTerrain","setFog","remove"];function Dp(P,V){if(!P)return null;const q=P.map,W={getMap:()=>q,getCenter:()=>P.transform.center,getZoom:()=>P.transform.zoom,getBearing:()=>P.transform.bearing,getPitch:()=>P.transform.pitch,getPadding:()=>P.transform.padding,getBounds:()=>P.transform.getBounds(),project:j=>P.transform.locationPoint(V.LngLat.convert(j)),unproject:j=>P.transform.pointLocation(V.Point.convert(j)),queryTerrainElevation:(j,Q)=>{const xe=q.transform;q.transform=P.transform;const l=q.queryTerrainElevation(j,Q);return q.transform=xe,l}};for(const j of Lp(q))!(j in W)&&!kp.includes(j)&&(W[j]=q[j].bind(q));return W}function Lp(P){const V=new Set;let q=P;for(;q;){for(const W of Object.getOwnPropertyNames(q))W[0]!=="_"&&typeof P[W]=="function"&&W!=="fire"&&W!=="setEventedParent"&&V.add(W);q=Object.getPrototypeOf(q)}return Array.from(V)}const Rp=typeof document<"u"?ge.exports.useLayoutEffect:ge.exports.useEffect,Bp=["baseApiUrl","maxParallelImageRequests","workerClass","workerCount","workerUrl"];function Fp(P,V){for(const q of Bp)q in V&&(P[q]=V[q]);V.RTLTextPlugin&&P.getRTLTextPluginStatus&&P.getRTLTextPluginStatus()==="unavailable"&&P.setRTLTextPlugin(V.RTLTextPlugin,q=>{q&&console.error(q)},!1)}const dl=ge.exports.createContext(null),Op={minZoom:0,maxZoom:22,minPitch:0,maxPitch:60,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,mapStyle:{version:8,sources:{},layers:[]},styleDiffing:!0,projection:"mercator",renderWorldCopies:!0,onError:P=>console.error(P.error),RTLTextPlugin:"https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.2.3/mapbox-gl-rtl-text.js"},lh=ge.exports.forwardRef((P,V)=>{const q=ge.exports.useContext(Sp),[W,j]=ge.exports.useState(null),Q=ge.exports.useRef(),{current:xe}=ge.exports.useRef({mapLib:null,map:null});ge.exports.useEffect(()=>{const ve=P.mapLib;let me=!0,Ee;return Promise.resolve(ve||_p(()=>import("./index.b70ba4b0.js").then(Te=>Te.i),[])).then(Te=>{if(!!me){if(Te.Map||(Te=Te.default),!Te||!Te.Map)throw new Error("Invalid mapLib");if(Te.supported(P))Fp(Te,P),P.reuseMaps&&(Ee=Qo.reuse(P,Q.current)),Ee||(Ee=new Qo(Te.Map,P,Q.current)),xe.map=Dp(Ee,Te),xe.mapLib=Te,j(Ee),q==null||q.onMapMount(xe.map,P.id);else throw new Error("Map is not supported by this browser")}}).catch(Te=>{P.onError({type:"error",target:null,originalEvent:null,error:Te})}),()=>{me=!1,Ee&&(q==null||q.onMapUnmount(P.id),P.reuseMaps?Ee.recycle():Ee.destroy())}},[]),Rp(()=>{W&&W.setProps(P)}),ge.exports.useImperativeHandle(V,()=>xe.map,[W]);const l=ge.exports.useMemo(()=>({position:"relative",width:"100%",height:"100%",...P.style}),[P.style]);return Bi("div",{id:P.id,ref:Q,style:l,children:W&&Bi(dl.Provider,{value:xe,children:P.children})})});lh.displayName="Map";lh.defaultProps=Op;const Up=/box|flex|grid|column|lineHeight|fontWeight|opacity|order|tabSize|zIndex/;function bo(P,V){if(!P||!V)return;const q=P.style;for(const W in V){const j=V[W];Number.isFinite(j)&&!Up.test(W)?q[W]=`${j}px`:q[W]=j}}const $p={draggable:!1,popup:null,rotation:0,rotationAlignment:"auto",pitchAlignment:"auto"};function ch(P){const{map:V,mapLib:q}=ge.exports.useContext(dl),W=ge.exports.useRef({props:P});W.current.props=P;const j=ge.exports.useMemo(()=>{let Q=!1;ge.exports.Children.forEach(P.children,ve=>{ve&&(Q=!0)});const xe={...P,element:Q?document.createElement("div"):null},l=new q.Marker(xe).setLngLat([P.longitude,P.latitude]);return l.getElement().addEventListener("click",ve=>{var me,Ee;(Ee=(me=W.current.props).onClick)===null||Ee===void 0||Ee.call(me,{type:"click",target:l,originalEvent:ve})}),l.on("dragstart",ve=>{var me,Ee;const Te=ve;Te.lngLat=j.getLngLat(),(Ee=(me=W.current.props).onDragStart)===null||Ee===void 0||Ee.call(me,Te)}),l.on("drag",ve=>{var me,Ee;const Te=ve;Te.lngLat=j.getLngLat(),(Ee=(me=W.current.props).onDrag)===null||Ee===void 0||Ee.call(me,Te)}),l.on("dragend",ve=>{var me,Ee;const Te=ve;Te.lngLat=j.getLngLat(),(Ee=(me=W.current.props).onDragEnd)===null||Ee===void 0||Ee.call(me,Te)}),l},[]);return ge.exports.useEffect(()=>(j.addTo(V.getMap()),()=>{j.remove()}),[]),ge.exports.useEffect(()=>{bo(j.getElement(),P.style)},[P.style]),(j.getLngLat().lng!==P.longitude||j.getLngLat().lat!==P.latitude)&&j.setLngLat([P.longitude,P.latitude]),P.offset&&!Cp(j.getOffset(),P.offset)&&j.setOffset(P.offset),j.isDraggable()!==P.draggable&&j.setDraggable(P.draggable),j.getRotation()!==P.rotation&&j.setRotation(P.rotation),j.getRotationAlignment()!==P.rotationAlignment&&j.setRotationAlignment(P.rotationAlignment),j.getPitchAlignment()!==P.pitchAlignment&&j.setPitchAlignment(P.pitchAlignment),j.getPopup()!==P.popup&&j.setPopup(P.popup),bc.exports.createPortal(P.children,j.getElement())}ch.defaultProps=$p;const Vp=ge.exports.memo(ch);function nh(P){return new Set(P?P.trim().split(/\s+/):[])}function Np(P){const{map:V,mapLib:q}=ge.exports.useContext(dl),W=ge.exports.useMemo(()=>document.createElement("div"),[]),j=ge.exports.useRef({props:P});j.current.props=P;const Q=ge.exports.useMemo(()=>{const xe={...P},l=new q.Popup(xe).setLngLat([P.longitude,P.latitude]);return l.once("open",ve=>{var me,Ee;(Ee=(me=j.current.props).onOpen)===null||Ee===void 0||Ee.call(me,ve)}),l},[]);if(ge.exports.useEffect(()=>{const xe=l=>{var ve,me;(me=(ve=j.current.props).onClose)===null||me===void 0||me.call(ve,l)};return Q.on("close",xe),Q.setDOMContent(W).addTo(V.getMap()),()=>{Q.off("close",xe),Q.isOpen()&&Q.remove()}},[]),ge.exports.useEffect(()=>{bo(Q.getElement(),P.style)},[P.style]),Q.isOpen()&&((Q.getLngLat().lng!==P.longitude||Q.getLngLat().lat!==P.latitude)&&Q.setLngLat([P.longitude,P.latitude]),P.offset&&!Un(Q.options.offset,P.offset)&&Q.setOffset(P.offset),(Q.options.anchor!==P.anchor||Q.options.maxWidth!==P.maxWidth)&&(Q.options.anchor=P.anchor,Q.setMaxWidth(P.maxWidth)),Q.options.className!==P.className)){const xe=nh(Q.options.className),l=nh(P.className);for(const ve of xe)l.has(ve)||Q.removeClassName(ve);for(const ve of l)xe.has(ve)||Q.addClassName(ve);Q.options.className=P.className}return bc.exports.createPortal(P.children,W)}ge.exports.memo(Np);function Qs(P,V,q,W){const j=ge.exports.useContext(dl),Q=ge.exports.useMemo(()=>P(j),[]);return ge.exports.useEffect(()=>{const xe=W||q||V,l=typeof V=="function"&&typeof q=="function"?V:null,ve=typeof q=="function"?q:typeof V=="function"?V:null,{map:me}=j;return me.hasControl(Q)||(me.addControl(Q,xe==null?void 0:xe.position),l&&l(j)),()=>{ve&&ve(j),me.hasControl(Q)&&me.removeControl(Q)}},[]),Q}function Gp(P){const V=Qs(({mapLib:q})=>new q.AttributionControl(P),{position:P.position});return ge.exports.useEffect(()=>{bo(V._container,P.style)},[P.style]),null}const Jf=ge.exports.memo(Gp);function qp(P){const V=Qs(({mapLib:q})=>new q.FullscreenControl({container:P.containerId&&document.getElementById(P.containerId)}),{position:P.position});return ge.exports.useEffect(()=>{bo(V._controlContainer,P.style)},[P.style]),null}ge.exports.memo(qp);const uh=ge.exports.forwardRef((P,V)=>{const q=ge.exports.useRef({props:P}),W=Qs(({mapLib:j})=>{const Q=new j.GeolocateControl(P),xe=Q._setupUI;return Q._setupUI=l=>{Q._container.hasChildNodes()||xe(l)},Q.on("geolocate",l=>{var ve,me;(me=(ve=q.current.props).onGeolocate)===null||me===void 0||me.call(ve,l)}),Q.on("error",l=>{var ve,me;(me=(ve=q.current.props).onError)===null||me===void 0||me.call(ve,l)}),Q.on("outofmaxbounds",l=>{var ve,me;(me=(ve=q.current.props).onOutOfMaxBounds)===null||me===void 0||me.call(ve,l)}),Q.on("trackuserlocationstart",l=>{var ve,me;(me=(ve=q.current.props).onTrackUserLocationStart)===null||me===void 0||me.call(ve,l)}),Q.on("trackuserlocationend",l=>{var ve,me;(me=(ve=q.current.props).onTrackUserLocationEnd)===null||me===void 0||me.call(ve,l)}),Q},{position:P.position});return q.current.props=P,ge.exports.useImperativeHandle(V,()=>({trigger:()=>W.trigger()}),[]),ge.exports.useEffect(()=>{bo(W._container,P.style)},[P.style]),null});uh.displayName="GeolocateControl";ge.exports.memo(uh);function Zp(P){const V=Qs(({mapLib:q})=>new q.NavigationControl(P),{position:P.position});return ge.exports.useEffect(()=>{bo(V._container,P.style)},[P.style]),null}const Yf=ge.exports.memo(Zp),jp={unit:"metric",maxWidth:100};function hh(P){const V=Qs(({mapLib:q})=>new q.ScaleControl(P),{position:P.position});return(V.options.unit!==P.unit||V.options.maxWidth!==P.maxWidth)&&(V.options.maxWidth=P.maxWidth,V.setUnit(P.unit)),ge.exports.useEffect(()=>{bo(V._container,P.style)},[P.style]),null}hh.defaultProps=jp;ge.exports.memo(hh);var dh={exports:{}};(function(P,V){(function(q,W){P.exports=W()})(yp,function(){var q,W,j;function Q(l,ve){if(!q)q=ve;else if(!W)W=ve;else{var me="var sharedChunk = {}; ("+q+")(sharedChunk); ("+W+")(sharedChunk);",Ee={};q(Ee),j=ve(Ee),typeof window<"u"&&(j.workerUrl=window.URL.createObjectURL(new Blob([me],{type:"text/javascript"})))}}Q(["exports"],function(l){var ve=me;function me(i,e,r,o){this.cx=3*i,this.bx=3*(r-i)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(o-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=i,this.p1y=e,this.p2x=r,this.p2y=o}function Ee(i,e,r,o){const c=new ve(i,e,r,o);return function(h){return c.solve(h)}}me.prototype={sampleCurveX:function(i){return((this.ax*i+this.bx)*i+this.cx)*i},sampleCurveY:function(i){return((this.ay*i+this.by)*i+this.cy)*i},sampleCurveDerivativeX:function(i){return(3*this.ax*i+2*this.bx)*i+this.cx},solveCurveX:function(i,e){if(e===void 0&&(e=1e-6),i<0)return 0;if(i>1)return 1;for(var r=i,o=0;o<8;o++){var c=this.sampleCurveX(r)-i;if(Math.abs(c)<e)return r;var h=this.sampleCurveDerivativeX(r);if(Math.abs(h)<1e-6)break;r-=c/h}var p=0,m=1;for(r=i,o=0;o<20&&(c=this.sampleCurveX(r),!(Math.abs(c-i)<e));o++)i>c?p=r:m=r,r=.5*(m-p)+p;return r},solve:function(i,e){return this.sampleCurveY(this.solveCurveX(i,e))}};const Te=Ee(.25,.1,.25,1);function se(i,e,r){return Math.min(r,Math.max(e,i))}function gt(i,e,r){const o=r-e,c=((i-e)%o+o)%o+e;return c===e?r:c}function nt(i,...e){for(const r of e)for(const o in r)i[o]=r[o];return i}let He=1;function Ut(i,e){i.forEach(r=>{e[r]&&(e[r]=e[r].bind(e))})}function Mt(i,e,r){const o={};for(const c in i)o[c]=e.call(r||this,i[c],c,i);return o}function ct(i,e,r){const o={};for(const c in i)e.call(r||this,i[c],c,i)&&(o[c]=i[c]);return o}function vt(i){return Array.isArray(i)?i.map(vt):typeof i=="object"&&i?Mt(i,vt):i}const Wt={};function $t(i){Wt[i]||(typeof console<"u"&&console.warn(i),Wt[i]=!0)}function Gi(i,e,r){return(r.y-i.y)*(e.x-i.x)>(e.y-i.y)*(r.x-i.x)}function Fi(i){let e=0;for(let r,o,c=0,h=i.length,p=h-1;c<h;p=c++)r=i[c],o=i[p],e+=(o.x-r.x)*(r.y+o.y);return e}function pi(){return typeof WorkerGlobalScope<"u"&&typeof self<"u"&&self instanceof WorkerGlobalScope}function wo(i){const e={};if(i.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(r,o,c,h)=>{const p=c||h;return e[o]=!p||p.toLowerCase(),""}),e["max-age"]){const r=parseInt(e["max-age"],10);isNaN(r)?delete e["max-age"]:e["max-age"]=r}return e}let lr,Gr,cr=null;function un(i){if(cr==null){const e=i.navigator?i.navigator.userAgent:null;cr=!!i.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return cr}function Er(i){return typeof ImageBitmap<"u"&&i instanceof ImageBitmap}const Sr={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frame(i){const e=requestAnimationFrame(i);return{cancel:()=>cancelAnimationFrame(e)}},getImageData(i,e=0){const r=window.document.createElement("canvas"),o=r.getContext("2d");if(!o)throw new Error("failed to create canvas 2d context");return r.width=i.width,r.height=i.height,o.drawImage(i,0,0,i.width,i.height),o.getImageData(-e,-e,i.width+2*e,i.height+2*e)},resolveURL:i=>(lr||(lr=document.createElement("a")),lr.href=i,lr.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(Gr==null&&(Gr=matchMedia("(prefers-reduced-motion: reduce)")),Gr.matches)}};var We=ur;function ur(i,e){this.x=i,this.y=e}ur.prototype={clone:function(){return new ur(this.x,this.y)},add:function(i){return this.clone()._add(i)},sub:function(i){return this.clone()._sub(i)},multByPoint:function(i){return this.clone()._multByPoint(i)},divByPoint:function(i){return this.clone()._divByPoint(i)},mult:function(i){return this.clone()._mult(i)},div:function(i){return this.clone()._div(i)},rotate:function(i){return this.clone()._rotate(i)},rotateAround:function(i,e){return this.clone()._rotateAround(i,e)},matMult:function(i){return this.clone()._matMult(i)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(i){return this.x===i.x&&this.y===i.y},dist:function(i){return Math.sqrt(this.distSqr(i))},distSqr:function(i){var e=i.x-this.x,r=i.y-this.y;return e*e+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(i){return Math.atan2(this.y-i.y,this.x-i.x)},angleWith:function(i){return this.angleWithSep(i.x,i.y)},angleWithSep:function(i,e){return Math.atan2(this.x*e-this.y*i,this.x*i+this.y*e)},_matMult:function(i){var e=i[2]*this.x+i[3]*this.y;return this.x=i[0]*this.x+i[1]*this.y,this.y=e,this},_add:function(i){return this.x+=i.x,this.y+=i.y,this},_sub:function(i){return this.x-=i.x,this.y-=i.y,this},_mult:function(i){return this.x*=i,this.y*=i,this},_div:function(i){return this.x/=i,this.y/=i,this},_multByPoint:function(i){return this.x*=i.x,this.y*=i.y,this},_divByPoint:function(i){return this.x/=i.x,this.y/=i.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var i=this.y;return this.y=this.x,this.x=-i,this},_rotate:function(i){var e=Math.cos(i),r=Math.sin(i),o=r*this.x+e*this.y;return this.x=e*this.x-r*this.y,this.y=o,this},_rotateAround:function(i,e){var r=Math.cos(i),o=Math.sin(i),c=e.y+o*(this.x-e.x)+r*(this.y-e.y);return this.x=e.x+r*(this.x-e.x)-o*(this.y-e.y),this.y=c,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},ur.convert=function(i){return i instanceof ur?i:Array.isArray(i)?new ur(i[0],i[1]):i};const hr={MAX_PARALLEL_IMAGE_REQUESTS:16,REGISTERED_PROTOCOLS:{}},qi="mapbox-tiles";let Zi,qr,hn=500,dn=50;function pn(){typeof caches>"u"||Zi||(Zi=caches.open(qi))}let Qi=1/0;const Ir={supported:!1,testSupport:function(i){!yi&&Cr&&(fn?$n(i):Ar=i)}};let Ar,Cr,yi=!1,fn=!1;function $n(i){const e=i.createTexture();i.bindTexture(i.TEXTURE_2D,e);try{if(i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,Cr),i.isContextLost())return;Ir.supported=!0}catch(r){}i.deleteTexture(e),yi=!0}typeof document<"u"&&(Cr=document.createElement("img"),Cr.onload=function(){Ar&&$n(Ar),Ar=null,fn=!0},Cr.onerror=function(){yi=!0,Ar=null},Cr.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const dr={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image"};typeof Object.freeze=="function"&&Object.freeze(dr);class Si extends Error{constructor(e,r,o,c){super(`AJAXError: ${r} (${e}): ${o}`),this.status=e,this.statusText=r,this.url=o,this.body=c}}const Vn=pi()?()=>self.worker&&self.worker.referrer:()=>(window.location.protocol==="blob:"?window.parent:window).location.href;function Mr(i,e){const r=new AbortController,o=new Request(i.url,{method:i.method||"GET",body:i.body,credentials:i.credentials,headers:i.headers,referrer:Vn(),signal:r.signal});let c=!1,h=!1;return i.type==="json"&&o.headers.set("Accept","application/json"),((p,m,g)=>{if(h)return;const x=Date.now();fetch(o).then(w=>w.ok?((E,A,M)=>{(i.type==="arrayBuffer"?E.arrayBuffer():i.type==="json"?E.json():E.text()).then(z=>{h||(A&&M&&function($,U,ee){if(pn(),!Zi)return;const oe={status:U.status,statusText:U.statusText,headers:new Headers};U.headers.forEach((re,fe)=>oe.headers.set(fe,re));const Y=wo(U.headers.get("Cache-Control")||"");Y["no-store"]||(Y["max-age"]&&oe.headers.set("Expires",new Date(ee+1e3*Y["max-age"]).toUTCString()),new Date(oe.headers.get("Expires")).getTime()-ee<42e4||function(re,fe){if(qr===void 0)try{new Response(new ReadableStream),qr=!0}catch(pe){qr=!1}qr?fe(re.body):re.blob().then(fe)}(U,re=>{const fe=new Response(re,oe);pn(),Zi&&Zi.then(pe=>pe.put(function(Be){const Ue=Be.indexOf("?");return Ue<0?Be:Be.slice(0,Ue)}($.url),fe)).catch(pe=>$t(pe.message))}))}(o,A,M),c=!0,e(null,z,E.headers.get("Cache-Control"),E.headers.get("Expires")))}).catch(z=>{h||e(new Error(z.message))})})(w,null,x):w.blob().then(E=>e(new Si(w.status,w.statusText,i.url,E)))).catch(w=>{w.code!==20&&e(new Error(w.message))})})(),{cancel:()=>{h=!0,c||r.abort()}}}const mn=function(i,e){if(/:\/\//.test(i.url)&&!/^https?:|^file:/.test(i.url)){if(pi()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",i,e);if(!pi()){const o=i.url.substring(0,i.url.indexOf("://"));return(hr.REGISTERED_PROTOCOLS[o]||Mr)(i,e)}}if(!(/^file:/.test(r=i.url)||/^file:/.test(Vn())&&!/^\w+:/.test(r))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return Mr(i,e);if(pi()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",i,e,void 0,!0)}var r;return function(o,c){const h=new XMLHttpRequest;h.open(o.method||"GET",o.url,!0),o.type==="arrayBuffer"&&(h.responseType="arraybuffer");for(const p in o.headers)h.setRequestHeader(p,o.headers[p]);return o.type==="json"&&(h.responseType="text",h.setRequestHeader("Accept","application/json")),h.withCredentials=o.credentials==="include",h.onerror=()=>{c(new Error(h.statusText))},h.onload=()=>{if((h.status>=200&&h.status<300||h.status===0)&&h.response!==null){let p=h.response;if(o.type==="json")try{p=JSON.parse(h.response)}catch(m){return c(m)}c(null,p,h.getResponseHeader("Cache-Control"),h.getResponseHeader("Expires"))}else{const p=new Blob([h.response],{type:h.getResponseHeader("Content-Type")});c(new Si(h.status,h.statusText,o.url,p))}},h.send(o.body),{cancel:()=>h.abort()}}(i,e)},gn=function(i,e){return mn(nt(i,{type:"arrayBuffer"}),e)};function Nn(i){const e=window.document.createElement("a");return e.href=i,e.protocol===window.document.location.protocol&&e.host===window.document.location.host}const ht="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let er,zr;er=[],zr=0;const Pr=function(i,e){if(Ir.supported&&(i.headers||(i.headers={}),i.headers.accept="image/webp,*/*"),zr>=hr.MAX_PARALLEL_IMAGE_REQUESTS){const h={requestParameters:i,callback:e,cancelled:!1,cancel(){this.cancelled=!0}};return er.push(h),h}zr++;let r=!1;const o=()=>{if(!r)for(r=!0,zr--;er.length&&zr<hr.MAX_PARALLEL_IMAGE_REQUESTS;){const h=er.shift(),{requestParameters:p,callback:m,cancelled:g}=h;g||(h.cancel=Pr(p,m).cancel)}},c=gn(i,(h,p,m,g)=>{o(),h?e(h):p&&function(x,w){typeof createImageBitmap=="function"?function(E,A){const M=new Blob([new Uint8Array(E)],{type:"image/png"});createImageBitmap(M).then(z=>{A(null,z)}).catch(z=>{A(new Error(`Could not load image because of ${z.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})}(x,w):function(E,A){const M=new Image;M.onload=()=>{A(null,M),URL.revokeObjectURL(M.src),M.onload=null,window.requestAnimationFrame(()=>{M.src=ht})},M.onerror=()=>A(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const z=new Blob([new Uint8Array(E)],{type:"image/png"});M.src=E.byteLength?URL.createObjectURL(z):ht}(x,w)}(p,(x,w)=>{x!=null?e(x):w!=null&&e(null,w,{cacheControl:m,expires:g})})});return{cancel:()=>{c.cancel(),o()}}};function Gn(i,e,r){r[i]&&r[i].indexOf(e)!==-1||(r[i]=r[i]||[],r[i].push(e))}function pr(i,e,r){if(r&&r[i]){const o=r[i].indexOf(e);o!==-1&&r[i].splice(o,1)}}class fr{constructor(e,r={}){nt(this,r),this.type=e}}class _n extends fr{constructor(e,r={}){super("error",nt({error:e},r))}}class mr{on(e,r){return this._listeners=this._listeners||{},Gn(e,r,this._listeners),this}off(e,r){return pr(e,r,this._listeners),pr(e,r,this._oneTimeListeners),this}once(e,r){return this._oneTimeListeners=this._oneTimeListeners||{},Gn(e,r,this._oneTimeListeners),this}fire(e,r){typeof e=="string"&&(e=new fr(e,r||{}));const o=e.type;if(this.listens(o)){e.target=this;const c=this._listeners&&this._listeners[o]?this._listeners[o].slice():[];for(const m of c)m.call(this,e);const h=this._oneTimeListeners&&this._oneTimeListeners[o]?this._oneTimeListeners[o].slice():[];for(const m of h)pr(o,m,this._oneTimeListeners),m.call(this,e);const p=this._eventedParent;p&&(nt(e,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),p.fire(e))}else e instanceof _n&&console.error(e.error);return this}listens(e){return this._listeners&&this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e)}setEventedParent(e,r){return this._eventedParent=e,this._eventedParentData=r,this}}var de={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"string"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{}},default:"mapbox"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{},within:{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1},elevationOffset:{type:"number",default:450}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}}};class Ce{constructor(e,r,o,c){this.message=(e?`${e}: `:"")+o,c&&(this.identifier=c),r!=null&&r.__line__&&(this.line=r.__line__)}}function Zr(i){const e=i.value;return e?[new Ce(i.key,e,"constants have been deprecated as of v8")]:[]}function ji(i,...e){for(const r of e)for(const o in r)i[o]=r[o];return i}function dt(i){return i instanceof Number||i instanceof String||i instanceof Boolean?i.valueOf():i}function Oi(i){if(Array.isArray(i))return i.map(Oi);if(i instanceof Object&&!(i instanceof Number||i instanceof String||i instanceof Boolean)){const e={};for(const r in i)e[r]=Oi(i[r]);return e}return dt(i)}class Ii extends Error{constructor(e,r){super(r),this.message=r,this.key=e}}class Ai{constructor(e,r=[]){this.parent=e,this.bindings={};for(const[o,c]of r)this.bindings[o]=c}concat(e){return new Ai(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw new Error(`${e} not found in scope.`)}has(e){return!!this.bindings[e]||!!this.parent&&this.parent.has(e)}}const kr={kind:"null"},Se={kind:"number"},et={kind:"string"},Ye={kind:"boolean"},oi={kind:"color"},Dr={kind:"object"},Je={kind:"value"},gr={kind:"collator"},Yt={kind:"formatted"},yn={kind:"padding"},qt={kind:"resolvedImage"};function fi(i,e){return{kind:"array",itemType:i,N:e}}function Tt(i){if(i.kind==="array"){const e=Tt(i.itemType);return typeof i.N=="number"?`array<${e}, ${i.N}>`:i.itemType.kind==="value"?"array":`array<${e}>`}return i.kind}const xn=[kr,Se,et,Ye,oi,Yt,Dr,fi(Je),yn,qt];function tr(i,e){if(e.kind==="error")return null;if(i.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!tr(i.itemType,e.itemType))&&(typeof i.N!="number"||i.N===e.N))return null}else{if(i.kind===e.kind)return null;if(i.kind==="value"){for(const r of xn)if(!tr(r,e))return null}}return`Expected ${Tt(i)} but found ${Tt(e)} instead.`}function jr(i,e){return e.some(r=>r.kind===i.kind)}function Xr(i,e){return e.some(r=>r==="null"?i===null:r==="array"?Array.isArray(i):r==="object"?i&&!Array.isArray(i)&&typeof i=="object":r===typeof i)}var vn,Wr={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function L(i){return(i=Math.round(i))<0?0:i>255?255:i}function b(i){return L(i[i.length-1]==="%"?parseFloat(i)/100*255:parseInt(i))}function S(i){return(e=i[i.length-1]==="%"?parseFloat(i)/100:parseFloat(i))<0?0:e>1?1:e;var e}function k(i,e,r){return r<0?r+=1:r>1&&(r-=1),6*r<1?i+(e-i)*r*6:2*r<1?e:3*r<2?i+(e-i)*(2/3-r)*6:i}try{vn={}.parseCSSColor=function(i){var e,r=i.replace(/ /g,"").toLowerCase();if(r in Wr)return Wr[r].slice();if(r[0]==="#")return r.length===4?(e=parseInt(r.substr(1),16))>=0&&e<=4095?[(3840&e)>>4|(3840&e)>>8,240&e|(240&e)>>4,15&e|(15&e)<<4,1]:null:r.length===7&&(e=parseInt(r.substr(1),16))>=0&&e<=16777215?[(16711680&e)>>16,(65280&e)>>8,255&e,1]:null;var o=r.indexOf("("),c=r.indexOf(")");if(o!==-1&&c+1===r.length){var h=r.substr(0,o),p=r.substr(o+1,c-(o+1)).split(","),m=1;switch(h){case"rgba":if(p.length!==4)return null;m=S(p.pop());case"rgb":return p.length!==3?null:[b(p[0]),b(p[1]),b(p[2]),m];case"hsla":if(p.length!==4)return null;m=S(p.pop());case"hsl":if(p.length!==3)return null;var g=(parseFloat(p[0])%360+360)%360/360,x=S(p[1]),w=S(p[2]),E=w<=.5?w*(x+1):w+x-w*x,A=2*w-E;return[L(255*k(A,E,g+1/3)),L(255*k(A,E,g)),L(255*k(A,E,g-1/3)),m];default:return null}}return null}}catch(i){}class D{constructor(e,r,o,c=1){this.r=e,this.g=r,this.b=o,this.a=c}static parse(e){if(!e)return;if(e instanceof D)return e;if(typeof e!="string")return;const r=vn(e);return r?new D(r[0]/255*r[3],r[1]/255*r[3],r[2]/255*r[3],r[3]):void 0}toString(){const[e,r,o,c]=this.toArray();return`rgba(${Math.round(e)},${Math.round(r)},${Math.round(o)},${c})`}toArray(){const{r:e,g:r,b:o,a:c}=this;return c===0?[0,0,0,0]:[255*e/c,255*r/c,255*o/c,c]}}D.black=new D(0,0,0,1),D.white=new D(1,1,1,1),D.transparent=new D(0,0,0,0),D.red=new D(1,0,0,1);class N{constructor(e,r,o){this.sensitivity=e?r?"variant":"case":r?"accent":"base",this.locale=o,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,r){return this.collator.compare(e,r)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class H{constructor(e,r,o,c,h){this.text=e,this.image=r,this.scale=o,this.fontStack=c,this.textColor=h}}class Z{constructor(e){this.sections=e}static fromString(e){return new Z([new H(e,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(e=>e.text.length!==0||e.image&&e.image.name.length!==0)}static factory(e){return e instanceof Z?e:Z.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map(e=>e.text).join("")}}class G{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof G)return e;if(typeof e=="number")return new G([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(const r of e)if(typeof r!="number")return;switch(e.length){case 1:e=[e[0],e[0],e[0],e[0]];break;case 2:e=[e[0],e[1],e[0],e[1]];break;case 3:e=[e[0],e[1],e[2],e[1]]}return new G(e)}}toString(){return JSON.stringify(this.values)}}class K{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new K({name:e,available:!1}):null}}function le(i,e,r,o){return typeof i=="number"&&i>=0&&i<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof r=="number"&&r>=0&&r<=255?o===void 0||typeof o=="number"&&o>=0&&o<=1?null:`Invalid rgba value [${[i,e,r,o].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof o=="number"?[i,e,r,o]:[i,e,r]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function _e(i){if(i===null||typeof i=="string"||typeof i=="boolean"||typeof i=="number"||i instanceof D||i instanceof N||i instanceof Z||i instanceof G||i instanceof K)return!0;if(Array.isArray(i)){for(const e of i)if(!_e(e))return!1;return!0}if(typeof i=="object"){for(const e in i)if(!_e(i[e]))return!1;return!0}return!1}function ae(i){if(i===null)return kr;if(typeof i=="string")return et;if(typeof i=="boolean")return Ye;if(typeof i=="number")return Se;if(i instanceof D)return oi;if(i instanceof N)return gr;if(i instanceof Z)return Yt;if(i instanceof G)return yn;if(i instanceof K)return qt;if(Array.isArray(i)){const e=i.length;let r;for(const o of i){const c=ae(o);if(r){if(r===c)continue;r=Je;break}r=c}return fi(r||Je,e)}return Dr}function Oe(i){const e=typeof i;return i===null?"":e==="string"||e==="number"||e==="boolean"?String(i):i instanceof D||i instanceof Z||i instanceof G||i instanceof K?i.toString():JSON.stringify(i)}class $e{constructor(e,r){this.type=e,this.value=r}static parse(e,r){if(e.length!==2)return r.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!_e(e[1]))return r.error("invalid value");const o=e[1];let c=ae(o);const h=r.expectedType;return c.kind!=="array"||c.N!==0||!h||h.kind!=="array"||typeof h.N=="number"&&h.N!==0||(c=h),new $e(c,o)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class De{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}}const Ze={string:et,number:Se,boolean:Ye,object:Dr};class Xe{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");let o,c=1;const h=e[0];if(h==="array"){let m,g;if(e.length>2){const x=e[1];if(typeof x!="string"||!(x in Ze)||x==="object")return r.error('The item type argument of "array" must be one of string, number, boolean',1);m=Ze[x],c++}else m=Je;if(e.length>3){if(e[2]!==null&&(typeof e[2]!="number"||e[2]<0||e[2]!==Math.floor(e[2])))return r.error('The length argument to "array" must be a positive integer literal',2);g=e[2],c++}o=fi(m,g)}else{if(!Ze[h])throw new Error(`Types doesn't contain name = ${h}`);o=Ze[h]}const p=[];for(;c<e.length;c++){const m=r.parse(e[c],c,Je);if(!m)return null;p.push(m)}return new Xe(o,p)}evaluate(e){for(let r=0;r<this.args.length;r++){const o=this.args[r].evaluate(e);if(!tr(this.type,ae(o)))return o;if(r===this.args.length-1)throw new De(`Expected value to be of type ${Tt(this.type)}, but found ${Tt(ae(o))} instead.`)}throw new Error}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const pt={"to-boolean":Ye,"to-color":oi,"to-number":Se,"to-string":et};class Ke{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");const o=e[0];if(!pt[o])throw new Error(`Can't parse ${o} as it is not part of the known types`);if((o==="to-boolean"||o==="to-string")&&e.length!==2)return r.error("Expected one argument.");const c=pt[o],h=[];for(let p=1;p<e.length;p++){const m=r.parse(e[p],p,Je);if(!m)return null;h.push(m)}return new Ke(c,h)}evaluate(e){if(this.type.kind==="boolean")return Boolean(this.args[0].evaluate(e));if(this.type.kind==="color"){let r,o;for(const c of this.args){if(r=c.evaluate(e),o=null,r instanceof D)return r;if(typeof r=="string"){const h=e.parseColor(r);if(h)return h}else if(Array.isArray(r)&&(o=r.length<3||r.length>4?`Invalid rbga value ${JSON.stringify(r)}: expected an array containing either three or four numeric values.`:le(r[0],r[1],r[2],r[3]),!o))return new D(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new De(o||`Could not parse color from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}if(this.type.kind==="padding"){let r;for(const o of this.args){r=o.evaluate(e);const c=G.parse(r);if(c)return c}throw new De(`Could not parse padding from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}if(this.type.kind==="number"){let r=null;for(const o of this.args){if(r=o.evaluate(e),r===null)return 0;const c=Number(r);if(!isNaN(c))return c}throw new De(`Could not convert ${JSON.stringify(r)} to number.`)}return this.type.kind==="formatted"?Z.fromString(Oe(this.args[0].evaluate(e))):this.type.kind==="resolvedImage"?K.fromString(Oe(this.args[0].evaluate(e))):Oe(this.args[0].evaluate(e))}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const tt=["Unknown","Point","LineString","Polygon"];class ft{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?tt[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(e){let r=this._parseColorCache[e];return r||(r=this._parseColorCache[e]=D.parse(e)),r}}class St{constructor(e,r,o,c){this.name=e,this.type=r,this._evaluate=o,this.args=c}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(e,r){const o=e[0],c=St.definitions[o];if(!c)return r.error(`Unknown expression "${o}". If you wanted a literal array, use ["literal", [...]].`,0);const h=Array.isArray(c)?c[0]:c.type,p=Array.isArray(c)?[[c[1],c[2]]]:c.overloads,m=p.filter(([x])=>!Array.isArray(x)||x.length===e.length-1);let g=null;for(const[x,w]of m){g=new Tn(r.registry,r.path,null,r.scope);const E=[];let A=!1;for(let M=1;M<e.length;M++){const z=e[M],$=Array.isArray(x)?x[M-1]:x.type,U=g.parse(z,1+E.length,$);if(!U){A=!0;break}E.push(U)}if(!A)if(Array.isArray(x)&&x.length!==E.length)g.error(`Expected ${x.length} arguments, but found ${E.length} instead.`);else{for(let M=0;M<E.length;M++){const z=Array.isArray(x)?x[M]:x.type,$=E[M];g.concat(M+1).checkSubtype(z,$.type)}if(g.errors.length===0)return new St(o,h,w,E)}}if(m.length===1)r.errors.push(...g.errors);else{const x=(m.length?m:p).map(([E])=>{return A=E,Array.isArray(A)?`(${A.map(Tt).join(", ")})`:`(${Tt(A.type)}...)`;var A}).join(" | "),w=[];for(let E=1;E<e.length;E++){const A=r.parse(e[E],1+w.length);if(!A)return null;w.push(Tt(A.type))}r.error(`Expected arguments of type ${x}, but found (${w.join(", ")}) instead.`)}return null}static register(e,r){St.definitions=r;for(const o in r)e[o]=St}}class Qt{constructor(e,r,o){this.type=gr,this.locale=o,this.caseSensitive=e,this.diacriticSensitive=r}static parse(e,r){if(e.length!==2)return r.error("Expected one argument.");const o=e[1];if(typeof o!="object"||Array.isArray(o))return r.error("Collator options argument must be an object.");const c=r.parse(o["case-sensitive"]!==void 0&&o["case-sensitive"],1,Ye);if(!c)return null;const h=r.parse(o["diacritic-sensitive"]!==void 0&&o["diacritic-sensitive"],1,Ye);if(!h)return null;let p=null;return o.locale&&(p=r.parse(o.locale,1,et),!p)?null:new Qt(c,h,p)}evaluate(e){return new N(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}}const kt=8192;function li(i,e){i[0]=Math.min(i[0],e[0]),i[1]=Math.min(i[1],e[1]),i[2]=Math.max(i[2],e[0]),i[3]=Math.max(i[3],e[1])}function bn(i,e){return!(i[0]<=e[0]||i[2]>=e[2]||i[1]<=e[1]||i[3]>=e[3])}function qn(i,e){const r=(180+i[0])/360,o=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i[1]*Math.PI/360)))/360,c=Math.pow(2,e.z);return[Math.round(r*c*kt),Math.round(o*c*kt)]}function It(i,e,r){const o=i[0]-e[0],c=i[1]-e[1],h=i[0]-r[0],p=i[1]-r[1];return o*p-h*c==0&&o*h<=0&&c*p<=0}function ts(i,e){let r=!1;for(let p=0,m=e.length;p<m;p++){const g=e[p];for(let x=0,w=g.length;x<w-1;x++){if(It(i,g[x],g[x+1]))return!1;(c=g[x])[1]>(o=i)[1]!=(h=g[x+1])[1]>o[1]&&o[0]<(h[0]-c[0])*(o[1]-c[1])/(h[1]-c[1])+c[0]&&(r=!r)}}var o,c,h;return r}function is(i,e){for(let r=0;r<e.length;r++)if(ts(i,e[r]))return!0;return!1}function ia(i,e,r,o){const c=o[0]-r[0],h=o[1]-r[1],p=(i[0]-r[0])*h-c*(i[1]-r[1]),m=(e[0]-r[0])*h-c*(e[1]-r[1]);return p>0&&m<0||p<0&&m>0}function ra(i,e,r){for(const x of r)for(let w=0;w<x.length-1;++w)if((m=[(p=x[w+1])[0]-(h=x[w])[0],p[1]-h[1]])[0]*(g=[(c=e)[0]-(o=i)[0],c[1]-o[1]])[1]-m[1]*g[0]!=0&&ia(o,c,h,p)&&ia(h,p,o,c))return!0;var o,c,h,p,m,g;return!1}function rs(i,e){for(let r=0;r<i.length;++r)if(!ts(i[r],e))return!1;for(let r=0;r<i.length-1;++r)if(ra(i[r],i[r+1],e))return!1;return!0}function fl(i,e){for(let r=0;r<e.length;r++)if(rs(i,e[r]))return!0;return!1}function To(i,e,r){const o=[];for(let c=0;c<i.length;c++){const h=[];for(let p=0;p<i[c].length;p++){const m=qn(i[c][p],r);li(e,m),h.push(m)}o.push(h)}return o}function ns(i,e,r){const o=[];for(let c=0;c<i.length;c++){const h=To(i[c],e,r);o.push(h)}return o}function na(i,e,r,o){if(i[0]<r[0]||i[0]>r[2]){const c=.5*o;let h=i[0]-r[0]>c?-o:r[0]-i[0]>c?o:0;h===0&&(h=i[0]-r[2]>c?-o:r[2]-i[0]>c?o:0),i[0]+=h}li(e,i)}function oa(i,e,r,o){const c=Math.pow(2,o.z)*kt,h=[o.x*kt,o.y*kt],p=[];for(const m of i)for(const g of m){const x=[g.x+h[0],g.y+h[1]];na(x,e,r,c),p.push(x)}return p}function sa(i,e,r,o){const c=Math.pow(2,o.z)*kt,h=[o.x*kt,o.y*kt],p=[];for(const g of i){const x=[];for(const w of g){const E=[w.x+h[0],w.y+h[1]];li(e,E),x.push(E)}p.push(x)}if(e[2]-e[0]<=c/2){(m=e)[0]=m[1]=1/0,m[2]=m[3]=-1/0;for(const g of p)for(const x of g)na(x,e,r,c)}var m;return p}class Hr{constructor(e,r){this.type=Ye,this.geojson=e,this.geometries=r}static parse(e,r){if(e.length!==2)return r.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(_e(e[1])){const o=e[1];if(o.type==="FeatureCollection")for(let c=0;c<o.features.length;++c){const h=o.features[c].geometry.type;if(h==="Polygon"||h==="MultiPolygon")return new Hr(o,o.features[c].geometry)}else if(o.type==="Feature"){const c=o.geometry.type;if(c==="Polygon"||c==="MultiPolygon")return new Hr(o,o.geometry)}else if(o.type==="Polygon"||o.type==="MultiPolygon")return new Hr(o,o)}return r.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return function(r,o){const c=[1/0,1/0,-1/0,-1/0],h=[1/0,1/0,-1/0,-1/0],p=r.canonicalID();if(o.type==="Polygon"){const m=To(o.coordinates,h,p),g=oa(r.geometry(),c,h,p);if(!bn(c,h))return!1;for(const x of g)if(!ts(x,m))return!1}if(o.type==="MultiPolygon"){const m=ns(o.coordinates,h,p),g=oa(r.geometry(),c,h,p);if(!bn(c,h))return!1;for(const x of g)if(!is(x,m))return!1}return!0}(e,this.geometries);if(e.geometryType()==="LineString")return function(r,o){const c=[1/0,1/0,-1/0,-1/0],h=[1/0,1/0,-1/0,-1/0],p=r.canonicalID();if(o.type==="Polygon"){const m=To(o.coordinates,h,p),g=sa(r.geometry(),c,h,p);if(!bn(c,h))return!1;for(const x of g)if(!rs(x,m))return!1}if(o.type==="MultiPolygon"){const m=ns(o.coordinates,h,p),g=sa(r.geometry(),c,h,p);if(!bn(c,h))return!1;for(const x of g)if(!fl(x,m))return!1}return!0}(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}function Zn(i){if(i instanceof St&&(i.name==="get"&&i.args.length===1||i.name==="feature-state"||i.name==="has"&&i.args.length===1||i.name==="properties"||i.name==="geometry-type"||i.name==="id"||/^filter-/.test(i.name))||i instanceof Hr)return!1;let e=!0;return i.eachChild(r=>{e&&!Zn(r)&&(e=!1)}),e}function wn(i){if(i instanceof St&&i.name==="feature-state")return!1;let e=!0;return i.eachChild(r=>{e&&!wn(r)&&(e=!1)}),e}function Eo(i,e){if(i instanceof St&&e.indexOf(i.name)>=0)return!1;let r=!0;return i.eachChild(o=>{r&&!Eo(o,e)&&(r=!1)}),r}class So{constructor(e,r){this.type=r.type,this.name=e,this.boundExpression=r}static parse(e,r){if(e.length!==2||typeof e[1]!="string")return r.error("'var' expression requires exactly one string literal argument.");const o=e[1];return r.scope.has(o)?new So(o,r.scope.get(o)):r.error(`Unknown variable "${o}". Make sure "${o}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}}class Tn{constructor(e,r=[],o,c=new Ai,h=[]){this.registry=e,this.path=r,this.key=r.map(p=>`[${p}]`).join(""),this.scope=c,this.errors=h,this.expectedType=o}parse(e,r,o,c,h={}){return r?this.concat(r,o,c)._parse(e,h):this._parse(e,h)}_parse(e,r){function o(c,h,p){return p==="assert"?new Xe(h,[c]):p==="coerce"?new Ke(h,[c]):c}if(e!==null&&typeof e!="string"&&typeof e!="boolean"&&typeof e!="number"||(e=["literal",e]),Array.isArray(e)){if(e.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const c=e[0];if(typeof c!="string")return this.error(`Expression name must be a string, but found ${typeof c} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const h=this.registry[c];if(h){let p=h.parse(e,this);if(!p)return null;if(this.expectedType){const m=this.expectedType,g=p.type;if(m.kind!=="string"&&m.kind!=="number"&&m.kind!=="boolean"&&m.kind!=="object"&&m.kind!=="array"||g.kind!=="value")if(m.kind!=="color"&&m.kind!=="formatted"&&m.kind!=="resolvedImage"||g.kind!=="value"&&g.kind!=="string")if(m.kind!=="padding"||g.kind!=="value"&&g.kind!=="number"&&g.kind!=="array"){if(this.checkSubtype(m,g))return null}else p=o(p,m,r.typeAnnotation||"coerce");else p=o(p,m,r.typeAnnotation||"coerce");else p=o(p,m,r.typeAnnotation||"assert")}if(!(p instanceof $e)&&p.type.kind!=="resolvedImage"&&os(p)){const m=new ft;try{p=new $e(p.type,p.evaluate(m))}catch(g){return this.error(g.message),null}}return p}return this.error(`Unknown expression "${c}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(e===void 0?"'undefined' value invalid. Use null instead.":typeof e=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof e} instead.`)}concat(e,r,o){const c=typeof e=="number"?this.path.concat(e):this.path,h=o?this.scope.concat(o):this.scope;return new Tn(this.registry,c,r||null,h,this.errors)}error(e,...r){const o=`${this.key}${r.map(c=>`[${c}]`).join("")}`;this.errors.push(new Ii(o,e))}checkSubtype(e,r){const o=tr(e,r);return o&&this.error(o),o}}function os(i){if(i instanceof So)return os(i.boundExpression);if(i instanceof St&&i.name==="error"||i instanceof Qt||i instanceof Hr)return!1;const e=i instanceof Ke||i instanceof Xe;let r=!0;return i.eachChild(o=>{r=e?r&&os(o):r&&o instanceof $e}),!!r&&Zn(i)&&Eo(i,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function Io(i,e){const r=i.length-1;let o,c,h=0,p=r,m=0;for(;h<=p;)if(m=Math.floor((h+p)/2),o=i[m],c=i[m+1],o<=e){if(m===r||e<c)return m;h=m+1}else{if(!(o>e))throw new De("Input is not a number.");p=m-1}return 0}class jn{constructor(e,r,o){this.type=e,this.input=r,this.labels=[],this.outputs=[];for(const[c,h]of o)this.labels.push(c),this.outputs.push(h)}static parse(e,r){if(e.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return r.error("Expected an even number of arguments.");const o=r.parse(e[1],1,Se);if(!o)return null;const c=[];let h=null;r.expectedType&&r.expectedType.kind!=="value"&&(h=r.expectedType);for(let p=1;p<e.length;p+=2){const m=p===1?-1/0:e[p],g=e[p+1],x=p,w=p+1;if(typeof m!="number")return r.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',x);if(c.length&&c[c.length-1][0]>=m)return r.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',x);const E=r.parse(g,w,h);if(!E)return null;h=h||E.type,c.push([m,E])}return new jn(h,o,c)}evaluate(e){const r=this.labels,o=this.outputs;if(r.length===1)return o[0].evaluate(e);const c=this.input.evaluate(e);if(c<=r[0])return o[0].evaluate(e);const h=r.length;return c>=r[h-1]?o[h-1].evaluate(e):o[Io(r,c)].evaluate(e)}eachChild(e){e(this.input);for(const r of this.outputs)e(r)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function Dt(i,e,r){return i*(1-r)+e*r}var Xn=Object.freeze({__proto__:null,number:Dt,color:function(i,e,r){return new D(Dt(i.r,e.r,r),Dt(i.g,e.g,r),Dt(i.b,e.b,r),Dt(i.a,e.a,r))},array:function(i,e,r){return i.map((o,c)=>Dt(o,e[c],r))},padding:function(i,e,r){const o=i.values,c=e.values;return new G([Dt(o[0],c[0],r),Dt(o[1],c[1],r),Dt(o[2],c[2],r),Dt(o[3],c[3],r)])}});const aa=.95047,la=1.08883,ss=4/29,Ao=6/29,ca=3*Ao*Ao,ml=Math.PI/180,gl=180/Math.PI;function as(i){return i>.008856451679035631?Math.pow(i,1/3):i/ca+ss}function ls(i){return i>Ao?i*i*i:ca*(i-ss)}function cs(i){return 255*(i<=.0031308?12.92*i:1.055*Math.pow(i,1/2.4)-.055)}function us(i){return(i/=255)<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4)}function _t(i){const e=us(i.r),r=us(i.g),o=us(i.b),c=as((.4124564*e+.3575761*r+.1804375*o)/aa),h=as((.2126729*e+.7151522*r+.072175*o)/1);return{l:116*h-16,a:500*(c-h),b:200*(h-as((.0193339*e+.119192*r+.9503041*o)/la)),alpha:i.a}}function ua(i){let e=(i.l+16)/116,r=isNaN(i.a)?e:e+i.a/500,o=isNaN(i.b)?e:e-i.b/200;return e=1*ls(e),r=aa*ls(r),o=la*ls(o),new D(cs(3.2404542*r-1.5371385*e-.4985314*o),cs(-.969266*r+1.8760108*e+.041556*o),cs(.0556434*r-.2040259*e+1.0572252*o),i.alpha)}function _l(i,e,r){const o=e-i;return i+r*(o>180||o<-180?o-360*Math.round(o/360):o)}const Wn={forward:_t,reverse:ua,interpolate:function(i,e,r){return{l:Dt(i.l,e.l,r),a:Dt(i.a,e.a,r),b:Dt(i.b,e.b,r),alpha:Dt(i.alpha,e.alpha,r)}}},Hn={forward:function(i){const{l:e,a:r,b:o}=_t(i),c=Math.atan2(o,r)*gl;return{h:c<0?c+360:c,c:Math.sqrt(r*r+o*o),l:e,alpha:i.a}},reverse:function(i){const e=i.h*ml,r=i.c;return ua({l:i.l,a:Math.cos(e)*r,b:Math.sin(e)*r,alpha:i.alpha})},interpolate:function(i,e,r){return{h:_l(i.h,e.h,r),c:Dt(i.c,e.c,r),l:Dt(i.l,e.l,r),alpha:Dt(i.alpha,e.alpha,r)}}};var ha=Object.freeze({__proto__:null,lab:Wn,hcl:Hn});class Ci{constructor(e,r,o,c,h){this.type=e,this.operator=r,this.interpolation=o,this.input=c,this.labels=[],this.outputs=[];for(const[p,m]of h)this.labels.push(p),this.outputs.push(m)}static interpolationFactor(e,r,o,c){let h=0;if(e.name==="exponential")h=hs(r,e.base,o,c);else if(e.name==="linear")h=hs(r,1,o,c);else if(e.name==="cubic-bezier"){const p=e.controlPoints;h=new ve(p[0],p[1],p[2],p[3]).solve(hs(r,1,o,c))}return h}static parse(e,r){let[o,c,h,...p]=e;if(!Array.isArray(c)||c.length===0)return r.error("Expected an interpolation type expression.",1);if(c[0]==="linear")c={name:"linear"};else if(c[0]==="exponential"){const x=c[1];if(typeof x!="number")return r.error("Exponential interpolation requires a numeric base.",1,1);c={name:"exponential",base:x}}else{if(c[0]!=="cubic-bezier")return r.error(`Unknown interpolation type ${String(c[0])}`,1,0);{const x=c.slice(1);if(x.length!==4||x.some(w=>typeof w!="number"||w<0||w>1))return r.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);c={name:"cubic-bezier",controlPoints:x}}}if(e.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return r.error("Expected an even number of arguments.");if(h=r.parse(h,2,Se),!h)return null;const m=[];let g=null;o==="interpolate-hcl"||o==="interpolate-lab"?g=oi:r.expectedType&&r.expectedType.kind!=="value"&&(g=r.expectedType);for(let x=0;x<p.length;x+=2){const w=p[x],E=p[x+1],A=x+3,M=x+4;if(typeof w!="number")return r.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',A);if(m.length&&m[m.length-1][0]>=w)return r.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',A);const z=r.parse(E,M,g);if(!z)return null;g=g||z.type,m.push([w,z])}return g.kind==="number"||g.kind==="color"||g.kind==="padding"||g.kind==="array"&&g.itemType.kind==="number"&&typeof g.N=="number"?new Ci(g,o,c,h,m):r.error(`Type ${Tt(g)} is not interpolatable.`)}evaluate(e){const r=this.labels,o=this.outputs;if(r.length===1)return o[0].evaluate(e);const c=this.input.evaluate(e);if(c<=r[0])return o[0].evaluate(e);const h=r.length;if(c>=r[h-1])return o[h-1].evaluate(e);const p=Io(r,c),m=Ci.interpolationFactor(this.interpolation,c,r[p],r[p+1]),g=o[p].evaluate(e),x=o[p+1].evaluate(e);return this.operator==="interpolate"?Xn[this.type.kind.toLowerCase()](g,x,m):this.operator==="interpolate-hcl"?Hn.reverse(Hn.interpolate(Hn.forward(g),Hn.forward(x),m)):Wn.reverse(Wn.interpolate(Wn.forward(g),Wn.forward(x),m))}eachChild(e){e(this.input);for(const r of this.outputs)e(r)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function hs(i,e,r,o){const c=o-r,h=i-r;return c===0?0:e===1?h/c:(Math.pow(e,h)-1)/(Math.pow(e,c)-1)}class Co{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expectected at least one argument.");let o=null;const c=r.expectedType;c&&c.kind!=="value"&&(o=c);const h=[];for(const m of e.slice(1)){const g=r.parse(m,1+h.length,o,void 0,{typeAnnotation:"omit"});if(!g)return null;o=o||g.type,h.push(g)}if(!o)throw new Error("No output type");const p=c&&h.some(m=>tr(c,m.type));return new Co(p?Je:o,h)}evaluate(e){let r,o=null,c=0;for(const h of this.args)if(c++,o=h.evaluate(e),o&&o instanceof K&&!o.available&&(r||(r=o.name),o=null,c===this.args.length&&(o=r)),o!==null)break;return o}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}class Mo{constructor(e,r){this.type=r.type,this.bindings=[].concat(e),this.result=r}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const r of this.bindings)e(r[1]);e(this.result)}static parse(e,r){if(e.length<4)return r.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);const o=[];for(let h=1;h<e.length-1;h+=2){const p=e[h];if(typeof p!="string")return r.error(`Expected string, but found ${typeof p} instead.`,h);if(/[^a-zA-Z0-9_]/.test(p))return r.error("Variable names must contain only alphanumeric characters or '_'.",h);const m=r.parse(e[h+1],h+1);if(!m)return null;o.push([p,m])}const c=r.parse(e[e.length-1],e.length-1,r.expectedType,o);return c?new Mo(o,c):null}outputDefined(){return this.result.outputDefined()}}class ds{constructor(e,r,o){this.type=e,this.index=r,this.input=o}static parse(e,r){if(e.length!==3)return r.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const o=r.parse(e[1],1,Se),c=r.parse(e[2],2,fi(r.expectedType||Je));return o&&c?new ds(c.type.itemType,o,c):null}evaluate(e){const r=this.index.evaluate(e),o=this.input.evaluate(e);if(r<0)throw new De(`Array index out of bounds: ${r} < 0.`);if(r>=o.length)throw new De(`Array index out of bounds: ${r} > ${o.length-1}.`);if(r!==Math.floor(r))throw new De(`Array index must be an integer, but found ${r} instead.`);return o[r]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}}class ps{constructor(e,r){this.type=Ye,this.needle=e,this.haystack=r}static parse(e,r){if(e.length!==3)return r.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const o=r.parse(e[1],1,Je),c=r.parse(e[2],2,Je);return o&&c?jr(o.type,[Ye,et,Se,kr,Je])?new ps(o,c):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${Tt(o.type)} instead`):null}evaluate(e){const r=this.needle.evaluate(e),o=this.haystack.evaluate(e);if(!o)return!1;if(!Xr(r,["boolean","string","number","null"]))throw new De(`Expected first argument to be of type boolean, string, number or null, but found ${Tt(ae(r))} instead.`);if(!Xr(o,["string","array"]))throw new De(`Expected second argument to be of type array or string, but found ${Tt(ae(o))} instead.`);return o.indexOf(r)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}}class zo{constructor(e,r,o){this.type=Se,this.needle=e,this.haystack=r,this.fromIndex=o}static parse(e,r){if(e.length<=2||e.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const o=r.parse(e[1],1,Je),c=r.parse(e[2],2,Je);if(!o||!c)return null;if(!jr(o.type,[Ye,et,Se,kr,Je]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${Tt(o.type)} instead`);if(e.length===4){const h=r.parse(e[3],3,Se);return h?new zo(o,c,h):null}return new zo(o,c)}evaluate(e){const r=this.needle.evaluate(e),o=this.haystack.evaluate(e);if(!Xr(r,["boolean","string","number","null"]))throw new De(`Expected first argument to be of type boolean, string, number or null, but found ${Tt(ae(r))} instead.`);if(!Xr(o,["string","array"]))throw new De(`Expected second argument to be of type array or string, but found ${Tt(ae(o))} instead.`);if(this.fromIndex){const c=this.fromIndex.evaluate(e);return o.indexOf(r,c)}return o.indexOf(r)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}}class fs{constructor(e,r,o,c,h,p){this.inputType=e,this.type=r,this.input=o,this.cases=c,this.outputs=h,this.otherwise=p}static parse(e,r){if(e.length<5)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return r.error("Expected an even number of arguments.");let o,c;r.expectedType&&r.expectedType.kind!=="value"&&(c=r.expectedType);const h={},p=[];for(let x=2;x<e.length-1;x+=2){let w=e[x];const E=e[x+1];Array.isArray(w)||(w=[w]);const A=r.concat(x);if(w.length===0)return A.error("Expected at least one branch label.");for(const z of w){if(typeof z!="number"&&typeof z!="string")return A.error("Branch labels must be numbers or strings.");if(typeof z=="number"&&Math.abs(z)>Number.MAX_SAFE_INTEGER)return A.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof z=="number"&&Math.floor(z)!==z)return A.error("Numeric branch labels must be integer values.");if(o){if(A.checkSubtype(o,ae(z)))return null}else o=ae(z);if(h[String(z)]!==void 0)return A.error("Branch labels must be unique.");h[String(z)]=p.length}const M=r.parse(E,x,c);if(!M)return null;c=c||M.type,p.push(M)}const m=r.parse(e[1],1,Je);if(!m)return null;const g=r.parse(e[e.length-1],e.length-1,c);return g?m.type.kind!=="value"&&r.concat(1).checkSubtype(o,m.type)?null:new fs(o,c,m,h,p,g):null}evaluate(e){const r=this.input.evaluate(e);return(ae(r)===this.inputType&&this.outputs[this.cases[r]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every(e=>e.outputDefined())&&this.otherwise.outputDefined()}}class ms{constructor(e,r,o){this.type=e,this.branches=r,this.otherwise=o}static parse(e,r){if(e.length<4)return r.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return r.error("Expected an odd number of arguments.");let o;r.expectedType&&r.expectedType.kind!=="value"&&(o=r.expectedType);const c=[];for(let p=1;p<e.length-1;p+=2){const m=r.parse(e[p],p,Ye);if(!m)return null;const g=r.parse(e[p+1],p+1,o);if(!g)return null;c.push([m,g]),o=o||g.type}const h=r.parse(e[e.length-1],e.length-1,o);if(!h)return null;if(!o)throw new Error("Can't infer output type");return new ms(o,c,h)}evaluate(e){for(const[r,o]of this.branches)if(r.evaluate(e))return o.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(const[r,o]of this.branches)e(r),e(o);e(this.otherwise)}outputDefined(){return this.branches.every(([e,r])=>r.outputDefined())&&this.otherwise.outputDefined()}}class Po{constructor(e,r,o,c){this.type=e,this.input=r,this.beginIndex=o,this.endIndex=c}static parse(e,r){if(e.length<=2||e.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const o=r.parse(e[1],1,Je),c=r.parse(e[2],2,Se);if(!o||!c)return null;if(!jr(o.type,[fi(Je),et,Je]))return r.error(`Expected first argument to be of type array or string, but found ${Tt(o.type)} instead`);if(e.length===4){const h=r.parse(e[3],3,Se);return h?new Po(o.type,o,c,h):null}return new Po(o.type,o,c)}evaluate(e){const r=this.input.evaluate(e),o=this.beginIndex.evaluate(e);if(!Xr(r,["string","array"]))throw new De(`Expected first argument to be of type array or string, but found ${Tt(ae(r))} instead.`);if(this.endIndex){const c=this.endIndex.evaluate(e);return r.slice(o,c)}return r.slice(o)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}}function da(i,e){return i==="=="||i==="!="?e.kind==="boolean"||e.kind==="string"||e.kind==="number"||e.kind==="null"||e.kind==="value":e.kind==="string"||e.kind==="number"||e.kind==="value"}function pa(i,e,r,o){return o.compare(e,r)===0}function En(i,e,r){const o=i!=="=="&&i!=="!=";return class ph{constructor(h,p,m){this.type=Ye,this.lhs=h,this.rhs=p,this.collator=m,this.hasUntypedArgument=h.type.kind==="value"||p.type.kind==="value"}static parse(h,p){if(h.length!==3&&h.length!==4)return p.error("Expected two or three arguments.");const m=h[0];let g=p.parse(h[1],1,Je);if(!g)return null;if(!da(m,g.type))return p.concat(1).error(`"${m}" comparisons are not supported for type '${Tt(g.type)}'.`);let x=p.parse(h[2],2,Je);if(!x)return null;if(!da(m,x.type))return p.concat(2).error(`"${m}" comparisons are not supported for type '${Tt(x.type)}'.`);if(g.type.kind!==x.type.kind&&g.type.kind!=="value"&&x.type.kind!=="value")return p.error(`Cannot compare types '${Tt(g.type)}' and '${Tt(x.type)}'.`);o&&(g.type.kind==="value"&&x.type.kind!=="value"?g=new Xe(x.type,[g]):g.type.kind!=="value"&&x.type.kind==="value"&&(x=new Xe(g.type,[x])));let w=null;if(h.length===4){if(g.type.kind!=="string"&&x.type.kind!=="string"&&g.type.kind!=="value"&&x.type.kind!=="value")return p.error("Cannot use collator to compare non-string types.");if(w=p.parse(h[3],3,gr),!w)return null}return new ph(g,x,w)}evaluate(h){const p=this.lhs.evaluate(h),m=this.rhs.evaluate(h);if(o&&this.hasUntypedArgument){const g=ae(p),x=ae(m);if(g.kind!==x.kind||g.kind!=="string"&&g.kind!=="number")throw new De(`Expected arguments for "${i}" to be (string, string) or (number, number), but found (${g.kind}, ${x.kind}) instead.`)}if(this.collator&&!o&&this.hasUntypedArgument){const g=ae(p),x=ae(m);if(g.kind!=="string"||x.kind!=="string")return e(h,p,m)}return this.collator?r(h,p,m,this.collator.evaluate(h)):e(h,p,m)}eachChild(h){h(this.lhs),h(this.rhs),this.collator&&h(this.collator)}outputDefined(){return!0}}}const yl=En("==",function(i,e,r){return e===r},pa),xl=En("!=",function(i,e,r){return e!==r},function(i,e,r,o){return!pa(0,e,r,o)}),vl=En("<",function(i,e,r){return e<r},function(i,e,r,o){return o.compare(e,r)<0}),bl=En(">",function(i,e,r){return e>r},function(i,e,r,o){return o.compare(e,r)>0}),wl=En("<=",function(i,e,r){return e<=r},function(i,e,r,o){return o.compare(e,r)<=0}),Tl=En(">=",function(i,e,r){return e>=r},function(i,e,r,o){return o.compare(e,r)>=0});class gs{constructor(e,r,o,c,h){this.type=et,this.number=e,this.locale=r,this.currency=o,this.minFractionDigits=c,this.maxFractionDigits=h}static parse(e,r){if(e.length!==3)return r.error("Expected two arguments.");const o=r.parse(e[1],1,Se);if(!o)return null;const c=e[2];if(typeof c!="object"||Array.isArray(c))return r.error("NumberFormat options argument must be an object.");let h=null;if(c.locale&&(h=r.parse(c.locale,1,et),!h))return null;let p=null;if(c.currency&&(p=r.parse(c.currency,1,et),!p))return null;let m=null;if(c["min-fraction-digits"]&&(m=r.parse(c["min-fraction-digits"],1,Se),!m))return null;let g=null;return c["max-fraction-digits"]&&(g=r.parse(c["max-fraction-digits"],1,Se),!g)?null:new gs(o,h,p,m,g)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}}class ko{constructor(e){this.type=Yt,this.sections=e}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");const o=e[1];if(!Array.isArray(o)&&typeof o=="object")return r.error("First argument must be an image or text section.");const c=[];let h=!1;for(let p=1;p<=e.length-1;++p){const m=e[p];if(h&&typeof m=="object"&&!Array.isArray(m)){h=!1;let g=null;if(m["font-scale"]&&(g=r.parse(m["font-scale"],1,Se),!g))return null;let x=null;if(m["text-font"]&&(x=r.parse(m["text-font"],1,fi(et)),!x))return null;let w=null;if(m["text-color"]&&(w=r.parse(m["text-color"],1,oi),!w))return null;const E=c[c.length-1];E.scale=g,E.font=x,E.textColor=w}else{const g=r.parse(e[p],1,Je);if(!g)return null;const x=g.type.kind;if(x!=="string"&&x!=="value"&&x!=="null"&&x!=="resolvedImage")return r.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");h=!0,c.push({content:g,scale:null,font:null,textColor:null})}}return new ko(c)}evaluate(e){return new Z(this.sections.map(r=>{const o=r.content.evaluate(e);return ae(o)===qt?new H("",o,null,null,null):new H(Oe(o),null,r.scale?r.scale.evaluate(e):null,r.font?r.font.evaluate(e).join(","):null,r.textColor?r.textColor.evaluate(e):null)}))}eachChild(e){for(const r of this.sections)e(r.content),r.scale&&e(r.scale),r.font&&e(r.font),r.textColor&&e(r.textColor)}outputDefined(){return!1}}class _s{constructor(e){this.type=qt,this.input=e}static parse(e,r){if(e.length!==2)return r.error("Expected two arguments.");const o=r.parse(e[1],1,et);return o?new _s(o):r.error("No image name provided.")}evaluate(e){const r=this.input.evaluate(e),o=K.fromString(r);return o&&e.availableImages&&(o.available=e.availableImages.indexOf(r)>-1),o}eachChild(e){e(this.input)}outputDefined(){return!1}}class ys{constructor(e){this.type=Se,this.input=e}static parse(e,r){if(e.length!==2)return r.error(`Expected 1 argument, but found ${e.length-1} instead.`);const o=r.parse(e[1],1);return o?o.type.kind!=="array"&&o.type.kind!=="string"&&o.type.kind!=="value"?r.error(`Expected argument of type string or array, but found ${Tt(o.type)} instead.`):new ys(o):null}evaluate(e){const r=this.input.evaluate(e);if(typeof r=="string"||Array.isArray(r))return r.length;throw new De(`Expected value to be of type string or array, but found ${Tt(ae(r))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}}const Sn={"==":yl,"!=":xl,">":bl,"<":vl,">=":Tl,"<=":wl,array:Xe,at:ds,boolean:Xe,case:ms,coalesce:Co,collator:Qt,format:ko,image:_s,in:ps,"index-of":zo,interpolate:Ci,"interpolate-hcl":Ci,"interpolate-lab":Ci,length:ys,let:Mo,literal:$e,match:fs,number:Xe,"number-format":gs,object:Xe,slice:Po,step:jn,string:Xe,"to-boolean":Ke,"to-color":Ke,"to-number":Ke,"to-string":Ke,var:So,within:Hr};function fa(i,[e,r,o,c]){e=e.evaluate(i),r=r.evaluate(i),o=o.evaluate(i);const h=c?c.evaluate(i):1,p=le(e,r,o,h);if(p)throw new De(p);return new D(e/255*h,r/255*h,o/255*h,h)}function ma(i,e){return i in e}function Do(i,e){const r=e[i];return r===void 0?null:r}function Kr(i){return{type:i}}function ga(i){return{result:"success",value:i}}function In(i){return{result:"error",value:i}}function zt(i){return i["property-type"]==="data-driven"||i["property-type"]==="cross-faded-data-driven"}function _a(i){return!!i.expression&&i.expression.parameters.indexOf("zoom")>-1}function at(i){return!!i.expression&&i.expression.interpolated}function yt(i){return i instanceof Number?"number":i instanceof String?"string":i instanceof Boolean?"boolean":Array.isArray(i)?"array":i===null?"null":typeof i}function Ct(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)}function Lt(i){return i}function Kn(i,e){const r=e.type==="color",o=i.stops&&typeof i.stops[0][0]=="object",c=o||!(o||i.property!==void 0),h=i.type||(at(e)?"exponential":"interval");if(r||e.type==="padding"){const x=r?D.parse:G.parse;(i=ji({},i)).stops&&(i.stops=i.stops.map(w=>[w[0],x(w[1])])),i.default=x(i.default?i.default:e.default)}if(i.colorSpace&&i.colorSpace!=="rgb"&&!ha[i.colorSpace])throw new Error(`Unknown color space: ${i.colorSpace}`);let p,m,g;if(h==="exponential")p=ya;else if(h==="interval")p=Sl;else if(h==="categorical"){p=El,m=Object.create(null);for(const x of i.stops)m[x[0]]=x[1];g=typeof i.stops[0][0]}else{if(h!=="identity")throw new Error(`Unknown function type "${h}"`);p=Il}if(o){const x={},w=[];for(let M=0;M<i.stops.length;M++){const z=i.stops[M],$=z[0].zoom;x[$]===void 0&&(x[$]={zoom:$,type:i.type,property:i.property,default:i.default,stops:[]},w.push($)),x[$].stops.push([z[0].value,z[1]])}const E=[];for(const M of w)E.push([x[M].zoom,Kn(x[M],e)]);const A={name:"linear"};return{kind:"composite",interpolationType:A,interpolationFactor:Ci.interpolationFactor.bind(void 0,A),zoomStops:E.map(M=>M[0]),evaluate:({zoom:M},z)=>ya({stops:E,base:i.base},e,M).evaluate(M,z)}}if(c){const x=h==="exponential"?{name:"exponential",base:i.base!==void 0?i.base:1}:null;return{kind:"camera",interpolationType:x,interpolationFactor:Ci.interpolationFactor.bind(void 0,x),zoomStops:i.stops.map(w=>w[0]),evaluate:({zoom:w})=>p(i,e,w,m,g)}}return{kind:"source",evaluate(x,w){const E=w&&w.properties?w.properties[i.property]:void 0;return E===void 0?An(i.default,e.default):p(i,e,E,m,g)}}}function An(i,e,r){return i!==void 0?i:e!==void 0?e:r!==void 0?r:void 0}function El(i,e,r,o,c){return An(typeof r===c?o[r]:void 0,i.default,e.default)}function Sl(i,e,r){if(yt(r)!=="number")return An(i.default,e.default);const o=i.stops.length;if(o===1||r<=i.stops[0][0])return i.stops[0][1];if(r>=i.stops[o-1][0])return i.stops[o-1][1];const c=Io(i.stops.map(h=>h[0]),r);return i.stops[c][1]}function ya(i,e,r){const o=i.base!==void 0?i.base:1;if(yt(r)!=="number")return An(i.default,e.default);const c=i.stops.length;if(c===1||r<=i.stops[0][0])return i.stops[0][1];if(r>=i.stops[c-1][0])return i.stops[c-1][1];const h=Io(i.stops.map(w=>w[0]),r),p=function(w,E,A,M){const z=M-A,$=w-A;return z===0?0:E===1?$/z:(Math.pow(E,$)-1)/(Math.pow(E,z)-1)}(r,o,i.stops[h][0],i.stops[h+1][0]),m=i.stops[h][1],g=i.stops[h+1][1];let x=Xn[e.type]||Lt;if(i.colorSpace&&i.colorSpace!=="rgb"){const w=ha[i.colorSpace];x=(E,A)=>w.reverse(w.interpolate(w.forward(E),w.forward(A),p))}return typeof m.evaluate=="function"?{evaluate(...w){const E=m.evaluate.apply(void 0,w),A=g.evaluate.apply(void 0,w);if(E!==void 0&&A!==void 0)return x(E,A,p)}}:x(m,g,p)}function Il(i,e,r){switch(e.type){case"color":r=D.parse(r);break;case"formatted":r=Z.fromString(r.toString());break;case"resolvedImage":r=K.fromString(r.toString());break;case"padding":r=G.parse(r);break;default:yt(r)===e.type||e.type==="enum"&&e.values[r]||(r=void 0)}return An(r,i.default,e.default)}St.register(Sn,{error:[{kind:"error"},[et],(i,[e])=>{throw new De(e.evaluate(i))}],typeof:[et,[Je],(i,[e])=>Tt(ae(e.evaluate(i)))],"to-rgba":[fi(Se,4),[oi],(i,[e])=>e.evaluate(i).toArray()],rgb:[oi,[Se,Se,Se],fa],rgba:[oi,[Se,Se,Se,Se],fa],has:{type:Ye,overloads:[[[et],(i,[e])=>ma(e.evaluate(i),i.properties())],[[et,Dr],(i,[e,r])=>ma(e.evaluate(i),r.evaluate(i))]]},get:{type:Je,overloads:[[[et],(i,[e])=>Do(e.evaluate(i),i.properties())],[[et,Dr],(i,[e,r])=>Do(e.evaluate(i),r.evaluate(i))]]},"feature-state":[Je,[et],(i,[e])=>Do(e.evaluate(i),i.featureState||{})],properties:[Dr,[],i=>i.properties()],"geometry-type":[et,[],i=>i.geometryType()],id:[Je,[],i=>i.id()],zoom:[Se,[],i=>i.globals.zoom],"heatmap-density":[Se,[],i=>i.globals.heatmapDensity||0],"line-progress":[Se,[],i=>i.globals.lineProgress||0],accumulated:[Je,[],i=>i.globals.accumulated===void 0?null:i.globals.accumulated],"+":[Se,Kr(Se),(i,e)=>{let r=0;for(const o of e)r+=o.evaluate(i);return r}],"*":[Se,Kr(Se),(i,e)=>{let r=1;for(const o of e)r*=o.evaluate(i);return r}],"-":{type:Se,overloads:[[[Se,Se],(i,[e,r])=>e.evaluate(i)-r.evaluate(i)],[[Se],(i,[e])=>-e.evaluate(i)]]},"/":[Se,[Se,Se],(i,[e,r])=>e.evaluate(i)/r.evaluate(i)],"%":[Se,[Se,Se],(i,[e,r])=>e.evaluate(i)%r.evaluate(i)],ln2:[Se,[],()=>Math.LN2],pi:[Se,[],()=>Math.PI],e:[Se,[],()=>Math.E],"^":[Se,[Se,Se],(i,[e,r])=>Math.pow(e.evaluate(i),r.evaluate(i))],sqrt:[Se,[Se],(i,[e])=>Math.sqrt(e.evaluate(i))],log10:[Se,[Se],(i,[e])=>Math.log(e.evaluate(i))/Math.LN10],ln:[Se,[Se],(i,[e])=>Math.log(e.evaluate(i))],log2:[Se,[Se],(i,[e])=>Math.log(e.evaluate(i))/Math.LN2],sin:[Se,[Se],(i,[e])=>Math.sin(e.evaluate(i))],cos:[Se,[Se],(i,[e])=>Math.cos(e.evaluate(i))],tan:[Se,[Se],(i,[e])=>Math.tan(e.evaluate(i))],asin:[Se,[Se],(i,[e])=>Math.asin(e.evaluate(i))],acos:[Se,[Se],(i,[e])=>Math.acos(e.evaluate(i))],atan:[Se,[Se],(i,[e])=>Math.atan(e.evaluate(i))],min:[Se,Kr(Se),(i,e)=>Math.min(...e.map(r=>r.evaluate(i)))],max:[Se,Kr(Se),(i,e)=>Math.max(...e.map(r=>r.evaluate(i)))],abs:[Se,[Se],(i,[e])=>Math.abs(e.evaluate(i))],round:[Se,[Se],(i,[e])=>{const r=e.evaluate(i);return r<0?-Math.round(-r):Math.round(r)}],floor:[Se,[Se],(i,[e])=>Math.floor(e.evaluate(i))],ceil:[Se,[Se],(i,[e])=>Math.ceil(e.evaluate(i))],"filter-==":[Ye,[et,Je],(i,[e,r])=>i.properties()[e.value]===r.value],"filter-id-==":[Ye,[Je],(i,[e])=>i.id()===e.value],"filter-type-==":[Ye,[et],(i,[e])=>i.geometryType()===e.value],"filter-<":[Ye,[et,Je],(i,[e,r])=>{const o=i.properties()[e.value],c=r.value;return typeof o==typeof c&&o<c}],"filter-id-<":[Ye,[Je],(i,[e])=>{const r=i.id(),o=e.value;return typeof r==typeof o&&r<o}],"filter->":[Ye,[et,Je],(i,[e,r])=>{const o=i.properties()[e.value],c=r.value;return typeof o==typeof c&&o>c}],"filter-id->":[Ye,[Je],(i,[e])=>{const r=i.id(),o=e.value;return typeof r==typeof o&&r>o}],"filter-<=":[Ye,[et,Je],(i,[e,r])=>{const o=i.properties()[e.value],c=r.value;return typeof o==typeof c&&o<=c}],"filter-id-<=":[Ye,[Je],(i,[e])=>{const r=i.id(),o=e.value;return typeof r==typeof o&&r<=o}],"filter->=":[Ye,[et,Je],(i,[e,r])=>{const o=i.properties()[e.value],c=r.value;return typeof o==typeof c&&o>=c}],"filter-id->=":[Ye,[Je],(i,[e])=>{const r=i.id(),o=e.value;return typeof r==typeof o&&r>=o}],"filter-has":[Ye,[Je],(i,[e])=>e.value in i.properties()],"filter-has-id":[Ye,[],i=>i.id()!==null&&i.id()!==void 0],"filter-type-in":[Ye,[fi(et)],(i,[e])=>e.value.indexOf(i.geometryType())>=0],"filter-id-in":[Ye,[fi(Je)],(i,[e])=>e.value.indexOf(i.id())>=0],"filter-in-small":[Ye,[et,fi(Je)],(i,[e,r])=>r.value.indexOf(i.properties()[e.value])>=0],"filter-in-large":[Ye,[et,fi(Je)],(i,[e,r])=>function(o,c,h,p){for(;h<=p;){const m=h+p>>1;if(c[m]===o)return!0;c[m]>o?p=m-1:h=m+1}return!1}(i.properties()[e.value],r.value,0,r.value.length-1)],all:{type:Ye,overloads:[[[Ye,Ye],(i,[e,r])=>e.evaluate(i)&&r.evaluate(i)],[Kr(Ye),(i,e)=>{for(const r of e)if(!r.evaluate(i))return!1;return!0}]]},any:{type:Ye,overloads:[[[Ye,Ye],(i,[e,r])=>e.evaluate(i)||r.evaluate(i)],[Kr(Ye),(i,e)=>{for(const r of e)if(r.evaluate(i))return!0;return!1}]]},"!":[Ye,[Ye],(i,[e])=>!e.evaluate(i)],"is-supported-script":[Ye,[et],(i,[e])=>{const r=i.globals&&i.globals.isSupportedScript;return!r||r(e.evaluate(i))}],upcase:[et,[et],(i,[e])=>e.evaluate(i).toUpperCase()],downcase:[et,[et],(i,[e])=>e.evaluate(i).toLowerCase()],concat:[et,Kr(Je),(i,e)=>e.map(r=>Oe(r.evaluate(i))).join("")],"resolved-locale":[et,[gr],(i,[e])=>e.evaluate(i).resolvedLocale()]});class Lo{constructor(e,r){this.expression=e,this._warningHistory={},this._evaluator=new ft,this._defaultValue=r?function(o){return o.type==="color"&&Ct(o.default)?new D(0,0,0,0):o.type==="color"?D.parse(o.default)||null:o.type==="padding"?G.parse(o.default)||null:o.default===void 0?null:o.default}(r):null,this._enumValues=r&&r.type==="enum"?r.values:null}evaluateWithoutErrorHandling(e,r,o,c,h,p){return this._evaluator.globals=e,this._evaluator.feature=r,this._evaluator.featureState=o,this._evaluator.canonical=c,this._evaluator.availableImages=h||null,this._evaluator.formattedSection=p,this.expression.evaluate(this._evaluator)}evaluate(e,r,o,c,h,p){this._evaluator.globals=e,this._evaluator.feature=r||null,this._evaluator.featureState=o||null,this._evaluator.canonical=c,this._evaluator.availableImages=h||null,this._evaluator.formattedSection=p||null;try{const m=this.expression.evaluate(this._evaluator);if(m==null||typeof m=="number"&&m!=m)return this._defaultValue;if(this._enumValues&&!(m in this._enumValues))throw new De(`Expected value to be one of ${Object.keys(this._enumValues).map(g=>JSON.stringify(g)).join(", ")}, but found ${JSON.stringify(m)} instead.`);return m}catch(m){return this._warningHistory[m.message]||(this._warningHistory[m.message]=!0,typeof console<"u"&&console.warn(m.message)),this._defaultValue}}}function Jn(i){return Array.isArray(i)&&i.length>0&&typeof i[0]=="string"&&i[0]in Sn}function Yn(i,e){const r=new Tn(Sn,[],e?function(c){const h={color:oi,string:et,number:Se,enum:et,boolean:Ye,formatted:Yt,padding:yn,resolvedImage:qt};return c.type==="array"?fi(h[c.value]||Je,c.length):h[c.type]}(e):void 0),o=r.parse(i,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return o?ga(new Lo(o,e)):In(r.errors)}class Qn{constructor(e,r){this.kind=e,this._styleExpression=r,this.isStateDependent=e!=="constant"&&!wn(r.expression)}evaluateWithoutErrorHandling(e,r,o,c,h,p){return this._styleExpression.evaluateWithoutErrorHandling(e,r,o,c,h,p)}evaluate(e,r,o,c,h,p){return this._styleExpression.evaluate(e,r,o,c,h,p)}}class xs{constructor(e,r,o,c){this.kind=e,this.zoomStops=o,this._styleExpression=r,this.isStateDependent=e!=="camera"&&!wn(r.expression),this.interpolationType=c}evaluateWithoutErrorHandling(e,r,o,c,h,p){return this._styleExpression.evaluateWithoutErrorHandling(e,r,o,c,h,p)}evaluate(e,r,o,c,h,p){return this._styleExpression.evaluate(e,r,o,c,h,p)}interpolationFactor(e,r,o){return this.interpolationType?Ci.interpolationFactor(this.interpolationType,e,r,o):0}}function xa(i,e){const r=Yn(i,e);if(r.result==="error")return r;const o=r.value.expression,c=Zn(o);if(!c&&!zt(e))return In([new Ii("","data expressions not supported")]);const h=Eo(o,["zoom"]);if(!h&&!_a(e))return In([new Ii("","zoom expressions not supported")]);const p=Bo(o);return p||h?p instanceof Ii?In([p]):p instanceof Ci&&!at(e)?In([new Ii("",'"interpolate" expressions cannot be used with this property')]):ga(p?new xs(c?"camera":"composite",r.value,p.labels,p instanceof Ci?p.interpolation:void 0):new Qn(c?"constant":"source",r.value)):In([new Ii("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Ro{constructor(e,r){this._parameters=e,this._specification=r,ji(this,Kn(this._parameters,this._specification))}static deserialize(e){return new Ro(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function Bo(i){let e=null;if(i instanceof Mo)e=Bo(i.result);else if(i instanceof Co){for(const r of i.args)if(e=Bo(r),e)break}else(i instanceof jn||i instanceof Ci)&&i.input instanceof St&&i.input.name==="zoom"&&(e=i);return e instanceof Ii||i.eachChild(r=>{const o=Bo(r);o instanceof Ii?e=o:!e&&o?e=new Ii("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&o&&e!==o&&(e=new Ii("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}function Xi(i){const e=i.key,r=i.value,o=i.valueSpec||{},c=i.objectElementValidators||{},h=i.style,p=i.styleSpec;let m=[];const g=yt(r);if(g!=="object")return[new Ce(e,r,`object expected, ${g} found`)];for(const x in r){const w=x.split(".")[0],E=o[w]||o["*"];let A;if(c[w])A=c[w];else if(o[w])A=zi;else if(c["*"])A=c["*"];else{if(!o["*"]){m.push(new Ce(e,r[x],`unknown property "${x}"`));continue}A=zi}m=m.concat(A({key:(e&&`${e}.`)+x,value:r[x],valueSpec:E,style:h,styleSpec:p,object:r,objectKey:x},r))}for(const x in o)c[x]||o[x].required&&o[x].default===void 0&&r[x]===void 0&&m.push(new Ce(e,r,`missing required property "${x}"`));return m}function va(i){const e=i.value,r=i.valueSpec,o=i.style,c=i.styleSpec,h=i.key,p=i.arrayElementValidator||zi;if(yt(e)!=="array")return[new Ce(h,e,`array expected, ${yt(e)} found`)];if(r.length&&e.length!==r.length)return[new Ce(h,e,`array length ${r.length} expected, length ${e.length} found`)];if(r["min-length"]&&e.length<r["min-length"])return[new Ce(h,e,`array length at least ${r["min-length"]} expected, length ${e.length} found`)];let m={type:r.value,values:r.values};c.$version<7&&(m.function=r.function),yt(r.value)==="object"&&(m=r.value);let g=[];for(let x=0;x<e.length;x++)g=g.concat(p({array:e,arrayIndex:x,value:e[x],valueSpec:m,style:o,styleSpec:c,key:`${h}[${x}]`}));return g}function vs(i){const e=i.key,r=i.value,o=i.valueSpec;let c=yt(r);return c==="number"&&r!=r&&(c="NaN"),c!=="number"?[new Ce(e,r,`number expected, ${c} found`)]:"minimum"in o&&r<o.minimum?[new Ce(e,r,`${r} is less than the minimum value ${o.minimum}`)]:"maximum"in o&&r>o.maximum?[new Ce(e,r,`${r} is greater than the maximum value ${o.maximum}`)]:[]}function ba(i){const e=i.valueSpec,r=dt(i.value.type);let o,c,h,p={};const m=r!=="categorical"&&i.value.property===void 0,g=!m,x=yt(i.value.stops)==="array"&&yt(i.value.stops[0])==="array"&&yt(i.value.stops[0][0])==="object",w=Xi({key:i.key,value:i.value,valueSpec:i.styleSpec.function,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{stops:function(M){if(r==="identity")return[new Ce(M.key,M.value,'identity function may not have a "stops" property')];let z=[];const $=M.value;return z=z.concat(va({key:M.key,value:$,valueSpec:M.valueSpec,style:M.style,styleSpec:M.styleSpec,arrayElementValidator:E})),yt($)==="array"&&$.length===0&&z.push(new Ce(M.key,$,"array must have at least one stop")),z},default:function(M){return zi({key:M.key,value:M.value,valueSpec:e,style:M.style,styleSpec:M.styleSpec})}}});return r==="identity"&&m&&w.push(new Ce(i.key,i.value,'missing required property "property"')),r==="identity"||i.value.stops||w.push(new Ce(i.key,i.value,'missing required property "stops"')),r==="exponential"&&i.valueSpec.expression&&!at(i.valueSpec)&&w.push(new Ce(i.key,i.value,"exponential functions not supported")),i.styleSpec.$version>=8&&(g&&!zt(i.valueSpec)?w.push(new Ce(i.key,i.value,"property functions not supported")):m&&!_a(i.valueSpec)&&w.push(new Ce(i.key,i.value,"zoom functions not supported"))),r!=="categorical"&&!x||i.value.property!==void 0||w.push(new Ce(i.key,i.value,'"property" property is required')),w;function E(M){let z=[];const $=M.value,U=M.key;if(yt($)!=="array")return[new Ce(U,$,`array expected, ${yt($)} found`)];if($.length!==2)return[new Ce(U,$,`array length 2 expected, length ${$.length} found`)];if(x){if(yt($[0])!=="object")return[new Ce(U,$,`object expected, ${yt($[0])} found`)];if($[0].zoom===void 0)return[new Ce(U,$,"object stop key must have zoom")];if($[0].value===void 0)return[new Ce(U,$,"object stop key must have value")];if(h&&h>dt($[0].zoom))return[new Ce(U,$[0].zoom,"stop zoom values must appear in ascending order")];dt($[0].zoom)!==h&&(h=dt($[0].zoom),c=void 0,p={}),z=z.concat(Xi({key:`${U}[0]`,value:$[0],valueSpec:{zoom:{}},style:M.style,styleSpec:M.styleSpec,objectElementValidators:{zoom:vs,value:A}}))}else z=z.concat(A({key:`${U}[0]`,value:$[0],valueSpec:{},style:M.style,styleSpec:M.styleSpec},$));return Jn(Oi($[1]))?z.concat([new Ce(`${U}[1]`,$[1],"expressions are not allowed in function stops.")]):z.concat(zi({key:`${U}[1]`,value:$[1],valueSpec:e,style:M.style,styleSpec:M.styleSpec}))}function A(M,z){const $=yt(M.value),U=dt(M.value),ee=M.value!==null?M.value:z;if(o){if($!==o)return[new Ce(M.key,ee,`${$} stop domain type must match previous stop domain type ${o}`)]}else o=$;if($!=="number"&&$!=="string"&&$!=="boolean")return[new Ce(M.key,ee,"stop domain value must be a number, string, or boolean")];if($!=="number"&&r!=="categorical"){let oe=`number expected, ${$} found`;return zt(e)&&r===void 0&&(oe+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new Ce(M.key,ee,oe)]}return r!=="categorical"||$!=="number"||isFinite(U)&&Math.floor(U)===U?r!=="categorical"&&$==="number"&&c!==void 0&&U<c?[new Ce(M.key,ee,"stop domain values must appear in ascending order")]:(c=U,r==="categorical"&&U in p?[new Ce(M.key,ee,"stop domain values must be unique")]:(p[U]=!0,[])):[new Ce(M.key,ee,`integer expected, found ${U}`)]}}function Jr(i){const e=(i.expressionContext==="property"?xa:Yn)(Oi(i.value),i.valueSpec);if(e.result==="error")return e.value.map(o=>new Ce(`${i.key}${o.key}`,i.value,o.message));const r=e.value.expression||e.value._styleExpression.expression;if(i.expressionContext==="property"&&i.propertyKey==="text-font"&&!r.outputDefined())return[new Ce(i.key,i.value,`Invalid data expression for "${i.propertyKey}". Output values must be contained as literals within the expression.`)];if(i.expressionContext==="property"&&i.propertyType==="layout"&&!wn(r))return[new Ce(i.key,i.value,'"feature-state" data expressions are not supported with layout properties.')];if(i.expressionContext==="filter"&&!wn(r))return[new Ce(i.key,i.value,'"feature-state" data expressions are not supported with filters.')];if(i.expressionContext&&i.expressionContext.indexOf("cluster")===0){if(!Eo(r,["zoom","feature-state"]))return[new Ce(i.key,i.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(i.expressionContext==="cluster-initial"&&!Zn(r))return[new Ce(i.key,i.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function eo(i){const e=i.key,r=i.value,o=i.valueSpec,c=[];return Array.isArray(o.values)?o.values.indexOf(dt(r))===-1&&c.push(new Ce(e,r,`expected one of [${o.values.join(", ")}], ${JSON.stringify(r)} found`)):Object.keys(o.values).indexOf(dt(r))===-1&&c.push(new Ce(e,r,`expected one of [${Object.keys(o.values).join(", ")}], ${JSON.stringify(r)} found`)),c}function Cn(i){if(i===!0||i===!1)return!0;if(!Array.isArray(i)||i.length===0)return!1;switch(i[0]){case"has":return i.length>=2&&i[1]!=="$id"&&i[1]!=="$type";case"in":return i.length>=3&&(typeof i[1]!="string"||Array.isArray(i[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return i.length!==3||Array.isArray(i[1])||Array.isArray(i[2]);case"any":case"all":for(const e of i.slice(1))if(!Cn(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}const Al={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Fo(i){if(i==null)return{filter:()=>!0,needGeometry:!1};Cn(i)||(i=to(i));const e=Yn(i,Al);if(e.result==="error")throw new Error(e.value.map(r=>`${r.key}: ${r.message}`).join(", "));return{filter:(r,o,c)=>e.value.evaluate(r,o,{},c),needGeometry:Ta(i)}}function wa(i,e){return i<e?-1:i>e?1:0}function Ta(i){if(!Array.isArray(i))return!1;if(i[0]==="within")return!0;for(let e=1;e<i.length;e++)if(Ta(i[e]))return!0;return!1}function to(i){if(!i)return!0;const e=i[0];return i.length<=1?e!=="any":e==="=="?bs(i[1],i[2],"=="):e==="!="?Mn(bs(i[1],i[2],"==")):e==="<"||e===">"||e==="<="||e===">="?bs(i[1],i[2],e):e==="any"?(r=i.slice(1),["any"].concat(r.map(to))):e==="all"?["all"].concat(i.slice(1).map(to)):e==="none"?["all"].concat(i.slice(1).map(to).map(Mn)):e==="in"?Oo(i[1],i.slice(2)):e==="!in"?Mn(Oo(i[1],i.slice(2))):e==="has"?io(i[1]):e==="!has"?Mn(io(i[1])):e!=="within"||i;var r}function bs(i,e,r){switch(i){case"$type":return[`filter-type-${r}`,e];case"$id":return[`filter-id-${r}`,e];default:return[`filter-${r}`,i,e]}}function Oo(i,e){if(e.length===0)return!1;switch(i){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(r=>typeof r!=typeof e[0])?["filter-in-large",i,["literal",e.sort(wa)]]:["filter-in-small",i,["literal",e]]}}function io(i){switch(i){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",i]}}function Mn(i){return["!",i]}function ro(i){return Cn(Oi(i.value))?Jr(ji({},i,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Ea(i)}function Ea(i){const e=i.value,r=i.key;if(yt(e)!=="array")return[new Ce(r,e,`array expected, ${yt(e)} found`)];const o=i.styleSpec;let c,h=[];if(e.length<1)return[new Ce(r,e,"filter array must have at least 1 element")];switch(h=h.concat(eo({key:`${r}[0]`,value:e[0],valueSpec:o.filter_operator,style:i.style,styleSpec:i.styleSpec})),dt(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&dt(e[1])==="$type"&&h.push(new Ce(r,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":e.length!==3&&h.push(new Ce(r,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(c=yt(e[1]),c!=="string"&&h.push(new Ce(`${r}[1]`,e[1],`string expected, ${c} found`)));for(let p=2;p<e.length;p++)c=yt(e[p]),dt(e[1])==="$type"?h=h.concat(eo({key:`${r}[${p}]`,value:e[p],valueSpec:o.geometry_type,style:i.style,styleSpec:i.styleSpec})):c!=="string"&&c!=="number"&&c!=="boolean"&&h.push(new Ce(`${r}[${p}]`,e[p],`string, number, or boolean expected, ${c} found`));break;case"any":case"all":case"none":for(let p=1;p<e.length;p++)h=h.concat(Ea({key:`${r}[${p}]`,value:e[p],style:i.style,styleSpec:i.styleSpec}));break;case"has":case"!has":c=yt(e[1]),e.length!==2?h.push(new Ce(r,e,`filter array for "${e[0]}" operator must have 2 elements`)):c!=="string"&&h.push(new Ce(`${r}[1]`,e[1],`string expected, ${c} found`));break;case"within":c=yt(e[1]),e.length!==2?h.push(new Ce(r,e,`filter array for "${e[0]}" operator must have 2 elements`)):c!=="object"&&h.push(new Ce(`${r}[1]`,e[1],`object expected, ${c} found`))}return h}function no(i,e){const r=i.key,o=i.style,c=i.styleSpec,h=i.value,p=i.objectKey,m=c[`${e}_${i.layerType}`];if(!m)return[];const g=p.match(/^(.*)-transition$/);if(e==="paint"&&g&&m[g[1]]&&m[g[1]].transition)return zi({key:r,value:h,valueSpec:c.transition,style:o,styleSpec:c});const x=i.valueSpec||m[p];if(!x)return[new Ce(r,h,`unknown property "${p}"`)];let w;if(yt(h)==="string"&&zt(x)&&!x.tokens&&(w=/^{([^}]+)}$/.exec(h)))return[new Ce(r,h,`"${p}" does not support interpolation syntax
|
|
2
|
-
Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(w[1])} }\`.`)];const E=[];return i.layerType==="symbol"&&(p==="text-field"&&o&&!o.glyphs&&E.push(new Ce(r,h,'use of "text-field" requires a style "glyphs" property')),p==="text-font"&&Ct(Oi(h))&&dt(h.type)==="identity"&&E.push(new Ce(r,h,'"text-font" does not support identity functions'))),E.concat(zi({key:i.key,value:h,valueSpec:x,style:o,styleSpec:c,expressionContext:"property",propertyType:e,propertyKey:p}))}function Sa(i){return no(i,"paint")}function Ia(i){return no(i,"layout")}function Aa(i){let e=[];const r=i.value,o=i.key,c=i.style,h=i.styleSpec;r.type||r.ref||e.push(new Ce(o,r,'either "type" or "ref" is required'));let p=dt(r.type);const m=dt(r.ref);if(r.id){const g=dt(r.id);for(let x=0;x<i.arrayIndex;x++){const w=c.layers[x];dt(w.id)===g&&e.push(new Ce(o,r.id,`duplicate layer id "${r.id}", previously used at line ${w.id.__line__}`))}}if("ref"in r){let g;["type","source","source-layer","filter","layout"].forEach(x=>{x in r&&e.push(new Ce(o,r[x],`"${x}" is prohibited for ref layers`))}),c.layers.forEach(x=>{dt(x.id)===m&&(g=x)}),g?g.ref?e.push(new Ce(o,r.ref,"ref cannot reference another ref layer")):p=dt(g.type):e.push(new Ce(o,r.ref,`ref layer "${m}" not found`))}else if(p!=="background")if(r.source){const g=c.sources&&c.sources[r.source],x=g&&dt(g.type);g?x==="vector"&&p==="raster"?e.push(new Ce(o,r.source,`layer "${r.id}" requires a raster source`)):x==="raster"&&p!=="raster"?e.push(new Ce(o,r.source,`layer "${r.id}" requires a vector source`)):x!=="vector"||r["source-layer"]?x==="raster-dem"&&p!=="hillshade"?e.push(new Ce(o,r.source,"raster-dem source can only be used with layer type 'hillshade'.")):p!=="line"||!r.paint||!r.paint["line-gradient"]||x==="geojson"&&g.lineMetrics||e.push(new Ce(o,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):e.push(new Ce(o,r,`layer "${r.id}" must specify a "source-layer"`)):e.push(new Ce(o,r.source,`source "${r.source}" not found`))}else e.push(new Ce(o,r,'missing required property "source"'));return e=e.concat(Xi({key:o,value:r,valueSpec:h.layer,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{"*":()=>[],type:()=>zi({key:`${o}.type`,value:r.type,valueSpec:h.layer.type,style:i.style,styleSpec:i.styleSpec,object:r,objectKey:"type"}),filter:ro,layout:g=>Xi({layer:r,key:g.key,value:g.value,style:g.style,styleSpec:g.styleSpec,objectElementValidators:{"*":x=>Ia(ji({layerType:p},x))}}),paint:g=>Xi({layer:r,key:g.key,value:g.value,style:g.style,styleSpec:g.styleSpec,objectElementValidators:{"*":x=>Sa(ji({layerType:p},x))}})}})),e}function zn(i){const e=i.value,r=i.key,o=yt(e);return o!=="string"?[new Ce(r,e,`string expected, ${o} found`)]:[]}const Ca={promoteId:function({key:i,value:e}){if(yt(e)==="string")return zn({key:i,value:e});{const r=[];for(const o in e)r.push(...zn({key:`${i}.${o}`,value:e[o]}));return r}}};function oo(i){const e=i.value,r=i.key,o=i.styleSpec,c=i.style;if(!e.type)return[new Ce(r,e,'"type" is required')];const h=dt(e.type);let p;switch(h){case"vector":case"raster":case"raster-dem":return p=Xi({key:r,value:e,valueSpec:o[`source_${h.replace("-","_")}`],style:i.style,styleSpec:o,objectElementValidators:Ca}),p;case"geojson":if(p=Xi({key:r,value:e,valueSpec:o.source_geojson,style:c,styleSpec:o,objectElementValidators:Ca}),e.cluster)for(const m in e.clusterProperties){const[g,x]=e.clusterProperties[m],w=typeof g=="string"?[g,["accumulated"],["get",m]]:g;p.push(...Jr({key:`${r}.${m}.map`,value:x,expressionContext:"cluster-map"})),p.push(...Jr({key:`${r}.${m}.reduce`,value:w,expressionContext:"cluster-reduce"}))}return p;case"video":return Xi({key:r,value:e,valueSpec:o.source_video,style:c,styleSpec:o});case"image":return Xi({key:r,value:e,valueSpec:o.source_image,style:c,styleSpec:o});case"canvas":return[new Ce(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return eo({key:`${r}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:c,styleSpec:o})}}function so(i){const e=i.value,r=i.styleSpec,o=r.light,c=i.style;let h=[];const p=yt(e);if(e===void 0)return h;if(p!=="object")return h=h.concat([new Ce("light",e,`object expected, ${p} found`)]),h;for(const m in e){const g=m.match(/^(.*)-transition$/);h=h.concat(g&&o[g[1]]&&o[g[1]].transition?zi({key:m,value:e[m],valueSpec:r.transition,style:c,styleSpec:r}):o[m]?zi({key:m,value:e[m],valueSpec:o[m],style:c,styleSpec:r}):[new Ce(m,e[m],`unknown property "${m}"`)])}return h}function Mi(i){const e=i.value,r=i.styleSpec,o=r.terrain,c=i.style;let h=[];const p=yt(e);if(e===void 0)return h;if(p!=="object")return h=h.concat([new Ce("terrain",e,`object expected, ${p} found`)]),h;for(const m in e)h=h.concat(o[m]?zi({key:m,value:e[m],valueSpec:o[m],style:c,styleSpec:r}):[new Ce(m,e[m],`unknown property "${m}"`)]);return h}const ao={"*":()=>[],array:va,boolean:function(i){const e=i.value,r=i.key,o=yt(e);return o!=="boolean"?[new Ce(r,e,`boolean expected, ${o} found`)]:[]},number:vs,color:function(i){const e=i.key,r=i.value,o=yt(r);return o!=="string"?[new Ce(e,r,`color expected, ${o} found`)]:vn(r)===null?[new Ce(e,r,`color expected, "${r}" found`)]:[]},constants:Zr,enum:eo,filter:ro,function:ba,layer:Aa,object:Xi,source:oo,light:so,terrain:Mi,string:zn,formatted:function(i){return zn(i).length===0?[]:Jr(i)},resolvedImage:function(i){return zn(i).length===0?[]:Jr(i)},padding:function(i){const e=i.key,r=i.value;if(yt(r)==="array"){if(r.length<1||r.length>4)return[new Ce(e,r,`padding requires 1 to 4 values; ${r.length} values found`)];const o={type:"number"};let c=[];for(let h=0;h<r.length;h++)c=c.concat(zi({key:`${e}[${h}]`,value:r[h],valueSpec:o}));return c}return vs({key:e,value:r,valueSpec:{}})}};function zi(i){const e=i.value,r=i.valueSpec,o=i.styleSpec;return r.expression&&Ct(dt(e))?ba(i):r.expression&&Jn(Oi(e))?Jr(i):r.type&&ao[r.type]?ao[r.type](i):Xi(ji({},i,{valueSpec:r.type?o[r.type]:r}))}function Cl(i){const e=i.value,r=i.key,o=zn(i);return o.length||(e.indexOf("{fontstack}")===-1&&o.push(new Ce(r,e,'"glyphs" url must include a "{fontstack}" token')),e.indexOf("{range}")===-1&&o.push(new Ce(r,e,'"glyphs" url must include a "{range}" token'))),o}function Lr(i,e=de){let r=[];return r=r.concat(zi({key:"",value:i,valueSpec:e.$root,styleSpec:e,style:i,objectElementValidators:{glyphs:Cl,"*":()=>[]}})),i.constants&&(r=r.concat(Zr({key:"constants",value:i.constants,style:i,styleSpec:e}))),Ma(r)}function Ma(i){return[].concat(i).sort((e,r)=>e.line-r.line)}function _r(i){return function(...e){return Ma(i.apply(this,e))}}Lr.source=_r(oo),Lr.light=_r(so),Lr.terrain=_r(Mi),Lr.layer=_r(Aa),Lr.filter=_r(ro),Lr.paintProperty=_r(Sa),Lr.layoutProperty=_r(Ia);const lo=Lr,ws=lo.light,Ml=lo.paintProperty,zl=lo.layoutProperty;function Uo(i,e){let r=!1;if(e&&e.length)for(const o of e)i.fire(new _n(new Error(o.message))),r=!0;return r}class co{constructor(e,r,o){const c=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;const p=new Int32Array(this.arrayBuffer);e=p[0],this.d=(r=p[1])+2*(o=p[2]);for(let g=0;g<this.d*this.d;g++){const x=p[3+g],w=p[3+g+1];c.push(x===w?null:p.subarray(x,w))}const m=p[3+c.length+1];this.keys=p.subarray(p[3+c.length],m),this.bboxes=p.subarray(m),this.insert=this._insertReadonly}else{this.d=r+2*o;for(let p=0;p<this.d*this.d;p++)c.push([]);this.keys=[],this.bboxes=[]}this.n=r,this.extent=e,this.padding=o,this.scale=r/e,this.uid=0;const h=o/r*e;this.min=-h,this.max=e+h}insert(e,r,o,c,h){this._forEachCell(r,o,c,h,this._insertCell,this.uid++,void 0,void 0),this.keys.push(e),this.bboxes.push(r),this.bboxes.push(o),this.bboxes.push(c),this.bboxes.push(h)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(e,r,o,c,h,p){this.cells[h].push(p)}query(e,r,o,c,h){const p=this.min,m=this.max;if(e<=p&&r<=p&&m<=o&&m<=c&&!h)return Array.prototype.slice.call(this.keys);{const g=[];return this._forEachCell(e,r,o,c,this._queryCell,g,{},h),g}}_queryCell(e,r,o,c,h,p,m,g){const x=this.cells[h];if(x!==null){const w=this.keys,E=this.bboxes;for(let A=0;A<x.length;A++){const M=x[A];if(m[M]===void 0){const z=4*M;(g?g(E[z+0],E[z+1],E[z+2],E[z+3]):e<=E[z+2]&&r<=E[z+3]&&o>=E[z+0]&&c>=E[z+1])?(m[M]=!0,p.push(w[M])):m[M]=!1}}}}_forEachCell(e,r,o,c,h,p,m,g){const x=this._convertToCellCoord(e),w=this._convertToCellCoord(r),E=this._convertToCellCoord(o),A=this._convertToCellCoord(c);for(let M=x;M<=E;M++)for(let z=w;z<=A;z++){const $=this.d*z+M;if((!g||g(this._convertFromCellCoord(M),this._convertFromCellCoord(z),this._convertFromCellCoord(M+1),this._convertFromCellCoord(z+1)))&&h.call(this,e,r,o,c,$,p,m,g))return}}_convertFromCellCoord(e){return(e-this.padding)/this.scale}_convertToCellCoord(e){return Math.max(0,Math.min(this.d-1,Math.floor(e*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const e=this.cells,r=3+this.cells.length+1+1;let o=0;for(let p=0;p<this.cells.length;p++)o+=this.cells[p].length;const c=new Int32Array(r+o+this.keys.length+this.bboxes.length);c[0]=this.extent,c[1]=this.n,c[2]=this.padding;let h=r;for(let p=0;p<e.length;p++){const m=e[p];c[3+p]=h,c.set(m,h),h+=m.length}return c[3+e.length]=h,c.set(this.keys,h),h+=this.keys.length,c[3+e.length+1]=h,c.set(this.bboxes,h),h+=this.bboxes.length,c.buffer}static serialize(e,r){const o=e.toArrayBuffer();return r&&r.push(o),{buffer:o}}static deserialize(e){return new co(e.buffer)}}const yr={};function Fe(i,e,r={}){if(yr[i])throw new Error(`${i} is already registered.`);Object.defineProperty(e,"_classRegistryKey",{value:i,writeable:!1}),yr[i]={klass:e,omit:r.omit||[],shallow:r.shallow||[]}}Fe("Object",Object),Fe("TransferableGridIndex",co),Fe("Color",D),Fe("Error",Error),Fe("AJAXError",Si),Fe("ResolvedImage",K),Fe("StylePropertyFunction",Ro),Fe("StyleExpression",Lo,{omit:["_evaluator"]}),Fe("ZoomDependentExpression",xs),Fe("ZoomConstantExpression",Qn),Fe("CompoundExpression",St,{omit:["_evaluate"]});for(const i in Sn)Sn[i]._classRegistryKey||Fe(`Expression_${i}`,Sn[i]);function za(i){return i&&typeof ArrayBuffer<"u"&&(i instanceof ArrayBuffer||i.constructor&&i.constructor.name==="ArrayBuffer")}function Yr(i,e){if(i==null||typeof i=="boolean"||typeof i=="number"||typeof i=="string"||i instanceof Boolean||i instanceof Number||i instanceof String||i instanceof Date||i instanceof RegExp||i instanceof Blob)return i;if(za(i)||Er(i))return e&&e.push(i),i;if(ArrayBuffer.isView(i)){const r=i;return e&&e.push(r.buffer),r}if(i instanceof ImageData)return e&&e.push(i.data.buffer),i;if(Array.isArray(i)){const r=[];for(const o of i)r.push(Yr(o,e));return r}if(typeof i=="object"){const r=i.constructor,o=r._classRegistryKey;if(!o)throw new Error("can't serialize object of unregistered class");if(!yr[o])throw new Error(`${o} is not registered.`);const c=r.serialize?r.serialize(i,e):{};if(r.serialize){if(e&&c===e[e.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(const h in i){if(!i.hasOwnProperty(h)||yr[o].omit.indexOf(h)>=0)continue;const p=i[h];c[h]=yr[o].shallow.indexOf(h)>=0?p:Yr(p,e)}i instanceof Error&&(c.message=i.message)}if(c.$name)throw new Error("$name property is reserved for worker serialization logic.");return o!=="Object"&&(c.$name=o),c}throw new Error("can't serialize object of type "+typeof i)}function Rr(i){if(i==null||typeof i=="boolean"||typeof i=="number"||typeof i=="string"||i instanceof Boolean||i instanceof Number||i instanceof String||i instanceof Date||i instanceof RegExp||i instanceof Blob||za(i)||Er(i)||ArrayBuffer.isView(i)||i instanceof ImageData)return i;if(Array.isArray(i))return i.map(Rr);if(typeof i=="object"){const e=i.$name||"Object";if(!yr[e])throw new Error(`can't deserialize unregistered class ${e}`);const{klass:r}=yr[e];if(!r)throw new Error(`can't deserialize unregistered class ${e}`);if(r.deserialize)return r.deserialize(i);const o=Object.create(r.prototype);for(const c of Object.keys(i)){if(c==="$name")continue;const h=i[c];o[c]=yr[e].shallow.indexOf(c)>=0?h:Rr(h)}return o}throw new Error("can't deserialize object of type "+typeof i)}class Ts{constructor(){this.first=!0}update(e,r){const o=Math.floor(e);return this.first?(this.first=!1,this.lastIntegerZoom=o,this.lastIntegerZoomTime=0,this.lastZoom=e,this.lastFloorZoom=o,!0):(this.lastFloorZoom>o?(this.lastIntegerZoom=o+1,this.lastIntegerZoomTime=r):this.lastFloorZoom<o&&(this.lastIntegerZoom=o,this.lastIntegerZoomTime=r),e!==this.lastZoom&&(this.lastZoom=e,this.lastFloorZoom=o,!0))}}const ze={"Latin-1 Supplement":i=>i>=128&&i<=255,Arabic:i=>i>=1536&&i<=1791,"Arabic Supplement":i=>i>=1872&&i<=1919,"Arabic Extended-A":i=>i>=2208&&i<=2303,"Hangul Jamo":i=>i>=4352&&i<=4607,"Unified Canadian Aboriginal Syllabics":i=>i>=5120&&i<=5759,Khmer:i=>i>=6016&&i<=6143,"Unified Canadian Aboriginal Syllabics Extended":i=>i>=6320&&i<=6399,"General Punctuation":i=>i>=8192&&i<=8303,"Letterlike Symbols":i=>i>=8448&&i<=8527,"Number Forms":i=>i>=8528&&i<=8591,"Miscellaneous Technical":i=>i>=8960&&i<=9215,"Control Pictures":i=>i>=9216&&i<=9279,"Optical Character Recognition":i=>i>=9280&&i<=9311,"Enclosed Alphanumerics":i=>i>=9312&&i<=9471,"Geometric Shapes":i=>i>=9632&&i<=9727,"Miscellaneous Symbols":i=>i>=9728&&i<=9983,"Miscellaneous Symbols and Arrows":i=>i>=11008&&i<=11263,"CJK Radicals Supplement":i=>i>=11904&&i<=12031,"Kangxi Radicals":i=>i>=12032&&i<=12255,"Ideographic Description Characters":i=>i>=12272&&i<=12287,"CJK Symbols and Punctuation":i=>i>=12288&&i<=12351,Hiragana:i=>i>=12352&&i<=12447,Katakana:i=>i>=12448&&i<=12543,Bopomofo:i=>i>=12544&&i<=12591,"Hangul Compatibility Jamo":i=>i>=12592&&i<=12687,Kanbun:i=>i>=12688&&i<=12703,"Bopomofo Extended":i=>i>=12704&&i<=12735,"CJK Strokes":i=>i>=12736&&i<=12783,"Katakana Phonetic Extensions":i=>i>=12784&&i<=12799,"Enclosed CJK Letters and Months":i=>i>=12800&&i<=13055,"CJK Compatibility":i=>i>=13056&&i<=13311,"CJK Unified Ideographs Extension A":i=>i>=13312&&i<=19903,"Yijing Hexagram Symbols":i=>i>=19904&&i<=19967,"CJK Unified Ideographs":i=>i>=19968&&i<=40959,"Yi Syllables":i=>i>=40960&&i<=42127,"Yi Radicals":i=>i>=42128&&i<=42191,"Hangul Jamo Extended-A":i=>i>=43360&&i<=43391,"Hangul Syllables":i=>i>=44032&&i<=55215,"Hangul Jamo Extended-B":i=>i>=55216&&i<=55295,"Private Use Area":i=>i>=57344&&i<=63743,"CJK Compatibility Ideographs":i=>i>=63744&&i<=64255,"Arabic Presentation Forms-A":i=>i>=64336&&i<=65023,"Vertical Forms":i=>i>=65040&&i<=65055,"CJK Compatibility Forms":i=>i>=65072&&i<=65103,"Small Form Variants":i=>i>=65104&&i<=65135,"Arabic Presentation Forms-B":i=>i>=65136&&i<=65279,"Halfwidth and Fullwidth Forms":i=>i>=65280&&i<=65519};function $o(i){for(const e of i)if(Ss(e.charCodeAt(0)))return!0;return!1}function Pl(i){for(const e of i)if(!Es(e.charCodeAt(0)))return!1;return!0}function Es(i){return!(ze.Arabic(i)||ze["Arabic Supplement"](i)||ze["Arabic Extended-A"](i)||ze["Arabic Presentation Forms-A"](i)||ze["Arabic Presentation Forms-B"](i))}function Ss(i){return!(i!==746&&i!==747&&(i<4352||!(ze["Bopomofo Extended"](i)||ze.Bopomofo(i)||ze["CJK Compatibility Forms"](i)&&!(i>=65097&&i<=65103)||ze["CJK Compatibility Ideographs"](i)||ze["CJK Compatibility"](i)||ze["CJK Radicals Supplement"](i)||ze["CJK Strokes"](i)||!(!ze["CJK Symbols and Punctuation"](i)||i>=12296&&i<=12305||i>=12308&&i<=12319||i===12336)||ze["CJK Unified Ideographs Extension A"](i)||ze["CJK Unified Ideographs"](i)||ze["Enclosed CJK Letters and Months"](i)||ze["Hangul Compatibility Jamo"](i)||ze["Hangul Jamo Extended-A"](i)||ze["Hangul Jamo Extended-B"](i)||ze["Hangul Jamo"](i)||ze["Hangul Syllables"](i)||ze.Hiragana(i)||ze["Ideographic Description Characters"](i)||ze.Kanbun(i)||ze["Kangxi Radicals"](i)||ze["Katakana Phonetic Extensions"](i)||ze.Katakana(i)&&i!==12540||!(!ze["Halfwidth and Fullwidth Forms"](i)||i===65288||i===65289||i===65293||i>=65306&&i<=65310||i===65339||i===65341||i===65343||i>=65371&&i<=65503||i===65507||i>=65512&&i<=65519)||!(!ze["Small Form Variants"](i)||i>=65112&&i<=65118||i>=65123&&i<=65126)||ze["Unified Canadian Aboriginal Syllabics"](i)||ze["Unified Canadian Aboriginal Syllabics Extended"](i)||ze["Vertical Forms"](i)||ze["Yijing Hexagram Symbols"](i)||ze["Yi Syllables"](i)||ze["Yi Radicals"](i))))}function Pa(i){return!(Ss(i)||function(e){return!!(ze["Latin-1 Supplement"](e)&&(e===167||e===169||e===174||e===177||e===188||e===189||e===190||e===215||e===247)||ze["General Punctuation"](e)&&(e===8214||e===8224||e===8225||e===8240||e===8241||e===8251||e===8252||e===8258||e===8263||e===8264||e===8265||e===8273)||ze["Letterlike Symbols"](e)||ze["Number Forms"](e)||ze["Miscellaneous Technical"](e)&&(e>=8960&&e<=8967||e>=8972&&e<=8991||e>=8996&&e<=9e3||e===9003||e>=9085&&e<=9114||e>=9150&&e<=9165||e===9167||e>=9169&&e<=9179||e>=9186&&e<=9215)||ze["Control Pictures"](e)&&e!==9251||ze["Optical Character Recognition"](e)||ze["Enclosed Alphanumerics"](e)||ze["Geometric Shapes"](e)||ze["Miscellaneous Symbols"](e)&&!(e>=9754&&e<=9759)||ze["Miscellaneous Symbols and Arrows"](e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||ze["CJK Symbols and Punctuation"](e)||ze.Katakana(e)||ze["Private Use Area"](e)||ze["CJK Compatibility Forms"](e)||ze["Small Form Variants"](e)||ze["Halfwidth and Fullwidth Forms"](e)||e===8734||e===8756||e===8757||e>=9984&&e<=10087||e>=10102&&e<=10131||e===65532||e===65533)}(i))}function ka(i){return i>=1424&&i<=2303||ze["Arabic Presentation Forms-A"](i)||ze["Arabic Presentation Forms-B"](i)}function kl(i,e){return!(!e&&ka(i)||i>=2304&&i<=3583||i>=3840&&i<=4255||ze.Khmer(i))}function Da(i){for(const e of i)if(ka(e.charCodeAt(0)))return!0;return!1}const Is="deferred",As="loading",Cs="loaded";let Ms=null,xi="unavailable",Br=null;const La=function(i){i&&typeof i=="string"&&i.indexOf("NetworkError")>-1&&(xi="error"),Ms&&Ms(i)};function Pn(){zs.fire(new fr("pluginStateChange",{pluginStatus:xi,pluginURL:Br}))}const zs=new mr,uo=function(){return xi},Ra=function(){if(xi!==Is||!Br)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");xi=As,Pn(),Br&&gn({url:Br},i=>{i?La(i):(xi=Cs,Pn())})},Ui={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>xi===Cs||Ui.applyArabicShaping!=null,isLoading:()=>xi===As,setState(i){if(!pi())throw new Error("Cannot set the state of the rtl-text-plugin when not in the web-worker context");xi=i.pluginStatus,Br=i.pluginURL},isParsed(){if(!pi())throw new Error("rtl-text-plugin is only parsed on the worker-threads");return Ui.applyArabicShaping!=null&&Ui.processBidirectionalText!=null&&Ui.processStyledBidirectionalText!=null},getPluginURL(){if(!pi())throw new Error("rtl-text-plugin url can only be queried from the worker threads");return Br}};class Rt{constructor(e,r){this.zoom=e,r?(this.now=r.now,this.fadeDuration=r.fadeDuration,this.zoomHistory=r.zoomHistory,this.transition=r.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Ts,this.transition={})}isSupportedScript(e){return function(r,o){for(const c of r)if(!kl(c.charCodeAt(0),o))return!1;return!0}(e,Ui.isLoaded())}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const e=this.zoom,r=e-Math.floor(e),o=this.crossFadingFactor();return e>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:r+(1-r)*o}:{fromScale:.5,toScale:1,t:1-(1-o)*r}}}class ho{constructor(e,r){this.property=e,this.value=r,this.expression=function(o,c){if(Ct(o))return new Ro(o,c);if(Jn(o)){const h=xa(o,c);if(h.result==="error")throw new Error(h.value.map(p=>`${p.key}: ${p.message}`).join(", "));return h.value}{let h=o;return c.type==="color"&&typeof o=="string"?h=D.parse(o):c.type!=="padding"||typeof o!="number"&&!Array.isArray(o)||(h=G.parse(o)),{kind:"constant",evaluate:()=>h}}}(r===void 0?e.specification.default:r,e.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(e,r,o){return this.property.possiblyEvaluate(this,e,r,o)}}class Vo{constructor(e){this.property=e,this.value=new ho(e,void 0)}transitioned(e,r){return new Fa(this.property,this.value,r,nt({},e.transition,this.transition),e.now)}untransitioned(){return new Fa(this.property,this.value,null,{},0)}}class Ba{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues)}getValue(e){return vt(this._values[e].value.value)}setValue(e,r){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Vo(this._values[e].property)),this._values[e].value=new ho(this._values[e].property,r===null?void 0:vt(r))}getTransition(e){return vt(this._values[e].transition)}setTransition(e,r){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Vo(this._values[e].property)),this._values[e].transition=vt(r)||void 0}serialize(){const e={};for(const r of Object.keys(this._values)){const o=this.getValue(r);o!==void 0&&(e[r]=o);const c=this.getTransition(r);c!==void 0&&(e[`${r}-transition`]=c)}return e}transitioned(e,r){const o=new Oa(this._properties);for(const c of Object.keys(this._values))o._values[c]=this._values[c].transitioned(e,r._values[c]);return o}untransitioned(){const e=new Oa(this._properties);for(const r of Object.keys(this._values))e._values[r]=this._values[r].untransitioned();return e}}class Fa{constructor(e,r,o,c,h){this.property=e,this.value=r,this.begin=h+c.delay||0,this.end=this.begin+c.duration||0,e.specification.transition&&(c.delay||c.duration)&&(this.prior=o)}possiblyEvaluate(e,r,o){const c=e.now||0,h=this.value.possiblyEvaluate(e,r,o),p=this.prior;if(p){if(c>this.end)return this.prior=null,h;if(this.value.isDataDriven())return this.prior=null,h;if(c<this.begin)return p.possiblyEvaluate(e,r,o);{const m=(c-this.begin)/(this.end-this.begin);return this.property.interpolate(p.possiblyEvaluate(e,r,o),h,function(g){if(g<=0)return 0;if(g>=1)return 1;const x=g*g,w=x*g;return 4*(g<.5?w:3*(g-x)+w-.75)}(m))}}return h}}class Oa{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,r,o){const c=new po(this._properties);for(const h of Object.keys(this._values))c._values[h]=this._values[h].possiblyEvaluate(e,r,o);return c}hasTransition(){for(const e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class Dl{constructor(e){this._properties=e,this._values=Object.create(e.defaultPropertyValues)}getValue(e){return vt(this._values[e].value)}setValue(e,r){this._values[e]=new ho(this._values[e].property,r===null?void 0:vt(r))}serialize(){const e={};for(const r of Object.keys(this._values)){const o=this.getValue(r);o!==void 0&&(e[r]=o)}return e}possiblyEvaluate(e,r,o){const c=new po(this._properties);for(const h of Object.keys(this._values))c._values[h]=this._values[h].possiblyEvaluate(e,r,o);return c}}class ir{constructor(e,r,o){this.property=e,this.value=r,this.parameters=o}isConstant(){return this.value.kind==="constant"}constantOr(e){return this.value.kind==="constant"?this.value.value:e}evaluate(e,r,o,c){return this.property.evaluate(this.value,this.parameters,e,r,o,c)}}class po{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class Ve{constructor(e){this.specification=e}possiblyEvaluate(e,r){if(e.isDataDriven())throw new Error("Value should not be data driven");return e.expression.evaluate(r)}interpolate(e,r,o){const c=Xn[this.specification.type];return c?c(e,r,o):e}}class je{constructor(e,r){this.specification=e,this.overrides=r}possiblyEvaluate(e,r,o,c){return new ir(this,e.expression.kind==="constant"||e.expression.kind==="camera"?{kind:"constant",value:e.expression.evaluate(r,null,{},o,c)}:e.expression,r)}interpolate(e,r,o){if(e.value.kind!=="constant"||r.value.kind!=="constant")return e;if(e.value.value===void 0||r.value.value===void 0)return new ir(this,{kind:"constant",value:void 0},e.parameters);const c=Xn[this.specification.type];return c?new ir(this,{kind:"constant",value:c(e.value.value,r.value.value,o)},e.parameters):e}evaluate(e,r,o,c,h,p){return e.kind==="constant"?e.value:e.evaluate(r,o,c,h,p)}}class kn extends je{possiblyEvaluate(e,r,o,c){if(e.value===void 0)return new ir(this,{kind:"constant",value:void 0},r);if(e.expression.kind==="constant"){const h=e.expression.evaluate(r,null,{},o,c),p=e.property.specification.type==="resolvedImage"&&typeof h!="string"?h.name:h,m=this._calculate(p,p,p,r);return new ir(this,{kind:"constant",value:m},r)}if(e.expression.kind==="camera"){const h=this._calculate(e.expression.evaluate({zoom:r.zoom-1}),e.expression.evaluate({zoom:r.zoom}),e.expression.evaluate({zoom:r.zoom+1}),r);return new ir(this,{kind:"constant",value:h},r)}return new ir(this,e.expression,r)}evaluate(e,r,o,c,h,p){if(e.kind==="source"){const m=e.evaluate(r,o,c,h,p);return this._calculate(m,m,m,r)}return e.kind==="composite"?this._calculate(e.evaluate({zoom:Math.floor(r.zoom)-1},o,c),e.evaluate({zoom:Math.floor(r.zoom)},o,c),e.evaluate({zoom:Math.floor(r.zoom)+1},o,c),r):e.value}_calculate(e,r,o,c){return c.zoom>c.zoomHistory.lastIntegerZoom?{from:e,to:r}:{from:o,to:r}}interpolate(e){return e}}class Ps{constructor(e){this.specification=e}possiblyEvaluate(e,r,o,c){if(e.value!==void 0){if(e.expression.kind==="constant"){const h=e.expression.evaluate(r,null,{},o,c);return this._calculate(h,h,h,r)}return this._calculate(e.expression.evaluate(new Rt(Math.floor(r.zoom-1),r)),e.expression.evaluate(new Rt(Math.floor(r.zoom),r)),e.expression.evaluate(new Rt(Math.floor(r.zoom+1),r)),r)}}_calculate(e,r,o,c){return c.zoom>c.zoomHistory.lastIntegerZoom?{from:e,to:r}:{from:o,to:r}}interpolate(e){return e}}class Fr{constructor(e){this.specification=e}possiblyEvaluate(e,r,o,c){return!!e.expression.evaluate(r,null,{},o,c)}interpolate(){return!1}}class si{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const r in e){const o=e[r];o.specification.overridable&&this.overridableProperties.push(r);const c=this.defaultPropertyValues[r]=new ho(o,void 0),h=this.defaultTransitionablePropertyValues[r]=new Vo(o);this.defaultTransitioningPropertyValues[r]=h.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=c.possiblyEvaluate({})}}}Fe("DataDrivenProperty",je),Fe("DataConstantProperty",Ve),Fe("CrossFadedDataDrivenProperty",kn),Fe("CrossFadedProperty",Ps),Fe("ColorRampProperty",Fr);const Or="-transition";class rr extends mr{constructor(e,r){if(super(),this.id=e.id,this.type=e.type,this._featureFilter={filter:()=>!0,needGeometry:!1},e.type!=="custom"&&(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,e.type!=="background"&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter),r.layout&&(this._unevaluatedLayout=new Dl(r.layout)),r.paint)){this._transitionablePaint=new Ba(r.paint);for(const o in e.paint)this.setPaintProperty(o,e.paint[o],{validate:!1});for(const o in e.layout)this.setLayoutProperty(o,e.layout[o],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new po(r.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){return e==="visibility"?this.visibility:this._unevaluatedLayout.getValue(e)}setLayoutProperty(e,r,o={}){r!=null&&this._validate(zl,`layers.${this.id}.layout.${e}`,e,r,o)||(e!=="visibility"?this._unevaluatedLayout.setValue(e,r):this.visibility=r)}getPaintProperty(e){return e.endsWith(Or)?this._transitionablePaint.getTransition(e.slice(0,-Or.length)):this._transitionablePaint.getValue(e)}setPaintProperty(e,r,o={}){if(r!=null&&this._validate(Ml,`layers.${this.id}.paint.${e}`,e,r,o))return!1;if(e.endsWith(Or))return this._transitionablePaint.setTransition(e.slice(0,-Or.length),r||void 0),!1;{const c=this._transitionablePaint._values[e],h=c.property.specification["property-type"]==="cross-faded-data-driven",p=c.value.isDataDriven(),m=c.value;this._transitionablePaint.setValue(e,r),this._handleSpecialPaintPropertyUpdate(e);const g=this._transitionablePaint._values[e].value;return g.isDataDriven()||p||h||this._handleOverridablePaintPropertyUpdate(e,m,g)}}_handleSpecialPaintPropertyUpdate(e){}_handleOverridablePaintPropertyUpdate(e,r,o){return!1}isHidden(e){return!!(this.minzoom&&e<this.minzoom)||!!(this.maxzoom&&e>=this.maxzoom)||this.visibility==="none"}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(e,r){e.getCrossfadeParameters&&(this._crossfadeParameters=e.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,r)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,r)}serialize(){const e={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(e.layout=e.layout||{},e.layout.visibility=this.visibility),ct(e,(r,o)=>!(r===void 0||o==="layout"&&!Object.keys(r).length||o==="paint"&&!Object.keys(r).length))}_validate(e,r,o,c,h={}){return(!h||h.validate!==!1)&&Uo(this,e.call(lo,{key:r,layerType:this.type,objectKey:o,value:c,styleSpec:de,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const e in this.paint._values){const r=this.paint.get(e);if(r instanceof ir&&zt(r.property.specification)&&(r.value.kind==="source"||r.value.kind==="composite")&&r.value.isStateDependent)return!0}return!1}}const Ua={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Ur{constructor(e,r){this._structArray=e,this._pos1=r*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class Vt{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(e,r){return e._trim(),r&&(e.isTransferred=!0,r.push(e.arrayBuffer)),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){const r=Object.create(this.prototype);return r.arrayBuffer=e.arrayBuffer,r.length=e.length,r.capacity=e.arrayBuffer.byteLength/r.bytesPerElement,r._refreshViews(),r}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(e){this.reserve(e),this.length=e}reserve(e){if(e>this.capacity){this.capacity=Math.max(e,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const r=this.uint8;this._refreshViews(),r&&this.uint8.set(r)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function Zt(i,e=1){let r=0,o=0;return{members:i.map(c=>{const h=Ua[c.type].BYTES_PER_ELEMENT,p=r=ks(r,Math.max(e,h)),m=c.components||1;return o=Math.max(o,h),r+=h*m,{name:c.name,type:c.type,components:m,offset:p}}),size:ks(r,Math.max(o,e)),alignment:e}}function ks(i,e){return Math.ceil(i/e)*e}class Qr extends Vt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r){const o=this.length;return this.resize(o+1),this.emplace(o,e,r)}emplace(e,r,o){const c=2*e;return this.int16[c+0]=r,this.int16[c+1]=o,e}}Qr.prototype.bytesPerElement=4,Fe("StructArrayLayout2i4",Qr);class a extends Vt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,o,c){const h=this.length;return this.resize(h+1),this.emplace(h,e,r,o,c)}emplace(e,r,o,c,h){const p=4*e;return this.int16[p+0]=r,this.int16[p+1]=o,this.int16[p+2]=c,this.int16[p+3]=h,e}}a.prototype.bytesPerElement=8,Fe("StructArrayLayout4i8",a);class t extends Vt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,o,c,h,p){const m=this.length;return this.resize(m+1),this.emplace(m,e,r,o,c,h,p)}emplace(e,r,o,c,h,p,m){const g=6*e;return this.int16[g+0]=r,this.int16[g+1]=o,this.int16[g+2]=c,this.int16[g+3]=h,this.int16[g+4]=p,this.int16[g+5]=m,e}}t.prototype.bytesPerElement=12,Fe("StructArrayLayout2i4i12",t);class n extends Vt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,o,c,h,p){const m=this.length;return this.resize(m+1),this.emplace(m,e,r,o,c,h,p)}emplace(e,r,o,c,h,p,m){const g=4*e,x=8*e;return this.int16[g+0]=r,this.int16[g+1]=o,this.uint8[x+4]=c,this.uint8[x+5]=h,this.uint8[x+6]=p,this.uint8[x+7]=m,e}}n.prototype.bytesPerElement=8,Fe("StructArrayLayout2i4ub8",n);class s extends Vt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r){const o=this.length;return this.resize(o+1),this.emplace(o,e,r)}emplace(e,r,o){const c=2*e;return this.float32[c+0]=r,this.float32[c+1]=o,e}}s.prototype.bytesPerElement=8,Fe("StructArrayLayout2f8",s);class u extends Vt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,o,c,h,p,m,g,x,w){const E=this.length;return this.resize(E+1),this.emplace(E,e,r,o,c,h,p,m,g,x,w)}emplace(e,r,o,c,h,p,m,g,x,w,E){const A=10*e;return this.uint16[A+0]=r,this.uint16[A+1]=o,this.uint16[A+2]=c,this.uint16[A+3]=h,this.uint16[A+4]=p,this.uint16[A+5]=m,this.uint16[A+6]=g,this.uint16[A+7]=x,this.uint16[A+8]=w,this.uint16[A+9]=E,e}}u.prototype.bytesPerElement=20,Fe("StructArrayLayout10ui20",u);class d extends Vt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,o,c,h,p,m,g,x,w,E,A){const M=this.length;return this.resize(M+1),this.emplace(M,e,r,o,c,h,p,m,g,x,w,E,A)}emplace(e,r,o,c,h,p,m,g,x,w,E,A,M){const z=12*e;return this.int16[z+0]=r,this.int16[z+1]=o,this.int16[z+2]=c,this.int16[z+3]=h,this.uint16[z+4]=p,this.uint16[z+5]=m,this.uint16[z+6]=g,this.uint16[z+7]=x,this.int16[z+8]=w,this.int16[z+9]=E,this.int16[z+10]=A,this.int16[z+11]=M,e}}d.prototype.bytesPerElement=24,Fe("StructArrayLayout4i4ui4i24",d);class f extends Vt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,o){const c=this.length;return this.resize(c+1),this.emplace(c,e,r,o)}emplace(e,r,o,c){const h=3*e;return this.float32[h+0]=r,this.float32[h+1]=o,this.float32[h+2]=c,e}}f.prototype.bytesPerElement=12,Fe("StructArrayLayout3f12",f);class _ extends Vt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){const r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){return this.uint32[1*e+0]=r,e}}_.prototype.bytesPerElement=4,Fe("StructArrayLayout1ul4",_);class y extends Vt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,o,c,h,p,m,g,x){const w=this.length;return this.resize(w+1),this.emplace(w,e,r,o,c,h,p,m,g,x)}emplace(e,r,o,c,h,p,m,g,x,w){const E=10*e,A=5*e;return this.int16[E+0]=r,this.int16[E+1]=o,this.int16[E+2]=c,this.int16[E+3]=h,this.int16[E+4]=p,this.int16[E+5]=m,this.uint32[A+3]=g,this.uint16[E+8]=x,this.uint16[E+9]=w,e}}y.prototype.bytesPerElement=20,Fe("StructArrayLayout6i1ul2ui20",y);class v extends Vt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,o,c,h,p){const m=this.length;return this.resize(m+1),this.emplace(m,e,r,o,c,h,p)}emplace(e,r,o,c,h,p,m){const g=6*e;return this.int16[g+0]=r,this.int16[g+1]=o,this.int16[g+2]=c,this.int16[g+3]=h,this.int16[g+4]=p,this.int16[g+5]=m,e}}v.prototype.bytesPerElement=12,Fe("StructArrayLayout2i2i2i12",v);class T extends Vt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,o,c,h){const p=this.length;return this.resize(p+1),this.emplace(p,e,r,o,c,h)}emplace(e,r,o,c,h,p){const m=4*e,g=8*e;return this.float32[m+0]=r,this.float32[m+1]=o,this.float32[m+2]=c,this.int16[g+6]=h,this.int16[g+7]=p,e}}T.prototype.bytesPerElement=16,Fe("StructArrayLayout2f1f2i16",T);class I extends Vt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,o,c){const h=this.length;return this.resize(h+1),this.emplace(h,e,r,o,c)}emplace(e,r,o,c,h){const p=12*e,m=3*e;return this.uint8[p+0]=r,this.uint8[p+1]=o,this.float32[m+1]=c,this.float32[m+2]=h,e}}I.prototype.bytesPerElement=12,Fe("StructArrayLayout2ub2f12",I);class C extends Vt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,o){const c=this.length;return this.resize(c+1),this.emplace(c,e,r,o)}emplace(e,r,o,c){const h=3*e;return this.uint16[h+0]=r,this.uint16[h+1]=o,this.uint16[h+2]=c,e}}C.prototype.bytesPerElement=6,Fe("StructArrayLayout3ui6",C);class F extends Vt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,o,c,h,p,m,g,x,w,E,A,M,z,$,U,ee){const oe=this.length;return this.resize(oe+1),this.emplace(oe,e,r,o,c,h,p,m,g,x,w,E,A,M,z,$,U,ee)}emplace(e,r,o,c,h,p,m,g,x,w,E,A,M,z,$,U,ee,oe){const Y=24*e,re=12*e,fe=48*e;return this.int16[Y+0]=r,this.int16[Y+1]=o,this.uint16[Y+2]=c,this.uint16[Y+3]=h,this.uint32[re+2]=p,this.uint32[re+3]=m,this.uint32[re+4]=g,this.uint16[Y+10]=x,this.uint16[Y+11]=w,this.uint16[Y+12]=E,this.float32[re+7]=A,this.float32[re+8]=M,this.uint8[fe+36]=z,this.uint8[fe+37]=$,this.uint8[fe+38]=U,this.uint32[re+10]=ee,this.int16[Y+22]=oe,e}}F.prototype.bytesPerElement=48,Fe("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",F);class R extends Vt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,o,c,h,p,m,g,x,w,E,A,M,z,$,U,ee,oe,Y,re,fe,pe,Be,Ue,Pe,Ae,we,ke){const Me=this.length;return this.resize(Me+1),this.emplace(Me,e,r,o,c,h,p,m,g,x,w,E,A,M,z,$,U,ee,oe,Y,re,fe,pe,Be,Ue,Pe,Ae,we,ke)}emplace(e,r,o,c,h,p,m,g,x,w,E,A,M,z,$,U,ee,oe,Y,re,fe,pe,Be,Ue,Pe,Ae,we,ke,Me){const be=34*e,qe=17*e;return this.int16[be+0]=r,this.int16[be+1]=o,this.int16[be+2]=c,this.int16[be+3]=h,this.int16[be+4]=p,this.int16[be+5]=m,this.int16[be+6]=g,this.int16[be+7]=x,this.uint16[be+8]=w,this.uint16[be+9]=E,this.uint16[be+10]=A,this.uint16[be+11]=M,this.uint16[be+12]=z,this.uint16[be+13]=$,this.uint16[be+14]=U,this.uint16[be+15]=ee,this.uint16[be+16]=oe,this.uint16[be+17]=Y,this.uint16[be+18]=re,this.uint16[be+19]=fe,this.uint16[be+20]=pe,this.uint16[be+21]=Be,this.uint16[be+22]=Ue,this.uint32[qe+12]=Pe,this.float32[qe+13]=Ae,this.float32[qe+14]=we,this.float32[qe+15]=ke,this.float32[qe+16]=Me,e}}R.prototype.bytesPerElement=68,Fe("StructArrayLayout8i15ui1ul4f68",R);class B extends Vt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){const r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){return this.float32[1*e+0]=r,e}}B.prototype.bytesPerElement=4,Fe("StructArrayLayout1f4",B);class X extends Vt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,o){const c=this.length;return this.resize(c+1),this.emplace(c,e,r,o)}emplace(e,r,o,c){const h=3*e;return this.int16[h+0]=r,this.int16[h+1]=o,this.int16[h+2]=c,e}}X.prototype.bytesPerElement=6,Fe("StructArrayLayout3i6",X);class J extends Vt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,o){const c=this.length;return this.resize(c+1),this.emplace(c,e,r,o)}emplace(e,r,o,c){const h=4*e;return this.uint32[2*e+0]=r,this.uint16[h+2]=o,this.uint16[h+3]=c,e}}J.prototype.bytesPerElement=8,Fe("StructArrayLayout1ul2ui8",J);class te extends Vt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r){const o=this.length;return this.resize(o+1),this.emplace(o,e,r)}emplace(e,r,o){const c=2*e;return this.uint16[c+0]=r,this.uint16[c+1]=o,e}}te.prototype.bytesPerElement=4,Fe("StructArrayLayout2ui4",te);class O extends Vt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){const r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){return this.uint16[1*e+0]=r,e}}O.prototype.bytesPerElement=2,Fe("StructArrayLayout1ui2",O);class ne extends Vt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,o,c){const h=this.length;return this.resize(h+1),this.emplace(h,e,r,o,c)}emplace(e,r,o,c,h){const p=4*e;return this.float32[p+0]=r,this.float32[p+1]=o,this.float32[p+2]=c,this.float32[p+3]=h,e}}ne.prototype.bytesPerElement=16,Fe("StructArrayLayout4f16",ne);class ie extends Ur{get anchorPointX(){return this._structArray.int16[this._pos2+0]}get anchorPointY(){return this._structArray.int16[this._pos2+1]}get x1(){return this._structArray.int16[this._pos2+2]}get y1(){return this._structArray.int16[this._pos2+3]}get x2(){return this._structArray.int16[this._pos2+4]}get y2(){return this._structArray.int16[this._pos2+5]}get featureIndex(){return this._structArray.uint32[this._pos4+3]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+8]}get bucketIndex(){return this._structArray.uint16[this._pos2+9]}get anchorPoint(){return new We(this.anchorPointX,this.anchorPointY)}}ie.prototype.size=20;class ue extends y{get(e){return new ie(this,e)}}Fe("CollisionBoxArray",ue);class he extends Ur{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(e){this._structArray.uint8[this._pos1+37]=e}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(e){this._structArray.uint8[this._pos1+38]=e}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(e){this._structArray.uint32[this._pos4+10]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}he.prototype.size=48;class ye extends F{get(e){return new he(this,e)}}Fe("PlacedSymbolArray",ye);class ce extends Ur{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(e){this._structArray.uint32[this._pos4+12]=e}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get textOffset0(){return this._structArray.float32[this._pos4+14]}get textOffset1(){return this._structArray.float32[this._pos4+15]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+16]}}ce.prototype.size=68;class Le extends R{get(e){return new ce(this,e)}}Fe("SymbolInstanceArray",Le);class Ie extends B{getoffsetX(e){return this.float32[1*e+0]}}Fe("GlyphOffsetArray",Ie);class Re extends X{getx(e){return this.int16[3*e+0]}gety(e){return this.int16[3*e+1]}gettileUnitDistanceFromAnchor(e){return this.int16[3*e+2]}}Fe("SymbolLineVertexArray",Re);class Qe extends Ur{get featureIndex(){return this._structArray.uint32[this._pos4+0]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+2]}get bucketIndex(){return this._structArray.uint16[this._pos2+3]}}Qe.prototype.size=8;class it extends J{get(e){return new Qe(this,e)}}Fe("FeatureIndexArray",it);class Ge extends Qr{}class bt extends Qr{}class wt extends Qr{}class ut extends t{}class mt extends n{}class Et extends s{}class ei extends u{}class nr extends d{}class Wi extends f{}class or extends _{}class $r extends v{}class $i extends I{}class vi extends C{}class xr extends te{}const No=Zt([{name:"a_pos",components:2,type:"Int16"}],4),{members:Ht}=No;class ot{constructor(e=[]){this.segments=e}prepareSegment(e,r,o,c){let h=this.segments[this.segments.length-1];return e>ot.MAX_VERTEX_ARRAY_LENGTH&&$t(`Max vertices per segment is ${ot.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),(!h||h.vertexLength+e>ot.MAX_VERTEX_ARRAY_LENGTH||h.sortKey!==c)&&(h={vertexOffset:r.length,primitiveOffset:o.length,vertexLength:0,primitiveLength:0},c!==void 0&&(h.sortKey=c),this.segments.push(h)),h}get(){return this.segments}destroy(){for(const e of this.segments)for(const r in e.vaos)e.vaos[r].destroy()}static simpleSegment(e,r,o,c){return new ot([{vertexOffset:e,primitiveOffset:r,vertexLength:o,primitiveLength:c,vaos:{},sortKey:0}])}}function xt(i,e){return 256*(i=se(Math.floor(i),0,255))+se(Math.floor(e),0,255)}ot.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Fe("SegmentVector",ot);const ti=Zt([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]);var ii={exports:{}},Bt={exports:{}};Bt.exports=function(i,e){var r,o,c,h,p,m,g,x;for(o=i.length-(r=3&i.length),c=e,p=3432918353,m=461845907,x=0;x<o;)g=255&i.charCodeAt(x)|(255&i.charCodeAt(++x))<<8|(255&i.charCodeAt(++x))<<16|(255&i.charCodeAt(++x))<<24,++x,c=27492+(65535&(h=5*(65535&(c=(c^=g=(65535&(g=(g=(65535&g)*p+(((g>>>16)*p&65535)<<16)&4294967295)<<15|g>>>17))*m+(((g>>>16)*m&65535)<<16)&4294967295)<<13|c>>>19))+((5*(c>>>16)&65535)<<16)&4294967295))+((58964+(h>>>16)&65535)<<16);switch(g=0,r){case 3:g^=(255&i.charCodeAt(x+2))<<16;case 2:g^=(255&i.charCodeAt(x+1))<<8;case 1:c^=g=(65535&(g=(g=(65535&(g^=255&i.charCodeAt(x)))*p+(((g>>>16)*p&65535)<<16)&4294967295)<<15|g>>>17))*m+(((g>>>16)*m&65535)<<16)&4294967295}return c^=i.length,c=2246822507*(65535&(c^=c>>>16))+((2246822507*(c>>>16)&65535)<<16)&4294967295,c=3266489909*(65535&(c^=c>>>13))+((3266489909*(c>>>16)&65535)<<16)&4294967295,(c^=c>>>16)>>>0};var Vi={exports:{}};Vi.exports=function(i,e){for(var r,o=i.length,c=e^o,h=0;o>=4;)r=1540483477*(65535&(r=255&i.charCodeAt(h)|(255&i.charCodeAt(++h))<<8|(255&i.charCodeAt(++h))<<16|(255&i.charCodeAt(++h))<<24))+((1540483477*(r>>>16)&65535)<<16),c=1540483477*(65535&c)+((1540483477*(c>>>16)&65535)<<16)^(r=1540483477*(65535&(r^=r>>>24))+((1540483477*(r>>>16)&65535)<<16)),o-=4,++h;switch(o){case 3:c^=(255&i.charCodeAt(h+2))<<16;case 2:c^=(255&i.charCodeAt(h+1))<<8;case 1:c=1540483477*(65535&(c^=255&i.charCodeAt(h)))+((1540483477*(c>>>16)&65535)<<16)}return c=1540483477*(65535&(c^=c>>>13))+((1540483477*(c>>>16)&65535)<<16),(c^=c>>>15)>>>0};var en=Bt.exports,Ds=Vi.exports;ii.exports=en,ii.exports.murmur3=en,ii.exports.murmur2=Ds;class Dn{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,r,o,c){this.ids.push($a(e)),this.positions.push(r,o,c)}getPositions(e){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const r=$a(e);let o=0,c=this.ids.length-1;for(;o<c;){const p=o+c>>1;this.ids[p]>=r?c=p:o=p+1}const h=[];for(;this.ids[o]===r;)h.push({index:this.positions[3*o],start:this.positions[3*o+1],end:this.positions[3*o+2]}),o++;return h}static serialize(e,r){const o=new Float64Array(e.ids),c=new Uint32Array(e.positions);return Ls(o,c,0,o.length-1),r&&r.push(o.buffer,c.buffer),{ids:o,positions:c}}static deserialize(e){const r=new Dn;return r.ids=e.ids,r.positions=e.positions,r.indexed=!0,r}}function $a(i){const e=+i;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:ii.exports(String(i))}function Ls(i,e,r,o){for(;r<o;){const c=i[r+o>>1];let h=r-1,p=o+1;for(;;){do h++;while(i[h]<c);do p--;while(i[p]>c);if(h>=p)break;Vr(i,h,p),Vr(e,3*h,3*p),Vr(e,3*h+1,3*p+1),Vr(e,3*h+2,3*p+2)}p-r<o-p?(Ls(i,e,r,p),r=p+1):(Ls(i,e,p+1,o),o=p)}}function Vr(i,e,r){const o=i[e];i[e]=i[r],i[r]=o}Fe("FeaturePositionMap",Dn);class tn{constructor(e,r){this.gl=e.gl,this.location=r}}class rn extends tn{constructor(e,r){super(e,r),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1f(this.location,e))}}class Go extends tn{constructor(e,r){super(e,r),this.current=[0,0,0,0]}set(e){e[0]===this.current[0]&&e[1]===this.current[1]&&e[2]===this.current[2]&&e[3]===this.current[3]||(this.current=e,this.gl.uniform4f(this.location,e[0],e[1],e[2],e[3]))}}class Mc extends tn{constructor(e,r){super(e,r),this.current=D.transparent}set(e){e.r===this.current.r&&e.g===this.current.g&&e.b===this.current.b&&e.a===this.current.a||(this.current=e,this.gl.uniform4f(this.location,e.r,e.g,e.b,e.a))}}const Mh=new Float32Array(16);function Ll(i){return[xt(255*i.r,255*i.g),xt(255*i.b,255*i.a)]}class Rs{constructor(e,r,o){this.value=e,this.uniformNames=r.map(c=>`u_${c}`),this.type=o}setUniform(e,r,o){e.set(o.constantOr(this.value))}getBinding(e,r,o){return this.type==="color"?new Mc(e,r):new rn(e,r)}}class qo{constructor(e,r){this.uniformNames=r.map(o=>`u_${o}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(e,r){this.pixelRatioFrom=r.pixelRatio,this.pixelRatioTo=e.pixelRatio,this.patternFrom=r.tlbr,this.patternTo=e.tlbr}setUniform(e,r,o,c){const h=c==="u_pattern_to"?this.patternTo:c==="u_pattern_from"?this.patternFrom:c==="u_pixel_ratio_to"?this.pixelRatioTo:c==="u_pixel_ratio_from"?this.pixelRatioFrom:null;h&&e.set(h)}getBinding(e,r,o){return o.substr(0,9)==="u_pattern"?new Go(e,r):new rn(e,r)}}class nn{constructor(e,r,o,c){this.expression=e,this.type=o,this.maxValue=0,this.paintVertexAttributes=r.map(h=>({name:`a_${h}`,type:"Float32",components:o==="color"?2:1,offset:0})),this.paintVertexArray=new c}populatePaintArray(e,r,o,c,h){const p=this.paintVertexArray.length,m=this.expression.evaluate(new Rt(0),r,{},c,[],h);this.paintVertexArray.resize(e),this._setPaintValue(p,e,m)}updatePaintArray(e,r,o,c){const h=this.expression.evaluate({zoom:0},o,c);this._setPaintValue(e,r,h)}_setPaintValue(e,r,o){if(this.type==="color"){const c=Ll(o);for(let h=e;h<r;h++)this.paintVertexArray.emplace(h,c[0],c[1])}else{for(let c=e;c<r;c++)this.paintVertexArray.emplace(c,o);this.maxValue=Math.max(this.maxValue,Math.abs(o))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class vr{constructor(e,r,o,c,h,p){this.expression=e,this.uniformNames=r.map(m=>`u_${m}_t`),this.type=o,this.useIntegerZoom=c,this.zoom=h,this.maxValue=0,this.paintVertexAttributes=r.map(m=>({name:`a_${m}`,type:"Float32",components:o==="color"?4:2,offset:0})),this.paintVertexArray=new p}populatePaintArray(e,r,o,c,h){const p=this.expression.evaluate(new Rt(this.zoom),r,{},c,[],h),m=this.expression.evaluate(new Rt(this.zoom+1),r,{},c,[],h),g=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(g,e,p,m)}updatePaintArray(e,r,o,c){const h=this.expression.evaluate({zoom:this.zoom},o,c),p=this.expression.evaluate({zoom:this.zoom+1},o,c);this._setPaintValue(e,r,h,p)}_setPaintValue(e,r,o,c){if(this.type==="color"){const h=Ll(o),p=Ll(c);for(let m=e;m<r;m++)this.paintVertexArray.emplace(m,h[0],h[1],p[0],p[1])}else{for(let h=e;h<r;h++)this.paintVertexArray.emplace(h,o,c);this.maxValue=Math.max(this.maxValue,Math.abs(o),Math.abs(c))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(e,r){const o=this.useIntegerZoom?Math.floor(r.zoom):r.zoom,c=se(this.expression.interpolationFactor(o,this.zoom,this.zoom+1),0,1);e.set(c)}getBinding(e,r,o){return new rn(e,r)}}class Ln{constructor(e,r,o,c,h,p){this.expression=e,this.type=r,this.useIntegerZoom=o,this.zoom=c,this.layerId=p,this.zoomInPaintVertexArray=new h,this.zoomOutPaintVertexArray=new h}populatePaintArray(e,r,o){const c=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(e),this.zoomOutPaintVertexArray.resize(e),this._setPaintValues(c,e,r.patterns&&r.patterns[this.layerId],o)}updatePaintArray(e,r,o,c,h){this._setPaintValues(e,r,o.patterns&&o.patterns[this.layerId],h)}_setPaintValues(e,r,o,c){if(!c||!o)return;const{min:h,mid:p,max:m}=o,g=c[h],x=c[p],w=c[m];if(g&&x&&w)for(let E=e;E<r;E++)this.zoomInPaintVertexArray.emplace(E,x.tl[0],x.tl[1],x.br[0],x.br[1],g.tl[0],g.tl[1],g.br[0],g.br[1],x.pixelRatio,g.pixelRatio),this.zoomOutPaintVertexArray.emplace(E,x.tl[0],x.tl[1],x.br[0],x.br[1],w.tl[0],w.tl[1],w.br[0],w.br[1],x.pixelRatio,w.pixelRatio)}upload(e){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=e.createVertexBuffer(this.zoomInPaintVertexArray,ti.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=e.createVertexBuffer(this.zoomOutPaintVertexArray,ti.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class zc{constructor(e,r,o){this.binders={},this._buffers=[];const c=[];for(const h in e.paint._values){if(!o(h))continue;const p=e.paint.get(h);if(!(p instanceof ir&&zt(p.property.specification)))continue;const m=zh(h,e.type),g=p.value,x=p.property.specification.type,w=p.property.useIntegerZoom,E=p.property.specification["property-type"],A=E==="cross-faded"||E==="cross-faded-data-driven";if(g.kind==="constant")this.binders[h]=A?new qo(g.value,m):new Rs(g.value,m,x),c.push(`/u_${h}`);else if(g.kind==="source"||A){const M=Pc(h,x,"source");this.binders[h]=A?new Ln(g,x,w,r,M,e.id):new nn(g,m,x,M),c.push(`/a_${h}`)}else{const M=Pc(h,x,"composite");this.binders[h]=new vr(g,m,x,w,r,M),c.push(`/z_${h}`)}}this.cacheKey=c.sort().join("")}getMaxValue(e){const r=this.binders[e];return r instanceof nn||r instanceof vr?r.maxValue:0}populatePaintArrays(e,r,o,c,h){for(const p in this.binders){const m=this.binders[p];(m instanceof nn||m instanceof vr||m instanceof Ln)&&m.populatePaintArray(e,r,o,c,h)}}setConstantPatternPositions(e,r){for(const o in this.binders){const c=this.binders[o];c instanceof qo&&c.setConstantPatternPositions(e,r)}}updatePaintArrays(e,r,o,c,h){let p=!1;for(const m in e){const g=r.getPositions(m);for(const x of g){const w=o.feature(x.index);for(const E in this.binders){const A=this.binders[E];if((A instanceof nn||A instanceof vr||A instanceof Ln)&&A.expression.isStateDependent===!0){const M=c.paint.get(E);A.expression=M.value,A.updatePaintArray(x.start,x.end,w,e[m],h),p=!0}}}}return p}defines(){const e=[];for(const r in this.binders){const o=this.binders[r];(o instanceof Rs||o instanceof qo)&&e.push(...o.uniformNames.map(c=>`#define HAS_UNIFORM_${c}`))}return e}getBinderAttributes(){const e=[];for(const r in this.binders){const o=this.binders[r];if(o instanceof nn||o instanceof vr)for(let c=0;c<o.paintVertexAttributes.length;c++)e.push(o.paintVertexAttributes[c].name);else if(o instanceof Ln)for(let c=0;c<ti.members.length;c++)e.push(ti.members[c].name)}return e}getBinderUniforms(){const e=[];for(const r in this.binders){const o=this.binders[r];if(o instanceof Rs||o instanceof qo||o instanceof vr)for(const c of o.uniformNames)e.push(c)}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e,r){const o=[];for(const c in this.binders){const h=this.binders[c];if(h instanceof Rs||h instanceof qo||h instanceof vr){for(const p of h.uniformNames)if(r[p]){const m=h.getBinding(e,r[p],p);o.push({name:p,property:c,binding:m})}}}return o}setUniforms(e,r,o,c){for(const{name:h,property:p,binding:m}of r)this.binders[p].setUniform(m,c,o.get(p),h)}updatePaintBuffers(e){this._buffers=[];for(const r in this.binders){const o=this.binders[r];if(e&&o instanceof Ln){const c=e.fromScale===2?o.zoomInPaintVertexBuffer:o.zoomOutPaintVertexBuffer;c&&this._buffers.push(c)}else(o instanceof nn||o instanceof vr)&&o.paintVertexBuffer&&this._buffers.push(o.paintVertexBuffer)}}upload(e){for(const r in this.binders){const o=this.binders[r];(o instanceof nn||o instanceof vr||o instanceof Ln)&&o.upload(e)}this.updatePaintBuffers()}destroy(){for(const e in this.binders){const r=this.binders[e];(r instanceof nn||r instanceof vr||r instanceof Ln)&&r.destroy()}}}class fo{constructor(e,r,o=()=>!0){this.programConfigurations={};for(const c of e)this.programConfigurations[c.id]=new zc(c,r,o);this.needsUpload=!1,this._featureMap=new Dn,this._bufferOffset=0}populatePaintArrays(e,r,o,c,h,p){for(const m in this.programConfigurations)this.programConfigurations[m].populatePaintArrays(e,r,c,h,p);r.id!==void 0&&this._featureMap.add(r.id,o,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,r,o,c){for(const h of o)this.needsUpload=this.programConfigurations[h.id].updatePaintArrays(e,this._featureMap,r,h,c)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(const r in this.programConfigurations)this.programConfigurations[r].upload(e);this.needsUpload=!1}}destroy(){for(const e in this.programConfigurations)this.programConfigurations[e].destroy()}}function zh(i,e){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[i]||[i.replace(`${e}-`,"").replace(/-/g,"_")]}function Pc(i,e,r){const o={color:{source:s,composite:ne},number:{source:B,composite:s}},c=function(h){return{"line-pattern":{source:ei,composite:ei},"fill-pattern":{source:ei,composite:ei},"fill-extrusion-pattern":{source:ei,composite:ei}}[h]}(i);return c&&c[r]||o[e][r]}Fe("ConstantBinder",Rs),Fe("CrossFadedConstantBinder",qo),Fe("SourceExpressionBinder",nn),Fe("CrossFadedCompositeBinder",Ln),Fe("CompositeExpressionBinder",vr),Fe("ProgramConfiguration",zc,{omit:["_buffers"]}),Fe("ProgramConfigurationSet",fo);var Kt=8192;const Rl=Math.pow(2,14)-1,kc=-Rl-1;function mo(i){const e=Kt/i.extent,r=i.loadGeometry();for(let o=0;o<r.length;o++){const c=r[o];for(let h=0;h<c.length;h++){const p=c[h],m=Math.round(p.x*e),g=Math.round(p.y*e);p.x=se(m,kc,Rl),p.y=se(g,kc,Rl),(m<p.x||m>p.x+1||g<p.y||g>p.y+1)&&$t("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return r}function go(i,e){return{type:i.type,id:i.id,properties:i.properties,geometry:e?mo(i):[]}}function Va(i,e,r,o,c){i.emplaceBack(2*e+(o+1)/2,2*r+(c+1)/2)}class Bl{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new bt,this.indexArray=new vi,this.segments=new ot,this.programConfigurations=new fo(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,o){const c=this.layers[0],h=[];let p=null,m=!1;c.type==="circle"&&(p=c.layout.get("circle-sort-key"),m=!p.isConstant());for(const{feature:g,id:x,index:w,sourceLayerIndex:E}of e){const A=this.layers[0]._featureFilter.needGeometry,M=go(g,A);if(!this.layers[0]._featureFilter.filter(new Rt(this.zoom),M,o))continue;const z=m?p.evaluate(M,{},o):void 0,$={id:x,properties:g.properties,type:g.type,sourceLayerIndex:E,index:w,geometry:A?M.geometry:mo(g),patterns:{},sortKey:z};h.push($)}m&&h.sort((g,x)=>g.sortKey-x.sortKey);for(const g of h){const{geometry:x,index:w,sourceLayerIndex:E}=g,A=e[w].feature;this.addFeature(g,x,w,o),r.featureIndex.insert(A,x,w,E,this.index)}}update(e,r,o){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,o)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Ht),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(e,r,o,c){for(const h of r)for(const p of h){const m=p.x,g=p.y;if(m<0||m>=Kt||g<0||g>=Kt)continue;const x=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),w=x.vertexLength;Va(this.layoutVertexArray,m,g,-1,-1),Va(this.layoutVertexArray,m,g,1,-1),Va(this.layoutVertexArray,m,g,1,1),Va(this.layoutVertexArray,m,g,-1,1),this.indexArray.emplaceBack(w,w+1,w+2),this.indexArray.emplaceBack(w,w+3,w+2),x.vertexLength+=4,x.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,o,{},c)}}function Dc(i,e){for(let r=0;r<i.length;r++)if(Zo(e,i[r]))return!0;for(let r=0;r<e.length;r++)if(Zo(i,e[r]))return!0;return!!Fl(i,e)}function Ph(i,e,r){return!!Zo(i,e)||!!Ol(e,i,r)}function Lc(i,e){if(i.length===1)return Bc(e,i[0]);for(let r=0;r<e.length;r++){const o=e[r];for(let c=0;c<o.length;c++)if(Zo(i,o[c]))return!0}for(let r=0;r<i.length;r++)if(Bc(e,i[r]))return!0;for(let r=0;r<e.length;r++)if(Fl(i,e[r]))return!0;return!1}function kh(i,e,r){if(i.length>1){if(Fl(i,e))return!0;for(let o=0;o<e.length;o++)if(Ol(e[o],i,r))return!0}for(let o=0;o<i.length;o++)if(Ol(i[o],e,r))return!0;return!1}function Fl(i,e){if(i.length===0||e.length===0)return!1;for(let r=0;r<i.length-1;r++){const o=i[r],c=i[r+1];for(let h=0;h<e.length-1;h++)if(Dh(o,c,e[h],e[h+1]))return!0}return!1}function Dh(i,e,r,o){return Gi(i,r,o)!==Gi(e,r,o)&&Gi(i,e,r)!==Gi(i,e,o)}function Ol(i,e,r){const o=r*r;if(e.length===1)return i.distSqr(e[0])<o;for(let c=1;c<e.length;c++)if(Rc(i,e[c-1],e[c])<o)return!0;return!1}function Rc(i,e,r){const o=e.distSqr(r);if(o===0)return i.distSqr(e);const c=((i.x-e.x)*(r.x-e.x)+(i.y-e.y)*(r.y-e.y))/o;return i.distSqr(c<0?e:c>1?r:r.sub(e)._mult(c)._add(e))}function Bc(i,e){let r,o,c,h=!1;for(let p=0;p<i.length;p++){r=i[p];for(let m=0,g=r.length-1;m<r.length;g=m++)o=r[m],c=r[g],o.y>e.y!=c.y>e.y&&e.x<(c.x-o.x)*(e.y-o.y)/(c.y-o.y)+o.x&&(h=!h)}return h}function Zo(i,e){let r=!1;for(let o=0,c=i.length-1;o<i.length;c=o++){const h=i[o],p=i[c];h.y>e.y!=p.y>e.y&&e.x<(p.x-h.x)*(e.y-h.y)/(p.y-h.y)+h.x&&(r=!r)}return r}function Lh(i,e,r){const o=r[0],c=r[2];if(i.x<o.x&&e.x<o.x||i.x>c.x&&e.x>c.x||i.y<o.y&&e.y<o.y||i.y>c.y&&e.y>c.y)return!1;const h=Gi(i,e,r[0]);return h!==Gi(i,e,r[1])||h!==Gi(i,e,r[2])||h!==Gi(i,e,r[3])}function Bs(i,e,r){const o=e.paint.get(i).value;return o.kind==="constant"?o.value:r.programConfigurations.get(e.id).getMaxValue(i)}function Na(i){return Math.sqrt(i[0]*i[0]+i[1]*i[1])}function Ga(i,e,r,o,c){if(!e[0]&&!e[1])return i;const h=We.convert(e)._mult(c);r==="viewport"&&h._rotate(-o);const p=[];for(let m=0;m<i.length;m++)p.push(i[m].sub(h));return p}Fe("CircleBucket",Bl,{omit:["layers"]});const Rh=new si({"circle-sort-key":new je(de.layout_circle["circle-sort-key"])});var Bh={paint:new si({"circle-radius":new je(de.paint_circle["circle-radius"]),"circle-color":new je(de.paint_circle["circle-color"]),"circle-blur":new je(de.paint_circle["circle-blur"]),"circle-opacity":new je(de.paint_circle["circle-opacity"]),"circle-translate":new Ve(de.paint_circle["circle-translate"]),"circle-translate-anchor":new Ve(de.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new Ve(de.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new Ve(de.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new je(de.paint_circle["circle-stroke-width"]),"circle-stroke-color":new je(de.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new je(de.paint_circle["circle-stroke-opacity"])}),layout:Rh},bi=1e-6,wi=typeof Float32Array<"u"?Float32Array:Array;function Fc(){var i=new wi(9);return wi!=Float32Array&&(i[1]=0,i[2]=0,i[3]=0,i[5]=0,i[6]=0,i[7]=0),i[0]=1,i[4]=1,i[8]=1,i}function Ul(i){return i[0]=1,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=1,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=1,i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i}function Oc(i,e,r){var o=e[0],c=e[1],h=e[2],p=e[3],m=e[4],g=e[5],x=e[6],w=e[7],E=e[8],A=e[9],M=e[10],z=e[11],$=e[12],U=e[13],ee=e[14],oe=e[15],Y=r[0],re=r[1],fe=r[2],pe=r[3];return i[0]=Y*o+re*m+fe*E+pe*$,i[1]=Y*c+re*g+fe*A+pe*U,i[2]=Y*h+re*x+fe*M+pe*ee,i[3]=Y*p+re*w+fe*z+pe*oe,i[4]=(Y=r[4])*o+(re=r[5])*m+(fe=r[6])*E+(pe=r[7])*$,i[5]=Y*c+re*g+fe*A+pe*U,i[6]=Y*h+re*x+fe*M+pe*ee,i[7]=Y*p+re*w+fe*z+pe*oe,i[8]=(Y=r[8])*o+(re=r[9])*m+(fe=r[10])*E+(pe=r[11])*$,i[9]=Y*c+re*g+fe*A+pe*U,i[10]=Y*h+re*x+fe*M+pe*ee,i[11]=Y*p+re*w+fe*z+pe*oe,i[12]=(Y=r[12])*o+(re=r[13])*m+(fe=r[14])*E+(pe=r[15])*$,i[13]=Y*c+re*g+fe*A+pe*U,i[14]=Y*h+re*x+fe*M+pe*ee,i[15]=Y*p+re*w+fe*z+pe*oe,i}Math.hypot||(Math.hypot=function(){for(var i=0,e=arguments.length;e--;)i+=arguments[e]*arguments[e];return Math.sqrt(i)});var Fs,Fh=Oc;function Uc(){var i=new wi(3);return wi!=Float32Array&&(i[0]=0,i[1]=0,i[2]=0),i}function $c(i,e,r){var o=new wi(3);return o[0]=i,o[1]=e,o[2]=r,o}function qa(i,e,r){var o=e[0],c=e[1],h=e[2],p=e[3];return i[0]=r[0]*o+r[4]*c+r[8]*h+r[12]*p,i[1]=r[1]*o+r[5]*c+r[9]*h+r[13]*p,i[2]=r[2]*o+r[6]*c+r[10]*h+r[14]*p,i[3]=r[3]*o+r[7]*c+r[11]*h+r[15]*p,i}function Vc(){var i=new wi(4);return wi!=Float32Array&&(i[0]=0,i[1]=0,i[2]=0),i[3]=1,i}function Nc(i,e){const r=qa([],[i.x,i.y,0,1],e);return new We(r[0]/r[3],r[1]/r[3])}Uc(),Fs=new wi(4),wi!=Float32Array&&(Fs[0]=0,Fs[1]=0,Fs[2]=0,Fs[3]=0),Uc(),$c(1,0,0),$c(0,1,0),Vc(),Vc(),Fc(),function(){var i;i=new wi(2),wi!=Float32Array&&(i[0]=0,i[1]=0)}();class Gc extends Bl{}Fe("HeatmapBucket",Gc,{omit:["layers"]});var Oh={paint:new si({"heatmap-radius":new je(de.paint_heatmap["heatmap-radius"]),"heatmap-weight":new je(de.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Ve(de.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Fr(de.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Ve(de.paint_heatmap["heatmap-opacity"])})};function $l(i,{width:e,height:r},o,c){if(c){if(c instanceof Uint8ClampedArray)c=new Uint8Array(c.buffer);else if(c.length!==e*r*o)throw new RangeError(`mismatched image size. expected: ${c.length} but got: ${e*r*o}`)}else c=new Uint8Array(e*r*o);return i.width=e,i.height=r,i.data=c,i}function qc(i,{width:e,height:r},o){if(e===i.width&&r===i.height)return;const c=$l({},{width:e,height:r},o);Vl(i,c,{x:0,y:0},{x:0,y:0},{width:Math.min(i.width,e),height:Math.min(i.height,r)},o),i.width=e,i.height=r,i.data=c.data}function Vl(i,e,r,o,c,h){if(c.width===0||c.height===0)return e;if(c.width>i.width||c.height>i.height||r.x>i.width-c.width||r.y>i.height-c.height)throw new RangeError("out of range source coordinates for image copy");if(c.width>e.width||c.height>e.height||o.x>e.width-c.width||o.y>e.height-c.height)throw new RangeError("out of range destination coordinates for image copy");const p=i.data,m=e.data;if(p===m)throw new Error("srcData equals dstData, so image is already copied");for(let g=0;g<c.height;g++){const x=((r.y+g)*i.width+r.x)*h,w=((o.y+g)*e.width+o.x)*h;for(let E=0;E<c.width*h;E++)m[w+E]=p[x+E]}return e}class Os{constructor(e,r){$l(this,e,1,r)}resize(e){qc(this,e,1)}clone(){return new Os({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,r,o,c,h){Vl(e,r,o,c,h,1)}}class Hi{constructor(e,r){$l(this,e,4,r)}resize(e){qc(this,e,4)}replace(e,r){r?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new Hi({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,r,o,c,h){Vl(e,r,o,c,h,4)}}function Zc(i){const e={},r=i.resolution||256,o=i.clips?i.clips.length:1,c=i.image||new Hi({width:r,height:o});if(Math.log(r)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${r}`);const h=(p,m,g)=>{e[i.evaluationKey]=g;const x=i.expression.evaluate(e);c.data[p+m+0]=Math.floor(255*x.r/x.a),c.data[p+m+1]=Math.floor(255*x.g/x.a),c.data[p+m+2]=Math.floor(255*x.b/x.a),c.data[p+m+3]=Math.floor(255*x.a)};if(i.clips)for(let p=0,m=0;p<o;++p,m+=4*r)for(let g=0,x=0;g<r;g++,x+=4){const w=g/(r-1),{start:E,end:A}=i.clips[p];h(m,x,E*(1-w)+A*w)}else for(let p=0,m=0;p<r;p++,m+=4)h(0,m,p/(r-1));return c}Fe("AlphaImage",Os),Fe("RGBAImage",Hi);var Uh={paint:new si({"hillshade-illumination-direction":new Ve(de.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new Ve(de.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new Ve(de.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new Ve(de.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new Ve(de.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new Ve(de.paint_hillshade["hillshade-accent-color"])})};const $h=Zt([{name:"a_pos",components:2,type:"Int16"}],4),{members:Vh}=$h;var Za={exports:{}};function ja(i,e,r){r=r||2;var o,c,h,p,m,g,x,w=e&&e.length,E=w?e[0]*r:i.length,A=jc(i,0,E,r,!0),M=[];if(!A||A.next===A.prev)return M;if(w&&(A=function($,U,ee,oe){var Y,re,fe,pe=[];for(Y=0,re=U.length;Y<re;Y++)(fe=jc($,U[Y]*oe,Y<re-1?U[Y+1]*oe:$.length,oe,!1))===fe.next&&(fe.steiner=!0),pe.push(Hh(fe));for(pe.sort(jh),Y=0;Y<pe.length;Y++)ee=Xh(pe[Y],ee);return ee}(i,e,A,r)),i.length>80*r){o=h=i[0],c=p=i[1];for(var z=r;z<E;z+=r)(m=i[z])<o&&(o=m),(g=i[z+1])<c&&(c=g),m>h&&(h=m),g>p&&(p=g);x=(x=Math.max(h-o,p-c))!==0?32767/x:0}return Us(A,M,r,o,c,x,0),M}function jc(i,e,r,o,c){var h,p;if(c===ql(i,e,r,o)>0)for(h=e;h<r;h+=o)p=Hc(h,i[h],i[h+1],p);else for(h=r-o;h>=e;h-=o)p=Hc(h,i[h],i[h+1],p);return p&&Xa(p,p.next)&&(Vs(p),p=p.next),p}function _o(i,e){if(!i)return i;e||(e=i);var r,o=i;do if(r=!1,o.steiner||!Xa(o,o.next)&&Gt(o.prev,o,o.next)!==0)o=o.next;else{if(Vs(o),(o=e=o.prev)===o.next)break;r=!0}while(r||o!==e);return e}function Us(i,e,r,o,c,h,p){if(i){!p&&h&&function(w,E,A,M){var z=w;do z.z===0&&(z.z=Nl(z.x,z.y,E,A,M)),z.prevZ=z.prev,z.nextZ=z.next,z=z.next;while(z!==w);z.prevZ.nextZ=null,z.prevZ=null,function($){var U,ee,oe,Y,re,fe,pe,Be,Ue=1;do{for(ee=$,$=null,re=null,fe=0;ee;){for(fe++,oe=ee,pe=0,U=0;U<Ue&&(pe++,oe=oe.nextZ);U++);for(Be=Ue;pe>0||Be>0&&oe;)pe!==0&&(Be===0||!oe||ee.z<=oe.z)?(Y=ee,ee=ee.nextZ,pe--):(Y=oe,oe=oe.nextZ,Be--),re?re.nextZ=Y:$=Y,Y.prevZ=re,re=Y;ee=oe}re.nextZ=null,Ue*=2}while(fe>1)}(z)}(i,o,c,h);for(var m,g,x=i;i.prev!==i.next;)if(m=i.prev,g=i.next,h?Gh(i,o,c,h):Nh(i))e.push(m.i/r|0),e.push(i.i/r|0),e.push(g.i/r|0),Vs(i),i=g.next,x=g.next;else if((i=g)===x){p?p===1?Us(i=qh(_o(i),e,r),e,r,o,c,h,2):p===2&&Zh(i,e,r,o,c,h):Us(_o(i),e,r,o,c,h,1);break}}}function Nh(i){var e=i.prev,r=i,o=i.next;if(Gt(e,r,o)>=0)return!1;for(var c=e.x,h=r.x,p=o.x,m=e.y,g=r.y,x=o.y,w=c<h?c<p?c:p:h<p?h:p,E=m<g?m<x?m:x:g<x?g:x,A=c>h?c>p?c:p:h>p?h:p,M=m>g?m>x?m:x:g>x?g:x,z=o.next;z!==e;){if(z.x>=w&&z.x<=A&&z.y>=E&&z.y<=M&&jo(c,m,h,g,p,x,z.x,z.y)&&Gt(z.prev,z,z.next)>=0)return!1;z=z.next}return!0}function Gh(i,e,r,o){var c=i.prev,h=i,p=i.next;if(Gt(c,h,p)>=0)return!1;for(var m=c.x,g=h.x,x=p.x,w=c.y,E=h.y,A=p.y,M=m<g?m<x?m:x:g<x?g:x,z=w<E?w<A?w:A:E<A?E:A,$=m>g?m>x?m:x:g>x?g:x,U=w>E?w>A?w:A:E>A?E:A,ee=Nl(M,z,e,r,o),oe=Nl($,U,e,r,o),Y=i.prevZ,re=i.nextZ;Y&&Y.z>=ee&&re&&re.z<=oe;){if(Y.x>=M&&Y.x<=$&&Y.y>=z&&Y.y<=U&&Y!==c&&Y!==p&&jo(m,w,g,E,x,A,Y.x,Y.y)&&Gt(Y.prev,Y,Y.next)>=0||(Y=Y.prevZ,re.x>=M&&re.x<=$&&re.y>=z&&re.y<=U&&re!==c&&re!==p&&jo(m,w,g,E,x,A,re.x,re.y)&&Gt(re.prev,re,re.next)>=0))return!1;re=re.nextZ}for(;Y&&Y.z>=ee;){if(Y.x>=M&&Y.x<=$&&Y.y>=z&&Y.y<=U&&Y!==c&&Y!==p&&jo(m,w,g,E,x,A,Y.x,Y.y)&&Gt(Y.prev,Y,Y.next)>=0)return!1;Y=Y.prevZ}for(;re&&re.z<=oe;){if(re.x>=M&&re.x<=$&&re.y>=z&&re.y<=U&&re!==c&&re!==p&&jo(m,w,g,E,x,A,re.x,re.y)&&Gt(re.prev,re,re.next)>=0)return!1;re=re.nextZ}return!0}function qh(i,e,r){var o=i;do{var c=o.prev,h=o.next.next;!Xa(c,h)&&Xc(c,o,o.next,h)&&$s(c,h)&&$s(h,c)&&(e.push(c.i/r|0),e.push(o.i/r|0),e.push(h.i/r|0),Vs(o),Vs(o.next),o=i=h),o=o.next}while(o!==i);return _o(o)}function Zh(i,e,r,o,c,h){var p=i;do{for(var m=p.next.next;m!==p.prev;){if(p.i!==m.i&&Kh(p,m)){var g=Wc(p,m);return p=_o(p,p.next),g=_o(g,g.next),Us(p,e,r,o,c,h,0),void Us(g,e,r,o,c,h,0)}m=m.next}p=p.next}while(p!==i)}function jh(i,e){return i.x-e.x}function Xh(i,e){var r=function(c,h){var p,m=h,g=c.x,x=c.y,w=-1/0;do{if(x<=m.y&&x>=m.next.y&&m.next.y!==m.y){var E=m.x+(x-m.y)*(m.next.x-m.x)/(m.next.y-m.y);if(E<=g&&E>w&&(w=E,p=m.x<m.next.x?m:m.next,E===g))return p}m=m.next}while(m!==h);if(!p)return null;var A,M=p,z=p.x,$=p.y,U=1/0;m=p;do g>=m.x&&m.x>=z&&g!==m.x&&jo(x<$?g:w,x,z,$,x<$?w:g,x,m.x,m.y)&&(A=Math.abs(x-m.y)/(g-m.x),$s(m,c)&&(A<U||A===U&&(m.x>p.x||m.x===p.x&&Wh(p,m)))&&(p=m,U=A)),m=m.next;while(m!==M);return p}(i,e);if(!r)return e;var o=Wc(r,i);return _o(o,o.next),_o(r,r.next)}function Wh(i,e){return Gt(i.prev,i,e.prev)<0&&Gt(e.next,i,i.next)<0}function Nl(i,e,r,o,c){return(i=1431655765&((i=858993459&((i=252645135&((i=16711935&((i=(i-r)*c|0)|i<<8))|i<<4))|i<<2))|i<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-o)*c|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Hh(i){var e=i,r=i;do(e.x<r.x||e.x===r.x&&e.y<r.y)&&(r=e),e=e.next;while(e!==i);return r}function jo(i,e,r,o,c,h,p,m){return(c-p)*(e-m)>=(i-p)*(h-m)&&(i-p)*(o-m)>=(r-p)*(e-m)&&(r-p)*(h-m)>=(c-p)*(o-m)}function Kh(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!function(r,o){var c=r;do{if(c.i!==r.i&&c.next.i!==r.i&&c.i!==o.i&&c.next.i!==o.i&&Xc(c,c.next,r,o))return!0;c=c.next}while(c!==r);return!1}(i,e)&&($s(i,e)&&$s(e,i)&&function(r,o){var c=r,h=!1,p=(r.x+o.x)/2,m=(r.y+o.y)/2;do c.y>m!=c.next.y>m&&c.next.y!==c.y&&p<(c.next.x-c.x)*(m-c.y)/(c.next.y-c.y)+c.x&&(h=!h),c=c.next;while(c!==r);return h}(i,e)&&(Gt(i.prev,i,e.prev)||Gt(i,e.prev,e))||Xa(i,e)&&Gt(i.prev,i,i.next)>0&&Gt(e.prev,e,e.next)>0)}function Gt(i,e,r){return(e.y-i.y)*(r.x-e.x)-(e.x-i.x)*(r.y-e.y)}function Xa(i,e){return i.x===e.x&&i.y===e.y}function Xc(i,e,r,o){var c=Ha(Gt(i,e,r)),h=Ha(Gt(i,e,o)),p=Ha(Gt(r,o,i)),m=Ha(Gt(r,o,e));return c!==h&&p!==m||!(c!==0||!Wa(i,r,e))||!(h!==0||!Wa(i,o,e))||!(p!==0||!Wa(r,i,o))||!(m!==0||!Wa(r,e,o))}function Wa(i,e,r){return e.x<=Math.max(i.x,r.x)&&e.x>=Math.min(i.x,r.x)&&e.y<=Math.max(i.y,r.y)&&e.y>=Math.min(i.y,r.y)}function Ha(i){return i>0?1:i<0?-1:0}function $s(i,e){return Gt(i.prev,i,i.next)<0?Gt(i,e,i.next)>=0&&Gt(i,i.prev,e)>=0:Gt(i,e,i.prev)<0||Gt(i,i.next,e)<0}function Wc(i,e){var r=new Gl(i.i,i.x,i.y),o=new Gl(e.i,e.x,e.y),c=i.next,h=e.prev;return i.next=e,e.prev=i,r.next=c,c.prev=r,o.next=r,r.prev=o,h.next=o,o.prev=h,o}function Hc(i,e,r,o){var c=new Gl(i,e,r);return o?(c.next=o.next,c.prev=o,o.next.prev=c,o.next=c):(c.prev=c,c.next=c),c}function Vs(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function Gl(i,e,r){this.i=i,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function ql(i,e,r,o){for(var c=0,h=e,p=r-o;h<r;h+=o)c+=(i[p]-i[h])*(i[h+1]+i[p+1]),p=h;return c}function Jh(i,e,r,o,c){Kc(i,e,r||0,o||i.length-1,c||Yh)}function Kc(i,e,r,o,c){for(;o>r;){if(o-r>600){var h=o-r+1,p=e-r+1,m=Math.log(h),g=.5*Math.exp(2*m/3),x=.5*Math.sqrt(m*g*(h-g)/h)*(p-h/2<0?-1:1);Kc(i,e,Math.max(r,Math.floor(e-p*g/h+x)),Math.min(o,Math.floor(e+(h-p)*g/h+x)),c)}var w=i[e],E=r,A=o;for(Ns(i,r,e),c(i[o],w)>0&&Ns(i,r,o);E<A;){for(Ns(i,E,A),E++,A--;c(i[E],w)<0;)E++;for(;c(i[A],w)>0;)A--}c(i[r],w)===0?Ns(i,r,A):Ns(i,++A,o),A<=e&&(r=A+1),e<=A&&(o=A-1)}}function Ns(i,e,r){var o=i[e];i[e]=i[r],i[r]=o}function Yh(i,e){return i<e?-1:i>e?1:0}function Zl(i,e){const r=i.length;if(r<=1)return[i];const o=[];let c,h;for(let p=0;p<r;p++){const m=Fi(i[p]);m!==0&&(i[p].area=Math.abs(m),h===void 0&&(h=m<0),h===m<0?(c&&o.push(c),c=[i[p]]):c.push(i[p]))}if(c&&o.push(c),e>1)for(let p=0;p<o.length;p++)o[p].length<=e||(Jh(o[p],e,1,o[p].length-1,Qh),o[p]=o[p].slice(0,e));return o}function Qh(i,e){return e.area-i.area}function jl(i,e,r){const o=r.patternDependencies;let c=!1;for(const h of e){const p=h.paint.get(`${i}-pattern`);p.isConstant()||(c=!0);const m=p.constantOr(null);m&&(c=!0,o[m.to]=!0,o[m.from]=!0)}return c}function Xl(i,e,r,o,c){const h=c.patternDependencies;for(const p of e){const m=p.paint.get(`${i}-pattern`).value;if(m.kind!=="constant"){let g=m.evaluate({zoom:o-1},r,{},c.availableImages),x=m.evaluate({zoom:o},r,{},c.availableImages),w=m.evaluate({zoom:o+1},r,{},c.availableImages);g=g&&g.name?g.name:g,x=x&&x.name?x.name:x,w=w&&w.name?w.name:w,h[g]=!0,h[x]=!0,h[w]=!0,r.patterns[p.id]={min:g,mid:x,max:w}}}return r}Za.exports=ja,Za.exports.default=ja,ja.deviation=function(i,e,r,o){var c=e&&e.length,h=Math.abs(ql(i,0,c?e[0]*r:i.length,r));if(c)for(var p=0,m=e.length;p<m;p++)h-=Math.abs(ql(i,e[p]*r,p<m-1?e[p+1]*r:i.length,r));var g=0;for(p=0;p<o.length;p+=3){var x=o[p]*r,w=o[p+1]*r,E=o[p+2]*r;g+=Math.abs((i[x]-i[E])*(i[w+1]-i[x+1])-(i[x]-i[w])*(i[E+1]-i[x+1]))}return h===0&&g===0?0:Math.abs((g-h)/h)},ja.flatten=function(i){for(var e=i[0][0].length,r={vertices:[],holes:[],dimensions:e},o=0,c=0;c<i.length;c++){for(var h=0;h<i[c].length;h++)for(var p=0;p<e;p++)r.vertices.push(i[c][h][p]);c>0&&r.holes.push(o+=i[c-1].length)}return r};class Wl{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new wt,this.indexArray=new vi,this.indexArray2=new xr,this.programConfigurations=new fo(e.layers,e.zoom),this.segments=new ot,this.segments2=new ot,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,o){this.hasPattern=jl("fill",this.layers,r);const c=this.layers[0].layout.get("fill-sort-key"),h=!c.isConstant(),p=[];for(const{feature:m,id:g,index:x,sourceLayerIndex:w}of e){const E=this.layers[0]._featureFilter.needGeometry,A=go(m,E);if(!this.layers[0]._featureFilter.filter(new Rt(this.zoom),A,o))continue;const M=h?c.evaluate(A,{},o,r.availableImages):void 0,z={id:g,properties:m.properties,type:m.type,sourceLayerIndex:w,index:x,geometry:E?A.geometry:mo(m),patterns:{},sortKey:M};p.push(z)}h&&p.sort((m,g)=>m.sortKey-g.sortKey);for(const m of p){const{geometry:g,index:x,sourceLayerIndex:w}=m;if(this.hasPattern){const E=Xl("fill",this.layers,m,this.zoom,r);this.patternFeatures.push(E)}else this.addFeature(m,g,x,o,{});r.featureIndex.insert(e[x].feature,g,x,w,this.index)}}update(e,r,o){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,o)}addFeatures(e,r,o){for(const c of this.patternFeatures)this.addFeature(c,c.geometry,c.index,r,o)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Vh),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.indexBuffer2=e.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(e,r,o,c,h){for(const p of Zl(r,500)){let m=0;for(const M of p)m+=M.length;const g=this.segments.prepareSegment(m,this.layoutVertexArray,this.indexArray),x=g.vertexLength,w=[],E=[];for(const M of p){if(M.length===0)continue;M!==p[0]&&E.push(w.length/2);const z=this.segments2.prepareSegment(M.length,this.layoutVertexArray,this.indexArray2),$=z.vertexLength;this.layoutVertexArray.emplaceBack(M[0].x,M[0].y),this.indexArray2.emplaceBack($+M.length-1,$),w.push(M[0].x),w.push(M[0].y);for(let U=1;U<M.length;U++)this.layoutVertexArray.emplaceBack(M[U].x,M[U].y),this.indexArray2.emplaceBack($+U-1,$+U),w.push(M[U].x),w.push(M[U].y);z.vertexLength+=M.length,z.primitiveLength+=M.length}const A=Za.exports(w,E);for(let M=0;M<A.length;M+=3)this.indexArray.emplaceBack(x+A[M],x+A[M+1],x+A[M+2]);g.vertexLength+=m,g.primitiveLength+=A.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,o,h,c)}}Fe("FillBucket",Wl,{omit:["layers","patternFeatures"]});const ed=new si({"fill-sort-key":new je(de.layout_fill["fill-sort-key"])});var td={paint:new si({"fill-antialias":new Ve(de.paint_fill["fill-antialias"]),"fill-opacity":new je(de.paint_fill["fill-opacity"]),"fill-color":new je(de.paint_fill["fill-color"]),"fill-outline-color":new je(de.paint_fill["fill-outline-color"]),"fill-translate":new Ve(de.paint_fill["fill-translate"]),"fill-translate-anchor":new Ve(de.paint_fill["fill-translate-anchor"]),"fill-pattern":new kn(de.paint_fill["fill-pattern"])}),layout:ed};const id=Zt([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),rd=Zt([{name:"a_centroid",components:2,type:"Int16"}],4),{members:nd}=id;var Rn={},od=We,Jc=Xo;function Xo(i,e,r,o,c){this.properties={},this.extent=r,this.type=0,this._pbf=i,this._geometry=-1,this._keys=o,this._values=c,i.readFields(sd,this,e)}function sd(i,e,r){i==1?e.id=r.readVarint():i==2?function(o,c){for(var h=o.readVarint()+o.pos;o.pos<h;){var p=c._keys[o.readVarint()],m=c._values[o.readVarint()];c.properties[p]=m}}(r,e):i==3?e.type=r.readVarint():i==4&&(e._geometry=r.pos)}function ad(i){for(var e,r,o=0,c=0,h=i.length,p=h-1;c<h;p=c++)o+=((r=i[p]).x-(e=i[c]).x)*(e.y+r.y);return o}Xo.types=["Unknown","Point","LineString","Polygon"],Xo.prototype.loadGeometry=function(){var i=this._pbf;i.pos=this._geometry;for(var e,r=i.readVarint()+i.pos,o=1,c=0,h=0,p=0,m=[];i.pos<r;){if(c<=0){var g=i.readVarint();o=7&g,c=g>>3}if(c--,o===1||o===2)h+=i.readSVarint(),p+=i.readSVarint(),o===1&&(e&&m.push(e),e=[]),e.push(new od(h,p));else{if(o!==7)throw new Error("unknown command "+o);e&&e.push(e[0].clone())}}return e&&m.push(e),m},Xo.prototype.bbox=function(){var i=this._pbf;i.pos=this._geometry;for(var e=i.readVarint()+i.pos,r=1,o=0,c=0,h=0,p=1/0,m=-1/0,g=1/0,x=-1/0;i.pos<e;){if(o<=0){var w=i.readVarint();r=7&w,o=w>>3}if(o--,r===1||r===2)(c+=i.readSVarint())<p&&(p=c),c>m&&(m=c),(h+=i.readSVarint())<g&&(g=h),h>x&&(x=h);else if(r!==7)throw new Error("unknown command "+r)}return[p,g,m,x]},Xo.prototype.toGeoJSON=function(i,e,r){var o,c,h=this.extent*Math.pow(2,r),p=this.extent*i,m=this.extent*e,g=this.loadGeometry(),x=Xo.types[this.type];function w(M){for(var z=0;z<M.length;z++){var $=M[z];M[z]=[360*($.x+p)/h-180,360/Math.PI*Math.atan(Math.exp((180-360*($.y+m)/h)*Math.PI/180))-90]}}switch(this.type){case 1:var E=[];for(o=0;o<g.length;o++)E[o]=g[o][0];w(g=E);break;case 2:for(o=0;o<g.length;o++)w(g[o]);break;case 3:for(g=function(M){var z=M.length;if(z<=1)return[M];for(var $,U,ee=[],oe=0;oe<z;oe++){var Y=ad(M[oe]);Y!==0&&(U===void 0&&(U=Y<0),U===Y<0?($&&ee.push($),$=[M[oe]]):$.push(M[oe]))}return $&&ee.push($),ee}(g),o=0;o<g.length;o++)for(c=0;c<g[o].length;c++)w(g[o][c])}g.length===1?g=g[0]:x="Multi"+x;var A={type:"Feature",geometry:{type:x,coordinates:g},properties:this.properties};return"id"in this&&(A.id=this.id),A};var ld=Jc,Yc=Qc;function Qc(i,e){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=i,this._keys=[],this._values=[],this._features=[],i.readFields(cd,this,e),this.length=this._features.length}function cd(i,e,r){i===15?e.version=r.readVarint():i===1?e.name=r.readString():i===5?e.extent=r.readVarint():i===2?e._features.push(r.pos):i===3?e._keys.push(r.readString()):i===4&&e._values.push(function(o){for(var c=null,h=o.readVarint()+o.pos;o.pos<h;){var p=o.readVarint()>>3;c=p===1?o.readString():p===2?o.readFloat():p===3?o.readDouble():p===4?o.readVarint64():p===5?o.readVarint():p===6?o.readSVarint():p===7?o.readBoolean():null}return c}(r))}Qc.prototype.feature=function(i){if(i<0||i>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[i];var e=this._pbf.readVarint()+this._pbf.pos;return new ld(this._pbf,e,this.extent,this._keys,this._values)};var ud=Yc;function hd(i,e,r){if(i===3){var o=new ud(r,r.readVarint()+r.pos);o.length&&(e[o.name]=o)}}Rn.VectorTile=function(i,e){this.layers=i.readFields(hd,{},e)},Rn.VectorTileFeature=Jc,Rn.VectorTileLayer=Yc;const dd=Rn.VectorTileFeature.types,Hl=Math.pow(2,13);function Gs(i,e,r,o,c,h,p,m){i.emplaceBack(e,r,2*Math.floor(o*Hl)+p,c*Hl*2,h*Hl*2,Math.round(m))}class Kl{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new ut,this.centroidVertexArray=new Ge,this.indexArray=new vi,this.programConfigurations=new fo(e.layers,e.zoom),this.segments=new ot,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,o){this.features=[],this.hasPattern=jl("fill-extrusion",this.layers,r);for(const{feature:c,id:h,index:p,sourceLayerIndex:m}of e){const g=this.layers[0]._featureFilter.needGeometry,x=go(c,g);if(!this.layers[0]._featureFilter.filter(new Rt(this.zoom),x,o))continue;const w={id:h,sourceLayerIndex:m,index:p,geometry:g?x.geometry:mo(c),properties:c.properties,type:c.type,patterns:{}};this.hasPattern?this.features.push(Xl("fill-extrusion",this.layers,w,this.zoom,r)):this.addFeature(w,w.geometry,p,o,{}),r.featureIndex.insert(c,w.geometry,p,m,this.index,!0)}}addFeatures(e,r,o){for(const c of this.features){const{geometry:h}=c;this.addFeature(c,h,c.index,r,o)}}update(e,r,o){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,o)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,nd),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,rd.members,!0),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(e,r,o,c,h){const p={x:0,y:0,vertexCount:0};for(const m of Zl(r,500)){let g=0;for(const z of m)g+=z.length;let x=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const z of m){if(z.length===0||fd(z))continue;let $=0;for(let U=0;U<z.length;U++){const ee=z[U];if(U>=1){const oe=z[U-1];if(!pd(ee,oe)){x.vertexLength+4>ot.MAX_VERTEX_ARRAY_LENGTH&&(x=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const Y=ee.sub(oe)._perp()._unit(),re=oe.dist(ee);$+re>32768&&($=0),Gs(this.layoutVertexArray,ee.x,ee.y,Y.x,Y.y,0,0,$),Gs(this.layoutVertexArray,ee.x,ee.y,Y.x,Y.y,0,1,$),p.x+=2*ee.x,p.y+=2*ee.y,p.vertexCount+=2,$+=re,Gs(this.layoutVertexArray,oe.x,oe.y,Y.x,Y.y,0,0,$),Gs(this.layoutVertexArray,oe.x,oe.y,Y.x,Y.y,0,1,$),p.x+=2*oe.x,p.y+=2*oe.y,p.vertexCount+=2;const fe=x.vertexLength;this.indexArray.emplaceBack(fe,fe+2,fe+1),this.indexArray.emplaceBack(fe+1,fe+2,fe+3),x.vertexLength+=4,x.primitiveLength+=2}}}}if(x.vertexLength+g>ot.MAX_VERTEX_ARRAY_LENGTH&&(x=this.segments.prepareSegment(g,this.layoutVertexArray,this.indexArray)),dd[e.type]!=="Polygon")continue;const w=[],E=[],A=x.vertexLength;for(const z of m)if(z.length!==0){z!==m[0]&&E.push(w.length/2);for(let $=0;$<z.length;$++){const U=z[$];Gs(this.layoutVertexArray,U.x,U.y,0,0,1,1,0),p.x+=U.x,p.y+=U.y,p.vertexCount+=1,w.push(U.x),w.push(U.y)}}const M=Za.exports(w,E);for(let z=0;z<M.length;z+=3)this.indexArray.emplaceBack(A+M[z],A+M[z+2],A+M[z+1]);x.primitiveLength+=M.length/3,x.vertexLength+=g}for(let m=0;m<p.vertexCount;m++)this.centroidVertexArray.emplaceBack(Math.floor(p.x/p.vertexCount),Math.floor(p.y/p.vertexCount));this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,o,h,c)}}function pd(i,e){return i.x===e.x&&(i.x<0||i.x>Kt)||i.y===e.y&&(i.y<0||i.y>Kt)}function fd(i){return i.every(e=>e.x<0)||i.every(e=>e.x>Kt)||i.every(e=>e.y<0)||i.every(e=>e.y>Kt)}Fe("FillExtrusionBucket",Kl,{omit:["layers","features"]});var md={paint:new si({"fill-extrusion-opacity":new Ve(de["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new je(de["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Ve(de["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Ve(de["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new kn(de["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new je(de["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new je(de["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Ve(de["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})};function qs(i,e){return i.x*e.x+i.y*e.y}function eu(i,e){if(i.length===1){let r=0;const o=e[r++];let c;for(;!c||o.equals(c);)if(c=e[r++],!c)return 1/0;for(;r<e.length;r++){const h=e[r],p=i[0],m=c.sub(o),g=h.sub(o),x=p.sub(o),w=qs(m,m),E=qs(m,g),A=qs(g,g),M=qs(x,m),z=qs(x,g),$=w*A-E*E,U=(A*M-E*z)/$,ee=(w*z-E*M)/$,oe=o.z*(1-U-ee)+c.z*U+h.z*ee;if(isFinite(oe))return oe}return 1/0}{let r=1/0;for(const o of e)r=Math.min(r,o.z);return r}}const gd=Zt([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:_d}=gd,yd=Zt([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:xd}=yd,vd=Rn.VectorTileFeature.types,bd=Math.cos(Math.PI/180*37.5),tu=Math.pow(2,14)/.5;class Jl{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(r=>{this.gradients[r.id]={}}),this.layoutVertexArray=new mt,this.layoutVertexArray2=new Et,this.indexArray=new vi,this.programConfigurations=new fo(e.layers,e.zoom),this.segments=new ot,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,o){this.hasPattern=jl("line",this.layers,r);const c=this.layers[0].layout.get("line-sort-key"),h=!c.isConstant(),p=[];for(const{feature:m,id:g,index:x,sourceLayerIndex:w}of e){const E=this.layers[0]._featureFilter.needGeometry,A=go(m,E);if(!this.layers[0]._featureFilter.filter(new Rt(this.zoom),A,o))continue;const M=h?c.evaluate(A,{},o):void 0,z={id:g,properties:m.properties,type:m.type,sourceLayerIndex:w,index:x,geometry:E?A.geometry:mo(m),patterns:{},sortKey:M};p.push(z)}h&&p.sort((m,g)=>m.sortKey-g.sortKey);for(const m of p){const{geometry:g,index:x,sourceLayerIndex:w}=m;if(this.hasPattern){const E=Xl("line",this.layers,m,this.zoom,r);this.patternFeatures.push(E)}else this.addFeature(m,g,x,o,{});r.featureIndex.insert(e[x].feature,g,x,w,this.index)}}update(e,r,o){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,o)}addFeatures(e,r,o){for(const c of this.patternFeatures)this.addFeature(c,c.geometry,c.index,r,o)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,xd)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,_d),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e){if(e.properties&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_end"))return{start:+e.properties.mapbox_clip_start,end:+e.properties.mapbox_clip_end}}addFeature(e,r,o,c,h){const p=this.layers[0].layout,m=p.get("line-join").evaluate(e,{}),g=p.get("line-cap"),x=p.get("line-miter-limit"),w=p.get("line-round-limit");this.lineClips=this.lineFeatureClips(e);for(const E of r)this.addLine(E,e,m,g,x,w);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,o,h,c)}addLine(e,r,o,c,h,p){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let ee=0;ee<e.length-1;ee++)this.totalDistance+=e[ee].dist(e[ee+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const m=vd[r.type]==="Polygon";let g=e.length;for(;g>=2&&e[g-1].equals(e[g-2]);)g--;let x=0;for(;x<g-1&&e[x].equals(e[x+1]);)x++;if(g<(m?3:2))return;o==="bevel"&&(h=1.05);const w=this.overscaling<=16?122880/(512*this.overscaling):0,E=this.segments.prepareSegment(10*g,this.layoutVertexArray,this.indexArray);let A,M,z,$,U;this.e1=this.e2=-1,m&&(A=e[g-2],U=e[x].sub(A)._unit()._perp());for(let ee=x;ee<g;ee++){if(z=ee===g-1?m?e[x+1]:void 0:e[ee+1],z&&e[ee].equals(z))continue;U&&($=U),A&&(M=A),A=e[ee],U=z?z.sub(A)._unit()._perp():$,$=$||U;let oe=$.add(U);oe.x===0&&oe.y===0||oe._unit();const Y=$.x*U.x+$.y*U.y,re=oe.x*U.x+oe.y*U.y,fe=re!==0?1/re:1/0,pe=2*Math.sqrt(2-2*re),Be=re<bd&&M&&z,Ue=$.x*U.y-$.y*U.x>0;if(Be&&ee>x){const we=A.dist(M);if(we>2*w){const ke=A.sub(A.sub(M)._mult(w/we)._round());this.updateDistance(M,ke),this.addCurrentVertex(ke,$,0,0,E),M=ke}}const Pe=M&&z;let Ae=Pe?o:m?"butt":c;if(Pe&&Ae==="round"&&(fe<p?Ae="miter":fe<=2&&(Ae="fakeround")),Ae==="miter"&&fe>h&&(Ae="bevel"),Ae==="bevel"&&(fe>2&&(Ae="flipbevel"),fe<h&&(Ae="miter")),M&&this.updateDistance(M,A),Ae==="miter")oe._mult(fe),this.addCurrentVertex(A,oe,0,0,E);else if(Ae==="flipbevel"){if(fe>100)oe=U.mult(-1);else{const we=fe*$.add(U).mag()/$.sub(U).mag();oe._perp()._mult(we*(Ue?-1:1))}this.addCurrentVertex(A,oe,0,0,E),this.addCurrentVertex(A,oe.mult(-1),0,0,E)}else if(Ae==="bevel"||Ae==="fakeround"){const we=-Math.sqrt(fe*fe-1),ke=Ue?we:0,Me=Ue?0:we;if(M&&this.addCurrentVertex(A,$,ke,Me,E),Ae==="fakeround"){const be=Math.round(180*pe/Math.PI/20);for(let qe=1;qe<be;qe++){let Ne=qe/be;if(Ne!==.5){const Pt=Ne-.5;Ne+=Ne*Pt*(Ne-1)*((1.0904+Y*(Y*(3.55645-1.43519*Y)-3.2452))*Pt*Pt+(.848013+Y*(.215638*Y-1.06021)))}const rt=U.sub($)._mult(Ne)._add($)._unit()._mult(Ue?-1:1);this.addHalfVertex(A,rt.x,rt.y,!1,Ue,0,E)}}z&&this.addCurrentVertex(A,U,-ke,-Me,E)}else if(Ae==="butt")this.addCurrentVertex(A,oe,0,0,E);else if(Ae==="square"){const we=M?1:-1;this.addCurrentVertex(A,oe,we,we,E)}else Ae==="round"&&(M&&(this.addCurrentVertex(A,$,0,0,E),this.addCurrentVertex(A,$,1,1,E,!0)),z&&(this.addCurrentVertex(A,U,-1,-1,E,!0),this.addCurrentVertex(A,U,0,0,E)));if(Be&&ee<g-1){const we=A.dist(z);if(we>2*w){const ke=A.add(z.sub(A)._mult(w/we)._round());this.updateDistance(A,ke),this.addCurrentVertex(ke,U,0,0,E),A=ke}}}}addCurrentVertex(e,r,o,c,h,p=!1){const m=r.y*c-r.x,g=-r.y-r.x*c;this.addHalfVertex(e,r.x+r.y*o,r.y-r.x*o,p,!1,o,h),this.addHalfVertex(e,m,g,p,!0,-c,h),this.distance>tu/2&&this.totalDistance===0&&(this.distance=0,this.addCurrentVertex(e,r,o,c,h,p))}addHalfVertex({x:e,y:r},o,c,h,p,m,g){const x=.5*(this.lineClips?this.scaledDistance*(tu-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((e<<1)+(h?1:0),(r<<1)+(p?1:0),Math.round(63*o)+128,Math.round(63*c)+128,1+(m===0?0:m<0?-1:1)|(63&x)<<2,x>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const w=g.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,w),g.primitiveLength++),p?this.e2=w:this.e1=w}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(e,r){this.distance+=e.dist(r),this.updateScaledDistance()}}Fe("LineBucket",Jl,{omit:["layers","patternFeatures"]});const wd=new si({"line-cap":new Ve(de.layout_line["line-cap"]),"line-join":new je(de.layout_line["line-join"]),"line-miter-limit":new Ve(de.layout_line["line-miter-limit"]),"line-round-limit":new Ve(de.layout_line["line-round-limit"]),"line-sort-key":new je(de.layout_line["line-sort-key"])});var iu={paint:new si({"line-opacity":new je(de.paint_line["line-opacity"]),"line-color":new je(de.paint_line["line-color"]),"line-translate":new Ve(de.paint_line["line-translate"]),"line-translate-anchor":new Ve(de.paint_line["line-translate-anchor"]),"line-width":new je(de.paint_line["line-width"]),"line-gap-width":new je(de.paint_line["line-gap-width"]),"line-offset":new je(de.paint_line["line-offset"]),"line-blur":new je(de.paint_line["line-blur"]),"line-dasharray":new Ps(de.paint_line["line-dasharray"]),"line-pattern":new kn(de.paint_line["line-pattern"]),"line-gradient":new Fr(de.paint_line["line-gradient"])}),layout:wd};const ru=new class extends je{possiblyEvaluate(i,e){return e=new Rt(Math.floor(e.zoom),{now:e.now,fadeDuration:e.fadeDuration,zoomHistory:e.zoomHistory,transition:e.transition}),super.possiblyEvaluate(i,e)}evaluate(i,e,r,o){return e=nt({},e,{zoom:Math.floor(e.zoom)}),super.evaluate(i,e,r,o)}}(iu.paint.properties["line-width"].specification);function nu(i,e){return e>0?e+2*i:i}ru.useIntegerZoom=!0;const Td=Zt([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Ed=Zt([{name:"a_projected_pos",components:3,type:"Float32"}],4);Zt([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const Sd=Zt([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]);Zt([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);const ou=Zt([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),Id=Zt([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function Ad(i,e,r){return i.sections.forEach(o=>{o.text=function(c,h,p){const m=h.layout.get("text-transform").evaluate(p,{});return m==="uppercase"?c=c.toLocaleUpperCase():m==="lowercase"&&(c=c.toLocaleLowerCase()),Ui.applyArabicShaping&&(c=Ui.applyArabicShaping(c)),c}(o.text,e,r)}),i}Zt([{name:"triangle",components:3,type:"Uint16"}]),Zt([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"}]),Zt([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",components:2,name:"textOffset"},{type:"Float32",name:"collisionCircleDiameter"}]),Zt([{type:"Float32",name:"offsetX"}]),Zt([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]);const Zs={"!":"\uFE15","#":"\uFF03",$:"\uFF04","%":"\uFF05","&":"\uFF06","(":"\uFE35",")":"\uFE36","*":"\uFF0A","+":"\uFF0B",",":"\uFE10","-":"\uFE32",".":"\u30FB","/":"\uFF0F",":":"\uFE13",";":"\uFE14","<":"\uFE3F","=":"\uFF1D",">":"\uFE40","?":"\uFE16","@":"\uFF20","[":"\uFE47","\\":"\uFF3C","]":"\uFE48","^":"\uFF3E",_:"\uFE33","`":"\uFF40","{":"\uFE37","|":"\u2015","}":"\uFE38","~":"\uFF5E","\xA2":"\uFFE0","\xA3":"\uFFE1","\xA5":"\uFFE5","\xA6":"\uFFE4","\xAC":"\uFFE2","\xAF":"\uFFE3","\u2013":"\uFE32","\u2014":"\uFE31","\u2018":"\uFE43","\u2019":"\uFE44","\u201C":"\uFE41","\u201D":"\uFE42","\u2026":"\uFE19","\u2027":"\u30FB","\u20A9":"\uFFE6","\u3001":"\uFE11","\u3002":"\uFE12","\u3008":"\uFE3F","\u3009":"\uFE40","\u300A":"\uFE3D","\u300B":"\uFE3E","\u300C":"\uFE41","\u300D":"\uFE42","\u300E":"\uFE43","\u300F":"\uFE44","\u3010":"\uFE3B","\u3011":"\uFE3C","\u3014":"\uFE39","\u3015":"\uFE3A","\u3016":"\uFE17","\u3017":"\uFE18","\uFF01":"\uFE15","\uFF08":"\uFE35","\uFF09":"\uFE36","\uFF0C":"\uFE10","\uFF0D":"\uFE32","\uFF0E":"\u30FB","\uFF1A":"\uFE13","\uFF1B":"\uFE14","\uFF1C":"\uFE3F","\uFF1E":"\uFE40","\uFF1F":"\uFE16","\uFF3B":"\uFE47","\uFF3D":"\uFE48","\uFF3F":"\uFE33","\uFF5B":"\uFE37","\uFF5C":"\u2015","\uFF5D":"\uFE38","\uFF5F":"\uFE35","\uFF60":"\uFE36","\uFF61":"\uFE12","\uFF62":"\uFE41","\uFF63":"\uFE42"};var ai=24,Yl=At,su=function(i,e,r,o,c){var h,p,m=8*c-o-1,g=(1<<m)-1,x=g>>1,w=-7,E=r?c-1:0,A=r?-1:1,M=i[e+E];for(E+=A,h=M&(1<<-w)-1,M>>=-w,w+=m;w>0;h=256*h+i[e+E],E+=A,w-=8);for(p=h&(1<<-w)-1,h>>=-w,w+=o;w>0;p=256*p+i[e+E],E+=A,w-=8);if(h===0)h=1-x;else{if(h===g)return p?NaN:1/0*(M?-1:1);p+=Math.pow(2,o),h-=x}return(M?-1:1)*p*Math.pow(2,h-o)},au=function(i,e,r,o,c,h){var p,m,g,x=8*h-c-1,w=(1<<x)-1,E=w>>1,A=c===23?Math.pow(2,-24)-Math.pow(2,-77):0,M=o?0:h-1,z=o?1:-1,$=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(m=isNaN(e)?1:0,p=w):(p=Math.floor(Math.log(e)/Math.LN2),e*(g=Math.pow(2,-p))<1&&(p--,g*=2),(e+=p+E>=1?A/g:A*Math.pow(2,1-E))*g>=2&&(p++,g/=2),p+E>=w?(m=0,p=w):p+E>=1?(m=(e*g-1)*Math.pow(2,c),p+=E):(m=e*Math.pow(2,E-1)*Math.pow(2,c),p=0));c>=8;i[r+M]=255&m,M+=z,m/=256,c-=8);for(p=p<<c|m,x+=c;x>0;i[r+M]=255&p,M+=z,p/=256,x-=8);i[r+M-z]|=128*$};function At(i){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(i)?i:new Uint8Array(i||0),this.pos=0,this.type=0,this.length=this.buf.length}At.Varint=0,At.Fixed64=1,At.Bytes=2,At.Fixed32=5;var Bn,Ql=4294967296,lu=1/Ql,cu=typeof TextDecoder>"u"?null:new TextDecoder("utf8");function on(i){return i.type===At.Bytes?i.readVarint()+i.pos:i.pos+1}function Wo(i,e,r){return r?4294967296*e+(i>>>0):4294967296*(e>>>0)+(i>>>0)}function uu(i,e,r){var o=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));r.realloc(o);for(var c=r.pos-1;c>=i;c--)r.buf[c+o]=r.buf[c]}function Cd(i,e){for(var r=0;r<i.length;r++)e.writeVarint(i[r])}function Md(i,e){for(var r=0;r<i.length;r++)e.writeSVarint(i[r])}function zd(i,e){for(var r=0;r<i.length;r++)e.writeFloat(i[r])}function Pd(i,e){for(var r=0;r<i.length;r++)e.writeDouble(i[r])}function kd(i,e){for(var r=0;r<i.length;r++)e.writeBoolean(i[r])}function Dd(i,e){for(var r=0;r<i.length;r++)e.writeFixed32(i[r])}function Ld(i,e){for(var r=0;r<i.length;r++)e.writeSFixed32(i[r])}function Rd(i,e){for(var r=0;r<i.length;r++)e.writeFixed64(i[r])}function Bd(i,e){for(var r=0;r<i.length;r++)e.writeSFixed64(i[r])}function Ka(i,e){return(i[e]|i[e+1]<<8|i[e+2]<<16)+16777216*i[e+3]}function Ho(i,e,r){i[r]=e,i[r+1]=e>>>8,i[r+2]=e>>>16,i[r+3]=e>>>24}function hu(i,e){return(i[e]|i[e+1]<<8|i[e+2]<<16)+(i[e+3]<<24)}function Fd(i,e,r){i===1&&r.readMessage(Od,e)}function Od(i,e,r){if(i===3){const{id:o,bitmap:c,width:h,height:p,left:m,top:g,advance:x}=r.readMessage(Ud,{});e.push({id:o,bitmap:new Os({width:h+6,height:p+6},c),metrics:{width:h,height:p,left:m,top:g,advance:x}})}}function Ud(i,e,r){i===1?e.id=r.readVarint():i===2?e.bitmap=r.readBytes():i===3?e.width=r.readVarint():i===4?e.height=r.readVarint():i===5?e.left=r.readSVarint():i===6?e.top=r.readSVarint():i===7&&(e.advance=r.readVarint())}function du(i){let e=0,r=0;for(const p of i)e+=p.w*p.h,r=Math.max(r,p.w);i.sort((p,m)=>m.h-p.h);const o=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),r),h:1/0}];let c=0,h=0;for(const p of i)for(let m=o.length-1;m>=0;m--){const g=o[m];if(!(p.w>g.w||p.h>g.h)){if(p.x=g.x,p.y=g.y,h=Math.max(h,p.y+p.h),c=Math.max(c,p.x+p.w),p.w===g.w&&p.h===g.h){const x=o.pop();m<o.length&&(o[m]=x)}else p.h===g.h?(g.x+=p.w,g.w-=p.w):p.w===g.w?(g.y+=p.h,g.h-=p.h):(o.push({x:g.x+p.w,y:g.y,w:g.w-p.w,h:p.h}),g.y+=p.h,g.h-=p.h);break}}return{w:c,h,fill:e/(c*h)||0}}At.prototype={destroy:function(){this.buf=null},readFields:function(i,e,r){for(r=r||this.length;this.pos<r;){var o=this.readVarint(),c=o>>3,h=this.pos;this.type=7&o,i(c,e,this),this.pos===h&&this.skip(o)}return e},readMessage:function(i,e){return this.readFields(i,e,this.readVarint()+this.pos)},readFixed32:function(){var i=Ka(this.buf,this.pos);return this.pos+=4,i},readSFixed32:function(){var i=hu(this.buf,this.pos);return this.pos+=4,i},readFixed64:function(){var i=Ka(this.buf,this.pos)+Ka(this.buf,this.pos+4)*Ql;return this.pos+=8,i},readSFixed64:function(){var i=Ka(this.buf,this.pos)+hu(this.buf,this.pos+4)*Ql;return this.pos+=8,i},readFloat:function(){var i=su(this.buf,this.pos,!0,23,4);return this.pos+=4,i},readDouble:function(){var i=su(this.buf,this.pos,!0,52,8);return this.pos+=8,i},readVarint:function(i){var e,r,o=this.buf;return e=127&(r=o[this.pos++]),r<128?e:(e|=(127&(r=o[this.pos++]))<<7,r<128?e:(e|=(127&(r=o[this.pos++]))<<14,r<128?e:(e|=(127&(r=o[this.pos++]))<<21,r<128?e:function(c,h,p){var m,g,x=p.buf;if(m=(112&(g=x[p.pos++]))>>4,g<128||(m|=(127&(g=x[p.pos++]))<<3,g<128)||(m|=(127&(g=x[p.pos++]))<<10,g<128)||(m|=(127&(g=x[p.pos++]))<<17,g<128)||(m|=(127&(g=x[p.pos++]))<<24,g<128)||(m|=(1&(g=x[p.pos++]))<<31,g<128))return Wo(c,m,h);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(r=o[this.pos]))<<28,i,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var i=this.readVarint();return i%2==1?(i+1)/-2:i/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var i=this.readVarint()+this.pos,e=this.pos;return this.pos=i,i-e>=12&&cu?function(r,o,c){return cu.decode(r.subarray(o,c))}(this.buf,e,i):function(r,o,c){for(var h="",p=o;p<c;){var m,g,x,w=r[p],E=null,A=w>239?4:w>223?3:w>191?2:1;if(p+A>c)break;A===1?w<128&&(E=w):A===2?(192&(m=r[p+1]))==128&&(E=(31&w)<<6|63&m)<=127&&(E=null):A===3?(g=r[p+2],(192&(m=r[p+1]))==128&&(192&g)==128&&((E=(15&w)<<12|(63&m)<<6|63&g)<=2047||E>=55296&&E<=57343)&&(E=null)):A===4&&(g=r[p+2],x=r[p+3],(192&(m=r[p+1]))==128&&(192&g)==128&&(192&x)==128&&((E=(15&w)<<18|(63&m)<<12|(63&g)<<6|63&x)<=65535||E>=1114112)&&(E=null)),E===null?(E=65533,A=1):E>65535&&(E-=65536,h+=String.fromCharCode(E>>>10&1023|55296),E=56320|1023&E),h+=String.fromCharCode(E),p+=A}return h}(this.buf,e,i)},readBytes:function(){var i=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,i);return this.pos=i,e},readPackedVarint:function(i,e){if(this.type!==At.Bytes)return i.push(this.readVarint(e));var r=on(this);for(i=i||[];this.pos<r;)i.push(this.readVarint(e));return i},readPackedSVarint:function(i){if(this.type!==At.Bytes)return i.push(this.readSVarint());var e=on(this);for(i=i||[];this.pos<e;)i.push(this.readSVarint());return i},readPackedBoolean:function(i){if(this.type!==At.Bytes)return i.push(this.readBoolean());var e=on(this);for(i=i||[];this.pos<e;)i.push(this.readBoolean());return i},readPackedFloat:function(i){if(this.type!==At.Bytes)return i.push(this.readFloat());var e=on(this);for(i=i||[];this.pos<e;)i.push(this.readFloat());return i},readPackedDouble:function(i){if(this.type!==At.Bytes)return i.push(this.readDouble());var e=on(this);for(i=i||[];this.pos<e;)i.push(this.readDouble());return i},readPackedFixed32:function(i){if(this.type!==At.Bytes)return i.push(this.readFixed32());var e=on(this);for(i=i||[];this.pos<e;)i.push(this.readFixed32());return i},readPackedSFixed32:function(i){if(this.type!==At.Bytes)return i.push(this.readSFixed32());var e=on(this);for(i=i||[];this.pos<e;)i.push(this.readSFixed32());return i},readPackedFixed64:function(i){if(this.type!==At.Bytes)return i.push(this.readFixed64());var e=on(this);for(i=i||[];this.pos<e;)i.push(this.readFixed64());return i},readPackedSFixed64:function(i){if(this.type!==At.Bytes)return i.push(this.readSFixed64());var e=on(this);for(i=i||[];this.pos<e;)i.push(this.readSFixed64());return i},skip:function(i){var e=7&i;if(e===At.Varint)for(;this.buf[this.pos++]>127;);else if(e===At.Bytes)this.pos=this.readVarint()+this.pos;else if(e===At.Fixed32)this.pos+=4;else{if(e!==At.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(i,e){this.writeVarint(i<<3|e)},realloc:function(i){for(var e=this.length||16;e<this.pos+i;)e*=2;if(e!==this.length){var r=new Uint8Array(e);r.set(this.buf),this.buf=r,this.length=e}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(i){this.realloc(4),Ho(this.buf,i,this.pos),this.pos+=4},writeSFixed32:function(i){this.realloc(4),Ho(this.buf,i,this.pos),this.pos+=4},writeFixed64:function(i){this.realloc(8),Ho(this.buf,-1&i,this.pos),Ho(this.buf,Math.floor(i*lu),this.pos+4),this.pos+=8},writeSFixed64:function(i){this.realloc(8),Ho(this.buf,-1&i,this.pos),Ho(this.buf,Math.floor(i*lu),this.pos+4),this.pos+=8},writeVarint:function(i){(i=+i||0)>268435455||i<0?function(e,r){var o,c;if(e>=0?(o=e%4294967296|0,c=e/4294967296|0):(c=~(-e/4294967296),4294967295^(o=~(-e%4294967296))?o=o+1|0:(o=0,c=c+1|0)),e>=18446744073709552e3||e<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");r.realloc(10),function(h,p,m){m.buf[m.pos++]=127&h|128,h>>>=7,m.buf[m.pos++]=127&h|128,h>>>=7,m.buf[m.pos++]=127&h|128,h>>>=7,m.buf[m.pos++]=127&h|128,m.buf[m.pos]=127&(h>>>=7)}(o,0,r),function(h,p){var m=(7&h)<<4;p.buf[p.pos++]|=m|((h>>>=3)?128:0),h&&(p.buf[p.pos++]=127&h|((h>>>=7)?128:0),h&&(p.buf[p.pos++]=127&h|((h>>>=7)?128:0),h&&(p.buf[p.pos++]=127&h|((h>>>=7)?128:0),h&&(p.buf[p.pos++]=127&h|((h>>>=7)?128:0),h&&(p.buf[p.pos++]=127&h)))))}(c,r)}(i,this):(this.realloc(4),this.buf[this.pos++]=127&i|(i>127?128:0),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|(i>127?128:0),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|(i>127?128:0),i<=127||(this.buf[this.pos++]=i>>>7&127))))},writeSVarint:function(i){this.writeVarint(i<0?2*-i-1:2*i)},writeBoolean:function(i){this.writeVarint(Boolean(i))},writeString:function(i){i=String(i),this.realloc(4*i.length),this.pos++;var e=this.pos;this.pos=function(o,c,h){for(var p,m,g=0;g<c.length;g++){if((p=c.charCodeAt(g))>55295&&p<57344){if(!m){p>56319||g+1===c.length?(o[h++]=239,o[h++]=191,o[h++]=189):m=p;continue}if(p<56320){o[h++]=239,o[h++]=191,o[h++]=189,m=p;continue}p=m-55296<<10|p-56320|65536,m=null}else m&&(o[h++]=239,o[h++]=191,o[h++]=189,m=null);p<128?o[h++]=p:(p<2048?o[h++]=p>>6|192:(p<65536?o[h++]=p>>12|224:(o[h++]=p>>18|240,o[h++]=p>>12&63|128),o[h++]=p>>6&63|128),o[h++]=63&p|128)}return h}(this.buf,i,this.pos);var r=this.pos-e;r>=128&&uu(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(i){this.realloc(4),au(this.buf,i,this.pos,!0,23,4),this.pos+=4},writeDouble:function(i){this.realloc(8),au(this.buf,i,this.pos,!0,52,8),this.pos+=8},writeBytes:function(i){var e=i.length;this.writeVarint(e),this.realloc(e);for(var r=0;r<e;r++)this.buf[this.pos++]=i[r]},writeRawMessage:function(i,e){this.pos++;var r=this.pos;i(e,this);var o=this.pos-r;o>=128&&uu(r,o,this),this.pos=r-1,this.writeVarint(o),this.pos+=o},writeMessage:function(i,e,r){this.writeTag(i,At.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(i,e){e.length&&this.writeMessage(i,Cd,e)},writePackedSVarint:function(i,e){e.length&&this.writeMessage(i,Md,e)},writePackedBoolean:function(i,e){e.length&&this.writeMessage(i,kd,e)},writePackedFloat:function(i,e){e.length&&this.writeMessage(i,zd,e)},writePackedDouble:function(i,e){e.length&&this.writeMessage(i,Pd,e)},writePackedFixed32:function(i,e){e.length&&this.writeMessage(i,Dd,e)},writePackedSFixed32:function(i,e){e.length&&this.writeMessage(i,Ld,e)},writePackedFixed64:function(i,e){e.length&&this.writeMessage(i,Rd,e)},writePackedSFixed64:function(i,e){e.length&&this.writeMessage(i,Bd,e)},writeBytesField:function(i,e){this.writeTag(i,At.Bytes),this.writeBytes(e)},writeFixed32Field:function(i,e){this.writeTag(i,At.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(i,e){this.writeTag(i,At.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(i,e){this.writeTag(i,At.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(i,e){this.writeTag(i,At.Fixed64),this.writeSFixed64(e)},writeVarintField:function(i,e){this.writeTag(i,At.Varint),this.writeVarint(e)},writeSVarintField:function(i,e){this.writeTag(i,At.Varint),this.writeSVarint(e)},writeStringField:function(i,e){this.writeTag(i,At.Bytes),this.writeString(e)},writeFloatField:function(i,e){this.writeTag(i,At.Fixed32),this.writeFloat(e)},writeDoubleField:function(i,e){this.writeTag(i,At.Fixed64),this.writeDouble(e)},writeBooleanField:function(i,e){this.writeVarintField(i,Boolean(e))}};class ec{constructor(e,{pixelRatio:r,version:o,stretchX:c,stretchY:h,content:p}){this.paddedRect=e,this.pixelRatio=r,this.stretchX=c,this.stretchY=h,this.content=p,this.version=o}get tl(){return[this.paddedRect.x+1,this.paddedRect.y+1]}get br(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]}}class pu{constructor(e,r){const o={},c={};this.haveRenderCallbacks=[];const h=[];this.addImages(e,o,h),this.addImages(r,c,h);const{w:p,h:m}=du(h),g=new Hi({width:p||1,height:m||1});for(const x in e){const w=e[x],E=o[x].paddedRect;Hi.copy(w.data,g,{x:0,y:0},{x:E.x+1,y:E.y+1},w.data)}for(const x in r){const w=r[x],E=c[x].paddedRect,A=E.x+1,M=E.y+1,z=w.data.width,$=w.data.height;Hi.copy(w.data,g,{x:0,y:0},{x:A,y:M},w.data),Hi.copy(w.data,g,{x:0,y:$-1},{x:A,y:M-1},{width:z,height:1}),Hi.copy(w.data,g,{x:0,y:0},{x:A,y:M+$},{width:z,height:1}),Hi.copy(w.data,g,{x:z-1,y:0},{x:A-1,y:M},{width:1,height:$}),Hi.copy(w.data,g,{x:0,y:0},{x:A+z,y:M},{width:1,height:$})}this.image=g,this.iconPositions=o,this.patternPositions=c}addImages(e,r,o){for(const c in e){const h=e[c],p={x:0,y:0,w:h.data.width+2,h:h.data.height+2};o.push(p),r[c]=new ec(p,h),h.hasRenderCallback&&this.haveRenderCallbacks.push(c)}}patchUpdatedImages(e,r){e.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const o in e.updatedImages)this.patchUpdatedImage(this.iconPositions[o],e.getImage(o),r),this.patchUpdatedImage(this.patternPositions[o],e.getImage(o),r)}patchUpdatedImage(e,r,o){if(!e||!r||e.version===r.version)return;e.version=r.version;const[c,h]=e.tl;o.update(r.data,void 0,{x:c,y:h})}}Fe("ImagePosition",ec),Fe("ImageAtlas",pu),l.WritingMode=void 0,(Bn=l.WritingMode||(l.WritingMode={}))[Bn.none=0]="none",Bn[Bn.horizontal=1]="horizontal",Bn[Bn.vertical=2]="vertical",Bn[Bn.horizontalOnly=3]="horizontalOnly";const Ja=-17;class js{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(e,r){const o=new js;return o.scale=e||1,o.fontStack=r,o}static forImage(e){const r=new js;return r.imageName=e,r}}class Ko{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(e,r){const o=new Ko;for(let c=0;c<e.sections.length;c++){const h=e.sections[c];h.image?o.addImageSection(h):o.addTextSection(h,r)}return o}length(){return this.text.length}getSection(e){return this.sections[this.sectionIndex[e]]}getSectionIndex(e){return this.sectionIndex[e]}getCharCode(e){return this.text.charCodeAt(e)}verticalizePunctuation(){this.text=function(e){let r="";for(let o=0;o<e.length;o++){const c=e.charCodeAt(o+1)||null,h=e.charCodeAt(o-1)||null;r+=c&&Pa(c)&&!Zs[e[o+1]]||h&&Pa(h)&&!Zs[e[o-1]]||!Zs[e[o]]?e[o]:Zs[e[o]]}return r}(this.text)}trim(){let e=0;for(let o=0;o<this.text.length&&Qa[this.text.charCodeAt(o)];o++)e++;let r=this.text.length;for(let o=this.text.length-1;o>=0&&o>=e&&Qa[this.text.charCodeAt(o)];o--)r--;this.text=this.text.substring(e,r),this.sectionIndex=this.sectionIndex.slice(e,r)}substring(e,r){const o=new Ko;return o.text=this.text.substring(e,r),o.sectionIndex=this.sectionIndex.slice(e,r),o.sections=this.sections,o}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((e,r)=>Math.max(e,this.sections[r].scale),0)}addTextSection(e,r){this.text+=e.text,this.sections.push(js.forText(e.scale,e.fontStack||r));const o=this.sections.length-1;for(let c=0;c<e.text.length;++c)this.sectionIndex.push(o)}addImageSection(e){const r=e.image?e.image.name:"";if(r.length===0)return void $t("Can't add FormattedSection with an empty image.");const o=this.getNextImageSectionCharCode();o?(this.text+=String.fromCharCode(o),this.sections.push(js.forImage(r)),this.sectionIndex.push(this.sections.length-1)):$t("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function Ya(i,e,r,o,c,h,p,m,g,x,w,E,A,M,z,$){const U=Ko.fromFeature(i,c);let ee;E===l.WritingMode.vertical&&U.verticalizePunctuation();const{processBidirectionalText:oe,processStyledBidirectionalText:Y}=Ui;if(oe&&U.sections.length===1){ee=[];const pe=oe(U.toString(),tc(U,x,h,e,o,M,z));for(const Be of pe){const Ue=new Ko;Ue.text=Be,Ue.sections=U.sections;for(let Pe=0;Pe<Be.length;Pe++)Ue.sectionIndex.push(0);ee.push(Ue)}}else if(Y){ee=[];const pe=Y(U.text,U.sectionIndex,tc(U,x,h,e,o,M,z));for(const Be of pe){const Ue=new Ko;Ue.text=Be[0],Ue.sectionIndex=Be[1],Ue.sections=U.sections,ee.push(Ue)}}else ee=function(pe,Be){const Ue=[],Pe=pe.text;let Ae=0;for(const we of Be)Ue.push(pe.substring(Ae,we)),Ae=we;return Ae<Pe.length&&Ue.push(pe.substring(Ae,Pe.length)),Ue}(U,tc(U,x,h,e,o,M,z));const re=[],fe={positionedLines:re,text:U.toString(),top:w[1],bottom:w[1],left:w[0],right:w[0],writingMode:E,iconsInText:!1,verticalizable:!1};return function(pe,Be,Ue,Pe,Ae,we,ke,Me,be,qe,Ne,rt){let Pt=0,Ft=Ja,Jt=0,Ji=0;const ci=Me==="right"?1:Me==="left"?0:.5;let jt=0;for(const Xt of Ae){Xt.trim();const hi=Xt.getMaxScale(),gi=(hi-1)*ai,Ti={positionedGlyphs:[],lineOffset:0};pe.positionedLines[jt]=Ti;const ki=Ti.positionedGlyphs;let Di=0;if(!Xt.length()){Ft+=we,++jt;continue}for(let ni=0;ni<Xt.length();ni++){const st=Xt.getSection(ni),Ni=Xt.getSectionIndex(ni),di=Xt.getCharCode(ni);let _i=0,sr=null,br=null,wr=null,an=ai;const ar=!(be===l.WritingMode.horizontal||!Ne&&!Ss(di)||Ne&&(Qa[di]||(ri=di,ze.Arabic(ri)||ze["Arabic Supplement"](ri)||ze["Arabic Extended-A"](ri)||ze["Arabic Presentation Forms-A"](ri)||ze["Arabic Presentation Forms-B"](ri))));if(st.imageName){const Yi=Pe[st.imageName];if(!Yi)continue;wr=st.imageName,pe.iconsInText=pe.iconsInText||!0,br=Yi.paddedRect;const Li=Yi.displaySize;st.scale=st.scale*ai/rt,sr={width:Li[0],height:Li[1],left:1,top:-3,advance:ar?Li[1]:Li[0]},_i=gi+(ai-Li[1]*st.scale),an=sr.advance;const ln=ar?Li[0]*st.scale-ai*hi:Li[1]*st.scale-ai*hi;ln>0&&ln>Di&&(Di=ln)}else{const Yi=Ue[st.fontStack],Li=Yi&&Yi[di];if(Li&&Li.rect)br=Li.rect,sr=Li.metrics;else{const ln=Be[st.fontStack],Hs=ln&&ln[di];if(!Hs)continue;sr=Hs.metrics}_i=(hi-st.scale)*ai}ar?(pe.verticalizable=!0,ki.push({glyph:di,imageName:wr,x:Pt,y:Ft+_i,vertical:ar,scale:st.scale,fontStack:st.fontStack,sectionIndex:Ni,metrics:sr,rect:br}),Pt+=an*st.scale+qe):(ki.push({glyph:di,imageName:wr,x:Pt,y:Ft+_i,vertical:ar,scale:st.scale,fontStack:st.fontStack,sectionIndex:Ni,metrics:sr,rect:br}),Pt+=sr.advance*st.scale+qe)}ki.length!==0&&(Jt=Math.max(Pt-qe,Jt),Nd(ki,0,ki.length-1,ci,Di)),Pt=0;const Ot=we*hi+Di;Ti.lineOffset=Math.max(Di,gi),Ft+=Ot,Ji=Math.max(Ot,Ji),++jt}var ri;const ui=Ft-Ja,{horizontalAlign:mi,verticalAlign:Pi}=ic(ke);(function(Xt,hi,gi,Ti,ki,Di,Ot,ni,st){const Ni=(hi-gi)*ki;let di=0;di=Di!==Ot?-ni*Ti-Ja:(-Ti*st+.5)*Ot;for(const _i of Xt)for(const sr of _i.positionedGlyphs)sr.x+=Ni,sr.y+=di})(pe.positionedLines,ci,mi,Pi,Jt,Ji,we,ui,Ae.length),pe.top+=-Pi*ui,pe.bottom=pe.top+ui,pe.left+=-mi*Jt,pe.right=pe.left+Jt}(fe,e,r,o,ee,p,m,g,E,x,A,$),!function(pe){for(const Be of pe)if(Be.positionedGlyphs.length!==0)return!1;return!0}(re)&&fe}const Qa={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},$d={10:!0,32:!0,38:!0,40:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0};function fu(i,e,r,o,c,h){if(e.imageName){const p=o[e.imageName];return p?p.displaySize[0]*e.scale*ai/h+c:0}{const p=r[e.fontStack],m=p&&p[i];return m?m.metrics.advance*e.scale+c:0}}function mu(i,e,r,o){const c=Math.pow(i-e,2);return o?i<e?c/2:2*c:c+Math.abs(r)*r}function Vd(i,e,r){let o=0;return i===10&&(o-=1e4),r&&(o+=150),i!==40&&i!==65288||(o+=50),e!==41&&e!==65289||(o+=50),o}function gu(i,e,r,o,c,h){let p=null,m=mu(e,r,c,h);for(const g of o){const x=mu(e-g.x,r,c,h)+g.badness;x<=m&&(p=g,m=x)}return{index:i,x:e,priorBreak:p,badness:m}}function _u(i){return i?_u(i.priorBreak).concat(i.index):[]}function tc(i,e,r,o,c,h,p){if(h!=="point")return[];if(!i)return[];const m=[],g=function(A,M,z,$,U,ee){let oe=0;for(let Y=0;Y<A.length();Y++){const re=A.getSection(Y);oe+=fu(A.getCharCode(Y),re,$,U,M,ee)}return oe/Math.max(1,Math.ceil(oe/z))}(i,e,r,o,c,p),x=i.text.indexOf("\u200B")>=0;let w=0;for(let A=0;A<i.length();A++){const M=i.getSection(A),z=i.getCharCode(A);if(Qa[z]||(w+=fu(z,M,o,c,e,p)),A<i.length()-1){const $=!((E=z)<11904||!(ze["Bopomofo Extended"](E)||ze.Bopomofo(E)||ze["CJK Compatibility Forms"](E)||ze["CJK Compatibility Ideographs"](E)||ze["CJK Compatibility"](E)||ze["CJK Radicals Supplement"](E)||ze["CJK Strokes"](E)||ze["CJK Symbols and Punctuation"](E)||ze["CJK Unified Ideographs Extension A"](E)||ze["CJK Unified Ideographs"](E)||ze["Enclosed CJK Letters and Months"](E)||ze["Halfwidth and Fullwidth Forms"](E)||ze.Hiragana(E)||ze["Ideographic Description Characters"](E)||ze["Kangxi Radicals"](E)||ze["Katakana Phonetic Extensions"](E)||ze.Katakana(E)||ze["Vertical Forms"](E)||ze["Yi Radicals"](E)||ze["Yi Syllables"](E)));($d[z]||$||M.imageName)&&m.push(gu(A+1,w,g,m,Vd(z,i.getCharCode(A+1),$&&x),!1))}}var E;return _u(gu(i.length(),w,g,m,0,!0))}function ic(i){let e=.5,r=.5;switch(i){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0}switch(i){case"bottom":case"bottom-right":case"bottom-left":r=1;break;case"top":case"top-right":case"top-left":r=0}return{horizontalAlign:e,verticalAlign:r}}function Nd(i,e,r,o,c){if(!o&&!c)return;const h=i[r],p=(i[r].x+h.metrics.advance*h.scale)*o;for(let m=e;m<=r;m++)i[m].x-=p,i[m].y+=c}function Gd(i,e,r){const{horizontalAlign:o,verticalAlign:c}=ic(r),h=e[0]-i.displaySize[0]*o,p=e[1]-i.displaySize[1]*c;return{image:i,top:p,bottom:p+i.displaySize[1],left:h,right:h+i.displaySize[0]}}function yu(i,e,r,o,c,h){const p=i.image;let m;if(p.content){const U=p.content,ee=p.pixelRatio||1;m=[U[0]/ee,U[1]/ee,p.displaySize[0]-U[2]/ee,p.displaySize[1]-U[3]/ee]}const g=e.left*h,x=e.right*h;let w,E,A,M;r==="width"||r==="both"?(M=c[0]+g-o[3],E=c[0]+x+o[1]):(M=c[0]+(g+x-p.displaySize[0])/2,E=M+p.displaySize[0]);const z=e.top*h,$=e.bottom*h;return r==="height"||r==="both"?(w=c[1]+z-o[0],A=c[1]+$+o[2]):(w=c[1]+(z+$-p.displaySize[1])/2,A=w+p.displaySize[1]),{image:p,top:w,right:E,bottom:A,left:M,collisionPadding:m}}const sn=128;function xu(i,e){const{expression:r}=e;if(r.kind==="constant")return{kind:"constant",layoutSize:r.evaluate(new Rt(i+1))};if(r.kind==="source")return{kind:"source"};{const{zoomStops:o,interpolationType:c}=r;let h=0;for(;h<o.length&&o[h]<=i;)h++;h=Math.max(0,h-1);let p=h;for(;p<o.length&&o[p]<i+1;)p++;p=Math.min(o.length-1,p);const m=o[h],g=o[p];return r.kind==="composite"?{kind:"composite",minZoom:m,maxZoom:g,interpolationType:c}:{kind:"camera",minZoom:m,maxZoom:g,minSize:r.evaluate(new Rt(m)),maxSize:r.evaluate(new Rt(g)),interpolationType:c}}}class Fn extends We{constructor(e,r,o,c){super(e,r),this.angle=o,c!==void 0&&(this.segment=c)}clone(){return new Fn(this.x,this.y,this.angle,this.segment)}}function vu(i,e,r,o,c){if(e.segment===void 0)return!0;let h=e,p=e.segment+1,m=0;for(;m>-r/2;){if(p--,p<0)return!1;m-=i[p].dist(h),h=i[p]}m+=i[p].dist(i[p+1]),p++;const g=[];let x=0;for(;m<r/2;){const w=i[p],E=i[p+1];if(!E)return!1;let A=i[p-1].angleTo(w)-w.angleTo(E);for(A=Math.abs((A+3*Math.PI)%(2*Math.PI)-Math.PI),g.push({distance:m,angleDelta:A}),x+=A;m-g[0].distance>o;)x-=g.shift().angleDelta;if(x>c)return!1;p++,m+=w.dist(E)}return!0}function bu(i){let e=0;for(let r=0;r<i.length-1;r++)e+=i[r].dist(i[r+1]);return e}function wu(i,e,r){return i?.6*e*r:0}function Tu(i,e){return Math.max(i?i.right-i.left:0,e?e.right-e.left:0)}function qd(i,e,r,o,c,h){const p=wu(r,c,h),m=Tu(r,o)*h;let g=0;const x=bu(i)/2;for(let w=0;w<i.length-1;w++){const E=i[w],A=i[w+1],M=E.dist(A);if(g+M>x){const z=(x-g)/M,$=Dt(E.x,A.x,z),U=Dt(E.y,A.y,z),ee=new Fn($,U,A.angleTo(E),w);return ee._round(),!p||vu(i,ee,m,p,e)?ee:void 0}g+=M}}function Zd(i,e,r,o,c,h,p,m,g){const x=wu(o,h,p),w=Tu(o,c),E=w*p,A=i[0].x===0||i[0].x===g||i[0].y===0||i[0].y===g;return e-E<e/4&&(e=E+e/4),Eu(i,A?e/2*m%e:(w/2+2*h)*p*m%e,e,x,r,E,A,!1,g)}function Eu(i,e,r,o,c,h,p,m,g){const x=h/2,w=bu(i);let E=0,A=e-r,M=[];for(let z=0;z<i.length-1;z++){const $=i[z],U=i[z+1],ee=$.dist(U),oe=U.angleTo($);for(;A+r<E+ee;){A+=r;const Y=(A-E)/ee,re=Dt($.x,U.x,Y),fe=Dt($.y,U.y,Y);if(re>=0&&re<g&&fe>=0&&fe<g&&A-x>=0&&A+x<=w){const pe=new Fn(re,fe,oe,z);pe._round(),o&&!vu(i,pe,h,o,c)||M.push(pe)}}E+=ee}return m||M.length||p||(M=Eu(i,E/2,r,o,c,h,p,!0,g)),M}function Su(i,e,r,o,c){const h=[];for(let p=0;p<i.length;p++){const m=i[p];let g;for(let x=0;x<m.length-1;x++){let w=m[x],E=m[x+1];w.x<e&&E.x<e||(w.x<e?w=new We(e,w.y+(e-w.x)/(E.x-w.x)*(E.y-w.y))._round():E.x<e&&(E=new We(e,w.y+(e-w.x)/(E.x-w.x)*(E.y-w.y))._round()),w.y<r&&E.y<r||(w.y<r?w=new We(w.x+(r-w.y)/(E.y-w.y)*(E.x-w.x),r)._round():E.y<r&&(E=new We(w.x+(r-w.y)/(E.y-w.y)*(E.x-w.x),r)._round()),w.x>=o&&E.x>=o||(w.x>=o?w=new We(o,w.y+(o-w.x)/(E.x-w.x)*(E.y-w.y))._round():E.x>=o&&(E=new We(o,w.y+(o-w.x)/(E.x-w.x)*(E.y-w.y))._round()),w.y>=c&&E.y>=c||(w.y>=c?w=new We(w.x+(c-w.y)/(E.y-w.y)*(E.x-w.x),c)._round():E.y>=c&&(E=new We(w.x+(c-w.y)/(E.y-w.y)*(E.x-w.x),c)._round()),g&&w.equals(g[g.length-1])||(g=[w],h.push(g)),g.push(E)))))}}return h}function Iu(i,e,r,o){const c=[],h=i.image,p=h.pixelRatio,m=h.paddedRect.w-2,g=h.paddedRect.h-2,x=i.right-i.left,w=i.bottom-i.top,E=h.stretchX||[[0,m]],A=h.stretchY||[[0,g]],M=(we,ke)=>we+ke[1]-ke[0],z=E.reduce(M,0),$=A.reduce(M,0),U=m-z,ee=g-$;let oe=0,Y=z,re=0,fe=$,pe=0,Be=U,Ue=0,Pe=ee;if(h.content&&o){const we=h.content;oe=el(E,0,we[0]),re=el(A,0,we[1]),Y=el(E,we[0],we[2]),fe=el(A,we[1],we[3]),pe=we[0]-oe,Ue=we[1]-re,Be=we[2]-we[0]-Y,Pe=we[3]-we[1]-fe}const Ae=(we,ke,Me,be)=>{const qe=tl(we.stretch-oe,Y,x,i.left),Ne=il(we.fixed-pe,Be,we.stretch,z),rt=tl(ke.stretch-re,fe,w,i.top),Pt=il(ke.fixed-Ue,Pe,ke.stretch,$),Ft=tl(Me.stretch-oe,Y,x,i.left),Jt=il(Me.fixed-pe,Be,Me.stretch,z),Ji=tl(be.stretch-re,fe,w,i.top),ci=il(be.fixed-Ue,Pe,be.stretch,$),jt=new We(qe,rt),ri=new We(Ft,rt),ui=new We(Ft,Ji),mi=new We(qe,Ji),Pi=new We(Ne/p,Pt/p),Xt=new We(Jt/p,ci/p),hi=e*Math.PI/180;if(hi){const ki=Math.sin(hi),Di=Math.cos(hi),Ot=[Di,-ki,ki,Di];jt._matMult(Ot),ri._matMult(Ot),mi._matMult(Ot),ui._matMult(Ot)}const gi=we.stretch+we.fixed,Ti=ke.stretch+ke.fixed;return{tl:jt,tr:ri,bl:mi,br:ui,tex:{x:h.paddedRect.x+1+gi,y:h.paddedRect.y+1+Ti,w:Me.stretch+Me.fixed-gi,h:be.stretch+be.fixed-Ti},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Pi,pixelOffsetBR:Xt,minFontScaleX:Be/p/x,minFontScaleY:Pe/p/w,isSDF:r}};if(o&&(h.stretchX||h.stretchY)){const we=Au(E,U,z),ke=Au(A,ee,$);for(let Me=0;Me<we.length-1;Me++){const be=we[Me],qe=we[Me+1];for(let Ne=0;Ne<ke.length-1;Ne++)c.push(Ae(be,ke[Ne],qe,ke[Ne+1]))}}else c.push(Ae({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:m+1},{fixed:0,stretch:g+1}));return c}function el(i,e,r){let o=0;for(const c of i)o+=Math.max(e,Math.min(r,c[1]))-Math.max(e,Math.min(r,c[0]));return o}function Au(i,e,r){const o=[{fixed:-1,stretch:0}];for(const[c,h]of i){const p=o[o.length-1];o.push({fixed:c-p.stretch,stretch:p.stretch}),o.push({fixed:c-p.stretch,stretch:p.stretch+(h-c)})}return o.push({fixed:e+1,stretch:r}),o}function tl(i,e,r,o){return i/e*r+o}function il(i,e,r,o){return i-e*r/o}Fe("Anchor",Fn);class rl{constructor(e,r,o,c,h,p,m,g,x,w){if(this.boxStartIndex=e.length,x){let E=p.top,A=p.bottom;const M=p.collisionPadding;M&&(E-=M[1],A+=M[3]);let z=A-E;z>0&&(z=Math.max(10,z),this.circleDiameter=z)}else{let E=p.top*m-g[0],A=p.bottom*m+g[2],M=p.left*m-g[3],z=p.right*m+g[1];const $=p.collisionPadding;if($&&(M-=$[0]*m,E-=$[1]*m,z+=$[2]*m,A+=$[3]*m),w){const U=new We(M,E),ee=new We(z,E),oe=new We(M,A),Y=new We(z,A),re=w*Math.PI/180;U._rotate(re),ee._rotate(re),oe._rotate(re),Y._rotate(re),M=Math.min(U.x,ee.x,oe.x,Y.x),z=Math.max(U.x,ee.x,oe.x,Y.x),E=Math.min(U.y,ee.y,oe.y,Y.y),A=Math.max(U.y,ee.y,oe.y,Y.y)}e.emplaceBack(r.x,r.y,M,E,z,A,o,c,h)}this.boxEndIndex=e.length}}class jd{constructor(e=[],r=Xd){if(this.data=e,this.length=this.data.length,this.compare=r,this.length>0)for(let o=(this.length>>1)-1;o>=0;o--)this._down(o)}push(e){this.data.push(e),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;const e=this.data[0],r=this.data.pop();return this.length--,this.length>0&&(this.data[0]=r,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:r,compare:o}=this,c=r[e];for(;e>0;){const h=e-1>>1,p=r[h];if(o(c,p)>=0)break;r[e]=p,e=h}r[e]=c}_down(e){const{data:r,compare:o}=this,c=this.length>>1,h=r[e];for(;e<c;){let p=1+(e<<1),m=r[p];const g=p+1;if(g<this.length&&o(r[g],m)<0&&(p=g,m=r[g]),o(m,h)>=0)break;r[e]=m,e=p}r[e]=h}}function Xd(i,e){return i<e?-1:i>e?1:0}function Wd(i,e=1,r=!1){let o=1/0,c=1/0,h=-1/0,p=-1/0;const m=i[0];for(let M=0;M<m.length;M++){const z=m[M];(!M||z.x<o)&&(o=z.x),(!M||z.y<c)&&(c=z.y),(!M||z.x>h)&&(h=z.x),(!M||z.y>p)&&(p=z.y)}const g=Math.min(h-o,p-c);let x=g/2;const w=new jd([],Hd);if(g===0)return new We(o,c);for(let M=o;M<h;M+=g)for(let z=c;z<p;z+=g)w.push(new Jo(M+x,z+x,x,i));let E=function(M){let z=0,$=0,U=0;const ee=M[0];for(let oe=0,Y=ee.length,re=Y-1;oe<Y;re=oe++){const fe=ee[oe],pe=ee[re],Be=fe.x*pe.y-pe.x*fe.y;$+=(fe.x+pe.x)*Be,U+=(fe.y+pe.y)*Be,z+=3*Be}return new Jo($/z,U/z,0,M)}(i),A=w.length;for(;w.length;){const M=w.pop();(M.d>E.d||!E.d)&&(E=M,r&&console.log("found best %d after %d probes",Math.round(1e4*M.d)/1e4,A)),M.max-E.d<=e||(x=M.h/2,w.push(new Jo(M.p.x-x,M.p.y-x,x,i)),w.push(new Jo(M.p.x+x,M.p.y-x,x,i)),w.push(new Jo(M.p.x-x,M.p.y+x,x,i)),w.push(new Jo(M.p.x+x,M.p.y+x,x,i)),A+=4)}return r&&(console.log(`num probes: ${A}`),console.log(`best distance: ${E.d}`)),E.p}function Hd(i,e){return e.max-i.max}function Jo(i,e,r,o){this.p=new We(i,e),this.h=r,this.d=function(c,h){let p=!1,m=1/0;for(let g=0;g<h.length;g++){const x=h[g];for(let w=0,E=x.length,A=E-1;w<E;A=w++){const M=x[w],z=x[A];M.y>c.y!=z.y>c.y&&c.x<(z.x-M.x)*(c.y-M.y)/(z.y-M.y)+M.x&&(p=!p),m=Math.min(m,Rc(c,M,z))}}return(p?1:-1)*Math.sqrt(m)}(this.p,o),this.max=this.d+this.h*Math.SQRT2}const rc=Number.POSITIVE_INFINITY;function Cu(i,e){return e[1]!==rc?function(r,o,c){let h=0,p=0;switch(o=Math.abs(o),c=Math.abs(c),r){case"top-right":case"top-left":case"top":p=c-7;break;case"bottom-right":case"bottom-left":case"bottom":p=7-c}switch(r){case"top-right":case"bottom-right":case"right":h=-o;break;case"top-left":case"bottom-left":case"left":h=o}return[h,p]}(i,e[0],e[1]):function(r,o){let c=0,h=0;o<0&&(o=0);const p=o/Math.sqrt(2);switch(r){case"top-right":case"top-left":h=p-7;break;case"bottom-right":case"bottom-left":h=7-p;break;case"bottom":h=7-o;break;case"top":h=o-7}switch(r){case"top-right":case"bottom-right":c=-p;break;case"top-left":case"bottom-left":c=p;break;case"left":c=o;break;case"right":c=-o}return[c,h]}(i,e[0])}function nc(i){switch(i){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function Kd(i,e,r,o,c,h,p,m,g,x,w){let E=h.textMaxSize.evaluate(e,{});E===void 0&&(E=p);const A=i.layers[0].layout,M=A.get("icon-offset").evaluate(e,{},w),z=zu(r.horizontal),$=p/24,U=i.tilePixelRatio*$,ee=i.tilePixelRatio*E/24,oe=i.tilePixelRatio*m,Y=i.tilePixelRatio*A.get("symbol-spacing"),re=A.get("text-padding")*i.tilePixelRatio,fe=function(be,qe,Ne,rt=1){const Pt=be.get("icon-padding").evaluate(qe,{},Ne),Ft=Pt&&Pt.values;return[Ft[0]*rt,Ft[1]*rt,Ft[2]*rt,Ft[3]*rt]}(A,e,w,i.tilePixelRatio),pe=A.get("text-max-angle")/180*Math.PI,Be=A.get("text-rotation-alignment")!=="viewport"&&A.get("symbol-placement")!=="point",Ue=A.get("icon-rotation-alignment")==="map"&&A.get("symbol-placement")!=="point",Pe=A.get("symbol-placement"),Ae=Y/2,we=A.get("icon-text-fit");let ke;o&&we!=="none"&&(i.allowVerticalPlacement&&r.vertical&&(ke=yu(o,r.vertical,we,A.get("icon-text-fit-padding"),M,$)),z&&(o=yu(o,z,we,A.get("icon-text-fit-padding"),M,$)));const Me=(be,qe)=>{qe.x<0||qe.x>=Kt||qe.y<0||qe.y>=Kt||function(Ne,rt,Pt,Ft,Jt,Ji,ci,jt,ri,ui,mi,Pi,Xt,hi,gi,Ti,ki,Di,Ot,ni,st,Ni,di,_i,sr){const br=Ne.addToLineVertexArray(rt,Pt);let wr,an,ar,Yi,Li=0,ln=0,Hs=0,ju=0,fc=-1,mc=-1;const cn={};let Xu=ii.exports(""),gc=0,_c=0;if(jt._unevaluatedLayout.getValue("text-radial-offset")===void 0?[gc,_c]=jt.layout.get("text-offset").evaluate(st,{},_i).map(Ri=>Ri*ai):(gc=jt.layout.get("text-radial-offset").evaluate(st,{},_i)*ai,_c=rc),Ne.allowVerticalPlacement&&Ft.vertical){const Ri=jt.layout.get("text-rotate").evaluate(st,{},_i)+90;ar=new rl(ri,rt,ui,mi,Pi,Ft.vertical,Xt,hi,gi,Ri),ci&&(Yi=new rl(ri,rt,ui,mi,Pi,ci,ki,Di,gi,Ri))}if(Jt){const Ri=jt.layout.get("icon-rotate").evaluate(st,{}),Nr=jt.layout.get("icon-text-fit")!=="none",Ks=Iu(Jt,Ri,di,Nr),Js=ci?Iu(ci,Ri,di,Nr):void 0;an=new rl(ri,rt,ui,mi,Pi,Jt,ki,Di,!1,Ri),Li=4*Ks.length;const Ku=Ne.iconSizeData;let xo=null;Ku.kind==="source"?(xo=[sn*jt.layout.get("icon-size").evaluate(st,{})],xo[0]>On&&$t(`${Ne.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)):Ku.kind==="composite"&&(xo=[sn*Ni.compositeIconSizes[0].evaluate(st,{},_i),sn*Ni.compositeIconSizes[1].evaluate(st,{},_i)],(xo[0]>On||xo[1]>On)&&$t(`${Ne.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),Ne.addSymbols(Ne.icon,Ks,xo,ni,Ot,st,l.WritingMode.none,rt,br.lineStartIndex,br.lineLength,-1,_i),fc=Ne.icon.placedSymbolArray.length-1,Js&&(ln=4*Js.length,Ne.addSymbols(Ne.icon,Js,xo,ni,Ot,st,l.WritingMode.vertical,rt,br.lineStartIndex,br.lineLength,-1,_i),mc=Ne.icon.placedSymbolArray.length-1)}const Wu=Object.keys(Ft.horizontal);for(const Ri of Wu){const Nr=Ft.horizontal[Ri];if(!wr){Xu=ii.exports(Nr.text);const Js=jt.layout.get("text-rotate").evaluate(st,{},_i);wr=new rl(ri,rt,ui,mi,Pi,Nr,Xt,hi,gi,Js)}const Ks=Nr.positionedLines.length===1;if(Hs+=Mu(Ne,rt,Nr,Ji,jt,gi,st,Ti,br,Ft.vertical?l.WritingMode.horizontal:l.WritingMode.horizontalOnly,Ks?Wu:[Ri],cn,fc,Ni,_i),Ks)break}Ft.vertical&&(ju+=Mu(Ne,rt,Ft.vertical,Ji,jt,gi,st,Ti,br,l.WritingMode.vertical,["vertical"],cn,mc,Ni,_i));const cp=wr?wr.boxStartIndex:Ne.collisionBoxArray.length,up=wr?wr.boxEndIndex:Ne.collisionBoxArray.length,hp=ar?ar.boxStartIndex:Ne.collisionBoxArray.length,dp=ar?ar.boxEndIndex:Ne.collisionBoxArray.length,pp=an?an.boxStartIndex:Ne.collisionBoxArray.length,fp=an?an.boxEndIndex:Ne.collisionBoxArray.length,mp=Yi?Yi.boxStartIndex:Ne.collisionBoxArray.length,gp=Yi?Yi.boxEndIndex:Ne.collisionBoxArray.length;let Tr=-1;const ll=(Ri,Nr)=>Ri&&Ri.circleDiameter?Math.max(Ri.circleDiameter,Nr):Nr;Tr=ll(wr,Tr),Tr=ll(ar,Tr),Tr=ll(an,Tr),Tr=ll(Yi,Tr);const Hu=Tr>-1?1:0;Hu&&(Tr*=sr/ai),Ne.glyphOffsetArray.length>=Yo.MAX_GLYPHS&&$t("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),st.sortKey!==void 0&&Ne.addToSortKeyRanges(Ne.symbolInstances.length,st.sortKey),Ne.symbolInstances.emplaceBack(rt.x,rt.y,cn.right>=0?cn.right:-1,cn.center>=0?cn.center:-1,cn.left>=0?cn.left:-1,cn.vertical||-1,fc,mc,Xu,cp,up,hp,dp,pp,fp,mp,gp,ui,Hs,ju,Li,ln,Hu,0,Xt,gc,_c,Tr)}(i,qe,be,r,o,c,ke,i.layers[0],i.collisionBoxArray,e.index,e.sourceLayerIndex,i.index,U,[re,re,re,re],Be,g,oe,fe,Ue,M,e,h,x,w,p)};if(Pe==="line")for(const be of Su(e.geometry,0,0,Kt,Kt)){const qe=Zd(be,Y,pe,r.vertical||z,o,24,ee,i.overscaling,Kt);for(const Ne of qe){const rt=z;rt&&Jd(i,rt.text,Ae,Ne)||Me(be,Ne)}}else if(Pe==="line-center"){for(const be of e.geometry)if(be.length>1){const qe=qd(be,pe,r.vertical||z,o,24,ee);qe&&Me(be,qe)}}else if(e.type==="Polygon")for(const be of Zl(e.geometry,0)){const qe=Wd(be,16);Me(be[0],new Fn(qe.x,qe.y,0))}else if(e.type==="LineString")for(const be of e.geometry)Me(be,new Fn(be[0].x,be[0].y,0));else if(e.type==="Point")for(const be of e.geometry)for(const qe of be)Me([qe],new Fn(qe.x,qe.y,0))}const On=32640;function Mu(i,e,r,o,c,h,p,m,g,x,w,E,A,M,z){const $=function(oe,Y,re,fe,pe,Be,Ue,Pe){const Ae=fe.layout.get("text-rotate").evaluate(Be,{})*Math.PI/180,we=[];for(const ke of Y.positionedLines)for(const Me of ke.positionedGlyphs){if(!Me.rect)continue;const be=Me.rect||{};let qe=4,Ne=!0,rt=1,Pt=0;const Ft=(pe||Pe)&&Me.vertical,Jt=Me.metrics.advance*Me.scale/2;if(Pe&&Y.verticalizable){const Ot=(Me.scale-1)*ai,ni=(ai-Me.metrics.width*Me.scale)/2;Pt=ke.lineOffset/2-(Me.imageName?-ni:Ot)}if(Me.imageName){const Ot=Ue[Me.imageName];Ne=Ot.sdf,rt=Ot.pixelRatio,qe=1/rt}const Ji=pe?[Me.x+Jt,Me.y]:[0,0];let ci=pe?[0,0]:[Me.x+Jt+re[0],Me.y+re[1]-Pt],jt=[0,0];Ft&&(jt=ci,ci=[0,0]);const ri=(Me.metrics.left-qe)*Me.scale-Jt+ci[0],ui=(-Me.metrics.top-qe)*Me.scale+ci[1],mi=ri+be.w*Me.scale/rt,Pi=ui+be.h*Me.scale/rt,Xt=new We(ri,ui),hi=new We(mi,ui),gi=new We(ri,Pi),Ti=new We(mi,Pi);if(Ft){const Ot=new We(-Jt,Jt-Ja),ni=-Math.PI/2,st=12-Jt,Ni=new We(22-st,-(Me.imageName?st:0)),di=new We(...jt);Xt._rotateAround(ni,Ot)._add(Ni)._add(di),hi._rotateAround(ni,Ot)._add(Ni)._add(di),gi._rotateAround(ni,Ot)._add(Ni)._add(di),Ti._rotateAround(ni,Ot)._add(Ni)._add(di)}if(Ae){const Ot=Math.sin(Ae),ni=Math.cos(Ae),st=[ni,-Ot,Ot,ni];Xt._matMult(st),hi._matMult(st),gi._matMult(st),Ti._matMult(st)}const ki=new We(0,0),Di=new We(0,0);we.push({tl:Xt,tr:hi,bl:gi,br:Ti,tex:be,writingMode:Y.writingMode,glyphOffset:Ji,sectionIndex:Me.sectionIndex,isSDF:Ne,pixelOffsetTL:ki,pixelOffsetBR:Di,minFontScaleX:0,minFontScaleY:0})}return we}(0,r,m,c,h,p,o,i.allowVerticalPlacement),U=i.textSizeData;let ee=null;U.kind==="source"?(ee=[sn*c.layout.get("text-size").evaluate(p,{})],ee[0]>On&&$t(`${i.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)):U.kind==="composite"&&(ee=[sn*M.compositeTextSizes[0].evaluate(p,{},z),sn*M.compositeTextSizes[1].evaluate(p,{},z)],(ee[0]>On||ee[1]>On)&&$t(`${i.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),i.addSymbols(i.text,$,ee,m,h,p,x,e,g.lineStartIndex,g.lineLength,A,z);for(const oe of w)E[oe]=i.text.placedSymbolArray.length-1;return 4*$.length}function zu(i){for(const e in i)return i[e];return null}function Jd(i,e,r,o){const c=i.compareText;if(e in c){const h=c[e];for(let p=h.length-1;p>=0;p--)if(o.dist(h[p])<r)return!0}else c[e]=[];return c[e].push(o),!1}const Yd=Rn.VectorTileFeature.types,Qd=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function nl(i,e,r,o,c,h,p,m,g,x,w,E,A){const M=m?Math.min(On,Math.round(m[0])):0,z=m?Math.min(On,Math.round(m[1])):0;i.emplaceBack(e,r,Math.round(32*o),Math.round(32*c),h,p,(M<<1)+(g?1:0),z,16*x,16*w,256*E,256*A)}function oc(i,e,r){i.emplaceBack(e.x,e.y,r),i.emplaceBack(e.x,e.y,r),i.emplaceBack(e.x,e.y,r),i.emplaceBack(e.x,e.y,r)}function ep(i){for(const e of i.sections)if(Da(e.text))return!0;return!1}class sc{constructor(e){this.layoutVertexArray=new nr,this.indexArray=new vi,this.programConfigurations=e,this.segments=new ot,this.dynamicLayoutVertexArray=new Wi,this.opacityVertexArray=new or,this.placedSymbolArray=new ye}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(e,r,o,c){this.isEmpty()||(o&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Td.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,r),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,Ed.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,Qd,!0),this.opacityVertexBuffer.itemSize=1),(o||c)&&this.programConfigurations.upload(e))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}}Fe("SymbolBuffers",sc);class ac{constructor(e,r,o){this.layoutVertexArray=new e,this.layoutAttributes=r,this.indexArray=new o,this.segments=new ot,this.collisionVertexArray=new $i}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,Sd.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}Fe("CollisionBuffers",ac);class Yo{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(p=>p.id),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=Ul([]),this.placementViewportMatrix=Ul([]);const r=this.layers[0]._unevaluatedLayout._values;this.textSizeData=xu(this.zoom,r["text-size"]),this.iconSizeData=xu(this.zoom,r["icon-size"]);const o=this.layers[0].layout,c=o.get("symbol-sort-key"),h=o.get("symbol-z-order");this.canOverlap=cc(o,"text-overlap","text-allow-overlap")!=="never"||cc(o,"icon-overlap","icon-allow-overlap")!=="never"||o.get("text-ignore-placement")||o.get("icon-ignore-placement"),this.sortFeaturesByKey=h!=="viewport-y"&&!c.isConstant(),this.sortFeaturesByY=(h==="viewport-y"||h==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,o.get("symbol-placement")==="point"&&(this.writingModes=o.get("text-writing-mode").map(p=>l.WritingMode[p])),this.stateDependentLayerIds=this.layers.filter(p=>p.isStateDependent()).map(p=>p.id),this.sourceID=e.sourceID}createArrays(){this.text=new sc(new fo(this.layers,this.zoom,e=>/^text/.test(e))),this.icon=new sc(new fo(this.layers,this.zoom,e=>/^icon/.test(e))),this.glyphOffsetArray=new Ie,this.lineVertexArray=new Re,this.symbolInstances=new Le}calculateGlyphDependencies(e,r,o,c,h){for(let p=0;p<e.length;p++)if(r[e.charCodeAt(p)]=!0,(o||c)&&h){const m=Zs[e.charAt(p)];m&&(r[m.charCodeAt(0)]=!0)}}populate(e,r,o){const c=this.layers[0],h=c.layout,p=h.get("text-font"),m=h.get("text-field"),g=h.get("icon-image"),x=(m.value.kind!=="constant"||m.value.value instanceof Z&&!m.value.value.isEmpty()||m.value.value.toString().length>0)&&(p.value.kind!=="constant"||p.value.value.length>0),w=g.value.kind!=="constant"||!!g.value.value||Object.keys(g.parameters).length>0,E=h.get("symbol-sort-key");if(this.features=[],!x&&!w)return;const A=r.iconDependencies,M=r.glyphDependencies,z=r.availableImages,$=new Rt(this.zoom);for(const{feature:U,id:ee,index:oe,sourceLayerIndex:Y}of e){const re=c._featureFilter.needGeometry,fe=go(U,re);if(!c._featureFilter.filter($,fe,o))continue;let pe,Be;if(re||(fe.geometry=mo(U)),x){const Pe=c.getValueAndResolveTokens("text-field",fe,o,z),Ae=Z.factory(Pe);ep(Ae)&&(this.hasRTLText=!0),(!this.hasRTLText||uo()==="unavailable"||this.hasRTLText&&Ui.isParsed())&&(pe=Ad(Ae,c,fe))}if(w){const Pe=c.getValueAndResolveTokens("icon-image",fe,o,z);Be=Pe instanceof K?Pe:K.fromString(Pe)}if(!pe&&!Be)continue;const Ue=this.sortFeaturesByKey?E.evaluate(fe,{},o):void 0;if(this.features.push({id:ee,text:pe,icon:Be,index:oe,sourceLayerIndex:Y,geometry:fe.geometry,properties:U.properties,type:Yd[U.type],sortKey:Ue}),Be&&(A[Be.name]=!0),pe){const Pe=p.evaluate(fe,{},o).join(","),Ae=h.get("text-rotation-alignment")!=="viewport"&&h.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(l.WritingMode.vertical)>=0;for(const we of pe.sections)if(we.image)A[we.image.name]=!0;else{const ke=$o(pe.toString()),Me=we.fontStack||Pe,be=M[Me]=M[Me]||{};this.calculateGlyphDependencies(we.text,be,Ae,this.allowVerticalPlacement,ke)}}}h.get("symbol-placement")==="line"&&(this.features=function(U){const ee={},oe={},Y=[];let re=0;function fe(Pe){Y.push(U[Pe]),re++}function pe(Pe,Ae,we){const ke=oe[Pe];return delete oe[Pe],oe[Ae]=ke,Y[ke].geometry[0].pop(),Y[ke].geometry[0]=Y[ke].geometry[0].concat(we[0]),ke}function Be(Pe,Ae,we){const ke=ee[Ae];return delete ee[Ae],ee[Pe]=ke,Y[ke].geometry[0].shift(),Y[ke].geometry[0]=we[0].concat(Y[ke].geometry[0]),ke}function Ue(Pe,Ae,we){const ke=we?Ae[0][Ae[0].length-1]:Ae[0][0];return`${Pe}:${ke.x}:${ke.y}`}for(let Pe=0;Pe<U.length;Pe++){const Ae=U[Pe],we=Ae.geometry,ke=Ae.text?Ae.text.toString():null;if(!ke){fe(Pe);continue}const Me=Ue(ke,we),be=Ue(ke,we,!0);if(Me in oe&&be in ee&&oe[Me]!==ee[be]){const qe=Be(Me,be,we),Ne=pe(Me,be,Y[qe].geometry);delete ee[Me],delete oe[be],oe[Ue(ke,Y[Ne].geometry,!0)]=Ne,Y[qe].geometry=null}else Me in oe?pe(Me,be,we):be in ee?Be(Me,be,we):(fe(Pe),ee[Me]=re-1,oe[be]=re-1)}return Y.filter(Pe=>Pe.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((U,ee)=>U.sortKey-ee.sortKey)}update(e,r,o){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,r,this.layers,o),this.icon.programConfigurations.updatePaintArrays(e,r,this.layers,o))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(e,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(e,r){const o=this.lineVertexArray.length;if(e.segment!==void 0){let c=e.dist(r[e.segment+1]),h=e.dist(r[e.segment]);const p={};for(let m=e.segment+1;m<r.length;m++)p[m]={x:r[m].x,y:r[m].y,tileUnitDistanceFromAnchor:c},m<r.length-1&&(c+=r[m+1].dist(r[m]));for(let m=e.segment||0;m>=0;m--)p[m]={x:r[m].x,y:r[m].y,tileUnitDistanceFromAnchor:h},m>0&&(h+=r[m-1].dist(r[m]));for(let m=0;m<r.length;m++){const g=p[m];this.lineVertexArray.emplaceBack(g.x,g.y,g.tileUnitDistanceFromAnchor)}}return{lineStartIndex:o,lineLength:this.lineVertexArray.length-o}}addSymbols(e,r,o,c,h,p,m,g,x,w,E,A){const M=e.indexArray,z=e.layoutVertexArray,$=e.segments.prepareSegment(4*r.length,z,M,this.canOverlap?p.sortKey:void 0),U=this.glyphOffsetArray.length,ee=$.vertexLength,oe=this.allowVerticalPlacement&&m===l.WritingMode.vertical?Math.PI/2:0,Y=p.text&&p.text.sections;for(let re=0;re<r.length;re++){const{tl:fe,tr:pe,bl:Be,br:Ue,tex:Pe,pixelOffsetTL:Ae,pixelOffsetBR:we,minFontScaleX:ke,minFontScaleY:Me,glyphOffset:be,isSDF:qe,sectionIndex:Ne}=r[re],rt=$.vertexLength,Pt=be[1];nl(z,g.x,g.y,fe.x,Pt+fe.y,Pe.x,Pe.y,o,qe,Ae.x,Ae.y,ke,Me),nl(z,g.x,g.y,pe.x,Pt+pe.y,Pe.x+Pe.w,Pe.y,o,qe,we.x,Ae.y,ke,Me),nl(z,g.x,g.y,Be.x,Pt+Be.y,Pe.x,Pe.y+Pe.h,o,qe,Ae.x,we.y,ke,Me),nl(z,g.x,g.y,Ue.x,Pt+Ue.y,Pe.x+Pe.w,Pe.y+Pe.h,o,qe,we.x,we.y,ke,Me),oc(e.dynamicLayoutVertexArray,g,oe),M.emplaceBack(rt,rt+1,rt+2),M.emplaceBack(rt+1,rt+2,rt+3),$.vertexLength+=4,$.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(be[0]),re!==r.length-1&&Ne===r[re+1].sectionIndex||e.programConfigurations.populatePaintArrays(z.length,p,p.index,{},A,Y&&Y[Ne])}e.placedSymbolArray.emplaceBack(g.x,g.y,U,this.glyphOffsetArray.length-U,ee,x,w,g.segment,o?o[0]:0,o?o[1]:0,c[0],c[1],m,0,!1,0,E)}_addCollisionDebugVertex(e,r,o,c,h,p){return r.emplaceBack(0,0),e.emplaceBack(o.x,o.y,c,h,Math.round(p.x),Math.round(p.y))}addCollisionDebugVertices(e,r,o,c,h,p,m){const g=h.segments.prepareSegment(4,h.layoutVertexArray,h.indexArray),x=g.vertexLength,w=h.layoutVertexArray,E=h.collisionVertexArray,A=m.anchorX,M=m.anchorY;this._addCollisionDebugVertex(w,E,p,A,M,new We(e,r)),this._addCollisionDebugVertex(w,E,p,A,M,new We(o,r)),this._addCollisionDebugVertex(w,E,p,A,M,new We(o,c)),this._addCollisionDebugVertex(w,E,p,A,M,new We(e,c)),g.vertexLength+=4;const z=h.indexArray;z.emplaceBack(x,x+1),z.emplaceBack(x+1,x+2),z.emplaceBack(x+2,x+3),z.emplaceBack(x+3,x),g.primitiveLength+=4}addDebugCollisionBoxes(e,r,o,c){for(let h=e;h<r;h++){const p=this.collisionBoxArray.get(h);this.addCollisionDebugVertices(p.x1,p.y1,p.x2,p.y2,c?this.textCollisionBox:this.iconCollisionBox,p.anchorPoint,o)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new ac($r,ou.members,xr),this.iconCollisionBox=new ac($r,ou.members,xr);for(let e=0;e<this.symbolInstances.length;e++){const r=this.symbolInstances.get(e);this.addDebugCollisionBoxes(r.textBoxStartIndex,r.textBoxEndIndex,r,!0),this.addDebugCollisionBoxes(r.verticalTextBoxStartIndex,r.verticalTextBoxEndIndex,r,!0),this.addDebugCollisionBoxes(r.iconBoxStartIndex,r.iconBoxEndIndex,r,!1),this.addDebugCollisionBoxes(r.verticalIconBoxStartIndex,r.verticalIconBoxEndIndex,r,!1)}}_deserializeCollisionBoxesForSymbol(e,r,o,c,h,p,m,g,x){const w={};for(let E=r;E<o;E++){const A=e.get(E);w.textBox={x1:A.x1,y1:A.y1,x2:A.x2,y2:A.y2,anchorPointX:A.anchorPointX,anchorPointY:A.anchorPointY},w.textFeatureIndex=A.featureIndex;break}for(let E=c;E<h;E++){const A=e.get(E);w.verticalTextBox={x1:A.x1,y1:A.y1,x2:A.x2,y2:A.y2,anchorPointX:A.anchorPointX,anchorPointY:A.anchorPointY},w.verticalTextFeatureIndex=A.featureIndex;break}for(let E=p;E<m;E++){const A=e.get(E);w.iconBox={x1:A.x1,y1:A.y1,x2:A.x2,y2:A.y2,anchorPointX:A.anchorPointX,anchorPointY:A.anchorPointY},w.iconFeatureIndex=A.featureIndex;break}for(let E=g;E<x;E++){const A=e.get(E);w.verticalIconBox={x1:A.x1,y1:A.y1,x2:A.x2,y2:A.y2,anchorPointX:A.anchorPointX,anchorPointY:A.anchorPointY},w.verticalIconFeatureIndex=A.featureIndex;break}return w}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let r=0;r<this.symbolInstances.length;r++){const o=this.symbolInstances.get(r);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,o.textBoxStartIndex,o.textBoxEndIndex,o.verticalTextBoxStartIndex,o.verticalTextBoxEndIndex,o.iconBoxStartIndex,o.iconBoxEndIndex,o.verticalIconBoxStartIndex,o.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(e,r){const o=e.placedSymbolArray.get(r),c=o.vertexStartIndex+4*o.numGlyphs;for(let h=o.vertexStartIndex;h<c;h+=4)e.indexArray.emplaceBack(h,h+1,h+2),e.indexArray.emplaceBack(h+1,h+2,h+3)}getSortedSymbolIndexes(e){if(this.sortedAngle===e&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const r=Math.sin(e),o=Math.cos(e),c=[],h=[],p=[];for(let m=0;m<this.symbolInstances.length;++m){p.push(m);const g=this.symbolInstances.get(m);c.push(0|Math.round(r*g.anchorX+o*g.anchorY)),h.push(g.featureIndex)}return p.sort((m,g)=>c[m]-c[g]||h[g]-h[m]),p}addToSortKeyRanges(e,r){const o=this.sortKeyRanges[this.sortKeyRanges.length-1];o&&o.sortKey===r?o.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:r,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const r of this.symbolInstanceIndexes){const o=this.symbolInstances.get(r);this.featureSortOrder.push(o.featureIndex),[o.rightJustifiedTextSymbolIndex,o.centerJustifiedTextSymbolIndex,o.leftJustifiedTextSymbolIndex].forEach((c,h,p)=>{c>=0&&p.indexOf(c)===h&&this.addIndicesForPlacedSymbol(this.text,c)}),o.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,o.verticalPlacedTextSymbolIndex),o.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,o.placedIconSymbolIndex),o.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,o.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}Fe("SymbolBucket",Yo,{omit:["layers","collisionBoxArray","features","compareText"]}),Yo.MAX_GLYPHS=65535,Yo.addDynamicAttributes=oc;const tp=new si({"symbol-placement":new Ve(de.layout_symbol["symbol-placement"]),"symbol-spacing":new Ve(de.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Ve(de.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new je(de.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Ve(de.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Ve(de.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Ve(de.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Ve(de.layout_symbol["icon-ignore-placement"]),"icon-optional":new Ve(de.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Ve(de.layout_symbol["icon-rotation-alignment"]),"icon-size":new je(de.layout_symbol["icon-size"]),"icon-text-fit":new Ve(de.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Ve(de.layout_symbol["icon-text-fit-padding"]),"icon-image":new je(de.layout_symbol["icon-image"]),"icon-rotate":new je(de.layout_symbol["icon-rotate"]),"icon-padding":new je(de.layout_symbol["icon-padding"]),"icon-keep-upright":new Ve(de.layout_symbol["icon-keep-upright"]),"icon-offset":new je(de.layout_symbol["icon-offset"]),"icon-anchor":new je(de.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Ve(de.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Ve(de.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Ve(de.layout_symbol["text-rotation-alignment"]),"text-field":new je(de.layout_symbol["text-field"]),"text-font":new je(de.layout_symbol["text-font"]),"text-size":new je(de.layout_symbol["text-size"]),"text-max-width":new je(de.layout_symbol["text-max-width"]),"text-line-height":new Ve(de.layout_symbol["text-line-height"]),"text-letter-spacing":new je(de.layout_symbol["text-letter-spacing"]),"text-justify":new je(de.layout_symbol["text-justify"]),"text-radial-offset":new je(de.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Ve(de.layout_symbol["text-variable-anchor"]),"text-anchor":new je(de.layout_symbol["text-anchor"]),"text-max-angle":new Ve(de.layout_symbol["text-max-angle"]),"text-writing-mode":new Ve(de.layout_symbol["text-writing-mode"]),"text-rotate":new je(de.layout_symbol["text-rotate"]),"text-padding":new Ve(de.layout_symbol["text-padding"]),"text-keep-upright":new Ve(de.layout_symbol["text-keep-upright"]),"text-transform":new je(de.layout_symbol["text-transform"]),"text-offset":new je(de.layout_symbol["text-offset"]),"text-allow-overlap":new Ve(de.layout_symbol["text-allow-overlap"]),"text-overlap":new Ve(de.layout_symbol["text-overlap"]),"text-ignore-placement":new Ve(de.layout_symbol["text-ignore-placement"]),"text-optional":new Ve(de.layout_symbol["text-optional"])});var lc={paint:new si({"icon-opacity":new je(de.paint_symbol["icon-opacity"]),"icon-color":new je(de.paint_symbol["icon-color"]),"icon-halo-color":new je(de.paint_symbol["icon-halo-color"]),"icon-halo-width":new je(de.paint_symbol["icon-halo-width"]),"icon-halo-blur":new je(de.paint_symbol["icon-halo-blur"]),"icon-translate":new Ve(de.paint_symbol["icon-translate"]),"icon-translate-anchor":new Ve(de.paint_symbol["icon-translate-anchor"]),"text-opacity":new je(de.paint_symbol["text-opacity"]),"text-color":new je(de.paint_symbol["text-color"],{runtimeType:oi,getOverride:i=>i.textColor,hasOverride:i=>!!i.textColor}),"text-halo-color":new je(de.paint_symbol["text-halo-color"]),"text-halo-width":new je(de.paint_symbol["text-halo-width"]),"text-halo-blur":new je(de.paint_symbol["text-halo-blur"]),"text-translate":new Ve(de.paint_symbol["text-translate"]),"text-translate-anchor":new Ve(de.paint_symbol["text-translate-anchor"])}),layout:tp};class Pu{constructor(e){if(e.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=e.property.overrides?e.property.overrides.runtimeType:kr,this.defaultValue=e}evaluate(e){if(e.formattedSection){const r=this.defaultValue.property.overrides;if(r&&r.hasOverride(e.formattedSection))return r.getOverride(e.formattedSection)}return e.feature&&e.featureState?this.defaultValue.evaluate(e.feature,e.featureState):this.defaultValue.property.specification.default}eachChild(e){this.defaultValue.isConstant()||e(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}Fe("FormatSectionOverride",Pu,{omit:["defaultValue"]});class ol extends rr{constructor(e){super(e,lc)}recalculate(e,r){if(super.recalculate(e,r),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout._values["icon-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout._values["text-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")==="map"?"map":"viewport"),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),this.layout.get("symbol-placement")==="point"){const o=this.layout.get("text-writing-mode");if(o){const c=[];for(const h of o)c.indexOf(h)<0&&c.push(h);this.layout._values["text-writing-mode"]=c}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(e,r,o,c){const h=this.layout.get(e).evaluate(r,{},o,c),p=this._unevaluatedLayout._values[e];return p.isDataDriven()||Jn(p.value)||!h?h:function(m,g){return g.replace(/{([^{}]+)}/g,(x,w)=>w in m?String(m[w]):"")}(r.properties,h)}createBucket(e){return new Yo(e)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const e of lc.paint.overridableProperties){if(!ol.hasPaintOverride(this.layout,e))continue;const r=this.paint.get(e),o=new Pu(r),c=new Lo(o,r.property.specification);let h=null;h=r.value.kind==="constant"||r.value.kind==="source"?new Qn("source",c):new xs("composite",c,r.value.zoomStops),this.paint._values[e]=new ir(r.property,h,r.parameters)}}_handleOverridablePaintPropertyUpdate(e,r,o){return!(!this.layout||r.isDataDriven()||o.isDataDriven())&&ol.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,r){const o=e.get("text-field"),c=lc.paint.properties[r];let h=!1;const p=m=>{for(const g of m)if(c.overrides&&c.overrides.hasOverride(g))return void(h=!0)};if(o.value.kind==="constant"&&o.value.value instanceof Z)p(o.value.value.sections);else if(o.value.kind==="source"){const m=x=>{h||(x instanceof $e&&ae(x.value)===Yt?p(x.value.sections):x instanceof ko?p(x.sections):x.eachChild(m))},g=o.value;g._styleExpression&&m(g._styleExpression.expression)}return h}}function cc(i,e,r){let o="never";const c=i.get(e);return c?o=c:i.get(r)&&(o="always"),o}var ip={paint:new si({"background-color":new Ve(de.paint_background["background-color"]),"background-pattern":new Ps(de.paint_background["background-pattern"]),"background-opacity":new Ve(de.paint_background["background-opacity"])})},rp={paint:new si({"raster-opacity":new Ve(de.paint_raster["raster-opacity"]),"raster-hue-rotate":new Ve(de.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Ve(de.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Ve(de.paint_raster["raster-brightness-max"]),"raster-saturation":new Ve(de.paint_raster["raster-saturation"]),"raster-contrast":new Ve(de.paint_raster["raster-contrast"]),"raster-resampling":new Ve(de.paint_raster["raster-resampling"]),"raster-fade-duration":new Ve(de.paint_raster["raster-fade-duration"])})};class np extends rr{constructor(e){super(e,{}),this.onAdd=r=>{this.implementation.onAdd&&this.implementation.onAdd(r,r.painter.context.gl)},this.onRemove=r=>{this.implementation.onRemove&&this.implementation.onRemove(r,r.painter.context.gl)},this.implementation=e}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}}const op={circle:class extends rr{constructor(i){super(i,Bh)}createBucket(i){return new Bl(i)}queryRadius(i){const e=i;return Bs("circle-radius",this,e)+Bs("circle-stroke-width",this,e)+Na(this.paint.get("circle-translate"))}queryIntersectsFeature(i,e,r,o,c,h,p,m){const g=Ga(i,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),h.angle,p),x=this.paint.get("circle-radius").evaluate(e,r)+this.paint.get("circle-stroke-width").evaluate(e,r),w=this.paint.get("circle-pitch-alignment")==="map",E=w?g:function(M,z){return M.map($=>Nc($,z))}(g,m),A=w?x*p:x;for(const M of o)for(const z of M){const $=w?z:Nc(z,m);let U=A;const ee=qa([],[z.x,z.y,0,1],m);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?U*=ee[3]/h.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(U*=h.cameraToCenterDistance/ee[3]),Ph(E,$,U))return!0}return!1}},heatmap:class extends rr{constructor(i){super(i,Oh),this._updateColorRamp()}createBucket(i){return new Gc(i)}_handleSpecialPaintPropertyUpdate(i){i==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=Zc({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}},hillshade:class extends rr{constructor(i){super(i,Uh)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}},fill:class extends rr{constructor(i){super(i,td)}recalculate(i,e){super.recalculate(i,e);const r=this.paint._values["fill-outline-color"];r.value.kind==="constant"&&r.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(i){return new Wl(i)}queryRadius(){return Na(this.paint.get("fill-translate"))}queryIntersectsFeature(i,e,r,o,c,h,p){return Lc(Ga(i,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),h.angle,p),o)}isTileClipped(){return!0}},"fill-extrusion":class extends rr{constructor(i){super(i,md)}createBucket(i){return new Kl(i)}queryRadius(){return Na(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(i,e,r,o,c,h,p,m){const g=Ga(i,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),h.angle,p),x=this.paint.get("fill-extrusion-height").evaluate(e,r),w=this.paint.get("fill-extrusion-base").evaluate(e,r),E=function(M,z,$,U){const ee=[];for(const oe of M){const Y=[oe.x,oe.y,0,1];qa(Y,Y,z),ee.push(new We(Y[0]/Y[3],Y[1]/Y[3]))}return ee}(g,m),A=function(M,z,$,U){const ee=[],oe=[],Y=U[8]*z,re=U[9]*z,fe=U[10]*z,pe=U[11]*z,Be=U[8]*$,Ue=U[9]*$,Pe=U[10]*$,Ae=U[11]*$;for(const we of M){const ke=[],Me=[];for(const be of we){const qe=be.x,Ne=be.y,rt=U[0]*qe+U[4]*Ne+U[12],Pt=U[1]*qe+U[5]*Ne+U[13],Ft=U[2]*qe+U[6]*Ne+U[14],Jt=U[3]*qe+U[7]*Ne+U[15],Ji=Ft+fe,ci=Jt+pe,jt=rt+Be,ri=Pt+Ue,ui=Ft+Pe,mi=Jt+Ae,Pi=new We((rt+Y)/ci,(Pt+re)/ci);Pi.z=Ji/ci,ke.push(Pi);const Xt=new We(jt/mi,ri/mi);Xt.z=ui/mi,Me.push(Xt)}ee.push(ke),oe.push(Me)}return[ee,oe]}(o,w,x,m);return function(M,z,$){let U=1/0;Lc($,z)&&(U=eu($,z[0]));for(let ee=0;ee<z.length;ee++){const oe=z[ee],Y=M[ee];for(let re=0;re<oe.length-1;re++){const fe=oe[re],pe=[fe,oe[re+1],Y[re+1],Y[re],fe];Dc($,pe)&&(U=Math.min(U,eu($,pe)))}}return U!==1/0&&U}(A[0],A[1],E)}},line:class extends rr{constructor(i){super(i,iu),this.gradientVersion=0}_handleSpecialPaintPropertyUpdate(i){i==="line-gradient"&&(this.stepInterpolant=this._transitionablePaint._values["line-gradient"].value.expression._styleExpression.expression instanceof jn,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER)}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(i,e){super.recalculate(i,e),this.paint._values["line-floorwidth"]=ru.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,i)}createBucket(i){return new Jl(i)}queryRadius(i){const e=i,r=nu(Bs("line-width",this,e),Bs("line-gap-width",this,e)),o=Bs("line-offset",this,e);return r/2+Math.abs(o)+Na(this.paint.get("line-translate"))}queryIntersectsFeature(i,e,r,o,c,h,p){const m=Ga(i,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),h.angle,p),g=p/2*nu(this.paint.get("line-width").evaluate(e,r),this.paint.get("line-gap-width").evaluate(e,r)),x=this.paint.get("line-offset").evaluate(e,r);return x&&(o=function(w,E){const A=[];for(let M=0;M<w.length;M++){const z=w[M],$=[];for(let U=0;U<z.length;U++){const ee=z[U-1],oe=z[U],Y=z[U+1],re=U===0?new We(0,0):oe.sub(ee)._unit()._perp(),fe=U===z.length-1?new We(0,0):Y.sub(oe)._unit()._perp(),pe=re._add(fe)._unit(),Be=pe.x*fe.x+pe.y*fe.y;Be!==0&&pe._mult(1/Be),$.push(pe._mult(E)._add(oe))}A.push($)}return A}(o,x*p)),function(w,E,A){for(let M=0;M<E.length;M++){const z=E[M];if(w.length>=3){for(let $=0;$<z.length;$++)if(Zo(w,z[$]))return!0}if(kh(w,z,A))return!0}return!1}(m,o,g)}isTileClipped(){return!0}},symbol:ol,background:class extends rr{constructor(i){super(i,ip)}},raster:class extends rr{constructor(i){super(i,rp)}}};class sp{constructor(e){this._callback=e,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._callback()},0))}remove(){delete this._channel,this._callback=()=>{}}}const ku=63710088e-1;class Nt{constructor(e,r){if(isNaN(e)||isNaN(r))throw new Error(`Invalid LngLat object: (${e}, ${r})`);if(this.lng=+e,this.lat=+r,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new Nt(gt(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){const r=Math.PI/180,o=this.lat*r,c=e.lat*r,h=Math.sin(o)*Math.sin(c)+Math.cos(o)*Math.cos(c)*Math.cos((e.lng-this.lng)*r);return ku*Math.acos(Math.min(h,1))}toBounds(e=0){const r=360*e/40075017,o=r/Math.cos(Math.PI/180*this.lat);return new yo(new Nt(this.lng-o,this.lat-r),new Nt(this.lng+o,this.lat+r))}static convert(e){if(e instanceof Nt)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new Nt(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e!==null)return new Nt(Number("lng"in e?e.lng:e.lon),Number(e.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}}class yo{constructor(e,r){e&&(r?this.setSouthWest(e).setNorthEast(r):e.length===4?this.setSouthWest([e[0],e[1]]).setNorthEast([e[2],e[3]]):this.setSouthWest(e[0]).setNorthEast(e[1]))}setNorthEast(e){return this._ne=e instanceof Nt?new Nt(e.lng,e.lat):Nt.convert(e),this}setSouthWest(e){return this._sw=e instanceof Nt?new Nt(e.lng,e.lat):Nt.convert(e),this}extend(e){const r=this._sw,o=this._ne;let c,h;if(e instanceof Nt)c=e,h=e;else{if(!(e instanceof yo))return Array.isArray(e)?e.length===4||e.every(Array.isArray)?this.extend(yo.convert(e)):this.extend(Nt.convert(e)):this;if(c=e._sw,h=e._ne,!c||!h)return this}return r||o?(r.lng=Math.min(c.lng,r.lng),r.lat=Math.min(c.lat,r.lat),o.lng=Math.max(h.lng,o.lng),o.lat=Math.max(h.lat,o.lat)):(this._sw=new Nt(c.lng,c.lat),this._ne=new Nt(h.lng,h.lat)),this}getCenter(){return new Nt((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 Nt(this.getWest(),this.getNorth())}getSouthEast(){return new Nt(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(e){const{lng:r,lat:o}=Nt.convert(e);let c=this._sw.lng<=r&&r<=this._ne.lng;return this._sw.lng>this._ne.lng&&(c=this._sw.lng>=r&&r>=this._ne.lng),this._sw.lat<=o&&o<=this._ne.lat&&c}static convert(e){return e instanceof yo?e:e&&new yo(e)}}const Du=2*Math.PI*ku;function Lu(i){return Du*Math.cos(i*Math.PI/180)}function Ru(i){return(180+i)/360}function Bu(i){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i*Math.PI/360)))/360}function Fu(i,e){return i/Lu(e)}function uc(i){return 360/Math.PI*Math.atan(Math.exp((180-360*i)*Math.PI/180))-90}class sl{constructor(e,r,o=0){this.x=+e,this.y=+r,this.z=+o}static fromLngLat(e,r=0){const o=Nt.convert(e);return new sl(Ru(o.lng),Bu(o.lat),Fu(r,o.lat))}toLngLat(){return new Nt(360*this.x-180,uc(this.y))}toAltitude(){return this.z*Lu(uc(this.y))}meterInMercatorCoordinateUnits(){return 1/Du*(e=uc(this.y),1/Math.cos(e*Math.PI/180));var e}}function Ou(i,e,r){var o=2*Math.PI*6378137/256/Math.pow(2,r);return[i*o-2*Math.PI*6378137/2,e*o-2*Math.PI*6378137/2]}class hc{constructor(e,r,o){if(e<0||e>25||o<0||o>=Math.pow(2,e)||r<0||r>=Math.pow(2,e))throw new Error(`x=${r}, y=${o}, z=${e} outside of bounds. 0<=x<${Math.pow(2,e)}, 0<=y<${Math.pow(2,e)} 0<=z<=25 `);this.z=e,this.x=r,this.y=o,this.key=Xs(0,e,e,r,o)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,r,o){const c=(p=this.y,m=this.z,g=Ou(256*(h=this.x),256*(p=Math.pow(2,m)-p-1),m),x=Ou(256*(h+1),256*(p+1),m),g[0]+","+g[1]+","+x[0]+","+x[1]);var h,p,m,g,x;const w=function(E,A,M){let z,$="";for(let U=E;U>0;U--)z=1<<U-1,$+=(A&z?1:0)+(M&z?2:0);return $}(this.z,this.x,this.y);return e[(this.x+this.y)%e.length].replace(/{prefix}/g,(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String(o==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,r>1?"@2x":"").replace(/{quadkey}/g,w).replace(/{bbox-epsg-3857}/g,c)}isChildOf(e){const r=this.z-e.z;return r>0&&e.x===this.x>>r&&e.y===this.y>>r}getTilePoint(e){const r=Math.pow(2,this.z);return new We((e.x*r-this.x)*Kt,(e.y*r-this.y)*Kt)}toString(){return`${this.z}/${this.x}/${this.y}`}}class Uu{constructor(e,r){this.wrap=e,this.canonical=r,this.key=Xs(e,r.z,r.z,r.x,r.y)}}class Ki{constructor(e,r,o,c,h){if(e<o)throw new Error(`overscaledZ should be >= z; overscaledZ = ${e}; z = ${o}`);this.overscaledZ=e,this.wrap=r,this.canonical=new hc(o,+c,+h),this.key=Xs(r,e,o,c,h)}clone(){return new Ki(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);const r=this.canonical.z-e;return e>this.canonical.z?new Ki(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Ki(e,this.wrap,e,this.canonical.x>>r,this.canonical.y>>r)}calculateScaledKey(e,r){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);const o=this.canonical.z-e;return e>this.canonical.z?Xs(this.wrap*+r,e,this.canonical.z,this.canonical.x,this.canonical.y):Xs(this.wrap*+r,e,e,this.canonical.x>>o,this.canonical.y>>o)}isChildOf(e){if(e.wrap!==this.wrap)return!1;const r=this.canonical.z-e.canonical.z;return e.overscaledZ===0||e.overscaledZ<this.overscaledZ&&e.canonical.x===this.canonical.x>>r&&e.canonical.y===this.canonical.y>>r}children(e){if(this.overscaledZ>=e)return[new Ki(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const r=this.canonical.z+1,o=2*this.canonical.x,c=2*this.canonical.y;return[new Ki(r,this.wrap,r,o,c),new Ki(r,this.wrap,r,o+1,c),new Ki(r,this.wrap,r,o,c+1),new Ki(r,this.wrap,r,o+1,c+1)]}isLessThan(e){return this.wrap<e.wrap||!(this.wrap>e.wrap)&&(this.overscaledZ<e.overscaledZ||!(this.overscaledZ>e.overscaledZ)&&(this.canonical.x<e.canonical.x||!(this.canonical.x>e.canonical.x)&&this.canonical.y<e.canonical.y))}wrapped(){return new Ki(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new Ki(this.overscaledZ,e,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new Uu(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(e){return this.canonical.getTilePoint(new sl(e.x-this.wrap,e.y))}}function Xs(i,e,r,o,c){(i*=2)<0&&(i=-1*i-1);const h=1<<r;return(h*h*i+h*c+o).toString(36)+r.toString(36)+e.toString(36)}Fe("CanonicalTileID",hc),Fe("OverscaledTileID",Ki,{omit:["posMatrix"]});class $u{constructor(e,r,o){if(this.uid=e,r.height!==r.width)throw new RangeError("DEM tiles must be square");if(o&&o!=="mapbox"&&o!=="terrarium")return void $t(`"${o}" is not a valid encoding type. Valid types include "mapbox" and "terrarium".`);this.stride=r.height;const c=this.dim=r.height-2;this.data=new Uint32Array(r.data.buffer),this.encoding=o||"mapbox";for(let h=0;h<c;h++)this.data[this._idx(-1,h)]=this.data[this._idx(0,h)],this.data[this._idx(c,h)]=this.data[this._idx(c-1,h)],this.data[this._idx(h,-1)]=this.data[this._idx(h,0)],this.data[this._idx(h,c)]=this.data[this._idx(h,c-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(c,-1)]=this.data[this._idx(c-1,0)],this.data[this._idx(-1,c)]=this.data[this._idx(0,c-1)],this.data[this._idx(c,c)]=this.data[this._idx(c-1,c-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let h=0;h<c;h++)for(let p=0;p<c;p++){const m=this.get(h,p);m>this.max&&(this.max=m),m<this.min&&(this.min=m)}}get(e,r){const o=new Uint8Array(this.data.buffer),c=4*this._idx(e,r);return(this.encoding==="terrarium"?this._unpackTerrarium:this._unpackMapbox)(o[c],o[c+1],o[c+2])}getUnpackVector(){return this.encoding==="terrarium"?[256,1,1/256,32768]:[6553.6,25.6,.1,1e4]}_idx(e,r){if(e<-1||e>=this.dim+1||r<-1||r>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(r+1)*this.stride+(e+1)}_unpackMapbox(e,r,o){return(256*e*256+256*r+o)/10-1e4}_unpackTerrarium(e,r,o){return 256*e+r+o/256-32768}getPixels(){return new Hi({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(e,r,o){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let c=r*this.dim,h=r*this.dim+this.dim,p=o*this.dim,m=o*this.dim+this.dim;switch(r){case-1:c=h-1;break;case 1:h=c+1}switch(o){case-1:p=m-1;break;case 1:m=p+1}const g=-r*this.dim,x=-o*this.dim;for(let w=p;w<m;w++)for(let E=c;E<h;E++)this.data[this._idx(E,w)]=e.data[this._idx(E+g,w+x)]}}Fe("DEMData",$u);class Vu{constructor(e){this._stringToNumber={},this._numberToString=[];for(let r=0;r<e.length;r++){const o=e[r];this._stringToNumber[o]=r,this._numberToString[r]=o}}encode(e){return this._stringToNumber[e]}decode(e){if(e>=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${e} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[e]}}class Nu{constructor(e,r,o,c,h){this.type="Feature",this._vectorTileFeature=e,e._z=r,e._x=o,e._y=c,this.properties=e.properties,this.id=h}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(e){this._geometry=e}toJSON(){const e={geometry:this.geometry};for(const r in this)r!=="_geometry"&&r!=="_vectorTileFeature"&&(e[r]=this[r]);return e}}class Gu{constructor(e,r){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new co(Kt,16,0),this.grid3D=new co(Kt,16,0),this.featureIndexArray=new it,this.promoteId=r}insert(e,r,o,c,h,p){const m=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(o,c,h);const g=p?this.grid3D:this.grid;for(let x=0;x<r.length;x++){const w=r[x],E=[1/0,1/0,-1/0,-1/0];for(let A=0;A<w.length;A++){const M=w[A];E[0]=Math.min(E[0],M.x),E[1]=Math.min(E[1],M.y),E[2]=Math.max(E[2],M.x),E[3]=Math.max(E[3],M.y)}E[0]<Kt&&E[1]<Kt&&E[2]>=0&&E[3]>=0&&g.insert(m,E[0],E[1],E[2],E[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new Rn.VectorTile(new Yl(this.rawTileData)).layers,this.sourceLayerCoder=new Vu(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(e,r,o,c){this.loadVTLayers();const h=e.params||{},p=Kt/e.tileSize/e.scale,m=Fo(h.filter),g=e.queryGeometry,x=e.queryPadding*p,w=Zu(g),E=this.grid.query(w.minX-x,w.minY-x,w.maxX+x,w.maxY+x),A=Zu(e.cameraQueryGeometry),M=this.grid3D.query(A.minX-x,A.minY-x,A.maxX+x,A.maxY+x,(U,ee,oe,Y)=>function(re,fe,pe,Be,Ue){for(const Ae of re)if(fe<=Ae.x&&pe<=Ae.y&&Be>=Ae.x&&Ue>=Ae.y)return!0;const Pe=[new We(fe,pe),new We(fe,Ue),new We(Be,Ue),new We(Be,pe)];if(re.length>2){for(const Ae of Pe)if(Zo(re,Ae))return!0}for(let Ae=0;Ae<re.length-1;Ae++)if(Lh(re[Ae],re[Ae+1],Pe))return!0;return!1}(e.cameraQueryGeometry,U-x,ee-x,oe+x,Y+x));for(const U of M)E.push(U);E.sort(ap);const z={};let $;for(let U=0;U<E.length;U++){const ee=E[U];if(ee===$)continue;$=ee;const oe=this.featureIndexArray.get(ee);let Y=null;this.loadMatchingFeature(z,oe.bucketIndex,oe.sourceLayerIndex,oe.featureIndex,m,h.layers,h.availableImages,r,o,c,(re,fe,pe)=>(Y||(Y=mo(re)),fe.queryIntersectsFeature(g,re,pe,Y,this.z,e.transform,p,e.pixelPosMatrix)))}return z}loadMatchingFeature(e,r,o,c,h,p,m,g,x,w,E){const A=this.bucketLayerIDs[r];if(p&&!function(U,ee){for(let oe=0;oe<U.length;oe++)if(ee.indexOf(U[oe])>=0)return!0;return!1}(p,A))return;const M=this.sourceLayerCoder.decode(o),z=this.vtLayers[M].feature(c);if(h.needGeometry){const U=go(z,!0);if(!h.filter(new Rt(this.tileID.overscaledZ),U,this.tileID.canonical))return}else if(!h.filter(new Rt(this.tileID.overscaledZ),z))return;const $=this.getId(z,M);for(let U=0;U<A.length;U++){const ee=A[U];if(p&&p.indexOf(ee)<0)continue;const oe=g[ee];if(!oe)continue;let Y={};$&&w&&(Y=w.getState(oe.sourceLayer||"_geojsonTileLayer",$));const re=nt({},x[ee]);re.paint=qu(re.paint,oe.paint,z,Y,m),re.layout=qu(re.layout,oe.layout,z,Y,m);const fe=!E||E(z,oe,Y);if(!fe)continue;const pe=new Nu(z,this.z,this.x,this.y,$);pe.layer=re;let Be=e[ee];Be===void 0&&(Be=e[ee]=[]),Be.push({featureIndex:c,feature:pe,intersectionZ:fe})}}lookupSymbolFeatures(e,r,o,c,h,p,m,g){const x={};this.loadVTLayers();const w=Fo(h);for(const E of e)this.loadMatchingFeature(x,o,c,E,w,p,m,g,r);return x}hasLayer(e){for(const r of this.bucketLayerIDs)for(const o of r)if(e===o)return!0;return!1}getId(e,r){let o=e.id;return this.promoteId&&(o=e.properties[typeof this.promoteId=="string"?this.promoteId:this.promoteId[r]],typeof o=="boolean"&&(o=Number(o))),o}}function qu(i,e,r,o,c){return Mt(i,(h,p)=>{const m=e instanceof po?e.get(p):null;return m&&m.evaluate?m.evaluate(r,o,c):m})}function Zu(i){let e=1/0,r=1/0,o=-1/0,c=-1/0;for(const h of i)e=Math.min(e,h.x),r=Math.min(r,h.y),o=Math.max(o,h.x),c=Math.max(c,h.y);return{minX:e,minY:r,maxX:o,maxY:c}}function ap(i,e){return e-i}var dc;Fe("FeatureIndex",Gu,{omit:["rawTileData","sourceLayerCoder"]}),l.PerformanceMarkers=void 0,(dc=l.PerformanceMarkers||(l.PerformanceMarkers={})).create="create",dc.load="load",dc.fullLoad="fullLoad";let al=null,Ws=[];const pc=1e3/30,lp={mark(i){performance.mark(i)},frame(i){const e=i;al!=null&&Ws.push(e-al),al=e},clearMetrics(){al=null,Ws=[],performance.clearMeasures("loadTime"),performance.clearMeasures("fullLoadTime");for(const i in l.PerformanceMarkers)performance.clearMarks(l.PerformanceMarkers[i])},getPerformanceMetrics(){performance.measure("loadTime",l.PerformanceMarkers.create,l.PerformanceMarkers.load),performance.measure("fullLoadTime",l.PerformanceMarkers.create,l.PerformanceMarkers.fullLoad);const i=performance.getEntriesByName("loadTime")[0].duration,e=performance.getEntriesByName("fullLoadTime")[0].duration,r=Ws.length,o=1/(Ws.reduce((h,p)=>h+p,0)/r/1e3),c=Ws.filter(h=>h>pc).reduce((h,p)=>h+(p-pc)/pc,0);return{loadTime:i,fullLoadTime:e,fps:o,percentDroppedFrames:c/(r+c)*100}}};l.AJAXError=Si,l.ARRAY_TYPE=wi,l.Actor=class{constructor(i,e,r){this.target=i,this.parent=e,this.mapId=r,this.callbacks={},this.tasks={},this.taskQueue=[],this.cancelCallbacks={},Ut(["receive","process"],this),this.invoker=new sp(this.process),this.target.addEventListener("message",this.receive,!1),this.globalScope=pi()?i:window}send(i,e,r,o,c=!1){const h=Math.round(1e18*Math.random()).toString(36).substring(0,10);r&&(this.callbacks[h]=r);const p=un(this.globalScope)?void 0:[];return this.target.postMessage({id:h,type:i,hasCallback:!!r,targetMapId:o,mustQueue:c,sourceMapId:this.mapId,data:Yr(e,p)},p),{cancel:()=>{r&&delete this.callbacks[h],this.target.postMessage({id:h,type:"<cancel>",targetMapId:o,sourceMapId:this.mapId})}}}receive(i){const e=i.data,r=e.id;if(r&&(!e.targetMapId||this.mapId===e.targetMapId))if(e.type==="<cancel>"){delete this.tasks[r];const o=this.cancelCallbacks[r];delete this.cancelCallbacks[r],o&&o()}else pi()||e.mustQueue?(this.tasks[r]=e,this.taskQueue.push(r),this.invoker.trigger()):this.processTask(r,e)}process(){if(!this.taskQueue.length)return;const i=this.taskQueue.shift(),e=this.tasks[i];delete this.tasks[i],this.taskQueue.length&&this.invoker.trigger(),e&&this.processTask(i,e)}processTask(i,e){if(e.type==="<response>"){const r=this.callbacks[i];delete this.callbacks[i],r&&(e.error?r(Rr(e.error)):r(null,Rr(e.data)))}else{let r=!1;const o=un(this.globalScope)?void 0:[],c=e.hasCallback?(m,g)=>{r=!0,delete this.cancelCallbacks[i],this.target.postMessage({id:i,type:"<response>",sourceMapId:this.mapId,error:m?Yr(m):null,data:Yr(g,o)},o)}:m=>{r=!0};let h=null;const p=Rr(e.data);if(this.parent[e.type])h=this.parent[e.type](e.sourceMapId,p,c);else if(this.parent.getWorkerSource){const m=e.type.split(".");h=this.parent.getWorkerSource(e.sourceMapId,m[0],p.source)[m[1]](p,c)}else c(new Error(`Could not find function ${e.type}`));!r&&h&&h.cancel&&(this.cancelCallbacks[i]=h.cancel)}}remove(){this.invoker.remove(),this.target.removeEventListener("message",this.receive,!1)}},l.AlphaImage=Os,l.CanonicalTileID=hc,l.CollisionBoxArray=ue,l.CollisionCircleLayoutArray=class extends T{},l.Color=D,l.DEMData=$u,l.DataConstantProperty=Ve,l.DictionaryCoder=Vu,l.EXTENT=Kt,l.ErrorEvent=_n,l.EvaluationParameters=Rt,l.Event=fr,l.Evented=mr,l.FeatureIndex=Gu,l.FillBucket=Wl,l.FillExtrusionBucket=Kl,l.GeoJSONFeature=Nu,l.ImageAtlas=pu,l.ImagePosition=ec,l.LineBucket=Jl,l.LineStripIndexArray=class extends O{},l.LngLat=Nt,l.LngLatBounds=yo,l.MercatorCoordinate=sl,l.ONE_EM=ai,l.OverscaledTileID=Ki,l.PerformanceUtils=lp,l.PosArray=Ge,l.Properties=si,l.QuadTriangleArray=class extends C{},l.RGBAImage=Hi,l.RasterBoundsArray=class extends a{},l.RequestPerformance=class{constructor(i){this._marks={start:[i.url,"start"].join("#"),end:[i.url,"end"].join("#"),measure:i.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let i=performance.getEntriesByName(this._marks.measure);return i.length===0&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),i=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),i}},l.ResourceType=dr,l.SegmentVector=ot,l.SymbolBucket=Yo,l.Transitionable=Ba,l.TriangleIndexArray=vi,l.Uniform1f=rn,l.Uniform1i=class extends tn{constructor(i,e){super(i,e),this.current=0}set(i){this.current!==i&&(this.current=i,this.gl.uniform1i(this.location,i))}},l.Uniform2f=class extends tn{constructor(i,e){super(i,e),this.current=[0,0]}set(i){i[0]===this.current[0]&&i[1]===this.current[1]||(this.current=i,this.gl.uniform2f(this.location,i[0],i[1]))}},l.Uniform3f=class extends tn{constructor(i,e){super(i,e),this.current=[0,0,0]}set(i){i[0]===this.current[0]&&i[1]===this.current[1]&&i[2]===this.current[2]||(this.current=i,this.gl.uniform3f(this.location,i[0],i[1],i[2]))}},l.Uniform4f=Go,l.UniformColor=Mc,l.UniformMatrix4f=class extends tn{constructor(i,e){super(i,e),this.current=Mh}set(i){if(i[12]!==this.current[12]||i[0]!==this.current[0])return this.current=i,void this.gl.uniformMatrix4fv(this.location,!1,i);for(let e=1;e<16;e++)if(i[e]!==this.current[e]){this.current=i,this.gl.uniformMatrix4fv(this.location,!1,i);break}}},l.UnwrappedTileID=Uu,l.ValidationError=Ce,l.ZoomHistory=Ts,l.add=function(i,e,r){return i[0]=e[0]+r[0],i[1]=e[1]+r[1],i[2]=e[2]+r[2],i},l.addDynamicAttributes=oc,l.asyncAll=function(i,e,r){if(!i.length)return r(null,[]);let o=i.length;const c=new Array(i.length);let h=null;i.forEach((p,m)=>{e(p,(g,x)=>{g&&(h=g),c[m]=x,--o==0&&r(h,c)})})},l.bezier=Ee,l.bindAll=Ut,l.cacheEntryPossiblyAdded=function(i){Qi++,Qi>dn&&(i.getActor().send("enforceCacheSizeLimit",hn),Qi=0)},l.clamp=se,l.clearTileCache=function(i){const e=caches.delete(qi);i&&e.catch(i).then(()=>i())},l.clipLine=Su,l.clone=function(i){var e=new wi(16);return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],e},l.clone$1=vt,l.clone$2=function(i){var e=new wi(3);return e[0]=i[0],e[1]=i[1],e[2]=i[2],e},l.collisionCircleLayout=Id,l.config=hr,l.copy=function(i,e){return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[4]=e[4],i[5]=e[5],i[6]=e[6],i[7]=e[7],i[8]=e[8],i[9]=e[9],i[10]=e[10],i[11]=e[11],i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15],i},l.create=function(){var i=new wi(16);return wi!=Float32Array&&(i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[11]=0,i[12]=0,i[13]=0,i[14]=0),i[0]=1,i[5]=1,i[10]=1,i[15]=1,i},l.create$1=Fc,l.createExpression=Yn,l.createFilter=Fo,l.createLayout=Zt,l.createStyleLayer=function(i){return i.type==="custom"?new np(i):new op[i.type](i)},l.cross=function(i,e,r){var o=e[0],c=e[1],h=e[2],p=r[0],m=r[1],g=r[2];return i[0]=c*g-h*m,i[1]=h*p-o*g,i[2]=o*m-c*p,i},l.dot=function(i,e){return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]},l.dot$1=function(i,e){return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]+i[3]*e[3]},l.ease=Te,l.emitValidationErrors=Uo,l.enforceCacheSizeLimit=function(i){pn(),Zi&&Zi.then(e=>{e.keys().then(r=>{for(let o=0;o<r.length-i;o++)e.delete(r[o])})})},l.equals=function(i,e){var r=i[0],o=i[1],c=i[2],h=i[3],p=i[4],m=i[5],g=i[6],x=i[7],w=i[8],E=i[9],A=i[10],M=i[11],z=i[12],$=i[13],U=i[14],ee=i[15],oe=e[0],Y=e[1],re=e[2],fe=e[3],pe=e[4],Be=e[5],Ue=e[6],Pe=e[7],Ae=e[8],we=e[9],ke=e[10],Me=e[11],be=e[12],qe=e[13],Ne=e[14],rt=e[15];return Math.abs(r-oe)<=bi*Math.max(1,Math.abs(r),Math.abs(oe))&&Math.abs(o-Y)<=bi*Math.max(1,Math.abs(o),Math.abs(Y))&&Math.abs(c-re)<=bi*Math.max(1,Math.abs(c),Math.abs(re))&&Math.abs(h-fe)<=bi*Math.max(1,Math.abs(h),Math.abs(fe))&&Math.abs(p-pe)<=bi*Math.max(1,Math.abs(p),Math.abs(pe))&&Math.abs(m-Be)<=bi*Math.max(1,Math.abs(m),Math.abs(Be))&&Math.abs(g-Ue)<=bi*Math.max(1,Math.abs(g),Math.abs(Ue))&&Math.abs(x-Pe)<=bi*Math.max(1,Math.abs(x),Math.abs(Pe))&&Math.abs(w-Ae)<=bi*Math.max(1,Math.abs(w),Math.abs(Ae))&&Math.abs(E-we)<=bi*Math.max(1,Math.abs(E),Math.abs(we))&&Math.abs(A-ke)<=bi*Math.max(1,Math.abs(A),Math.abs(ke))&&Math.abs(M-Me)<=bi*Math.max(1,Math.abs(M),Math.abs(Me))&&Math.abs(z-be)<=bi*Math.max(1,Math.abs(z),Math.abs(be))&&Math.abs($-qe)<=bi*Math.max(1,Math.abs($),Math.abs(qe))&&Math.abs(U-Ne)<=bi*Math.max(1,Math.abs(U),Math.abs(Ne))&&Math.abs(ee-rt)<=bi*Math.max(1,Math.abs(ee),Math.abs(rt))},l.evaluateSizeForFeature=function(i,{uSize:e,uSizeT:r},{lowerSize:o,upperSize:c}){return i.kind==="source"?o/sn:i.kind==="composite"?Dt(o/sn,c/sn,r):e},l.evaluateSizeForZoom=function(i,e){let r=0,o=0;if(i.kind==="constant")o=i.layoutSize;else if(i.kind!=="source"){const{interpolationType:c,minZoom:h,maxZoom:p}=i,m=c?se(Ci.interpolationFactor(c,e,h,p),0,1):0;i.kind==="camera"?o=Dt(i.minSize,i.maxSize,m):r=m}return{uSizeT:r,uSize:o}},l.evaluateVariableOffset=Cu,l.evented=zs,l.exported=Sr,l.exported$1=Ir,l.extend=nt,l.filterObject=ct,l.fromRotation=function(i,e){var r=Math.sin(e),o=Math.cos(e);return i[0]=o,i[1]=r,i[2]=0,i[3]=-r,i[4]=o,i[5]=0,i[6]=0,i[7]=0,i[8]=1,i},l.fromScaling=function(i,e){return i[0]=e[0],i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=e[1],i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=e[2],i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i},l.getAnchorAlignment=ic,l.getAnchorJustification=nc,l.getArrayBuffer=gn,l.getImage=Pr,l.getJSON=function(i,e){return mn(nt(i,{type:"json"}),e)},l.getOverlapMode=cc,l.getRTLTextPluginStatus=uo,l.getReferrer=Vn,l.getVideo=function(i,e){const r=window.document.createElement("video");r.muted=!0,r.onloadstart=function(){e(null,r)};for(let o=0;o<i.length;o++){const c=window.document.createElement("source");Nn(i[o])||(r.crossOrigin="Anonymous"),c.src=i[o],r.appendChild(c)}return{cancel:()=>{}}},l.identity=Ul,l.invert=function(i,e){var r=e[0],o=e[1],c=e[2],h=e[3],p=e[4],m=e[5],g=e[6],x=e[7],w=e[8],E=e[9],A=e[10],M=e[11],z=e[12],$=e[13],U=e[14],ee=e[15],oe=r*m-o*p,Y=r*g-c*p,re=r*x-h*p,fe=o*g-c*m,pe=o*x-h*m,Be=c*x-h*g,Ue=w*$-E*z,Pe=w*U-A*z,Ae=w*ee-M*z,we=E*U-A*$,ke=E*ee-M*$,Me=A*ee-M*U,be=oe*Me-Y*ke+re*we+fe*Ae-pe*Pe+Be*Ue;return be?(i[0]=(m*Me-g*ke+x*we)*(be=1/be),i[1]=(c*ke-o*Me-h*we)*be,i[2]=($*Be-U*pe+ee*fe)*be,i[3]=(A*pe-E*Be-M*fe)*be,i[4]=(g*Ae-p*Me-x*Pe)*be,i[5]=(r*Me-c*Ae+h*Pe)*be,i[6]=(U*re-z*Be-ee*Y)*be,i[7]=(w*Be-A*re+M*Y)*be,i[8]=(p*ke-m*Ae+x*Ue)*be,i[9]=(o*Ae-r*ke-h*Ue)*be,i[10]=(z*pe-$*re+ee*oe)*be,i[11]=(E*re-w*pe-M*oe)*be,i[12]=(m*Pe-p*we-g*Ue)*be,i[13]=(r*we-o*Pe+c*Ue)*be,i[14]=($*Y-z*fe-U*oe)*be,i[15]=(w*fe-E*Y+A*oe)*be,i):null},l.isImageBitmap=Er,l.isSafari=un,l.isWorker=pi,l.keysDifference=function(i,e){const r=[];for(const o in i)o in e||r.push(o);return r},l.lazyLoadRTLTextPlugin=function(){Ui.isLoading()||Ui.isLoaded()||uo()!=="deferred"||Ra()},l.makeRequest=mn,l.mapObject=Mt,l.mercatorXfromLng=Ru,l.mercatorYfromLat=Bu,l.mercatorZfromAltitude=Fu,l.mul=Fh,l.mul$1=function(i,e,r){return i[0]=e[0]*r[0],i[1]=e[1]*r[1],i[2]=e[2]*r[2],i[3]=e[3]*r[3],i},l.multiply=Oc,l.nextPowerOfTwo=function(i){return i<=1?1:Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))},l.normalize=function(i,e){var r=e[0],o=e[1],c=e[2],h=r*r+o*o+c*c;return h>0&&(h=1/Math.sqrt(h)),i[0]=e[0]*h,i[1]=e[1]*h,i[2]=e[2]*h,i},l.number=Dt,l.ortho=function(i,e,r,o,c,h,p){var m=1/(e-r),g=1/(o-c),x=1/(h-p);return i[0]=-2*m,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=-2*g,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=2*x,i[11]=0,i[12]=(e+r)*m,i[13]=(c+o)*g,i[14]=(p+h)*x,i[15]=1,i},l.parseCacheControl=wo,l.parseGlyphPbf=function(i){return new Yl(i).readFields(Fd,[])},l.pbf=Yl,l.performSymbolLayout=function(i){i.bucket.createArrays(),i.bucket.tilePixelRatio=Kt/(512*i.bucket.overscaling),i.bucket.compareText={},i.bucket.iconsNeedLinear=!1;const e=i.bucket.layers[0].layout,r=i.bucket.layers[0]._unevaluatedLayout._values,o={layoutIconSize:r["icon-size"].possiblyEvaluate(new Rt(i.bucket.zoom+1),i.canonical),layoutTextSize:r["text-size"].possiblyEvaluate(new Rt(i.bucket.zoom+1),i.canonical),textMaxSize:r["text-size"].possiblyEvaluate(new Rt(18))};if(i.bucket.textSizeData.kind==="composite"){const{minZoom:g,maxZoom:x}=i.bucket.textSizeData;o.compositeTextSizes=[r["text-size"].possiblyEvaluate(new Rt(g),i.canonical),r["text-size"].possiblyEvaluate(new Rt(x),i.canonical)]}if(i.bucket.iconSizeData.kind==="composite"){const{minZoom:g,maxZoom:x}=i.bucket.iconSizeData;o.compositeIconSizes=[r["icon-size"].possiblyEvaluate(new Rt(g),i.canonical),r["icon-size"].possiblyEvaluate(new Rt(x),i.canonical)]}const c=e.get("text-line-height")*ai,h=e.get("text-rotation-alignment")!=="viewport"&&e.get("symbol-placement")!=="point",p=e.get("text-keep-upright"),m=e.get("text-size");for(const g of i.bucket.features){const x=e.get("text-font").evaluate(g,{},i.canonical).join(","),w=m.evaluate(g,{},i.canonical),E=o.layoutTextSize.evaluate(g,{},i.canonical),A=o.layoutIconSize.evaluate(g,{},i.canonical),M={horizontal:{},vertical:void 0},z=g.text;let $,U=[0,0];if(z){const Y=z.toString(),re=e.get("text-letter-spacing").evaluate(g,{},i.canonical)*ai,fe=Pl(Y)?re:0,pe=e.get("text-anchor").evaluate(g,{},i.canonical),Be=e.get("text-variable-anchor");if(!Be){const ke=e.get("text-radial-offset").evaluate(g,{},i.canonical);U=ke?Cu(pe,[ke*ai,rc]):e.get("text-offset").evaluate(g,{},i.canonical).map(Me=>Me*ai)}let Ue=h?"center":e.get("text-justify").evaluate(g,{},i.canonical);const Pe=e.get("symbol-placement"),Ae=Pe==="point"?e.get("text-max-width").evaluate(g,{},i.canonical)*ai:0,we=()=>{i.bucket.allowVerticalPlacement&&$o(Y)&&(M.vertical=Ya(z,i.glyphMap,i.glyphPositions,i.imagePositions,x,Ae,c,pe,"left",fe,U,l.WritingMode.vertical,!0,Pe,E,w))};if(!h&&Be){const ke=Ue==="auto"?Be.map(be=>nc(be)):[Ue];let Me=!1;for(let be=0;be<ke.length;be++){const qe=ke[be];if(!M.horizontal[qe])if(Me)M.horizontal[qe]=M.horizontal[0];else{const Ne=Ya(z,i.glyphMap,i.glyphPositions,i.imagePositions,x,Ae,c,"center",qe,fe,U,l.WritingMode.horizontal,!1,Pe,E,w);Ne&&(M.horizontal[qe]=Ne,Me=Ne.positionedLines.length===1)}}we()}else{Ue==="auto"&&(Ue=nc(pe));const ke=Ya(z,i.glyphMap,i.glyphPositions,i.imagePositions,x,Ae,c,pe,Ue,fe,U,l.WritingMode.horizontal,!1,Pe,E,w);ke&&(M.horizontal[Ue]=ke),we(),$o(Y)&&h&&p&&(M.vertical=Ya(z,i.glyphMap,i.glyphPositions,i.imagePositions,x,Ae,c,pe,Ue,fe,U,l.WritingMode.vertical,!1,Pe,E,w))}}let ee=!1;if(g.icon&&g.icon.name){const Y=i.imageMap[g.icon.name];Y&&($=Gd(i.imagePositions[g.icon.name],e.get("icon-offset").evaluate(g,{},i.canonical),e.get("icon-anchor").evaluate(g,{},i.canonical)),ee=!!Y.sdf,i.bucket.sdfIcons===void 0?i.bucket.sdfIcons=ee:i.bucket.sdfIcons!==ee&&$t("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(Y.pixelRatio!==i.bucket.pixelRatio||e.get("icon-rotate").constantOr(1)!==0)&&(i.bucket.iconsNeedLinear=!0))}const oe=zu(M.horizontal)||M.vertical;i.bucket.iconsInText=!!oe&&oe.iconsInText,(oe||$)&&Kd(i.bucket,g,M,$,i.imageMap,o,E,A,U,ee,i.canonical)}i.showCollisionBoxes&&i.bucket.generateCollisionDebugBuffers()},l.perspective=function(i,e,r,o,c){var h,p=1/Math.tan(e/2);return i[0]=p/r,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=p,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[11]=-1,i[12]=0,i[13]=0,i[15]=0,c!=null&&c!==1/0?(i[10]=(c+o)*(h=1/(o-c)),i[14]=2*c*o*h):(i[10]=-1,i[14]=-2*o),i},l.pick=function(i,e){const r={};for(let o=0;o<e.length;o++){const c=e[o];c in i&&(r[c]=i[c])}return r},l.plugin=Ui,l.pointGeometry=We,l.polygonIntersectsPolygon=Dc,l.potpack=du,l.refProperties=["type","source","source-layer","minzoom","maxzoom","filter","layout"],l.register=Fe,l.registerForPluginStateChange=function(i){return i({pluginStatus:xi,pluginURL:Br}),zs.on("pluginStateChange",i),i},l.renderColorRamp=Zc,l.rotateX=function(i,e,r){var o=Math.sin(r),c=Math.cos(r),h=e[4],p=e[5],m=e[6],g=e[7],x=e[8],w=e[9],E=e[10],A=e[11];return e!==i&&(i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15]),i[4]=h*c+x*o,i[5]=p*c+w*o,i[6]=m*c+E*o,i[7]=g*c+A*o,i[8]=x*c-h*o,i[9]=w*c-p*o,i[10]=E*c-m*o,i[11]=A*c-g*o,i},l.rotateZ=function(i,e,r){var o=Math.sin(r),c=Math.cos(r),h=e[0],p=e[1],m=e[2],g=e[3],x=e[4],w=e[5],E=e[6],A=e[7];return e!==i&&(i[8]=e[8],i[9]=e[9],i[10]=e[10],i[11]=e[11],i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15]),i[0]=h*c+x*o,i[1]=p*c+w*o,i[2]=m*c+E*o,i[3]=g*c+A*o,i[4]=x*c-h*o,i[5]=w*c-p*o,i[6]=E*c-m*o,i[7]=A*c-g*o,i},l.scale=function(i,e,r){var o=r[0],c=r[1],h=r[2];return i[0]=e[0]*o,i[1]=e[1]*o,i[2]=e[2]*o,i[3]=e[3]*o,i[4]=e[4]*c,i[5]=e[5]*c,i[6]=e[6]*c,i[7]=e[7]*c,i[8]=e[8]*h,i[9]=e[9]*h,i[10]=e[10]*h,i[11]=e[11]*h,i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15],i},l.scale$1=function(i,e,r){return i[0]=e[0]*r,i[1]=e[1]*r,i[2]=e[2]*r,i},l.setCacheLimits=function(i,e){hn=i,dn=e},l.setRTLTextPlugin=function(i,e,r=!1){if(xi===Is||xi===As||xi===Cs)throw new Error("setRTLTextPlugin cannot be called multiple times.");Br=Sr.resolveURL(i),xi=Is,Ms=e,Pn(),r||Ra()},l.spec=de,l.sphericalToCartesian=function([i,e,r]){return e+=90,e*=Math.PI/180,r*=Math.PI/180,{x:i*Math.cos(e)*Math.sin(r),y:i*Math.sin(e)*Math.sin(r),z:i*Math.cos(r)}},l.sqrLen=function(i){var e=i[0],r=i[1];return e*e+r*r},l.sub=function(i,e,r){return i[0]=e[0]-r[0],i[1]=e[1]-r[1],i[2]=e[2]-r[2],i},l.toEvaluationFeature=go,l.transformMat3=function(i,e,r){var o=e[0],c=e[1],h=e[2];return i[0]=o*r[0]+c*r[3]+h*r[6],i[1]=o*r[1]+c*r[4]+h*r[7],i[2]=o*r[2]+c*r[5]+h*r[8],i},l.transformMat4=qa,l.transformMat4$1=function(i,e,r){var o=e[0],c=e[1];return i[0]=r[0]*o+r[4]*c+r[12],i[1]=r[1]*o+r[5]*c+r[13],i},l.translate=function(i,e,r){var o,c,h,p,m,g,x,w,E,A,M,z,$=r[0],U=r[1],ee=r[2];return e===i?(i[12]=e[0]*$+e[4]*U+e[8]*ee+e[12],i[13]=e[1]*$+e[5]*U+e[9]*ee+e[13],i[14]=e[2]*$+e[6]*U+e[10]*ee+e[14],i[15]=e[3]*$+e[7]*U+e[11]*ee+e[15]):(c=e[1],h=e[2],p=e[3],m=e[4],g=e[5],x=e[6],w=e[7],E=e[8],A=e[9],M=e[10],z=e[11],i[0]=o=e[0],i[1]=c,i[2]=h,i[3]=p,i[4]=m,i[5]=g,i[6]=x,i[7]=w,i[8]=E,i[9]=A,i[10]=M,i[11]=z,i[12]=o*$+m*U+E*ee+e[12],i[13]=c*$+g*U+A*ee+e[13],i[14]=h*$+x*U+M*ee+e[14],i[15]=p*$+w*U+z*ee+e[15]),i},l.triggerPluginCompletionEvent=La,l.unicodeBlockLookup=ze,l.uniqueId=function(){return He++},l.validateCustomStyleLayer=function(i){const e=[],r=i.id;return r===void 0&&e.push({message:`layers.${r}: missing required property "id"`}),i.render===void 0&&e.push({message:`layers.${r}: missing required method "render"`}),i.renderingMode&&i.renderingMode!=="2d"&&i.renderingMode!=="3d"&&e.push({message:`layers.${r}: property "renderingMode" must be either "2d" or "3d"`}),e},l.validateLight=ws,l.validateStyle=lo,l.vectorTile=Rn,l.warnOnce=$t,l.wrap=gt}),Q(["./shared"],function(l){function ve(L){const b=typeof L;if(b==="number"||b==="boolean"||b==="string"||L==null)return JSON.stringify(L);if(Array.isArray(L)){let D="[";for(const N of L)D+=`${ve(N)},`;return`${D}]`}const S=Object.keys(L).sort();let k="{";for(let D=0;D<S.length;D++)k+=`${JSON.stringify(S[D])}:${ve(L[S[D]])},`;return`${k}}`}function me(L){let b="";for(const S of l.refProperties)b+=`/${ve(L[S])}`;return b}class Ee{constructor(b){this.keyCache={},b&&this.replace(b)}replace(b){this._layerConfigs={},this._layers={},this.update(b,[])}update(b,S){for(const D of b){this._layerConfigs[D.id]=D;const N=this._layers[D.id]=l.createStyleLayer(D);N._featureFilter=l.createFilter(N.filter),this.keyCache[D.id]&&delete this.keyCache[D.id]}for(const D of S)delete this.keyCache[D],delete this._layerConfigs[D],delete this._layers[D];this.familiesBySource={};const k=function(D,N){const H={};for(let G=0;G<D.length;G++){const K=N&&N[D[G].id]||me(D[G]);N&&(N[D[G].id]=K);let le=H[K];le||(le=H[K]=[]),le.push(D[G])}const Z=[];for(const G in H)Z.push(H[G]);return Z}(Object.values(this._layerConfigs),this.keyCache);for(const D of k){const N=D.map(_e=>this._layers[_e.id]),H=N[0];if(H.visibility==="none")continue;const Z=H.source||"";let G=this.familiesBySource[Z];G||(G=this.familiesBySource[Z]={});const K=H.sourceLayer||"_geojsonTileLayer";let le=G[K];le||(le=G[K]=[]),le.push(N)}}}class Te{constructor(b){const S={},k=[];for(const Z in b){const G=b[Z],K=S[Z]={};for(const le in G){const _e=G[+le];if(!_e||_e.bitmap.width===0||_e.bitmap.height===0)continue;const ae={x:0,y:0,w:_e.bitmap.width+2,h:_e.bitmap.height+2};k.push(ae),K[le]={rect:ae,metrics:_e.metrics}}}const{w:D,h:N}=l.potpack(k),H=new l.AlphaImage({width:D||1,height:N||1});for(const Z in b){const G=b[Z];for(const K in G){const le=G[+K];if(!le||le.bitmap.width===0||le.bitmap.height===0)continue;const _e=S[Z][K].rect;l.AlphaImage.copy(le.bitmap,H,{x:0,y:0},{x:_e.x+1,y:_e.y+1},le.bitmap)}}this.image=H,this.positions=S}}l.register("GlyphAtlas",Te);class se{constructor(b){this.tileID=new l.OverscaledTileID(b.tileID.overscaledZ,b.tileID.wrap,b.tileID.canonical.z,b.tileID.canonical.x,b.tileID.canonical.y),this.uid=b.uid,this.zoom=b.zoom,this.pixelRatio=b.pixelRatio,this.tileSize=b.tileSize,this.source=b.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=b.showCollisionBoxes,this.collectResourceTiming=!!b.collectResourceTiming,this.returnDependencies=!!b.returnDependencies,this.promoteId=b.promoteId}parse(b,S,k,D,N){this.status="parsing",this.data=b,this.collisionBoxArray=new l.CollisionBoxArray;const H=new l.DictionaryCoder(Object.keys(b.layers).sort()),Z=new l.FeatureIndex(this.tileID,this.promoteId);Z.bucketLayerIDs=[];const G={},K={featureIndex:Z,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:k},le=S.familiesBySource[this.source];for(const Ke in le){const tt=b.layers[Ke];if(!tt)continue;tt.version===1&&l.warnOnce(`Vector tile source "${this.source}" layer "${Ke}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const ft=H.encode(Ke),St=[];for(let Qt=0;Qt<tt.length;Qt++){const kt=tt.feature(Qt),li=Z.getId(kt,Ke);St.push({feature:kt,id:li,index:Qt,sourceLayerIndex:ft})}for(const Qt of le[Ke]){const kt=Qt[0];kt.source!==this.source&&l.warnOnce(`layer.source = ${kt.source} does not equal this.source = ${this.source}`),kt.minzoom&&this.zoom<Math.floor(kt.minzoom)||kt.maxzoom&&this.zoom>=kt.maxzoom||kt.visibility!=="none"&&(gt(Qt,this.zoom,k),(G[kt.id]=kt.createBucket({index:Z.bucketLayerIDs.length,layers:Qt,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:ft,sourceID:this.source})).populate(St,K,this.tileID.canonical),Z.bucketLayerIDs.push(Qt.map(li=>li.id)))}}let _e,ae,Oe,$e;const De=l.mapObject(K.glyphDependencies,Ke=>Object.keys(Ke).map(Number));Object.keys(De).length?D.send("getGlyphs",{uid:this.uid,stacks:De},(Ke,tt)=>{_e||(_e=Ke,ae=tt,pt.call(this))}):ae={};const Ze=Object.keys(K.iconDependencies);Ze.length?D.send("getImages",{icons:Ze,source:this.source,tileID:this.tileID,type:"icons"},(Ke,tt)=>{_e||(_e=Ke,Oe=tt,pt.call(this))}):Oe={};const Xe=Object.keys(K.patternDependencies);function pt(){if(_e)return N(_e);if(ae&&Oe&&$e){const Ke=new Te(ae),tt=new l.ImageAtlas(Oe,$e);for(const ft in G){const St=G[ft];St instanceof l.SymbolBucket?(gt(St.layers,this.zoom,k),l.performSymbolLayout({bucket:St,glyphMap:ae,glyphPositions:Ke.positions,imageMap:Oe,imagePositions:tt.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):St.hasPattern&&(St instanceof l.LineBucket||St instanceof l.FillBucket||St instanceof l.FillExtrusionBucket)&&(gt(St.layers,this.zoom,k),St.addFeatures(K,this.tileID.canonical,tt.patternPositions))}this.status="done",N(null,{buckets:Object.values(G).filter(ft=>!ft.isEmpty()),featureIndex:Z,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:Ke.image,imageAtlas:tt,glyphMap:this.returnDependencies?ae:null,iconMap:this.returnDependencies?Oe:null,glyphPositions:this.returnDependencies?Ke.positions:null})}}Xe.length?D.send("getImages",{icons:Xe,source:this.source,tileID:this.tileID,type:"patterns"},(Ke,tt)=>{_e||(_e=Ke,$e=tt,pt.call(this))}):$e={},pt.call(this)}}function gt(L,b,S){const k=new l.EvaluationParameters(b);for(const D of L)D.recalculate(k,S)}function nt(L,b){const S=l.getArrayBuffer(L.request,(k,D,N,H)=>{k?b(k):D&&b(null,{vectorTile:new l.vectorTile.VectorTile(new l.pbf(D)),rawData:D,cacheControl:N,expires:H})});return()=>{S.cancel(),b()}}class He{constructor(b,S,k,D){this.actor=b,this.layerIndex=S,this.availableImages=k,this.loadVectorData=D||nt,this.loading={},this.loaded={}}loadTile(b,S){const k=b.uid;this.loading||(this.loading={});const D=!!(b&&b.request&&b.request.collectResourceTiming)&&new l.RequestPerformance(b.request),N=this.loading[k]=new se(b);N.abort=this.loadVectorData(b,(H,Z)=>{if(delete this.loading[k],H||!Z)return N.status="done",this.loaded[k]=N,S(H);const G=Z.rawData,K={};Z.expires&&(K.expires=Z.expires),Z.cacheControl&&(K.cacheControl=Z.cacheControl);const le={};if(D){const _e=D.finish();_e&&(le.resourceTiming=JSON.parse(JSON.stringify(_e)))}N.vectorTile=Z.vectorTile,N.parse(Z.vectorTile,this.layerIndex,this.availableImages,this.actor,(_e,ae)=>{if(_e||!ae)return S(_e);S(null,l.extend({rawTileData:G.slice(0)},ae,K,le))}),this.loaded=this.loaded||{},this.loaded[k]=N})}reloadTile(b,S){const k=this.loaded,D=b.uid,N=this;if(k&&k[D]){const H=k[D];H.showCollisionBoxes=b.showCollisionBoxes;const Z=(G,K)=>{const le=H.reloadCallback;le&&(delete H.reloadCallback,H.parse(H.vectorTile,N.layerIndex,this.availableImages,N.actor,le)),S(G,K)};H.status==="parsing"?H.reloadCallback=Z:H.status==="done"&&(H.vectorTile?H.parse(H.vectorTile,this.layerIndex,this.availableImages,this.actor,Z):Z())}}abortTile(b,S){const k=this.loading,D=b.uid;k&&k[D]&&k[D].abort&&(k[D].abort(),delete k[D]),S()}removeTile(b,S){const k=this.loaded,D=b.uid;k&&k[D]&&delete k[D],S()}}class Ut{constructor(){this.loaded={}}loadTile(b,S){const{uid:k,encoding:D,rawImageData:N}=b,H=l.isImageBitmap(N)?this.getImageData(N):N,Z=new l.DEMData(k,H,D);this.loaded=this.loaded||{},this.loaded[k]=Z,S(null,Z)}getImageData(b){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(b.width,b.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d")),this.offscreenCanvas.width=b.width,this.offscreenCanvas.height=b.height,this.offscreenCanvasContext.drawImage(b,0,0,b.width,b.height);const S=this.offscreenCanvasContext.getImageData(-1,-1,b.width+2,b.height+2);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),new l.RGBAImage({width:S.width,height:S.height},S.data)}removeTile(b){const S=this.loaded,k=b.uid;S&&S[k]&&delete S[k]}}var Mt=function L(b,S){var k,D=b&&b.type;if(D==="FeatureCollection")for(k=0;k<b.features.length;k++)L(b.features[k],S);else if(D==="GeometryCollection")for(k=0;k<b.geometries.length;k++)L(b.geometries[k],S);else if(D==="Feature")L(b.geometry,S);else if(D==="Polygon")ct(b.coordinates,S);else if(D==="MultiPolygon")for(k=0;k<b.coordinates.length;k++)ct(b.coordinates[k],S);return b};function ct(L,b){if(L.length!==0){vt(L[0],b);for(var S=1;S<L.length;S++)vt(L[S],!b)}}function vt(L,b){for(var S=0,k=0,D=0,N=L.length,H=N-1;D<N;H=D++){var Z=(L[D][0]-L[H][0])*(L[H][1]+L[D][1]),G=S+Z;k+=Math.abs(S)>=Math.abs(Z)?S-G+Z:Z-G+S,S=G}S+k>=0!=!!b&&L.reverse()}const Wt=l.vectorTile.VectorTileFeature.prototype.toGeoJSON;class $t{constructor(b){this._feature=b,this.extent=l.EXTENT,this.type=b.type,this.properties=b.tags,"id"in b&&!isNaN(b.id)&&(this.id=parseInt(b.id,10))}loadGeometry(){if(this._feature.type===1){const b=[];for(const S of this._feature.geometry)b.push([new l.pointGeometry(S[0],S[1])]);return b}{const b=[];for(const S of this._feature.geometry){const k=[];for(const D of S)k.push(new l.pointGeometry(D[0],D[1]));b.push(k)}return b}}toGeoJSON(b,S,k){return Wt.call(this,b,S,k)}}class Gi{constructor(b){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=l.EXTENT,this.length=b.length,this._features=b}feature(b){return new $t(this._features[b])}}var Fi={exports:{}},pi=l.pointGeometry,wo=l.vectorTile.VectorTileFeature,lr=Gr;function Gr(L,b){this.options=b||{},this.features=L,this.length=L.length}function cr(L,b){this.id=typeof L.id=="number"?L.id:void 0,this.type=L.type,this.rawGeometry=L.type===1?[L.geometry]:L.geometry,this.properties=L.tags,this.extent=b||4096}Gr.prototype.feature=function(L){return new cr(this.features[L],this.options.extent)},cr.prototype.loadGeometry=function(){var L=this.rawGeometry;this.geometry=[];for(var b=0;b<L.length;b++){for(var S=L[b],k=[],D=0;D<S.length;D++)k.push(new pi(S[D][0],S[D][1]));this.geometry.push(k)}return this.geometry},cr.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var L=this.geometry,b=1/0,S=-1/0,k=1/0,D=-1/0,N=0;N<L.length;N++)for(var H=L[N],Z=0;Z<H.length;Z++){var G=H[Z];b=Math.min(b,G.x),S=Math.max(S,G.x),k=Math.min(k,G.y),D=Math.max(D,G.y)}return[b,k,S,D]},cr.prototype.toGeoJSON=wo.prototype.toGeoJSON;var un=l.pbf,Er=lr;function Sr(L){var b=new un;return function(S,k){for(var D in S.layers)k.writeMessage(3,We,S.layers[D])}(L,b),b.finish()}function We(L,b){var S;b.writeVarintField(15,L.version||1),b.writeStringField(1,L.name||""),b.writeVarintField(5,L.extent||4096);var k={keys:[],values:[],keycache:{},valuecache:{}};for(S=0;S<L.length;S++)k.feature=L.feature(S),b.writeMessage(2,ur,k);var D=k.keys;for(S=0;S<D.length;S++)b.writeStringField(3,D[S]);var N=k.values;for(S=0;S<N.length;S++)b.writeMessage(4,hn,N[S])}function ur(L,b){var S=L.feature;S.id!==void 0&&b.writeVarintField(1,S.id),b.writeMessage(2,hr,L),b.writeVarintField(3,S.type),b.writeMessage(4,qr,S)}function hr(L,b){var S=L.feature,k=L.keys,D=L.values,N=L.keycache,H=L.valuecache;for(var Z in S.properties){var G=S.properties[Z],K=N[Z];if(G!==null){K===void 0&&(k.push(Z),N[Z]=K=k.length-1),b.writeVarint(K);var le=typeof G;le!=="string"&&le!=="boolean"&&le!=="number"&&(G=JSON.stringify(G));var _e=le+":"+G,ae=H[_e];ae===void 0&&(D.push(G),H[_e]=ae=D.length-1),b.writeVarint(ae)}}}function qi(L,b){return(b<<3)+(7&L)}function Zi(L){return L<<1^L>>31}function qr(L,b){for(var S=L.loadGeometry(),k=L.type,D=0,N=0,H=S.length,Z=0;Z<H;Z++){var G=S[Z],K=1;k===1&&(K=G.length),b.writeVarint(qi(1,K));for(var le=k===3?G.length-1:G.length,_e=0;_e<le;_e++){_e===1&&k!==1&&b.writeVarint(qi(2,le-1));var ae=G[_e].x-D,Oe=G[_e].y-N;b.writeVarint(Zi(ae)),b.writeVarint(Zi(Oe)),D+=ae,N+=Oe}k===3&&b.writeVarint(qi(7,1))}}function hn(L,b){var S=typeof L;S==="string"?b.writeStringField(1,L):S==="boolean"?b.writeBooleanField(7,L):S==="number"&&(L%1!=0?b.writeDoubleField(3,L):L<0?b.writeSVarintField(6,L):b.writeVarintField(5,L))}function dn(L,b,S,k,D,N){if(D-k<=S)return;const H=k+D>>1;pn(L,b,H,k,D,N%2),dn(L,b,S,k,H-1,N+1),dn(L,b,S,H+1,D,N+1)}function pn(L,b,S,k,D,N){for(;D>k;){if(D-k>600){const K=D-k+1,le=S-k+1,_e=Math.log(K),ae=.5*Math.exp(2*_e/3),Oe=.5*Math.sqrt(_e*ae*(K-ae)/K)*(le-K/2<0?-1:1);pn(L,b,S,Math.max(k,Math.floor(S-le*ae/K+Oe)),Math.min(D,Math.floor(S+(K-le)*ae/K+Oe)),N)}const H=b[2*S+N];let Z=k,G=D;for(Qi(L,b,k,S),b[2*D+N]>H&&Qi(L,b,k,D);Z<G;){for(Qi(L,b,Z,G),Z++,G--;b[2*Z+N]<H;)Z++;for(;b[2*G+N]>H;)G--}b[2*k+N]===H?Qi(L,b,k,G):(G++,Qi(L,b,G,D)),G<=S&&(k=G+1),S<=G&&(D=G-1)}}function Qi(L,b,S,k){Ir(L,S,k),Ir(b,2*S,2*k),Ir(b,2*S+1,2*k+1)}function Ir(L,b,S){const k=L[b];L[b]=L[S],L[S]=k}function Ar(L,b,S,k){const D=L-S,N=b-k;return D*D+N*N}Fi.exports=Sr,Fi.exports.fromVectorTileJs=Sr,Fi.exports.fromGeojsonVt=function(L,b){b=b||{};var S={};for(var k in L)S[k]=new Er(L[k].features,b),S[k].name=k,S[k].version=b.version,S[k].extent=b.extent;return Sr({layers:S})},Fi.exports.GeoJSONWrapper=Er;const Cr=L=>L[0],yi=L=>L[1];class fn{constructor(b,S=Cr,k=yi,D=64,N=Float64Array){this.nodeSize=D,this.points=b;const H=b.length<65536?Uint16Array:Uint32Array,Z=this.ids=new H(b.length),G=this.coords=new N(2*b.length);for(let K=0;K<b.length;K++)Z[K]=K,G[2*K]=S(b[K]),G[2*K+1]=k(b[K]);dn(Z,G,D,0,Z.length-1,0)}range(b,S,k,D){return function(N,H,Z,G,K,le,_e){const ae=[0,N.length-1,0],Oe=[];let $e,De;for(;ae.length;){const Ze=ae.pop(),Xe=ae.pop(),pt=ae.pop();if(Xe-pt<=_e){for(let ft=pt;ft<=Xe;ft++)$e=H[2*ft],De=H[2*ft+1],$e>=Z&&$e<=K&&De>=G&&De<=le&&Oe.push(N[ft]);continue}const Ke=Math.floor((pt+Xe)/2);$e=H[2*Ke],De=H[2*Ke+1],$e>=Z&&$e<=K&&De>=G&&De<=le&&Oe.push(N[Ke]);const tt=(Ze+1)%2;(Ze===0?Z<=$e:G<=De)&&(ae.push(pt),ae.push(Ke-1),ae.push(tt)),(Ze===0?K>=$e:le>=De)&&(ae.push(Ke+1),ae.push(Xe),ae.push(tt))}return Oe}(this.ids,this.coords,b,S,k,D,this.nodeSize)}within(b,S,k){return function(D,N,H,Z,G,K){const le=[0,D.length-1,0],_e=[],ae=G*G;for(;le.length;){const Oe=le.pop(),$e=le.pop(),De=le.pop();if($e-De<=K){for(let tt=De;tt<=$e;tt++)Ar(N[2*tt],N[2*tt+1],H,Z)<=ae&&_e.push(D[tt]);continue}const Ze=Math.floor((De+$e)/2),Xe=N[2*Ze],pt=N[2*Ze+1];Ar(Xe,pt,H,Z)<=ae&&_e.push(D[Ze]);const Ke=(Oe+1)%2;(Oe===0?H-G<=Xe:Z-G<=pt)&&(le.push(De),le.push(Ze-1),le.push(Ke)),(Oe===0?H+G>=Xe:Z+G>=pt)&&(le.push(Ze+1),le.push($e),le.push(Ke))}return _e}(this.ids,this.coords,b,S,k,this.nodeSize)}}const $n={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:L=>L},dr=Math.fround||(Si=new Float32Array(1),L=>(Si[0]=+L,Si[0]));var Si;class Vn{constructor(b){this.options=Pr(Object.create($n),b),this.trees=new Array(this.options.maxZoom+1)}load(b){const{log:S,minZoom:k,maxZoom:D,nodeSize:N}=this.options;S&&console.time("total time");const H=`prepare ${b.length} points`;S&&console.time(H),this.points=b;let Z=[];for(let G=0;G<b.length;G++)b[G].geometry&&Z.push(mn(b[G],G));this.trees[D+1]=new fn(Z,Gn,pr,N,Float32Array),S&&console.timeEnd(H);for(let G=D;G>=k;G--){const K=+Date.now();Z=this._cluster(Z,G),this.trees[G]=new fn(Z,Gn,pr,N,Float32Array),S&&console.log("z%d: %d clusters in %dms",G,Z.length,+Date.now()-K)}return S&&console.timeEnd("total time"),this}getClusters(b,S){let k=((b[0]+180)%360+360)%360-180;const D=Math.max(-90,Math.min(90,b[1]));let N=b[2]===180?180:((b[2]+180)%360+360)%360-180;const H=Math.max(-90,Math.min(90,b[3]));if(b[2]-b[0]>=360)k=-180,N=180;else if(k>N){const le=this.getClusters([k,D,180,H],S),_e=this.getClusters([-180,D,N,H],S);return le.concat(_e)}const Z=this.trees[this._limitZoom(S)],G=Z.range(ht(k),er(H),ht(N),er(D)),K=[];for(const le of G){const _e=Z.points[le];K.push(_e.numPoints?gn(_e):this.points[_e.index])}return K}getChildren(b){const S=this._getOriginId(b),k=this._getOriginZoom(b),D="No cluster with the specified id.",N=this.trees[k];if(!N)throw new Error(D);const H=N.points[S];if(!H)throw new Error(D);const Z=this.options.radius/(this.options.extent*Math.pow(2,k-1)),G=N.within(H.x,H.y,Z),K=[];for(const le of G){const _e=N.points[le];_e.parentId===b&&K.push(_e.numPoints?gn(_e):this.points[_e.index])}if(K.length===0)throw new Error(D);return K}getLeaves(b,S,k){const D=[];return this._appendLeaves(D,b,S=S||10,k=k||0,0),D}getTile(b,S,k){const D=this.trees[this._limitZoom(b)],N=Math.pow(2,b),{extent:H,radius:Z}=this.options,G=Z/H,K=(k-G)/N,le=(k+1+G)/N,_e={features:[]};return this._addTileFeatures(D.range((S-G)/N,K,(S+1+G)/N,le),D.points,S,k,N,_e),S===0&&this._addTileFeatures(D.range(1-G/N,K,1,le),D.points,N,k,N,_e),S===N-1&&this._addTileFeatures(D.range(0,K,G/N,le),D.points,-1,k,N,_e),_e.features.length?_e:null}getClusterExpansionZoom(b){let S=this._getOriginZoom(b)-1;for(;S<=this.options.maxZoom;){const k=this.getChildren(b);if(S++,k.length!==1)break;b=k[0].properties.cluster_id}return S}_appendLeaves(b,S,k,D,N){const H=this.getChildren(S);for(const Z of H){const G=Z.properties;if(G&&G.cluster?N+G.point_count<=D?N+=G.point_count:N=this._appendLeaves(b,G.cluster_id,k,D,N):N<D?N++:b.push(Z),b.length===k)break}return N}_addTileFeatures(b,S,k,D,N,H){for(const Z of b){const G=S[Z],K=G.numPoints;let le,_e,ae;if(K)le=Nn(G),_e=G.x,ae=G.y;else{const De=this.points[G.index];le=De.properties,_e=ht(De.geometry.coordinates[0]),ae=er(De.geometry.coordinates[1])}const Oe={type:1,geometry:[[Math.round(this.options.extent*(_e*N-k)),Math.round(this.options.extent*(ae*N-D))]],tags:le};let $e;K?$e=G.id:this.options.generateId?$e=G.index:this.points[G.index].id&&($e=this.points[G.index].id),$e!==void 0&&(Oe.id=$e),H.features.push(Oe)}}_limitZoom(b){return Math.max(this.options.minZoom,Math.min(Math.floor(+b),this.options.maxZoom+1))}_cluster(b,S){const k=[],{radius:D,extent:N,reduce:H,minPoints:Z}=this.options,G=D/(N*Math.pow(2,S));for(let K=0;K<b.length;K++){const le=b[K];if(le.zoom<=S)continue;le.zoom=S;const _e=this.trees[S+1],ae=_e.within(le.x,le.y,G),Oe=le.numPoints||1;let $e=Oe;for(const De of ae){const Ze=_e.points[De];Ze.zoom>S&&($e+=Ze.numPoints||1)}if($e>Oe&&$e>=Z){let De=le.x*Oe,Ze=le.y*Oe,Xe=H&&Oe>1?this._map(le,!0):null;const pt=(K<<5)+(S+1)+this.points.length;for(const Ke of ae){const tt=_e.points[Ke];if(tt.zoom<=S)continue;tt.zoom=S;const ft=tt.numPoints||1;De+=tt.x*ft,Ze+=tt.y*ft,tt.parentId=pt,H&&(Xe||(Xe=this._map(le,!0)),H(Xe,this._map(tt)))}le.parentId=pt,k.push(Mr(De/$e,Ze/$e,pt,$e,Xe))}else if(k.push(le),$e>1)for(const De of ae){const Ze=_e.points[De];Ze.zoom<=S||(Ze.zoom=S,k.push(Ze))}}return k}_getOriginId(b){return b-this.points.length>>5}_getOriginZoom(b){return(b-this.points.length)%32}_map(b,S){if(b.numPoints)return S?Pr({},b.properties):b.properties;const k=this.points[b.index].properties,D=this.options.map(k);return S&&D===k?Pr({},D):D}}function Mr(L,b,S,k,D){return{x:dr(L),y:dr(b),zoom:1/0,id:S,parentId:-1,numPoints:k,properties:D}}function mn(L,b){const[S,k]=L.geometry.coordinates;return{x:dr(ht(S)),y:dr(er(k)),zoom:1/0,index:b,parentId:-1}}function gn(L){return{type:"Feature",id:L.id,properties:Nn(L),geometry:{type:"Point",coordinates:[(b=L.x,360*(b-.5)),zr(L.y)]}};var b}function Nn(L){const b=L.numPoints,S=b>=1e4?`${Math.round(b/1e3)}k`:b>=1e3?Math.round(b/100)/10+"k":b;return Pr(Pr({},L.properties),{cluster:!0,cluster_id:L.id,point_count:b,point_count_abbreviated:S})}function ht(L){return L/360+.5}function er(L){const b=Math.sin(L*Math.PI/180),S=.5-.25*Math.log((1+b)/(1-b))/Math.PI;return S<0?0:S>1?1:S}function zr(L){const b=(180-360*L)*Math.PI/180;return 360*Math.atan(Math.exp(b))/Math.PI-90}function Pr(L,b){for(const S in b)L[S]=b[S];return L}function Gn(L){return L.x}function pr(L){return L.y}function fr(L,b,S,k){for(var D,N=k,H=S-b>>1,Z=S-b,G=L[b],K=L[b+1],le=L[S],_e=L[S+1],ae=b+3;ae<S;ae+=3){var Oe=_n(L[ae],L[ae+1],G,K,le,_e);if(Oe>N)D=ae,N=Oe;else if(Oe===N){var $e=Math.abs(ae-H);$e<Z&&(D=ae,Z=$e)}}N>k&&(D-b>3&&fr(L,b,D,k),L[D+2]=N,S-D>3&&fr(L,D,S,k))}function _n(L,b,S,k,D,N){var H=D-S,Z=N-k;if(H!==0||Z!==0){var G=((L-S)*H+(b-k)*Z)/(H*H+Z*Z);G>1?(S=D,k=N):G>0&&(S+=H*G,k+=Z*G)}return(H=L-S)*H+(Z=b-k)*Z}function mr(L,b,S,k){var D={id:L===void 0?null:L,type:b,geometry:S,tags:k,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(N){var H=N.geometry,Z=N.type;if(Z==="Point"||Z==="MultiPoint"||Z==="LineString")de(N,H);else if(Z==="Polygon"||Z==="MultiLineString")for(var G=0;G<H.length;G++)de(N,H[G]);else if(Z==="MultiPolygon")for(G=0;G<H.length;G++)for(var K=0;K<H[G].length;K++)de(N,H[G][K])}(D),D}function de(L,b){for(var S=0;S<b.length;S+=3)L.minX=Math.min(L.minX,b[S]),L.minY=Math.min(L.minY,b[S+1]),L.maxX=Math.max(L.maxX,b[S]),L.maxY=Math.max(L.maxY,b[S+1])}function Ce(L,b,S,k){if(b.geometry){var D=b.geometry.coordinates,N=b.geometry.type,H=Math.pow(S.tolerance/((1<<S.maxZoom)*S.extent),2),Z=[],G=b.id;if(S.promoteId?G=b.properties[S.promoteId]:S.generateId&&(G=k||0),N==="Point")Zr(D,Z);else if(N==="MultiPoint")for(var K=0;K<D.length;K++)Zr(D[K],Z);else if(N==="LineString")ji(D,Z,H,!1);else if(N==="MultiLineString"){if(S.lineMetrics){for(K=0;K<D.length;K++)ji(D[K],Z=[],H,!1),L.push(mr(G,"LineString",Z,b.properties));return}dt(D,Z,H,!1)}else if(N==="Polygon")dt(D,Z,H,!0);else{if(N!=="MultiPolygon"){if(N==="GeometryCollection"){for(K=0;K<b.geometry.geometries.length;K++)Ce(L,{id:G,geometry:b.geometry.geometries[K],properties:b.properties},S,k);return}throw new Error("Input data is not a valid GeoJSON object.")}for(K=0;K<D.length;K++){var le=[];dt(D[K],le,H,!0),Z.push(le)}}L.push(mr(G,N,Z,b.properties))}}function Zr(L,b){b.push(Oi(L[0])),b.push(Ii(L[1])),b.push(0)}function ji(L,b,S,k){for(var D,N,H=0,Z=0;Z<L.length;Z++){var G=Oi(L[Z][0]),K=Ii(L[Z][1]);b.push(G),b.push(K),b.push(0),Z>0&&(H+=k?(D*K-G*N)/2:Math.sqrt(Math.pow(G-D,2)+Math.pow(K-N,2))),D=G,N=K}var le=b.length-3;b[2]=1,fr(b,0,le,S),b[le+2]=1,b.size=Math.abs(H),b.start=0,b.end=b.size}function dt(L,b,S,k){for(var D=0;D<L.length;D++){var N=[];ji(L[D],N,S,k),b.push(N)}}function Oi(L){return L/360+.5}function Ii(L){var b=Math.sin(L*Math.PI/180),S=.5-.25*Math.log((1+b)/(1-b))/Math.PI;return S<0?0:S>1?1:S}function Ai(L,b,S,k,D,N,H,Z){if(k/=b,N>=(S/=b)&&H<k)return L;if(H<S||N>=k)return null;for(var G=[],K=0;K<L.length;K++){var le=L[K],_e=le.geometry,ae=le.type,Oe=D===0?le.minX:le.minY,$e=D===0?le.maxX:le.maxY;if(Oe>=S&&$e<k)G.push(le);else if(!($e<S||Oe>=k)){var De=[];if(ae==="Point"||ae==="MultiPoint")kr(_e,De,S,k,D);else if(ae==="LineString")Se(_e,De,S,k,D,!1,Z.lineMetrics);else if(ae==="MultiLineString")Ye(_e,De,S,k,D,!1);else if(ae==="Polygon")Ye(_e,De,S,k,D,!0);else if(ae==="MultiPolygon")for(var Ze=0;Ze<_e.length;Ze++){var Xe=[];Ye(_e[Ze],Xe,S,k,D,!0),Xe.length&&De.push(Xe)}if(De.length){if(Z.lineMetrics&&ae==="LineString"){for(Ze=0;Ze<De.length;Ze++)G.push(mr(le.id,ae,De[Ze],le.tags));continue}ae!=="LineString"&&ae!=="MultiLineString"||(De.length===1?(ae="LineString",De=De[0]):ae="MultiLineString"),ae!=="Point"&&ae!=="MultiPoint"||(ae=De.length===3?"Point":"MultiPoint"),G.push(mr(le.id,ae,De,le.tags))}}}return G.length?G:null}function kr(L,b,S,k,D){for(var N=0;N<L.length;N+=3){var H=L[N+D];H>=S&&H<=k&&(b.push(L[N]),b.push(L[N+1]),b.push(L[N+2]))}}function Se(L,b,S,k,D,N,H){for(var Z,G,K=et(L),le=D===0?Dr:Je,_e=L.start,ae=0;ae<L.length-3;ae+=3){var Oe=L[ae],$e=L[ae+1],De=L[ae+2],Ze=L[ae+3],Xe=L[ae+4],pt=D===0?Oe:$e,Ke=D===0?Ze:Xe,tt=!1;H&&(Z=Math.sqrt(Math.pow(Oe-Ze,2)+Math.pow($e-Xe,2))),pt<S?Ke>S&&(G=le(K,Oe,$e,Ze,Xe,S),H&&(K.start=_e+Z*G)):pt>k?Ke<k&&(G=le(K,Oe,$e,Ze,Xe,k),H&&(K.start=_e+Z*G)):oi(K,Oe,$e,De),Ke<S&&pt>=S&&(G=le(K,Oe,$e,Ze,Xe,S),tt=!0),Ke>k&&pt<=k&&(G=le(K,Oe,$e,Ze,Xe,k),tt=!0),!N&&tt&&(H&&(K.end=_e+Z*G),b.push(K),K=et(L)),H&&(_e+=Z)}var ft=L.length-3;Oe=L[ft],$e=L[ft+1],De=L[ft+2],(pt=D===0?Oe:$e)>=S&&pt<=k&&oi(K,Oe,$e,De),ft=K.length-3,N&&ft>=3&&(K[ft]!==K[0]||K[ft+1]!==K[1])&&oi(K,K[0],K[1],K[2]),K.length&&b.push(K)}function et(L){var b=[];return b.size=L.size,b.start=L.start,b.end=L.end,b}function Ye(L,b,S,k,D,N){for(var H=0;H<L.length;H++)Se(L[H],b,S,k,D,N,!1)}function oi(L,b,S,k){L.push(b),L.push(S),L.push(k)}function Dr(L,b,S,k,D,N){var H=(N-b)/(k-b);return L.push(N),L.push(S+(D-S)*H),L.push(1),H}function Je(L,b,S,k,D,N){var H=(N-S)/(D-S);return L.push(b+(k-b)*H),L.push(N),L.push(1),H}function gr(L,b){for(var S=[],k=0;k<L.length;k++){var D,N=L[k],H=N.type;if(H==="Point"||H==="MultiPoint"||H==="LineString")D=Yt(N.geometry,b);else if(H==="MultiLineString"||H==="Polygon"){D=[];for(var Z=0;Z<N.geometry.length;Z++)D.push(Yt(N.geometry[Z],b))}else if(H==="MultiPolygon")for(D=[],Z=0;Z<N.geometry.length;Z++){for(var G=[],K=0;K<N.geometry[Z].length;K++)G.push(Yt(N.geometry[Z][K],b));D.push(G)}S.push(mr(N.id,H,D,N.tags))}return S}function Yt(L,b){var S=[];S.size=L.size,L.start!==void 0&&(S.start=L.start,S.end=L.end);for(var k=0;k<L.length;k+=3)S.push(L[k]+b,L[k+1],L[k+2]);return S}function yn(L,b){if(L.transformed)return L;var S,k,D,N=1<<L.z,H=L.x,Z=L.y;for(S=0;S<L.features.length;S++){var G=L.features[S],K=G.geometry,le=G.type;if(G.geometry=[],le===1)for(k=0;k<K.length;k+=2)G.geometry.push(qt(K[k],K[k+1],b,N,H,Z));else for(k=0;k<K.length;k++){var _e=[];for(D=0;D<K[k].length;D+=2)_e.push(qt(K[k][D],K[k][D+1],b,N,H,Z));G.geometry.push(_e)}}return L.transformed=!0,L}function qt(L,b,S,k,D,N){return[Math.round(S*(L*k-D)),Math.round(S*(b*k-N))]}function fi(L,b,S,k,D){for(var N=b===D.maxZoom?0:D.tolerance/((1<<b)*D.extent),H={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:S,y:k,z:b,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0},Z=0;Z<L.length;Z++){H.numFeatures++,Tt(H,L[Z],N,D);var G=L[Z].minX,K=L[Z].minY,le=L[Z].maxX,_e=L[Z].maxY;G<H.minX&&(H.minX=G),K<H.minY&&(H.minY=K),le>H.maxX&&(H.maxX=le),_e>H.maxY&&(H.maxY=_e)}return H}function Tt(L,b,S,k){var D=b.geometry,N=b.type,H=[];if(N==="Point"||N==="MultiPoint")for(var Z=0;Z<D.length;Z+=3)H.push(D[Z]),H.push(D[Z+1]),L.numPoints++,L.numSimplified++;else if(N==="LineString")xn(H,D,L,S,!1,!1);else if(N==="MultiLineString"||N==="Polygon")for(Z=0;Z<D.length;Z++)xn(H,D[Z],L,S,N==="Polygon",Z===0);else if(N==="MultiPolygon")for(var G=0;G<D.length;G++){var K=D[G];for(Z=0;Z<K.length;Z++)xn(H,K[Z],L,S,!0,Z===0)}if(H.length){var le=b.tags||null;if(N==="LineString"&&k.lineMetrics){for(var _e in le={},b.tags)le[_e]=b.tags[_e];le.mapbox_clip_start=D.start/D.size,le.mapbox_clip_end=D.end/D.size}var ae={geometry:H,type:N==="Polygon"||N==="MultiPolygon"?3:N==="LineString"||N==="MultiLineString"?2:1,tags:le};b.id!==null&&(ae.id=b.id),L.features.push(ae)}}function xn(L,b,S,k,D,N){var H=k*k;if(k>0&&b.size<(D?H:k))S.numPoints+=b.length/3;else{for(var Z=[],G=0;G<b.length;G+=3)(k===0||b[G+2]>H)&&(S.numSimplified++,Z.push(b[G]),Z.push(b[G+1])),S.numPoints++;D&&function(K,le){for(var _e=0,ae=0,Oe=K.length,$e=Oe-2;ae<Oe;$e=ae,ae+=2)_e+=(K[ae]-K[$e])*(K[ae+1]+K[$e+1]);if(_e>0===le)for(ae=0,Oe=K.length;ae<Oe/2;ae+=2){var De=K[ae],Ze=K[ae+1];K[ae]=K[Oe-2-ae],K[ae+1]=K[Oe-1-ae],K[Oe-2-ae]=De,K[Oe-1-ae]=Ze}}(Z,N),L.push(Z)}}function tr(L,b){var S=(b=this.options=function(D,N){for(var H in N)D[H]=N[H];return D}(Object.create(this.options),b)).debug;if(S&&console.time("preprocess data"),b.maxZoom<0||b.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(b.promoteId&&b.generateId)throw new Error("promoteId and generateId cannot be used together.");var k=function(D,N){var H=[];if(D.type==="FeatureCollection")for(var Z=0;Z<D.features.length;Z++)Ce(H,D.features[Z],N,Z);else Ce(H,D.type==="Feature"?D:{geometry:D},N);return H}(L,b);this.tiles={},this.tileCoords=[],S&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",b.indexMaxZoom,b.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),k=function(D,N){var H=N.buffer/N.extent,Z=D,G=Ai(D,1,-1-H,H,0,-1,2,N),K=Ai(D,1,1-H,2+H,0,-1,2,N);return(G||K)&&(Z=Ai(D,1,-H,1+H,0,-1,2,N)||[],G&&(Z=gr(G,1).concat(Z)),K&&(Z=Z.concat(gr(K,-1)))),Z}(k,b),k.length&&this.splitTile(k,0,0,0),S&&(k.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}function jr(L,b,S){return 32*((1<<L)*S+b)+L}function Xr(L,b){const S=L.tileID.canonical;if(!this._geoJSONIndex)return b(null,null);const k=this._geoJSONIndex.getTile(S.z,S.x,S.y);if(!k)return b(null,null);const D=new Gi(k.features);let N=Fi.exports(D);N.byteOffset===0&&N.byteLength===N.buffer.byteLength||(N=new Uint8Array(N)),b(null,{vectorTile:D,rawData:N.buffer})}tr.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},tr.prototype.splitTile=function(L,b,S,k,D,N,H){for(var Z=[L,b,S,k],G=this.options,K=G.debug;Z.length;){k=Z.pop(),S=Z.pop(),b=Z.pop(),L=Z.pop();var le=1<<b,_e=jr(b,S,k),ae=this.tiles[_e];if(!ae&&(K>1&&console.time("creation"),ae=this.tiles[_e]=fi(L,b,S,k,G),this.tileCoords.push({z:b,x:S,y:k}),K)){K>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",b,S,k,ae.numFeatures,ae.numPoints,ae.numSimplified),console.timeEnd("creation"));var Oe="z"+b;this.stats[Oe]=(this.stats[Oe]||0)+1,this.total++}if(ae.source=L,D){if(b===G.maxZoom||b===D)continue;var $e=1<<D-b;if(S!==Math.floor(N/$e)||k!==Math.floor(H/$e))continue}else if(b===G.indexMaxZoom||ae.numPoints<=G.indexMaxPoints)continue;if(ae.source=null,L.length!==0){K>1&&console.time("clipping");var De,Ze,Xe,pt,Ke,tt,ft=.5*G.buffer/G.extent,St=.5-ft,Qt=.5+ft,kt=1+ft;De=Ze=Xe=pt=null,Ke=Ai(L,le,S-ft,S+Qt,0,ae.minX,ae.maxX,G),tt=Ai(L,le,S+St,S+kt,0,ae.minX,ae.maxX,G),L=null,Ke&&(De=Ai(Ke,le,k-ft,k+Qt,1,ae.minY,ae.maxY,G),Ze=Ai(Ke,le,k+St,k+kt,1,ae.minY,ae.maxY,G),Ke=null),tt&&(Xe=Ai(tt,le,k-ft,k+Qt,1,ae.minY,ae.maxY,G),pt=Ai(tt,le,k+St,k+kt,1,ae.minY,ae.maxY,G),tt=null),K>1&&console.timeEnd("clipping"),Z.push(De||[],b+1,2*S,2*k),Z.push(Ze||[],b+1,2*S,2*k+1),Z.push(Xe||[],b+1,2*S+1,2*k),Z.push(pt||[],b+1,2*S+1,2*k+1)}}},tr.prototype.getTile=function(L,b,S){var k=this.options,D=k.extent,N=k.debug;if(L<0||L>24)return null;var H=1<<L,Z=jr(L,b=(b%H+H)%H,S);if(this.tiles[Z])return yn(this.tiles[Z],D);N>1&&console.log("drilling down to z%d-%d-%d",L,b,S);for(var G,K=L,le=b,_e=S;!G&&K>0;)K--,le=Math.floor(le/2),_e=Math.floor(_e/2),G=this.tiles[jr(K,le,_e)];return G&&G.source?(N>1&&console.log("found parent tile z%d-%d-%d",K,le,_e),N>1&&console.time("drilling down"),this.splitTile(G.source,K,le,_e,L,b,S),N>1&&console.timeEnd("drilling down"),this.tiles[Z]?yn(this.tiles[Z],D):null):null};class vn extends He{constructor(b,S,k,D){super(b,S,k,Xr),D&&(this.loadGeoJSON=D)}loadData(b,S){var k;(k=this._pendingRequest)===null||k===void 0||k.cancel(),this._pendingCallback&&this._pendingCallback(null,{abandoned:!0});const D=!!(b&&b.request&&b.request.collectResourceTiming)&&new l.RequestPerformance(b.request);this._pendingCallback=S,this._pendingRequest=this.loadGeoJSON(b,(N,H)=>{if(delete this._pendingCallback,delete this._pendingRequest,N||!H)return S(N);if(typeof H!="object")return S(new Error(`Input data given to '${b.source}' is not a valid GeoJSON object.`));{Mt(H,!0);try{if(b.filter){const G=l.createExpression(b.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(G.result==="error")throw new Error(G.value.map(le=>`${le.key}: ${le.message}`).join(", "));H={type:"FeatureCollection",features:H.features.filter(le=>G.value.evaluate({zoom:0},le))}}this._geoJSONIndex=b.cluster?new Vn(function({superclusterOptions:G,clusterProperties:K}){if(!K||!G)return G;const le={},_e={},ae={accumulated:null,zoom:0},Oe={properties:null},$e=Object.keys(K);for(const De of $e){const[Ze,Xe]=K[De],pt=l.createExpression(Xe),Ke=l.createExpression(typeof Ze=="string"?[Ze,["accumulated"],["get",De]]:Ze);le[De]=pt.value,_e[De]=Ke.value}return G.map=De=>{Oe.properties=De;const Ze={};for(const Xe of $e)Ze[Xe]=le[Xe].evaluate(ae,Oe);return Ze},G.reduce=(De,Ze)=>{Oe.properties=Ze;for(const Xe of $e)ae.accumulated=De[Xe],De[Xe]=_e[Xe].evaluate(ae,Oe)},G}(b)).load(H.features):function(G,K){return new tr(G,K)}(H,b.geojsonVtOptions)}catch(G){return S(G)}this.loaded={};const Z={};if(D){const G=D.finish();G&&(Z.resourceTiming={},Z.resourceTiming[b.source]=JSON.parse(JSON.stringify(G)))}S(null,Z)}})}reloadTile(b,S){const k=this.loaded;return k&&k[b.uid]?super.reloadTile(b,S):this.loadTile(b,S)}loadGeoJSON(b,S){if(b.request)return l.getJSON(b.request,S);if(typeof b.data=="string")try{S(null,JSON.parse(b.data))}catch(k){S(new Error(`Input data given to '${b.source}' is not a valid GeoJSON object.`))}else S(new Error(`Input data given to '${b.source}' is not a valid GeoJSON object.`));return{cancel:()=>{}}}removeSource(b,S){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),S()}getClusterExpansionZoom(b,S){try{S(null,this._geoJSONIndex.getClusterExpansionZoom(b.clusterId))}catch(k){S(k)}}getClusterChildren(b,S){try{S(null,this._geoJSONIndex.getChildren(b.clusterId))}catch(k){S(k)}}getClusterLeaves(b,S){try{S(null,this._geoJSONIndex.getLeaves(b.clusterId,b.limit,b.offset))}catch(k){S(k)}}}class Wr{constructor(b){this.self=b,this.actor=new l.Actor(b,this),this.layerIndexes={},this.availableImages={},this.workerSourceTypes={vector:He,geojson:vn},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(S,k)=>{if(this.workerSourceTypes[S])throw new Error(`Worker source with name "${S}" already registered.`);this.workerSourceTypes[S]=k},this.self.registerRTLTextPlugin=S=>{if(l.plugin.isParsed())throw new Error("RTL text plugin already registered.");l.plugin.applyArabicShaping=S.applyArabicShaping,l.plugin.processBidirectionalText=S.processBidirectionalText,l.plugin.processStyledBidirectionalText=S.processStyledBidirectionalText}}setReferrer(b,S){this.referrer=S}setImages(b,S,k){this.availableImages[b]=S;for(const D in this.workerSources[b]){const N=this.workerSources[b][D];for(const H in N)N[H].availableImages=S}k()}setLayers(b,S,k){this.getLayerIndex(b).replace(S),k()}updateLayers(b,S,k){this.getLayerIndex(b).update(S.layers,S.removedIds),k()}loadTile(b,S,k){this.getWorkerSource(b,S.type,S.source).loadTile(S,k)}loadDEMTile(b,S,k){this.getDEMWorkerSource(b,S.source).loadTile(S,k)}reloadTile(b,S,k){this.getWorkerSource(b,S.type,S.source).reloadTile(S,k)}abortTile(b,S,k){this.getWorkerSource(b,S.type,S.source).abortTile(S,k)}removeTile(b,S,k){this.getWorkerSource(b,S.type,S.source).removeTile(S,k)}removeDEMTile(b,S){this.getDEMWorkerSource(b,S.source).removeTile(S)}removeSource(b,S,k){if(!this.workerSources[b]||!this.workerSources[b][S.type]||!this.workerSources[b][S.type][S.source])return;const D=this.workerSources[b][S.type][S.source];delete this.workerSources[b][S.type][S.source],D.removeSource!==void 0?D.removeSource(S,k):k()}loadWorkerSource(b,S,k){try{this.self.importScripts(S.url),k()}catch(D){k(D.toString())}}syncRTLPluginState(b,S,k){try{l.plugin.setState(S);const D=l.plugin.getPluginURL();if(l.plugin.isLoaded()&&!l.plugin.isParsed()&&D!=null){this.self.importScripts(D);const N=l.plugin.isParsed();k(N?void 0:new Error(`RTL Text Plugin failed to import scripts from ${D}`),N)}}catch(D){k(D.toString())}}getAvailableImages(b){let S=this.availableImages[b];return S||(S=[]),S}getLayerIndex(b){let S=this.layerIndexes[b];return S||(S=this.layerIndexes[b]=new Ee),S}getWorkerSource(b,S,k){if(this.workerSources[b]||(this.workerSources[b]={}),this.workerSources[b][S]||(this.workerSources[b][S]={}),!this.workerSources[b][S][k]){const D={send:(N,H,Z)=>{this.actor.send(N,H,Z,b)}};this.workerSources[b][S][k]=new this.workerSourceTypes[S](D,this.getLayerIndex(b),this.getAvailableImages(b))}return this.workerSources[b][S][k]}getDEMWorkerSource(b,S){return this.demWorkerSources[b]||(this.demWorkerSources[b]={}),this.demWorkerSources[b][S]||(this.demWorkerSources[b][S]=new Ut),this.demWorkerSources[b][S]}enforceCacheSizeLimit(b,S){l.enforceCacheSizeLimit(S)}}return l.isWorker()&&(self.worker=new Wr(self)),Wr}),Q(["./shared"],function(l){var ve=me;function me(a){return!function(t){return typeof window>"u"||typeof document>"u"?"not a browser":Array.prototype&&Array.prototype.every&&Array.prototype.filter&&Array.prototype.forEach&&Array.prototype.indexOf&&Array.prototype.lastIndexOf&&Array.prototype.map&&Array.prototype.some&&Array.prototype.reduce&&Array.prototype.reduceRight&&Array.isArray?Function.prototype&&Function.prototype.bind?Object.keys&&Object.create&&Object.getPrototypeOf&&Object.getOwnPropertyNames&&Object.isSealed&&Object.isFrozen&&Object.isExtensible&&Object.getOwnPropertyDescriptor&&Object.defineProperty&&Object.defineProperties&&Object.seal&&Object.freeze&&Object.preventExtensions?"JSON"in window&&"parse"in JSON&&"stringify"in JSON?function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var s,u,d=new Blob([""],{type:"text/javascript"}),f=URL.createObjectURL(d);try{u=new Worker(f),s=!0}catch(_){s=!1}return u&&u.terminate(),URL.revokeObjectURL(f),s}()?"Uint8ClampedArray"in window?ArrayBuffer.isView?function(){var s=document.createElement("canvas");s.width=s.height=1;var u=s.getContext("2d");if(!u)return!1;var d=u.getImageData(0,0,1,1);return d&&d.width===s.width}()?(Ee[n=t&&t.failIfMajorPerformanceCaveat]===void 0&&(Ee[n]=function(s){var u,d=function(f){var _=document.createElement("canvas"),y=Object.create(me.webGLContextAttributes);return y.failIfMajorPerformanceCaveat=f,_.getContext("webgl",y)||_.getContext("experimental-webgl",y)}(s);if(!d)return!1;try{u=d.createShader(d.VERTEX_SHADER)}catch(f){return!1}return!(!u||d.isContextLost())&&(d.shaderSource(u,"void main() {}"),d.compileShader(u),d.getShaderParameter(u,d.COMPILE_STATUS)===!0)}(n)),Ee[n]?document.documentMode?"insufficient ECMAScript 6 support":void 0:"insufficient WebGL support"):"insufficient Canvas/getImageData support":"insufficient ArrayBuffer support":"insufficient Uint8ClampedArray support":"insufficient worker support":"insufficient JSON support":"insufficient Object support":"insufficient Function support":"insufficent Array support";var n}(a)}var Ee={};function Te(a,t){if(Array.isArray(a)){if(!Array.isArray(t)||a.length!==t.length)return!1;for(let n=0;n<a.length;n++)if(!Te(a[n],t[n]))return!1;return!0}if(typeof a=="object"&&a!==null&&t!==null){if(typeof t!="object"||Object.keys(a).length!==Object.keys(t).length)return!1;for(const n in a)if(!Te(a[n],t[n]))return!1;return!0}return a===t}me.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0};class se{static testProp(t){if(!se.docStyle)return t[0];for(let n=0;n<t.length;n++)if(t[n]in se.docStyle)return t[n];return t[0]}static create(t,n,s){const u=window.document.createElement(t);return n!==void 0&&(u.className=n),s&&s.appendChild(u),u}static createNS(t,n){return window.document.createElementNS(t,n)}static disableDrag(){se.docStyle&&se.selectProp&&(se.userSelect=se.docStyle[se.selectProp],se.docStyle[se.selectProp]="none")}static enableDrag(){se.docStyle&&se.selectProp&&(se.docStyle[se.selectProp]=se.userSelect)}static setTransform(t,n){t.style[se.transformProp]=n}static addEventListener(t,n,s,u={}){t.addEventListener(n,s,"passive"in u?u:u.capture)}static removeEventListener(t,n,s,u={}){t.removeEventListener(n,s,"passive"in u?u:u.capture)}static suppressClickInternal(t){t.preventDefault(),t.stopPropagation(),window.removeEventListener("click",se.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",se.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",se.suppressClickInternal,!0)},0)}static mousePos(t,n){const s=t.getBoundingClientRect();return new l.pointGeometry(n.clientX-s.left-t.clientLeft,n.clientY-s.top-t.clientTop)}static touchPos(t,n){const s=t.getBoundingClientRect(),u=[];for(let d=0;d<n.length;d++)u.push(new l.pointGeometry(n[d].clientX-s.left-t.clientLeft,n[d].clientY-s.top-t.clientTop));return u}static mouseButton(t){return t.button}static remove(t){t.parentNode&&t.parentNode.removeChild(t)}}se.docStyle=typeof window<"u"&&window.document&&window.document.documentElement.style,se.selectProp=se.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),se.transformProp=se.testProp(["transform","WebkitTransform"]);class gt{constructor(t){this._transformRequestFn=t}transformRequest(t,n){return this._transformRequestFn&&this._transformRequestFn(t,n)||{url:t}}normalizeSpriteURL(t,n,s){const u=function(d){const f=d.match(nt);if(!f)throw new Error(`Unable to parse URL "${d}"`);return{protocol:f[1],authority:f[2],path:f[3]||"/",params:f[4]?f[4].split("&"):[]}}(t);return u.path+=`${n}${s}`,function(d){const f=d.params.length?`?${d.params.join("&")}`:"";return`${d.protocol}://${d.authority}${d.path}${f}`}(u)}setTransformRequest(t){this._transformRequestFn=t}}const nt=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;class He{constructor(t,n,s,u){this.context=t,this.format=s,this.texture=t.gl.createTexture(),this.update(n,u)}update(t,n,s){const{width:u,height:d}=t,f=!(this.size&&this.size[0]===u&&this.size[1]===d||s),{context:_}=this,{gl:y}=_;if(this.useMipmap=Boolean(n&&n.useMipmap),y.bindTexture(y.TEXTURE_2D,this.texture),_.pixelStoreUnpackFlipY.set(!1),_.pixelStoreUnpack.set(1),_.pixelStoreUnpackPremultiplyAlpha.set(this.format===y.RGBA&&(!n||n.premultiply!==!1)),f)this.size=[u,d],t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||l.isImageBitmap(t)?y.texImage2D(y.TEXTURE_2D,0,this.format,this.format,y.UNSIGNED_BYTE,t):y.texImage2D(y.TEXTURE_2D,0,this.format,u,d,0,this.format,y.UNSIGNED_BYTE,t.data);else{const{x:v,y:T}=s||{x:0,y:0};t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||l.isImageBitmap(t)?y.texSubImage2D(y.TEXTURE_2D,0,v,T,y.RGBA,y.UNSIGNED_BYTE,t):y.texSubImage2D(y.TEXTURE_2D,0,v,T,u,d,y.RGBA,y.UNSIGNED_BYTE,t.data)}this.useMipmap&&this.isSizePowerOfTwo()&&y.generateMipmap(y.TEXTURE_2D)}bind(t,n,s){const{context:u}=this,{gl:d}=u;d.bindTexture(d.TEXTURE_2D,this.texture),s!==d.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(s=d.LINEAR),t!==this.filter&&(d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MAG_FILTER,t),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MIN_FILTER,s||t),this.filter=t),n!==this.wrap&&(d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_S,n),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_T,n),this.wrap=n)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:t}=this.context;t.deleteTexture(this.texture),this.texture=null}}function Ut(a){const{userImage:t}=a;return!!(t&&t.render&&t.render())&&(a.data.replace(new Uint8Array(t.data.buffer)),!0)}class Mt extends l.Evented{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new l.RGBAImage({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(t){if(this.loaded!==t&&(this.loaded=t,t)){for(const{ids:n,callback:s}of this.requestors)this._notify(n,s);this.requestors=[]}}getImage(t){return this.images[t]}addImage(t,n){if(this.images[t])throw new Error(`Image id ${t} already exist, use updateImage instead`);this._validate(t,n)&&(this.images[t]=n)}_validate(t,n){let s=!0;return this._validateStretch(n.stretchX,n.data&&n.data.width)||(this.fire(new l.ErrorEvent(new Error(`Image "${t}" has invalid "stretchX" value`))),s=!1),this._validateStretch(n.stretchY,n.data&&n.data.height)||(this.fire(new l.ErrorEvent(new Error(`Image "${t}" has invalid "stretchY" value`))),s=!1),this._validateContent(n.content,n)||(this.fire(new l.ErrorEvent(new Error(`Image "${t}" has invalid "content" value`))),s=!1),s}_validateStretch(t,n){if(!t)return!0;let s=0;for(const u of t){if(u[0]<s||u[1]<u[0]||n<u[1])return!1;s=u[1]}return!0}_validateContent(t,n){return!(t&&(t.length!==4||t[0]<0||n.data.width<t[0]||t[1]<0||n.data.height<t[1]||t[2]<0||n.data.width<t[2]||t[3]<0||n.data.height<t[3]||t[2]<t[0]||t[3]<t[1]))}updateImage(t,n){const s=this.images[t];if(s.data.width!==n.data.width||s.data.height!==n.data.height)throw new Error(`size mismatch between old image (${s.data.width}x${s.data.height}) and new image (${n.data.width}x${n.data.height}).`);n.version=s.version+1,this.images[t]=n,this.updatedImages[t]=!0}removeImage(t){const n=this.images[t];delete this.images[t],delete this.patterns[t],n.userImage&&n.userImage.onRemove&&n.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(t,n){let s=!0;if(!this.isLoaded())for(const u of t)this.images[u]||(s=!1);this.isLoaded()||s?this._notify(t,n):this.requestors.push({ids:t,callback:n})}_notify(t,n){const s={};for(const u of t){this.images[u]||this.fire(new l.Event("styleimagemissing",{id:u}));const d=this.images[u];d?s[u]={data:d.data.clone(),pixelRatio:d.pixelRatio,sdf:d.sdf,version:d.version,stretchX:d.stretchX,stretchY:d.stretchY,content:d.content,hasRenderCallback:Boolean(d.userImage&&d.userImage.render)}:l.warnOnce(`Image "${u}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`)}n(null,s)}getPixelSize(){const{width:t,height:n}=this.atlasImage;return{width:t,height:n}}getPattern(t){const n=this.patterns[t],s=this.getImage(t);if(!s)return null;if(n&&n.position.version===s.version)return n.position;if(n)n.position.version=s.version;else{const u={w:s.data.width+2,h:s.data.height+2,x:0,y:0},d=new l.ImagePosition(u,s);this.patterns[t]={bin:u,position:d}}return this._updatePatternAtlas(),this.patterns[t].position}bind(t){const n=t.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new He(t,this.atlasImage,n.RGBA),this.atlasTexture.bind(n.LINEAR,n.CLAMP_TO_EDGE)}_updatePatternAtlas(){const t=[];for(const d in this.patterns)t.push(this.patterns[d].bin);const{w:n,h:s}=l.potpack(t),u=this.atlasImage;u.resize({width:n||1,height:s||1});for(const d in this.patterns){const{bin:f}=this.patterns[d],_=f.x+1,y=f.y+1,v=this.images[d].data,T=v.width,I=v.height;l.RGBAImage.copy(v,u,{x:0,y:0},{x:_,y},{width:T,height:I}),l.RGBAImage.copy(v,u,{x:0,y:I-1},{x:_,y:y-1},{width:T,height:1}),l.RGBAImage.copy(v,u,{x:0,y:0},{x:_,y:y+I},{width:T,height:1}),l.RGBAImage.copy(v,u,{x:T-1,y:0},{x:_-1,y},{width:1,height:I}),l.RGBAImage.copy(v,u,{x:0,y:0},{x:_+T,y},{width:1,height:I})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(t){for(const n of t){if(this.callbackDispatchedThisFrame[n])continue;this.callbackDispatchedThisFrame[n]=!0;const s=this.images[n];s||l.warnOnce(`Image with ID: "${n}" was not found`),Ut(s)&&this.updateImage(n,s)}}}const ct=1e20;function vt(a,t,n,s,u,d,f,_,y){for(let v=t;v<t+s;v++)Wt(a,n*d+v,d,u,f,_,y);for(let v=n;v<n+u;v++)Wt(a,v*d+t,1,s,f,_,y)}function Wt(a,t,n,s,u,d,f){d[0]=0,f[0]=-ct,f[1]=ct,u[0]=a[t];for(let _=1,y=0,v=0;_<s;_++){u[_]=a[t+_*n];const T=_*_;do{const I=d[y];v=(u[_]-u[I]+T-I*I)/(_-I)/2}while(v<=f[y]&&--y>-1);y++,d[y]=_,f[y]=v,f[y+1]=ct}for(let _=0,y=0;_<s;_++){for(;f[y+1]<_;)y++;const v=d[y],T=_-v;a[t+_*n]=u[v]+T*T}}class $t{constructor(t,n){this.requestManager=t,this.localIdeographFontFamily=n,this.entries={}}setURL(t){this.url=t}getGlyphs(t,n){const s=[];for(const u in t)for(const d of t[u])s.push({stack:u,id:d});l.asyncAll(s,({stack:u,id:d},f)=>{let _=this.entries[u];_||(_=this.entries[u]={glyphs:{},requests:{},ranges:{}});let y=_.glyphs[d];if(y!==void 0)return void f(null,{stack:u,id:d,glyph:y});if(y=this._tinySDF(_,u,d),y)return _.glyphs[d]=y,void f(null,{stack:u,id:d,glyph:y});const v=Math.floor(d/256);if(256*v>65535)return void f(new Error("glyphs > 65535 not supported"));if(_.ranges[v])return void f(null,{stack:u,id:d,glyph:y});let T=_.requests[v];T||(T=_.requests[v]=[],$t.loadGlyphRange(u,v,this.url,this.requestManager,(I,C)=>{if(C){for(const F in C)this._doesCharSupportLocalGlyph(+F)||(_.glyphs[+F]=C[+F]);_.ranges[v]=!0}for(const F of T)F(I,C);delete _.requests[v]})),T.push((I,C)=>{I?f(I):C&&f(null,{stack:u,id:d,glyph:C[d]||null})})},(u,d)=>{if(u)n(u);else if(d){const f={};for(const{stack:_,id:y,glyph:v}of d)(f[_]||(f[_]={}))[y]=v&&{id:v.id,bitmap:v.bitmap.clone(),metrics:v.metrics};n(null,f)}})}_doesCharSupportLocalGlyph(t){return!!this.localIdeographFontFamily&&(l.unicodeBlockLookup["CJK Unified Ideographs"](t)||l.unicodeBlockLookup["Hangul Syllables"](t)||l.unicodeBlockLookup.Hiragana(t)||l.unicodeBlockLookup.Katakana(t))}_tinySDF(t,n,s){const u=this.localIdeographFontFamily;if(!u||!this._doesCharSupportLocalGlyph(s))return;let d=t.tinySDF;if(!d){let _="400";/bold/i.test(n)?_="900":/medium/i.test(n)?_="500":/light/i.test(n)&&(_="200"),d=t.tinySDF=new $t.TinySDF({fontSize:24,buffer:3,radius:8,cutoff:.25,fontFamily:u,fontWeight:_})}const f=d.draw(String.fromCharCode(s));return{id:s,bitmap:new l.AlphaImage({width:f.width||30,height:f.height||30},f.data),metrics:{width:f.glyphWidth||24,height:f.glyphHeight||24,left:f.glyphLeft||0,top:f.glyphTop-27||-8,advance:f.glyphAdvance||24}}}}$t.loadGlyphRange=function(a,t,n,s,u){const d=256*t,f=d+255,_=s.transformRequest(n.replace("{fontstack}",a).replace("{range}",`${d}-${f}`),l.ResourceType.Glyphs);l.getArrayBuffer(_,(y,v)=>{if(y)u(y);else if(v){const T={};for(const I of l.parseGlyphPbf(v))T[I.id]=I;u(null,T)}})},$t.TinySDF=class{constructor({fontSize:a=24,buffer:t=3,radius:n=8,cutoff:s=.25,fontFamily:u="sans-serif",fontWeight:d="normal",fontStyle:f="normal"}={}){this.buffer=t,this.cutoff=s,this.radius=n;const _=this.size=a+4*t,y=this._createCanvas(_),v=this.ctx=y.getContext("2d",{willReadFrequently:!0});v.font=`${f} ${d} ${a}px ${u}`,v.textBaseline="alphabetic",v.textAlign="left",v.fillStyle="black",this.gridOuter=new Float64Array(_*_),this.gridInner=new Float64Array(_*_),this.f=new Float64Array(_),this.z=new Float64Array(_+1),this.v=new Uint16Array(_)}_createCanvas(a){const t=document.createElement("canvas");return t.width=t.height=a,t}draw(a){const{width:t,actualBoundingBoxAscent:n,actualBoundingBoxDescent:s,actualBoundingBoxLeft:u,actualBoundingBoxRight:d}=this.ctx.measureText(a),f=Math.ceil(n),_=Math.min(this.size-this.buffer,Math.ceil(d-u)),y=Math.min(this.size-this.buffer,f+Math.ceil(s)),v=_+2*this.buffer,T=y+2*this.buffer,I=Math.max(v*T,0),C=new Uint8ClampedArray(I),F={data:C,width:v,height:T,glyphWidth:_,glyphHeight:y,glyphTop:f,glyphLeft:0,glyphAdvance:t};if(_===0||y===0)return F;const{ctx:R,buffer:B,gridInner:X,gridOuter:J}=this;R.clearRect(B,B,_,y),R.fillText(a,B,B+f);const te=R.getImageData(B,B,_,y);J.fill(ct,0,I),X.fill(0,0,I);for(let O=0;O<y;O++)for(let ne=0;ne<_;ne++){const ie=te.data[4*(O*_+ne)+3]/255;if(ie===0)continue;const ue=(O+B)*v+ne+B;if(ie===1)J[ue]=0,X[ue]=ct;else{const he=.5-ie;J[ue]=he>0?he*he:0,X[ue]=he<0?he*he:0}}vt(J,0,0,v,T,v,this.f,this.v,this.z),vt(X,B,B,_,y,v,this.f,this.v,this.z);for(let O=0;O<I;O++){const ne=Math.sqrt(J[O])-Math.sqrt(X[O]);C[O]=Math.round(255-255*(ne/this.radius+this.cutoff))}return F}};const Gi=new l.Properties({anchor:new l.DataConstantProperty(l.spec.light.anchor),position:new class{constructor(){this.specification=l.spec.light.position}possiblyEvaluate(a,t){return l.sphericalToCartesian(a.expression.evaluate(t))}interpolate(a,t,n){return{x:l.number(a.x,t.x,n),y:l.number(a.y,t.y,n),z:l.number(a.z,t.z,n)}}},color:new l.DataConstantProperty(l.spec.light.color),intensity:new l.DataConstantProperty(l.spec.light.intensity)}),Fi="-transition";class pi extends l.Evented{constructor(t){super(),this._transitionable=new l.Transitionable(Gi),this.setLight(t),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(t,n={}){if(!this._validate(l.validateLight,t,n))for(const s in t){const u=t[s];s.endsWith(Fi)?this._transitionable.setTransition(s.slice(0,-Fi.length),u):this._transitionable.setValue(s,u)}}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}_validate(t,n,s){return(!s||s.validate!==!1)&&l.emitValidationErrors(this,t.call(l.validateStyle,l.extend({value:n,style:{glyphs:!0,sprite:!0},styleSpec:l.spec})))}}class wo{constructor(t,n){this.width=t,this.height=n,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(t,n){const s=t.join(",")+String(n);return this.dashEntry[s]||(this.dashEntry[s]=this.addDash(t,n)),this.dashEntry[s]}getDashRanges(t,n,s){const u=[];let d=t.length%2==1?-t[t.length-1]*s:0,f=t[0]*s,_=!0;u.push({left:d,right:f,isDash:_,zeroLength:t[0]===0});let y=t[0];for(let v=1;v<t.length;v++){_=!_;const T=t[v];d=y*s,y+=T,f=y*s,u.push({left:d,right:f,isDash:_,zeroLength:T===0})}return u}addRoundDash(t,n,s){const u=n/2;for(let d=-s;d<=s;d++){const f=this.width*(this.nextRow+s+d);let _=0,y=t[_];for(let v=0;v<this.width;v++){v/y.right>1&&(y=t[++_]);const T=Math.abs(v-y.left),I=Math.abs(v-y.right),C=Math.min(T,I);let F;const R=d/s*(u+1);if(y.isDash){const B=u-Math.abs(R);F=Math.sqrt(C*C+B*B)}else F=u-Math.sqrt(C*C+R*R);this.data[f+v]=Math.max(0,Math.min(255,F+128))}}}addRegularDash(t){for(let _=t.length-1;_>=0;--_){const y=t[_],v=t[_+1];y.zeroLength?t.splice(_,1):v&&v.isDash===y.isDash&&(v.left=y.left,t.splice(_,1))}const n=t[0],s=t[t.length-1];n.isDash===s.isDash&&(n.left=s.left-this.width,s.right=n.right+this.width);const u=this.width*this.nextRow;let d=0,f=t[d];for(let _=0;_<this.width;_++){_/f.right>1&&(f=t[++d]);const y=Math.abs(_-f.left),v=Math.abs(_-f.right),T=Math.min(y,v);this.data[u+_]=Math.max(0,Math.min(255,(f.isDash?T:-T)+128))}}addDash(t,n){const s=n?7:0,u=2*s+1;if(this.nextRow+u>this.height)return l.warnOnce("LineAtlas out of space"),null;let d=0;for(let _=0;_<t.length;_++)d+=t[_];if(d!==0){const _=this.width/d,y=this.getDashRanges(t,this.width,_);n?this.addRoundDash(y,_,s):this.addRegularDash(y)}const f={y:(this.nextRow+s+.5)/this.height,height:2*s/this.height,width:d};return this.nextRow+=u,this.dirty=!0,f}bind(t){const n=t.gl;this.texture?(n.bindTexture(n.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,n.texSubImage2D(n.TEXTURE_2D,0,0,0,this.width,this.height,n.ALPHA,n.UNSIGNED_BYTE,this.data))):(this.texture=n.createTexture(),n.bindTexture(n.TEXTURE_2D,this.texture),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.REPEAT),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.REPEAT),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.LINEAR),n.texImage2D(n.TEXTURE_2D,0,n.ALPHA,this.width,this.height,0,n.ALPHA,n.UNSIGNED_BYTE,this.data))}}class lr{constructor(t,n){this.workerPool=t,this.actors=[],this.currentActor=0,this.id=l.uniqueId();const s=this.workerPool.acquire(this.id);for(let u=0;u<s.length;u++){const d=new lr.Actor(s[u],n,this.id);d.name=`Worker ${u}`,this.actors.push(d)}if(!this.actors.length)throw new Error("No actors found")}broadcast(t,n,s){l.asyncAll(this.actors,(u,d)=>{u.send(t,n,d)},s=s||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(){this.actors.forEach(t=>{t.remove()}),this.actors=[],this.workerPool.release(this.id)}}function Gr(a,t,n){const s=function(u,d){if(u)return n(u);if(d){const f=l.pick(l.extend(d,a),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);d.vector_layers&&(f.vectorLayers=d.vector_layers,f.vectorLayerIds=f.vectorLayers.map(_=>_.id)),n(null,f)}};return a.url?l.getJSON(t.transformRequest(a.url,l.ResourceType.Source),s):l.exported.frame(()=>s(null,a))}lr.Actor=l.Actor;class cr{constructor(t,n,s){this.bounds=l.LngLatBounds.convert(this.validateBounds(t)),this.minzoom=n||0,this.maxzoom=s||24}validateBounds(t){return Array.isArray(t)&&t.length===4?[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){const n=Math.pow(2,t.z),s=Math.floor(l.mercatorXfromLng(this.bounds.getWest())*n),u=Math.floor(l.mercatorYfromLat(this.bounds.getNorth())*n),d=Math.ceil(l.mercatorXfromLng(this.bounds.getEast())*n),f=Math.ceil(l.mercatorYfromLat(this.bounds.getSouth())*n);return t.x>=s&&t.x<d&&t.y>=u&&t.y<f}}class un extends l.Evented{constructor(t,n,s,u){if(super(),this.id=t,this.dispatcher=s,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,l.extend(this,l.pick(n,["url","scheme","tileSize","promoteId"])),this._options=l.extend({type:"vector"},n),this._collectResourceTiming=n.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(u)}load(){this._loaded=!1,this.fire(new l.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=Gr(this._options,this.map._requestManager,(t,n)=>{this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),t?this.fire(new l.ErrorEvent(t)):n&&(l.extend(this,n),n.bounds&&(this.tileBounds=new cr(n.bounds,this.minzoom,this.maxzoom)),this.fire(new l.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new l.Event("data",{dataType:"source",sourceDataType:"content"})))})}loaded(){return this._loaded}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}onAdd(t){this.map=t,this.load()}setSourceProperty(t){this._tileJSONRequest&&this._tileJSONRequest.cancel(),t(),this.load()}setTiles(t){return this.setSourceProperty(()=>{this._options.tiles=t}),this}setUrl(t){return this.setSourceProperty(()=>{this.url=t,this._options.url=t}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return l.extend({},this._options)}loadTile(t,n){const s=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),u={request:this.map._requestManager.transformRequest(s,l.ResourceType.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};function d(f,_){return delete t.request,t.aborted?n(null):f&&f.status!==404?n(f):(_&&_.resourceTiming&&(t.resourceTiming=_.resourceTiming),this.map._refreshExpiredTiles&&_&&t.setExpiryData(_),t.loadVectorData(_,this.map.painter),l.cacheEntryPossiblyAdded(this.dispatcher),n(null),void(t.reloadCallback&&(this.loadTile(t,t.reloadCallback),t.reloadCallback=null)))}u.request.collectResourceTiming=this._collectResourceTiming,t.actor&&t.state!=="expired"?t.state==="loading"?t.reloadCallback=n:t.request=t.actor.send("reloadTile",u,d.bind(this)):(t.actor=this.dispatcher.getActor(),t.request=t.actor.send("loadTile",u,d.bind(this)))}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.actor&&t.actor.send("abortTile",{uid:t.uid,type:this.type,source:this.id},void 0)}unloadTile(t){t.unloadVectorData(),t.actor&&t.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id},void 0)}hasTransition(){return!1}}class Er extends l.Evented{constructor(t,n,s,u){super(),this.id=t,this.dispatcher=s,this.setEventedParent(u),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=l.extend({type:"raster"},n),l.extend(this,l.pick(n,["url","scheme","tileSize"]))}load(){this._loaded=!1,this.fire(new l.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=Gr(this._options,this.map._requestManager,(t,n)=>{this._tileJSONRequest=null,this._loaded=!0,t?this.fire(new l.ErrorEvent(t)):n&&(l.extend(this,n),n.bounds&&(this.tileBounds=new cr(n.bounds,this.minzoom,this.maxzoom)),this.fire(new l.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new l.Event("data",{dataType:"source",sourceDataType:"content"})))})}loaded(){return this._loaded}onAdd(t){this.map=t,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return l.extend({},this._options)}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}loadTile(t,n){const s=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);t.request=l.getImage(this.map._requestManager.transformRequest(s,l.ResourceType.Tile),(u,d,f)=>{if(delete t.request,t.aborted)t.state="unloaded",n(null);else if(u)t.state="errored",n(u);else if(d){this.map._refreshExpiredTiles&&t.setExpiryData(f);const _=this.map.painter.context,y=_.gl;t.texture=this.map.painter.getTileTexture(d.width),t.texture?t.texture.update(d,{useMipmap:!0}):(t.texture=new He(_,d,y.RGBA,{useMipmap:!0}),t.texture.bind(y.LINEAR,y.CLAMP_TO_EDGE,y.LINEAR_MIPMAP_NEAREST),_.extTextureFilterAnisotropic&&y.texParameterf(y.TEXTURE_2D,_.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,_.extTextureFilterAnisotropicMax)),t.state="loaded",l.cacheEntryPossiblyAdded(this.dispatcher),n(null)}})}abortTile(t,n){t.request&&(t.request.cancel(),delete t.request),n()}unloadTile(t,n){t.texture&&this.map.painter.saveTileTexture(t.texture),n()}hasTransition(){return!1}}let Sr;class We extends Er{constructor(t,n,s,u){super(t,n,s,u),this.type="raster-dem",this.maxzoom=22,this._options=l.extend({type:"raster-dem"},n),this.encoding=n.encoding||"mapbox"}serialize(){return{type:"raster-dem",url:this.url,tileSize:this.tileSize,tiles:this.tiles,bounds:this.bounds,encoding:this.encoding}}loadTile(t,n){const s=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);function u(d,f){d&&(t.state="errored",n(d)),f&&(t.dem=f,t.needsHillshadePrepare=!0,t.needsTerrainPrepare=!0,t.state="loaded",n(null))}t.request=l.getImage(this.map._requestManager.transformRequest(s,l.ResourceType.Tile),function(d,f){if(delete t.request,t.aborted)t.state="unloaded",n(null);else if(d)t.state="errored",n(d);else if(f){this.map._refreshExpiredTiles&&t.setExpiryData(f),delete f.cacheControl,delete f.expires;const _=l.isImageBitmap(f)&&(Sr==null&&(Sr=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),Sr)?f:l.exported.getImageData(f,1),y={uid:t.uid,coord:t.tileID,source:this.id,rawImageData:_,encoding:this.encoding};t.actor&&t.state!=="expired"||(t.actor=this.dispatcher.getActor(),t.actor.send("loadDEMTile",y,u.bind(this)))}}.bind(this)),t.neighboringTiles=this._getNeighboringTiles(t.tileID)}_getNeighboringTiles(t){const n=t.canonical,s=Math.pow(2,n.z),u=(n.x-1+s)%s,d=n.x===0?t.wrap-1:t.wrap,f=(n.x+1+s)%s,_=n.x+1===s?t.wrap+1:t.wrap,y={};return y[new l.OverscaledTileID(t.overscaledZ,d,n.z,u,n.y).key]={backfilled:!1},y[new l.OverscaledTileID(t.overscaledZ,_,n.z,f,n.y).key]={backfilled:!1},n.y>0&&(y[new l.OverscaledTileID(t.overscaledZ,d,n.z,u,n.y-1).key]={backfilled:!1},y[new l.OverscaledTileID(t.overscaledZ,t.wrap,n.z,n.x,n.y-1).key]={backfilled:!1},y[new l.OverscaledTileID(t.overscaledZ,_,n.z,f,n.y-1).key]={backfilled:!1}),n.y+1<s&&(y[new l.OverscaledTileID(t.overscaledZ,d,n.z,u,n.y+1).key]={backfilled:!1},y[new l.OverscaledTileID(t.overscaledZ,t.wrap,n.z,n.x,n.y+1).key]={backfilled:!1},y[new l.OverscaledTileID(t.overscaledZ,_,n.z,f,n.y+1).key]={backfilled:!1}),y}unloadTile(t){t.demTexture&&this.map.painter.saveTileTexture(t.demTexture),t.fbo&&(t.fbo.destroy(),delete t.fbo),t.dem&&delete t.dem,delete t.neighboringTiles,t.state="unloaded",t.actor&&t.actor.send("removeDEMTile",{uid:t.uid,source:this.id})}}class ur extends l.Evented{constructor(t,n,s,u){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._pendingLoads=0,this.actor=s.getActor(),this.setEventedParent(u),this._data=n.data,this._options=l.extend({},n),this._collectResourceTiming=n.collectResourceTiming,n.maxzoom!==void 0&&(this.maxzoom=n.maxzoom),n.type&&(this.type=n.type),n.attribution&&(this.attribution=n.attribution),this.promoteId=n.promoteId;const d=l.EXTENT/this.tileSize;this.workerOptions=l.extend({source:this.id,cluster:n.cluster||!1,geojsonVtOptions:{buffer:(n.buffer!==void 0?n.buffer:128)*d,tolerance:(n.tolerance!==void 0?n.tolerance:.375)*d,extent:l.EXTENT,maxZoom:this.maxzoom,lineMetrics:n.lineMetrics||!1,generateId:n.generateId||!1},superclusterOptions:{maxZoom:n.clusterMaxZoom!==void 0?n.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,n.clusterMinPoints||2),extent:l.EXTENT,radius:(n.clusterRadius||50)*d,log:!1,generateId:n.generateId||!1},clusterProperties:n.clusterProperties,filter:n.filter},n.workerOptions)}load(){this._updateWorkerData("metadata")}onAdd(t){this.map=t,this.load()}setData(t){return this._data=t,this._updateWorkerData("content"),this}getClusterExpansionZoom(t,n){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:t,source:this.id},n),this}getClusterChildren(t,n){return this.actor.send("geojson.getClusterChildren",{clusterId:t,source:this.id},n),this}getClusterLeaves(t,n,s,u){return this.actor.send("geojson.getClusterLeaves",{source:this.id,clusterId:t,limit:n,offset:s},u),this}_updateWorkerData(t){const n=l.extend({},this.workerOptions),s=this._data;typeof s=="string"?(n.request=this.map._requestManager.transformRequest(l.exported.resolveURL(s),l.ResourceType.Source),n.request.collectResourceTiming=this._collectResourceTiming):n.data=JSON.stringify(s),this._pendingLoads++,this.fire(new l.Event("dataloading",{dataType:"source"})),this.actor.send(`${this.type}.loadData`,n,(u,d)=>{if(this._pendingLoads--,this._removed||d&&d.abandoned)return void this.fire(new l.Event("dataabort",{dataType:"source",sourceDataType:t}));let f=null;if(d&&d.resourceTiming&&d.resourceTiming[this.id]&&(f=d.resourceTiming[this.id].slice(0)),u)return void this.fire(new l.ErrorEvent(u));const _={dataType:"source",sourceDataType:t};this._collectResourceTiming&&f&&f.length>0&&l.extend(_,{resourceTiming:f}),this.fire(new l.Event("data",_))})}loaded(){return this._pendingLoads===0}loadTile(t,n){const s=t.actor?"reloadTile":"loadTile";t.actor=this.actor;const u={type:this.type,uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};t.request=this.actor.send(s,u,(d,f)=>(delete t.request,t.unloadVectorData(),t.aborted?n(null):d?n(d):(t.loadVectorData(f,this.map.painter,s==="reloadTile"),n(null))))}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.aborted=!0}unloadTile(t){t.unloadVectorData(),this.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id})}onRemove(){this._removed=!0,this.actor.send("removeSource",{type:this.type,source:this.id})}serialize(){return l.extend({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var hr=l.createLayout([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class qi extends l.Evented{constructor(t,n,s,u){super(),this.id=t,this.dispatcher=s,this.coordinates=n.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(u),this.options=n}load(t,n){this._loaded=!1,this.fire(new l.Event("dataloading",{dataType:"source"})),this.url=this.options.url,l.getImage(this.map._requestManager.transformRequest(this.url,l.ResourceType.Image),(s,u)=>{this._loaded=!0,s?this.fire(new l.ErrorEvent(s)):u&&(this.image=u,t&&(this.coordinates=t),n&&n(),this._finishLoading())})}loaded(){return this._loaded}updateImage(t){return this.image&&t.url?(this.options.url=t.url,this.load(t.coordinates,()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new l.Event("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(t){this.map=t,this.load()}setCoordinates(t){this.coordinates=t;const n=t.map(l.MercatorCoordinate.fromLngLat);this.tileID=function(u){let d=1/0,f=1/0,_=-1/0,y=-1/0;for(const C of u)d=Math.min(d,C.x),f=Math.min(f,C.y),_=Math.max(_,C.x),y=Math.max(y,C.y);const v=Math.max(_-d,y-f),T=Math.max(0,Math.floor(-Math.log(v)/Math.LN2)),I=Math.pow(2,T);return new l.CanonicalTileID(T,Math.floor((d+_)/2*I),Math.floor((f+y)/2*I))}(n),this.minzoom=this.maxzoom=this.tileID.z;const s=n.map(u=>this.tileID.getTilePoint(u)._round());return this._boundsArray=new l.RasterBoundsArray,this._boundsArray.emplaceBack(s[0].x,s[0].y,0,0),this._boundsArray.emplaceBack(s[1].x,s[1].y,l.EXTENT,0),this._boundsArray.emplaceBack(s[3].x,s[3].y,0,l.EXTENT),this._boundsArray.emplaceBack(s[2].x,s[2].y,l.EXTENT,l.EXTENT),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new l.Event("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;const t=this.map.painter.context,n=t.gl;this.boundsBuffer||(this.boundsBuffer=t.createVertexBuffer(this._boundsArray,hr.members)),this.boundsSegments||(this.boundsSegments=l.SegmentVector.simpleSegment(0,0,4,2)),this.texture||(this.texture=new He(t,this.image,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));for(const s in this.tiles){const u=this.tiles[s];u.state!=="loaded"&&(u.state="loaded",u.texture=this.texture)}}loadTile(t,n){this.tileID&&this.tileID.equals(t.tileID.canonical)?(this.tiles[String(t.tileID.wrap)]=t,t.buckets={},n(null)):(t.state="errored",n(null))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class Zi extends qi{constructor(t,n,s,u){super(t,n,s,u),this.roundZoom=!0,this.type="video",this.options=n}load(){this._loaded=!1;const t=this.options;this.urls=[];for(const n of t.urls)this.urls.push(this.map._requestManager.transformRequest(n,l.ResourceType.Source).url);l.getVideo(this.urls,(n,s)=>{this._loaded=!0,n?this.fire(new l.ErrorEvent(n)):s&&(this.video=s,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading())})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(t){if(this.video){const n=this.video.seekable;t<n.start(0)||t>n.end(0)?this.fire(new l.ErrorEvent(new l.ValidationError(`sources.${this.id}`,null,`Playback for this video can be set only between the ${n.start(0)} and ${n.end(0)}-second mark.`))):this.video.currentTime=t}}getVideo(){return this.video}onAdd(t){this.map||(this.map=t,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const t=this.map.painter.context,n=t.gl;this.boundsBuffer||(this.boundsBuffer=t.createVertexBuffer(this._boundsArray,hr.members)),this.boundsSegments||(this.boundsSegments=l.SegmentVector.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE),n.texSubImage2D(n.TEXTURE_2D,0,0,0,n.RGBA,n.UNSIGNED_BYTE,this.video)):(this.texture=new He(t,this.video,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));for(const s in this.tiles){const u=this.tiles[s];u.state!=="loaded"&&(u.state="loaded",u.texture=this.texture)}}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class qr extends qi{constructor(t,n,s,u){super(t,n,s,u),n.coordinates?Array.isArray(n.coordinates)&&n.coordinates.length===4&&!n.coordinates.some(d=>!Array.isArray(d)||d.length!==2||d.some(f=>typeof f!="number"))||this.fire(new l.ErrorEvent(new l.ValidationError(`sources.${t}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new l.ErrorEvent(new l.ValidationError(`sources.${t}`,null,'missing required property "coordinates"'))),n.animate&&typeof n.animate!="boolean"&&this.fire(new l.ErrorEvent(new l.ValidationError(`sources.${t}`,null,'optional "animate" property must be a boolean value'))),n.canvas?typeof n.canvas=="string"||n.canvas instanceof HTMLCanvasElement||this.fire(new l.ErrorEvent(new l.ValidationError(`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 l.ErrorEvent(new l.ValidationError(`sources.${t}`,null,'missing required property "canvas"'))),this.options=n,this.animate=n.animate===void 0||n.animate}load(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new l.ErrorEvent(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())}getCanvas(){return this.canvas}onAdd(t){this.map=t,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let 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()||Object.keys(this.tiles).length===0)return;const n=this.map.painter.context,s=n.gl;this.boundsBuffer||(this.boundsBuffer=n.createVertexBuffer(this._boundsArray,hr.members)),this.boundsSegments||(this.boundsSegments=l.SegmentVector.simpleSegment(0,0,4,2)),this.texture?(t||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new He(n,this.canvas,s.RGBA,{premultiply:!0});for(const u in this.tiles){const d=this.tiles[u];d.state!=="loaded"&&(d.state="loaded",d.texture=this.texture)}}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const t of[this.canvas.width,this.canvas.height])if(isNaN(t)||t<=0)return!0;return!1}}const hn={vector:un,raster:Er,"raster-dem":We,geojson:ur,video:Zi,image:qi,canvas:qr};function dn(a,t){const n=l.create();return l.translate(n,n,[1,1,0]),l.scale(n,n,[.5*a.width,.5*a.height,1]),l.multiply(n,n,a.calculatePosMatrix(t.toUnwrapped()))}function pn(a,t,n,s,u,d){const f=function(I,C,F){if(I)for(const R of I){const B=C[R];if(B&&B.source===F&&B.type==="fill-extrusion")return!0}else for(const R in C){const B=C[R];if(B.source===F&&B.type==="fill-extrusion")return!0}return!1}(u&&u.layers,t,a.id),_=d.maxPitchScaleFactor(),y=a.tilesIn(s,_,f);y.sort(Qi);const v=[];for(const I of y)v.push({wrappedTileID:I.tileID.wrapped().key,queryResults:I.tile.queryRenderedFeatures(t,n,a._state,I.queryGeometry,I.cameraQueryGeometry,I.scale,u,d,_,dn(a.transform,I.tileID))});const T=function(I){const C={},F={};for(const R of I){const B=R.queryResults,X=R.wrappedTileID,J=F[X]=F[X]||{};for(const te in B){const O=B[te],ne=J[te]=J[te]||{},ie=C[te]=C[te]||[];for(const ue of O)ne[ue.featureIndex]||(ne[ue.featureIndex]=!0,ie.push(ue))}}return C}(v);for(const I in T)T[I].forEach(C=>{const F=C.feature,R=a.getFeatureState(F.layer["source-layer"],F.id);F.source=F.layer.source,F.layer["source-layer"]&&(F.sourceLayer=F.layer["source-layer"]),F.state=R});return T}function Qi(a,t){const n=a.tileID,s=t.tileID;return n.overscaledZ-s.overscaledZ||n.canonical.y-s.canonical.y||n.wrap-s.wrap||n.canonical.x-s.canonical.x}class Ir{constructor(t,n){this.tileID=t,this.uid=l.uniqueId(),this.uses=0,this.tileSize=n,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.textures=[],this.textureCoords={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(t){const n=t+this.timeAdded;n<l.exported.now()||this.fadeEndTime&&n<this.fadeEndTime||(this.fadeEndTime=n)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}clearTextures(t){this.demTexture&&t.saveTileTexture(this.demTexture),this.textures.forEach(n=>t.saveTileTexture(n)),this.demTexture=null,this.textures=[],this.textureCoords={}}loadVectorData(t,n,s){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",t){t.featureIndex&&(this.latestFeatureIndex=t.featureIndex,t.rawTileData?(this.latestRawTileData=t.rawTileData,this.latestFeatureIndex.rawTileData=t.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=t.collisionBoxArray,this.buckets=function(u,d){const f={};if(!d)return f;for(const _ of u){const y=_.layerIds.map(v=>d.getLayer(v)).filter(Boolean);if(y.length!==0){_.layers=y,_.stateDependentLayerIds&&(_.stateDependentLayers=_.stateDependentLayerIds.map(v=>y.filter(T=>T.id===v)[0]));for(const v of y)f[v.id]=_}}return f}(t.buckets,n.style),this.hasSymbolBuckets=!1;for(const u in this.buckets){const d=this.buckets[u];if(d instanceof l.SymbolBucket){if(this.hasSymbolBuckets=!0,!s)break;d.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const u in this.buckets){const d=this.buckets[u];if(d instanceof l.SymbolBucket&&d.hasRTLText){this.hasRTLText=!0,l.lazyLoadRTLTextPlugin();break}}this.queryPadding=0;for(const u in this.buckets){const d=this.buckets[u];this.queryPadding=Math.max(this.queryPadding,n.style.getLayer(u).queryRadius(d))}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage)}else this.collisionBoxArray=new l.CollisionBoxArray}unloadVectorData(){for(const t in this.buckets)this.buckets[t].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(t){return this.buckets[t.id]}upload(t){for(const s in this.buckets){const u=this.buckets[s];u.uploadPending()&&u.upload(t)}const n=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new He(t,this.imageAtlas.image,n.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new He(t,this.glyphAtlasImage,n.ALPHA),this.glyphAtlasImage=null)}prepare(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture)}queryRenderedFeatures(t,n,s,u,d,f,_,y,v,T){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:u,cameraQueryGeometry:d,scale:f,tileSize:this.tileSize,pixelPosMatrix:T,transform:y,params:_,queryPadding:this.queryPadding*v},t,n,s):{}}querySourceFeatures(t,n){const s=this.latestFeatureIndex;if(!s||!s.rawTileData)return;const u=s.loadVTLayers(),d=n?n.sourceLayer:"",f=u._geojsonTileLayer||u[d];if(!f)return;const _=l.createFilter(n&&n.filter),{z:y,x:v,y:T}=this.tileID.canonical,I={z:y,x:v,y:T};for(let C=0;C<f.length;C++){const F=f.feature(C);if(_.needGeometry){const X=l.toEvaluationFeature(F,!0);if(!_.filter(new l.EvaluationParameters(this.tileID.overscaledZ),X,this.tileID.canonical))continue}else if(!_.filter(new l.EvaluationParameters(this.tileID.overscaledZ),F))continue;const R=s.getId(F,d),B=new l.GeoJSONFeature(F,y,v,T,R);B.tile=I,t.push(B)}}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(t){const n=this.expirationTime;if(t.cacheControl){const s=l.parseCacheControl(t.cacheControl);s["max-age"]&&(this.expirationTime=Date.now()+1e3*s["max-age"])}else t.expires&&(this.expirationTime=new Date(t.expires).getTime());if(this.expirationTime){const s=Date.now();let u=!1;if(this.expirationTime>s)u=!1;else if(n)if(this.expirationTime<n)u=!0;else{const d=this.expirationTime-n;d?this.expirationTime=s+Math.max(d,3e4):u=!0}else u=!0;u?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-new Date().getTime(),Math.pow(2,31)-1)}setFeatureState(t,n){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||Object.keys(t).length===0)return;const s=this.latestFeatureIndex.loadVTLayers();for(const u in this.buckets){if(!n.style.hasLayer(u))continue;const d=this.buckets[u],f=d.layers[0].sourceLayer||"_geojsonTileLayer",_=s[f],y=t[f];if(!_||!y||Object.keys(y).length===0)continue;d.update(y,_,this.imageAtlas&&this.imageAtlas.patternPositions||{});const v=n&&n.style&&n.style.getLayer(u);v&&(this.queryPadding=Math.max(this.queryPadding,v.queryRadius(d)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<l.exported.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(t){this.symbolFadeHoldUntil=l.exported.now()+t}setDependencies(t,n){const s={};for(const u of n)s[u]=!0;this.dependencies[t]=s}hasDependency(t,n){for(const s of t){const u=this.dependencies[s];if(u){for(const d of n)if(u[d])return!0}}return!1}}class Ar{constructor(t,n){this.max=t,this.onRemove=n,this.reset()}reset(){for(const t in this.data)for(const n of this.data[t])n.timeout&&clearTimeout(n.timeout),this.onRemove(n.value);return this.data={},this.order=[],this}add(t,n,s){const u=t.wrapped().key;this.data[u]===void 0&&(this.data[u]=[]);const d={value:n,timeout:void 0};if(s!==void 0&&(d.timeout=setTimeout(()=>{this.remove(t,d)},s)),this.data[u].push(d),this.order.push(u),this.order.length>this.max){const f=this._getAndRemoveByKey(this.order[0]);f&&this.onRemove(f)}return this}has(t){return t.wrapped().key in this.data}getAndRemove(t){return this.has(t)?this._getAndRemoveByKey(t.wrapped().key):null}_getAndRemoveByKey(t){const n=this.data[t].shift();return n.timeout&&clearTimeout(n.timeout),this.data[t].length===0&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),n.value}getByKey(t){const n=this.data[t];return n?n[0].value:null}get(t){return this.has(t)?this.data[t.wrapped().key][0].value:null}remove(t,n){if(!this.has(t))return this;const s=t.wrapped().key,u=n===void 0?0:this.data[s].indexOf(n),d=this.data[s][u];return this.data[s].splice(u,1),d.timeout&&clearTimeout(d.timeout),this.data[s].length===0&&delete this.data[s],this.onRemove(d.value),this.order.splice(this.order.indexOf(s),1),this}setMaxSize(t){for(this.max=t;this.order.length>this.max;){const n=this._getAndRemoveByKey(this.order[0]);n&&this.onRemove(n)}return this}filter(t){const n=[];for(const s in this.data)for(const u of this.data[s])t(u.value)||n.push(u);for(const s of n)this.remove(s.value.tileID,s)}}class Cr{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(t,n,s){const u=String(n);if(this.stateChanges[t]=this.stateChanges[t]||{},this.stateChanges[t][u]=this.stateChanges[t][u]||{},l.extend(this.stateChanges[t][u],s),this.deletedStates[t]===null){this.deletedStates[t]={};for(const d in this.state[t])d!==u&&(this.deletedStates[t][d]=null)}else if(this.deletedStates[t]&&this.deletedStates[t][u]===null){this.deletedStates[t][u]={};for(const d in this.state[t][u])s[d]||(this.deletedStates[t][u][d]=null)}else for(const d in s)this.deletedStates[t]&&this.deletedStates[t][u]&&this.deletedStates[t][u][d]===null&&delete this.deletedStates[t][u][d]}removeFeatureState(t,n,s){if(this.deletedStates[t]===null)return;const u=String(n);if(this.deletedStates[t]=this.deletedStates[t]||{},s&&n!==void 0)this.deletedStates[t][u]!==null&&(this.deletedStates[t][u]=this.deletedStates[t][u]||{},this.deletedStates[t][u][s]=null);else if(n!==void 0)if(this.stateChanges[t]&&this.stateChanges[t][u])for(s in this.deletedStates[t][u]={},this.stateChanges[t][u])this.deletedStates[t][u][s]=null;else this.deletedStates[t][u]=null;else this.deletedStates[t]=null}getState(t,n){const s=String(n),u=l.extend({},(this.state[t]||{})[s],(this.stateChanges[t]||{})[s]);if(this.deletedStates[t]===null)return{};if(this.deletedStates[t]){const d=this.deletedStates[t][n];if(d===null)return{};for(const f in d)delete u[f]}return u}initializeTileState(t,n){t.setFeatureState(this.state,n)}coalesceChanges(t,n){const s={};for(const u in this.stateChanges){this.state[u]=this.state[u]||{};const d={};for(const f in this.stateChanges[u])this.state[u][f]||(this.state[u][f]={}),l.extend(this.state[u][f],this.stateChanges[u][f]),d[f]=this.state[u][f];s[u]=d}for(const u in this.deletedStates){this.state[u]=this.state[u]||{};const d={};if(this.deletedStates[u]===null)for(const f in this.state[u])d[f]={},this.state[u][f]={};else for(const f in this.deletedStates[u]){if(this.deletedStates[u][f]===null)this.state[u][f]={};else for(const _ of Object.keys(this.deletedStates[u][f]))delete this.state[u][f][_];d[f]=this.state[u][f]}s[u]=s[u]||{},l.extend(s[u],d)}if(this.stateChanges={},this.deletedStates={},Object.keys(s).length!==0)for(const u in t)t[u].setFeatureState(s,n)}}class yi extends l.Evented{constructor(t,n,s){super(),this.id=t,this.dispatcher=s,this.on("data",u=>{u.dataType==="source"&&u.sourceDataType==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&u.dataType==="source"&&u.sourceDataType==="content"&&(this.reload(),this.transform&&this.update(this.transform,this.terrain))}),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=function(u,d,f,_){const y=new hn[d.type](u,d,f,_);if(y.id!==u)throw new Error(`Expected Source id to be ${u} instead of ${y.id}`);return l.bindAll(["load","abort","unload","serialize","prepare"],y),y}(t,n,s,this),this._tiles={},this._cache=new Ar(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new Cr}onAdd(t){this.map=t,this._maxTileCacheSize=t?t._maxTileCacheSize:null,this._source&&this._source.onAdd&&this._source.onAdd(t)}onRemove(t){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(t)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;for(const t in this._tiles){const n=this._tiles[t];if(n.state!=="loaded"&&n.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const t=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,t&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(t,n){return this._source.loadTile(t,n)}_unloadTile(t){if(this._source.unloadTile)return this._source.unloadTile(t,()=>{})}_abortTile(t){this._source.abortTile&&this._source.abortTile(t,()=>{}),this._source.fire(new l.Event("dataabort",{tile:t,coord:t.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(t){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const n in this._tiles){const s=this._tiles[n];s.upload(t),s.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(t=>t.tileID).sort(fn).map(t=>t.key)}getRenderableIds(t){const n=[];for(const s in this._tiles)this._isIdRenderable(s,t)&&n.push(this._tiles[s]);return t?n.sort((s,u)=>{const d=s.tileID,f=u.tileID,_=new l.pointGeometry(d.canonical.x,d.canonical.y)._rotate(this.transform.angle),y=new l.pointGeometry(f.canonical.x,f.canonical.y)._rotate(this.transform.angle);return d.overscaledZ-f.overscaledZ||y.y-_.y||y.x-_.x}).map(s=>s.tileID.key):n.map(s=>s.tileID).sort(fn).map(s=>s.key)}hasRenderableParent(t){const n=this.findLoadedParent(t,0);return!!n&&this._isIdRenderable(n.tileID.key)}_isIdRenderable(t,n){return this._tiles[t]&&this._tiles[t].hasData()&&!this._coveredTiles[t]&&(n||!this._tiles[t].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const t in this._tiles)this._tiles[t].state!=="errored"&&this._reloadTile(t,"reloading")}}_reloadTile(t,n){const s=this._tiles[t];s&&(s.state!=="loading"&&(s.state=n),this._loadTile(s,this._tileLoaded.bind(this,s,t,n)))}_tileLoaded(t,n,s,u){if(u)return t.state="errored",void(u.status!==404?this._source.fire(new l.ErrorEvent(u,{tile:t})):this.update(this.transform,this.terrain));t.timeAdded=l.exported.now(),s==="expired"&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(n,t),this.getSource().type==="raster-dem"&&t.dem&&this._backfillDEM(t),this._state.initializeTileState(t,this.map?this.map.painter:null),t.aborted||this._source.fire(new l.Event("data",{dataType:"source",tile:t,coord:t.tileID}))}_backfillDEM(t){const n=this.getRenderableIds();for(let u=0;u<n.length;u++){const d=n[u];if(t.neighboringTiles&&t.neighboringTiles[d]){const f=this.getTileByID(d);s(t,f),s(f,t)}}function s(u,d){u.needsHillshadePrepare=!0,u.needsTerrainPrepare=!0;let f=d.tileID.canonical.x-u.tileID.canonical.x;const _=d.tileID.canonical.y-u.tileID.canonical.y,y=Math.pow(2,u.tileID.canonical.z),v=d.tileID.key;f===0&&_===0||Math.abs(_)>1||(Math.abs(f)>1&&(Math.abs(f+y)===1?f+=y:Math.abs(f-y)===1&&(f-=y)),d.dem&&u.dem&&(u.dem.backfillBorder(d.dem,f,_),u.neighboringTiles&&u.neighboringTiles[v]&&(u.neighboringTiles[v].backfilled=!0)))}}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._tiles[t]}_retainLoadedChildren(t,n,s,u){for(const d in this._tiles){let f=this._tiles[d];if(u[d]||!f.hasData()||f.tileID.overscaledZ<=n||f.tileID.overscaledZ>s)continue;let _=f.tileID;for(;f&&f.tileID.overscaledZ>n+1;){const v=f.tileID.scaledTo(f.tileID.overscaledZ-1);f=this._tiles[v.key],f&&f.hasData()&&(_=v)}let y=_;for(;y.overscaledZ>n;)if(y=y.scaledTo(y.overscaledZ-1),t[y.key]){u[_.key]=_;break}}}findLoadedParent(t,n){if(t.key in this._loadedParentTiles){const s=this._loadedParentTiles[t.key];return s&&s.tileID.overscaledZ>=n?s:null}for(let s=t.overscaledZ-1;s>=n;s--){const u=t.scaledTo(s),d=this._getLoadedTile(u);if(d)return d}}_getLoadedTile(t){const n=this._tiles[t.key];return n&&n.hasData()?n:this._cache.getByKey(t.wrapped().key)}updateCacheSize(t){const n=Math.ceil(t.width/this._source.tileSize)+1,s=Math.ceil(t.height/this._source.tileSize)+1,u=Math.floor(n*s*5),d=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,u):u;this._cache.setMaxSize(d)}handleWrapJump(t){const n=Math.round((t-(this._prevLng===void 0?t:this._prevLng))/360);if(this._prevLng=t,n){const s={};for(const u in this._tiles){const d=this._tiles[u];d.tileID=d.tileID.unwrapTo(d.tileID.wrap+n),s[d.tileID.key]=d}this._tiles=s;for(const u in this._timers)clearTimeout(this._timers[u]),delete this._timers[u];for(const u in this._tiles)this._setTileReloadTimer(u,this._tiles[u])}}update(t,n){if(this.transform=t,this.terrain=n,!this._sourceLoaded||this._paused)return;let s;this.updateCacheSize(t),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?s=t.getVisibleUnwrappedCoordinates(this._source.tileID).map(v=>new l.OverscaledTileID(v.canonical.z,v.wrap,v.canonical.z,v.canonical.x,v.canonical.y)):(s=t.coveringTiles({tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:n}),this._source.hasTile&&(s=s.filter(v=>this._source.hasTile(v)))):s=[];const u=t.coveringZoomLevel(this._source),d=Math.max(u-yi.maxOverzooming,this._source.minzoom),f=Math.max(u+yi.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const v={};for(const T of s)if(T.canonical.z>this._source.minzoom){const I=T.scaledTo(T.canonical.z-1);v[I.key]=I;const C=T.scaledTo(Math.max(this._source.minzoom,Math.min(T.canonical.z,5)));v[C.key]=C}s=s.concat(Object.values(v))}const _=this._updateRetainedTiles(s,u);if($n(this._source.type)){const v={},T={},I=Object.keys(_);for(const C of I){const F=_[C],R=this._tiles[C];if(!R||R.fadeEndTime&&R.fadeEndTime<=l.exported.now())continue;const B=this.findLoadedParent(F,d);B&&(this._addTile(B.tileID),v[B.tileID.key]=B.tileID),T[C]=F}this._retainLoadedChildren(T,u,f,_);for(const C in v)_[C]||(this._coveredTiles[C]=!0,_[C]=v[C]);if(n){const C={},F={};for(const R of s)this._tiles[R.key].hasData()?C[R.key]=R:F[R.key]=R;for(const R in F){const B=F[R].children(this._source.maxzoom);this._tiles[B[0].key]&&this._tiles[B[1].key]&&this._tiles[B[2].key]&&this._tiles[B[3].key]&&(C[B[0].key]=_[B[0].key]=B[0],C[B[1].key]=_[B[1].key]=B[1],C[B[2].key]=_[B[2].key]=B[2],C[B[3].key]=_[B[3].key]=B[3],delete F[R])}for(const R in F){const B=this.findLoadedParent(F[R],this._source.minzoom);if(B){C[B.tileID.key]=_[B.tileID.key]=B.tileID;for(const X in C)C[X].isChildOf(B.tileID)&&delete C[X]}}for(const R in this._tiles)C[R]||(this._coveredTiles[R]=!0)}}for(const v in _)this._tiles[v].clearFadeHold();const y=l.keysDifference(this._tiles,_);for(const v of y){const T=this._tiles[v];T.hasSymbolBuckets&&!T.holdingForFade()?T.setHoldDuration(this.map._fadeDuration):T.hasSymbolBuckets&&!T.symbolFadeFinished()||this._removeTile(v)}this._updateLoadedParentTileCache()}releaseSymbolFadeTiles(){for(const t in this._tiles)this._tiles[t].holdingForFade()&&this._removeTile(t)}_updateRetainedTiles(t,n){const s={},u={},d=Math.max(n-yi.maxOverzooming,this._source.minzoom),f=Math.max(n+yi.maxUnderzooming,this._source.minzoom),_={};for(const y of t){const v=this._addTile(y);s[y.key]=y,v.hasData()||n<this._source.maxzoom&&(_[y.key]=y)}this._retainLoadedChildren(_,n,f,s);for(const y of t){let v=this._tiles[y.key];if(v.hasData())continue;if(n+1>this._source.maxzoom){const I=y.children(this._source.maxzoom)[0],C=this.getTile(I);if(C&&C.hasData()){s[I.key]=I;continue}}else{const I=y.children(this._source.maxzoom);if(s[I[0].key]&&s[I[1].key]&&s[I[2].key]&&s[I[3].key])continue}let T=v.wasRequested();for(let I=y.overscaledZ-1;I>=d;--I){const C=y.scaledTo(I);if(u[C.key]||(u[C.key]=!0,v=this.getTile(C),!v&&T&&(v=this._addTile(C)),v&&(s[C.key]=C,T=v.wasRequested(),v.hasData())))break}}return s}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const t in this._tiles){const n=[];let s,u=this._tiles[t].tileID;for(;u.overscaledZ>0;){if(u.key in this._loadedParentTiles){s=this._loadedParentTiles[u.key];break}n.push(u.key);const d=u.scaledTo(u.overscaledZ-1);if(s=this._getLoadedTile(d),s)break;u=d}for(const d of n)this._loadedParentTiles[d]=s}}_addTile(t){let n=this._tiles[t.key];if(n)return n;n=this._cache.getAndRemove(t),n&&(this._setTileReloadTimer(t.key,n),n.tileID=t,this._state.initializeTileState(n,this.map?this.map.painter:null),this._cacheTimers[t.key]&&(clearTimeout(this._cacheTimers[t.key]),delete this._cacheTimers[t.key],this._setTileReloadTimer(t.key,n)));const s=n;return n||(n=new Ir(t,this._source.tileSize*t.overscaleFactor()),this._loadTile(n,this._tileLoaded.bind(this,n,t.key,n.state))),n.uses++,this._tiles[t.key]=n,s||this._source.fire(new l.Event("dataloading",{tile:n,coord:n.tileID,dataType:"source"})),n}_setTileReloadTimer(t,n){t in this._timers&&(clearTimeout(this._timers[t]),delete this._timers[t]);const s=n.getExpiryTimeout();s&&(this._timers[t]=setTimeout(()=>{this._reloadTile(t,"expired"),delete this._timers[t]},s))}_removeTile(t){const n=this._tiles[t];n&&(n.uses--,delete this._tiles[t],this._timers[t]&&(clearTimeout(this._timers[t]),delete this._timers[t]),n.uses>0||(n.hasData()&&n.state!=="reloading"?this._cache.add(n.tileID,n,n.getExpiryTimeout()):(n.aborted=!0,this._abortTile(n),this._unloadTile(n))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const t in this._tiles)this._removeTile(t);this._cache.reset()}tilesIn(t,n,s){const u=[],d=this.transform;if(!d)return u;const f=s?d.getCameraQueryGeometry(t):t,_=t.map(R=>d.pointCoordinate(R,this.terrain)),y=f.map(R=>d.pointCoordinate(R,this.terrain)),v=this.getIds();let T=1/0,I=1/0,C=-1/0,F=-1/0;for(const R of y)T=Math.min(T,R.x),I=Math.min(I,R.y),C=Math.max(C,R.x),F=Math.max(F,R.y);for(let R=0;R<v.length;R++){const B=this._tiles[v[R]];if(B.holdingForFade())continue;const X=B.tileID,J=Math.pow(2,d.zoom-B.tileID.overscaledZ),te=n*B.queryPadding*l.EXTENT/B.tileSize/J,O=[X.getTilePoint(new l.MercatorCoordinate(T,I)),X.getTilePoint(new l.MercatorCoordinate(C,F))];if(O[0].x-te<l.EXTENT&&O[0].y-te<l.EXTENT&&O[1].x+te>=0&&O[1].y+te>=0){const ne=_.map(ue=>X.getTilePoint(ue)),ie=y.map(ue=>X.getTilePoint(ue));u.push({tile:B,tileID:X,queryGeometry:ne,cameraQueryGeometry:ie,scale:J})}}return u}getVisibleCoordinates(t){const n=this.getRenderableIds(t).map(s=>this._tiles[s].tileID);for(const s of n)s.posMatrix=this.transform.calculatePosMatrix(s.toUnwrapped());return n}hasTransition(){if(this._source.hasTransition())return!0;if($n(this._source.type))for(const t in this._tiles){const n=this._tiles[t];if(n.fadeEndTime!==void 0&&n.fadeEndTime>=l.exported.now())return!0}return!1}setFeatureState(t,n,s){this._state.updateState(t=t||"_geojsonTileLayer",n,s)}removeFeatureState(t,n,s){this._state.removeFeatureState(t=t||"_geojsonTileLayer",n,s)}getFeatureState(t,n){return this._state.getState(t=t||"_geojsonTileLayer",n)}setDependencies(t,n,s){const u=this._tiles[t];u&&u.setDependencies(n,s)}reloadTilesForDependencies(t,n){for(const s in this._tiles)this._tiles[s].hasDependency(t,n)&&this._reloadTile(s,"reloading");this._cache.filter(s=>!s.hasDependency(t,n))}}function fn(a,t){const n=Math.abs(2*a.wrap)-+(a.wrap<0),s=Math.abs(2*t.wrap)-+(t.wrap<0);return a.overscaledZ-t.overscaledZ||s-n||t.canonical.y-a.canonical.y||t.canonical.x-a.canonical.x}function $n(a){return a==="raster"||a==="image"||a==="video"}yi.maxOverzooming=10,yi.maxUnderzooming=3;const dr="mapboxgl_preloaded_worker_pool";class Si{constructor(){this.active={}}acquire(t){if(!this.workers)for(this.workers=[];this.workers.length<Si.workerCount;)this.workers.push(new Worker(Qr.workerUrl));return this.active[t]=!0,this.workers.slice()}release(t){delete this.active[t],this.numActive()===0&&(this.workers.forEach(n=>{n.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[dr]}numActive(){return Object.keys(this.active).length}}const Vn=Math.floor(l.exported.hardwareConcurrency/2);let Mr;function mn(){return Mr||(Mr=new Si),Mr}function gn(a,t){const n={};for(const s in a)s!=="ref"&&(n[s]=a[s]);return l.refProperties.forEach(s=>{s in t&&(n[s]=t[s])}),n}function Nn(a){a=a.slice();const t=Object.create(null);for(let n=0;n<a.length;n++)t[a[n].id]=a[n];for(let n=0;n<a.length;n++)"ref"in a[n]&&(a[n]=gn(a[n],t[a[n].ref]));return a}Si.workerCount=Math.max(Math.min(Vn,6),1);const ht={setStyle:"setStyle",addLayer:"addLayer",removeLayer:"removeLayer",setPaintProperty:"setPaintProperty",setLayoutProperty:"setLayoutProperty",setFilter:"setFilter",addSource:"addSource",removeSource:"removeSource",setGeoJSONSourceData:"setGeoJSONSourceData",setLayerZoomRange:"setLayerZoomRange",setLayerProperty:"setLayerProperty",setCenter:"setCenter",setZoom:"setZoom",setBearing:"setBearing",setPitch:"setPitch",setSprite:"setSprite",setGlyphs:"setGlyphs",setTransition:"setTransition",setLight:"setLight"};function er(a,t,n){n.push({command:ht.addSource,args:[a,t[a]]})}function zr(a,t,n){t.push({command:ht.removeSource,args:[a]}),n[a]=!0}function Pr(a,t,n,s){zr(a,n,s),er(a,t,n)}function Gn(a,t,n){let s;for(s in a[n])if(Object.prototype.hasOwnProperty.call(a[n],s)&&s!=="data"&&!Te(a[n][s],t[n][s]))return!1;for(s in t[n])if(Object.prototype.hasOwnProperty.call(t[n],s)&&s!=="data"&&!Te(a[n][s],t[n][s]))return!1;return!0}function pr(a,t,n,s,u,d){let f;for(f in t=t||{},a=a||{})Object.prototype.hasOwnProperty.call(a,f)&&(Te(a[f],t[f])||n.push({command:d,args:[s,f,t[f],u]}));for(f in t)Object.prototype.hasOwnProperty.call(t,f)&&!Object.prototype.hasOwnProperty.call(a,f)&&(Te(a[f],t[f])||n.push({command:d,args:[s,f,t[f],u]}))}function fr(a){return a.id}function _n(a,t){return a[t.id]=t,a}class mr{constructor(t,n){this.reset(t,n)}reset(t,n){this.points=t||[],this._distances=[0];for(let s=1;s<this.points.length;s++)this._distances[s]=this._distances[s-1]+this.points[s].dist(this.points[s-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(n||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(t){if(this.points.length===1)return this.points[0];t=l.clamp(t,0,1);let n=1,s=this._distances[n];const u=t*this.paddedLength+this.padding;for(;s<u&&n<this._distances.length;)s=this._distances[++n];const d=n-1,f=this._distances[d],_=s-f,y=_>0?(u-f)/_:0;return this.points[d].mult(1-y).add(this.points[n].mult(y))}}function de(a,t){let n=!0;return a==="always"||a!=="never"&&t!=="never"||(n=!1),n}class Ce{constructor(t,n,s){const u=this.boxCells=[],d=this.circleCells=[];this.xCellCount=Math.ceil(t/s),this.yCellCount=Math.ceil(n/s);for(let f=0;f<this.xCellCount*this.yCellCount;f++)u.push([]),d.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=t,this.height=n,this.xScale=this.xCellCount/t,this.yScale=this.yCellCount/n,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(t,n,s,u,d){this._forEachCell(n,s,u,d,this._insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(n),this.bboxes.push(s),this.bboxes.push(u),this.bboxes.push(d)}insertCircle(t,n,s,u){this._forEachCell(n-u,s-u,n+u,s+u,this._insertCircleCell,this.circleUid++),this.circleKeys.push(t),this.circles.push(n),this.circles.push(s),this.circles.push(u)}_insertBoxCell(t,n,s,u,d,f){this.boxCells[d].push(f)}_insertCircleCell(t,n,s,u,d,f){this.circleCells[d].push(f)}_query(t,n,s,u,d,f,_){if(s<0||t>this.width||u<0||n>this.height)return[];const y=[];if(t<=0&&n<=0&&this.width<=s&&this.height<=u){if(d)return[{key:null,x1:t,y1:n,x2:s,y2:u}];for(let v=0;v<this.boxKeys.length;v++)y.push({key:this.boxKeys[v],x1:this.bboxes[4*v],y1:this.bboxes[4*v+1],x2:this.bboxes[4*v+2],y2:this.bboxes[4*v+3]});for(let v=0;v<this.circleKeys.length;v++){const T=this.circles[3*v],I=this.circles[3*v+1],C=this.circles[3*v+2];y.push({key:this.circleKeys[v],x1:T-C,y1:I-C,x2:T+C,y2:I+C})}}else this._forEachCell(t,n,s,u,this._queryCell,y,{hitTest:d,overlapMode:f,seenUids:{box:{},circle:{}}},_);return y}query(t,n,s,u){return this._query(t,n,s,u,!1,null)}hitTest(t,n,s,u,d,f){return this._query(t,n,s,u,!0,d,f).length>0}hitTestCircle(t,n,s,u,d){const f=t-s,_=t+s,y=n-s,v=n+s;if(_<0||f>this.width||v<0||y>this.height)return!1;const T=[];return this._forEachCell(f,y,_,v,this._queryCellCircle,T,{hitTest:!0,overlapMode:u,circle:{x:t,y:n,radius:s},seenUids:{box:{},circle:{}}},d),T.length>0}_queryCell(t,n,s,u,d,f,_,y){const{seenUids:v,hitTest:T,overlapMode:I}=_,C=this.boxCells[d];if(C!==null){const R=this.bboxes;for(const B of C)if(!v.box[B]){v.box[B]=!0;const X=4*B,J=this.boxKeys[B];if(t<=R[X+2]&&n<=R[X+3]&&s>=R[X+0]&&u>=R[X+1]&&(!y||y(J))&&(!T||!de(I,J.overlapMode))&&(f.push({key:J,x1:R[X],y1:R[X+1],x2:R[X+2],y2:R[X+3]}),T))return!0}}const F=this.circleCells[d];if(F!==null){const R=this.circles;for(const B of F)if(!v.circle[B]){v.circle[B]=!0;const X=3*B,J=this.circleKeys[B];if(this._circleAndRectCollide(R[X],R[X+1],R[X+2],t,n,s,u)&&(!y||y(J))&&(!T||!de(I,J.overlapMode))){const te=R[X],O=R[X+1],ne=R[X+2];if(f.push({key:J,x1:te-ne,y1:O-ne,x2:te+ne,y2:O+ne}),T)return!0}}}return!1}_queryCellCircle(t,n,s,u,d,f,_,y){const{circle:v,seenUids:T,overlapMode:I}=_,C=this.boxCells[d];if(C!==null){const R=this.bboxes;for(const B of C)if(!T.box[B]){T.box[B]=!0;const X=4*B,J=this.boxKeys[B];if(this._circleAndRectCollide(v.x,v.y,v.radius,R[X+0],R[X+1],R[X+2],R[X+3])&&(!y||y(J))&&!de(I,J.overlapMode))return f.push(!0),!0}}const F=this.circleCells[d];if(F!==null){const R=this.circles;for(const B of F)if(!T.circle[B]){T.circle[B]=!0;const X=3*B,J=this.circleKeys[B];if(this._circlesCollide(R[X],R[X+1],R[X+2],v.x,v.y,v.radius)&&(!y||y(J))&&!de(I,J.overlapMode))return f.push(!0),!0}}}_forEachCell(t,n,s,u,d,f,_,y){const v=this._convertToXCellCoord(t),T=this._convertToYCellCoord(n),I=this._convertToXCellCoord(s),C=this._convertToYCellCoord(u);for(let F=v;F<=I;F++)for(let R=T;R<=C;R++)if(d.call(this,t,n,s,u,this.xCellCount*R+F,f,_,y))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,n,s,u,d,f){const _=u-t,y=d-n,v=s+f;return v*v>_*_+y*y}_circleAndRectCollide(t,n,s,u,d,f,_){const y=(f-u)/2,v=Math.abs(t-(u+y));if(v>y+s)return!1;const T=(_-d)/2,I=Math.abs(n-(d+T));if(I>T+s)return!1;if(v<=y||I<=T)return!0;const C=v-y,F=I-T;return C*C+F*F<=s*s}}function Zr(a,t,n,s,u){const d=l.create();return t?(l.scale(d,d,[1/u,1/u,1]),n||l.rotateZ(d,d,s.angle)):l.multiply(d,s.labelPlaneMatrix,a),d}function ji(a,t,n,s,u){if(t){const d=l.clone(a);return l.scale(d,d,[u,u,1]),n||l.rotateZ(d,d,-s.angle),d}return s.glCoordMatrix}function dt(a,t,n){let s;n?(s=[a.x,a.y,n(a.x,a.y),1],l.transformMat4(s,s,t)):(s=[a.x,a.y,0,1],gr(s,s,t));const u=s[3];return{point:new l.pointGeometry(s[0]/u,s[1]/u),signedDistanceFromCamera:u}}function Oi(a,t){return .5+a/t*.5}function Ii(a,t){const n=a[0]/a[3],s=a[1]/a[3];return n>=-t[0]&&n<=t[0]&&s>=-t[1]&&s<=t[1]}function Ai(a,t,n,s,u,d,f,_,y,v){const T=s?a.textSizeData:a.iconSizeData,I=l.evaluateSizeForZoom(T,n.transform.zoom),C=[256/n.width*2+1,256/n.height*2+1],F=s?a.text.dynamicLayoutVertexArray:a.icon.dynamicLayoutVertexArray;F.clear();const R=a.lineVertexArray,B=s?a.text.placedSymbolArray:a.icon.placedSymbolArray,X=n.transform.width/n.transform.height;let J=!1;for(let te=0;te<B.length;te++){const O=B.get(te);if(O.hidden||O.writingMode===l.WritingMode.vertical&&!J){Je(O.numGlyphs,F);continue}let ne;if(J=!1,v?(ne=[O.anchorX,O.anchorY,v(O.anchorX,O.anchorY),1],l.transformMat4(ne,ne,t)):(ne=[O.anchorX,O.anchorY,0,1],gr(ne,ne,t)),!Ii(ne,C)){Je(O.numGlyphs,F);continue}const ie=Oi(n.transform.cameraToCenterDistance,ne[3]),ue=l.evaluateSizeForFeature(T,I,O),he=f?ue/ie:ue*ie,ye=new l.pointGeometry(O.anchorX,O.anchorY),ce=dt(ye,u,v).point,Le={},Ie=et(O,he,!1,_,t,u,d,a.glyphOffsetArray,R,F,ce,ye,Le,X,y,v);J=Ie.useVertical,(Ie.notEnoughRoom||J||Ie.needsFlipping&&et(O,he,!0,_,t,u,d,a.glyphOffsetArray,R,F,ce,ye,Le,X,y,v).notEnoughRoom)&&Je(O.numGlyphs,F)}s?a.text.dynamicLayoutVertexBuffer.updateData(F):a.icon.dynamicLayoutVertexBuffer.updateData(F)}function kr(a,t,n,s,u,d,f,_,y,v,T,I,C){const F=_.glyphStartIndex+_.numGlyphs,R=_.lineStartIndex,B=_.lineStartIndex+_.lineLength,X=t.getoffsetX(_.glyphStartIndex),J=t.getoffsetX(F-1),te=oi(a*X,n,s,u,d,f,_.segment,R,B,y,v,T,I,C);if(!te)return null;const O=oi(a*J,n,s,u,d,f,_.segment,R,B,y,v,T,I,C);return O?{first:te,last:O}:null}function Se(a,t,n,s){return a===l.WritingMode.horizontal&&Math.abs(n.y-t.y)>Math.abs(n.x-t.x)*s?{useVertical:!0}:(a===l.WritingMode.vertical?t.y<n.y:t.x>n.x)?{needsFlipping:!0}:null}function et(a,t,n,s,u,d,f,_,y,v,T,I,C,F,R,B){const X=t/24,J=a.lineOffsetX*X,te=a.lineOffsetY*X;let O;if(a.numGlyphs>1){const ne=a.glyphStartIndex+a.numGlyphs,ie=a.lineStartIndex,ue=a.lineStartIndex+a.lineLength,he=kr(X,_,J,te,n,T,I,a,y,d,C,R,B);if(!he)return{notEnoughRoom:!0};const ye=dt(he.first.point,f,B).point,ce=dt(he.last.point,f,B).point;if(s&&!n){const Le=Se(a.writingMode,ye,ce,F);if(Le)return Le}O=[he.first];for(let Le=a.glyphStartIndex+1;Le<ne-1;Le++)O.push(oi(X*_.getoffsetX(Le),J,te,n,T,I,a.segment,ie,ue,y,d,C,R,B));O.push(he.last)}else{if(s&&!n){const ie=dt(I,u,B).point,ue=a.lineStartIndex+a.segment+1,he=new l.pointGeometry(y.getx(ue),y.gety(ue)),ye=dt(he,u,B),ce=ye.signedDistanceFromCamera>0?ye.point:Ye(I,he,ie,1,u,B),Le=Se(a.writingMode,ie,ce,F);if(Le)return Le}const ne=oi(X*_.getoffsetX(a.glyphStartIndex),J,te,n,T,I,a.segment,a.lineStartIndex,a.lineStartIndex+a.lineLength,y,d,C,R,B);if(!ne)return{notEnoughRoom:!0};O=[ne]}for(const ne of O)l.addDynamicAttributes(v,ne.point,ne.angle);return{}}function Ye(a,t,n,s,u,d){const f=dt(a.add(a.sub(t)._unit()),u,d).point,_=n.sub(f);return n.add(_._mult(s/_.mag()))}function oi(a,t,n,s,u,d,f,_,y,v,T,I,C,F){const R=s?a-t:a+t;let B=R>0?1:-1,X=0;s&&(B*=-1,X=Math.PI),B<0&&(X+=Math.PI);let J=B>0?_+f:_+f+1,te=u,O=u,ne=0,ie=0;const ue=Math.abs(R),he=[];for(;ne+ie<=ue;){if(J+=B,J<_||J>=y)return null;if(O=te,he.push(te),te=I[J],te===void 0){const Re=new l.pointGeometry(v.getx(J),v.gety(J)),Qe=dt(Re,T,F);if(Qe.signedDistanceFromCamera>0)te=I[J]=Qe.point;else{const it=J-B;te=Ye(ne===0?d:new l.pointGeometry(v.getx(it),v.gety(it)),Re,O,ue-ne+1,T,F)}}ne+=ie,ie=O.dist(te)}const ye=(ue-ne)/ie,ce=te.sub(O),Le=ce.mult(ye)._add(O);Le._add(ce._unit()._perp()._mult(n*B));const Ie=X+Math.atan2(te.y-O.y,te.x-O.x);return he.push(Le),{point:Le,angle:C?Ie:0,path:he}}const Dr=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function Je(a,t){for(let n=0;n<a;n++){const s=t.length;t.resize(s+4),t.float32.set(Dr,3*s)}}function gr(a,t,n){const s=t[0],u=t[1];return a[0]=n[0]*s+n[4]*u+n[12],a[1]=n[1]*s+n[5]*u+n[13],a[3]=n[3]*s+n[7]*u+n[15],a}const Yt=100;class yn{constructor(t,n=new Ce(t.width+200,t.height+200,25),s=new Ce(t.width+200,t.height+200,25)){this.transform=t,this.grid=n,this.ignoredGrid=s,this.pitchfactor=Math.cos(t._pitch)*t.cameraToCenterDistance,this.screenRightBoundary=t.width+Yt,this.screenBottomBoundary=t.height+Yt,this.gridRightBoundary=t.width+200,this.gridBottomBoundary=t.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(t,n,s,u,d,f){const _=this.projectAndGetPerspectiveRatio(u,t.anchorPointX,t.anchorPointY,f),y=s*_.perspectiveRatio,v=t.x1*y+_.point.x,T=t.y1*y+_.point.y,I=t.x2*y+_.point.x,C=t.y2*y+_.point.y;return!this.isInsideGrid(v,T,I,C)||n!=="always"&&this.grid.hitTest(v,T,I,C,n,d)||_.perspectiveRatio<this.perspectiveRatioCutoff?{box:[],offscreen:!1}:{box:[v,T,I,C],offscreen:this.isOffscreen(v,T,I,C)}}placeCollisionCircles(t,n,s,u,d,f,_,y,v,T,I,C,F,R){const B=[],X=new l.pointGeometry(n.anchorX,n.anchorY),J=dt(X,f,R),te=Oi(this.transform.cameraToCenterDistance,J.signedDistanceFromCamera),O=(T?d/te:d*te)/l.ONE_EM,ne=dt(X,_,R).point,ie=kr(O,u,n.lineOffsetX*O,n.lineOffsetY*O,!1,ne,X,n,s,_,{},!1,R);let ue=!1,he=!1,ye=!0;if(ie){const ce=.5*C*te+F,Le=new l.pointGeometry(-100,-100),Ie=new l.pointGeometry(this.screenRightBoundary,this.screenBottomBoundary),Re=new mr,Qe=ie.first,it=ie.last;let Ge=[];for(let ut=Qe.path.length-1;ut>=1;ut--)Ge.push(Qe.path[ut]);for(let ut=1;ut<it.path.length;ut++)Ge.push(it.path[ut]);const bt=2.5*ce;if(y){const ut=Ge.map(mt=>dt(mt,y,R));Ge=ut.some(mt=>mt.signedDistanceFromCamera<=0)?[]:ut.map(mt=>mt.point)}let wt=[];if(Ge.length>0){const ut=Ge[0].clone(),mt=Ge[0].clone();for(let Et=1;Et<Ge.length;Et++)ut.x=Math.min(ut.x,Ge[Et].x),ut.y=Math.min(ut.y,Ge[Et].y),mt.x=Math.max(mt.x,Ge[Et].x),mt.y=Math.max(mt.y,Ge[Et].y);wt=ut.x>=Le.x&&mt.x<=Ie.x&&ut.y>=Le.y&&mt.y<=Ie.y?[Ge]:mt.x<Le.x||ut.x>Ie.x||mt.y<Le.y||ut.y>Ie.y?[]:l.clipLine([Ge],Le.x,Le.y,Ie.x,Ie.y)}for(const ut of wt){Re.reset(ut,.25*ce);let mt=0;mt=Re.length<=.5*ce?1:Math.ceil(Re.paddedLength/bt)+1;for(let Et=0;Et<mt;Et++){const ei=Et/Math.max(mt-1,1),nr=Re.lerp(ei),Wi=nr.x+Yt,or=nr.y+Yt;B.push(Wi,or,ce,0);const $r=Wi-ce,$i=or-ce,vi=Wi+ce,xr=or+ce;if(ye=ye&&this.isOffscreen($r,$i,vi,xr),he=he||this.isInsideGrid($r,$i,vi,xr),t!=="always"&&this.grid.hitTestCircle(Wi,or,ce,t,I)&&(ue=!0,!v))return{circles:[],offscreen:!1,collisionDetected:ue}}}}return{circles:!v&&ue||!he||te<this.perspectiveRatioCutoff?[]:B,offscreen:ye,collisionDetected:ue}}queryRenderedSymbols(t){if(t.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const n=[];let s=1/0,u=1/0,d=-1/0,f=-1/0;for(const T of t){const I=new l.pointGeometry(T.x+Yt,T.y+Yt);s=Math.min(s,I.x),u=Math.min(u,I.y),d=Math.max(d,I.x),f=Math.max(f,I.y),n.push(I)}const _=this.grid.query(s,u,d,f).concat(this.ignoredGrid.query(s,u,d,f)),y={},v={};for(const T of _){const I=T.key;if(y[I.bucketInstanceId]===void 0&&(y[I.bucketInstanceId]={}),y[I.bucketInstanceId][I.featureIndex])continue;const C=[new l.pointGeometry(T.x1,T.y1),new l.pointGeometry(T.x2,T.y1),new l.pointGeometry(T.x2,T.y2),new l.pointGeometry(T.x1,T.y2)];l.polygonIntersectsPolygon(n,C)&&(y[I.bucketInstanceId][I.featureIndex]=!0,v[I.bucketInstanceId]===void 0&&(v[I.bucketInstanceId]=[]),v[I.bucketInstanceId].push(I.featureIndex))}return v}insertCollisionBox(t,n,s,u,d,f){(s?this.ignoredGrid:this.grid).insert({bucketInstanceId:u,featureIndex:d,collisionGroupID:f,overlapMode:n},t[0],t[1],t[2],t[3])}insertCollisionCircles(t,n,s,u,d,f){const _=s?this.ignoredGrid:this.grid,y={bucketInstanceId:u,featureIndex:d,collisionGroupID:f,overlapMode:n};for(let v=0;v<t.length;v+=4)_.insertCircle(y,t[v],t[v+1],t[v+2])}projectAndGetPerspectiveRatio(t,n,s,u){let d;return u?(d=[n,s,u(n,s),1],l.transformMat4(d,d,t)):(d=[n,s,0,1],gr(d,d,t)),{point:new l.pointGeometry((d[0]/d[3]+1)/2*this.transform.width+Yt,(-d[1]/d[3]+1)/2*this.transform.height+Yt),perspectiveRatio:.5+this.transform.cameraToCenterDistance/d[3]*.5}}isOffscreen(t,n,s,u){return s<Yt||t>=this.screenRightBoundary||u<Yt||n>this.screenBottomBoundary}isInsideGrid(t,n,s,u){return s>=0&&t<this.gridRightBoundary&&u>=0&&n<this.gridBottomBoundary}getViewportMatrix(){const t=l.identity([]);return l.translate(t,t,[-100,-100,0]),t}}function qt(a,t,n){return t*(l.EXTENT/(a.tileSize*Math.pow(2,n-a.tileID.overscaledZ)))}class fi{constructor(t,n,s,u){this.opacity=t?Math.max(0,Math.min(1,t.opacity+(t.placed?n:-n))):u&&s?1:0,this.placed=s}isHidden(){return this.opacity===0&&!this.placed}}class Tt{constructor(t,n,s,u,d){this.text=new fi(t?t.text:null,n,s,d),this.icon=new fi(t?t.icon:null,n,u,d)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class xn{constructor(t,n,s){this.text=t,this.icon=n,this.skipFade=s}}class tr{constructor(){this.invProjMatrix=l.create(),this.viewportMatrix=l.create(),this.circles=[]}}class jr{constructor(t,n,s,u,d){this.bucketInstanceId=t,this.featureIndex=n,this.sourceLayerIndex=s,this.bucketIndex=u,this.tileID=d}}class Xr{constructor(t){this.crossSourceCollisions=t,this.maxGroupID=0,this.collisionGroups={}}get(t){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[t]){const n=++this.maxGroupID;this.collisionGroups[t]={ID:n,predicate:s=>s.collisionGroupID===n}}return this.collisionGroups[t]}}function vn(a,t,n,s,u){const{horizontalAlign:d,verticalAlign:f}=l.getAnchorAlignment(a),_=-(d-.5)*t,y=-(f-.5)*n,v=l.evaluateVariableOffset(a,s);return new l.pointGeometry(_+v[0]*u,y+v[1]*u)}function Wr(a,t,n,s,u,d){const{x1:f,x2:_,y1:y,y2:v,anchorPointX:T,anchorPointY:I}=a,C=new l.pointGeometry(t,n);return s&&C._rotate(u?d:-d),{x1:f+C.x,y1:y+C.y,x2:_+C.x,y2:v+C.y,anchorPointX:T,anchorPointY:I}}class L{constructor(t,n,s,u,d){this.transform=t.clone(),this.terrain=n,this.collisionIndex=new yn(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=s,this.retainedQueryData={},this.collisionGroups=new Xr(u),this.collisionCircleArrays={},this.prevPlacement=d,d&&(d.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(t,n,s,u){const d=s.getBucket(n),f=s.latestFeatureIndex;if(!d||!f||n.id!==d.layerIds[0])return;const _=s.collisionBoxArray,y=d.layers[0].layout,v=Math.pow(2,this.transform.zoom-s.tileID.overscaledZ),T=s.tileSize/l.EXTENT,I=this.transform.calculatePosMatrix(s.tileID.toUnwrapped()),C=y.get("text-pitch-alignment")==="map",F=y.get("text-rotation-alignment")==="map",R=qt(s,1,this.transform.zoom),B=Zr(I,C,F,this.transform,R);let X=null;if(C){const te=ji(I,C,F,this.transform,R);X=l.multiply([],this.transform.labelPlaneMatrix,te)}this.retainedQueryData[d.bucketInstanceId]=new jr(d.bucketInstanceId,f,d.sourceLayerIndex,d.index,s.tileID);const J={bucket:d,layout:y,posMatrix:I,textLabelPlaneMatrix:B,labelToScreenMatrix:X,scale:v,textPixelRatio:T,holdingForFade:s.holdingForFade(),collisionBoxArray:_,partiallyEvaluatedTextSize:l.evaluateSizeForZoom(d.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(d.sourceID)};if(u)for(const te of d.sortKeyRanges){const{sortKey:O,symbolInstanceStart:ne,symbolInstanceEnd:ie}=te;t.push({sortKey:O,symbolInstanceStart:ne,symbolInstanceEnd:ie,parameters:J})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:d.symbolInstances.length,parameters:J})}attemptAnchorPlacement(t,n,s,u,d,f,_,y,v,T,I,C,F,R,B,X){const J=[C.textOffset0,C.textOffset1],te=vn(t,s,u,J,d),O=this.collisionIndex.placeCollisionBox(Wr(n,te.x,te.y,f,_,this.transform.angle),I,y,v,T.predicate,X);if((!B||this.collisionIndex.placeCollisionBox(Wr(B,te.x,te.y,f,_,this.transform.angle),I,y,v,T.predicate,X).box.length!==0)&&O.box.length>0){let ne;if(this.prevPlacement&&this.prevPlacement.variableOffsets[C.crossTileID]&&this.prevPlacement.placements[C.crossTileID]&&this.prevPlacement.placements[C.crossTileID].text&&(ne=this.prevPlacement.variableOffsets[C.crossTileID].anchor),C.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[C.crossTileID]={textOffset:J,width:s,height:u,anchor:t,textBoxScale:d,prevAnchor:ne},this.markUsedJustification(F,t,C,R),F.allowVerticalPlacement&&(this.markUsedOrientation(F,R,C),this.placedOrientations[C.crossTileID]=R),{shift:te,placedGlyphBoxes:O}}}placeLayerBucketPart(t,n,s){const{bucket:u,layout:d,posMatrix:f,textLabelPlaneMatrix:_,labelToScreenMatrix:y,textPixelRatio:v,holdingForFade:T,collisionBoxArray:I,partiallyEvaluatedTextSize:C,collisionGroup:F}=t.parameters,R=d.get("text-optional"),B=d.get("icon-optional"),X=l.getOverlapMode(d,"text-overlap","text-allow-overlap"),J=X==="always",te=l.getOverlapMode(d,"icon-overlap","icon-allow-overlap"),O=te==="always",ne=d.get("text-rotation-alignment")==="map",ie=d.get("text-pitch-alignment")==="map",ue=d.get("icon-text-fit")!=="none",he=d.get("symbol-z-order")==="viewport-y",ye=J&&(O||!u.hasIconData()||B),ce=O&&(J||!u.hasTextData()||R);!u.collisionArrays&&I&&u.deserializeCollisionBoxes(I);const Le=(Ie,Re)=>{if(n[Ie.crossTileID])return;if(T)return void(this.placements[Ie.crossTileID]=new xn(!1,!1,!1));let Qe=!1,it=!1,Ge=!0,bt=null,wt={box:null,offscreen:null},ut={box:null,offscreen:null},mt=null,Et=null,ei=null,nr=0,Wi=0,or=0;Re.textFeatureIndex?nr=Re.textFeatureIndex:Ie.useRuntimeCollisionCircles&&(nr=Ie.featureIndex),Re.verticalTextFeatureIndex&&(Wi=Re.verticalTextFeatureIndex);const $r=this.retainedQueryData[u.bucketInstanceId].tileID,$i=this.terrain?(Ht,ot)=>this.terrain.getElevation($r,Ht,ot):null;for(const Ht of["textBox","verticalTextBox","iconBox","verticalIconBox"]){const ot=Re[Ht];ot&&(ot.elevation=$i?$i(ot.anchorPointX,ot.anchorPointY):0)}const vi=Re.textBox;if(vi){const Ht=xt=>{let ti=l.WritingMode.horizontal;if(u.allowVerticalPlacement&&!xt&&this.prevPlacement){const ii=this.prevPlacement.placedOrientations[Ie.crossTileID];ii&&(this.placedOrientations[Ie.crossTileID]=ii,ti=ii,this.markUsedOrientation(u,ti,Ie))}return ti},ot=(xt,ti)=>{if(u.allowVerticalPlacement&&Ie.numVerticalGlyphVertices>0&&Re.verticalTextBox){for(const ii of u.writingModes)if(ii===l.WritingMode.vertical?(wt=ti(),ut=wt):wt=xt(),wt&&wt.box&&wt.box.length)break}else wt=xt()};if(d.get("text-variable-anchor")){let xt=d.get("text-variable-anchor");if(this.prevPlacement&&this.prevPlacement.variableOffsets[Ie.crossTileID]){const Bt=this.prevPlacement.variableOffsets[Ie.crossTileID];xt.indexOf(Bt.anchor)>0&&(xt=xt.filter(Vi=>Vi!==Bt.anchor),xt.unshift(Bt.anchor))}const ti=(Bt,Vi,en)=>{const Ds=Bt.x2-Bt.x1,Dn=Bt.y2-Bt.y1,$a=Ie.textBoxScale,Ls=ue&&te==="never"?Vi:null;let Vr={box:[],offscreen:!1};const tn=X!=="never"?2*xt.length:xt.length;for(let rn=0;rn<tn;++rn){const Go=this.attemptAnchorPlacement(xt[rn%xt.length],Bt,Ds,Dn,$a,ne,ie,v,f,F,rn>=xt.length?X:"never",Ie,u,en,Ls,$i);if(Go&&(Vr=Go.placedGlyphBoxes,Vr&&Vr.box&&Vr.box.length)){Qe=!0,bt=Go.shift;break}}return Vr};ot(()=>ti(vi,Re.iconBox,l.WritingMode.horizontal),()=>{const Bt=Re.verticalTextBox;return u.allowVerticalPlacement&&!(wt&&wt.box&&wt.box.length)&&Ie.numVerticalGlyphVertices>0&&Bt?ti(Bt,Re.verticalIconBox,l.WritingMode.vertical):{box:null,offscreen:null}}),wt&&(Qe=wt.box,Ge=wt.offscreen);const ii=Ht(wt&&wt.box);if(!Qe&&this.prevPlacement){const Bt=this.prevPlacement.variableOffsets[Ie.crossTileID];Bt&&(this.variableOffsets[Ie.crossTileID]=Bt,this.markUsedJustification(u,Bt.anchor,Ie,ii))}}else{const xt=(ti,ii)=>{const Bt=this.collisionIndex.placeCollisionBox(ti,X,v,f,F.predicate,$i);return Bt&&Bt.box&&Bt.box.length&&(this.markUsedOrientation(u,ii,Ie),this.placedOrientations[Ie.crossTileID]=ii),Bt};ot(()=>xt(vi,l.WritingMode.horizontal),()=>{const ti=Re.verticalTextBox;return u.allowVerticalPlacement&&Ie.numVerticalGlyphVertices>0&&ti?xt(ti,l.WritingMode.vertical):{box:null,offscreen:null}}),Ht(wt&&wt.box&&wt.box.length)}}if(mt=wt,Qe=mt&&mt.box&&mt.box.length>0,Ge=mt&&mt.offscreen,Ie.useRuntimeCollisionCircles){const Ht=u.text.placedSymbolArray.get(Ie.centerJustifiedTextSymbolIndex),ot=l.evaluateSizeForFeature(u.textSizeData,C,Ht),xt=d.get("text-padding");Et=this.collisionIndex.placeCollisionCircles(X,Ht,u.lineVertexArray,u.glyphOffsetArray,ot,f,_,y,s,ie,F.predicate,Ie.collisionCircleDiameter,xt,$i),Et.circles.length&&Et.collisionDetected&&!s&&l.warnOnce("Collisions detected, but collision boxes are not shown"),Qe=J||Et.circles.length>0&&!Et.collisionDetected,Ge=Ge&&Et.offscreen}if(Re.iconFeatureIndex&&(or=Re.iconFeatureIndex),Re.iconBox){const Ht=ot=>{const xt=ue&&bt?Wr(ot,bt.x,bt.y,ne,ie,this.transform.angle):ot;return this.collisionIndex.placeCollisionBox(xt,te,v,f,F.predicate,$i)};ut&&ut.box&&ut.box.length&&Re.verticalIconBox?(ei=Ht(Re.verticalIconBox),it=ei.box.length>0):(ei=Ht(Re.iconBox),it=ei.box.length>0),Ge=Ge&&ei.offscreen}const xr=R||Ie.numHorizontalGlyphVertices===0&&Ie.numVerticalGlyphVertices===0,No=B||Ie.numIconVertices===0;if(xr||No?No?xr||(it=it&&Qe):Qe=it&&Qe:it=Qe=it&&Qe,Qe&&mt&&mt.box&&this.collisionIndex.insertCollisionBox(mt.box,X,d.get("text-ignore-placement"),u.bucketInstanceId,ut&&ut.box&&Wi?Wi:nr,F.ID),it&&ei&&this.collisionIndex.insertCollisionBox(ei.box,te,d.get("icon-ignore-placement"),u.bucketInstanceId,or,F.ID),Et&&(Qe&&this.collisionIndex.insertCollisionCircles(Et.circles,X,d.get("text-ignore-placement"),u.bucketInstanceId,nr,F.ID),s)){const Ht=u.bucketInstanceId;let ot=this.collisionCircleArrays[Ht];ot===void 0&&(ot=this.collisionCircleArrays[Ht]=new tr);for(let xt=0;xt<Et.circles.length;xt+=4)ot.circles.push(Et.circles[xt+0]),ot.circles.push(Et.circles[xt+1]),ot.circles.push(Et.circles[xt+2]),ot.circles.push(Et.collisionDetected?1:0)}if(Ie.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");if(u.bucketInstanceId===0)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[Ie.crossTileID]=new xn(Qe||ye,it||ce,Ge||u.justReloaded),n[Ie.crossTileID]=!0};if(he){if(t.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");const Ie=u.getSortedSymbolIndexes(this.transform.angle);for(let Re=Ie.length-1;Re>=0;--Re){const Qe=Ie[Re];Le(u.symbolInstances.get(Qe),u.collisionArrays[Qe])}}else for(let Ie=t.symbolInstanceStart;Ie<t.symbolInstanceEnd;Ie++)Le(u.symbolInstances.get(Ie),u.collisionArrays[Ie]);if(s&&u.bucketInstanceId in this.collisionCircleArrays){const Ie=this.collisionCircleArrays[u.bucketInstanceId];l.invert(Ie.invProjMatrix,f),Ie.viewportMatrix=this.collisionIndex.getViewportMatrix()}u.justReloaded=!1}markUsedJustification(t,n,s,u){let d;d=u===l.WritingMode.vertical?s.verticalPlacedTextSymbolIndex:{left:s.leftJustifiedTextSymbolIndex,center:s.centerJustifiedTextSymbolIndex,right:s.rightJustifiedTextSymbolIndex}[l.getAnchorJustification(n)];const f=[s.leftJustifiedTextSymbolIndex,s.centerJustifiedTextSymbolIndex,s.rightJustifiedTextSymbolIndex,s.verticalPlacedTextSymbolIndex];for(const _ of f)_>=0&&(t.text.placedSymbolArray.get(_).crossTileID=d>=0&&_!==d?0:s.crossTileID)}markUsedOrientation(t,n,s){const u=n===l.WritingMode.horizontal||n===l.WritingMode.horizontalOnly?n:0,d=n===l.WritingMode.vertical?n:0,f=[s.leftJustifiedTextSymbolIndex,s.centerJustifiedTextSymbolIndex,s.rightJustifiedTextSymbolIndex];for(const _ of f)t.text.placedSymbolArray.get(_).placedOrientation=u;s.verticalPlacedTextSymbolIndex&&(t.text.placedSymbolArray.get(s.verticalPlacedTextSymbolIndex).placedOrientation=d)}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;const n=this.prevPlacement;let s=!1;this.prevZoomAdjustment=n?n.zoomAdjustment(this.transform.zoom):0;const u=n?n.symbolFadeChange(t):1,d=n?n.opacities:{},f=n?n.variableOffsets:{},_=n?n.placedOrientations:{};for(const y in this.placements){const v=this.placements[y],T=d[y];T?(this.opacities[y]=new Tt(T,u,v.text,v.icon),s=s||v.text!==T.text.placed||v.icon!==T.icon.placed):(this.opacities[y]=new Tt(null,u,v.text,v.icon,v.skipFade),s=s||v.text||v.icon)}for(const y in d){const v=d[y];if(!this.opacities[y]){const T=new Tt(v,u,!1,!1);T.isHidden()||(this.opacities[y]=T,s=s||v.text.placed||v.icon.placed)}}for(const y in f)this.variableOffsets[y]||!this.opacities[y]||this.opacities[y].isHidden()||(this.variableOffsets[y]=f[y]);for(const y in _)this.placedOrientations[y]||!this.opacities[y]||this.opacities[y].isHidden()||(this.placedOrientations[y]=_[y]);if(n&&n.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");s?this.lastPlacementChangeTime=t:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=n?n.lastPlacementChangeTime:t)}updateLayerOpacities(t,n){const s={};for(const u of n){const d=u.getBucket(t);d&&u.latestFeatureIndex&&t.id===d.layerIds[0]&&this.updateBucketOpacities(d,s,u.collisionBoxArray)}}updateBucketOpacities(t,n,s){t.hasTextData()&&t.text.opacityVertexArray.clear(),t.hasIconData()&&t.icon.opacityVertexArray.clear(),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexArray.clear(),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexArray.clear();const u=t.layers[0].layout,d=new Tt(null,0,!1,!1,!0),f=u.get("text-allow-overlap"),_=u.get("icon-allow-overlap"),y=u.get("text-variable-anchor"),v=u.get("text-rotation-alignment")==="map",T=u.get("text-pitch-alignment")==="map",I=u.get("icon-text-fit")!=="none",C=new Tt(null,0,f&&(_||!t.hasIconData()||u.get("icon-optional")),_&&(f||!t.hasTextData()||u.get("text-optional")),!0);!t.collisionArrays&&s&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(s);const F=(R,B,X)=>{for(let J=0;J<B/4;J++)R.opacityVertexArray.emplaceBack(X)};for(let R=0;R<t.symbolInstances.length;R++){const B=t.symbolInstances.get(R),{numHorizontalGlyphVertices:X,numVerticalGlyphVertices:J,crossTileID:te}=B;let O=this.opacities[te];n[te]?O=d:O||(O=C,this.opacities[te]=O),n[te]=!0;const ne=B.numIconVertices>0,ie=this.placedOrientations[B.crossTileID],ue=ie===l.WritingMode.vertical,he=ie===l.WritingMode.horizontal||ie===l.WritingMode.horizontalOnly;if(X>0||J>0){const ye=K(O.text);F(t.text,X,ue?le:ye),F(t.text,J,he?le:ye);const ce=O.text.isHidden();[B.rightJustifiedTextSymbolIndex,B.centerJustifiedTextSymbolIndex,B.leftJustifiedTextSymbolIndex].forEach(Re=>{Re>=0&&(t.text.placedSymbolArray.get(Re).hidden=ce||ue?1:0)}),B.verticalPlacedTextSymbolIndex>=0&&(t.text.placedSymbolArray.get(B.verticalPlacedTextSymbolIndex).hidden=ce||he?1:0);const Le=this.variableOffsets[B.crossTileID];Le&&this.markUsedJustification(t,Le.anchor,B,ie);const Ie=this.placedOrientations[B.crossTileID];Ie&&(this.markUsedJustification(t,"left",B,Ie),this.markUsedOrientation(t,Ie,B))}if(ne){const ye=K(O.icon),ce=!(I&&B.verticalPlacedIconSymbolIndex&&ue);B.placedIconSymbolIndex>=0&&(F(t.icon,B.numIconVertices,ce?ye:le),t.icon.placedSymbolArray.get(B.placedIconSymbolIndex).hidden=O.icon.isHidden()),B.verticalPlacedIconSymbolIndex>=0&&(F(t.icon,B.numVerticalIconVertices,ce?le:ye),t.icon.placedSymbolArray.get(B.verticalPlacedIconSymbolIndex).hidden=O.icon.isHidden())}if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const ye=t.collisionArrays[R];if(ye){let ce=new l.pointGeometry(0,0);if(ye.textBox||ye.verticalTextBox){let Ie=!0;if(y){const Re=this.variableOffsets[te];Re?(ce=vn(Re.anchor,Re.width,Re.height,Re.textOffset,Re.textBoxScale),v&&ce._rotate(T?this.transform.angle:-this.transform.angle)):Ie=!1}ye.textBox&&b(t.textCollisionBox.collisionVertexArray,O.text.placed,!Ie||ue,ce.x,ce.y),ye.verticalTextBox&&b(t.textCollisionBox.collisionVertexArray,O.text.placed,!Ie||he,ce.x,ce.y)}const Le=Boolean(!he&&ye.verticalIconBox);ye.iconBox&&b(t.iconCollisionBox.collisionVertexArray,O.icon.placed,Le,I?ce.x:0,I?ce.y:0),ye.verticalIconBox&&b(t.iconCollisionBox.collisionVertexArray,O.icon.placed,!Le,I?ce.x:0,I?ce.y:0)}}}if(t.sortFeatures(this.transform.angle),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 new 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 new Error(`bucket.icon.opacityVertexArray.length (= ${t.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${t.icon.layoutVertexArray.length}) / 4`);if(t.bucketInstanceId in this.collisionCircleArrays){const R=this.collisionCircleArrays[t.bucketInstanceId];t.placementInvProjMatrix=R.invProjMatrix,t.placementViewportMatrix=R.viewportMatrix,t.collisionCircleArray=R.circles,delete this.collisionCircleArrays[t.bucketInstanceId]}}symbolFadeChange(t){return this.fadeDuration===0?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,n){const s=this.zoomAtLastRecencyCheck===n?1-this.zoomAdjustment(n):1;return this.zoomAtLastRecencyCheck=n,this.commitTime+this.fadeDuration*s>t}setStale(){this.stale=!0}}function b(a,t,n,s,u){a.emplaceBack(t?1:0,n?1:0,s||0,u||0),a.emplaceBack(t?1:0,n?1:0,s||0,u||0),a.emplaceBack(t?1:0,n?1:0,s||0,u||0),a.emplaceBack(t?1:0,n?1:0,s||0,u||0)}const S=Math.pow(2,25),k=Math.pow(2,24),D=Math.pow(2,17),N=Math.pow(2,16),H=Math.pow(2,9),Z=Math.pow(2,8),G=Math.pow(2,1);function K(a){if(a.opacity===0&&!a.placed)return 0;if(a.opacity===1&&a.placed)return 4294967295;const t=a.placed?1:0,n=Math.floor(127*a.opacity);return n*S+t*k+n*D+t*N+n*H+t*Z+n*G+t}const le=0;class _e{constructor(t){this._sortAcrossTiles=t.layout.get("symbol-z-order")!=="viewport-y"&&!t.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(t,n,s,u,d){const f=this._bucketParts;for(;this._currentTileIndex<t.length;)if(n.getBucketParts(f,u,t[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,d())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,f.sort((_,y)=>_.sortKey-y.sortKey));this._currentPartIndex<f.length;)if(n.placeLayerBucketPart(f[this._currentPartIndex],this._seenCrossTileIDs,s),this._currentPartIndex++,d())return!0;return!1}}class ae{constructor(t,n,s,u,d,f,_,y){this.placement=new L(t,n,f,_,y),this._currentPlacementIndex=s.length-1,this._forceFullPlacement=u,this._showCollisionBoxes=d,this._done=!1}isDone(){return this._done}continuePlacement(t,n,s){const u=l.exported.now(),d=()=>{const f=l.exported.now()-u;return!this._forceFullPlacement&&f>2};for(;this._currentPlacementIndex>=0;){const f=n[t[this._currentPlacementIndex]],_=this.placement.collisionIndex.transform.zoom;if(f.type==="symbol"&&(!f.minzoom||f.minzoom<=_)&&(!f.maxzoom||f.maxzoom>_)){if(this._inProgressLayer||(this._inProgressLayer=new _e(f)),this._inProgressLayer.continuePlacement(s[f.source],this.placement,this._showCollisionBoxes,f,d))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(t){return this.placement.commit(t),this.placement}}const Oe=512/l.EXTENT/2;class $e{constructor(t,n,s){this.tileID=t,this.indexedSymbolInstances={},this.bucketInstanceId=s;for(let u=0;u<n.length;u++){const d=n.get(u),f=d.key;this.indexedSymbolInstances[f]||(this.indexedSymbolInstances[f]=[]),this.indexedSymbolInstances[f].push({crossTileID:d.crossTileID,coord:this.getScaledCoordinates(d,t)})}}getScaledCoordinates(t,n){const s=Oe/Math.pow(2,n.canonical.z-this.tileID.canonical.z);return{x:Math.floor((n.canonical.x*l.EXTENT+t.anchorX)*s),y:Math.floor((n.canonical.y*l.EXTENT+t.anchorY)*s)}}findMatches(t,n,s){const u=this.tileID.canonical.z<n.canonical.z?1:Math.pow(2,this.tileID.canonical.z-n.canonical.z);for(let d=0;d<t.length;d++){const f=t.get(d);if(f.crossTileID)continue;const _=this.indexedSymbolInstances[f.key];if(!_)continue;const y=this.getScaledCoordinates(f,n);for(const v of _)if(Math.abs(v.coord.x-y.x)<=u&&Math.abs(v.coord.y-y.y)<=u&&!s[v.crossTileID]){s[v.crossTileID]=!0,f.crossTileID=v.crossTileID;break}}}}class De{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Ze{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(t){const n=Math.round((t-this.lng)/360);if(n!==0)for(const s in this.indexes){const u=this.indexes[s],d={};for(const f in u){const _=u[f];_.tileID=_.tileID.unwrapTo(_.tileID.wrap+n),d[_.tileID.key]=_}this.indexes[s]=d}this.lng=t}addBucket(t,n,s){if(this.indexes[t.overscaledZ]&&this.indexes[t.overscaledZ][t.key]){if(this.indexes[t.overscaledZ][t.key].bucketInstanceId===n.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(t.overscaledZ,this.indexes[t.overscaledZ][t.key])}for(let d=0;d<n.symbolInstances.length;d++)n.symbolInstances.get(d).crossTileID=0;this.usedCrossTileIDs[t.overscaledZ]||(this.usedCrossTileIDs[t.overscaledZ]={});const u=this.usedCrossTileIDs[t.overscaledZ];for(const d in this.indexes){const f=this.indexes[d];if(Number(d)>t.overscaledZ)for(const _ in f){const y=f[_];y.tileID.isChildOf(t)&&y.findMatches(n.symbolInstances,t,u)}else{const _=f[t.scaledTo(Number(d)).key];_&&_.findMatches(n.symbolInstances,t,u)}}for(let d=0;d<n.symbolInstances.length;d++){const f=n.symbolInstances.get(d);f.crossTileID||(f.crossTileID=s.generate(),u[f.crossTileID]=!0)}return this.indexes[t.overscaledZ]===void 0&&(this.indexes[t.overscaledZ]={}),this.indexes[t.overscaledZ][t.key]=new $e(t,n.symbolInstances,n.bucketInstanceId),!0}removeBucketCrossTileIDs(t,n){for(const s in n.indexedSymbolInstances)for(const u of n.indexedSymbolInstances[s])delete this.usedCrossTileIDs[t][u.crossTileID]}removeStaleBuckets(t){let n=!1;for(const s in this.indexes){const u=this.indexes[s];for(const d in u)t[u[d].bucketInstanceId]||(this.removeBucketCrossTileIDs(s,u[d]),delete u[d],n=!0)}return n}}class Xe{constructor(){this.layerIndexes={},this.crossTileIDs=new De,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(t,n,s){let u=this.layerIndexes[t.id];u===void 0&&(u=this.layerIndexes[t.id]=new Ze);let d=!1;const f={};u.handleWrapJump(s);for(const _ of n){const y=_.getBucket(t);y&&t.id===y.layerIds[0]&&(y.bucketInstanceId||(y.bucketInstanceId=++this.maxBucketInstanceId),u.addBucket(_.tileID,y,this.crossTileIDs)&&(d=!0),f[y.bucketInstanceId]=!0)}return u.removeStaleBuckets(f)&&(d=!0),d}pruneUnusedLayers(t){const n={};t.forEach(s=>{n[s]=!0});for(const s in this.layerIndexes)n[s]||delete this.layerIndexes[s]}}var pt=l.createLayout([{name:"a_pos",type:"Int16",components:2}]);class Ke extends l.Evented{constructor(t){super(),this.sourceCache=t,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.renderHistory=[],this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,this.renderHistorySize=t._cache.max,t.usedForTerrain=!0,t.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null;for(const t in this._tiles){const n=this._tiles[t];n.textures.forEach(s=>s.destroy()),n.textures=[]}}update(t,n){this.sourceCache.update(t,n),this._renderableTilesKeys=[];for(const s of t.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:n}))this._renderableTilesKeys.push(s.key),this._tiles[s.key]||(s.posMatrix=new Float64Array(16),l.ortho(s.posMatrix,0,l.EXTENT,0,l.EXTENT,0,1),this._tiles[s.key]=new Ir(s,this.tileSize))}removeOutdated(t){const n={};this.renderHistory=this.renderHistory.filter((s,u)=>this.renderHistory.indexOf(s)===u).slice(0,this.renderHistorySize);for(const s of this._renderableTilesKeys)n[s]=!0;for(const s of this.renderHistory)n[s]=!0;for(const s in this._tiles)n[s]||(this._tiles[s].clearTextures(t),delete this._tiles[s])}getRenderableTiles(){return this._renderableTilesKeys.map(t=>this.getTileByID(t))}getTileByID(t){return this._tiles[t]}getTerrainCoords(t){const n={};for(const s of this._renderableTilesKeys){const u=this._tiles[s].tileID;if(u.canonical.equals(t.canonical)){const d=t.clone();d.posMatrix=new Float64Array(16),l.ortho(d.posMatrix,0,l.EXTENT,0,l.EXTENT,0,1),n[s]=d}else if(u.canonical.isChildOf(t.canonical)){const d=t.clone();d.posMatrix=new Float64Array(16);const f=u.canonical.z-t.canonical.z,_=u.canonical.x-(u.canonical.x>>f<<f),y=u.canonical.y-(u.canonical.y>>f<<f),v=l.EXTENT>>f;l.ortho(d.posMatrix,0,v,0,v,0,1),l.translate(d.posMatrix,d.posMatrix,[-_*v,-y*v,0]),n[s]=d}else if(t.canonical.isChildOf(u.canonical)){const d=t.clone();d.posMatrix=new Float64Array(16);const f=t.canonical.z-u.canonical.z,_=t.canonical.x-(t.canonical.x>>f<<f),y=t.canonical.y-(t.canonical.y>>f<<f),v=l.EXTENT>>f;l.ortho(d.posMatrix,0,l.EXTENT,0,l.EXTENT,0,1),l.translate(d.posMatrix,d.posMatrix,[_*v,y*v,0]),l.scale(d.posMatrix,d.posMatrix,[1/2**f,1/2**f,0]),n[s]=d}}return n}getSourceTile(t,n){const s=this.sourceCache._source;let u=t.overscaledZ-this.deltaZoom;if(u>s.maxzoom&&(u=s.maxzoom),u<s.minzoom)return null;this._sourceTileCache[t.key]||(this._sourceTileCache[t.key]=t.scaledTo(u).key);let d=this.sourceCache.getTileByID(this._sourceTileCache[t.key]);if((!d||!d.dem)&&n)for(;u>=s.minzoom&&(!d||!d.dem);)d=this.sourceCache.getTileByID(t.scaledTo(u--).key);return d}tilesAfterTime(t=Date.now()){return Object.values(this._tiles).filter(n=>n.timeLoaded>=t)}}class tt{constructor(t,n,s){this.style=t,this.sourceCache=new Ke(n),this.options=s,this.exaggeration=typeof s.exaggeration=="number"?s.exaggeration:1,this.elevationOffset=typeof s.elevationOffset=="number"?s.elevationOffset:450,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024,this.clearRerenderCache()}getDEMElevation(t,n,s,u=l.EXTENT){if(!(n>=0&&n<u&&s>=0&&s<u))return this.elevationOffset;let d=0;const f=this.getTerrainData(t);if(f.tile&&f.tile.dem){const _=l.transformMat4$1([],[n/u*l.EXTENT,s/u*l.EXTENT],f.u_terrain_matrix),y=[_[0]*f.tile.dem.dim,_[1]*f.tile.dem.dim],v=[Math.floor(y[0]),Math.floor(y[1])],T=f.tile.dem.get(v[0],v[1]),I=f.tile.dem.get(v[0],v[1]+1),C=f.tile.dem.get(v[0]+1,v[1]),F=f.tile.dem.get(v[0]+1,v[1]+1);d=l.number(l.number(T,I,y[0]-v[0]),l.number(C,F,y[0]-v[0]),y[1]-v[1])}return d}rememberForRerender(t,n){for(const s in this.sourceCache._tiles){const u=this.sourceCache._tiles[s];(u.tileID.equals(n)||u.tileID.isChildOf(n))&&(t===this.sourceCache.sourceCache.id&&(u.timeLoaded=Date.now()),this._rerender[t]=this._rerender[t]||{},this._rerender[t][u.tileID.key]=!0)}}needsRerender(t,n){return this._rerender[t]&&this._rerender[t][n.key]}clearRerenderCache(){this._rerender={}}getElevation(t,n,s,u=l.EXTENT){return(this.getDEMElevation(t,n,s,u)+this.elevationOffset)*this.exaggeration}getTerrainData(t){if(!this._emptyDemTexture){const u=this.style.map.painter.context,d=new l.RGBAImage({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new He(u,d,u.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new He(u,new l.RGBAImage({width:1,height:1}),u.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(u.gl.NEAREST,u.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=l.identity([])}const n=this.sourceCache.getSourceTile(t,!0);if(n&&n.dem&&(!n.demTexture||n.needsTerrainPrepare)){const u=this.style.map.painter.context;n.demTexture=this.style.map.painter.getTileTexture(n.dem.stride),n.demTexture?n.demTexture.update(n.dem.getPixels(),{premultiply:!1}):n.demTexture=new He(u,n.dem.getPixels(),u.gl.RGBA,{premultiply:!1}),n.demTexture.bind(u.gl.NEAREST,u.gl.CLAMP_TO_EDGE),n.needsTerrainPrepare=!1}const s=n&&n+n.tileID.key+t.key;if(s&&!this._demMatrixCache[s]){const u=this.sourceCache.sourceCache._source.maxzoom;let d=t.canonical.z-n.tileID.canonical.z;t.overscaledZ>t.canonical.z&&(t.canonical.z>=u?d=t.canonical.z-u:l.warnOnce("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const f=t.canonical.x-(t.canonical.x>>d<<d),_=t.canonical.y-(t.canonical.y>>d<<d),y=l.fromScaling(new Float64Array(16),[1/(l.EXTENT<<d),1/(l.EXTENT<<d),0]);l.translate(y,y,[f*l.EXTENT,_*l.EXTENT,0]),this._demMatrixCache[t.key]={matrix:y,coord:t}}return{u_depth:2,u_terrain:3,u_terrain_dim:n&&n.dem&&n.dem.dim||1,u_terrain_matrix:s?this._demMatrixCache[t.key].matrix:this._emptyDemMatrix,u_terrain_unpack:n&&n.dem&&n.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_offset:this.elevationOffset,u_terrain_exaggeration:this.exaggeration,texture:(n&&n.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:n}}getRTTFramebuffer(){const t=this.style.map.painter;if(!this._rttFramebuffer){const n=this.sourceCache.tileSize*this.qualityFactor;this._rttFramebuffer=t.context.createFramebuffer(n,n,!0),this._rttFramebuffer.depthAttachment.set(t.context.createRenderbuffer(t.context.gl.DEPTH_COMPONENT16,n,n))}return this._rttFramebuffer}getFramebuffer(t){const n=this.style.map.painter,s=n.width/devicePixelRatio,u=n.height/devicePixelRatio;return!this._fbo||this._fbo.width===s&&this._fbo.height===u||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new He(n.context,{width:s,height:u,data:null},n.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(n.context.gl.NEAREST,n.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new He(n.context,{width:s,height:u,data:null},n.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(n.context.gl.NEAREST,n.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=n.context.createFramebuffer(s,u,!0),this._fbo.depthAttachment.set(n.context.createRenderbuffer(n.context.gl.DEPTH_COMPONENT16,s,u))),this._fbo.colorAttachment.set(t==="coords"?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){const t=this.style.map.painter.context;if(this._coordsTexture)return this._coordsTexture;const n=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let d=0,f=0;d<this._coordsTextureSize;d++)for(let _=0;_<this._coordsTextureSize;_++,f+=4)n[f+0]=255&_,n[f+1]=255&d,n[f+2]=_>>8<<4|d>>8,n[f+3]=0;const s=new l.RGBAImage({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(n.buffer)),u=new He(t,s,t.gl.RGBA,{premultiply:!1});return u.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),this._coordsTexture=u,u}pointCoordinate(t){const n=new Uint8Array(4),s=this.style.map.painter,u=s.context,d=u.gl;u.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),d.readPixels(t.x,s.height/devicePixelRatio-t.y-1,1,1,d.RGBA,d.UNSIGNED_BYTE,n),u.bindFramebuffer.set(null);const f=n[0]+(n[2]>>4<<8),_=n[1]+((15&n[2])<<8),y=this.coordsIndex[255-n[3]],v=y&&this.sourceCache.getTileByID(y);if(!v)return null;const T=this._coordsTextureSize,I=(1<<v.tileID.canonical.z)*T;return new l.MercatorCoordinate((v.tileID.canonical.x*T+f)/I,(v.tileID.canonical.y*T+_)/I,this.getElevation(v.tileID,f,_,T))}getTerrainMesh(){if(this._mesh)return this._mesh;const t=this.style.map.painter.context,n=new l.PosArray,s=new l.TriangleIndexArray,u=this.meshSize,d=l.EXTENT/u,f=u*u;for(let _=0;_<=u;_++)for(let y=0;y<=u;y++)n.emplaceBack(y*d,_*d);for(let _=0;_<f;_+=u+1)for(let y=0;y<u;y++)s.emplaceBack(y+_,u+y+_+1,u+y+_+2),s.emplaceBack(y+_,u+y+_+2,y+_+1);return this._mesh={indexBuffer:t.createIndexBuffer(s),vertexBuffer:t.createVertexBuffer(n,pt.members),segments:l.SegmentVector.simpleSegment(0,0,n.length,s.length)},this._mesh}getMinMaxElevation(t){const n=this.getTerrainData(t).tile,s={minElevation:null,maxElevation:null};return n&&n.dem&&(s.minElevation=(n.dem.min+this.elevationOffset)*this.exaggeration,s.maxElevation=(n.dem.max+this.elevationOffset)*this.exaggeration),s}}const ft=(a,t)=>l.emitValidationErrors(a,t&&t.filter(n=>n.identifier!=="source.canvas")),St=l.pick(ht,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData"]),Qt=l.pick(ht,["setCenter","setZoom","setBearing","setPitch"]),kt=function(){const a={},t=l.spec.$version;for(const n in l.spec.$root){const s=l.spec.$root[n];if(s.required){let u=null;u=n==="version"?t:s.type==="array"?[]:{},u!=null&&(a[n]=u)}}return a}();class li extends l.Evented{constructor(t,n={}){super(),this.map=t,this.dispatcher=new lr(mn(),this),this.imageManager=new Mt,this.imageManager.setEventedParent(this),this.glyphManager=new $t(t._requestManager,n.localIdeographFontFamily),this.lineAtlas=new wo(256,512),this.crossTileSymbolIndex=new Xe,this._layers={},this._serializedLayers={},this._order=[],this.sourceCaches={},this.zoomHistory=new l.ZoomHistory,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("setReferrer",l.getReferrer());const s=this;this._rtlTextPluginCallback=li.registerForPluginStateChange(u=>{s.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:u.pluginStatus,pluginURL:u.pluginURL},(d,f)=>{if(l.triggerPluginCompletionEvent(d),f&&f.every(_=>_))for(const _ in s.sourceCaches)s.sourceCaches[_].reload()})}),this.on("data",u=>{if(u.dataType!=="source"||u.sourceDataType!=="metadata")return;const d=this.sourceCaches[u.sourceId];if(!d)return;const f=d.getSource();if(f&&f.vectorLayerIds)for(const _ in this._layers){const y=this._layers[_];y.source===f.id&&this._validateLayer(y)}})}loadURL(t,n={}){this.fire(new l.Event("dataloading",{dataType:"style"}));const s=typeof n.validate!="boolean"||n.validate,u=this.map._requestManager.transformRequest(t,l.ResourceType.Style);this._request=l.getJSON(u,(d,f)=>{this._request=null,d?this.fire(new l.ErrorEvent(d)):f&&this._load(f,s)})}loadJSON(t,n={}){this.fire(new l.Event("dataloading",{dataType:"style"})),this._request=l.exported.frame(()=>{this._request=null,this._load(t,n.validate!==!1)})}loadEmpty(){this.fire(new l.Event("dataloading",{dataType:"style"})),this._load(kt,!1)}_load(t,n){if(n&&ft(this,l.validateStyle(t)))return;this._loaded=!0,this.stylesheet=t;for(const u in t.sources)this.addSource(u,t.sources[u],{validate:!1});t.sprite?this._loadSprite(t.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(t.glyphs);const s=Nn(this.stylesheet.layers);this._order=s.map(u=>u.id),this._layers={},this._serializedLayers={};for(let u of s)u=l.createStyleLayer(u),u.setEventedParent(this,{layer:{id:u.id}}),this._layers[u.id]=u,this._serializedLayers[u.id]=u.serialize();this.dispatcher.broadcast("setLayers",this._serializeLayers(this._order)),this.light=new pi(this.stylesheet.light),this.setTerrain(this.stylesheet.terrain),this.fire(new l.Event("data",{dataType:"style"})),this.fire(new l.Event("style.load"))}_loadSprite(t){this._spriteRequest=function(n,s,u,d){let f,_,y;const v=u>1?"@2x":"";let T=l.getJSON(s.transformRequest(s.normalizeSpriteURL(n,v,".json"),l.ResourceType.SpriteJSON),(F,R)=>{T=null,y||(y=F,f=R,C())}),I=l.getImage(s.transformRequest(s.normalizeSpriteURL(n,v,".png"),l.ResourceType.SpriteImage),(F,R)=>{I=null,y||(y=F,_=R,C())});function C(){if(y)d(y);else if(f&&_){const F=l.exported.getImageData(_),R={};for(const B in f){const{width:X,height:J,x:te,y:O,sdf:ne,pixelRatio:ie,stretchX:ue,stretchY:he,content:ye}=f[B],ce=new l.RGBAImage({width:X,height:J});l.RGBAImage.copy(F,ce,{x:te,y:O},{x:0,y:0},{width:X,height:J}),R[B]={data:ce,pixelRatio:ie,sdf:ne,stretchX:ue,stretchY:he,content:ye}}d(null,R)}}return{cancel(){T&&(T.cancel(),T=null),I&&(I.cancel(),I=null)}}}(t,this.map._requestManager,this.map.getPixelRatio(),(n,s)=>{if(this._spriteRequest=null,n)this.fire(new l.ErrorEvent(n));else if(s)for(const u in s)this.imageManager.addImage(u,s[u]);this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new l.Event("data",{dataType:"style"}))})}_validateLayer(t){const n=this.sourceCaches[t.source];if(!n)return;const s=t.sourceLayer;if(!s)return;const u=n.getSource();(u.type==="geojson"||u.vectorLayerIds&&u.vectorLayerIds.indexOf(s)===-1)&&this.fire(new l.ErrorEvent(new Error(`Source layer "${s}" does not exist on source "${u.id}" as specified by style layer "${t.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const t in this.sourceCaches)if(!this.sourceCaches[t].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeLayers(t){const n=[];for(const s of t){const u=this._layers[s];u.type!=="custom"&&n.push(u.serialize())}return n}hasTransitions(){if(this.light&&this.light.hasTransition())return!0;for(const t in this.sourceCaches)if(this.sourceCaches[t].hasTransition())return!0;for(const t in this._layers)if(this._layers[t].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(t){if(!this._loaded)return;const n=this._changed;if(this._changed){const u=Object.keys(this._updatedLayers),d=Object.keys(this._removedLayers);(u.length||d.length)&&this._updateWorkerLayers(u,d);for(const f in this._updatedSources){const _=this._updatedSources[f];if(_==="reload")this._reloadSource(f);else{if(_!=="clear")throw new Error(`Invalid action ${_}`);this._clearSource(f)}}this._updateTilesForChangedImages();for(const f in this._updatedPaintProps)this._layers[f].updateTransitions(t);this.light.updateTransitions(t),this._resetUpdates()}const s={};for(const u in this.sourceCaches){const d=this.sourceCaches[u];s[u]=d.used,d.used=!1}for(const u of this._order){const d=this._layers[u];d.recalculate(t,this._availableImages),!d.isHidden(t.zoom)&&d.source&&(this.sourceCaches[d.source].used=!0)}for(const u in s){const d=this.sourceCaches[u];s[u]!==d.used&&d.fire(new l.Event("data",{sourceDataType:"visibility",dataType:"source",sourceId:u}))}this.light.recalculate(t),this.z=t.zoom,n&&this.fire(new l.Event("data",{dataType:"style"}))}_updateTilesForChangedImages(){const t=Object.keys(this._changedImages);if(t.length){for(const n in this.sourceCaches)this.sourceCaches[n].reloadTilesForDependencies(["icons","patterns"],t);this._changedImages={}}}_updateWorkerLayers(t,n){this.dispatcher.broadcast("updateLayers",{layers:this._serializeLayers(t),removedIds:n})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={}}setTerrain(t){if(this._checkLoaded(),this._terrainDataCallback&&this.off("data",this._terrainDataCallback),this._terrainfreezeElevationCallback&&this.map.off("freezeElevation",this._terrainfreezeElevationCallback),t){const n=this.sourceCaches[t.source];if(!n)throw new Error(`cannot load terrain, because there exists no source with ID: ${t.source}`);this.terrain=new tt(this,n,t),this.map.transform.updateElevation(this.terrain),this._terrainfreezeElevationCallback=s=>{s.freeze?this.map.transform.freezeElevation=!0:(this.map.transform.freezeElevation=!1,this.map.transform.recalculateZoom(this.terrain))},this._terrainDataCallback=s=>{s.tile&&(s.sourceId===t.source?(this.map.transform.updateElevation(this.terrain),this.terrain.rememberForRerender(s.sourceId,s.tile.tileID)):s.source.type==="geojson"&&this.terrain.rememberForRerender(s.sourceId,s.tile.tileID))},this.on("data",this._terrainDataCallback),this.map.on("freezeElevation",this._terrainfreezeElevationCallback)}else this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.map.transform.updateElevation(this.terrain);this.map.fire(new l.Event("terrain",{terrain:t}))}setState(t){if(this._checkLoaded(),ft(this,l.validateStyle(t)))return!1;(t=l.clone$1(t)).layers=Nn(t.layers);const n=function(u,d){if(!u)return[{command:ht.setStyle,args:[d]}];let f=[];try{if(!Te(u.version,d.version))return[{command:ht.setStyle,args:[d]}];Te(u.center,d.center)||f.push({command:ht.setCenter,args:[d.center]}),Te(u.zoom,d.zoom)||f.push({command:ht.setZoom,args:[d.zoom]}),Te(u.bearing,d.bearing)||f.push({command:ht.setBearing,args:[d.bearing]}),Te(u.pitch,d.pitch)||f.push({command:ht.setPitch,args:[d.pitch]}),Te(u.sprite,d.sprite)||f.push({command:ht.setSprite,args:[d.sprite]}),Te(u.glyphs,d.glyphs)||f.push({command:ht.setGlyphs,args:[d.glyphs]}),Te(u.transition,d.transition)||f.push({command:ht.setTransition,args:[d.transition]}),Te(u.light,d.light)||f.push({command:ht.setLight,args:[d.light]});const _={},y=[];(function(T,I,C,F){let R;for(R in I=I||{},T=T||{})Object.prototype.hasOwnProperty.call(T,R)&&(Object.prototype.hasOwnProperty.call(I,R)||zr(R,C,F));for(R in I)Object.prototype.hasOwnProperty.call(I,R)&&(Object.prototype.hasOwnProperty.call(T,R)?Te(T[R],I[R])||(T[R].type==="geojson"&&I[R].type==="geojson"&&Gn(T,I,R)?C.push({command:ht.setGeoJSONSourceData,args:[R,I[R].data]}):Pr(R,I,C,F)):er(R,I,C))})(u.sources,d.sources,y,_);const v=[];u.layers&&u.layers.forEach(T=>{_[T.source]?f.push({command:ht.removeLayer,args:[T.id]}):v.push(T)}),f=f.concat(y),function(T,I,C){I=I||[];const F=(T=T||[]).map(fr),R=I.map(fr),B=T.reduce(_n,{}),X=I.reduce(_n,{}),J=F.slice(),te=Object.create(null);let O,ne,ie,ue,he,ye,ce;for(O=0,ne=0;O<F.length;O++)ie=F[O],Object.prototype.hasOwnProperty.call(X,ie)?ne++:(C.push({command:ht.removeLayer,args:[ie]}),J.splice(J.indexOf(ie,ne),1));for(O=0,ne=0;O<R.length;O++)ie=R[R.length-1-O],J[J.length-1-O]!==ie&&(Object.prototype.hasOwnProperty.call(B,ie)?(C.push({command:ht.removeLayer,args:[ie]}),J.splice(J.lastIndexOf(ie,J.length-ne),1)):ne++,ye=J[J.length-O],C.push({command:ht.addLayer,args:[X[ie],ye]}),J.splice(J.length-O,0,ie),te[ie]=!0);for(O=0;O<R.length;O++)if(ie=R[O],ue=B[ie],he=X[ie],!te[ie]&&!Te(ue,he))if(Te(ue.source,he.source)&&Te(ue["source-layer"],he["source-layer"])&&Te(ue.type,he.type)){for(ce in pr(ue.layout,he.layout,C,ie,null,ht.setLayoutProperty),pr(ue.paint,he.paint,C,ie,null,ht.setPaintProperty),Te(ue.filter,he.filter)||C.push({command:ht.setFilter,args:[ie,he.filter]}),Te(ue.minzoom,he.minzoom)&&Te(ue.maxzoom,he.maxzoom)||C.push({command:ht.setLayerZoomRange,args:[ie,he.minzoom,he.maxzoom]}),ue)Object.prototype.hasOwnProperty.call(ue,ce)&&ce!=="layout"&&ce!=="paint"&&ce!=="filter"&&ce!=="metadata"&&ce!=="minzoom"&&ce!=="maxzoom"&&(ce.indexOf("paint.")===0?pr(ue[ce],he[ce],C,ie,ce.slice(6),ht.setPaintProperty):Te(ue[ce],he[ce])||C.push({command:ht.setLayerProperty,args:[ie,ce,he[ce]]}));for(ce in he)Object.prototype.hasOwnProperty.call(he,ce)&&!Object.prototype.hasOwnProperty.call(ue,ce)&&ce!=="layout"&&ce!=="paint"&&ce!=="filter"&&ce!=="metadata"&&ce!=="minzoom"&&ce!=="maxzoom"&&(ce.indexOf("paint.")===0?pr(ue[ce],he[ce],C,ie,ce.slice(6),ht.setPaintProperty):Te(ue[ce],he[ce])||C.push({command:ht.setLayerProperty,args:[ie,ce,he[ce]]}))}else C.push({command:ht.removeLayer,args:[ie]}),ye=J[J.lastIndexOf(ie)+1],C.push({command:ht.addLayer,args:[he,ye]})}(v,d.layers,f)}catch(_){console.warn("Unable to compute style diff:",_),f=[{command:ht.setStyle,args:[d]}]}return f}(this.serialize(),t).filter(u=>!(u.command in Qt));if(n.length===0)return!1;const s=n.filter(u=>!(u.command in St));if(s.length>0)throw new Error(`Unimplemented: ${s.map(u=>u.command).join(", ")}.`);return n.forEach(u=>{u.command!=="setTransition"&&this[u.command].apply(this,u.args)}),this.stylesheet=t,!0}addImage(t,n){if(this.getImage(t))return this.fire(new l.ErrorEvent(new Error(`An image named "${t}" already exists.`)));this.imageManager.addImage(t,n),this._afterImageUpdated(t)}updateImage(t,n){this.imageManager.updateImage(t,n)}getImage(t){return this.imageManager.getImage(t)}removeImage(t){if(!this.getImage(t))return this.fire(new l.ErrorEvent(new Error(`An image named "${t}" does not exist.`)));this.imageManager.removeImage(t),this._afterImageUpdated(t)}_afterImageUpdated(t){this._availableImages=this.imageManager.listImages(),this._changedImages[t]=!0,this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new l.Event("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(t,n,s={}){if(this._checkLoaded(),this.sourceCaches[t]!==void 0)throw new Error(`Source "${t}" already exists.`);if(!n.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(n).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(n.type)>=0&&this._validate(l.validateStyle.source,`sources.${t}`,n,null,s))return;this.map&&this.map._collectResourceTiming&&(n.collectResourceTiming=!0);const u=this.sourceCaches[t]=new yi(t,n,this.dispatcher);u.style=this,u.setEventedParent(this,()=>({isSourceLoaded:this.loaded(),source:u.serialize(),sourceId:t})),u.onAdd(this.map),this._changed=!0}removeSource(t){if(this._checkLoaded(),this.sourceCaches[t]===void 0)throw new Error("There is no source with this ID");for(const s in this._layers)if(this._layers[s].source===t)return this.fire(new l.ErrorEvent(new Error(`Source "${t}" cannot be removed while layer "${s}" is using it.`)));const n=this.sourceCaches[t];delete this.sourceCaches[t],delete this._updatedSources[t],n.fire(new l.Event("data",{sourceDataType:"metadata",dataType:"source",sourceId:t})),n.setEventedParent(null),n.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(t,n){if(this._checkLoaded(),this.sourceCaches[t]===void 0)throw new Error(`There is no source with this ID=${t}`);const s=this.sourceCaches[t].getSource();if(s.type!=="geojson")throw new Error(`geojsonSource.type is ${s.type}, which is !== 'geojson`);s.setData(n),this._changed=!0}getSource(t){return this.sourceCaches[t]&&this.sourceCaches[t].getSource()}addLayer(t,n,s={}){this._checkLoaded();const u=t.id;if(this.getLayer(u))return void this.fire(new l.ErrorEvent(new Error(`Layer "${u}" already exists on this map.`)));let d;if(t.type==="custom"){if(ft(this,l.validateCustomStyleLayer(t)))return;d=l.createStyleLayer(t)}else{if(typeof t.source=="object"&&(this.addSource(u,t.source),t=l.clone$1(t),t=l.extend(t,{source:u})),this._validate(l.validateStyle.layer,`layers.${u}`,t,{arrayIndex:-1},s))return;d=l.createStyleLayer(t),this._validateLayer(d),d.setEventedParent(this,{layer:{id:u}}),this._serializedLayers[d.id]=d.serialize()}const f=n?this._order.indexOf(n):this._order.length;if(n&&f===-1)this.fire(new l.ErrorEvent(new Error(`Cannot add layer "${u}" before non-existing layer "${n}".`)));else{if(this._order.splice(f,0,u),this._layerOrderChanged=!0,this._layers[u]=d,this._removedLayers[u]&&d.source&&d.type!=="custom"){const _=this._removedLayers[u];delete this._removedLayers[u],_.type!==d.type?this._updatedSources[d.source]="clear":(this._updatedSources[d.source]="reload",this.sourceCaches[d.source].pause())}this._updateLayer(d),d.onAdd&&d.onAdd(this.map)}}moveLayer(t,n){if(this._checkLoaded(),this._changed=!0,!this._layers[t])return void this.fire(new l.ErrorEvent(new Error(`The layer '${t}' does not exist in the map's style and cannot be moved.`)));if(t===n)return;const s=this._order.indexOf(t);this._order.splice(s,1);const u=n?this._order.indexOf(n):this._order.length;n&&u===-1?this.fire(new l.ErrorEvent(new Error(`Cannot move layer "${t}" before non-existing layer "${n}".`))):(this._order.splice(u,0,t),this._layerOrderChanged=!0)}removeLayer(t){this._checkLoaded();const n=this._layers[t];if(!n)return void this.fire(new l.ErrorEvent(new Error(`Cannot remove non-existing layer "${t}".`)));n.setEventedParent(null);const s=this._order.indexOf(t);this._order.splice(s,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[t]=n,delete this._layers[t],delete this._serializedLayers[t],delete this._updatedLayers[t],delete this._updatedPaintProps[t],n.onRemove&&n.onRemove(this.map)}getLayer(t){return this._layers[t]}hasLayer(t){return t in this._layers}setLayerZoomRange(t,n,s){this._checkLoaded();const u=this.getLayer(t);u?u.minzoom===n&&u.maxzoom===s||(n!=null&&(u.minzoom=n),s!=null&&(u.maxzoom=s),this._updateLayer(u)):this.fire(new l.ErrorEvent(new Error(`Cannot set the zoom range of non-existing layer "${t}".`)))}setFilter(t,n,s={}){this._checkLoaded();const u=this.getLayer(t);if(u){if(!Te(u.filter,n))return n==null?(u.filter=void 0,void this._updateLayer(u)):void(this._validate(l.validateStyle.filter,`layers.${u.id}.filter`,n,null,s)||(u.filter=l.clone$1(n),this._updateLayer(u)))}else this.fire(new l.ErrorEvent(new Error(`Cannot filter non-existing layer "${t}".`)))}getFilter(t){return l.clone$1(this.getLayer(t).filter)}setLayoutProperty(t,n,s,u={}){this._checkLoaded();const d=this.getLayer(t);d?Te(d.getLayoutProperty(n),s)||(d.setLayoutProperty(n,s,u),this._updateLayer(d)):this.fire(new l.ErrorEvent(new Error(`Cannot style non-existing layer "${t}".`)))}getLayoutProperty(t,n){const s=this.getLayer(t);if(s)return s.getLayoutProperty(n);this.fire(new l.ErrorEvent(new Error(`Cannot get style of non-existing layer "${t}".`)))}setPaintProperty(t,n,s,u={}){this._checkLoaded();const d=this.getLayer(t);d?Te(d.getPaintProperty(n),s)||(d.setPaintProperty(n,s,u)&&this._updateLayer(d),this._changed=!0,this._updatedPaintProps[t]=!0):this.fire(new l.ErrorEvent(new Error(`Cannot style non-existing layer "${t}".`)))}getPaintProperty(t,n){return this.getLayer(t).getPaintProperty(n)}setFeatureState(t,n){this._checkLoaded();const s=t.source,u=t.sourceLayer,d=this.sourceCaches[s];if(d===void 0)return void this.fire(new l.ErrorEvent(new Error(`The source '${s}' does not exist in the map's style.`)));const f=d.getSource().type;f==="geojson"&&u?this.fire(new l.ErrorEvent(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):f!=="vector"||u?(t.id===void 0&&this.fire(new l.ErrorEvent(new Error("The feature id parameter must be provided."))),d.setFeatureState(u,t.id,n)):this.fire(new l.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(t,n){this._checkLoaded();const s=t.source,u=this.sourceCaches[s];if(u===void 0)return void this.fire(new l.ErrorEvent(new Error(`The source '${s}' does not exist in the map's style.`)));const d=u.getSource().type,f=d==="vector"?t.sourceLayer:void 0;d!=="vector"||f?n&&typeof t.id!="string"&&typeof t.id!="number"?this.fire(new l.ErrorEvent(new Error("A feature id is required to remove its specific state property."))):u.removeFeatureState(f,t.id,n):this.fire(new l.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(t){this._checkLoaded();const n=t.source,s=t.sourceLayer,u=this.sourceCaches[n];if(u!==void 0)return u.getSource().type!=="vector"||s?(t.id===void 0&&this.fire(new l.ErrorEvent(new Error("The feature id parameter must be provided."))),u.getFeatureState(s,t.id)):void this.fire(new l.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new l.ErrorEvent(new Error(`The source '${n}' does not exist in the map's style.`)))}getTransition(){return l.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){return l.filterObject({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,light:this.stylesheet.light,center:this.stylesheet.center,zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,sources:l.mapObject(this.sourceCaches,t=>t.serialize()),layers:this._serializeLayers(this._order)},t=>t!==void 0)}_updateLayer(t){this._updatedLayers[t.id]=!0,t.source&&!this._updatedSources[t.source]&&this.sourceCaches[t.source].getSource().type!=="raster"&&(this._updatedSources[t.source]="reload",this.sourceCaches[t.source].pause()),this._changed=!0}_flattenAndSortRenderedFeatures(t){const n=f=>this._layers[f].type==="fill-extrusion",s={},u=[];for(let f=this._order.length-1;f>=0;f--){const _=this._order[f];if(n(_)){s[_]=f;for(const y of t){const v=y[_];if(v)for(const T of v)u.push(T)}}}u.sort((f,_)=>_.intersectionZ-f.intersectionZ);const d=[];for(let f=this._order.length-1;f>=0;f--){const _=this._order[f];if(n(_))for(let y=u.length-1;y>=0;y--){const v=u[y].feature;if(s[v.layer.id]<f)break;d.push(v),u.pop()}else for(const y of t){const v=y[_];if(v)for(const T of v)d.push(T.feature)}}return d}queryRenderedFeatures(t,n,s){n&&n.filter&&this._validate(l.validateStyle.filter,"queryRenderedFeatures.filter",n.filter,null,n);const u={};if(n&&n.layers){if(!Array.isArray(n.layers))return this.fire(new l.ErrorEvent(new Error("parameters.layers must be an Array."))),[];for(const f of n.layers){const _=this._layers[f];if(!_)return this.fire(new l.ErrorEvent(new Error(`The layer '${f}' does not exist in the map's style and cannot be queried for features.`))),[];u[_.source]=!0}}const d=[];n.availableImages=this._availableImages;for(const f in this.sourceCaches)n.layers&&!u[f]||d.push(pn(this.sourceCaches[f],this._layers,this._serializedLayers,t,n,s));return this.placement&&d.push(function(f,_,y,v,T,I,C){const F={},R=I.queryRenderedSymbols(v),B=[];for(const X of Object.keys(R).map(Number))B.push(C[X]);B.sort(Qi);for(const X of B){const J=X.featureIndex.lookupSymbolFeatures(R[X.bucketInstanceId],_,X.bucketIndex,X.sourceLayerIndex,T.filter,T.layers,T.availableImages,f);for(const te in J){const O=F[te]=F[te]||[],ne=J[te];ne.sort((ie,ue)=>{const he=X.featureSortOrder;if(he){const ye=he.indexOf(ie.featureIndex);return he.indexOf(ue.featureIndex)-ye}return ue.featureIndex-ie.featureIndex});for(const ie of ne)O.push(ie)}}for(const X in F)F[X].forEach(J=>{const te=J.feature,O=y[f[X].source].getFeatureState(te.layer["source-layer"],te.id);te.source=te.layer.source,te.layer["source-layer"]&&(te.sourceLayer=te.layer["source-layer"]),te.state=O});return F}(this._layers,this._serializedLayers,this.sourceCaches,t,n,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(d)}querySourceFeatures(t,n){n&&n.filter&&this._validate(l.validateStyle.filter,"querySourceFeatures.filter",n.filter,null,n);const s=this.sourceCaches[t];return s?function(u,d){const f=u.getRenderableIds().map(v=>u.getTileByID(v)),_=[],y={};for(let v=0;v<f.length;v++){const T=f[v],I=T.tileID.canonical.key;y[I]||(y[I]=!0,T.querySourceFeatures(_,d))}return _}(s,n):[]}addSourceType(t,n,s){return li.getSourceType(t)?s(new Error(`A source type called "${t}" already exists.`)):(li.setSourceType(t,n),n.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:t,url:n.workerSourceURL},s):s(null,null))}getLight(){return this.light.getLight()}setLight(t,n={}){this._checkLoaded();const s=this.light.getLight();let u=!1;for(const f in t)if(!Te(t[f],s[f])){u=!0;break}if(!u)return;const d={now:l.exported.now(),transition:l.extend({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(t,n),this.light.updateTransitions(d)}_validate(t,n,s,u,d={}){return(!d||d.validate!==!1)&&ft(this,t.call(l.validateStyle,l.extend({key:n,style:this.serialize(),value:s,styleSpec:l.spec},u)))}_remove(){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),l.evented.off("pluginStateChange",this._rtlTextPluginCallback);for(const t in this._layers)this._layers[t].setEventedParent(null);for(const t in this.sourceCaches){const n=this.sourceCaches[t];n.setEventedParent(null),n.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),this.dispatcher.remove()}_clearSource(t){this.sourceCaches[t].clearTiles()}_reloadSource(t){this.sourceCaches[t].resume(),this.sourceCaches[t].reload()}_updateSources(t){for(const n in this.sourceCaches)this.sourceCaches[n].update(t,this.terrain)}_generateCollisionBoxes(){for(const t in this.sourceCaches)this._reloadSource(t)}_updatePlacement(t,n,s,u,d=!1){let f=!1,_=!1;const y={};for(const v of this._order){const T=this._layers[v];if(T.type!=="symbol")continue;if(!y[T.source]){const C=this.sourceCaches[T.source];y[T.source]=C.getRenderableIds(!0).map(F=>C.getTileByID(F)).sort((F,R)=>R.tileID.overscaledZ-F.tileID.overscaledZ||(F.tileID.isLessThan(R.tileID)?-1:1))}const I=this.crossTileSymbolIndex.addLayer(T,y[T.source],t.center.lng);f=f||I}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((d=d||this._layerOrderChanged||s===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(l.exported.now(),t.zoom))&&(this.pauseablePlacement=new ae(t,this.terrain,this._order,d,n,s,u,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,y),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(l.exported.now()),_=!0),f&&this.pauseablePlacement.placement.setStale()),_||f)for(const v of this._order){const T=this._layers[v];T.type==="symbol"&&this.placement.updateLayerOpacities(T,y[T.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(l.exported.now())}_releaseSymbolFadeTiles(){for(const t in this.sourceCaches)this.sourceCaches[t].releaseSymbolFadeTiles()}getImages(t,n,s){this.imageManager.getImages(n.icons,s),this._updateTilesForChangedImages();const u=this.sourceCaches[n.source];u&&u.setDependencies(n.tileID.key,n.type,n.icons)}getGlyphs(t,n,s){this.glyphManager.getGlyphs(n.stacks,s)}getResource(t,n,s){return l.makeRequest(n,s)}}li.getSourceType=function(a){return hn[a]},li.setSourceType=function(a,t){hn[a]=t},li.registerForPluginStateChange=l.registerForPluginStateChange;var bn="attribute vec2 a_pos;uniform mat4 u_matrix;varying vec2 v_texture_pos;varying float v_depth;void main() {v_texture_pos=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos,get_elevation(a_pos),1.0);v_depth=gl_Position.z/gl_Position.w;}";const qn={prelude:It(`#ifdef GL_ES
|
|
1
|
+
import{r as ge,_ as _d,j as Bi,x as bc,y as yd,R as lt,Y as xd,$ as vd,s as es,m as sh,C as vo,z as bd,a as wd,A as Ju,e as Td,H as Ed,I as Yu}from"./index.9af49ac7.js";import{u as ah}from"./useQuery.83f2b67b.js";const Sd=ge.exports.createContext(null);function Id(P){const $=P.clone();return $.pixelsToGLUnits=P.pixelsToGLUnits,$}function Qu(P){return{longitude:P.center.lng,latitude:P.center.lat,zoom:P.zoom,pitch:P.pitch,bearing:P.bearing,padding:P.padding}}function eh(P,$){const N=$.viewState||$;let W=!1;if("longitude"in N&&"latitude"in N){const j=P.center;P.center=new j.constructor(N.longitude,N.latitude),W=W||j!==P.center}if("zoom"in N){const j=P.zoom;P.zoom=N.zoom,W=W||j!==P.zoom}if("bearing"in N){const j=P.bearing;P.bearing=N.bearing,W=W||j!==P.bearing}if("pitch"in N){const j=P.pitch;P.pitch=N.pitch,W=W||j!==P.pitch}return N.padding&&!P.isPaddingEqual(N.padding)&&(W=!0,P.padding=N.padding),W}const Ad=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function th(P){if(!P)return null;if(typeof P=="string"||("toJS"in P&&(P=P.toJS()),!P.layers))return P;const $={};for(const W of P.layers)$[W.id]=W;const N=P.layers.map(W=>{const j=$[W.ref];let Q=null;if("interactive"in W&&(Q={...W},delete Q.interactive),j){Q=Q||{...W},delete Q.ref;for(const xe of Ad)xe in j&&(Q[xe]=j[xe])}return Q||W});return{...P,layers:N}}function Cd(P,$){const N=Array.isArray(P)?P[0]:P?P.x:0,W=Array.isArray(P)?P[1]:P?P.y:0,j=Array.isArray($)?$[0]:$?$.x:0,Q=Array.isArray($)?$[1]:$?$.y:0;return N===j&&W===Q}function Un(P,$){if(P===$)return!0;if(!P||!$)return!1;if(Array.isArray(P)){if(!Array.isArray($)||P.length!==$.length)return!1;for(let N=0;N<P.length;N++)if(!Un(P[N],$[N]))return!1;return!0}else if(Array.isArray($))return!1;if(typeof P=="object"&&typeof $=="object"){const N=Object.keys(P),W=Object.keys($);if(N.length!==W.length)return!1;for(const j of N)if(!$.hasOwnProperty(j)||!Un(P[j],$[j]))return!1;return!0}return!1}const ih={mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",click:"onClick",dblclick:"onDblClick",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",mouseout:"onMouseOut",contextmenu:"onContextMenu",touchstart:"onTouchStart",touchend:"onTouchEnd",touchmove:"onTouchMove",touchcancel:"onTouchCancel"},yc={movestart:"onMoveStart",move:"onMove",moveend:"onMoveEnd",dragstart:"onDragStart",drag:"onDrag",dragend:"onDragEnd",zoomstart:"onZoomStart",zoom:"onZoom",zoomend:"onZoomEnd",rotatestart:"onRotateStart",rotate:"onRotate",rotateend:"onRotateEnd",pitchstart:"onPitchStart",pitch:"onPitch",pitchend:"onPitchEnd"},rh={wheel:"onWheel",boxzoomstart:"onBoxZoomStart",boxzoomend:"onBoxZoomEnd",boxzoomcancel:"onBoxZoomCancel",resize:"onResize",load:"onLoad",render:"onRender",idle:"onIdle",remove:"onRemove",data:"onData",styledata:"onStyleData",sourcedata:"onSourceData",error:"onError"},Md=["minZoom","maxZoom","minPitch","maxPitch","maxBounds","projection","renderWorldCopies"],zd=["scrollZoom","boxZoom","dragRotate","dragPan","keyboard","doubleClickZoom","touchZoomRotate","touchPitch"];class Qo{constructor($,N,W){this._map=null,this._internalUpdate=!1,this._inRender=!1,this._hoveredFeatures=null,this._deferredEvents={move:!1,zoom:!1,pitch:!1,rotate:!1},this._onEvent=j=>{const Q=this.props[rh[j.type]];Q&&Q(j)},this._onPointerEvent=j=>{(j.type==="mousemove"||j.type==="mouseout")&&this._updateHover(j);const Q=this.props[ih[j.type]];if(Q){if(this.props.interactiveLayerIds&&j.type!=="mouseover"&&j.type!=="mouseout"){const xe=this._hoveredFeatures||this._map.queryRenderedFeatures(j.point,{layers:this.props.interactiveLayerIds});j.features=xe}Q(j),delete j.features}},this._onCameraEvent=j=>{if(!this._internalUpdate){const Q=this.props[yc[j.type]];Q&&Q(j)}j.type in this._deferredEvents&&(this._deferredEvents[j.type]=!1)},this._MapClass=$,this.props=N,this._initialize(W)}get map(){return this._map}get transform(){return this._renderTransform}setProps($){const N=this.props;this.props=$;const W=this._updateSettings($,N);W&&this._createShadowTransform(this._map);const j=this._updateSize($),Q=this._updateViewState($,!0);this._updateStyle($,N),this._updateStyleComponents($,N),this._updateHandlers($,N),(W||j||Q&&!this._map.isMoving())&&this.redraw()}static reuse($,N){const W=Qo.savedMaps.pop();if(!W)return null;const j=W.map,Q=j.getContainer();for(N.className=Q.className;Q.childNodes.length>0;)N.appendChild(Q.childNodes[0]);j._container=N,W.setProps({...$,styleDiffing:!1}),j.resize();const{initialViewState:xe}=$;return xe&&(xe.bounds?j.fitBounds(xe.bounds,{...xe.fitBoundsOptions,duration:0}):W._updateViewState(xe,!1)),j.isStyleLoaded()?j.fire("load"):j.once("styledata",()=>j.fire("load")),W}_initialize($){const{props:N}=this,W={...N,...N.initialViewState,accessToken:N.mapboxAccessToken||Pd()||null,container:$,style:th(N.mapStyle)},j=W.initialViewState||W.viewState||W;if(Object.assign(W,{center:[j.longitude||0,j.latitude||0],zoom:j.zoom||0,pitch:j.pitch||0,bearing:j.bearing||0}),N.gl){const me=HTMLCanvasElement.prototype.getContext;HTMLCanvasElement.prototype.getContext=()=>(HTMLCanvasElement.prototype.getContext=me,N.gl)}const Q=new this._MapClass(W);j.padding&&Q.setPadding(j.padding),N.cursor&&(Q.getCanvas().style.cursor=N.cursor),this._createShadowTransform(Q);const xe=Q._render;Q._render=me=>{this._inRender=!0,xe.call(Q,me),this._inRender=!1};const l=Q._renderTaskQueue.run;Q._renderTaskQueue.run=me=>{l.call(Q._renderTaskQueue,me),this._onBeforeRepaint()},Q.on("render",()=>this._onAfterRepaint());const ve=Q.fire;Q.fire=this._fireEvent.bind(this,ve),Q.on("resize",()=>{this._renderTransform.resize(Q.transform.width,Q.transform.height)}),Q.on("styledata",()=>this._updateStyleComponents(this.props,{})),Q.on("sourcedata",()=>this._updateStyleComponents(this.props,{}));for(const me in ih)Q.on(me,this._onPointerEvent);for(const me in yc)Q.on(me,this._onCameraEvent);for(const me in rh)Q.on(me,this._onEvent);this._map=Q}recycle(){Qo.savedMaps.push(this)}destroy(){this._map.remove()}redraw(){const $=this._map;!this._inRender&&$.style&&($._frame&&($._frame.cancel(),$._frame=null),$._render())}_createShadowTransform($){const N=Id($.transform);$.painter.transform=N,this._renderTransform=N}_updateSize($){const{viewState:N}=$;if(N){const W=this._map;if(N.width!==W.transform.width||N.height!==W.transform.height)return W.resize(),!0}return!1}_updateViewState($,N){if(this._internalUpdate)return!1;const W=this._map,j=this._renderTransform,{zoom:Q,pitch:xe,bearing:l}=j,ve=W.isMoving();ve&&(j.cameraElevationReference="sea");const me=eh(j,{...Qu(W.transform),...$});if(ve&&(j.cameraElevationReference="ground"),me&&N){const Ee=this._deferredEvents;Ee.move=!0,Ee.zoom||(Ee.zoom=Q!==j.zoom),Ee.rotate||(Ee.rotate=l!==j.bearing),Ee.pitch||(Ee.pitch=xe!==j.pitch)}return ve||eh(W.transform,$),me}_updateSettings($,N){const W=this._map;let j=!1;for(const Q of Md)Q in $&&!Un($[Q],N[Q])&&(j=!0,W[`set${Q[0].toUpperCase()}${Q.slice(1)}`]($[Q]));return j}_updateStyle($,N){if($.cursor!==N.cursor&&(this._map.getCanvas().style.cursor=$.cursor),$.mapStyle!==N.mapStyle){const W={diff:$.styleDiffing};return"localIdeographFontFamily"in $&&(W.localIdeographFontFamily=$.localIdeographFontFamily),this._map.setStyle(th($.mapStyle),W),!0}return!1}_updateStyleComponents($,N){const W=this._map;let j=!1;return W.style.loaded()&&("light"in $&&!Un($.light,N.light)&&(j=!0,W.setLight($.light)),"fog"in $&&!Un($.fog,N.fog)&&(j=!0,W.setFog($.fog)),"terrain"in $&&!Un($.terrain,N.terrain)&&(!$.terrain||W.getSource($.terrain.source))&&(j=!0,W.setTerrain($.terrain))),j}_updateHandlers($,N){const W=this._map;let j=!1;for(const Q of zd){const xe=$[Q];Un(xe,N[Q])||(j=!0,xe?W[Q].enable(xe):W[Q].disable())}return j}_updateHover($){var N;const{props:W}=this;if(W.interactiveLayerIds&&(W.onMouseMove||W.onMouseEnter||W.onMouseLeave)){const Q=$.type,xe=((N=this._hoveredFeatures)===null||N===void 0?void 0:N.length)>0;let l;if(Q==="mousemove")try{l=this._map.queryRenderedFeatures($.point,{layers:W.interactiveLayerIds})}catch(me){l=[]}else l=[];const ve=l.length>0;!ve&&xe&&($.type="mouseleave",this._onPointerEvent($)),this._hoveredFeatures=l,ve&&!xe&&($.type="mouseenter",this._onPointerEvent($)),$.type=Q}else this._hoveredFeatures=null}_fireEvent($,N,W){const j=this._map,Q=j.transform,xe=typeof N=="string"?N:N.type;return xe==="move"&&this._updateViewState(this.props,!1),xe in yc&&(typeof N=="object"&&(N.viewState=Qu(Q)),this._map.isMoving())?(j.transform=this._renderTransform,$.call(j,N,W),j.transform=Q,j):($.call(j,N,W),j)}_onBeforeRepaint(){const $=this._map;this._internalUpdate=!0;for(const W in this._deferredEvents)this._deferredEvents[W]&&$.fire(W);this._internalUpdate=!1;const N=this._map.transform;this._map.transform=this._renderTransform,this._onAfterRepaint=()=>{this._map.transform=N}}}Qo.savedMaps=[];function Pd(){let P=null;if(typeof location<"u"){const $=/access_token=([^&\/]*)/.exec(location.search);P=$&&$[1]}try{P=P||process.env.MapboxAccessToken}catch($){}try{P=P||process.env.REACT_APP_MAPBOX_ACCESS_TOKEN}catch($){}return P}const kd=["setMaxBounds","setMinZoom","setMaxZoom","setMinPitch","setMaxPitch","setRenderWorldCopies","setProjection","setStyle","addSource","removeSource","addLayer","removeLayer","setLayerZoomRange","setFilter","setPaintProperty","setLayoutProperty","setLight","setTerrain","setFog","remove"];function Dd(P,$){if(!P)return null;const N=P.map,W={getMap:()=>N,getCenter:()=>P.transform.center,getZoom:()=>P.transform.zoom,getBearing:()=>P.transform.bearing,getPitch:()=>P.transform.pitch,getPadding:()=>P.transform.padding,getBounds:()=>P.transform.getBounds(),project:j=>P.transform.locationPoint($.LngLat.convert(j)),unproject:j=>P.transform.pointLocation($.Point.convert(j)),queryTerrainElevation:(j,Q)=>{const xe=N.transform;N.transform=P.transform;const l=N.queryTerrainElevation(j,Q);return N.transform=xe,l}};for(const j of Ld(N))!(j in W)&&!kd.includes(j)&&(W[j]=N[j].bind(N));return W}function Ld(P){const $=new Set;let N=P;for(;N;){for(const W of Object.getOwnPropertyNames(N))W[0]!=="_"&&typeof P[W]=="function"&&W!=="fire"&&W!=="setEventedParent"&&$.add(W);N=Object.getPrototypeOf(N)}return Array.from($)}const Rd=typeof document<"u"?ge.exports.useLayoutEffect:ge.exports.useEffect,Bd=["baseApiUrl","maxParallelImageRequests","workerClass","workerCount","workerUrl"];function Fd(P,$){for(const N of Bd)N in $&&(P[N]=$[N]);$.RTLTextPlugin&&P.getRTLTextPluginStatus&&P.getRTLTextPluginStatus()==="unavailable"&&P.setRTLTextPlugin($.RTLTextPlugin,N=>{N&&console.error(N)},!1)}const pl=ge.exports.createContext(null),Od={minZoom:0,maxZoom:22,minPitch:0,maxPitch:60,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,mapStyle:{version:8,sources:{},layers:[]},styleDiffing:!0,projection:"mercator",renderWorldCopies:!0,onError:P=>console.error(P.error),RTLTextPlugin:"https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.2.3/mapbox-gl-rtl-text.js"},lh=ge.exports.forwardRef((P,$)=>{const N=ge.exports.useContext(Sd),[W,j]=ge.exports.useState(null),Q=ge.exports.useRef(),{current:xe}=ge.exports.useRef({mapLib:null,map:null});ge.exports.useEffect(()=>{const ve=P.mapLib;let me=!0,Ee;return Promise.resolve(ve||_d(()=>import("./index.b70ba4b0.js").then(Te=>Te.i),[])).then(Te=>{if(!!me){if(Te.Map||(Te=Te.default),!Te||!Te.Map)throw new Error("Invalid mapLib");if(Te.supported(P))Fd(Te,P),P.reuseMaps&&(Ee=Qo.reuse(P,Q.current)),Ee||(Ee=new Qo(Te.Map,P,Q.current)),xe.map=Dd(Ee,Te),xe.mapLib=Te,j(Ee),N==null||N.onMapMount(xe.map,P.id);else throw new Error("Map is not supported by this browser")}}).catch(Te=>{P.onError({type:"error",target:null,originalEvent:null,error:Te})}),()=>{me=!1,Ee&&(N==null||N.onMapUnmount(P.id),P.reuseMaps?Ee.recycle():Ee.destroy())}},[]),Rd(()=>{W&&W.setProps(P)}),ge.exports.useImperativeHandle($,()=>xe.map,[W]);const l=ge.exports.useMemo(()=>({position:"relative",width:"100%",height:"100%",...P.style}),[P.style]);return Bi("div",{id:P.id,ref:Q,style:l,children:W&&Bi(pl.Provider,{value:xe,children:P.children})})});lh.displayName="Map";lh.defaultProps=Od;const Ud=/box|flex|grid|column|lineHeight|fontWeight|opacity|order|tabSize|zIndex/;function bo(P,$){if(!P||!$)return;const N=P.style;for(const W in $){const j=$[W];Number.isFinite(j)&&!Ud.test(W)?N[W]=`${j}px`:N[W]=j}}const $d={draggable:!1,popup:null,rotation:0,rotationAlignment:"auto",pitchAlignment:"auto"};function ch(P){const{map:$,mapLib:N}=ge.exports.useContext(pl),W=ge.exports.useRef({props:P});W.current.props=P;const j=ge.exports.useMemo(()=>{let Q=!1;ge.exports.Children.forEach(P.children,ve=>{ve&&(Q=!0)});const xe={...P,element:Q?document.createElement("div"):null},l=new N.Marker(xe).setLngLat([P.longitude,P.latitude]);return l.getElement().addEventListener("click",ve=>{var me,Ee;(Ee=(me=W.current.props).onClick)===null||Ee===void 0||Ee.call(me,{type:"click",target:l,originalEvent:ve})}),l.on("dragstart",ve=>{var me,Ee;const Te=ve;Te.lngLat=j.getLngLat(),(Ee=(me=W.current.props).onDragStart)===null||Ee===void 0||Ee.call(me,Te)}),l.on("drag",ve=>{var me,Ee;const Te=ve;Te.lngLat=j.getLngLat(),(Ee=(me=W.current.props).onDrag)===null||Ee===void 0||Ee.call(me,Te)}),l.on("dragend",ve=>{var me,Ee;const Te=ve;Te.lngLat=j.getLngLat(),(Ee=(me=W.current.props).onDragEnd)===null||Ee===void 0||Ee.call(me,Te)}),l},[]);return ge.exports.useEffect(()=>(j.addTo($.getMap()),()=>{j.remove()}),[]),ge.exports.useEffect(()=>{bo(j.getElement(),P.style)},[P.style]),(j.getLngLat().lng!==P.longitude||j.getLngLat().lat!==P.latitude)&&j.setLngLat([P.longitude,P.latitude]),P.offset&&!Cd(j.getOffset(),P.offset)&&j.setOffset(P.offset),j.isDraggable()!==P.draggable&&j.setDraggable(P.draggable),j.getRotation()!==P.rotation&&j.setRotation(P.rotation),j.getRotationAlignment()!==P.rotationAlignment&&j.setRotationAlignment(P.rotationAlignment),j.getPitchAlignment()!==P.pitchAlignment&&j.setPitchAlignment(P.pitchAlignment),j.getPopup()!==P.popup&&j.setPopup(P.popup),bc.exports.createPortal(P.children,j.getElement())}ch.defaultProps=$d;const Vd=ge.exports.memo(ch);function nh(P){return new Set(P?P.trim().split(/\s+/):[])}function Nd(P){const{map:$,mapLib:N}=ge.exports.useContext(pl),W=ge.exports.useMemo(()=>document.createElement("div"),[]),j=ge.exports.useRef({props:P});j.current.props=P;const Q=ge.exports.useMemo(()=>{const xe={...P},l=new N.Popup(xe).setLngLat([P.longitude,P.latitude]);return l.once("open",ve=>{var me,Ee;(Ee=(me=j.current.props).onOpen)===null||Ee===void 0||Ee.call(me,ve)}),l},[]);if(ge.exports.useEffect(()=>{const xe=l=>{var ve,me;(me=(ve=j.current.props).onClose)===null||me===void 0||me.call(ve,l)};return Q.on("close",xe),Q.setDOMContent(W).addTo($.getMap()),()=>{Q.off("close",xe),Q.isOpen()&&Q.remove()}},[]),ge.exports.useEffect(()=>{bo(Q.getElement(),P.style)},[P.style]),Q.isOpen()&&((Q.getLngLat().lng!==P.longitude||Q.getLngLat().lat!==P.latitude)&&Q.setLngLat([P.longitude,P.latitude]),P.offset&&!Un(Q.options.offset,P.offset)&&Q.setOffset(P.offset),(Q.options.anchor!==P.anchor||Q.options.maxWidth!==P.maxWidth)&&(Q.options.anchor=P.anchor,Q.setMaxWidth(P.maxWidth)),Q.options.className!==P.className)){const xe=nh(Q.options.className),l=nh(P.className);for(const ve of xe)l.has(ve)||Q.removeClassName(ve);for(const ve of l)xe.has(ve)||Q.addClassName(ve);Q.options.className=P.className}return bc.exports.createPortal(P.children,W)}ge.exports.memo(Nd);function Qs(P,$,N,W){const j=ge.exports.useContext(pl),Q=ge.exports.useMemo(()=>P(j),[]);return ge.exports.useEffect(()=>{const xe=W||N||$,l=typeof $=="function"&&typeof N=="function"?$:null,ve=typeof N=="function"?N:typeof $=="function"?$:null,{map:me}=j;return me.hasControl(Q)||(me.addControl(Q,xe==null?void 0:xe.position),l&&l(j)),()=>{ve&&ve(j),me.hasControl(Q)&&me.removeControl(Q)}},[]),Q}function Gd(P){const $=Qs(({mapLib:N})=>new N.AttributionControl(P),{position:P.position});return ge.exports.useEffect(()=>{bo($._container,P.style)},[P.style]),null}const Wf=ge.exports.memo(Gd);function qd(P){const $=Qs(({mapLib:N})=>new N.FullscreenControl({container:P.containerId&&document.getElementById(P.containerId)}),{position:P.position});return ge.exports.useEffect(()=>{bo($._controlContainer,P.style)},[P.style]),null}ge.exports.memo(qd);const uh=ge.exports.forwardRef((P,$)=>{const N=ge.exports.useRef({props:P}),W=Qs(({mapLib:j})=>{const Q=new j.GeolocateControl(P),xe=Q._setupUI;return Q._setupUI=l=>{Q._container.hasChildNodes()||xe(l)},Q.on("geolocate",l=>{var ve,me;(me=(ve=N.current.props).onGeolocate)===null||me===void 0||me.call(ve,l)}),Q.on("error",l=>{var ve,me;(me=(ve=N.current.props).onError)===null||me===void 0||me.call(ve,l)}),Q.on("outofmaxbounds",l=>{var ve,me;(me=(ve=N.current.props).onOutOfMaxBounds)===null||me===void 0||me.call(ve,l)}),Q.on("trackuserlocationstart",l=>{var ve,me;(me=(ve=N.current.props).onTrackUserLocationStart)===null||me===void 0||me.call(ve,l)}),Q.on("trackuserlocationend",l=>{var ve,me;(me=(ve=N.current.props).onTrackUserLocationEnd)===null||me===void 0||me.call(ve,l)}),Q},{position:P.position});return N.current.props=P,ge.exports.useImperativeHandle($,()=>({trigger:()=>W.trigger()}),[]),ge.exports.useEffect(()=>{bo(W._container,P.style)},[P.style]),null});uh.displayName="GeolocateControl";ge.exports.memo(uh);function Zd(P){const $=Qs(({mapLib:N})=>new N.NavigationControl(P),{position:P.position});return ge.exports.useEffect(()=>{bo($._container,P.style)},[P.style]),null}const Hf=ge.exports.memo(Zd),jd={unit:"metric",maxWidth:100};function hh(P){const $=Qs(({mapLib:N})=>new N.ScaleControl(P),{position:P.position});return($.options.unit!==P.unit||$.options.maxWidth!==P.maxWidth)&&($.options.maxWidth=P.maxWidth,$.setUnit(P.unit)),ge.exports.useEffect(()=>{bo($._container,P.style)},[P.style]),null}hh.defaultProps=jd;ge.exports.memo(hh);var ph={exports:{}};(function(P,$){(function(N,W){P.exports=W()})(yd,function(){var N,W,j;function Q(l,ve){if(!N)N=ve;else if(!W)W=ve;else{var me="var sharedChunk = {}; ("+N+")(sharedChunk); ("+W+")(sharedChunk);",Ee={};N(Ee),j=ve(Ee),typeof window<"u"&&(j.workerUrl=window.URL.createObjectURL(new Blob([me],{type:"text/javascript"})))}}Q(["exports"],function(l){var ve=me;function me(i,e,r,o){this.cx=3*i,this.bx=3*(r-i)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(o-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=i,this.p1y=e,this.p2x=r,this.p2y=o}function Ee(i,e,r,o){const c=new ve(i,e,r,o);return function(h){return c.solve(h)}}me.prototype={sampleCurveX:function(i){return((this.ax*i+this.bx)*i+this.cx)*i},sampleCurveY:function(i){return((this.ay*i+this.by)*i+this.cy)*i},sampleCurveDerivativeX:function(i){return(3*this.ax*i+2*this.bx)*i+this.cx},solveCurveX:function(i,e){if(e===void 0&&(e=1e-6),i<0)return 0;if(i>1)return 1;for(var r=i,o=0;o<8;o++){var c=this.sampleCurveX(r)-i;if(Math.abs(c)<e)return r;var h=this.sampleCurveDerivativeX(r);if(Math.abs(h)<1e-6)break;r-=c/h}var d=0,m=1;for(r=i,o=0;o<20&&(c=this.sampleCurveX(r),!(Math.abs(c-i)<e));o++)i>c?d=r:m=r,r=.5*(m-d)+d;return r},solve:function(i,e){return this.sampleCurveY(this.solveCurveX(i,e))}};const Te=Ee(.25,.1,.25,1);function se(i,e,r){return Math.min(r,Math.max(e,i))}function gt(i,e,r){const o=r-e,c=((i-e)%o+o)%o+e;return c===e?r:c}function nt(i,...e){for(const r of e)for(const o in r)i[o]=r[o];return i}let He=1;function Ut(i,e){i.forEach(r=>{e[r]&&(e[r]=e[r].bind(e))})}function Mt(i,e,r){const o={};for(const c in i)o[c]=e.call(r||this,i[c],c,i);return o}function ct(i,e,r){const o={};for(const c in i)e.call(r||this,i[c],c,i)&&(o[c]=i[c]);return o}function vt(i){return Array.isArray(i)?i.map(vt):typeof i=="object"&&i?Mt(i,vt):i}const Wt={};function $t(i){Wt[i]||(typeof console<"u"&&console.warn(i),Wt[i]=!0)}function Gi(i,e,r){return(r.y-i.y)*(e.x-i.x)>(e.y-i.y)*(r.x-i.x)}function Fi(i){let e=0;for(let r,o,c=0,h=i.length,d=h-1;c<h;d=c++)r=i[c],o=i[d],e+=(o.x-r.x)*(r.y+o.y);return e}function fi(){return typeof WorkerGlobalScope<"u"&&typeof self<"u"&&self instanceof WorkerGlobalScope}function wo(i){const e={};if(i.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(r,o,c,h)=>{const d=c||h;return e[o]=!d||d.toLowerCase(),""}),e["max-age"]){const r=parseInt(e["max-age"],10);isNaN(r)?delete e["max-age"]:e["max-age"]=r}return e}let lr,Gr,cr=null;function un(i){if(cr==null){const e=i.navigator?i.navigator.userAgent:null;cr=!!i.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return cr}function Er(i){return typeof ImageBitmap<"u"&&i instanceof ImageBitmap}const Sr={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frame(i){const e=requestAnimationFrame(i);return{cancel:()=>cancelAnimationFrame(e)}},getImageData(i,e=0){const r=window.document.createElement("canvas"),o=r.getContext("2d");if(!o)throw new Error("failed to create canvas 2d context");return r.width=i.width,r.height=i.height,o.drawImage(i,0,0,i.width,i.height),o.getImageData(-e,-e,i.width+2*e,i.height+2*e)},resolveURL:i=>(lr||(lr=document.createElement("a")),lr.href=i,lr.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(Gr==null&&(Gr=matchMedia("(prefers-reduced-motion: reduce)")),Gr.matches)}};var We=ur;function ur(i,e){this.x=i,this.y=e}ur.prototype={clone:function(){return new ur(this.x,this.y)},add:function(i){return this.clone()._add(i)},sub:function(i){return this.clone()._sub(i)},multByPoint:function(i){return this.clone()._multByPoint(i)},divByPoint:function(i){return this.clone()._divByPoint(i)},mult:function(i){return this.clone()._mult(i)},div:function(i){return this.clone()._div(i)},rotate:function(i){return this.clone()._rotate(i)},rotateAround:function(i,e){return this.clone()._rotateAround(i,e)},matMult:function(i){return this.clone()._matMult(i)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(i){return this.x===i.x&&this.y===i.y},dist:function(i){return Math.sqrt(this.distSqr(i))},distSqr:function(i){var e=i.x-this.x,r=i.y-this.y;return e*e+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(i){return Math.atan2(this.y-i.y,this.x-i.x)},angleWith:function(i){return this.angleWithSep(i.x,i.y)},angleWithSep:function(i,e){return Math.atan2(this.x*e-this.y*i,this.x*i+this.y*e)},_matMult:function(i){var e=i[2]*this.x+i[3]*this.y;return this.x=i[0]*this.x+i[1]*this.y,this.y=e,this},_add:function(i){return this.x+=i.x,this.y+=i.y,this},_sub:function(i){return this.x-=i.x,this.y-=i.y,this},_mult:function(i){return this.x*=i,this.y*=i,this},_div:function(i){return this.x/=i,this.y/=i,this},_multByPoint:function(i){return this.x*=i.x,this.y*=i.y,this},_divByPoint:function(i){return this.x/=i.x,this.y/=i.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var i=this.y;return this.y=this.x,this.x=-i,this},_rotate:function(i){var e=Math.cos(i),r=Math.sin(i),o=r*this.x+e*this.y;return this.x=e*this.x-r*this.y,this.y=o,this},_rotateAround:function(i,e){var r=Math.cos(i),o=Math.sin(i),c=e.y+o*(this.x-e.x)+r*(this.y-e.y);return this.x=e.x+r*(this.x-e.x)-o*(this.y-e.y),this.y=c,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},ur.convert=function(i){return i instanceof ur?i:Array.isArray(i)?new ur(i[0],i[1]):i};const hr={MAX_PARALLEL_IMAGE_REQUESTS:16,REGISTERED_PROTOCOLS:{}},qi="mapbox-tiles";let Zi,qr,hn=500,pn=50;function dn(){typeof caches>"u"||Zi||(Zi=caches.open(qi))}let Qi=1/0;const Ir={supported:!1,testSupport:function(i){!xi&&Cr&&(fn?$n(i):Ar=i)}};let Ar,Cr,xi=!1,fn=!1;function $n(i){const e=i.createTexture();i.bindTexture(i.TEXTURE_2D,e);try{if(i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,Cr),i.isContextLost())return;Ir.supported=!0}catch(r){}i.deleteTexture(e),xi=!0}typeof document<"u"&&(Cr=document.createElement("img"),Cr.onload=function(){Ar&&$n(Ar),Ar=null,fn=!0},Cr.onerror=function(){xi=!0,Ar=null},Cr.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const pr={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image"};typeof Object.freeze=="function"&&Object.freeze(pr);class Si extends Error{constructor(e,r,o,c){super(`AJAXError: ${r} (${e}): ${o}`),this.status=e,this.statusText=r,this.url=o,this.body=c}}const Vn=fi()?()=>self.worker&&self.worker.referrer:()=>(window.location.protocol==="blob:"?window.parent:window).location.href;function Mr(i,e){const r=new AbortController,o=new Request(i.url,{method:i.method||"GET",body:i.body,credentials:i.credentials,headers:i.headers,referrer:Vn(),signal:r.signal});let c=!1,h=!1;return i.type==="json"&&o.headers.set("Accept","application/json"),((d,m,g)=>{if(h)return;const x=Date.now();fetch(o).then(w=>w.ok?((E,A,M)=>{(i.type==="arrayBuffer"?E.arrayBuffer():i.type==="json"?E.json():E.text()).then(z=>{h||(A&&M&&function(V,U,ee){if(dn(),!Zi)return;const oe={status:U.status,statusText:U.statusText,headers:new Headers};U.headers.forEach((re,fe)=>oe.headers.set(fe,re));const Y=wo(U.headers.get("Cache-Control")||"");Y["no-store"]||(Y["max-age"]&&oe.headers.set("Expires",new Date(ee+1e3*Y["max-age"]).toUTCString()),new Date(oe.headers.get("Expires")).getTime()-ee<42e4||function(re,fe){if(qr===void 0)try{new Response(new ReadableStream),qr=!0}catch(de){qr=!1}qr?fe(re.body):re.blob().then(fe)}(U,re=>{const fe=new Response(re,oe);dn(),Zi&&Zi.then(de=>de.put(function(Be){const Ue=Be.indexOf("?");return Ue<0?Be:Be.slice(0,Ue)}(V.url),fe)).catch(de=>$t(de.message))}))}(o,A,M),c=!0,e(null,z,E.headers.get("Cache-Control"),E.headers.get("Expires")))}).catch(z=>{h||e(new Error(z.message))})})(w,null,x):w.blob().then(E=>e(new Si(w.status,w.statusText,i.url,E)))).catch(w=>{w.code!==20&&e(new Error(w.message))})})(),{cancel:()=>{h=!0,c||r.abort()}}}const mn=function(i,e){if(/:\/\//.test(i.url)&&!/^https?:|^file:/.test(i.url)){if(fi()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",i,e);if(!fi()){const o=i.url.substring(0,i.url.indexOf("://"));return(hr.REGISTERED_PROTOCOLS[o]||Mr)(i,e)}}if(!(/^file:/.test(r=i.url)||/^file:/.test(Vn())&&!/^\w+:/.test(r))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return Mr(i,e);if(fi()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",i,e,void 0,!0)}var r;return function(o,c){const h=new XMLHttpRequest;h.open(o.method||"GET",o.url,!0),o.type==="arrayBuffer"&&(h.responseType="arraybuffer");for(const d in o.headers)h.setRequestHeader(d,o.headers[d]);return o.type==="json"&&(h.responseType="text",h.setRequestHeader("Accept","application/json")),h.withCredentials=o.credentials==="include",h.onerror=()=>{c(new Error(h.statusText))},h.onload=()=>{if((h.status>=200&&h.status<300||h.status===0)&&h.response!==null){let d=h.response;if(o.type==="json")try{d=JSON.parse(h.response)}catch(m){return c(m)}c(null,d,h.getResponseHeader("Cache-Control"),h.getResponseHeader("Expires"))}else{const d=new Blob([h.response],{type:h.getResponseHeader("Content-Type")});c(new Si(h.status,h.statusText,o.url,d))}},h.send(o.body),{cancel:()=>h.abort()}}(i,e)},gn=function(i,e){return mn(nt(i,{type:"arrayBuffer"}),e)};function Nn(i){const e=window.document.createElement("a");return e.href=i,e.protocol===window.document.location.protocol&&e.host===window.document.location.host}const ht="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let er,zr;er=[],zr=0;const Pr=function(i,e){if(Ir.supported&&(i.headers||(i.headers={}),i.headers.accept="image/webp,*/*"),zr>=hr.MAX_PARALLEL_IMAGE_REQUESTS){const h={requestParameters:i,callback:e,cancelled:!1,cancel(){this.cancelled=!0}};return er.push(h),h}zr++;let r=!1;const o=()=>{if(!r)for(r=!0,zr--;er.length&&zr<hr.MAX_PARALLEL_IMAGE_REQUESTS;){const h=er.shift(),{requestParameters:d,callback:m,cancelled:g}=h;g||(h.cancel=Pr(d,m).cancel)}},c=gn(i,(h,d,m,g)=>{o(),h?e(h):d&&function(x,w){typeof createImageBitmap=="function"?function(E,A){const M=new Blob([new Uint8Array(E)],{type:"image/png"});createImageBitmap(M).then(z=>{A(null,z)}).catch(z=>{A(new Error(`Could not load image because of ${z.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})}(x,w):function(E,A){const M=new Image;M.onload=()=>{A(null,M),URL.revokeObjectURL(M.src),M.onload=null,window.requestAnimationFrame(()=>{M.src=ht})},M.onerror=()=>A(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const z=new Blob([new Uint8Array(E)],{type:"image/png"});M.src=E.byteLength?URL.createObjectURL(z):ht}(x,w)}(d,(x,w)=>{x!=null?e(x):w!=null&&e(null,w,{cacheControl:m,expires:g})})});return{cancel:()=>{c.cancel(),o()}}};function Gn(i,e,r){r[i]&&r[i].indexOf(e)!==-1||(r[i]=r[i]||[],r[i].push(e))}function dr(i,e,r){if(r&&r[i]){const o=r[i].indexOf(e);o!==-1&&r[i].splice(o,1)}}class fr{constructor(e,r={}){nt(this,r),this.type=e}}class _n extends fr{constructor(e,r={}){super("error",nt({error:e},r))}}class mr{on(e,r){return this._listeners=this._listeners||{},Gn(e,r,this._listeners),this}off(e,r){return dr(e,r,this._listeners),dr(e,r,this._oneTimeListeners),this}once(e,r){return this._oneTimeListeners=this._oneTimeListeners||{},Gn(e,r,this._oneTimeListeners),this}fire(e,r){typeof e=="string"&&(e=new fr(e,r||{}));const o=e.type;if(this.listens(o)){e.target=this;const c=this._listeners&&this._listeners[o]?this._listeners[o].slice():[];for(const m of c)m.call(this,e);const h=this._oneTimeListeners&&this._oneTimeListeners[o]?this._oneTimeListeners[o].slice():[];for(const m of h)dr(o,m,this._oneTimeListeners),m.call(this,e);const d=this._eventedParent;d&&(nt(e,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),d.fire(e))}else e instanceof _n&&console.error(e.error);return this}listens(e){return this._listeners&&this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e)}setEventedParent(e,r){return this._eventedParent=e,this._eventedParentData=r,this}}var pe={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"string"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{}},default:"mapbox"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{},within:{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1},elevationOffset:{type:"number",default:450}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}}};class Ce{constructor(e,r,o,c){this.message=(e?`${e}: `:"")+o,c&&(this.identifier=c),r!=null&&r.__line__&&(this.line=r.__line__)}}function Zr(i){const e=i.value;return e?[new Ce(i.key,e,"constants have been deprecated as of v8")]:[]}function ji(i,...e){for(const r of e)for(const o in r)i[o]=r[o];return i}function pt(i){return i instanceof Number||i instanceof String||i instanceof Boolean?i.valueOf():i}function Oi(i){if(Array.isArray(i))return i.map(Oi);if(i instanceof Object&&!(i instanceof Number||i instanceof String||i instanceof Boolean)){const e={};for(const r in i)e[r]=Oi(i[r]);return e}return pt(i)}class Ii extends Error{constructor(e,r){super(r),this.message=r,this.key=e}}class Ai{constructor(e,r=[]){this.parent=e,this.bindings={};for(const[o,c]of r)this.bindings[o]=c}concat(e){return new Ai(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw new Error(`${e} not found in scope.`)}has(e){return!!this.bindings[e]||!!this.parent&&this.parent.has(e)}}const kr={kind:"null"},Se={kind:"number"},et={kind:"string"},Ye={kind:"boolean"},oi={kind:"color"},Dr={kind:"object"},Je={kind:"value"},gr={kind:"collator"},Yt={kind:"formatted"},yn={kind:"padding"},qt={kind:"resolvedImage"};function mi(i,e){return{kind:"array",itemType:i,N:e}}function Tt(i){if(i.kind==="array"){const e=Tt(i.itemType);return typeof i.N=="number"?`array<${e}, ${i.N}>`:i.itemType.kind==="value"?"array":`array<${e}>`}return i.kind}const xn=[kr,Se,et,Ye,oi,Yt,Dr,mi(Je),yn,qt];function tr(i,e){if(e.kind==="error")return null;if(i.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!tr(i.itemType,e.itemType))&&(typeof i.N!="number"||i.N===e.N))return null}else{if(i.kind===e.kind)return null;if(i.kind==="value"){for(const r of xn)if(!tr(r,e))return null}}return`Expected ${Tt(i)} but found ${Tt(e)} instead.`}function jr(i,e){return e.some(r=>r.kind===i.kind)}function Xr(i,e){return e.some(r=>r==="null"?i===null:r==="array"?Array.isArray(i):r==="object"?i&&!Array.isArray(i)&&typeof i=="object":r===typeof i)}var vn,Wr={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function L(i){return(i=Math.round(i))<0?0:i>255?255:i}function b(i){return L(i[i.length-1]==="%"?parseFloat(i)/100*255:parseInt(i))}function S(i){return(e=i[i.length-1]==="%"?parseFloat(i)/100:parseFloat(i))<0?0:e>1?1:e;var e}function k(i,e,r){return r<0?r+=1:r>1&&(r-=1),6*r<1?i+(e-i)*r*6:2*r<1?e:3*r<2?i+(e-i)*(2/3-r)*6:i}try{vn={}.parseCSSColor=function(i){var e,r=i.replace(/ /g,"").toLowerCase();if(r in Wr)return Wr[r].slice();if(r[0]==="#")return r.length===4?(e=parseInt(r.substr(1),16))>=0&&e<=4095?[(3840&e)>>4|(3840&e)>>8,240&e|(240&e)>>4,15&e|(15&e)<<4,1]:null:r.length===7&&(e=parseInt(r.substr(1),16))>=0&&e<=16777215?[(16711680&e)>>16,(65280&e)>>8,255&e,1]:null;var o=r.indexOf("("),c=r.indexOf(")");if(o!==-1&&c+1===r.length){var h=r.substr(0,o),d=r.substr(o+1,c-(o+1)).split(","),m=1;switch(h){case"rgba":if(d.length!==4)return null;m=S(d.pop());case"rgb":return d.length!==3?null:[b(d[0]),b(d[1]),b(d[2]),m];case"hsla":if(d.length!==4)return null;m=S(d.pop());case"hsl":if(d.length!==3)return null;var g=(parseFloat(d[0])%360+360)%360/360,x=S(d[1]),w=S(d[2]),E=w<=.5?w*(x+1):w+x-w*x,A=2*w-E;return[L(255*k(A,E,g+1/3)),L(255*k(A,E,g)),L(255*k(A,E,g-1/3)),m];default:return null}}return null}}catch(i){}class D{constructor(e,r,o,c=1){this.r=e,this.g=r,this.b=o,this.a=c}static parse(e){if(!e)return;if(e instanceof D)return e;if(typeof e!="string")return;const r=vn(e);return r?new D(r[0]/255*r[3],r[1]/255*r[3],r[2]/255*r[3],r[3]):void 0}toString(){const[e,r,o,c]=this.toArray();return`rgba(${Math.round(e)},${Math.round(r)},${Math.round(o)},${c})`}toArray(){const{r:e,g:r,b:o,a:c}=this;return c===0?[0,0,0,0]:[255*e/c,255*r/c,255*o/c,c]}}D.black=new D(0,0,0,1),D.white=new D(1,1,1,1),D.transparent=new D(0,0,0,0),D.red=new D(1,0,0,1);class G{constructor(e,r,o){this.sensitivity=e?r?"variant":"case":r?"accent":"base",this.locale=o,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,r){return this.collator.compare(e,r)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class H{constructor(e,r,o,c,h){this.text=e,this.image=r,this.scale=o,this.fontStack=c,this.textColor=h}}class Z{constructor(e){this.sections=e}static fromString(e){return new Z([new H(e,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(e=>e.text.length!==0||e.image&&e.image.name.length!==0)}static factory(e){return e instanceof Z?e:Z.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map(e=>e.text).join("")}}class q{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof q)return e;if(typeof e=="number")return new q([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(const r of e)if(typeof r!="number")return;switch(e.length){case 1:e=[e[0],e[0],e[0],e[0]];break;case 2:e=[e[0],e[1],e[0],e[1]];break;case 3:e=[e[0],e[1],e[2],e[1]]}return new q(e)}}toString(){return JSON.stringify(this.values)}}class K{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new K({name:e,available:!1}):null}}function le(i,e,r,o){return typeof i=="number"&&i>=0&&i<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof r=="number"&&r>=0&&r<=255?o===void 0||typeof o=="number"&&o>=0&&o<=1?null:`Invalid rgba value [${[i,e,r,o].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof o=="number"?[i,e,r,o]:[i,e,r]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function _e(i){if(i===null||typeof i=="string"||typeof i=="boolean"||typeof i=="number"||i instanceof D||i instanceof G||i instanceof Z||i instanceof q||i instanceof K)return!0;if(Array.isArray(i)){for(const e of i)if(!_e(e))return!1;return!0}if(typeof i=="object"){for(const e in i)if(!_e(i[e]))return!1;return!0}return!1}function ae(i){if(i===null)return kr;if(typeof i=="string")return et;if(typeof i=="boolean")return Ye;if(typeof i=="number")return Se;if(i instanceof D)return oi;if(i instanceof G)return gr;if(i instanceof Z)return Yt;if(i instanceof q)return yn;if(i instanceof K)return qt;if(Array.isArray(i)){const e=i.length;let r;for(const o of i){const c=ae(o);if(r){if(r===c)continue;r=Je;break}r=c}return mi(r||Je,e)}return Dr}function Oe(i){const e=typeof i;return i===null?"":e==="string"||e==="number"||e==="boolean"?String(i):i instanceof D||i instanceof Z||i instanceof q||i instanceof K?i.toString():JSON.stringify(i)}class $e{constructor(e,r){this.type=e,this.value=r}static parse(e,r){if(e.length!==2)return r.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!_e(e[1]))return r.error("invalid value");const o=e[1];let c=ae(o);const h=r.expectedType;return c.kind!=="array"||c.N!==0||!h||h.kind!=="array"||typeof h.N=="number"&&h.N!==0||(c=h),new $e(c,o)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class De{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}}const Ze={string:et,number:Se,boolean:Ye,object:Dr};class Xe{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");let o,c=1;const h=e[0];if(h==="array"){let m,g;if(e.length>2){const x=e[1];if(typeof x!="string"||!(x in Ze)||x==="object")return r.error('The item type argument of "array" must be one of string, number, boolean',1);m=Ze[x],c++}else m=Je;if(e.length>3){if(e[2]!==null&&(typeof e[2]!="number"||e[2]<0||e[2]!==Math.floor(e[2])))return r.error('The length argument to "array" must be a positive integer literal',2);g=e[2],c++}o=mi(m,g)}else{if(!Ze[h])throw new Error(`Types doesn't contain name = ${h}`);o=Ze[h]}const d=[];for(;c<e.length;c++){const m=r.parse(e[c],c,Je);if(!m)return null;d.push(m)}return new Xe(o,d)}evaluate(e){for(let r=0;r<this.args.length;r++){const o=this.args[r].evaluate(e);if(!tr(this.type,ae(o)))return o;if(r===this.args.length-1)throw new De(`Expected value to be of type ${Tt(this.type)}, but found ${Tt(ae(o))} instead.`)}throw new Error}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const dt={"to-boolean":Ye,"to-color":oi,"to-number":Se,"to-string":et};class Ke{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");const o=e[0];if(!dt[o])throw new Error(`Can't parse ${o} as it is not part of the known types`);if((o==="to-boolean"||o==="to-string")&&e.length!==2)return r.error("Expected one argument.");const c=dt[o],h=[];for(let d=1;d<e.length;d++){const m=r.parse(e[d],d,Je);if(!m)return null;h.push(m)}return new Ke(c,h)}evaluate(e){if(this.type.kind==="boolean")return Boolean(this.args[0].evaluate(e));if(this.type.kind==="color"){let r,o;for(const c of this.args){if(r=c.evaluate(e),o=null,r instanceof D)return r;if(typeof r=="string"){const h=e.parseColor(r);if(h)return h}else if(Array.isArray(r)&&(o=r.length<3||r.length>4?`Invalid rbga value ${JSON.stringify(r)}: expected an array containing either three or four numeric values.`:le(r[0],r[1],r[2],r[3]),!o))return new D(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new De(o||`Could not parse color from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}if(this.type.kind==="padding"){let r;for(const o of this.args){r=o.evaluate(e);const c=q.parse(r);if(c)return c}throw new De(`Could not parse padding from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}if(this.type.kind==="number"){let r=null;for(const o of this.args){if(r=o.evaluate(e),r===null)return 0;const c=Number(r);if(!isNaN(c))return c}throw new De(`Could not convert ${JSON.stringify(r)} to number.`)}return this.type.kind==="formatted"?Z.fromString(Oe(this.args[0].evaluate(e))):this.type.kind==="resolvedImage"?K.fromString(Oe(this.args[0].evaluate(e))):Oe(this.args[0].evaluate(e))}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const tt=["Unknown","Point","LineString","Polygon"];class ft{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?tt[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(e){let r=this._parseColorCache[e];return r||(r=this._parseColorCache[e]=D.parse(e)),r}}class St{constructor(e,r,o,c){this.name=e,this.type=r,this._evaluate=o,this.args=c}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(e,r){const o=e[0],c=St.definitions[o];if(!c)return r.error(`Unknown expression "${o}". If you wanted a literal array, use ["literal", [...]].`,0);const h=Array.isArray(c)?c[0]:c.type,d=Array.isArray(c)?[[c[1],c[2]]]:c.overloads,m=d.filter(([x])=>!Array.isArray(x)||x.length===e.length-1);let g=null;for(const[x,w]of m){g=new Tn(r.registry,r.path,null,r.scope);const E=[];let A=!1;for(let M=1;M<e.length;M++){const z=e[M],V=Array.isArray(x)?x[M-1]:x.type,U=g.parse(z,1+E.length,V);if(!U){A=!0;break}E.push(U)}if(!A)if(Array.isArray(x)&&x.length!==E.length)g.error(`Expected ${x.length} arguments, but found ${E.length} instead.`);else{for(let M=0;M<E.length;M++){const z=Array.isArray(x)?x[M]:x.type,V=E[M];g.concat(M+1).checkSubtype(z,V.type)}if(g.errors.length===0)return new St(o,h,w,E)}}if(m.length===1)r.errors.push(...g.errors);else{const x=(m.length?m:d).map(([E])=>{return A=E,Array.isArray(A)?`(${A.map(Tt).join(", ")})`:`(${Tt(A.type)}...)`;var A}).join(" | "),w=[];for(let E=1;E<e.length;E++){const A=r.parse(e[E],1+w.length);if(!A)return null;w.push(Tt(A.type))}r.error(`Expected arguments of type ${x}, but found (${w.join(", ")}) instead.`)}return null}static register(e,r){St.definitions=r;for(const o in r)e[o]=St}}class Qt{constructor(e,r,o){this.type=gr,this.locale=o,this.caseSensitive=e,this.diacriticSensitive=r}static parse(e,r){if(e.length!==2)return r.error("Expected one argument.");const o=e[1];if(typeof o!="object"||Array.isArray(o))return r.error("Collator options argument must be an object.");const c=r.parse(o["case-sensitive"]!==void 0&&o["case-sensitive"],1,Ye);if(!c)return null;const h=r.parse(o["diacritic-sensitive"]!==void 0&&o["diacritic-sensitive"],1,Ye);if(!h)return null;let d=null;return o.locale&&(d=r.parse(o.locale,1,et),!d)?null:new Qt(c,h,d)}evaluate(e){return new G(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}}const kt=8192;function li(i,e){i[0]=Math.min(i[0],e[0]),i[1]=Math.min(i[1],e[1]),i[2]=Math.max(i[2],e[0]),i[3]=Math.max(i[3],e[1])}function bn(i,e){return!(i[0]<=e[0]||i[2]>=e[2]||i[1]<=e[1]||i[3]>=e[3])}function qn(i,e){const r=(180+i[0])/360,o=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i[1]*Math.PI/360)))/360,c=Math.pow(2,e.z);return[Math.round(r*c*kt),Math.round(o*c*kt)]}function It(i,e,r){const o=i[0]-e[0],c=i[1]-e[1],h=i[0]-r[0],d=i[1]-r[1];return o*d-h*c==0&&o*h<=0&&c*d<=0}function ts(i,e){let r=!1;for(let d=0,m=e.length;d<m;d++){const g=e[d];for(let x=0,w=g.length;x<w-1;x++){if(It(i,g[x],g[x+1]))return!1;(c=g[x])[1]>(o=i)[1]!=(h=g[x+1])[1]>o[1]&&o[0]<(h[0]-c[0])*(o[1]-c[1])/(h[1]-c[1])+c[0]&&(r=!r)}}var o,c,h;return r}function is(i,e){for(let r=0;r<e.length;r++)if(ts(i,e[r]))return!0;return!1}function ia(i,e,r,o){const c=o[0]-r[0],h=o[1]-r[1],d=(i[0]-r[0])*h-c*(i[1]-r[1]),m=(e[0]-r[0])*h-c*(e[1]-r[1]);return d>0&&m<0||d<0&&m>0}function ra(i,e,r){for(const x of r)for(let w=0;w<x.length-1;++w)if((m=[(d=x[w+1])[0]-(h=x[w])[0],d[1]-h[1]])[0]*(g=[(c=e)[0]-(o=i)[0],c[1]-o[1]])[1]-m[1]*g[0]!=0&&ia(o,c,h,d)&&ia(h,d,o,c))return!0;var o,c,h,d,m,g;return!1}function rs(i,e){for(let r=0;r<i.length;++r)if(!ts(i[r],e))return!1;for(let r=0;r<i.length-1;++r)if(ra(i[r],i[r+1],e))return!1;return!0}function fl(i,e){for(let r=0;r<e.length;r++)if(rs(i,e[r]))return!0;return!1}function To(i,e,r){const o=[];for(let c=0;c<i.length;c++){const h=[];for(let d=0;d<i[c].length;d++){const m=qn(i[c][d],r);li(e,m),h.push(m)}o.push(h)}return o}function ns(i,e,r){const o=[];for(let c=0;c<i.length;c++){const h=To(i[c],e,r);o.push(h)}return o}function na(i,e,r,o){if(i[0]<r[0]||i[0]>r[2]){const c=.5*o;let h=i[0]-r[0]>c?-o:r[0]-i[0]>c?o:0;h===0&&(h=i[0]-r[2]>c?-o:r[2]-i[0]>c?o:0),i[0]+=h}li(e,i)}function oa(i,e,r,o){const c=Math.pow(2,o.z)*kt,h=[o.x*kt,o.y*kt],d=[];for(const m of i)for(const g of m){const x=[g.x+h[0],g.y+h[1]];na(x,e,r,c),d.push(x)}return d}function sa(i,e,r,o){const c=Math.pow(2,o.z)*kt,h=[o.x*kt,o.y*kt],d=[];for(const g of i){const x=[];for(const w of g){const E=[w.x+h[0],w.y+h[1]];li(e,E),x.push(E)}d.push(x)}if(e[2]-e[0]<=c/2){(m=e)[0]=m[1]=1/0,m[2]=m[3]=-1/0;for(const g of d)for(const x of g)na(x,e,r,c)}var m;return d}class Hr{constructor(e,r){this.type=Ye,this.geojson=e,this.geometries=r}static parse(e,r){if(e.length!==2)return r.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(_e(e[1])){const o=e[1];if(o.type==="FeatureCollection")for(let c=0;c<o.features.length;++c){const h=o.features[c].geometry.type;if(h==="Polygon"||h==="MultiPolygon")return new Hr(o,o.features[c].geometry)}else if(o.type==="Feature"){const c=o.geometry.type;if(c==="Polygon"||c==="MultiPolygon")return new Hr(o,o.geometry)}else if(o.type==="Polygon"||o.type==="MultiPolygon")return new Hr(o,o)}return r.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return function(r,o){const c=[1/0,1/0,-1/0,-1/0],h=[1/0,1/0,-1/0,-1/0],d=r.canonicalID();if(o.type==="Polygon"){const m=To(o.coordinates,h,d),g=oa(r.geometry(),c,h,d);if(!bn(c,h))return!1;for(const x of g)if(!ts(x,m))return!1}if(o.type==="MultiPolygon"){const m=ns(o.coordinates,h,d),g=oa(r.geometry(),c,h,d);if(!bn(c,h))return!1;for(const x of g)if(!is(x,m))return!1}return!0}(e,this.geometries);if(e.geometryType()==="LineString")return function(r,o){const c=[1/0,1/0,-1/0,-1/0],h=[1/0,1/0,-1/0,-1/0],d=r.canonicalID();if(o.type==="Polygon"){const m=To(o.coordinates,h,d),g=sa(r.geometry(),c,h,d);if(!bn(c,h))return!1;for(const x of g)if(!rs(x,m))return!1}if(o.type==="MultiPolygon"){const m=ns(o.coordinates,h,d),g=sa(r.geometry(),c,h,d);if(!bn(c,h))return!1;for(const x of g)if(!fl(x,m))return!1}return!0}(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}function Zn(i){if(i instanceof St&&(i.name==="get"&&i.args.length===1||i.name==="feature-state"||i.name==="has"&&i.args.length===1||i.name==="properties"||i.name==="geometry-type"||i.name==="id"||/^filter-/.test(i.name))||i instanceof Hr)return!1;let e=!0;return i.eachChild(r=>{e&&!Zn(r)&&(e=!1)}),e}function wn(i){if(i instanceof St&&i.name==="feature-state")return!1;let e=!0;return i.eachChild(r=>{e&&!wn(r)&&(e=!1)}),e}function Eo(i,e){if(i instanceof St&&e.indexOf(i.name)>=0)return!1;let r=!0;return i.eachChild(o=>{r&&!Eo(o,e)&&(r=!1)}),r}class So{constructor(e,r){this.type=r.type,this.name=e,this.boundExpression=r}static parse(e,r){if(e.length!==2||typeof e[1]!="string")return r.error("'var' expression requires exactly one string literal argument.");const o=e[1];return r.scope.has(o)?new So(o,r.scope.get(o)):r.error(`Unknown variable "${o}". Make sure "${o}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}}class Tn{constructor(e,r=[],o,c=new Ai,h=[]){this.registry=e,this.path=r,this.key=r.map(d=>`[${d}]`).join(""),this.scope=c,this.errors=h,this.expectedType=o}parse(e,r,o,c,h={}){return r?this.concat(r,o,c)._parse(e,h):this._parse(e,h)}_parse(e,r){function o(c,h,d){return d==="assert"?new Xe(h,[c]):d==="coerce"?new Ke(h,[c]):c}if(e!==null&&typeof e!="string"&&typeof e!="boolean"&&typeof e!="number"||(e=["literal",e]),Array.isArray(e)){if(e.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const c=e[0];if(typeof c!="string")return this.error(`Expression name must be a string, but found ${typeof c} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const h=this.registry[c];if(h){let d=h.parse(e,this);if(!d)return null;if(this.expectedType){const m=this.expectedType,g=d.type;if(m.kind!=="string"&&m.kind!=="number"&&m.kind!=="boolean"&&m.kind!=="object"&&m.kind!=="array"||g.kind!=="value")if(m.kind!=="color"&&m.kind!=="formatted"&&m.kind!=="resolvedImage"||g.kind!=="value"&&g.kind!=="string")if(m.kind!=="padding"||g.kind!=="value"&&g.kind!=="number"&&g.kind!=="array"){if(this.checkSubtype(m,g))return null}else d=o(d,m,r.typeAnnotation||"coerce");else d=o(d,m,r.typeAnnotation||"coerce");else d=o(d,m,r.typeAnnotation||"assert")}if(!(d instanceof $e)&&d.type.kind!=="resolvedImage"&&os(d)){const m=new ft;try{d=new $e(d.type,d.evaluate(m))}catch(g){return this.error(g.message),null}}return d}return this.error(`Unknown expression "${c}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(e===void 0?"'undefined' value invalid. Use null instead.":typeof e=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof e} instead.`)}concat(e,r,o){const c=typeof e=="number"?this.path.concat(e):this.path,h=o?this.scope.concat(o):this.scope;return new Tn(this.registry,c,r||null,h,this.errors)}error(e,...r){const o=`${this.key}${r.map(c=>`[${c}]`).join("")}`;this.errors.push(new Ii(o,e))}checkSubtype(e,r){const o=tr(e,r);return o&&this.error(o),o}}function os(i){if(i instanceof So)return os(i.boundExpression);if(i instanceof St&&i.name==="error"||i instanceof Qt||i instanceof Hr)return!1;const e=i instanceof Ke||i instanceof Xe;let r=!0;return i.eachChild(o=>{r=e?r&&os(o):r&&o instanceof $e}),!!r&&Zn(i)&&Eo(i,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function Io(i,e){const r=i.length-1;let o,c,h=0,d=r,m=0;for(;h<=d;)if(m=Math.floor((h+d)/2),o=i[m],c=i[m+1],o<=e){if(m===r||e<c)return m;h=m+1}else{if(!(o>e))throw new De("Input is not a number.");d=m-1}return 0}class jn{constructor(e,r,o){this.type=e,this.input=r,this.labels=[],this.outputs=[];for(const[c,h]of o)this.labels.push(c),this.outputs.push(h)}static parse(e,r){if(e.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return r.error("Expected an even number of arguments.");const o=r.parse(e[1],1,Se);if(!o)return null;const c=[];let h=null;r.expectedType&&r.expectedType.kind!=="value"&&(h=r.expectedType);for(let d=1;d<e.length;d+=2){const m=d===1?-1/0:e[d],g=e[d+1],x=d,w=d+1;if(typeof m!="number")return r.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',x);if(c.length&&c[c.length-1][0]>=m)return r.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',x);const E=r.parse(g,w,h);if(!E)return null;h=h||E.type,c.push([m,E])}return new jn(h,o,c)}evaluate(e){const r=this.labels,o=this.outputs;if(r.length===1)return o[0].evaluate(e);const c=this.input.evaluate(e);if(c<=r[0])return o[0].evaluate(e);const h=r.length;return c>=r[h-1]?o[h-1].evaluate(e):o[Io(r,c)].evaluate(e)}eachChild(e){e(this.input);for(const r of this.outputs)e(r)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function Dt(i,e,r){return i*(1-r)+e*r}var Xn=Object.freeze({__proto__:null,number:Dt,color:function(i,e,r){return new D(Dt(i.r,e.r,r),Dt(i.g,e.g,r),Dt(i.b,e.b,r),Dt(i.a,e.a,r))},array:function(i,e,r){return i.map((o,c)=>Dt(o,e[c],r))},padding:function(i,e,r){const o=i.values,c=e.values;return new q([Dt(o[0],c[0],r),Dt(o[1],c[1],r),Dt(o[2],c[2],r),Dt(o[3],c[3],r)])}});const aa=.95047,la=1.08883,ss=4/29,Ao=6/29,ca=3*Ao*Ao,ml=Math.PI/180,gl=180/Math.PI;function as(i){return i>.008856451679035631?Math.pow(i,1/3):i/ca+ss}function ls(i){return i>Ao?i*i*i:ca*(i-ss)}function cs(i){return 255*(i<=.0031308?12.92*i:1.055*Math.pow(i,1/2.4)-.055)}function us(i){return(i/=255)<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4)}function _t(i){const e=us(i.r),r=us(i.g),o=us(i.b),c=as((.4124564*e+.3575761*r+.1804375*o)/aa),h=as((.2126729*e+.7151522*r+.072175*o)/1);return{l:116*h-16,a:500*(c-h),b:200*(h-as((.0193339*e+.119192*r+.9503041*o)/la)),alpha:i.a}}function ua(i){let e=(i.l+16)/116,r=isNaN(i.a)?e:e+i.a/500,o=isNaN(i.b)?e:e-i.b/200;return e=1*ls(e),r=aa*ls(r),o=la*ls(o),new D(cs(3.2404542*r-1.5371385*e-.4985314*o),cs(-.969266*r+1.8760108*e+.041556*o),cs(.0556434*r-.2040259*e+1.0572252*o),i.alpha)}function _l(i,e,r){const o=e-i;return i+r*(o>180||o<-180?o-360*Math.round(o/360):o)}const Wn={forward:_t,reverse:ua,interpolate:function(i,e,r){return{l:Dt(i.l,e.l,r),a:Dt(i.a,e.a,r),b:Dt(i.b,e.b,r),alpha:Dt(i.alpha,e.alpha,r)}}},Hn={forward:function(i){const{l:e,a:r,b:o}=_t(i),c=Math.atan2(o,r)*gl;return{h:c<0?c+360:c,c:Math.sqrt(r*r+o*o),l:e,alpha:i.a}},reverse:function(i){const e=i.h*ml,r=i.c;return ua({l:i.l,a:Math.cos(e)*r,b:Math.sin(e)*r,alpha:i.alpha})},interpolate:function(i,e,r){return{h:_l(i.h,e.h,r),c:Dt(i.c,e.c,r),l:Dt(i.l,e.l,r),alpha:Dt(i.alpha,e.alpha,r)}}};var ha=Object.freeze({__proto__:null,lab:Wn,hcl:Hn});class Ci{constructor(e,r,o,c,h){this.type=e,this.operator=r,this.interpolation=o,this.input=c,this.labels=[],this.outputs=[];for(const[d,m]of h)this.labels.push(d),this.outputs.push(m)}static interpolationFactor(e,r,o,c){let h=0;if(e.name==="exponential")h=hs(r,e.base,o,c);else if(e.name==="linear")h=hs(r,1,o,c);else if(e.name==="cubic-bezier"){const d=e.controlPoints;h=new ve(d[0],d[1],d[2],d[3]).solve(hs(r,1,o,c))}return h}static parse(e,r){let[o,c,h,...d]=e;if(!Array.isArray(c)||c.length===0)return r.error("Expected an interpolation type expression.",1);if(c[0]==="linear")c={name:"linear"};else if(c[0]==="exponential"){const x=c[1];if(typeof x!="number")return r.error("Exponential interpolation requires a numeric base.",1,1);c={name:"exponential",base:x}}else{if(c[0]!=="cubic-bezier")return r.error(`Unknown interpolation type ${String(c[0])}`,1,0);{const x=c.slice(1);if(x.length!==4||x.some(w=>typeof w!="number"||w<0||w>1))return r.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);c={name:"cubic-bezier",controlPoints:x}}}if(e.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return r.error("Expected an even number of arguments.");if(h=r.parse(h,2,Se),!h)return null;const m=[];let g=null;o==="interpolate-hcl"||o==="interpolate-lab"?g=oi:r.expectedType&&r.expectedType.kind!=="value"&&(g=r.expectedType);for(let x=0;x<d.length;x+=2){const w=d[x],E=d[x+1],A=x+3,M=x+4;if(typeof w!="number")return r.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',A);if(m.length&&m[m.length-1][0]>=w)return r.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',A);const z=r.parse(E,M,g);if(!z)return null;g=g||z.type,m.push([w,z])}return g.kind==="number"||g.kind==="color"||g.kind==="padding"||g.kind==="array"&&g.itemType.kind==="number"&&typeof g.N=="number"?new Ci(g,o,c,h,m):r.error(`Type ${Tt(g)} is not interpolatable.`)}evaluate(e){const r=this.labels,o=this.outputs;if(r.length===1)return o[0].evaluate(e);const c=this.input.evaluate(e);if(c<=r[0])return o[0].evaluate(e);const h=r.length;if(c>=r[h-1])return o[h-1].evaluate(e);const d=Io(r,c),m=Ci.interpolationFactor(this.interpolation,c,r[d],r[d+1]),g=o[d].evaluate(e),x=o[d+1].evaluate(e);return this.operator==="interpolate"?Xn[this.type.kind.toLowerCase()](g,x,m):this.operator==="interpolate-hcl"?Hn.reverse(Hn.interpolate(Hn.forward(g),Hn.forward(x),m)):Wn.reverse(Wn.interpolate(Wn.forward(g),Wn.forward(x),m))}eachChild(e){e(this.input);for(const r of this.outputs)e(r)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function hs(i,e,r,o){const c=o-r,h=i-r;return c===0?0:e===1?h/c:(Math.pow(e,h)-1)/(Math.pow(e,c)-1)}class Co{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expectected at least one argument.");let o=null;const c=r.expectedType;c&&c.kind!=="value"&&(o=c);const h=[];for(const m of e.slice(1)){const g=r.parse(m,1+h.length,o,void 0,{typeAnnotation:"omit"});if(!g)return null;o=o||g.type,h.push(g)}if(!o)throw new Error("No output type");const d=c&&h.some(m=>tr(c,m.type));return new Co(d?Je:o,h)}evaluate(e){let r,o=null,c=0;for(const h of this.args)if(c++,o=h.evaluate(e),o&&o instanceof K&&!o.available&&(r||(r=o.name),o=null,c===this.args.length&&(o=r)),o!==null)break;return o}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}class Mo{constructor(e,r){this.type=r.type,this.bindings=[].concat(e),this.result=r}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const r of this.bindings)e(r[1]);e(this.result)}static parse(e,r){if(e.length<4)return r.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);const o=[];for(let h=1;h<e.length-1;h+=2){const d=e[h];if(typeof d!="string")return r.error(`Expected string, but found ${typeof d} instead.`,h);if(/[^a-zA-Z0-9_]/.test(d))return r.error("Variable names must contain only alphanumeric characters or '_'.",h);const m=r.parse(e[h+1],h+1);if(!m)return null;o.push([d,m])}const c=r.parse(e[e.length-1],e.length-1,r.expectedType,o);return c?new Mo(o,c):null}outputDefined(){return this.result.outputDefined()}}class ps{constructor(e,r,o){this.type=e,this.index=r,this.input=o}static parse(e,r){if(e.length!==3)return r.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const o=r.parse(e[1],1,Se),c=r.parse(e[2],2,mi(r.expectedType||Je));return o&&c?new ps(c.type.itemType,o,c):null}evaluate(e){const r=this.index.evaluate(e),o=this.input.evaluate(e);if(r<0)throw new De(`Array index out of bounds: ${r} < 0.`);if(r>=o.length)throw new De(`Array index out of bounds: ${r} > ${o.length-1}.`);if(r!==Math.floor(r))throw new De(`Array index must be an integer, but found ${r} instead.`);return o[r]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}}class ds{constructor(e,r){this.type=Ye,this.needle=e,this.haystack=r}static parse(e,r){if(e.length!==3)return r.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const o=r.parse(e[1],1,Je),c=r.parse(e[2],2,Je);return o&&c?jr(o.type,[Ye,et,Se,kr,Je])?new ds(o,c):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${Tt(o.type)} instead`):null}evaluate(e){const r=this.needle.evaluate(e),o=this.haystack.evaluate(e);if(!o)return!1;if(!Xr(r,["boolean","string","number","null"]))throw new De(`Expected first argument to be of type boolean, string, number or null, but found ${Tt(ae(r))} instead.`);if(!Xr(o,["string","array"]))throw new De(`Expected second argument to be of type array or string, but found ${Tt(ae(o))} instead.`);return o.indexOf(r)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}}class zo{constructor(e,r,o){this.type=Se,this.needle=e,this.haystack=r,this.fromIndex=o}static parse(e,r){if(e.length<=2||e.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const o=r.parse(e[1],1,Je),c=r.parse(e[2],2,Je);if(!o||!c)return null;if(!jr(o.type,[Ye,et,Se,kr,Je]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${Tt(o.type)} instead`);if(e.length===4){const h=r.parse(e[3],3,Se);return h?new zo(o,c,h):null}return new zo(o,c)}evaluate(e){const r=this.needle.evaluate(e),o=this.haystack.evaluate(e);if(!Xr(r,["boolean","string","number","null"]))throw new De(`Expected first argument to be of type boolean, string, number or null, but found ${Tt(ae(r))} instead.`);if(!Xr(o,["string","array"]))throw new De(`Expected second argument to be of type array or string, but found ${Tt(ae(o))} instead.`);if(this.fromIndex){const c=this.fromIndex.evaluate(e);return o.indexOf(r,c)}return o.indexOf(r)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}}class fs{constructor(e,r,o,c,h,d){this.inputType=e,this.type=r,this.input=o,this.cases=c,this.outputs=h,this.otherwise=d}static parse(e,r){if(e.length<5)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return r.error("Expected an even number of arguments.");let o,c;r.expectedType&&r.expectedType.kind!=="value"&&(c=r.expectedType);const h={},d=[];for(let x=2;x<e.length-1;x+=2){let w=e[x];const E=e[x+1];Array.isArray(w)||(w=[w]);const A=r.concat(x);if(w.length===0)return A.error("Expected at least one branch label.");for(const z of w){if(typeof z!="number"&&typeof z!="string")return A.error("Branch labels must be numbers or strings.");if(typeof z=="number"&&Math.abs(z)>Number.MAX_SAFE_INTEGER)return A.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof z=="number"&&Math.floor(z)!==z)return A.error("Numeric branch labels must be integer values.");if(o){if(A.checkSubtype(o,ae(z)))return null}else o=ae(z);if(h[String(z)]!==void 0)return A.error("Branch labels must be unique.");h[String(z)]=d.length}const M=r.parse(E,x,c);if(!M)return null;c=c||M.type,d.push(M)}const m=r.parse(e[1],1,Je);if(!m)return null;const g=r.parse(e[e.length-1],e.length-1,c);return g?m.type.kind!=="value"&&r.concat(1).checkSubtype(o,m.type)?null:new fs(o,c,m,h,d,g):null}evaluate(e){const r=this.input.evaluate(e);return(ae(r)===this.inputType&&this.outputs[this.cases[r]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every(e=>e.outputDefined())&&this.otherwise.outputDefined()}}class ms{constructor(e,r,o){this.type=e,this.branches=r,this.otherwise=o}static parse(e,r){if(e.length<4)return r.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return r.error("Expected an odd number of arguments.");let o;r.expectedType&&r.expectedType.kind!=="value"&&(o=r.expectedType);const c=[];for(let d=1;d<e.length-1;d+=2){const m=r.parse(e[d],d,Ye);if(!m)return null;const g=r.parse(e[d+1],d+1,o);if(!g)return null;c.push([m,g]),o=o||g.type}const h=r.parse(e[e.length-1],e.length-1,o);if(!h)return null;if(!o)throw new Error("Can't infer output type");return new ms(o,c,h)}evaluate(e){for(const[r,o]of this.branches)if(r.evaluate(e))return o.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(const[r,o]of this.branches)e(r),e(o);e(this.otherwise)}outputDefined(){return this.branches.every(([e,r])=>r.outputDefined())&&this.otherwise.outputDefined()}}class Po{constructor(e,r,o,c){this.type=e,this.input=r,this.beginIndex=o,this.endIndex=c}static parse(e,r){if(e.length<=2||e.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const o=r.parse(e[1],1,Je),c=r.parse(e[2],2,Se);if(!o||!c)return null;if(!jr(o.type,[mi(Je),et,Je]))return r.error(`Expected first argument to be of type array or string, but found ${Tt(o.type)} instead`);if(e.length===4){const h=r.parse(e[3],3,Se);return h?new Po(o.type,o,c,h):null}return new Po(o.type,o,c)}evaluate(e){const r=this.input.evaluate(e),o=this.beginIndex.evaluate(e);if(!Xr(r,["string","array"]))throw new De(`Expected first argument to be of type array or string, but found ${Tt(ae(r))} instead.`);if(this.endIndex){const c=this.endIndex.evaluate(e);return r.slice(o,c)}return r.slice(o)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}}function pa(i,e){return i==="=="||i==="!="?e.kind==="boolean"||e.kind==="string"||e.kind==="number"||e.kind==="null"||e.kind==="value":e.kind==="string"||e.kind==="number"||e.kind==="value"}function da(i,e,r,o){return o.compare(e,r)===0}function En(i,e,r){const o=i!=="=="&&i!=="!=";return class dh{constructor(h,d,m){this.type=Ye,this.lhs=h,this.rhs=d,this.collator=m,this.hasUntypedArgument=h.type.kind==="value"||d.type.kind==="value"}static parse(h,d){if(h.length!==3&&h.length!==4)return d.error("Expected two or three arguments.");const m=h[0];let g=d.parse(h[1],1,Je);if(!g)return null;if(!pa(m,g.type))return d.concat(1).error(`"${m}" comparisons are not supported for type '${Tt(g.type)}'.`);let x=d.parse(h[2],2,Je);if(!x)return null;if(!pa(m,x.type))return d.concat(2).error(`"${m}" comparisons are not supported for type '${Tt(x.type)}'.`);if(g.type.kind!==x.type.kind&&g.type.kind!=="value"&&x.type.kind!=="value")return d.error(`Cannot compare types '${Tt(g.type)}' and '${Tt(x.type)}'.`);o&&(g.type.kind==="value"&&x.type.kind!=="value"?g=new Xe(x.type,[g]):g.type.kind!=="value"&&x.type.kind==="value"&&(x=new Xe(g.type,[x])));let w=null;if(h.length===4){if(g.type.kind!=="string"&&x.type.kind!=="string"&&g.type.kind!=="value"&&x.type.kind!=="value")return d.error("Cannot use collator to compare non-string types.");if(w=d.parse(h[3],3,gr),!w)return null}return new dh(g,x,w)}evaluate(h){const d=this.lhs.evaluate(h),m=this.rhs.evaluate(h);if(o&&this.hasUntypedArgument){const g=ae(d),x=ae(m);if(g.kind!==x.kind||g.kind!=="string"&&g.kind!=="number")throw new De(`Expected arguments for "${i}" to be (string, string) or (number, number), but found (${g.kind}, ${x.kind}) instead.`)}if(this.collator&&!o&&this.hasUntypedArgument){const g=ae(d),x=ae(m);if(g.kind!=="string"||x.kind!=="string")return e(h,d,m)}return this.collator?r(h,d,m,this.collator.evaluate(h)):e(h,d,m)}eachChild(h){h(this.lhs),h(this.rhs),this.collator&&h(this.collator)}outputDefined(){return!0}}}const yl=En("==",function(i,e,r){return e===r},da),xl=En("!=",function(i,e,r){return e!==r},function(i,e,r,o){return!da(0,e,r,o)}),vl=En("<",function(i,e,r){return e<r},function(i,e,r,o){return o.compare(e,r)<0}),bl=En(">",function(i,e,r){return e>r},function(i,e,r,o){return o.compare(e,r)>0}),wl=En("<=",function(i,e,r){return e<=r},function(i,e,r,o){return o.compare(e,r)<=0}),Tl=En(">=",function(i,e,r){return e>=r},function(i,e,r,o){return o.compare(e,r)>=0});class gs{constructor(e,r,o,c,h){this.type=et,this.number=e,this.locale=r,this.currency=o,this.minFractionDigits=c,this.maxFractionDigits=h}static parse(e,r){if(e.length!==3)return r.error("Expected two arguments.");const o=r.parse(e[1],1,Se);if(!o)return null;const c=e[2];if(typeof c!="object"||Array.isArray(c))return r.error("NumberFormat options argument must be an object.");let h=null;if(c.locale&&(h=r.parse(c.locale,1,et),!h))return null;let d=null;if(c.currency&&(d=r.parse(c.currency,1,et),!d))return null;let m=null;if(c["min-fraction-digits"]&&(m=r.parse(c["min-fraction-digits"],1,Se),!m))return null;let g=null;return c["max-fraction-digits"]&&(g=r.parse(c["max-fraction-digits"],1,Se),!g)?null:new gs(o,h,d,m,g)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}}class ko{constructor(e){this.type=Yt,this.sections=e}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");const o=e[1];if(!Array.isArray(o)&&typeof o=="object")return r.error("First argument must be an image or text section.");const c=[];let h=!1;for(let d=1;d<=e.length-1;++d){const m=e[d];if(h&&typeof m=="object"&&!Array.isArray(m)){h=!1;let g=null;if(m["font-scale"]&&(g=r.parse(m["font-scale"],1,Se),!g))return null;let x=null;if(m["text-font"]&&(x=r.parse(m["text-font"],1,mi(et)),!x))return null;let w=null;if(m["text-color"]&&(w=r.parse(m["text-color"],1,oi),!w))return null;const E=c[c.length-1];E.scale=g,E.font=x,E.textColor=w}else{const g=r.parse(e[d],1,Je);if(!g)return null;const x=g.type.kind;if(x!=="string"&&x!=="value"&&x!=="null"&&x!=="resolvedImage")return r.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");h=!0,c.push({content:g,scale:null,font:null,textColor:null})}}return new ko(c)}evaluate(e){return new Z(this.sections.map(r=>{const o=r.content.evaluate(e);return ae(o)===qt?new H("",o,null,null,null):new H(Oe(o),null,r.scale?r.scale.evaluate(e):null,r.font?r.font.evaluate(e).join(","):null,r.textColor?r.textColor.evaluate(e):null)}))}eachChild(e){for(const r of this.sections)e(r.content),r.scale&&e(r.scale),r.font&&e(r.font),r.textColor&&e(r.textColor)}outputDefined(){return!1}}class _s{constructor(e){this.type=qt,this.input=e}static parse(e,r){if(e.length!==2)return r.error("Expected two arguments.");const o=r.parse(e[1],1,et);return o?new _s(o):r.error("No image name provided.")}evaluate(e){const r=this.input.evaluate(e),o=K.fromString(r);return o&&e.availableImages&&(o.available=e.availableImages.indexOf(r)>-1),o}eachChild(e){e(this.input)}outputDefined(){return!1}}class ys{constructor(e){this.type=Se,this.input=e}static parse(e,r){if(e.length!==2)return r.error(`Expected 1 argument, but found ${e.length-1} instead.`);const o=r.parse(e[1],1);return o?o.type.kind!=="array"&&o.type.kind!=="string"&&o.type.kind!=="value"?r.error(`Expected argument of type string or array, but found ${Tt(o.type)} instead.`):new ys(o):null}evaluate(e){const r=this.input.evaluate(e);if(typeof r=="string"||Array.isArray(r))return r.length;throw new De(`Expected value to be of type string or array, but found ${Tt(ae(r))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}}const Sn={"==":yl,"!=":xl,">":bl,"<":vl,">=":Tl,"<=":wl,array:Xe,at:ps,boolean:Xe,case:ms,coalesce:Co,collator:Qt,format:ko,image:_s,in:ds,"index-of":zo,interpolate:Ci,"interpolate-hcl":Ci,"interpolate-lab":Ci,length:ys,let:Mo,literal:$e,match:fs,number:Xe,"number-format":gs,object:Xe,slice:Po,step:jn,string:Xe,"to-boolean":Ke,"to-color":Ke,"to-number":Ke,"to-string":Ke,var:So,within:Hr};function fa(i,[e,r,o,c]){e=e.evaluate(i),r=r.evaluate(i),o=o.evaluate(i);const h=c?c.evaluate(i):1,d=le(e,r,o,h);if(d)throw new De(d);return new D(e/255*h,r/255*h,o/255*h,h)}function ma(i,e){return i in e}function Do(i,e){const r=e[i];return r===void 0?null:r}function Kr(i){return{type:i}}function ga(i){return{result:"success",value:i}}function In(i){return{result:"error",value:i}}function zt(i){return i["property-type"]==="data-driven"||i["property-type"]==="cross-faded-data-driven"}function _a(i){return!!i.expression&&i.expression.parameters.indexOf("zoom")>-1}function at(i){return!!i.expression&&i.expression.interpolated}function yt(i){return i instanceof Number?"number":i instanceof String?"string":i instanceof Boolean?"boolean":Array.isArray(i)?"array":i===null?"null":typeof i}function Ct(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)}function Lt(i){return i}function Kn(i,e){const r=e.type==="color",o=i.stops&&typeof i.stops[0][0]=="object",c=o||!(o||i.property!==void 0),h=i.type||(at(e)?"exponential":"interval");if(r||e.type==="padding"){const x=r?D.parse:q.parse;(i=ji({},i)).stops&&(i.stops=i.stops.map(w=>[w[0],x(w[1])])),i.default=x(i.default?i.default:e.default)}if(i.colorSpace&&i.colorSpace!=="rgb"&&!ha[i.colorSpace])throw new Error(`Unknown color space: ${i.colorSpace}`);let d,m,g;if(h==="exponential")d=ya;else if(h==="interval")d=Sl;else if(h==="categorical"){d=El,m=Object.create(null);for(const x of i.stops)m[x[0]]=x[1];g=typeof i.stops[0][0]}else{if(h!=="identity")throw new Error(`Unknown function type "${h}"`);d=Il}if(o){const x={},w=[];for(let M=0;M<i.stops.length;M++){const z=i.stops[M],V=z[0].zoom;x[V]===void 0&&(x[V]={zoom:V,type:i.type,property:i.property,default:i.default,stops:[]},w.push(V)),x[V].stops.push([z[0].value,z[1]])}const E=[];for(const M of w)E.push([x[M].zoom,Kn(x[M],e)]);const A={name:"linear"};return{kind:"composite",interpolationType:A,interpolationFactor:Ci.interpolationFactor.bind(void 0,A),zoomStops:E.map(M=>M[0]),evaluate:({zoom:M},z)=>ya({stops:E,base:i.base},e,M).evaluate(M,z)}}if(c){const x=h==="exponential"?{name:"exponential",base:i.base!==void 0?i.base:1}:null;return{kind:"camera",interpolationType:x,interpolationFactor:Ci.interpolationFactor.bind(void 0,x),zoomStops:i.stops.map(w=>w[0]),evaluate:({zoom:w})=>d(i,e,w,m,g)}}return{kind:"source",evaluate(x,w){const E=w&&w.properties?w.properties[i.property]:void 0;return E===void 0?An(i.default,e.default):d(i,e,E,m,g)}}}function An(i,e,r){return i!==void 0?i:e!==void 0?e:r!==void 0?r:void 0}function El(i,e,r,o,c){return An(typeof r===c?o[r]:void 0,i.default,e.default)}function Sl(i,e,r){if(yt(r)!=="number")return An(i.default,e.default);const o=i.stops.length;if(o===1||r<=i.stops[0][0])return i.stops[0][1];if(r>=i.stops[o-1][0])return i.stops[o-1][1];const c=Io(i.stops.map(h=>h[0]),r);return i.stops[c][1]}function ya(i,e,r){const o=i.base!==void 0?i.base:1;if(yt(r)!=="number")return An(i.default,e.default);const c=i.stops.length;if(c===1||r<=i.stops[0][0])return i.stops[0][1];if(r>=i.stops[c-1][0])return i.stops[c-1][1];const h=Io(i.stops.map(w=>w[0]),r),d=function(w,E,A,M){const z=M-A,V=w-A;return z===0?0:E===1?V/z:(Math.pow(E,V)-1)/(Math.pow(E,z)-1)}(r,o,i.stops[h][0],i.stops[h+1][0]),m=i.stops[h][1],g=i.stops[h+1][1];let x=Xn[e.type]||Lt;if(i.colorSpace&&i.colorSpace!=="rgb"){const w=ha[i.colorSpace];x=(E,A)=>w.reverse(w.interpolate(w.forward(E),w.forward(A),d))}return typeof m.evaluate=="function"?{evaluate(...w){const E=m.evaluate.apply(void 0,w),A=g.evaluate.apply(void 0,w);if(E!==void 0&&A!==void 0)return x(E,A,d)}}:x(m,g,d)}function Il(i,e,r){switch(e.type){case"color":r=D.parse(r);break;case"formatted":r=Z.fromString(r.toString());break;case"resolvedImage":r=K.fromString(r.toString());break;case"padding":r=q.parse(r);break;default:yt(r)===e.type||e.type==="enum"&&e.values[r]||(r=void 0)}return An(r,i.default,e.default)}St.register(Sn,{error:[{kind:"error"},[et],(i,[e])=>{throw new De(e.evaluate(i))}],typeof:[et,[Je],(i,[e])=>Tt(ae(e.evaluate(i)))],"to-rgba":[mi(Se,4),[oi],(i,[e])=>e.evaluate(i).toArray()],rgb:[oi,[Se,Se,Se],fa],rgba:[oi,[Se,Se,Se,Se],fa],has:{type:Ye,overloads:[[[et],(i,[e])=>ma(e.evaluate(i),i.properties())],[[et,Dr],(i,[e,r])=>ma(e.evaluate(i),r.evaluate(i))]]},get:{type:Je,overloads:[[[et],(i,[e])=>Do(e.evaluate(i),i.properties())],[[et,Dr],(i,[e,r])=>Do(e.evaluate(i),r.evaluate(i))]]},"feature-state":[Je,[et],(i,[e])=>Do(e.evaluate(i),i.featureState||{})],properties:[Dr,[],i=>i.properties()],"geometry-type":[et,[],i=>i.geometryType()],id:[Je,[],i=>i.id()],zoom:[Se,[],i=>i.globals.zoom],"heatmap-density":[Se,[],i=>i.globals.heatmapDensity||0],"line-progress":[Se,[],i=>i.globals.lineProgress||0],accumulated:[Je,[],i=>i.globals.accumulated===void 0?null:i.globals.accumulated],"+":[Se,Kr(Se),(i,e)=>{let r=0;for(const o of e)r+=o.evaluate(i);return r}],"*":[Se,Kr(Se),(i,e)=>{let r=1;for(const o of e)r*=o.evaluate(i);return r}],"-":{type:Se,overloads:[[[Se,Se],(i,[e,r])=>e.evaluate(i)-r.evaluate(i)],[[Se],(i,[e])=>-e.evaluate(i)]]},"/":[Se,[Se,Se],(i,[e,r])=>e.evaluate(i)/r.evaluate(i)],"%":[Se,[Se,Se],(i,[e,r])=>e.evaluate(i)%r.evaluate(i)],ln2:[Se,[],()=>Math.LN2],pi:[Se,[],()=>Math.PI],e:[Se,[],()=>Math.E],"^":[Se,[Se,Se],(i,[e,r])=>Math.pow(e.evaluate(i),r.evaluate(i))],sqrt:[Se,[Se],(i,[e])=>Math.sqrt(e.evaluate(i))],log10:[Se,[Se],(i,[e])=>Math.log(e.evaluate(i))/Math.LN10],ln:[Se,[Se],(i,[e])=>Math.log(e.evaluate(i))],log2:[Se,[Se],(i,[e])=>Math.log(e.evaluate(i))/Math.LN2],sin:[Se,[Se],(i,[e])=>Math.sin(e.evaluate(i))],cos:[Se,[Se],(i,[e])=>Math.cos(e.evaluate(i))],tan:[Se,[Se],(i,[e])=>Math.tan(e.evaluate(i))],asin:[Se,[Se],(i,[e])=>Math.asin(e.evaluate(i))],acos:[Se,[Se],(i,[e])=>Math.acos(e.evaluate(i))],atan:[Se,[Se],(i,[e])=>Math.atan(e.evaluate(i))],min:[Se,Kr(Se),(i,e)=>Math.min(...e.map(r=>r.evaluate(i)))],max:[Se,Kr(Se),(i,e)=>Math.max(...e.map(r=>r.evaluate(i)))],abs:[Se,[Se],(i,[e])=>Math.abs(e.evaluate(i))],round:[Se,[Se],(i,[e])=>{const r=e.evaluate(i);return r<0?-Math.round(-r):Math.round(r)}],floor:[Se,[Se],(i,[e])=>Math.floor(e.evaluate(i))],ceil:[Se,[Se],(i,[e])=>Math.ceil(e.evaluate(i))],"filter-==":[Ye,[et,Je],(i,[e,r])=>i.properties()[e.value]===r.value],"filter-id-==":[Ye,[Je],(i,[e])=>i.id()===e.value],"filter-type-==":[Ye,[et],(i,[e])=>i.geometryType()===e.value],"filter-<":[Ye,[et,Je],(i,[e,r])=>{const o=i.properties()[e.value],c=r.value;return typeof o==typeof c&&o<c}],"filter-id-<":[Ye,[Je],(i,[e])=>{const r=i.id(),o=e.value;return typeof r==typeof o&&r<o}],"filter->":[Ye,[et,Je],(i,[e,r])=>{const o=i.properties()[e.value],c=r.value;return typeof o==typeof c&&o>c}],"filter-id->":[Ye,[Je],(i,[e])=>{const r=i.id(),o=e.value;return typeof r==typeof o&&r>o}],"filter-<=":[Ye,[et,Je],(i,[e,r])=>{const o=i.properties()[e.value],c=r.value;return typeof o==typeof c&&o<=c}],"filter-id-<=":[Ye,[Je],(i,[e])=>{const r=i.id(),o=e.value;return typeof r==typeof o&&r<=o}],"filter->=":[Ye,[et,Je],(i,[e,r])=>{const o=i.properties()[e.value],c=r.value;return typeof o==typeof c&&o>=c}],"filter-id->=":[Ye,[Je],(i,[e])=>{const r=i.id(),o=e.value;return typeof r==typeof o&&r>=o}],"filter-has":[Ye,[Je],(i,[e])=>e.value in i.properties()],"filter-has-id":[Ye,[],i=>i.id()!==null&&i.id()!==void 0],"filter-type-in":[Ye,[mi(et)],(i,[e])=>e.value.indexOf(i.geometryType())>=0],"filter-id-in":[Ye,[mi(Je)],(i,[e])=>e.value.indexOf(i.id())>=0],"filter-in-small":[Ye,[et,mi(Je)],(i,[e,r])=>r.value.indexOf(i.properties()[e.value])>=0],"filter-in-large":[Ye,[et,mi(Je)],(i,[e,r])=>function(o,c,h,d){for(;h<=d;){const m=h+d>>1;if(c[m]===o)return!0;c[m]>o?d=m-1:h=m+1}return!1}(i.properties()[e.value],r.value,0,r.value.length-1)],all:{type:Ye,overloads:[[[Ye,Ye],(i,[e,r])=>e.evaluate(i)&&r.evaluate(i)],[Kr(Ye),(i,e)=>{for(const r of e)if(!r.evaluate(i))return!1;return!0}]]},any:{type:Ye,overloads:[[[Ye,Ye],(i,[e,r])=>e.evaluate(i)||r.evaluate(i)],[Kr(Ye),(i,e)=>{for(const r of e)if(r.evaluate(i))return!0;return!1}]]},"!":[Ye,[Ye],(i,[e])=>!e.evaluate(i)],"is-supported-script":[Ye,[et],(i,[e])=>{const r=i.globals&&i.globals.isSupportedScript;return!r||r(e.evaluate(i))}],upcase:[et,[et],(i,[e])=>e.evaluate(i).toUpperCase()],downcase:[et,[et],(i,[e])=>e.evaluate(i).toLowerCase()],concat:[et,Kr(Je),(i,e)=>e.map(r=>Oe(r.evaluate(i))).join("")],"resolved-locale":[et,[gr],(i,[e])=>e.evaluate(i).resolvedLocale()]});class Lo{constructor(e,r){this.expression=e,this._warningHistory={},this._evaluator=new ft,this._defaultValue=r?function(o){return o.type==="color"&&Ct(o.default)?new D(0,0,0,0):o.type==="color"?D.parse(o.default)||null:o.type==="padding"?q.parse(o.default)||null:o.default===void 0?null:o.default}(r):null,this._enumValues=r&&r.type==="enum"?r.values:null}evaluateWithoutErrorHandling(e,r,o,c,h,d){return this._evaluator.globals=e,this._evaluator.feature=r,this._evaluator.featureState=o,this._evaluator.canonical=c,this._evaluator.availableImages=h||null,this._evaluator.formattedSection=d,this.expression.evaluate(this._evaluator)}evaluate(e,r,o,c,h,d){this._evaluator.globals=e,this._evaluator.feature=r||null,this._evaluator.featureState=o||null,this._evaluator.canonical=c,this._evaluator.availableImages=h||null,this._evaluator.formattedSection=d||null;try{const m=this.expression.evaluate(this._evaluator);if(m==null||typeof m=="number"&&m!=m)return this._defaultValue;if(this._enumValues&&!(m in this._enumValues))throw new De(`Expected value to be one of ${Object.keys(this._enumValues).map(g=>JSON.stringify(g)).join(", ")}, but found ${JSON.stringify(m)} instead.`);return m}catch(m){return this._warningHistory[m.message]||(this._warningHistory[m.message]=!0,typeof console<"u"&&console.warn(m.message)),this._defaultValue}}}function Jn(i){return Array.isArray(i)&&i.length>0&&typeof i[0]=="string"&&i[0]in Sn}function Yn(i,e){const r=new Tn(Sn,[],e?function(c){const h={color:oi,string:et,number:Se,enum:et,boolean:Ye,formatted:Yt,padding:yn,resolvedImage:qt};return c.type==="array"?mi(h[c.value]||Je,c.length):h[c.type]}(e):void 0),o=r.parse(i,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return o?ga(new Lo(o,e)):In(r.errors)}class Qn{constructor(e,r){this.kind=e,this._styleExpression=r,this.isStateDependent=e!=="constant"&&!wn(r.expression)}evaluateWithoutErrorHandling(e,r,o,c,h,d){return this._styleExpression.evaluateWithoutErrorHandling(e,r,o,c,h,d)}evaluate(e,r,o,c,h,d){return this._styleExpression.evaluate(e,r,o,c,h,d)}}class xs{constructor(e,r,o,c){this.kind=e,this.zoomStops=o,this._styleExpression=r,this.isStateDependent=e!=="camera"&&!wn(r.expression),this.interpolationType=c}evaluateWithoutErrorHandling(e,r,o,c,h,d){return this._styleExpression.evaluateWithoutErrorHandling(e,r,o,c,h,d)}evaluate(e,r,o,c,h,d){return this._styleExpression.evaluate(e,r,o,c,h,d)}interpolationFactor(e,r,o){return this.interpolationType?Ci.interpolationFactor(this.interpolationType,e,r,o):0}}function xa(i,e){const r=Yn(i,e);if(r.result==="error")return r;const o=r.value.expression,c=Zn(o);if(!c&&!zt(e))return In([new Ii("","data expressions not supported")]);const h=Eo(o,["zoom"]);if(!h&&!_a(e))return In([new Ii("","zoom expressions not supported")]);const d=Bo(o);return d||h?d instanceof Ii?In([d]):d instanceof Ci&&!at(e)?In([new Ii("",'"interpolate" expressions cannot be used with this property')]):ga(d?new xs(c?"camera":"composite",r.value,d.labels,d instanceof Ci?d.interpolation:void 0):new Qn(c?"constant":"source",r.value)):In([new Ii("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Ro{constructor(e,r){this._parameters=e,this._specification=r,ji(this,Kn(this._parameters,this._specification))}static deserialize(e){return new Ro(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function Bo(i){let e=null;if(i instanceof Mo)e=Bo(i.result);else if(i instanceof Co){for(const r of i.args)if(e=Bo(r),e)break}else(i instanceof jn||i instanceof Ci)&&i.input instanceof St&&i.input.name==="zoom"&&(e=i);return e instanceof Ii||i.eachChild(r=>{const o=Bo(r);o instanceof Ii?e=o:!e&&o?e=new Ii("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&o&&e!==o&&(e=new Ii("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}function Xi(i){const e=i.key,r=i.value,o=i.valueSpec||{},c=i.objectElementValidators||{},h=i.style,d=i.styleSpec;let m=[];const g=yt(r);if(g!=="object")return[new Ce(e,r,`object expected, ${g} found`)];for(const x in r){const w=x.split(".")[0],E=o[w]||o["*"];let A;if(c[w])A=c[w];else if(o[w])A=zi;else if(c["*"])A=c["*"];else{if(!o["*"]){m.push(new Ce(e,r[x],`unknown property "${x}"`));continue}A=zi}m=m.concat(A({key:(e&&`${e}.`)+x,value:r[x],valueSpec:E,style:h,styleSpec:d,object:r,objectKey:x},r))}for(const x in o)c[x]||o[x].required&&o[x].default===void 0&&r[x]===void 0&&m.push(new Ce(e,r,`missing required property "${x}"`));return m}function va(i){const e=i.value,r=i.valueSpec,o=i.style,c=i.styleSpec,h=i.key,d=i.arrayElementValidator||zi;if(yt(e)!=="array")return[new Ce(h,e,`array expected, ${yt(e)} found`)];if(r.length&&e.length!==r.length)return[new Ce(h,e,`array length ${r.length} expected, length ${e.length} found`)];if(r["min-length"]&&e.length<r["min-length"])return[new Ce(h,e,`array length at least ${r["min-length"]} expected, length ${e.length} found`)];let m={type:r.value,values:r.values};c.$version<7&&(m.function=r.function),yt(r.value)==="object"&&(m=r.value);let g=[];for(let x=0;x<e.length;x++)g=g.concat(d({array:e,arrayIndex:x,value:e[x],valueSpec:m,style:o,styleSpec:c,key:`${h}[${x}]`}));return g}function vs(i){const e=i.key,r=i.value,o=i.valueSpec;let c=yt(r);return c==="number"&&r!=r&&(c="NaN"),c!=="number"?[new Ce(e,r,`number expected, ${c} found`)]:"minimum"in o&&r<o.minimum?[new Ce(e,r,`${r} is less than the minimum value ${o.minimum}`)]:"maximum"in o&&r>o.maximum?[new Ce(e,r,`${r} is greater than the maximum value ${o.maximum}`)]:[]}function ba(i){const e=i.valueSpec,r=pt(i.value.type);let o,c,h,d={};const m=r!=="categorical"&&i.value.property===void 0,g=!m,x=yt(i.value.stops)==="array"&&yt(i.value.stops[0])==="array"&&yt(i.value.stops[0][0])==="object",w=Xi({key:i.key,value:i.value,valueSpec:i.styleSpec.function,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{stops:function(M){if(r==="identity")return[new Ce(M.key,M.value,'identity function may not have a "stops" property')];let z=[];const V=M.value;return z=z.concat(va({key:M.key,value:V,valueSpec:M.valueSpec,style:M.style,styleSpec:M.styleSpec,arrayElementValidator:E})),yt(V)==="array"&&V.length===0&&z.push(new Ce(M.key,V,"array must have at least one stop")),z},default:function(M){return zi({key:M.key,value:M.value,valueSpec:e,style:M.style,styleSpec:M.styleSpec})}}});return r==="identity"&&m&&w.push(new Ce(i.key,i.value,'missing required property "property"')),r==="identity"||i.value.stops||w.push(new Ce(i.key,i.value,'missing required property "stops"')),r==="exponential"&&i.valueSpec.expression&&!at(i.valueSpec)&&w.push(new Ce(i.key,i.value,"exponential functions not supported")),i.styleSpec.$version>=8&&(g&&!zt(i.valueSpec)?w.push(new Ce(i.key,i.value,"property functions not supported")):m&&!_a(i.valueSpec)&&w.push(new Ce(i.key,i.value,"zoom functions not supported"))),r!=="categorical"&&!x||i.value.property!==void 0||w.push(new Ce(i.key,i.value,'"property" property is required')),w;function E(M){let z=[];const V=M.value,U=M.key;if(yt(V)!=="array")return[new Ce(U,V,`array expected, ${yt(V)} found`)];if(V.length!==2)return[new Ce(U,V,`array length 2 expected, length ${V.length} found`)];if(x){if(yt(V[0])!=="object")return[new Ce(U,V,`object expected, ${yt(V[0])} found`)];if(V[0].zoom===void 0)return[new Ce(U,V,"object stop key must have zoom")];if(V[0].value===void 0)return[new Ce(U,V,"object stop key must have value")];if(h&&h>pt(V[0].zoom))return[new Ce(U,V[0].zoom,"stop zoom values must appear in ascending order")];pt(V[0].zoom)!==h&&(h=pt(V[0].zoom),c=void 0,d={}),z=z.concat(Xi({key:`${U}[0]`,value:V[0],valueSpec:{zoom:{}},style:M.style,styleSpec:M.styleSpec,objectElementValidators:{zoom:vs,value:A}}))}else z=z.concat(A({key:`${U}[0]`,value:V[0],valueSpec:{},style:M.style,styleSpec:M.styleSpec},V));return Jn(Oi(V[1]))?z.concat([new Ce(`${U}[1]`,V[1],"expressions are not allowed in function stops.")]):z.concat(zi({key:`${U}[1]`,value:V[1],valueSpec:e,style:M.style,styleSpec:M.styleSpec}))}function A(M,z){const V=yt(M.value),U=pt(M.value),ee=M.value!==null?M.value:z;if(o){if(V!==o)return[new Ce(M.key,ee,`${V} stop domain type must match previous stop domain type ${o}`)]}else o=V;if(V!=="number"&&V!=="string"&&V!=="boolean")return[new Ce(M.key,ee,"stop domain value must be a number, string, or boolean")];if(V!=="number"&&r!=="categorical"){let oe=`number expected, ${V} found`;return zt(e)&&r===void 0&&(oe+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new Ce(M.key,ee,oe)]}return r!=="categorical"||V!=="number"||isFinite(U)&&Math.floor(U)===U?r!=="categorical"&&V==="number"&&c!==void 0&&U<c?[new Ce(M.key,ee,"stop domain values must appear in ascending order")]:(c=U,r==="categorical"&&U in d?[new Ce(M.key,ee,"stop domain values must be unique")]:(d[U]=!0,[])):[new Ce(M.key,ee,`integer expected, found ${U}`)]}}function Jr(i){const e=(i.expressionContext==="property"?xa:Yn)(Oi(i.value),i.valueSpec);if(e.result==="error")return e.value.map(o=>new Ce(`${i.key}${o.key}`,i.value,o.message));const r=e.value.expression||e.value._styleExpression.expression;if(i.expressionContext==="property"&&i.propertyKey==="text-font"&&!r.outputDefined())return[new Ce(i.key,i.value,`Invalid data expression for "${i.propertyKey}". Output values must be contained as literals within the expression.`)];if(i.expressionContext==="property"&&i.propertyType==="layout"&&!wn(r))return[new Ce(i.key,i.value,'"feature-state" data expressions are not supported with layout properties.')];if(i.expressionContext==="filter"&&!wn(r))return[new Ce(i.key,i.value,'"feature-state" data expressions are not supported with filters.')];if(i.expressionContext&&i.expressionContext.indexOf("cluster")===0){if(!Eo(r,["zoom","feature-state"]))return[new Ce(i.key,i.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(i.expressionContext==="cluster-initial"&&!Zn(r))return[new Ce(i.key,i.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function eo(i){const e=i.key,r=i.value,o=i.valueSpec,c=[];return Array.isArray(o.values)?o.values.indexOf(pt(r))===-1&&c.push(new Ce(e,r,`expected one of [${o.values.join(", ")}], ${JSON.stringify(r)} found`)):Object.keys(o.values).indexOf(pt(r))===-1&&c.push(new Ce(e,r,`expected one of [${Object.keys(o.values).join(", ")}], ${JSON.stringify(r)} found`)),c}function Cn(i){if(i===!0||i===!1)return!0;if(!Array.isArray(i)||i.length===0)return!1;switch(i[0]){case"has":return i.length>=2&&i[1]!=="$id"&&i[1]!=="$type";case"in":return i.length>=3&&(typeof i[1]!="string"||Array.isArray(i[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return i.length!==3||Array.isArray(i[1])||Array.isArray(i[2]);case"any":case"all":for(const e of i.slice(1))if(!Cn(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}const Al={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Fo(i){if(i==null)return{filter:()=>!0,needGeometry:!1};Cn(i)||(i=to(i));const e=Yn(i,Al);if(e.result==="error")throw new Error(e.value.map(r=>`${r.key}: ${r.message}`).join(", "));return{filter:(r,o,c)=>e.value.evaluate(r,o,{},c),needGeometry:Ta(i)}}function wa(i,e){return i<e?-1:i>e?1:0}function Ta(i){if(!Array.isArray(i))return!1;if(i[0]==="within")return!0;for(let e=1;e<i.length;e++)if(Ta(i[e]))return!0;return!1}function to(i){if(!i)return!0;const e=i[0];return i.length<=1?e!=="any":e==="=="?bs(i[1],i[2],"=="):e==="!="?Mn(bs(i[1],i[2],"==")):e==="<"||e===">"||e==="<="||e===">="?bs(i[1],i[2],e):e==="any"?(r=i.slice(1),["any"].concat(r.map(to))):e==="all"?["all"].concat(i.slice(1).map(to)):e==="none"?["all"].concat(i.slice(1).map(to).map(Mn)):e==="in"?Oo(i[1],i.slice(2)):e==="!in"?Mn(Oo(i[1],i.slice(2))):e==="has"?io(i[1]):e==="!has"?Mn(io(i[1])):e!=="within"||i;var r}function bs(i,e,r){switch(i){case"$type":return[`filter-type-${r}`,e];case"$id":return[`filter-id-${r}`,e];default:return[`filter-${r}`,i,e]}}function Oo(i,e){if(e.length===0)return!1;switch(i){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(r=>typeof r!=typeof e[0])?["filter-in-large",i,["literal",e.sort(wa)]]:["filter-in-small",i,["literal",e]]}}function io(i){switch(i){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",i]}}function Mn(i){return["!",i]}function ro(i){return Cn(Oi(i.value))?Jr(ji({},i,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Ea(i)}function Ea(i){const e=i.value,r=i.key;if(yt(e)!=="array")return[new Ce(r,e,`array expected, ${yt(e)} found`)];const o=i.styleSpec;let c,h=[];if(e.length<1)return[new Ce(r,e,"filter array must have at least 1 element")];switch(h=h.concat(eo({key:`${r}[0]`,value:e[0],valueSpec:o.filter_operator,style:i.style,styleSpec:i.styleSpec})),pt(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&pt(e[1])==="$type"&&h.push(new Ce(r,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":e.length!==3&&h.push(new Ce(r,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(c=yt(e[1]),c!=="string"&&h.push(new Ce(`${r}[1]`,e[1],`string expected, ${c} found`)));for(let d=2;d<e.length;d++)c=yt(e[d]),pt(e[1])==="$type"?h=h.concat(eo({key:`${r}[${d}]`,value:e[d],valueSpec:o.geometry_type,style:i.style,styleSpec:i.styleSpec})):c!=="string"&&c!=="number"&&c!=="boolean"&&h.push(new Ce(`${r}[${d}]`,e[d],`string, number, or boolean expected, ${c} found`));break;case"any":case"all":case"none":for(let d=1;d<e.length;d++)h=h.concat(Ea({key:`${r}[${d}]`,value:e[d],style:i.style,styleSpec:i.styleSpec}));break;case"has":case"!has":c=yt(e[1]),e.length!==2?h.push(new Ce(r,e,`filter array for "${e[0]}" operator must have 2 elements`)):c!=="string"&&h.push(new Ce(`${r}[1]`,e[1],`string expected, ${c} found`));break;case"within":c=yt(e[1]),e.length!==2?h.push(new Ce(r,e,`filter array for "${e[0]}" operator must have 2 elements`)):c!=="object"&&h.push(new Ce(`${r}[1]`,e[1],`object expected, ${c} found`))}return h}function no(i,e){const r=i.key,o=i.style,c=i.styleSpec,h=i.value,d=i.objectKey,m=c[`${e}_${i.layerType}`];if(!m)return[];const g=d.match(/^(.*)-transition$/);if(e==="paint"&&g&&m[g[1]]&&m[g[1]].transition)return zi({key:r,value:h,valueSpec:c.transition,style:o,styleSpec:c});const x=i.valueSpec||m[d];if(!x)return[new Ce(r,h,`unknown property "${d}"`)];let w;if(yt(h)==="string"&&zt(x)&&!x.tokens&&(w=/^{([^}]+)}$/.exec(h)))return[new Ce(r,h,`"${d}" does not support interpolation syntax
|
|
2
|
+
Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(w[1])} }\`.`)];const E=[];return i.layerType==="symbol"&&(d==="text-field"&&o&&!o.glyphs&&E.push(new Ce(r,h,'use of "text-field" requires a style "glyphs" property')),d==="text-font"&&Ct(Oi(h))&&pt(h.type)==="identity"&&E.push(new Ce(r,h,'"text-font" does not support identity functions'))),E.concat(zi({key:i.key,value:h,valueSpec:x,style:o,styleSpec:c,expressionContext:"property",propertyType:e,propertyKey:d}))}function Sa(i){return no(i,"paint")}function Ia(i){return no(i,"layout")}function Aa(i){let e=[];const r=i.value,o=i.key,c=i.style,h=i.styleSpec;r.type||r.ref||e.push(new Ce(o,r,'either "type" or "ref" is required'));let d=pt(r.type);const m=pt(r.ref);if(r.id){const g=pt(r.id);for(let x=0;x<i.arrayIndex;x++){const w=c.layers[x];pt(w.id)===g&&e.push(new Ce(o,r.id,`duplicate layer id "${r.id}", previously used at line ${w.id.__line__}`))}}if("ref"in r){let g;["type","source","source-layer","filter","layout"].forEach(x=>{x in r&&e.push(new Ce(o,r[x],`"${x}" is prohibited for ref layers`))}),c.layers.forEach(x=>{pt(x.id)===m&&(g=x)}),g?g.ref?e.push(new Ce(o,r.ref,"ref cannot reference another ref layer")):d=pt(g.type):e.push(new Ce(o,r.ref,`ref layer "${m}" not found`))}else if(d!=="background")if(r.source){const g=c.sources&&c.sources[r.source],x=g&&pt(g.type);g?x==="vector"&&d==="raster"?e.push(new Ce(o,r.source,`layer "${r.id}" requires a raster source`)):x==="raster"&&d!=="raster"?e.push(new Ce(o,r.source,`layer "${r.id}" requires a vector source`)):x!=="vector"||r["source-layer"]?x==="raster-dem"&&d!=="hillshade"?e.push(new Ce(o,r.source,"raster-dem source can only be used with layer type 'hillshade'.")):d!=="line"||!r.paint||!r.paint["line-gradient"]||x==="geojson"&&g.lineMetrics||e.push(new Ce(o,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):e.push(new Ce(o,r,`layer "${r.id}" must specify a "source-layer"`)):e.push(new Ce(o,r.source,`source "${r.source}" not found`))}else e.push(new Ce(o,r,'missing required property "source"'));return e=e.concat(Xi({key:o,value:r,valueSpec:h.layer,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{"*":()=>[],type:()=>zi({key:`${o}.type`,value:r.type,valueSpec:h.layer.type,style:i.style,styleSpec:i.styleSpec,object:r,objectKey:"type"}),filter:ro,layout:g=>Xi({layer:r,key:g.key,value:g.value,style:g.style,styleSpec:g.styleSpec,objectElementValidators:{"*":x=>Ia(ji({layerType:d},x))}}),paint:g=>Xi({layer:r,key:g.key,value:g.value,style:g.style,styleSpec:g.styleSpec,objectElementValidators:{"*":x=>Sa(ji({layerType:d},x))}})}})),e}function zn(i){const e=i.value,r=i.key,o=yt(e);return o!=="string"?[new Ce(r,e,`string expected, ${o} found`)]:[]}const Ca={promoteId:function({key:i,value:e}){if(yt(e)==="string")return zn({key:i,value:e});{const r=[];for(const o in e)r.push(...zn({key:`${i}.${o}`,value:e[o]}));return r}}};function oo(i){const e=i.value,r=i.key,o=i.styleSpec,c=i.style;if(!e.type)return[new Ce(r,e,'"type" is required')];const h=pt(e.type);let d;switch(h){case"vector":case"raster":case"raster-dem":return d=Xi({key:r,value:e,valueSpec:o[`source_${h.replace("-","_")}`],style:i.style,styleSpec:o,objectElementValidators:Ca}),d;case"geojson":if(d=Xi({key:r,value:e,valueSpec:o.source_geojson,style:c,styleSpec:o,objectElementValidators:Ca}),e.cluster)for(const m in e.clusterProperties){const[g,x]=e.clusterProperties[m],w=typeof g=="string"?[g,["accumulated"],["get",m]]:g;d.push(...Jr({key:`${r}.${m}.map`,value:x,expressionContext:"cluster-map"})),d.push(...Jr({key:`${r}.${m}.reduce`,value:w,expressionContext:"cluster-reduce"}))}return d;case"video":return Xi({key:r,value:e,valueSpec:o.source_video,style:c,styleSpec:o});case"image":return Xi({key:r,value:e,valueSpec:o.source_image,style:c,styleSpec:o});case"canvas":return[new Ce(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return eo({key:`${r}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:c,styleSpec:o})}}function so(i){const e=i.value,r=i.styleSpec,o=r.light,c=i.style;let h=[];const d=yt(e);if(e===void 0)return h;if(d!=="object")return h=h.concat([new Ce("light",e,`object expected, ${d} found`)]),h;for(const m in e){const g=m.match(/^(.*)-transition$/);h=h.concat(g&&o[g[1]]&&o[g[1]].transition?zi({key:m,value:e[m],valueSpec:r.transition,style:c,styleSpec:r}):o[m]?zi({key:m,value:e[m],valueSpec:o[m],style:c,styleSpec:r}):[new Ce(m,e[m],`unknown property "${m}"`)])}return h}function Mi(i){const e=i.value,r=i.styleSpec,o=r.terrain,c=i.style;let h=[];const d=yt(e);if(e===void 0)return h;if(d!=="object")return h=h.concat([new Ce("terrain",e,`object expected, ${d} found`)]),h;for(const m in e)h=h.concat(o[m]?zi({key:m,value:e[m],valueSpec:o[m],style:c,styleSpec:r}):[new Ce(m,e[m],`unknown property "${m}"`)]);return h}const ao={"*":()=>[],array:va,boolean:function(i){const e=i.value,r=i.key,o=yt(e);return o!=="boolean"?[new Ce(r,e,`boolean expected, ${o} found`)]:[]},number:vs,color:function(i){const e=i.key,r=i.value,o=yt(r);return o!=="string"?[new Ce(e,r,`color expected, ${o} found`)]:vn(r)===null?[new Ce(e,r,`color expected, "${r}" found`)]:[]},constants:Zr,enum:eo,filter:ro,function:ba,layer:Aa,object:Xi,source:oo,light:so,terrain:Mi,string:zn,formatted:function(i){return zn(i).length===0?[]:Jr(i)},resolvedImage:function(i){return zn(i).length===0?[]:Jr(i)},padding:function(i){const e=i.key,r=i.value;if(yt(r)==="array"){if(r.length<1||r.length>4)return[new Ce(e,r,`padding requires 1 to 4 values; ${r.length} values found`)];const o={type:"number"};let c=[];for(let h=0;h<r.length;h++)c=c.concat(zi({key:`${e}[${h}]`,value:r[h],valueSpec:o}));return c}return vs({key:e,value:r,valueSpec:{}})}};function zi(i){const e=i.value,r=i.valueSpec,o=i.styleSpec;return r.expression&&Ct(pt(e))?ba(i):r.expression&&Jn(Oi(e))?Jr(i):r.type&&ao[r.type]?ao[r.type](i):Xi(ji({},i,{valueSpec:r.type?o[r.type]:r}))}function Cl(i){const e=i.value,r=i.key,o=zn(i);return o.length||(e.indexOf("{fontstack}")===-1&&o.push(new Ce(r,e,'"glyphs" url must include a "{fontstack}" token')),e.indexOf("{range}")===-1&&o.push(new Ce(r,e,'"glyphs" url must include a "{range}" token'))),o}function Lr(i,e=pe){let r=[];return r=r.concat(zi({key:"",value:i,valueSpec:e.$root,styleSpec:e,style:i,objectElementValidators:{glyphs:Cl,"*":()=>[]}})),i.constants&&(r=r.concat(Zr({key:"constants",value:i.constants,style:i,styleSpec:e}))),Ma(r)}function Ma(i){return[].concat(i).sort((e,r)=>e.line-r.line)}function _r(i){return function(...e){return Ma(i.apply(this,e))}}Lr.source=_r(oo),Lr.light=_r(so),Lr.terrain=_r(Mi),Lr.layer=_r(Aa),Lr.filter=_r(ro),Lr.paintProperty=_r(Sa),Lr.layoutProperty=_r(Ia);const lo=Lr,ws=lo.light,Ml=lo.paintProperty,zl=lo.layoutProperty;function Uo(i,e){let r=!1;if(e&&e.length)for(const o of e)i.fire(new _n(new Error(o.message))),r=!0;return r}class co{constructor(e,r,o){const c=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;const d=new Int32Array(this.arrayBuffer);e=d[0],this.d=(r=d[1])+2*(o=d[2]);for(let g=0;g<this.d*this.d;g++){const x=d[3+g],w=d[3+g+1];c.push(x===w?null:d.subarray(x,w))}const m=d[3+c.length+1];this.keys=d.subarray(d[3+c.length],m),this.bboxes=d.subarray(m),this.insert=this._insertReadonly}else{this.d=r+2*o;for(let d=0;d<this.d*this.d;d++)c.push([]);this.keys=[],this.bboxes=[]}this.n=r,this.extent=e,this.padding=o,this.scale=r/e,this.uid=0;const h=o/r*e;this.min=-h,this.max=e+h}insert(e,r,o,c,h){this._forEachCell(r,o,c,h,this._insertCell,this.uid++,void 0,void 0),this.keys.push(e),this.bboxes.push(r),this.bboxes.push(o),this.bboxes.push(c),this.bboxes.push(h)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(e,r,o,c,h,d){this.cells[h].push(d)}query(e,r,o,c,h){const d=this.min,m=this.max;if(e<=d&&r<=d&&m<=o&&m<=c&&!h)return Array.prototype.slice.call(this.keys);{const g=[];return this._forEachCell(e,r,o,c,this._queryCell,g,{},h),g}}_queryCell(e,r,o,c,h,d,m,g){const x=this.cells[h];if(x!==null){const w=this.keys,E=this.bboxes;for(let A=0;A<x.length;A++){const M=x[A];if(m[M]===void 0){const z=4*M;(g?g(E[z+0],E[z+1],E[z+2],E[z+3]):e<=E[z+2]&&r<=E[z+3]&&o>=E[z+0]&&c>=E[z+1])?(m[M]=!0,d.push(w[M])):m[M]=!1}}}}_forEachCell(e,r,o,c,h,d,m,g){const x=this._convertToCellCoord(e),w=this._convertToCellCoord(r),E=this._convertToCellCoord(o),A=this._convertToCellCoord(c);for(let M=x;M<=E;M++)for(let z=w;z<=A;z++){const V=this.d*z+M;if((!g||g(this._convertFromCellCoord(M),this._convertFromCellCoord(z),this._convertFromCellCoord(M+1),this._convertFromCellCoord(z+1)))&&h.call(this,e,r,o,c,V,d,m,g))return}}_convertFromCellCoord(e){return(e-this.padding)/this.scale}_convertToCellCoord(e){return Math.max(0,Math.min(this.d-1,Math.floor(e*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const e=this.cells,r=3+this.cells.length+1+1;let o=0;for(let d=0;d<this.cells.length;d++)o+=this.cells[d].length;const c=new Int32Array(r+o+this.keys.length+this.bboxes.length);c[0]=this.extent,c[1]=this.n,c[2]=this.padding;let h=r;for(let d=0;d<e.length;d++){const m=e[d];c[3+d]=h,c.set(m,h),h+=m.length}return c[3+e.length]=h,c.set(this.keys,h),h+=this.keys.length,c[3+e.length+1]=h,c.set(this.bboxes,h),h+=this.bboxes.length,c.buffer}static serialize(e,r){const o=e.toArrayBuffer();return r&&r.push(o),{buffer:o}}static deserialize(e){return new co(e.buffer)}}const yr={};function Fe(i,e,r={}){if(yr[i])throw new Error(`${i} is already registered.`);Object.defineProperty(e,"_classRegistryKey",{value:i,writeable:!1}),yr[i]={klass:e,omit:r.omit||[],shallow:r.shallow||[]}}Fe("Object",Object),Fe("TransferableGridIndex",co),Fe("Color",D),Fe("Error",Error),Fe("AJAXError",Si),Fe("ResolvedImage",K),Fe("StylePropertyFunction",Ro),Fe("StyleExpression",Lo,{omit:["_evaluator"]}),Fe("ZoomDependentExpression",xs),Fe("ZoomConstantExpression",Qn),Fe("CompoundExpression",St,{omit:["_evaluate"]});for(const i in Sn)Sn[i]._classRegistryKey||Fe(`Expression_${i}`,Sn[i]);function za(i){return i&&typeof ArrayBuffer<"u"&&(i instanceof ArrayBuffer||i.constructor&&i.constructor.name==="ArrayBuffer")}function Yr(i,e){if(i==null||typeof i=="boolean"||typeof i=="number"||typeof i=="string"||i instanceof Boolean||i instanceof Number||i instanceof String||i instanceof Date||i instanceof RegExp||i instanceof Blob)return i;if(za(i)||Er(i))return e&&e.push(i),i;if(ArrayBuffer.isView(i)){const r=i;return e&&e.push(r.buffer),r}if(i instanceof ImageData)return e&&e.push(i.data.buffer),i;if(Array.isArray(i)){const r=[];for(const o of i)r.push(Yr(o,e));return r}if(typeof i=="object"){const r=i.constructor,o=r._classRegistryKey;if(!o)throw new Error("can't serialize object of unregistered class");if(!yr[o])throw new Error(`${o} is not registered.`);const c=r.serialize?r.serialize(i,e):{};if(r.serialize){if(e&&c===e[e.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(const h in i){if(!i.hasOwnProperty(h)||yr[o].omit.indexOf(h)>=0)continue;const d=i[h];c[h]=yr[o].shallow.indexOf(h)>=0?d:Yr(d,e)}i instanceof Error&&(c.message=i.message)}if(c.$name)throw new Error("$name property is reserved for worker serialization logic.");return o!=="Object"&&(c.$name=o),c}throw new Error("can't serialize object of type "+typeof i)}function Rr(i){if(i==null||typeof i=="boolean"||typeof i=="number"||typeof i=="string"||i instanceof Boolean||i instanceof Number||i instanceof String||i instanceof Date||i instanceof RegExp||i instanceof Blob||za(i)||Er(i)||ArrayBuffer.isView(i)||i instanceof ImageData)return i;if(Array.isArray(i))return i.map(Rr);if(typeof i=="object"){const e=i.$name||"Object";if(!yr[e])throw new Error(`can't deserialize unregistered class ${e}`);const{klass:r}=yr[e];if(!r)throw new Error(`can't deserialize unregistered class ${e}`);if(r.deserialize)return r.deserialize(i);const o=Object.create(r.prototype);for(const c of Object.keys(i)){if(c==="$name")continue;const h=i[c];o[c]=yr[e].shallow.indexOf(c)>=0?h:Rr(h)}return o}throw new Error("can't deserialize object of type "+typeof i)}class Ts{constructor(){this.first=!0}update(e,r){const o=Math.floor(e);return this.first?(this.first=!1,this.lastIntegerZoom=o,this.lastIntegerZoomTime=0,this.lastZoom=e,this.lastFloorZoom=o,!0):(this.lastFloorZoom>o?(this.lastIntegerZoom=o+1,this.lastIntegerZoomTime=r):this.lastFloorZoom<o&&(this.lastIntegerZoom=o,this.lastIntegerZoomTime=r),e!==this.lastZoom&&(this.lastZoom=e,this.lastFloorZoom=o,!0))}}const ze={"Latin-1 Supplement":i=>i>=128&&i<=255,Arabic:i=>i>=1536&&i<=1791,"Arabic Supplement":i=>i>=1872&&i<=1919,"Arabic Extended-A":i=>i>=2208&&i<=2303,"Hangul Jamo":i=>i>=4352&&i<=4607,"Unified Canadian Aboriginal Syllabics":i=>i>=5120&&i<=5759,Khmer:i=>i>=6016&&i<=6143,"Unified Canadian Aboriginal Syllabics Extended":i=>i>=6320&&i<=6399,"General Punctuation":i=>i>=8192&&i<=8303,"Letterlike Symbols":i=>i>=8448&&i<=8527,"Number Forms":i=>i>=8528&&i<=8591,"Miscellaneous Technical":i=>i>=8960&&i<=9215,"Control Pictures":i=>i>=9216&&i<=9279,"Optical Character Recognition":i=>i>=9280&&i<=9311,"Enclosed Alphanumerics":i=>i>=9312&&i<=9471,"Geometric Shapes":i=>i>=9632&&i<=9727,"Miscellaneous Symbols":i=>i>=9728&&i<=9983,"Miscellaneous Symbols and Arrows":i=>i>=11008&&i<=11263,"CJK Radicals Supplement":i=>i>=11904&&i<=12031,"Kangxi Radicals":i=>i>=12032&&i<=12255,"Ideographic Description Characters":i=>i>=12272&&i<=12287,"CJK Symbols and Punctuation":i=>i>=12288&&i<=12351,Hiragana:i=>i>=12352&&i<=12447,Katakana:i=>i>=12448&&i<=12543,Bopomofo:i=>i>=12544&&i<=12591,"Hangul Compatibility Jamo":i=>i>=12592&&i<=12687,Kanbun:i=>i>=12688&&i<=12703,"Bopomofo Extended":i=>i>=12704&&i<=12735,"CJK Strokes":i=>i>=12736&&i<=12783,"Katakana Phonetic Extensions":i=>i>=12784&&i<=12799,"Enclosed CJK Letters and Months":i=>i>=12800&&i<=13055,"CJK Compatibility":i=>i>=13056&&i<=13311,"CJK Unified Ideographs Extension A":i=>i>=13312&&i<=19903,"Yijing Hexagram Symbols":i=>i>=19904&&i<=19967,"CJK Unified Ideographs":i=>i>=19968&&i<=40959,"Yi Syllables":i=>i>=40960&&i<=42127,"Yi Radicals":i=>i>=42128&&i<=42191,"Hangul Jamo Extended-A":i=>i>=43360&&i<=43391,"Hangul Syllables":i=>i>=44032&&i<=55215,"Hangul Jamo Extended-B":i=>i>=55216&&i<=55295,"Private Use Area":i=>i>=57344&&i<=63743,"CJK Compatibility Ideographs":i=>i>=63744&&i<=64255,"Arabic Presentation Forms-A":i=>i>=64336&&i<=65023,"Vertical Forms":i=>i>=65040&&i<=65055,"CJK Compatibility Forms":i=>i>=65072&&i<=65103,"Small Form Variants":i=>i>=65104&&i<=65135,"Arabic Presentation Forms-B":i=>i>=65136&&i<=65279,"Halfwidth and Fullwidth Forms":i=>i>=65280&&i<=65519};function $o(i){for(const e of i)if(Ss(e.charCodeAt(0)))return!0;return!1}function Pl(i){for(const e of i)if(!Es(e.charCodeAt(0)))return!1;return!0}function Es(i){return!(ze.Arabic(i)||ze["Arabic Supplement"](i)||ze["Arabic Extended-A"](i)||ze["Arabic Presentation Forms-A"](i)||ze["Arabic Presentation Forms-B"](i))}function Ss(i){return!(i!==746&&i!==747&&(i<4352||!(ze["Bopomofo Extended"](i)||ze.Bopomofo(i)||ze["CJK Compatibility Forms"](i)&&!(i>=65097&&i<=65103)||ze["CJK Compatibility Ideographs"](i)||ze["CJK Compatibility"](i)||ze["CJK Radicals Supplement"](i)||ze["CJK Strokes"](i)||!(!ze["CJK Symbols and Punctuation"](i)||i>=12296&&i<=12305||i>=12308&&i<=12319||i===12336)||ze["CJK Unified Ideographs Extension A"](i)||ze["CJK Unified Ideographs"](i)||ze["Enclosed CJK Letters and Months"](i)||ze["Hangul Compatibility Jamo"](i)||ze["Hangul Jamo Extended-A"](i)||ze["Hangul Jamo Extended-B"](i)||ze["Hangul Jamo"](i)||ze["Hangul Syllables"](i)||ze.Hiragana(i)||ze["Ideographic Description Characters"](i)||ze.Kanbun(i)||ze["Kangxi Radicals"](i)||ze["Katakana Phonetic Extensions"](i)||ze.Katakana(i)&&i!==12540||!(!ze["Halfwidth and Fullwidth Forms"](i)||i===65288||i===65289||i===65293||i>=65306&&i<=65310||i===65339||i===65341||i===65343||i>=65371&&i<=65503||i===65507||i>=65512&&i<=65519)||!(!ze["Small Form Variants"](i)||i>=65112&&i<=65118||i>=65123&&i<=65126)||ze["Unified Canadian Aboriginal Syllabics"](i)||ze["Unified Canadian Aboriginal Syllabics Extended"](i)||ze["Vertical Forms"](i)||ze["Yijing Hexagram Symbols"](i)||ze["Yi Syllables"](i)||ze["Yi Radicals"](i))))}function Pa(i){return!(Ss(i)||function(e){return!!(ze["Latin-1 Supplement"](e)&&(e===167||e===169||e===174||e===177||e===188||e===189||e===190||e===215||e===247)||ze["General Punctuation"](e)&&(e===8214||e===8224||e===8225||e===8240||e===8241||e===8251||e===8252||e===8258||e===8263||e===8264||e===8265||e===8273)||ze["Letterlike Symbols"](e)||ze["Number Forms"](e)||ze["Miscellaneous Technical"](e)&&(e>=8960&&e<=8967||e>=8972&&e<=8991||e>=8996&&e<=9e3||e===9003||e>=9085&&e<=9114||e>=9150&&e<=9165||e===9167||e>=9169&&e<=9179||e>=9186&&e<=9215)||ze["Control Pictures"](e)&&e!==9251||ze["Optical Character Recognition"](e)||ze["Enclosed Alphanumerics"](e)||ze["Geometric Shapes"](e)||ze["Miscellaneous Symbols"](e)&&!(e>=9754&&e<=9759)||ze["Miscellaneous Symbols and Arrows"](e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||ze["CJK Symbols and Punctuation"](e)||ze.Katakana(e)||ze["Private Use Area"](e)||ze["CJK Compatibility Forms"](e)||ze["Small Form Variants"](e)||ze["Halfwidth and Fullwidth Forms"](e)||e===8734||e===8756||e===8757||e>=9984&&e<=10087||e>=10102&&e<=10131||e===65532||e===65533)}(i))}function ka(i){return i>=1424&&i<=2303||ze["Arabic Presentation Forms-A"](i)||ze["Arabic Presentation Forms-B"](i)}function kl(i,e){return!(!e&&ka(i)||i>=2304&&i<=3583||i>=3840&&i<=4255||ze.Khmer(i))}function Da(i){for(const e of i)if(ka(e.charCodeAt(0)))return!0;return!1}const Is="deferred",As="loading",Cs="loaded";let Ms=null,vi="unavailable",Br=null;const La=function(i){i&&typeof i=="string"&&i.indexOf("NetworkError")>-1&&(vi="error"),Ms&&Ms(i)};function Pn(){zs.fire(new fr("pluginStateChange",{pluginStatus:vi,pluginURL:Br}))}const zs=new mr,uo=function(){return vi},Ra=function(){if(vi!==Is||!Br)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");vi=As,Pn(),Br&&gn({url:Br},i=>{i?La(i):(vi=Cs,Pn())})},Ui={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>vi===Cs||Ui.applyArabicShaping!=null,isLoading:()=>vi===As,setState(i){if(!fi())throw new Error("Cannot set the state of the rtl-text-plugin when not in the web-worker context");vi=i.pluginStatus,Br=i.pluginURL},isParsed(){if(!fi())throw new Error("rtl-text-plugin is only parsed on the worker-threads");return Ui.applyArabicShaping!=null&&Ui.processBidirectionalText!=null&&Ui.processStyledBidirectionalText!=null},getPluginURL(){if(!fi())throw new Error("rtl-text-plugin url can only be queried from the worker threads");return Br}};class Rt{constructor(e,r){this.zoom=e,r?(this.now=r.now,this.fadeDuration=r.fadeDuration,this.zoomHistory=r.zoomHistory,this.transition=r.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Ts,this.transition={})}isSupportedScript(e){return function(r,o){for(const c of r)if(!kl(c.charCodeAt(0),o))return!1;return!0}(e,Ui.isLoaded())}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const e=this.zoom,r=e-Math.floor(e),o=this.crossFadingFactor();return e>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:r+(1-r)*o}:{fromScale:.5,toScale:1,t:1-(1-o)*r}}}class ho{constructor(e,r){this.property=e,this.value=r,this.expression=function(o,c){if(Ct(o))return new Ro(o,c);if(Jn(o)){const h=xa(o,c);if(h.result==="error")throw new Error(h.value.map(d=>`${d.key}: ${d.message}`).join(", "));return h.value}{let h=o;return c.type==="color"&&typeof o=="string"?h=D.parse(o):c.type!=="padding"||typeof o!="number"&&!Array.isArray(o)||(h=q.parse(o)),{kind:"constant",evaluate:()=>h}}}(r===void 0?e.specification.default:r,e.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(e,r,o){return this.property.possiblyEvaluate(this,e,r,o)}}class Vo{constructor(e){this.property=e,this.value=new ho(e,void 0)}transitioned(e,r){return new Fa(this.property,this.value,r,nt({},e.transition,this.transition),e.now)}untransitioned(){return new Fa(this.property,this.value,null,{},0)}}class Ba{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues)}getValue(e){return vt(this._values[e].value.value)}setValue(e,r){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Vo(this._values[e].property)),this._values[e].value=new ho(this._values[e].property,r===null?void 0:vt(r))}getTransition(e){return vt(this._values[e].transition)}setTransition(e,r){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Vo(this._values[e].property)),this._values[e].transition=vt(r)||void 0}serialize(){const e={};for(const r of Object.keys(this._values)){const o=this.getValue(r);o!==void 0&&(e[r]=o);const c=this.getTransition(r);c!==void 0&&(e[`${r}-transition`]=c)}return e}transitioned(e,r){const o=new Oa(this._properties);for(const c of Object.keys(this._values))o._values[c]=this._values[c].transitioned(e,r._values[c]);return o}untransitioned(){const e=new Oa(this._properties);for(const r of Object.keys(this._values))e._values[r]=this._values[r].untransitioned();return e}}class Fa{constructor(e,r,o,c,h){this.property=e,this.value=r,this.begin=h+c.delay||0,this.end=this.begin+c.duration||0,e.specification.transition&&(c.delay||c.duration)&&(this.prior=o)}possiblyEvaluate(e,r,o){const c=e.now||0,h=this.value.possiblyEvaluate(e,r,o),d=this.prior;if(d){if(c>this.end)return this.prior=null,h;if(this.value.isDataDriven())return this.prior=null,h;if(c<this.begin)return d.possiblyEvaluate(e,r,o);{const m=(c-this.begin)/(this.end-this.begin);return this.property.interpolate(d.possiblyEvaluate(e,r,o),h,function(g){if(g<=0)return 0;if(g>=1)return 1;const x=g*g,w=x*g;return 4*(g<.5?w:3*(g-x)+w-.75)}(m))}}return h}}class Oa{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,r,o){const c=new po(this._properties);for(const h of Object.keys(this._values))c._values[h]=this._values[h].possiblyEvaluate(e,r,o);return c}hasTransition(){for(const e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class Dl{constructor(e){this._properties=e,this._values=Object.create(e.defaultPropertyValues)}getValue(e){return vt(this._values[e].value)}setValue(e,r){this._values[e]=new ho(this._values[e].property,r===null?void 0:vt(r))}serialize(){const e={};for(const r of Object.keys(this._values)){const o=this.getValue(r);o!==void 0&&(e[r]=o)}return e}possiblyEvaluate(e,r,o){const c=new po(this._properties);for(const h of Object.keys(this._values))c._values[h]=this._values[h].possiblyEvaluate(e,r,o);return c}}class ir{constructor(e,r,o){this.property=e,this.value=r,this.parameters=o}isConstant(){return this.value.kind==="constant"}constantOr(e){return this.value.kind==="constant"?this.value.value:e}evaluate(e,r,o,c){return this.property.evaluate(this.value,this.parameters,e,r,o,c)}}class po{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class Ve{constructor(e){this.specification=e}possiblyEvaluate(e,r){if(e.isDataDriven())throw new Error("Value should not be data driven");return e.expression.evaluate(r)}interpolate(e,r,o){const c=Xn[this.specification.type];return c?c(e,r,o):e}}class je{constructor(e,r){this.specification=e,this.overrides=r}possiblyEvaluate(e,r,o,c){return new ir(this,e.expression.kind==="constant"||e.expression.kind==="camera"?{kind:"constant",value:e.expression.evaluate(r,null,{},o,c)}:e.expression,r)}interpolate(e,r,o){if(e.value.kind!=="constant"||r.value.kind!=="constant")return e;if(e.value.value===void 0||r.value.value===void 0)return new ir(this,{kind:"constant",value:void 0},e.parameters);const c=Xn[this.specification.type];return c?new ir(this,{kind:"constant",value:c(e.value.value,r.value.value,o)},e.parameters):e}evaluate(e,r,o,c,h,d){return e.kind==="constant"?e.value:e.evaluate(r,o,c,h,d)}}class kn extends je{possiblyEvaluate(e,r,o,c){if(e.value===void 0)return new ir(this,{kind:"constant",value:void 0},r);if(e.expression.kind==="constant"){const h=e.expression.evaluate(r,null,{},o,c),d=e.property.specification.type==="resolvedImage"&&typeof h!="string"?h.name:h,m=this._calculate(d,d,d,r);return new ir(this,{kind:"constant",value:m},r)}if(e.expression.kind==="camera"){const h=this._calculate(e.expression.evaluate({zoom:r.zoom-1}),e.expression.evaluate({zoom:r.zoom}),e.expression.evaluate({zoom:r.zoom+1}),r);return new ir(this,{kind:"constant",value:h},r)}return new ir(this,e.expression,r)}evaluate(e,r,o,c,h,d){if(e.kind==="source"){const m=e.evaluate(r,o,c,h,d);return this._calculate(m,m,m,r)}return e.kind==="composite"?this._calculate(e.evaluate({zoom:Math.floor(r.zoom)-1},o,c),e.evaluate({zoom:Math.floor(r.zoom)},o,c),e.evaluate({zoom:Math.floor(r.zoom)+1},o,c),r):e.value}_calculate(e,r,o,c){return c.zoom>c.zoomHistory.lastIntegerZoom?{from:e,to:r}:{from:o,to:r}}interpolate(e){return e}}class Ps{constructor(e){this.specification=e}possiblyEvaluate(e,r,o,c){if(e.value!==void 0){if(e.expression.kind==="constant"){const h=e.expression.evaluate(r,null,{},o,c);return this._calculate(h,h,h,r)}return this._calculate(e.expression.evaluate(new Rt(Math.floor(r.zoom-1),r)),e.expression.evaluate(new Rt(Math.floor(r.zoom),r)),e.expression.evaluate(new Rt(Math.floor(r.zoom+1),r)),r)}}_calculate(e,r,o,c){return c.zoom>c.zoomHistory.lastIntegerZoom?{from:e,to:r}:{from:o,to:r}}interpolate(e){return e}}class Fr{constructor(e){this.specification=e}possiblyEvaluate(e,r,o,c){return!!e.expression.evaluate(r,null,{},o,c)}interpolate(){return!1}}class si{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const r in e){const o=e[r];o.specification.overridable&&this.overridableProperties.push(r);const c=this.defaultPropertyValues[r]=new ho(o,void 0),h=this.defaultTransitionablePropertyValues[r]=new Vo(o);this.defaultTransitioningPropertyValues[r]=h.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=c.possiblyEvaluate({})}}}Fe("DataDrivenProperty",je),Fe("DataConstantProperty",Ve),Fe("CrossFadedDataDrivenProperty",kn),Fe("CrossFadedProperty",Ps),Fe("ColorRampProperty",Fr);const Or="-transition";class rr extends mr{constructor(e,r){if(super(),this.id=e.id,this.type=e.type,this._featureFilter={filter:()=>!0,needGeometry:!1},e.type!=="custom"&&(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,e.type!=="background"&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter),r.layout&&(this._unevaluatedLayout=new Dl(r.layout)),r.paint)){this._transitionablePaint=new Ba(r.paint);for(const o in e.paint)this.setPaintProperty(o,e.paint[o],{validate:!1});for(const o in e.layout)this.setLayoutProperty(o,e.layout[o],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new po(r.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){return e==="visibility"?this.visibility:this._unevaluatedLayout.getValue(e)}setLayoutProperty(e,r,o={}){r!=null&&this._validate(zl,`layers.${this.id}.layout.${e}`,e,r,o)||(e!=="visibility"?this._unevaluatedLayout.setValue(e,r):this.visibility=r)}getPaintProperty(e){return e.endsWith(Or)?this._transitionablePaint.getTransition(e.slice(0,-Or.length)):this._transitionablePaint.getValue(e)}setPaintProperty(e,r,o={}){if(r!=null&&this._validate(Ml,`layers.${this.id}.paint.${e}`,e,r,o))return!1;if(e.endsWith(Or))return this._transitionablePaint.setTransition(e.slice(0,-Or.length),r||void 0),!1;{const c=this._transitionablePaint._values[e],h=c.property.specification["property-type"]==="cross-faded-data-driven",d=c.value.isDataDriven(),m=c.value;this._transitionablePaint.setValue(e,r),this._handleSpecialPaintPropertyUpdate(e);const g=this._transitionablePaint._values[e].value;return g.isDataDriven()||d||h||this._handleOverridablePaintPropertyUpdate(e,m,g)}}_handleSpecialPaintPropertyUpdate(e){}_handleOverridablePaintPropertyUpdate(e,r,o){return!1}isHidden(e){return!!(this.minzoom&&e<this.minzoom)||!!(this.maxzoom&&e>=this.maxzoom)||this.visibility==="none"}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(e,r){e.getCrossfadeParameters&&(this._crossfadeParameters=e.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,r)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,r)}serialize(){const e={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(e.layout=e.layout||{},e.layout.visibility=this.visibility),ct(e,(r,o)=>!(r===void 0||o==="layout"&&!Object.keys(r).length||o==="paint"&&!Object.keys(r).length))}_validate(e,r,o,c,h={}){return(!h||h.validate!==!1)&&Uo(this,e.call(lo,{key:r,layerType:this.type,objectKey:o,value:c,styleSpec:pe,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const e in this.paint._values){const r=this.paint.get(e);if(r instanceof ir&&zt(r.property.specification)&&(r.value.kind==="source"||r.value.kind==="composite")&&r.value.isStateDependent)return!0}return!1}}const Ua={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Ur{constructor(e,r){this._structArray=e,this._pos1=r*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class Vt{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(e,r){return e._trim(),r&&(e.isTransferred=!0,r.push(e.arrayBuffer)),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){const r=Object.create(this.prototype);return r.arrayBuffer=e.arrayBuffer,r.length=e.length,r.capacity=e.arrayBuffer.byteLength/r.bytesPerElement,r._refreshViews(),r}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(e){this.reserve(e),this.length=e}reserve(e){if(e>this.capacity){this.capacity=Math.max(e,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const r=this.uint8;this._refreshViews(),r&&this.uint8.set(r)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function Zt(i,e=1){let r=0,o=0;return{members:i.map(c=>{const h=Ua[c.type].BYTES_PER_ELEMENT,d=r=ks(r,Math.max(e,h)),m=c.components||1;return o=Math.max(o,h),r+=h*m,{name:c.name,type:c.type,components:m,offset:d}}),size:ks(r,Math.max(o,e)),alignment:e}}function ks(i,e){return Math.ceil(i/e)*e}class Qr extends Vt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r){const o=this.length;return this.resize(o+1),this.emplace(o,e,r)}emplace(e,r,o){const c=2*e;return this.int16[c+0]=r,this.int16[c+1]=o,e}}Qr.prototype.bytesPerElement=4,Fe("StructArrayLayout2i4",Qr);class a extends Vt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,o,c){const h=this.length;return this.resize(h+1),this.emplace(h,e,r,o,c)}emplace(e,r,o,c,h){const d=4*e;return this.int16[d+0]=r,this.int16[d+1]=o,this.int16[d+2]=c,this.int16[d+3]=h,e}}a.prototype.bytesPerElement=8,Fe("StructArrayLayout4i8",a);class t extends Vt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,o,c,h,d){const m=this.length;return this.resize(m+1),this.emplace(m,e,r,o,c,h,d)}emplace(e,r,o,c,h,d,m){const g=6*e;return this.int16[g+0]=r,this.int16[g+1]=o,this.int16[g+2]=c,this.int16[g+3]=h,this.int16[g+4]=d,this.int16[g+5]=m,e}}t.prototype.bytesPerElement=12,Fe("StructArrayLayout2i4i12",t);class n extends Vt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,o,c,h,d){const m=this.length;return this.resize(m+1),this.emplace(m,e,r,o,c,h,d)}emplace(e,r,o,c,h,d,m){const g=4*e,x=8*e;return this.int16[g+0]=r,this.int16[g+1]=o,this.uint8[x+4]=c,this.uint8[x+5]=h,this.uint8[x+6]=d,this.uint8[x+7]=m,e}}n.prototype.bytesPerElement=8,Fe("StructArrayLayout2i4ub8",n);class s extends Vt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r){const o=this.length;return this.resize(o+1),this.emplace(o,e,r)}emplace(e,r,o){const c=2*e;return this.float32[c+0]=r,this.float32[c+1]=o,e}}s.prototype.bytesPerElement=8,Fe("StructArrayLayout2f8",s);class u extends Vt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,o,c,h,d,m,g,x,w){const E=this.length;return this.resize(E+1),this.emplace(E,e,r,o,c,h,d,m,g,x,w)}emplace(e,r,o,c,h,d,m,g,x,w,E){const A=10*e;return this.uint16[A+0]=r,this.uint16[A+1]=o,this.uint16[A+2]=c,this.uint16[A+3]=h,this.uint16[A+4]=d,this.uint16[A+5]=m,this.uint16[A+6]=g,this.uint16[A+7]=x,this.uint16[A+8]=w,this.uint16[A+9]=E,e}}u.prototype.bytesPerElement=20,Fe("StructArrayLayout10ui20",u);class p extends Vt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,o,c,h,d,m,g,x,w,E,A){const M=this.length;return this.resize(M+1),this.emplace(M,e,r,o,c,h,d,m,g,x,w,E,A)}emplace(e,r,o,c,h,d,m,g,x,w,E,A,M){const z=12*e;return this.int16[z+0]=r,this.int16[z+1]=o,this.int16[z+2]=c,this.int16[z+3]=h,this.uint16[z+4]=d,this.uint16[z+5]=m,this.uint16[z+6]=g,this.uint16[z+7]=x,this.int16[z+8]=w,this.int16[z+9]=E,this.int16[z+10]=A,this.int16[z+11]=M,e}}p.prototype.bytesPerElement=24,Fe("StructArrayLayout4i4ui4i24",p);class f extends Vt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,o){const c=this.length;return this.resize(c+1),this.emplace(c,e,r,o)}emplace(e,r,o,c){const h=3*e;return this.float32[h+0]=r,this.float32[h+1]=o,this.float32[h+2]=c,e}}f.prototype.bytesPerElement=12,Fe("StructArrayLayout3f12",f);class _ extends Vt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){const r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){return this.uint32[1*e+0]=r,e}}_.prototype.bytesPerElement=4,Fe("StructArrayLayout1ul4",_);class y extends Vt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,o,c,h,d,m,g,x){const w=this.length;return this.resize(w+1),this.emplace(w,e,r,o,c,h,d,m,g,x)}emplace(e,r,o,c,h,d,m,g,x,w){const E=10*e,A=5*e;return this.int16[E+0]=r,this.int16[E+1]=o,this.int16[E+2]=c,this.int16[E+3]=h,this.int16[E+4]=d,this.int16[E+5]=m,this.uint32[A+3]=g,this.uint16[E+8]=x,this.uint16[E+9]=w,e}}y.prototype.bytesPerElement=20,Fe("StructArrayLayout6i1ul2ui20",y);class v extends Vt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,o,c,h,d){const m=this.length;return this.resize(m+1),this.emplace(m,e,r,o,c,h,d)}emplace(e,r,o,c,h,d,m){const g=6*e;return this.int16[g+0]=r,this.int16[g+1]=o,this.int16[g+2]=c,this.int16[g+3]=h,this.int16[g+4]=d,this.int16[g+5]=m,e}}v.prototype.bytesPerElement=12,Fe("StructArrayLayout2i2i2i12",v);class T extends Vt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,o,c,h){const d=this.length;return this.resize(d+1),this.emplace(d,e,r,o,c,h)}emplace(e,r,o,c,h,d){const m=4*e,g=8*e;return this.float32[m+0]=r,this.float32[m+1]=o,this.float32[m+2]=c,this.int16[g+6]=h,this.int16[g+7]=d,e}}T.prototype.bytesPerElement=16,Fe("StructArrayLayout2f1f2i16",T);class I extends Vt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,o,c){const h=this.length;return this.resize(h+1),this.emplace(h,e,r,o,c)}emplace(e,r,o,c,h){const d=12*e,m=3*e;return this.uint8[d+0]=r,this.uint8[d+1]=o,this.float32[m+1]=c,this.float32[m+2]=h,e}}I.prototype.bytesPerElement=12,Fe("StructArrayLayout2ub2f12",I);class C extends Vt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,o){const c=this.length;return this.resize(c+1),this.emplace(c,e,r,o)}emplace(e,r,o,c){const h=3*e;return this.uint16[h+0]=r,this.uint16[h+1]=o,this.uint16[h+2]=c,e}}C.prototype.bytesPerElement=6,Fe("StructArrayLayout3ui6",C);class F extends Vt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,o,c,h,d,m,g,x,w,E,A,M,z,V,U,ee){const oe=this.length;return this.resize(oe+1),this.emplace(oe,e,r,o,c,h,d,m,g,x,w,E,A,M,z,V,U,ee)}emplace(e,r,o,c,h,d,m,g,x,w,E,A,M,z,V,U,ee,oe){const Y=24*e,re=12*e,fe=48*e;return this.int16[Y+0]=r,this.int16[Y+1]=o,this.uint16[Y+2]=c,this.uint16[Y+3]=h,this.uint32[re+2]=d,this.uint32[re+3]=m,this.uint32[re+4]=g,this.uint16[Y+10]=x,this.uint16[Y+11]=w,this.uint16[Y+12]=E,this.float32[re+7]=A,this.float32[re+8]=M,this.uint8[fe+36]=z,this.uint8[fe+37]=V,this.uint8[fe+38]=U,this.uint32[re+10]=ee,this.int16[Y+22]=oe,e}}F.prototype.bytesPerElement=48,Fe("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",F);class R extends Vt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,o,c,h,d,m,g,x,w,E,A,M,z,V,U,ee,oe,Y,re,fe,de,Be,Ue,Pe,Ae,we,ke){const Me=this.length;return this.resize(Me+1),this.emplace(Me,e,r,o,c,h,d,m,g,x,w,E,A,M,z,V,U,ee,oe,Y,re,fe,de,Be,Ue,Pe,Ae,we,ke)}emplace(e,r,o,c,h,d,m,g,x,w,E,A,M,z,V,U,ee,oe,Y,re,fe,de,Be,Ue,Pe,Ae,we,ke,Me){const be=34*e,qe=17*e;return this.int16[be+0]=r,this.int16[be+1]=o,this.int16[be+2]=c,this.int16[be+3]=h,this.int16[be+4]=d,this.int16[be+5]=m,this.int16[be+6]=g,this.int16[be+7]=x,this.uint16[be+8]=w,this.uint16[be+9]=E,this.uint16[be+10]=A,this.uint16[be+11]=M,this.uint16[be+12]=z,this.uint16[be+13]=V,this.uint16[be+14]=U,this.uint16[be+15]=ee,this.uint16[be+16]=oe,this.uint16[be+17]=Y,this.uint16[be+18]=re,this.uint16[be+19]=fe,this.uint16[be+20]=de,this.uint16[be+21]=Be,this.uint16[be+22]=Ue,this.uint32[qe+12]=Pe,this.float32[qe+13]=Ae,this.float32[qe+14]=we,this.float32[qe+15]=ke,this.float32[qe+16]=Me,e}}R.prototype.bytesPerElement=68,Fe("StructArrayLayout8i15ui1ul4f68",R);class B extends Vt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){const r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){return this.float32[1*e+0]=r,e}}B.prototype.bytesPerElement=4,Fe("StructArrayLayout1f4",B);class X extends Vt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,o){const c=this.length;return this.resize(c+1),this.emplace(c,e,r,o)}emplace(e,r,o,c){const h=3*e;return this.int16[h+0]=r,this.int16[h+1]=o,this.int16[h+2]=c,e}}X.prototype.bytesPerElement=6,Fe("StructArrayLayout3i6",X);class J extends Vt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,o){const c=this.length;return this.resize(c+1),this.emplace(c,e,r,o)}emplace(e,r,o,c){const h=4*e;return this.uint32[2*e+0]=r,this.uint16[h+2]=o,this.uint16[h+3]=c,e}}J.prototype.bytesPerElement=8,Fe("StructArrayLayout1ul2ui8",J);class te extends Vt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r){const o=this.length;return this.resize(o+1),this.emplace(o,e,r)}emplace(e,r,o){const c=2*e;return this.uint16[c+0]=r,this.uint16[c+1]=o,e}}te.prototype.bytesPerElement=4,Fe("StructArrayLayout2ui4",te);class O extends Vt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){const r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){return this.uint16[1*e+0]=r,e}}O.prototype.bytesPerElement=2,Fe("StructArrayLayout1ui2",O);class ne extends Vt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,o,c){const h=this.length;return this.resize(h+1),this.emplace(h,e,r,o,c)}emplace(e,r,o,c,h){const d=4*e;return this.float32[d+0]=r,this.float32[d+1]=o,this.float32[d+2]=c,this.float32[d+3]=h,e}}ne.prototype.bytesPerElement=16,Fe("StructArrayLayout4f16",ne);class ie extends Ur{get anchorPointX(){return this._structArray.int16[this._pos2+0]}get anchorPointY(){return this._structArray.int16[this._pos2+1]}get x1(){return this._structArray.int16[this._pos2+2]}get y1(){return this._structArray.int16[this._pos2+3]}get x2(){return this._structArray.int16[this._pos2+4]}get y2(){return this._structArray.int16[this._pos2+5]}get featureIndex(){return this._structArray.uint32[this._pos4+3]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+8]}get bucketIndex(){return this._structArray.uint16[this._pos2+9]}get anchorPoint(){return new We(this.anchorPointX,this.anchorPointY)}}ie.prototype.size=20;class ue extends y{get(e){return new ie(this,e)}}Fe("CollisionBoxArray",ue);class he extends Ur{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(e){this._structArray.uint8[this._pos1+37]=e}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(e){this._structArray.uint8[this._pos1+38]=e}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(e){this._structArray.uint32[this._pos4+10]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}he.prototype.size=48;class ye extends F{get(e){return new he(this,e)}}Fe("PlacedSymbolArray",ye);class ce extends Ur{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(e){this._structArray.uint32[this._pos4+12]=e}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get textOffset0(){return this._structArray.float32[this._pos4+14]}get textOffset1(){return this._structArray.float32[this._pos4+15]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+16]}}ce.prototype.size=68;class Le extends R{get(e){return new ce(this,e)}}Fe("SymbolInstanceArray",Le);class Ie extends B{getoffsetX(e){return this.float32[1*e+0]}}Fe("GlyphOffsetArray",Ie);class Re extends X{getx(e){return this.int16[3*e+0]}gety(e){return this.int16[3*e+1]}gettileUnitDistanceFromAnchor(e){return this.int16[3*e+2]}}Fe("SymbolLineVertexArray",Re);class Qe extends Ur{get featureIndex(){return this._structArray.uint32[this._pos4+0]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+2]}get bucketIndex(){return this._structArray.uint16[this._pos2+3]}}Qe.prototype.size=8;class it extends J{get(e){return new Qe(this,e)}}Fe("FeatureIndexArray",it);class Ge extends Qr{}class bt extends Qr{}class wt extends Qr{}class ut extends t{}class mt extends n{}class Et extends s{}class ei extends u{}class nr extends p{}class Wi extends f{}class or extends _{}class $r extends v{}class $i extends I{}class bi extends C{}class xr extends te{}const No=Zt([{name:"a_pos",components:2,type:"Int16"}],4),{members:Ht}=No;class ot{constructor(e=[]){this.segments=e}prepareSegment(e,r,o,c){let h=this.segments[this.segments.length-1];return e>ot.MAX_VERTEX_ARRAY_LENGTH&&$t(`Max vertices per segment is ${ot.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),(!h||h.vertexLength+e>ot.MAX_VERTEX_ARRAY_LENGTH||h.sortKey!==c)&&(h={vertexOffset:r.length,primitiveOffset:o.length,vertexLength:0,primitiveLength:0},c!==void 0&&(h.sortKey=c),this.segments.push(h)),h}get(){return this.segments}destroy(){for(const e of this.segments)for(const r in e.vaos)e.vaos[r].destroy()}static simpleSegment(e,r,o,c){return new ot([{vertexOffset:e,primitiveOffset:r,vertexLength:o,primitiveLength:c,vaos:{},sortKey:0}])}}function xt(i,e){return 256*(i=se(Math.floor(i),0,255))+se(Math.floor(e),0,255)}ot.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Fe("SegmentVector",ot);const ti=Zt([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]);var ii={exports:{}},Bt={exports:{}};Bt.exports=function(i,e){var r,o,c,h,d,m,g,x;for(o=i.length-(r=3&i.length),c=e,d=3432918353,m=461845907,x=0;x<o;)g=255&i.charCodeAt(x)|(255&i.charCodeAt(++x))<<8|(255&i.charCodeAt(++x))<<16|(255&i.charCodeAt(++x))<<24,++x,c=27492+(65535&(h=5*(65535&(c=(c^=g=(65535&(g=(g=(65535&g)*d+(((g>>>16)*d&65535)<<16)&4294967295)<<15|g>>>17))*m+(((g>>>16)*m&65535)<<16)&4294967295)<<13|c>>>19))+((5*(c>>>16)&65535)<<16)&4294967295))+((58964+(h>>>16)&65535)<<16);switch(g=0,r){case 3:g^=(255&i.charCodeAt(x+2))<<16;case 2:g^=(255&i.charCodeAt(x+1))<<8;case 1:c^=g=(65535&(g=(g=(65535&(g^=255&i.charCodeAt(x)))*d+(((g>>>16)*d&65535)<<16)&4294967295)<<15|g>>>17))*m+(((g>>>16)*m&65535)<<16)&4294967295}return c^=i.length,c=2246822507*(65535&(c^=c>>>16))+((2246822507*(c>>>16)&65535)<<16)&4294967295,c=3266489909*(65535&(c^=c>>>13))+((3266489909*(c>>>16)&65535)<<16)&4294967295,(c^=c>>>16)>>>0};var Vi={exports:{}};Vi.exports=function(i,e){for(var r,o=i.length,c=e^o,h=0;o>=4;)r=1540483477*(65535&(r=255&i.charCodeAt(h)|(255&i.charCodeAt(++h))<<8|(255&i.charCodeAt(++h))<<16|(255&i.charCodeAt(++h))<<24))+((1540483477*(r>>>16)&65535)<<16),c=1540483477*(65535&c)+((1540483477*(c>>>16)&65535)<<16)^(r=1540483477*(65535&(r^=r>>>24))+((1540483477*(r>>>16)&65535)<<16)),o-=4,++h;switch(o){case 3:c^=(255&i.charCodeAt(h+2))<<16;case 2:c^=(255&i.charCodeAt(h+1))<<8;case 1:c=1540483477*(65535&(c^=255&i.charCodeAt(h)))+((1540483477*(c>>>16)&65535)<<16)}return c=1540483477*(65535&(c^=c>>>13))+((1540483477*(c>>>16)&65535)<<16),(c^=c>>>15)>>>0};var en=Bt.exports,Ds=Vi.exports;ii.exports=en,ii.exports.murmur3=en,ii.exports.murmur2=Ds;class Dn{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,r,o,c){this.ids.push($a(e)),this.positions.push(r,o,c)}getPositions(e){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const r=$a(e);let o=0,c=this.ids.length-1;for(;o<c;){const d=o+c>>1;this.ids[d]>=r?c=d:o=d+1}const h=[];for(;this.ids[o]===r;)h.push({index:this.positions[3*o],start:this.positions[3*o+1],end:this.positions[3*o+2]}),o++;return h}static serialize(e,r){const o=new Float64Array(e.ids),c=new Uint32Array(e.positions);return Ls(o,c,0,o.length-1),r&&r.push(o.buffer,c.buffer),{ids:o,positions:c}}static deserialize(e){const r=new Dn;return r.ids=e.ids,r.positions=e.positions,r.indexed=!0,r}}function $a(i){const e=+i;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:ii.exports(String(i))}function Ls(i,e,r,o){for(;r<o;){const c=i[r+o>>1];let h=r-1,d=o+1;for(;;){do h++;while(i[h]<c);do d--;while(i[d]>c);if(h>=d)break;Vr(i,h,d),Vr(e,3*h,3*d),Vr(e,3*h+1,3*d+1),Vr(e,3*h+2,3*d+2)}d-r<o-d?(Ls(i,e,r,d),r=d+1):(Ls(i,e,d+1,o),o=d)}}function Vr(i,e,r){const o=i[e];i[e]=i[r],i[r]=o}Fe("FeaturePositionMap",Dn);class tn{constructor(e,r){this.gl=e.gl,this.location=r}}class rn extends tn{constructor(e,r){super(e,r),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1f(this.location,e))}}class Go extends tn{constructor(e,r){super(e,r),this.current=[0,0,0,0]}set(e){e[0]===this.current[0]&&e[1]===this.current[1]&&e[2]===this.current[2]&&e[3]===this.current[3]||(this.current=e,this.gl.uniform4f(this.location,e[0],e[1],e[2],e[3]))}}class Mc extends tn{constructor(e,r){super(e,r),this.current=D.transparent}set(e){e.r===this.current.r&&e.g===this.current.g&&e.b===this.current.b&&e.a===this.current.a||(this.current=e,this.gl.uniform4f(this.location,e.r,e.g,e.b,e.a))}}const Mh=new Float32Array(16);function Ll(i){return[xt(255*i.r,255*i.g),xt(255*i.b,255*i.a)]}class Rs{constructor(e,r,o){this.value=e,this.uniformNames=r.map(c=>`u_${c}`),this.type=o}setUniform(e,r,o){e.set(o.constantOr(this.value))}getBinding(e,r,o){return this.type==="color"?new Mc(e,r):new rn(e,r)}}class qo{constructor(e,r){this.uniformNames=r.map(o=>`u_${o}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(e,r){this.pixelRatioFrom=r.pixelRatio,this.pixelRatioTo=e.pixelRatio,this.patternFrom=r.tlbr,this.patternTo=e.tlbr}setUniform(e,r,o,c){const h=c==="u_pattern_to"?this.patternTo:c==="u_pattern_from"?this.patternFrom:c==="u_pixel_ratio_to"?this.pixelRatioTo:c==="u_pixel_ratio_from"?this.pixelRatioFrom:null;h&&e.set(h)}getBinding(e,r,o){return o.substr(0,9)==="u_pattern"?new Go(e,r):new rn(e,r)}}class nn{constructor(e,r,o,c){this.expression=e,this.type=o,this.maxValue=0,this.paintVertexAttributes=r.map(h=>({name:`a_${h}`,type:"Float32",components:o==="color"?2:1,offset:0})),this.paintVertexArray=new c}populatePaintArray(e,r,o,c,h){const d=this.paintVertexArray.length,m=this.expression.evaluate(new Rt(0),r,{},c,[],h);this.paintVertexArray.resize(e),this._setPaintValue(d,e,m)}updatePaintArray(e,r,o,c){const h=this.expression.evaluate({zoom:0},o,c);this._setPaintValue(e,r,h)}_setPaintValue(e,r,o){if(this.type==="color"){const c=Ll(o);for(let h=e;h<r;h++)this.paintVertexArray.emplace(h,c[0],c[1])}else{for(let c=e;c<r;c++)this.paintVertexArray.emplace(c,o);this.maxValue=Math.max(this.maxValue,Math.abs(o))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class vr{constructor(e,r,o,c,h,d){this.expression=e,this.uniformNames=r.map(m=>`u_${m}_t`),this.type=o,this.useIntegerZoom=c,this.zoom=h,this.maxValue=0,this.paintVertexAttributes=r.map(m=>({name:`a_${m}`,type:"Float32",components:o==="color"?4:2,offset:0})),this.paintVertexArray=new d}populatePaintArray(e,r,o,c,h){const d=this.expression.evaluate(new Rt(this.zoom),r,{},c,[],h),m=this.expression.evaluate(new Rt(this.zoom+1),r,{},c,[],h),g=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(g,e,d,m)}updatePaintArray(e,r,o,c){const h=this.expression.evaluate({zoom:this.zoom},o,c),d=this.expression.evaluate({zoom:this.zoom+1},o,c);this._setPaintValue(e,r,h,d)}_setPaintValue(e,r,o,c){if(this.type==="color"){const h=Ll(o),d=Ll(c);for(let m=e;m<r;m++)this.paintVertexArray.emplace(m,h[0],h[1],d[0],d[1])}else{for(let h=e;h<r;h++)this.paintVertexArray.emplace(h,o,c);this.maxValue=Math.max(this.maxValue,Math.abs(o),Math.abs(c))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(e,r){const o=this.useIntegerZoom?Math.floor(r.zoom):r.zoom,c=se(this.expression.interpolationFactor(o,this.zoom,this.zoom+1),0,1);e.set(c)}getBinding(e,r,o){return new rn(e,r)}}class Ln{constructor(e,r,o,c,h,d){this.expression=e,this.type=r,this.useIntegerZoom=o,this.zoom=c,this.layerId=d,this.zoomInPaintVertexArray=new h,this.zoomOutPaintVertexArray=new h}populatePaintArray(e,r,o){const c=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(e),this.zoomOutPaintVertexArray.resize(e),this._setPaintValues(c,e,r.patterns&&r.patterns[this.layerId],o)}updatePaintArray(e,r,o,c,h){this._setPaintValues(e,r,o.patterns&&o.patterns[this.layerId],h)}_setPaintValues(e,r,o,c){if(!c||!o)return;const{min:h,mid:d,max:m}=o,g=c[h],x=c[d],w=c[m];if(g&&x&&w)for(let E=e;E<r;E++)this.zoomInPaintVertexArray.emplace(E,x.tl[0],x.tl[1],x.br[0],x.br[1],g.tl[0],g.tl[1],g.br[0],g.br[1],x.pixelRatio,g.pixelRatio),this.zoomOutPaintVertexArray.emplace(E,x.tl[0],x.tl[1],x.br[0],x.br[1],w.tl[0],w.tl[1],w.br[0],w.br[1],x.pixelRatio,w.pixelRatio)}upload(e){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=e.createVertexBuffer(this.zoomInPaintVertexArray,ti.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=e.createVertexBuffer(this.zoomOutPaintVertexArray,ti.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class zc{constructor(e,r,o){this.binders={},this._buffers=[];const c=[];for(const h in e.paint._values){if(!o(h))continue;const d=e.paint.get(h);if(!(d instanceof ir&&zt(d.property.specification)))continue;const m=zh(h,e.type),g=d.value,x=d.property.specification.type,w=d.property.useIntegerZoom,E=d.property.specification["property-type"],A=E==="cross-faded"||E==="cross-faded-data-driven";if(g.kind==="constant")this.binders[h]=A?new qo(g.value,m):new Rs(g.value,m,x),c.push(`/u_${h}`);else if(g.kind==="source"||A){const M=Pc(h,x,"source");this.binders[h]=A?new Ln(g,x,w,r,M,e.id):new nn(g,m,x,M),c.push(`/a_${h}`)}else{const M=Pc(h,x,"composite");this.binders[h]=new vr(g,m,x,w,r,M),c.push(`/z_${h}`)}}this.cacheKey=c.sort().join("")}getMaxValue(e){const r=this.binders[e];return r instanceof nn||r instanceof vr?r.maxValue:0}populatePaintArrays(e,r,o,c,h){for(const d in this.binders){const m=this.binders[d];(m instanceof nn||m instanceof vr||m instanceof Ln)&&m.populatePaintArray(e,r,o,c,h)}}setConstantPatternPositions(e,r){for(const o in this.binders){const c=this.binders[o];c instanceof qo&&c.setConstantPatternPositions(e,r)}}updatePaintArrays(e,r,o,c,h){let d=!1;for(const m in e){const g=r.getPositions(m);for(const x of g){const w=o.feature(x.index);for(const E in this.binders){const A=this.binders[E];if((A instanceof nn||A instanceof vr||A instanceof Ln)&&A.expression.isStateDependent===!0){const M=c.paint.get(E);A.expression=M.value,A.updatePaintArray(x.start,x.end,w,e[m],h),d=!0}}}}return d}defines(){const e=[];for(const r in this.binders){const o=this.binders[r];(o instanceof Rs||o instanceof qo)&&e.push(...o.uniformNames.map(c=>`#define HAS_UNIFORM_${c}`))}return e}getBinderAttributes(){const e=[];for(const r in this.binders){const o=this.binders[r];if(o instanceof nn||o instanceof vr)for(let c=0;c<o.paintVertexAttributes.length;c++)e.push(o.paintVertexAttributes[c].name);else if(o instanceof Ln)for(let c=0;c<ti.members.length;c++)e.push(ti.members[c].name)}return e}getBinderUniforms(){const e=[];for(const r in this.binders){const o=this.binders[r];if(o instanceof Rs||o instanceof qo||o instanceof vr)for(const c of o.uniformNames)e.push(c)}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e,r){const o=[];for(const c in this.binders){const h=this.binders[c];if(h instanceof Rs||h instanceof qo||h instanceof vr){for(const d of h.uniformNames)if(r[d]){const m=h.getBinding(e,r[d],d);o.push({name:d,property:c,binding:m})}}}return o}setUniforms(e,r,o,c){for(const{name:h,property:d,binding:m}of r)this.binders[d].setUniform(m,c,o.get(d),h)}updatePaintBuffers(e){this._buffers=[];for(const r in this.binders){const o=this.binders[r];if(e&&o instanceof Ln){const c=e.fromScale===2?o.zoomInPaintVertexBuffer:o.zoomOutPaintVertexBuffer;c&&this._buffers.push(c)}else(o instanceof nn||o instanceof vr)&&o.paintVertexBuffer&&this._buffers.push(o.paintVertexBuffer)}}upload(e){for(const r in this.binders){const o=this.binders[r];(o instanceof nn||o instanceof vr||o instanceof Ln)&&o.upload(e)}this.updatePaintBuffers()}destroy(){for(const e in this.binders){const r=this.binders[e];(r instanceof nn||r instanceof vr||r instanceof Ln)&&r.destroy()}}}class fo{constructor(e,r,o=()=>!0){this.programConfigurations={};for(const c of e)this.programConfigurations[c.id]=new zc(c,r,o);this.needsUpload=!1,this._featureMap=new Dn,this._bufferOffset=0}populatePaintArrays(e,r,o,c,h,d){for(const m in this.programConfigurations)this.programConfigurations[m].populatePaintArrays(e,r,c,h,d);r.id!==void 0&&this._featureMap.add(r.id,o,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,r,o,c){for(const h of o)this.needsUpload=this.programConfigurations[h.id].updatePaintArrays(e,this._featureMap,r,h,c)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(const r in this.programConfigurations)this.programConfigurations[r].upload(e);this.needsUpload=!1}}destroy(){for(const e in this.programConfigurations)this.programConfigurations[e].destroy()}}function zh(i,e){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[i]||[i.replace(`${e}-`,"").replace(/-/g,"_")]}function Pc(i,e,r){const o={color:{source:s,composite:ne},number:{source:B,composite:s}},c=function(h){return{"line-pattern":{source:ei,composite:ei},"fill-pattern":{source:ei,composite:ei},"fill-extrusion-pattern":{source:ei,composite:ei}}[h]}(i);return c&&c[r]||o[e][r]}Fe("ConstantBinder",Rs),Fe("CrossFadedConstantBinder",qo),Fe("SourceExpressionBinder",nn),Fe("CrossFadedCompositeBinder",Ln),Fe("CompositeExpressionBinder",vr),Fe("ProgramConfiguration",zc,{omit:["_buffers"]}),Fe("ProgramConfigurationSet",fo);var Kt=8192;const Rl=Math.pow(2,14)-1,kc=-Rl-1;function mo(i){const e=Kt/i.extent,r=i.loadGeometry();for(let o=0;o<r.length;o++){const c=r[o];for(let h=0;h<c.length;h++){const d=c[h],m=Math.round(d.x*e),g=Math.round(d.y*e);d.x=se(m,kc,Rl),d.y=se(g,kc,Rl),(m<d.x||m>d.x+1||g<d.y||g>d.y+1)&&$t("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return r}function go(i,e){return{type:i.type,id:i.id,properties:i.properties,geometry:e?mo(i):[]}}function Va(i,e,r,o,c){i.emplaceBack(2*e+(o+1)/2,2*r+(c+1)/2)}class Bl{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new bt,this.indexArray=new bi,this.segments=new ot,this.programConfigurations=new fo(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,o){const c=this.layers[0],h=[];let d=null,m=!1;c.type==="circle"&&(d=c.layout.get("circle-sort-key"),m=!d.isConstant());for(const{feature:g,id:x,index:w,sourceLayerIndex:E}of e){const A=this.layers[0]._featureFilter.needGeometry,M=go(g,A);if(!this.layers[0]._featureFilter.filter(new Rt(this.zoom),M,o))continue;const z=m?d.evaluate(M,{},o):void 0,V={id:x,properties:g.properties,type:g.type,sourceLayerIndex:E,index:w,geometry:A?M.geometry:mo(g),patterns:{},sortKey:z};h.push(V)}m&&h.sort((g,x)=>g.sortKey-x.sortKey);for(const g of h){const{geometry:x,index:w,sourceLayerIndex:E}=g,A=e[w].feature;this.addFeature(g,x,w,o),r.featureIndex.insert(A,x,w,E,this.index)}}update(e,r,o){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,o)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Ht),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(e,r,o,c){for(const h of r)for(const d of h){const m=d.x,g=d.y;if(m<0||m>=Kt||g<0||g>=Kt)continue;const x=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),w=x.vertexLength;Va(this.layoutVertexArray,m,g,-1,-1),Va(this.layoutVertexArray,m,g,1,-1),Va(this.layoutVertexArray,m,g,1,1),Va(this.layoutVertexArray,m,g,-1,1),this.indexArray.emplaceBack(w,w+1,w+2),this.indexArray.emplaceBack(w,w+3,w+2),x.vertexLength+=4,x.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,o,{},c)}}function Dc(i,e){for(let r=0;r<i.length;r++)if(Zo(e,i[r]))return!0;for(let r=0;r<e.length;r++)if(Zo(i,e[r]))return!0;return!!Fl(i,e)}function Ph(i,e,r){return!!Zo(i,e)||!!Ol(e,i,r)}function Lc(i,e){if(i.length===1)return Bc(e,i[0]);for(let r=0;r<e.length;r++){const o=e[r];for(let c=0;c<o.length;c++)if(Zo(i,o[c]))return!0}for(let r=0;r<i.length;r++)if(Bc(e,i[r]))return!0;for(let r=0;r<e.length;r++)if(Fl(i,e[r]))return!0;return!1}function kh(i,e,r){if(i.length>1){if(Fl(i,e))return!0;for(let o=0;o<e.length;o++)if(Ol(e[o],i,r))return!0}for(let o=0;o<i.length;o++)if(Ol(i[o],e,r))return!0;return!1}function Fl(i,e){if(i.length===0||e.length===0)return!1;for(let r=0;r<i.length-1;r++){const o=i[r],c=i[r+1];for(let h=0;h<e.length-1;h++)if(Dh(o,c,e[h],e[h+1]))return!0}return!1}function Dh(i,e,r,o){return Gi(i,r,o)!==Gi(e,r,o)&&Gi(i,e,r)!==Gi(i,e,o)}function Ol(i,e,r){const o=r*r;if(e.length===1)return i.distSqr(e[0])<o;for(let c=1;c<e.length;c++)if(Rc(i,e[c-1],e[c])<o)return!0;return!1}function Rc(i,e,r){const o=e.distSqr(r);if(o===0)return i.distSqr(e);const c=((i.x-e.x)*(r.x-e.x)+(i.y-e.y)*(r.y-e.y))/o;return i.distSqr(c<0?e:c>1?r:r.sub(e)._mult(c)._add(e))}function Bc(i,e){let r,o,c,h=!1;for(let d=0;d<i.length;d++){r=i[d];for(let m=0,g=r.length-1;m<r.length;g=m++)o=r[m],c=r[g],o.y>e.y!=c.y>e.y&&e.x<(c.x-o.x)*(e.y-o.y)/(c.y-o.y)+o.x&&(h=!h)}return h}function Zo(i,e){let r=!1;for(let o=0,c=i.length-1;o<i.length;c=o++){const h=i[o],d=i[c];h.y>e.y!=d.y>e.y&&e.x<(d.x-h.x)*(e.y-h.y)/(d.y-h.y)+h.x&&(r=!r)}return r}function Lh(i,e,r){const o=r[0],c=r[2];if(i.x<o.x&&e.x<o.x||i.x>c.x&&e.x>c.x||i.y<o.y&&e.y<o.y||i.y>c.y&&e.y>c.y)return!1;const h=Gi(i,e,r[0]);return h!==Gi(i,e,r[1])||h!==Gi(i,e,r[2])||h!==Gi(i,e,r[3])}function Bs(i,e,r){const o=e.paint.get(i).value;return o.kind==="constant"?o.value:r.programConfigurations.get(e.id).getMaxValue(i)}function Na(i){return Math.sqrt(i[0]*i[0]+i[1]*i[1])}function Ga(i,e,r,o,c){if(!e[0]&&!e[1])return i;const h=We.convert(e)._mult(c);r==="viewport"&&h._rotate(-o);const d=[];for(let m=0;m<i.length;m++)d.push(i[m].sub(h));return d}Fe("CircleBucket",Bl,{omit:["layers"]});const Rh=new si({"circle-sort-key":new je(pe.layout_circle["circle-sort-key"])});var Bh={paint:new si({"circle-radius":new je(pe.paint_circle["circle-radius"]),"circle-color":new je(pe.paint_circle["circle-color"]),"circle-blur":new je(pe.paint_circle["circle-blur"]),"circle-opacity":new je(pe.paint_circle["circle-opacity"]),"circle-translate":new Ve(pe.paint_circle["circle-translate"]),"circle-translate-anchor":new Ve(pe.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new Ve(pe.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new Ve(pe.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new je(pe.paint_circle["circle-stroke-width"]),"circle-stroke-color":new je(pe.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new je(pe.paint_circle["circle-stroke-opacity"])}),layout:Rh},wi=1e-6,Ti=typeof Float32Array<"u"?Float32Array:Array;function Fc(){var i=new Ti(9);return Ti!=Float32Array&&(i[1]=0,i[2]=0,i[3]=0,i[5]=0,i[6]=0,i[7]=0),i[0]=1,i[4]=1,i[8]=1,i}function Ul(i){return i[0]=1,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=1,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=1,i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i}function Oc(i,e,r){var o=e[0],c=e[1],h=e[2],d=e[3],m=e[4],g=e[5],x=e[6],w=e[7],E=e[8],A=e[9],M=e[10],z=e[11],V=e[12],U=e[13],ee=e[14],oe=e[15],Y=r[0],re=r[1],fe=r[2],de=r[3];return i[0]=Y*o+re*m+fe*E+de*V,i[1]=Y*c+re*g+fe*A+de*U,i[2]=Y*h+re*x+fe*M+de*ee,i[3]=Y*d+re*w+fe*z+de*oe,i[4]=(Y=r[4])*o+(re=r[5])*m+(fe=r[6])*E+(de=r[7])*V,i[5]=Y*c+re*g+fe*A+de*U,i[6]=Y*h+re*x+fe*M+de*ee,i[7]=Y*d+re*w+fe*z+de*oe,i[8]=(Y=r[8])*o+(re=r[9])*m+(fe=r[10])*E+(de=r[11])*V,i[9]=Y*c+re*g+fe*A+de*U,i[10]=Y*h+re*x+fe*M+de*ee,i[11]=Y*d+re*w+fe*z+de*oe,i[12]=(Y=r[12])*o+(re=r[13])*m+(fe=r[14])*E+(de=r[15])*V,i[13]=Y*c+re*g+fe*A+de*U,i[14]=Y*h+re*x+fe*M+de*ee,i[15]=Y*d+re*w+fe*z+de*oe,i}Math.hypot||(Math.hypot=function(){for(var i=0,e=arguments.length;e--;)i+=arguments[e]*arguments[e];return Math.sqrt(i)});var Fs,Fh=Oc;function Uc(){var i=new Ti(3);return Ti!=Float32Array&&(i[0]=0,i[1]=0,i[2]=0),i}function $c(i,e,r){var o=new Ti(3);return o[0]=i,o[1]=e,o[2]=r,o}function qa(i,e,r){var o=e[0],c=e[1],h=e[2],d=e[3];return i[0]=r[0]*o+r[4]*c+r[8]*h+r[12]*d,i[1]=r[1]*o+r[5]*c+r[9]*h+r[13]*d,i[2]=r[2]*o+r[6]*c+r[10]*h+r[14]*d,i[3]=r[3]*o+r[7]*c+r[11]*h+r[15]*d,i}function Vc(){var i=new Ti(4);return Ti!=Float32Array&&(i[0]=0,i[1]=0,i[2]=0),i[3]=1,i}function Nc(i,e){const r=qa([],[i.x,i.y,0,1],e);return new We(r[0]/r[3],r[1]/r[3])}Uc(),Fs=new Ti(4),Ti!=Float32Array&&(Fs[0]=0,Fs[1]=0,Fs[2]=0,Fs[3]=0),Uc(),$c(1,0,0),$c(0,1,0),Vc(),Vc(),Fc(),function(){var i;i=new Ti(2),Ti!=Float32Array&&(i[0]=0,i[1]=0)}();class Gc extends Bl{}Fe("HeatmapBucket",Gc,{omit:["layers"]});var Oh={paint:new si({"heatmap-radius":new je(pe.paint_heatmap["heatmap-radius"]),"heatmap-weight":new je(pe.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Ve(pe.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Fr(pe.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Ve(pe.paint_heatmap["heatmap-opacity"])})};function $l(i,{width:e,height:r},o,c){if(c){if(c instanceof Uint8ClampedArray)c=new Uint8Array(c.buffer);else if(c.length!==e*r*o)throw new RangeError(`mismatched image size. expected: ${c.length} but got: ${e*r*o}`)}else c=new Uint8Array(e*r*o);return i.width=e,i.height=r,i.data=c,i}function qc(i,{width:e,height:r},o){if(e===i.width&&r===i.height)return;const c=$l({},{width:e,height:r},o);Vl(i,c,{x:0,y:0},{x:0,y:0},{width:Math.min(i.width,e),height:Math.min(i.height,r)},o),i.width=e,i.height=r,i.data=c.data}function Vl(i,e,r,o,c,h){if(c.width===0||c.height===0)return e;if(c.width>i.width||c.height>i.height||r.x>i.width-c.width||r.y>i.height-c.height)throw new RangeError("out of range source coordinates for image copy");if(c.width>e.width||c.height>e.height||o.x>e.width-c.width||o.y>e.height-c.height)throw new RangeError("out of range destination coordinates for image copy");const d=i.data,m=e.data;if(d===m)throw new Error("srcData equals dstData, so image is already copied");for(let g=0;g<c.height;g++){const x=((r.y+g)*i.width+r.x)*h,w=((o.y+g)*e.width+o.x)*h;for(let E=0;E<c.width*h;E++)m[w+E]=d[x+E]}return e}class Os{constructor(e,r){$l(this,e,1,r)}resize(e){qc(this,e,1)}clone(){return new Os({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,r,o,c,h){Vl(e,r,o,c,h,1)}}class Hi{constructor(e,r){$l(this,e,4,r)}resize(e){qc(this,e,4)}replace(e,r){r?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new Hi({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,r,o,c,h){Vl(e,r,o,c,h,4)}}function Zc(i){const e={},r=i.resolution||256,o=i.clips?i.clips.length:1,c=i.image||new Hi({width:r,height:o});if(Math.log(r)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${r}`);const h=(d,m,g)=>{e[i.evaluationKey]=g;const x=i.expression.evaluate(e);c.data[d+m+0]=Math.floor(255*x.r/x.a),c.data[d+m+1]=Math.floor(255*x.g/x.a),c.data[d+m+2]=Math.floor(255*x.b/x.a),c.data[d+m+3]=Math.floor(255*x.a)};if(i.clips)for(let d=0,m=0;d<o;++d,m+=4*r)for(let g=0,x=0;g<r;g++,x+=4){const w=g/(r-1),{start:E,end:A}=i.clips[d];h(m,x,E*(1-w)+A*w)}else for(let d=0,m=0;d<r;d++,m+=4)h(0,m,d/(r-1));return c}Fe("AlphaImage",Os),Fe("RGBAImage",Hi);var Uh={paint:new si({"hillshade-illumination-direction":new Ve(pe.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new Ve(pe.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new Ve(pe.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new Ve(pe.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new Ve(pe.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new Ve(pe.paint_hillshade["hillshade-accent-color"])})};const $h=Zt([{name:"a_pos",components:2,type:"Int16"}],4),{members:Vh}=$h;var Za={exports:{}};function ja(i,e,r){r=r||2;var o,c,h,d,m,g,x,w=e&&e.length,E=w?e[0]*r:i.length,A=jc(i,0,E,r,!0),M=[];if(!A||A.next===A.prev)return M;if(w&&(A=function(V,U,ee,oe){var Y,re,fe,de=[];for(Y=0,re=U.length;Y<re;Y++)(fe=jc(V,U[Y]*oe,Y<re-1?U[Y+1]*oe:V.length,oe,!1))===fe.next&&(fe.steiner=!0),de.push(Hh(fe));for(de.sort(jh),Y=0;Y<de.length;Y++)ee=Xh(de[Y],ee);return ee}(i,e,A,r)),i.length>80*r){o=h=i[0],c=d=i[1];for(var z=r;z<E;z+=r)(m=i[z])<o&&(o=m),(g=i[z+1])<c&&(c=g),m>h&&(h=m),g>d&&(d=g);x=(x=Math.max(h-o,d-c))!==0?32767/x:0}return Us(A,M,r,o,c,x,0),M}function jc(i,e,r,o,c){var h,d;if(c===ql(i,e,r,o)>0)for(h=e;h<r;h+=o)d=Hc(h,i[h],i[h+1],d);else for(h=r-o;h>=e;h-=o)d=Hc(h,i[h],i[h+1],d);return d&&Xa(d,d.next)&&(Vs(d),d=d.next),d}function _o(i,e){if(!i)return i;e||(e=i);var r,o=i;do if(r=!1,o.steiner||!Xa(o,o.next)&&Gt(o.prev,o,o.next)!==0)o=o.next;else{if(Vs(o),(o=e=o.prev)===o.next)break;r=!0}while(r||o!==e);return e}function Us(i,e,r,o,c,h,d){if(i){!d&&h&&function(w,E,A,M){var z=w;do z.z===0&&(z.z=Nl(z.x,z.y,E,A,M)),z.prevZ=z.prev,z.nextZ=z.next,z=z.next;while(z!==w);z.prevZ.nextZ=null,z.prevZ=null,function(V){var U,ee,oe,Y,re,fe,de,Be,Ue=1;do{for(ee=V,V=null,re=null,fe=0;ee;){for(fe++,oe=ee,de=0,U=0;U<Ue&&(de++,oe=oe.nextZ);U++);for(Be=Ue;de>0||Be>0&&oe;)de!==0&&(Be===0||!oe||ee.z<=oe.z)?(Y=ee,ee=ee.nextZ,de--):(Y=oe,oe=oe.nextZ,Be--),re?re.nextZ=Y:V=Y,Y.prevZ=re,re=Y;ee=oe}re.nextZ=null,Ue*=2}while(fe>1)}(z)}(i,o,c,h);for(var m,g,x=i;i.prev!==i.next;)if(m=i.prev,g=i.next,h?Gh(i,o,c,h):Nh(i))e.push(m.i/r|0),e.push(i.i/r|0),e.push(g.i/r|0),Vs(i),i=g.next,x=g.next;else if((i=g)===x){d?d===1?Us(i=qh(_o(i),e,r),e,r,o,c,h,2):d===2&&Zh(i,e,r,o,c,h):Us(_o(i),e,r,o,c,h,1);break}}}function Nh(i){var e=i.prev,r=i,o=i.next;if(Gt(e,r,o)>=0)return!1;for(var c=e.x,h=r.x,d=o.x,m=e.y,g=r.y,x=o.y,w=c<h?c<d?c:d:h<d?h:d,E=m<g?m<x?m:x:g<x?g:x,A=c>h?c>d?c:d:h>d?h:d,M=m>g?m>x?m:x:g>x?g:x,z=o.next;z!==e;){if(z.x>=w&&z.x<=A&&z.y>=E&&z.y<=M&&jo(c,m,h,g,d,x,z.x,z.y)&&Gt(z.prev,z,z.next)>=0)return!1;z=z.next}return!0}function Gh(i,e,r,o){var c=i.prev,h=i,d=i.next;if(Gt(c,h,d)>=0)return!1;for(var m=c.x,g=h.x,x=d.x,w=c.y,E=h.y,A=d.y,M=m<g?m<x?m:x:g<x?g:x,z=w<E?w<A?w:A:E<A?E:A,V=m>g?m>x?m:x:g>x?g:x,U=w>E?w>A?w:A:E>A?E:A,ee=Nl(M,z,e,r,o),oe=Nl(V,U,e,r,o),Y=i.prevZ,re=i.nextZ;Y&&Y.z>=ee&&re&&re.z<=oe;){if(Y.x>=M&&Y.x<=V&&Y.y>=z&&Y.y<=U&&Y!==c&&Y!==d&&jo(m,w,g,E,x,A,Y.x,Y.y)&&Gt(Y.prev,Y,Y.next)>=0||(Y=Y.prevZ,re.x>=M&&re.x<=V&&re.y>=z&&re.y<=U&&re!==c&&re!==d&&jo(m,w,g,E,x,A,re.x,re.y)&&Gt(re.prev,re,re.next)>=0))return!1;re=re.nextZ}for(;Y&&Y.z>=ee;){if(Y.x>=M&&Y.x<=V&&Y.y>=z&&Y.y<=U&&Y!==c&&Y!==d&&jo(m,w,g,E,x,A,Y.x,Y.y)&&Gt(Y.prev,Y,Y.next)>=0)return!1;Y=Y.prevZ}for(;re&&re.z<=oe;){if(re.x>=M&&re.x<=V&&re.y>=z&&re.y<=U&&re!==c&&re!==d&&jo(m,w,g,E,x,A,re.x,re.y)&&Gt(re.prev,re,re.next)>=0)return!1;re=re.nextZ}return!0}function qh(i,e,r){var o=i;do{var c=o.prev,h=o.next.next;!Xa(c,h)&&Xc(c,o,o.next,h)&&$s(c,h)&&$s(h,c)&&(e.push(c.i/r|0),e.push(o.i/r|0),e.push(h.i/r|0),Vs(o),Vs(o.next),o=i=h),o=o.next}while(o!==i);return _o(o)}function Zh(i,e,r,o,c,h){var d=i;do{for(var m=d.next.next;m!==d.prev;){if(d.i!==m.i&&Kh(d,m)){var g=Wc(d,m);return d=_o(d,d.next),g=_o(g,g.next),Us(d,e,r,o,c,h,0),void Us(g,e,r,o,c,h,0)}m=m.next}d=d.next}while(d!==i)}function jh(i,e){return i.x-e.x}function Xh(i,e){var r=function(c,h){var d,m=h,g=c.x,x=c.y,w=-1/0;do{if(x<=m.y&&x>=m.next.y&&m.next.y!==m.y){var E=m.x+(x-m.y)*(m.next.x-m.x)/(m.next.y-m.y);if(E<=g&&E>w&&(w=E,d=m.x<m.next.x?m:m.next,E===g))return d}m=m.next}while(m!==h);if(!d)return null;var A,M=d,z=d.x,V=d.y,U=1/0;m=d;do g>=m.x&&m.x>=z&&g!==m.x&&jo(x<V?g:w,x,z,V,x<V?w:g,x,m.x,m.y)&&(A=Math.abs(x-m.y)/(g-m.x),$s(m,c)&&(A<U||A===U&&(m.x>d.x||m.x===d.x&&Wh(d,m)))&&(d=m,U=A)),m=m.next;while(m!==M);return d}(i,e);if(!r)return e;var o=Wc(r,i);return _o(o,o.next),_o(r,r.next)}function Wh(i,e){return Gt(i.prev,i,e.prev)<0&&Gt(e.next,i,i.next)<0}function Nl(i,e,r,o,c){return(i=1431655765&((i=858993459&((i=252645135&((i=16711935&((i=(i-r)*c|0)|i<<8))|i<<4))|i<<2))|i<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-o)*c|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Hh(i){var e=i,r=i;do(e.x<r.x||e.x===r.x&&e.y<r.y)&&(r=e),e=e.next;while(e!==i);return r}function jo(i,e,r,o,c,h,d,m){return(c-d)*(e-m)>=(i-d)*(h-m)&&(i-d)*(o-m)>=(r-d)*(e-m)&&(r-d)*(h-m)>=(c-d)*(o-m)}function Kh(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!function(r,o){var c=r;do{if(c.i!==r.i&&c.next.i!==r.i&&c.i!==o.i&&c.next.i!==o.i&&Xc(c,c.next,r,o))return!0;c=c.next}while(c!==r);return!1}(i,e)&&($s(i,e)&&$s(e,i)&&function(r,o){var c=r,h=!1,d=(r.x+o.x)/2,m=(r.y+o.y)/2;do c.y>m!=c.next.y>m&&c.next.y!==c.y&&d<(c.next.x-c.x)*(m-c.y)/(c.next.y-c.y)+c.x&&(h=!h),c=c.next;while(c!==r);return h}(i,e)&&(Gt(i.prev,i,e.prev)||Gt(i,e.prev,e))||Xa(i,e)&&Gt(i.prev,i,i.next)>0&&Gt(e.prev,e,e.next)>0)}function Gt(i,e,r){return(e.y-i.y)*(r.x-e.x)-(e.x-i.x)*(r.y-e.y)}function Xa(i,e){return i.x===e.x&&i.y===e.y}function Xc(i,e,r,o){var c=Ha(Gt(i,e,r)),h=Ha(Gt(i,e,o)),d=Ha(Gt(r,o,i)),m=Ha(Gt(r,o,e));return c!==h&&d!==m||!(c!==0||!Wa(i,r,e))||!(h!==0||!Wa(i,o,e))||!(d!==0||!Wa(r,i,o))||!(m!==0||!Wa(r,e,o))}function Wa(i,e,r){return e.x<=Math.max(i.x,r.x)&&e.x>=Math.min(i.x,r.x)&&e.y<=Math.max(i.y,r.y)&&e.y>=Math.min(i.y,r.y)}function Ha(i){return i>0?1:i<0?-1:0}function $s(i,e){return Gt(i.prev,i,i.next)<0?Gt(i,e,i.next)>=0&&Gt(i,i.prev,e)>=0:Gt(i,e,i.prev)<0||Gt(i,i.next,e)<0}function Wc(i,e){var r=new Gl(i.i,i.x,i.y),o=new Gl(e.i,e.x,e.y),c=i.next,h=e.prev;return i.next=e,e.prev=i,r.next=c,c.prev=r,o.next=r,r.prev=o,h.next=o,o.prev=h,o}function Hc(i,e,r,o){var c=new Gl(i,e,r);return o?(c.next=o.next,c.prev=o,o.next.prev=c,o.next=c):(c.prev=c,c.next=c),c}function Vs(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function Gl(i,e,r){this.i=i,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function ql(i,e,r,o){for(var c=0,h=e,d=r-o;h<r;h+=o)c+=(i[d]-i[h])*(i[h+1]+i[d+1]),d=h;return c}function Jh(i,e,r,o,c){Kc(i,e,r||0,o||i.length-1,c||Yh)}function Kc(i,e,r,o,c){for(;o>r;){if(o-r>600){var h=o-r+1,d=e-r+1,m=Math.log(h),g=.5*Math.exp(2*m/3),x=.5*Math.sqrt(m*g*(h-g)/h)*(d-h/2<0?-1:1);Kc(i,e,Math.max(r,Math.floor(e-d*g/h+x)),Math.min(o,Math.floor(e+(h-d)*g/h+x)),c)}var w=i[e],E=r,A=o;for(Ns(i,r,e),c(i[o],w)>0&&Ns(i,r,o);E<A;){for(Ns(i,E,A),E++,A--;c(i[E],w)<0;)E++;for(;c(i[A],w)>0;)A--}c(i[r],w)===0?Ns(i,r,A):Ns(i,++A,o),A<=e&&(r=A+1),e<=A&&(o=A-1)}}function Ns(i,e,r){var o=i[e];i[e]=i[r],i[r]=o}function Yh(i,e){return i<e?-1:i>e?1:0}function Zl(i,e){const r=i.length;if(r<=1)return[i];const o=[];let c,h;for(let d=0;d<r;d++){const m=Fi(i[d]);m!==0&&(i[d].area=Math.abs(m),h===void 0&&(h=m<0),h===m<0?(c&&o.push(c),c=[i[d]]):c.push(i[d]))}if(c&&o.push(c),e>1)for(let d=0;d<o.length;d++)o[d].length<=e||(Jh(o[d],e,1,o[d].length-1,Qh),o[d]=o[d].slice(0,e));return o}function Qh(i,e){return e.area-i.area}function jl(i,e,r){const o=r.patternDependencies;let c=!1;for(const h of e){const d=h.paint.get(`${i}-pattern`);d.isConstant()||(c=!0);const m=d.constantOr(null);m&&(c=!0,o[m.to]=!0,o[m.from]=!0)}return c}function Xl(i,e,r,o,c){const h=c.patternDependencies;for(const d of e){const m=d.paint.get(`${i}-pattern`).value;if(m.kind!=="constant"){let g=m.evaluate({zoom:o-1},r,{},c.availableImages),x=m.evaluate({zoom:o},r,{},c.availableImages),w=m.evaluate({zoom:o+1},r,{},c.availableImages);g=g&&g.name?g.name:g,x=x&&x.name?x.name:x,w=w&&w.name?w.name:w,h[g]=!0,h[x]=!0,h[w]=!0,r.patterns[d.id]={min:g,mid:x,max:w}}}return r}Za.exports=ja,Za.exports.default=ja,ja.deviation=function(i,e,r,o){var c=e&&e.length,h=Math.abs(ql(i,0,c?e[0]*r:i.length,r));if(c)for(var d=0,m=e.length;d<m;d++)h-=Math.abs(ql(i,e[d]*r,d<m-1?e[d+1]*r:i.length,r));var g=0;for(d=0;d<o.length;d+=3){var x=o[d]*r,w=o[d+1]*r,E=o[d+2]*r;g+=Math.abs((i[x]-i[E])*(i[w+1]-i[x+1])-(i[x]-i[w])*(i[E+1]-i[x+1]))}return h===0&&g===0?0:Math.abs((g-h)/h)},ja.flatten=function(i){for(var e=i[0][0].length,r={vertices:[],holes:[],dimensions:e},o=0,c=0;c<i.length;c++){for(var h=0;h<i[c].length;h++)for(var d=0;d<e;d++)r.vertices.push(i[c][h][d]);c>0&&r.holes.push(o+=i[c-1].length)}return r};class Wl{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new wt,this.indexArray=new bi,this.indexArray2=new xr,this.programConfigurations=new fo(e.layers,e.zoom),this.segments=new ot,this.segments2=new ot,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,o){this.hasPattern=jl("fill",this.layers,r);const c=this.layers[0].layout.get("fill-sort-key"),h=!c.isConstant(),d=[];for(const{feature:m,id:g,index:x,sourceLayerIndex:w}of e){const E=this.layers[0]._featureFilter.needGeometry,A=go(m,E);if(!this.layers[0]._featureFilter.filter(new Rt(this.zoom),A,o))continue;const M=h?c.evaluate(A,{},o,r.availableImages):void 0,z={id:g,properties:m.properties,type:m.type,sourceLayerIndex:w,index:x,geometry:E?A.geometry:mo(m),patterns:{},sortKey:M};d.push(z)}h&&d.sort((m,g)=>m.sortKey-g.sortKey);for(const m of d){const{geometry:g,index:x,sourceLayerIndex:w}=m;if(this.hasPattern){const E=Xl("fill",this.layers,m,this.zoom,r);this.patternFeatures.push(E)}else this.addFeature(m,g,x,o,{});r.featureIndex.insert(e[x].feature,g,x,w,this.index)}}update(e,r,o){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,o)}addFeatures(e,r,o){for(const c of this.patternFeatures)this.addFeature(c,c.geometry,c.index,r,o)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Vh),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.indexBuffer2=e.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(e,r,o,c,h){for(const d of Zl(r,500)){let m=0;for(const M of d)m+=M.length;const g=this.segments.prepareSegment(m,this.layoutVertexArray,this.indexArray),x=g.vertexLength,w=[],E=[];for(const M of d){if(M.length===0)continue;M!==d[0]&&E.push(w.length/2);const z=this.segments2.prepareSegment(M.length,this.layoutVertexArray,this.indexArray2),V=z.vertexLength;this.layoutVertexArray.emplaceBack(M[0].x,M[0].y),this.indexArray2.emplaceBack(V+M.length-1,V),w.push(M[0].x),w.push(M[0].y);for(let U=1;U<M.length;U++)this.layoutVertexArray.emplaceBack(M[U].x,M[U].y),this.indexArray2.emplaceBack(V+U-1,V+U),w.push(M[U].x),w.push(M[U].y);z.vertexLength+=M.length,z.primitiveLength+=M.length}const A=Za.exports(w,E);for(let M=0;M<A.length;M+=3)this.indexArray.emplaceBack(x+A[M],x+A[M+1],x+A[M+2]);g.vertexLength+=m,g.primitiveLength+=A.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,o,h,c)}}Fe("FillBucket",Wl,{omit:["layers","patternFeatures"]});const ep=new si({"fill-sort-key":new je(pe.layout_fill["fill-sort-key"])});var tp={paint:new si({"fill-antialias":new Ve(pe.paint_fill["fill-antialias"]),"fill-opacity":new je(pe.paint_fill["fill-opacity"]),"fill-color":new je(pe.paint_fill["fill-color"]),"fill-outline-color":new je(pe.paint_fill["fill-outline-color"]),"fill-translate":new Ve(pe.paint_fill["fill-translate"]),"fill-translate-anchor":new Ve(pe.paint_fill["fill-translate-anchor"]),"fill-pattern":new kn(pe.paint_fill["fill-pattern"])}),layout:ep};const ip=Zt([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),rp=Zt([{name:"a_centroid",components:2,type:"Int16"}],4),{members:np}=ip;var Rn={},op=We,Jc=Xo;function Xo(i,e,r,o,c){this.properties={},this.extent=r,this.type=0,this._pbf=i,this._geometry=-1,this._keys=o,this._values=c,i.readFields(sp,this,e)}function sp(i,e,r){i==1?e.id=r.readVarint():i==2?function(o,c){for(var h=o.readVarint()+o.pos;o.pos<h;){var d=c._keys[o.readVarint()],m=c._values[o.readVarint()];c.properties[d]=m}}(r,e):i==3?e.type=r.readVarint():i==4&&(e._geometry=r.pos)}function ap(i){for(var e,r,o=0,c=0,h=i.length,d=h-1;c<h;d=c++)o+=((r=i[d]).x-(e=i[c]).x)*(e.y+r.y);return o}Xo.types=["Unknown","Point","LineString","Polygon"],Xo.prototype.loadGeometry=function(){var i=this._pbf;i.pos=this._geometry;for(var e,r=i.readVarint()+i.pos,o=1,c=0,h=0,d=0,m=[];i.pos<r;){if(c<=0){var g=i.readVarint();o=7&g,c=g>>3}if(c--,o===1||o===2)h+=i.readSVarint(),d+=i.readSVarint(),o===1&&(e&&m.push(e),e=[]),e.push(new op(h,d));else{if(o!==7)throw new Error("unknown command "+o);e&&e.push(e[0].clone())}}return e&&m.push(e),m},Xo.prototype.bbox=function(){var i=this._pbf;i.pos=this._geometry;for(var e=i.readVarint()+i.pos,r=1,o=0,c=0,h=0,d=1/0,m=-1/0,g=1/0,x=-1/0;i.pos<e;){if(o<=0){var w=i.readVarint();r=7&w,o=w>>3}if(o--,r===1||r===2)(c+=i.readSVarint())<d&&(d=c),c>m&&(m=c),(h+=i.readSVarint())<g&&(g=h),h>x&&(x=h);else if(r!==7)throw new Error("unknown command "+r)}return[d,g,m,x]},Xo.prototype.toGeoJSON=function(i,e,r){var o,c,h=this.extent*Math.pow(2,r),d=this.extent*i,m=this.extent*e,g=this.loadGeometry(),x=Xo.types[this.type];function w(M){for(var z=0;z<M.length;z++){var V=M[z];M[z]=[360*(V.x+d)/h-180,360/Math.PI*Math.atan(Math.exp((180-360*(V.y+m)/h)*Math.PI/180))-90]}}switch(this.type){case 1:var E=[];for(o=0;o<g.length;o++)E[o]=g[o][0];w(g=E);break;case 2:for(o=0;o<g.length;o++)w(g[o]);break;case 3:for(g=function(M){var z=M.length;if(z<=1)return[M];for(var V,U,ee=[],oe=0;oe<z;oe++){var Y=ap(M[oe]);Y!==0&&(U===void 0&&(U=Y<0),U===Y<0?(V&&ee.push(V),V=[M[oe]]):V.push(M[oe]))}return V&&ee.push(V),ee}(g),o=0;o<g.length;o++)for(c=0;c<g[o].length;c++)w(g[o][c])}g.length===1?g=g[0]:x="Multi"+x;var A={type:"Feature",geometry:{type:x,coordinates:g},properties:this.properties};return"id"in this&&(A.id=this.id),A};var lp=Jc,Yc=Qc;function Qc(i,e){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=i,this._keys=[],this._values=[],this._features=[],i.readFields(cp,this,e),this.length=this._features.length}function cp(i,e,r){i===15?e.version=r.readVarint():i===1?e.name=r.readString():i===5?e.extent=r.readVarint():i===2?e._features.push(r.pos):i===3?e._keys.push(r.readString()):i===4&&e._values.push(function(o){for(var c=null,h=o.readVarint()+o.pos;o.pos<h;){var d=o.readVarint()>>3;c=d===1?o.readString():d===2?o.readFloat():d===3?o.readDouble():d===4?o.readVarint64():d===5?o.readVarint():d===6?o.readSVarint():d===7?o.readBoolean():null}return c}(r))}Qc.prototype.feature=function(i){if(i<0||i>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[i];var e=this._pbf.readVarint()+this._pbf.pos;return new lp(this._pbf,e,this.extent,this._keys,this._values)};var up=Yc;function hp(i,e,r){if(i===3){var o=new up(r,r.readVarint()+r.pos);o.length&&(e[o.name]=o)}}Rn.VectorTile=function(i,e){this.layers=i.readFields(hp,{},e)},Rn.VectorTileFeature=Jc,Rn.VectorTileLayer=Yc;const pp=Rn.VectorTileFeature.types,Hl=Math.pow(2,13);function Gs(i,e,r,o,c,h,d,m){i.emplaceBack(e,r,2*Math.floor(o*Hl)+d,c*Hl*2,h*Hl*2,Math.round(m))}class Kl{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new ut,this.centroidVertexArray=new Ge,this.indexArray=new bi,this.programConfigurations=new fo(e.layers,e.zoom),this.segments=new ot,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,o){this.features=[],this.hasPattern=jl("fill-extrusion",this.layers,r);for(const{feature:c,id:h,index:d,sourceLayerIndex:m}of e){const g=this.layers[0]._featureFilter.needGeometry,x=go(c,g);if(!this.layers[0]._featureFilter.filter(new Rt(this.zoom),x,o))continue;const w={id:h,sourceLayerIndex:m,index:d,geometry:g?x.geometry:mo(c),properties:c.properties,type:c.type,patterns:{}};this.hasPattern?this.features.push(Xl("fill-extrusion",this.layers,w,this.zoom,r)):this.addFeature(w,w.geometry,d,o,{}),r.featureIndex.insert(c,w.geometry,d,m,this.index,!0)}}addFeatures(e,r,o){for(const c of this.features){const{geometry:h}=c;this.addFeature(c,h,c.index,r,o)}}update(e,r,o){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,o)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,np),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,rp.members,!0),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(e,r,o,c,h){const d={x:0,y:0,vertexCount:0};for(const m of Zl(r,500)){let g=0;for(const z of m)g+=z.length;let x=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const z of m){if(z.length===0||fp(z))continue;let V=0;for(let U=0;U<z.length;U++){const ee=z[U];if(U>=1){const oe=z[U-1];if(!dp(ee,oe)){x.vertexLength+4>ot.MAX_VERTEX_ARRAY_LENGTH&&(x=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const Y=ee.sub(oe)._perp()._unit(),re=oe.dist(ee);V+re>32768&&(V=0),Gs(this.layoutVertexArray,ee.x,ee.y,Y.x,Y.y,0,0,V),Gs(this.layoutVertexArray,ee.x,ee.y,Y.x,Y.y,0,1,V),d.x+=2*ee.x,d.y+=2*ee.y,d.vertexCount+=2,V+=re,Gs(this.layoutVertexArray,oe.x,oe.y,Y.x,Y.y,0,0,V),Gs(this.layoutVertexArray,oe.x,oe.y,Y.x,Y.y,0,1,V),d.x+=2*oe.x,d.y+=2*oe.y,d.vertexCount+=2;const fe=x.vertexLength;this.indexArray.emplaceBack(fe,fe+2,fe+1),this.indexArray.emplaceBack(fe+1,fe+2,fe+3),x.vertexLength+=4,x.primitiveLength+=2}}}}if(x.vertexLength+g>ot.MAX_VERTEX_ARRAY_LENGTH&&(x=this.segments.prepareSegment(g,this.layoutVertexArray,this.indexArray)),pp[e.type]!=="Polygon")continue;const w=[],E=[],A=x.vertexLength;for(const z of m)if(z.length!==0){z!==m[0]&&E.push(w.length/2);for(let V=0;V<z.length;V++){const U=z[V];Gs(this.layoutVertexArray,U.x,U.y,0,0,1,1,0),d.x+=U.x,d.y+=U.y,d.vertexCount+=1,w.push(U.x),w.push(U.y)}}const M=Za.exports(w,E);for(let z=0;z<M.length;z+=3)this.indexArray.emplaceBack(A+M[z],A+M[z+2],A+M[z+1]);x.primitiveLength+=M.length/3,x.vertexLength+=g}for(let m=0;m<d.vertexCount;m++)this.centroidVertexArray.emplaceBack(Math.floor(d.x/d.vertexCount),Math.floor(d.y/d.vertexCount));this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,o,h,c)}}function dp(i,e){return i.x===e.x&&(i.x<0||i.x>Kt)||i.y===e.y&&(i.y<0||i.y>Kt)}function fp(i){return i.every(e=>e.x<0)||i.every(e=>e.x>Kt)||i.every(e=>e.y<0)||i.every(e=>e.y>Kt)}Fe("FillExtrusionBucket",Kl,{omit:["layers","features"]});var mp={paint:new si({"fill-extrusion-opacity":new Ve(pe["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new je(pe["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Ve(pe["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Ve(pe["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new kn(pe["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new je(pe["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new je(pe["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Ve(pe["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})};function qs(i,e){return i.x*e.x+i.y*e.y}function eu(i,e){if(i.length===1){let r=0;const o=e[r++];let c;for(;!c||o.equals(c);)if(c=e[r++],!c)return 1/0;for(;r<e.length;r++){const h=e[r],d=i[0],m=c.sub(o),g=h.sub(o),x=d.sub(o),w=qs(m,m),E=qs(m,g),A=qs(g,g),M=qs(x,m),z=qs(x,g),V=w*A-E*E,U=(A*M-E*z)/V,ee=(w*z-E*M)/V,oe=o.z*(1-U-ee)+c.z*U+h.z*ee;if(isFinite(oe))return oe}return 1/0}{let r=1/0;for(const o of e)r=Math.min(r,o.z);return r}}const gp=Zt([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:_p}=gp,yp=Zt([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:xp}=yp,vp=Rn.VectorTileFeature.types,bp=Math.cos(Math.PI/180*37.5),tu=Math.pow(2,14)/.5;class Jl{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(r=>{this.gradients[r.id]={}}),this.layoutVertexArray=new mt,this.layoutVertexArray2=new Et,this.indexArray=new bi,this.programConfigurations=new fo(e.layers,e.zoom),this.segments=new ot,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,o){this.hasPattern=jl("line",this.layers,r);const c=this.layers[0].layout.get("line-sort-key"),h=!c.isConstant(),d=[];for(const{feature:m,id:g,index:x,sourceLayerIndex:w}of e){const E=this.layers[0]._featureFilter.needGeometry,A=go(m,E);if(!this.layers[0]._featureFilter.filter(new Rt(this.zoom),A,o))continue;const M=h?c.evaluate(A,{},o):void 0,z={id:g,properties:m.properties,type:m.type,sourceLayerIndex:w,index:x,geometry:E?A.geometry:mo(m),patterns:{},sortKey:M};d.push(z)}h&&d.sort((m,g)=>m.sortKey-g.sortKey);for(const m of d){const{geometry:g,index:x,sourceLayerIndex:w}=m;if(this.hasPattern){const E=Xl("line",this.layers,m,this.zoom,r);this.patternFeatures.push(E)}else this.addFeature(m,g,x,o,{});r.featureIndex.insert(e[x].feature,g,x,w,this.index)}}update(e,r,o){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,o)}addFeatures(e,r,o){for(const c of this.patternFeatures)this.addFeature(c,c.geometry,c.index,r,o)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,xp)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,_p),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e){if(e.properties&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_end"))return{start:+e.properties.mapbox_clip_start,end:+e.properties.mapbox_clip_end}}addFeature(e,r,o,c,h){const d=this.layers[0].layout,m=d.get("line-join").evaluate(e,{}),g=d.get("line-cap"),x=d.get("line-miter-limit"),w=d.get("line-round-limit");this.lineClips=this.lineFeatureClips(e);for(const E of r)this.addLine(E,e,m,g,x,w);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,o,h,c)}addLine(e,r,o,c,h,d){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let ee=0;ee<e.length-1;ee++)this.totalDistance+=e[ee].dist(e[ee+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const m=vp[r.type]==="Polygon";let g=e.length;for(;g>=2&&e[g-1].equals(e[g-2]);)g--;let x=0;for(;x<g-1&&e[x].equals(e[x+1]);)x++;if(g<(m?3:2))return;o==="bevel"&&(h=1.05);const w=this.overscaling<=16?122880/(512*this.overscaling):0,E=this.segments.prepareSegment(10*g,this.layoutVertexArray,this.indexArray);let A,M,z,V,U;this.e1=this.e2=-1,m&&(A=e[g-2],U=e[x].sub(A)._unit()._perp());for(let ee=x;ee<g;ee++){if(z=ee===g-1?m?e[x+1]:void 0:e[ee+1],z&&e[ee].equals(z))continue;U&&(V=U),A&&(M=A),A=e[ee],U=z?z.sub(A)._unit()._perp():V,V=V||U;let oe=V.add(U);oe.x===0&&oe.y===0||oe._unit();const Y=V.x*U.x+V.y*U.y,re=oe.x*U.x+oe.y*U.y,fe=re!==0?1/re:1/0,de=2*Math.sqrt(2-2*re),Be=re<bp&&M&&z,Ue=V.x*U.y-V.y*U.x>0;if(Be&&ee>x){const we=A.dist(M);if(we>2*w){const ke=A.sub(A.sub(M)._mult(w/we)._round());this.updateDistance(M,ke),this.addCurrentVertex(ke,V,0,0,E),M=ke}}const Pe=M&&z;let Ae=Pe?o:m?"butt":c;if(Pe&&Ae==="round"&&(fe<d?Ae="miter":fe<=2&&(Ae="fakeround")),Ae==="miter"&&fe>h&&(Ae="bevel"),Ae==="bevel"&&(fe>2&&(Ae="flipbevel"),fe<h&&(Ae="miter")),M&&this.updateDistance(M,A),Ae==="miter")oe._mult(fe),this.addCurrentVertex(A,oe,0,0,E);else if(Ae==="flipbevel"){if(fe>100)oe=U.mult(-1);else{const we=fe*V.add(U).mag()/V.sub(U).mag();oe._perp()._mult(we*(Ue?-1:1))}this.addCurrentVertex(A,oe,0,0,E),this.addCurrentVertex(A,oe.mult(-1),0,0,E)}else if(Ae==="bevel"||Ae==="fakeround"){const we=-Math.sqrt(fe*fe-1),ke=Ue?we:0,Me=Ue?0:we;if(M&&this.addCurrentVertex(A,V,ke,Me,E),Ae==="fakeround"){const be=Math.round(180*de/Math.PI/20);for(let qe=1;qe<be;qe++){let Ne=qe/be;if(Ne!==.5){const Pt=Ne-.5;Ne+=Ne*Pt*(Ne-1)*((1.0904+Y*(Y*(3.55645-1.43519*Y)-3.2452))*Pt*Pt+(.848013+Y*(.215638*Y-1.06021)))}const rt=U.sub(V)._mult(Ne)._add(V)._unit()._mult(Ue?-1:1);this.addHalfVertex(A,rt.x,rt.y,!1,Ue,0,E)}}z&&this.addCurrentVertex(A,U,-ke,-Me,E)}else if(Ae==="butt")this.addCurrentVertex(A,oe,0,0,E);else if(Ae==="square"){const we=M?1:-1;this.addCurrentVertex(A,oe,we,we,E)}else Ae==="round"&&(M&&(this.addCurrentVertex(A,V,0,0,E),this.addCurrentVertex(A,V,1,1,E,!0)),z&&(this.addCurrentVertex(A,U,-1,-1,E,!0),this.addCurrentVertex(A,U,0,0,E)));if(Be&&ee<g-1){const we=A.dist(z);if(we>2*w){const ke=A.add(z.sub(A)._mult(w/we)._round());this.updateDistance(A,ke),this.addCurrentVertex(ke,U,0,0,E),A=ke}}}}addCurrentVertex(e,r,o,c,h,d=!1){const m=r.y*c-r.x,g=-r.y-r.x*c;this.addHalfVertex(e,r.x+r.y*o,r.y-r.x*o,d,!1,o,h),this.addHalfVertex(e,m,g,d,!0,-c,h),this.distance>tu/2&&this.totalDistance===0&&(this.distance=0,this.addCurrentVertex(e,r,o,c,h,d))}addHalfVertex({x:e,y:r},o,c,h,d,m,g){const x=.5*(this.lineClips?this.scaledDistance*(tu-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((e<<1)+(h?1:0),(r<<1)+(d?1:0),Math.round(63*o)+128,Math.round(63*c)+128,1+(m===0?0:m<0?-1:1)|(63&x)<<2,x>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const w=g.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,w),g.primitiveLength++),d?this.e2=w:this.e1=w}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(e,r){this.distance+=e.dist(r),this.updateScaledDistance()}}Fe("LineBucket",Jl,{omit:["layers","patternFeatures"]});const wp=new si({"line-cap":new Ve(pe.layout_line["line-cap"]),"line-join":new je(pe.layout_line["line-join"]),"line-miter-limit":new Ve(pe.layout_line["line-miter-limit"]),"line-round-limit":new Ve(pe.layout_line["line-round-limit"]),"line-sort-key":new je(pe.layout_line["line-sort-key"])});var iu={paint:new si({"line-opacity":new je(pe.paint_line["line-opacity"]),"line-color":new je(pe.paint_line["line-color"]),"line-translate":new Ve(pe.paint_line["line-translate"]),"line-translate-anchor":new Ve(pe.paint_line["line-translate-anchor"]),"line-width":new je(pe.paint_line["line-width"]),"line-gap-width":new je(pe.paint_line["line-gap-width"]),"line-offset":new je(pe.paint_line["line-offset"]),"line-blur":new je(pe.paint_line["line-blur"]),"line-dasharray":new Ps(pe.paint_line["line-dasharray"]),"line-pattern":new kn(pe.paint_line["line-pattern"]),"line-gradient":new Fr(pe.paint_line["line-gradient"])}),layout:wp};const ru=new class extends je{possiblyEvaluate(i,e){return e=new Rt(Math.floor(e.zoom),{now:e.now,fadeDuration:e.fadeDuration,zoomHistory:e.zoomHistory,transition:e.transition}),super.possiblyEvaluate(i,e)}evaluate(i,e,r,o){return e=nt({},e,{zoom:Math.floor(e.zoom)}),super.evaluate(i,e,r,o)}}(iu.paint.properties["line-width"].specification);function nu(i,e){return e>0?e+2*i:i}ru.useIntegerZoom=!0;const Tp=Zt([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Ep=Zt([{name:"a_projected_pos",components:3,type:"Float32"}],4);Zt([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const Sp=Zt([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]);Zt([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);const ou=Zt([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),Ip=Zt([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function Ap(i,e,r){return i.sections.forEach(o=>{o.text=function(c,h,d){const m=h.layout.get("text-transform").evaluate(d,{});return m==="uppercase"?c=c.toLocaleUpperCase():m==="lowercase"&&(c=c.toLocaleLowerCase()),Ui.applyArabicShaping&&(c=Ui.applyArabicShaping(c)),c}(o.text,e,r)}),i}Zt([{name:"triangle",components:3,type:"Uint16"}]),Zt([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"}]),Zt([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",components:2,name:"textOffset"},{type:"Float32",name:"collisionCircleDiameter"}]),Zt([{type:"Float32",name:"offsetX"}]),Zt([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]);const Zs={"!":"\uFE15","#":"\uFF03",$:"\uFF04","%":"\uFF05","&":"\uFF06","(":"\uFE35",")":"\uFE36","*":"\uFF0A","+":"\uFF0B",",":"\uFE10","-":"\uFE32",".":"\u30FB","/":"\uFF0F",":":"\uFE13",";":"\uFE14","<":"\uFE3F","=":"\uFF1D",">":"\uFE40","?":"\uFE16","@":"\uFF20","[":"\uFE47","\\":"\uFF3C","]":"\uFE48","^":"\uFF3E",_:"\uFE33","`":"\uFF40","{":"\uFE37","|":"\u2015","}":"\uFE38","~":"\uFF5E","\xA2":"\uFFE0","\xA3":"\uFFE1","\xA5":"\uFFE5","\xA6":"\uFFE4","\xAC":"\uFFE2","\xAF":"\uFFE3","\u2013":"\uFE32","\u2014":"\uFE31","\u2018":"\uFE43","\u2019":"\uFE44","\u201C":"\uFE41","\u201D":"\uFE42","\u2026":"\uFE19","\u2027":"\u30FB","\u20A9":"\uFFE6","\u3001":"\uFE11","\u3002":"\uFE12","\u3008":"\uFE3F","\u3009":"\uFE40","\u300A":"\uFE3D","\u300B":"\uFE3E","\u300C":"\uFE41","\u300D":"\uFE42","\u300E":"\uFE43","\u300F":"\uFE44","\u3010":"\uFE3B","\u3011":"\uFE3C","\u3014":"\uFE39","\u3015":"\uFE3A","\u3016":"\uFE17","\u3017":"\uFE18","\uFF01":"\uFE15","\uFF08":"\uFE35","\uFF09":"\uFE36","\uFF0C":"\uFE10","\uFF0D":"\uFE32","\uFF0E":"\u30FB","\uFF1A":"\uFE13","\uFF1B":"\uFE14","\uFF1C":"\uFE3F","\uFF1E":"\uFE40","\uFF1F":"\uFE16","\uFF3B":"\uFE47","\uFF3D":"\uFE48","\uFF3F":"\uFE33","\uFF5B":"\uFE37","\uFF5C":"\u2015","\uFF5D":"\uFE38","\uFF5F":"\uFE35","\uFF60":"\uFE36","\uFF61":"\uFE12","\uFF62":"\uFE41","\uFF63":"\uFE42"};var ai=24,Yl=At,su=function(i,e,r,o,c){var h,d,m=8*c-o-1,g=(1<<m)-1,x=g>>1,w=-7,E=r?c-1:0,A=r?-1:1,M=i[e+E];for(E+=A,h=M&(1<<-w)-1,M>>=-w,w+=m;w>0;h=256*h+i[e+E],E+=A,w-=8);for(d=h&(1<<-w)-1,h>>=-w,w+=o;w>0;d=256*d+i[e+E],E+=A,w-=8);if(h===0)h=1-x;else{if(h===g)return d?NaN:1/0*(M?-1:1);d+=Math.pow(2,o),h-=x}return(M?-1:1)*d*Math.pow(2,h-o)},au=function(i,e,r,o,c,h){var d,m,g,x=8*h-c-1,w=(1<<x)-1,E=w>>1,A=c===23?Math.pow(2,-24)-Math.pow(2,-77):0,M=o?0:h-1,z=o?1:-1,V=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(m=isNaN(e)?1:0,d=w):(d=Math.floor(Math.log(e)/Math.LN2),e*(g=Math.pow(2,-d))<1&&(d--,g*=2),(e+=d+E>=1?A/g:A*Math.pow(2,1-E))*g>=2&&(d++,g/=2),d+E>=w?(m=0,d=w):d+E>=1?(m=(e*g-1)*Math.pow(2,c),d+=E):(m=e*Math.pow(2,E-1)*Math.pow(2,c),d=0));c>=8;i[r+M]=255&m,M+=z,m/=256,c-=8);for(d=d<<c|m,x+=c;x>0;i[r+M]=255&d,M+=z,d/=256,x-=8);i[r+M-z]|=128*V};function At(i){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(i)?i:new Uint8Array(i||0),this.pos=0,this.type=0,this.length=this.buf.length}At.Varint=0,At.Fixed64=1,At.Bytes=2,At.Fixed32=5;var Bn,Ql=4294967296,lu=1/Ql,cu=typeof TextDecoder>"u"?null:new TextDecoder("utf8");function on(i){return i.type===At.Bytes?i.readVarint()+i.pos:i.pos+1}function Wo(i,e,r){return r?4294967296*e+(i>>>0):4294967296*(e>>>0)+(i>>>0)}function uu(i,e,r){var o=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));r.realloc(o);for(var c=r.pos-1;c>=i;c--)r.buf[c+o]=r.buf[c]}function Cp(i,e){for(var r=0;r<i.length;r++)e.writeVarint(i[r])}function Mp(i,e){for(var r=0;r<i.length;r++)e.writeSVarint(i[r])}function zp(i,e){for(var r=0;r<i.length;r++)e.writeFloat(i[r])}function Pp(i,e){for(var r=0;r<i.length;r++)e.writeDouble(i[r])}function kp(i,e){for(var r=0;r<i.length;r++)e.writeBoolean(i[r])}function Dp(i,e){for(var r=0;r<i.length;r++)e.writeFixed32(i[r])}function Lp(i,e){for(var r=0;r<i.length;r++)e.writeSFixed32(i[r])}function Rp(i,e){for(var r=0;r<i.length;r++)e.writeFixed64(i[r])}function Bp(i,e){for(var r=0;r<i.length;r++)e.writeSFixed64(i[r])}function Ka(i,e){return(i[e]|i[e+1]<<8|i[e+2]<<16)+16777216*i[e+3]}function Ho(i,e,r){i[r]=e,i[r+1]=e>>>8,i[r+2]=e>>>16,i[r+3]=e>>>24}function hu(i,e){return(i[e]|i[e+1]<<8|i[e+2]<<16)+(i[e+3]<<24)}function Fp(i,e,r){i===1&&r.readMessage(Op,e)}function Op(i,e,r){if(i===3){const{id:o,bitmap:c,width:h,height:d,left:m,top:g,advance:x}=r.readMessage(Up,{});e.push({id:o,bitmap:new Os({width:h+6,height:d+6},c),metrics:{width:h,height:d,left:m,top:g,advance:x}})}}function Up(i,e,r){i===1?e.id=r.readVarint():i===2?e.bitmap=r.readBytes():i===3?e.width=r.readVarint():i===4?e.height=r.readVarint():i===5?e.left=r.readSVarint():i===6?e.top=r.readSVarint():i===7&&(e.advance=r.readVarint())}function pu(i){let e=0,r=0;for(const d of i)e+=d.w*d.h,r=Math.max(r,d.w);i.sort((d,m)=>m.h-d.h);const o=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),r),h:1/0}];let c=0,h=0;for(const d of i)for(let m=o.length-1;m>=0;m--){const g=o[m];if(!(d.w>g.w||d.h>g.h)){if(d.x=g.x,d.y=g.y,h=Math.max(h,d.y+d.h),c=Math.max(c,d.x+d.w),d.w===g.w&&d.h===g.h){const x=o.pop();m<o.length&&(o[m]=x)}else d.h===g.h?(g.x+=d.w,g.w-=d.w):d.w===g.w?(g.y+=d.h,g.h-=d.h):(o.push({x:g.x+d.w,y:g.y,w:g.w-d.w,h:d.h}),g.y+=d.h,g.h-=d.h);break}}return{w:c,h,fill:e/(c*h)||0}}At.prototype={destroy:function(){this.buf=null},readFields:function(i,e,r){for(r=r||this.length;this.pos<r;){var o=this.readVarint(),c=o>>3,h=this.pos;this.type=7&o,i(c,e,this),this.pos===h&&this.skip(o)}return e},readMessage:function(i,e){return this.readFields(i,e,this.readVarint()+this.pos)},readFixed32:function(){var i=Ka(this.buf,this.pos);return this.pos+=4,i},readSFixed32:function(){var i=hu(this.buf,this.pos);return this.pos+=4,i},readFixed64:function(){var i=Ka(this.buf,this.pos)+Ka(this.buf,this.pos+4)*Ql;return this.pos+=8,i},readSFixed64:function(){var i=Ka(this.buf,this.pos)+hu(this.buf,this.pos+4)*Ql;return this.pos+=8,i},readFloat:function(){var i=su(this.buf,this.pos,!0,23,4);return this.pos+=4,i},readDouble:function(){var i=su(this.buf,this.pos,!0,52,8);return this.pos+=8,i},readVarint:function(i){var e,r,o=this.buf;return e=127&(r=o[this.pos++]),r<128?e:(e|=(127&(r=o[this.pos++]))<<7,r<128?e:(e|=(127&(r=o[this.pos++]))<<14,r<128?e:(e|=(127&(r=o[this.pos++]))<<21,r<128?e:function(c,h,d){var m,g,x=d.buf;if(m=(112&(g=x[d.pos++]))>>4,g<128||(m|=(127&(g=x[d.pos++]))<<3,g<128)||(m|=(127&(g=x[d.pos++]))<<10,g<128)||(m|=(127&(g=x[d.pos++]))<<17,g<128)||(m|=(127&(g=x[d.pos++]))<<24,g<128)||(m|=(1&(g=x[d.pos++]))<<31,g<128))return Wo(c,m,h);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(r=o[this.pos]))<<28,i,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var i=this.readVarint();return i%2==1?(i+1)/-2:i/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var i=this.readVarint()+this.pos,e=this.pos;return this.pos=i,i-e>=12&&cu?function(r,o,c){return cu.decode(r.subarray(o,c))}(this.buf,e,i):function(r,o,c){for(var h="",d=o;d<c;){var m,g,x,w=r[d],E=null,A=w>239?4:w>223?3:w>191?2:1;if(d+A>c)break;A===1?w<128&&(E=w):A===2?(192&(m=r[d+1]))==128&&(E=(31&w)<<6|63&m)<=127&&(E=null):A===3?(g=r[d+2],(192&(m=r[d+1]))==128&&(192&g)==128&&((E=(15&w)<<12|(63&m)<<6|63&g)<=2047||E>=55296&&E<=57343)&&(E=null)):A===4&&(g=r[d+2],x=r[d+3],(192&(m=r[d+1]))==128&&(192&g)==128&&(192&x)==128&&((E=(15&w)<<18|(63&m)<<12|(63&g)<<6|63&x)<=65535||E>=1114112)&&(E=null)),E===null?(E=65533,A=1):E>65535&&(E-=65536,h+=String.fromCharCode(E>>>10&1023|55296),E=56320|1023&E),h+=String.fromCharCode(E),d+=A}return h}(this.buf,e,i)},readBytes:function(){var i=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,i);return this.pos=i,e},readPackedVarint:function(i,e){if(this.type!==At.Bytes)return i.push(this.readVarint(e));var r=on(this);for(i=i||[];this.pos<r;)i.push(this.readVarint(e));return i},readPackedSVarint:function(i){if(this.type!==At.Bytes)return i.push(this.readSVarint());var e=on(this);for(i=i||[];this.pos<e;)i.push(this.readSVarint());return i},readPackedBoolean:function(i){if(this.type!==At.Bytes)return i.push(this.readBoolean());var e=on(this);for(i=i||[];this.pos<e;)i.push(this.readBoolean());return i},readPackedFloat:function(i){if(this.type!==At.Bytes)return i.push(this.readFloat());var e=on(this);for(i=i||[];this.pos<e;)i.push(this.readFloat());return i},readPackedDouble:function(i){if(this.type!==At.Bytes)return i.push(this.readDouble());var e=on(this);for(i=i||[];this.pos<e;)i.push(this.readDouble());return i},readPackedFixed32:function(i){if(this.type!==At.Bytes)return i.push(this.readFixed32());var e=on(this);for(i=i||[];this.pos<e;)i.push(this.readFixed32());return i},readPackedSFixed32:function(i){if(this.type!==At.Bytes)return i.push(this.readSFixed32());var e=on(this);for(i=i||[];this.pos<e;)i.push(this.readSFixed32());return i},readPackedFixed64:function(i){if(this.type!==At.Bytes)return i.push(this.readFixed64());var e=on(this);for(i=i||[];this.pos<e;)i.push(this.readFixed64());return i},readPackedSFixed64:function(i){if(this.type!==At.Bytes)return i.push(this.readSFixed64());var e=on(this);for(i=i||[];this.pos<e;)i.push(this.readSFixed64());return i},skip:function(i){var e=7&i;if(e===At.Varint)for(;this.buf[this.pos++]>127;);else if(e===At.Bytes)this.pos=this.readVarint()+this.pos;else if(e===At.Fixed32)this.pos+=4;else{if(e!==At.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(i,e){this.writeVarint(i<<3|e)},realloc:function(i){for(var e=this.length||16;e<this.pos+i;)e*=2;if(e!==this.length){var r=new Uint8Array(e);r.set(this.buf),this.buf=r,this.length=e}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(i){this.realloc(4),Ho(this.buf,i,this.pos),this.pos+=4},writeSFixed32:function(i){this.realloc(4),Ho(this.buf,i,this.pos),this.pos+=4},writeFixed64:function(i){this.realloc(8),Ho(this.buf,-1&i,this.pos),Ho(this.buf,Math.floor(i*lu),this.pos+4),this.pos+=8},writeSFixed64:function(i){this.realloc(8),Ho(this.buf,-1&i,this.pos),Ho(this.buf,Math.floor(i*lu),this.pos+4),this.pos+=8},writeVarint:function(i){(i=+i||0)>268435455||i<0?function(e,r){var o,c;if(e>=0?(o=e%4294967296|0,c=e/4294967296|0):(c=~(-e/4294967296),4294967295^(o=~(-e%4294967296))?o=o+1|0:(o=0,c=c+1|0)),e>=18446744073709552e3||e<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");r.realloc(10),function(h,d,m){m.buf[m.pos++]=127&h|128,h>>>=7,m.buf[m.pos++]=127&h|128,h>>>=7,m.buf[m.pos++]=127&h|128,h>>>=7,m.buf[m.pos++]=127&h|128,m.buf[m.pos]=127&(h>>>=7)}(o,0,r),function(h,d){var m=(7&h)<<4;d.buf[d.pos++]|=m|((h>>>=3)?128:0),h&&(d.buf[d.pos++]=127&h|((h>>>=7)?128:0),h&&(d.buf[d.pos++]=127&h|((h>>>=7)?128:0),h&&(d.buf[d.pos++]=127&h|((h>>>=7)?128:0),h&&(d.buf[d.pos++]=127&h|((h>>>=7)?128:0),h&&(d.buf[d.pos++]=127&h)))))}(c,r)}(i,this):(this.realloc(4),this.buf[this.pos++]=127&i|(i>127?128:0),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|(i>127?128:0),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|(i>127?128:0),i<=127||(this.buf[this.pos++]=i>>>7&127))))},writeSVarint:function(i){this.writeVarint(i<0?2*-i-1:2*i)},writeBoolean:function(i){this.writeVarint(Boolean(i))},writeString:function(i){i=String(i),this.realloc(4*i.length),this.pos++;var e=this.pos;this.pos=function(o,c,h){for(var d,m,g=0;g<c.length;g++){if((d=c.charCodeAt(g))>55295&&d<57344){if(!m){d>56319||g+1===c.length?(o[h++]=239,o[h++]=191,o[h++]=189):m=d;continue}if(d<56320){o[h++]=239,o[h++]=191,o[h++]=189,m=d;continue}d=m-55296<<10|d-56320|65536,m=null}else m&&(o[h++]=239,o[h++]=191,o[h++]=189,m=null);d<128?o[h++]=d:(d<2048?o[h++]=d>>6|192:(d<65536?o[h++]=d>>12|224:(o[h++]=d>>18|240,o[h++]=d>>12&63|128),o[h++]=d>>6&63|128),o[h++]=63&d|128)}return h}(this.buf,i,this.pos);var r=this.pos-e;r>=128&&uu(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(i){this.realloc(4),au(this.buf,i,this.pos,!0,23,4),this.pos+=4},writeDouble:function(i){this.realloc(8),au(this.buf,i,this.pos,!0,52,8),this.pos+=8},writeBytes:function(i){var e=i.length;this.writeVarint(e),this.realloc(e);for(var r=0;r<e;r++)this.buf[this.pos++]=i[r]},writeRawMessage:function(i,e){this.pos++;var r=this.pos;i(e,this);var o=this.pos-r;o>=128&&uu(r,o,this),this.pos=r-1,this.writeVarint(o),this.pos+=o},writeMessage:function(i,e,r){this.writeTag(i,At.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(i,e){e.length&&this.writeMessage(i,Cp,e)},writePackedSVarint:function(i,e){e.length&&this.writeMessage(i,Mp,e)},writePackedBoolean:function(i,e){e.length&&this.writeMessage(i,kp,e)},writePackedFloat:function(i,e){e.length&&this.writeMessage(i,zp,e)},writePackedDouble:function(i,e){e.length&&this.writeMessage(i,Pp,e)},writePackedFixed32:function(i,e){e.length&&this.writeMessage(i,Dp,e)},writePackedSFixed32:function(i,e){e.length&&this.writeMessage(i,Lp,e)},writePackedFixed64:function(i,e){e.length&&this.writeMessage(i,Rp,e)},writePackedSFixed64:function(i,e){e.length&&this.writeMessage(i,Bp,e)},writeBytesField:function(i,e){this.writeTag(i,At.Bytes),this.writeBytes(e)},writeFixed32Field:function(i,e){this.writeTag(i,At.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(i,e){this.writeTag(i,At.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(i,e){this.writeTag(i,At.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(i,e){this.writeTag(i,At.Fixed64),this.writeSFixed64(e)},writeVarintField:function(i,e){this.writeTag(i,At.Varint),this.writeVarint(e)},writeSVarintField:function(i,e){this.writeTag(i,At.Varint),this.writeSVarint(e)},writeStringField:function(i,e){this.writeTag(i,At.Bytes),this.writeString(e)},writeFloatField:function(i,e){this.writeTag(i,At.Fixed32),this.writeFloat(e)},writeDoubleField:function(i,e){this.writeTag(i,At.Fixed64),this.writeDouble(e)},writeBooleanField:function(i,e){this.writeVarintField(i,Boolean(e))}};class ec{constructor(e,{pixelRatio:r,version:o,stretchX:c,stretchY:h,content:d}){this.paddedRect=e,this.pixelRatio=r,this.stretchX=c,this.stretchY=h,this.content=d,this.version=o}get tl(){return[this.paddedRect.x+1,this.paddedRect.y+1]}get br(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]}}class du{constructor(e,r){const o={},c={};this.haveRenderCallbacks=[];const h=[];this.addImages(e,o,h),this.addImages(r,c,h);const{w:d,h:m}=pu(h),g=new Hi({width:d||1,height:m||1});for(const x in e){const w=e[x],E=o[x].paddedRect;Hi.copy(w.data,g,{x:0,y:0},{x:E.x+1,y:E.y+1},w.data)}for(const x in r){const w=r[x],E=c[x].paddedRect,A=E.x+1,M=E.y+1,z=w.data.width,V=w.data.height;Hi.copy(w.data,g,{x:0,y:0},{x:A,y:M},w.data),Hi.copy(w.data,g,{x:0,y:V-1},{x:A,y:M-1},{width:z,height:1}),Hi.copy(w.data,g,{x:0,y:0},{x:A,y:M+V},{width:z,height:1}),Hi.copy(w.data,g,{x:z-1,y:0},{x:A-1,y:M},{width:1,height:V}),Hi.copy(w.data,g,{x:0,y:0},{x:A+z,y:M},{width:1,height:V})}this.image=g,this.iconPositions=o,this.patternPositions=c}addImages(e,r,o){for(const c in e){const h=e[c],d={x:0,y:0,w:h.data.width+2,h:h.data.height+2};o.push(d),r[c]=new ec(d,h),h.hasRenderCallback&&this.haveRenderCallbacks.push(c)}}patchUpdatedImages(e,r){e.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const o in e.updatedImages)this.patchUpdatedImage(this.iconPositions[o],e.getImage(o),r),this.patchUpdatedImage(this.patternPositions[o],e.getImage(o),r)}patchUpdatedImage(e,r,o){if(!e||!r||e.version===r.version)return;e.version=r.version;const[c,h]=e.tl;o.update(r.data,void 0,{x:c,y:h})}}Fe("ImagePosition",ec),Fe("ImageAtlas",du),l.WritingMode=void 0,(Bn=l.WritingMode||(l.WritingMode={}))[Bn.none=0]="none",Bn[Bn.horizontal=1]="horizontal",Bn[Bn.vertical=2]="vertical",Bn[Bn.horizontalOnly=3]="horizontalOnly";const Ja=-17;class js{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(e,r){const o=new js;return o.scale=e||1,o.fontStack=r,o}static forImage(e){const r=new js;return r.imageName=e,r}}class Ko{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(e,r){const o=new Ko;for(let c=0;c<e.sections.length;c++){const h=e.sections[c];h.image?o.addImageSection(h):o.addTextSection(h,r)}return o}length(){return this.text.length}getSection(e){return this.sections[this.sectionIndex[e]]}getSectionIndex(e){return this.sectionIndex[e]}getCharCode(e){return this.text.charCodeAt(e)}verticalizePunctuation(){this.text=function(e){let r="";for(let o=0;o<e.length;o++){const c=e.charCodeAt(o+1)||null,h=e.charCodeAt(o-1)||null;r+=c&&Pa(c)&&!Zs[e[o+1]]||h&&Pa(h)&&!Zs[e[o-1]]||!Zs[e[o]]?e[o]:Zs[e[o]]}return r}(this.text)}trim(){let e=0;for(let o=0;o<this.text.length&&Qa[this.text.charCodeAt(o)];o++)e++;let r=this.text.length;for(let o=this.text.length-1;o>=0&&o>=e&&Qa[this.text.charCodeAt(o)];o--)r--;this.text=this.text.substring(e,r),this.sectionIndex=this.sectionIndex.slice(e,r)}substring(e,r){const o=new Ko;return o.text=this.text.substring(e,r),o.sectionIndex=this.sectionIndex.slice(e,r),o.sections=this.sections,o}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((e,r)=>Math.max(e,this.sections[r].scale),0)}addTextSection(e,r){this.text+=e.text,this.sections.push(js.forText(e.scale,e.fontStack||r));const o=this.sections.length-1;for(let c=0;c<e.text.length;++c)this.sectionIndex.push(o)}addImageSection(e){const r=e.image?e.image.name:"";if(r.length===0)return void $t("Can't add FormattedSection with an empty image.");const o=this.getNextImageSectionCharCode();o?(this.text+=String.fromCharCode(o),this.sections.push(js.forImage(r)),this.sectionIndex.push(this.sections.length-1)):$t("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function Ya(i,e,r,o,c,h,d,m,g,x,w,E,A,M,z,V){const U=Ko.fromFeature(i,c);let ee;E===l.WritingMode.vertical&&U.verticalizePunctuation();const{processBidirectionalText:oe,processStyledBidirectionalText:Y}=Ui;if(oe&&U.sections.length===1){ee=[];const de=oe(U.toString(),tc(U,x,h,e,o,M,z));for(const Be of de){const Ue=new Ko;Ue.text=Be,Ue.sections=U.sections;for(let Pe=0;Pe<Be.length;Pe++)Ue.sectionIndex.push(0);ee.push(Ue)}}else if(Y){ee=[];const de=Y(U.text,U.sectionIndex,tc(U,x,h,e,o,M,z));for(const Be of de){const Ue=new Ko;Ue.text=Be[0],Ue.sectionIndex=Be[1],Ue.sections=U.sections,ee.push(Ue)}}else ee=function(de,Be){const Ue=[],Pe=de.text;let Ae=0;for(const we of Be)Ue.push(de.substring(Ae,we)),Ae=we;return Ae<Pe.length&&Ue.push(de.substring(Ae,Pe.length)),Ue}(U,tc(U,x,h,e,o,M,z));const re=[],fe={positionedLines:re,text:U.toString(),top:w[1],bottom:w[1],left:w[0],right:w[0],writingMode:E,iconsInText:!1,verticalizable:!1};return function(de,Be,Ue,Pe,Ae,we,ke,Me,be,qe,Ne,rt){let Pt=0,Ft=Ja,Jt=0,Ji=0;const ci=Me==="right"?1:Me==="left"?0:.5;let jt=0;for(const Xt of Ae){Xt.trim();const hi=Xt.getMaxScale(),_i=(hi-1)*ai,Ei={positionedGlyphs:[],lineOffset:0};de.positionedLines[jt]=Ei;const ki=Ei.positionedGlyphs;let Di=0;if(!Xt.length()){Ft+=we,++jt;continue}for(let ni=0;ni<Xt.length();ni++){const st=Xt.getSection(ni),Ni=Xt.getSectionIndex(ni),pi=Xt.getCharCode(ni);let yi=0,sr=null,br=null,wr=null,an=ai;const ar=!(be===l.WritingMode.horizontal||!Ne&&!Ss(pi)||Ne&&(Qa[pi]||(ri=pi,ze.Arabic(ri)||ze["Arabic Supplement"](ri)||ze["Arabic Extended-A"](ri)||ze["Arabic Presentation Forms-A"](ri)||ze["Arabic Presentation Forms-B"](ri))));if(st.imageName){const Yi=Pe[st.imageName];if(!Yi)continue;wr=st.imageName,de.iconsInText=de.iconsInText||!0,br=Yi.paddedRect;const Li=Yi.displaySize;st.scale=st.scale*ai/rt,sr={width:Li[0],height:Li[1],left:1,top:-3,advance:ar?Li[1]:Li[0]},yi=_i+(ai-Li[1]*st.scale),an=sr.advance;const ln=ar?Li[0]*st.scale-ai*hi:Li[1]*st.scale-ai*hi;ln>0&&ln>Di&&(Di=ln)}else{const Yi=Ue[st.fontStack],Li=Yi&&Yi[pi];if(Li&&Li.rect)br=Li.rect,sr=Li.metrics;else{const ln=Be[st.fontStack],Hs=ln&&ln[pi];if(!Hs)continue;sr=Hs.metrics}yi=(hi-st.scale)*ai}ar?(de.verticalizable=!0,ki.push({glyph:pi,imageName:wr,x:Pt,y:Ft+yi,vertical:ar,scale:st.scale,fontStack:st.fontStack,sectionIndex:Ni,metrics:sr,rect:br}),Pt+=an*st.scale+qe):(ki.push({glyph:pi,imageName:wr,x:Pt,y:Ft+yi,vertical:ar,scale:st.scale,fontStack:st.fontStack,sectionIndex:Ni,metrics:sr,rect:br}),Pt+=sr.advance*st.scale+qe)}ki.length!==0&&(Jt=Math.max(Pt-qe,Jt),Np(ki,0,ki.length-1,ci,Di)),Pt=0;const Ot=we*hi+Di;Ei.lineOffset=Math.max(Di,_i),Ft+=Ot,Ji=Math.max(Ot,Ji),++jt}var ri;const ui=Ft-Ja,{horizontalAlign:gi,verticalAlign:Pi}=ic(ke);(function(Xt,hi,_i,Ei,ki,Di,Ot,ni,st){const Ni=(hi-_i)*ki;let pi=0;pi=Di!==Ot?-ni*Ei-Ja:(-Ei*st+.5)*Ot;for(const yi of Xt)for(const sr of yi.positionedGlyphs)sr.x+=Ni,sr.y+=pi})(de.positionedLines,ci,gi,Pi,Jt,Ji,we,ui,Ae.length),de.top+=-Pi*ui,de.bottom=de.top+ui,de.left+=-gi*Jt,de.right=de.left+Jt}(fe,e,r,o,ee,d,m,g,E,x,A,V),!function(de){for(const Be of de)if(Be.positionedGlyphs.length!==0)return!1;return!0}(re)&&fe}const Qa={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},$p={10:!0,32:!0,38:!0,40:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0};function fu(i,e,r,o,c,h){if(e.imageName){const d=o[e.imageName];return d?d.displaySize[0]*e.scale*ai/h+c:0}{const d=r[e.fontStack],m=d&&d[i];return m?m.metrics.advance*e.scale+c:0}}function mu(i,e,r,o){const c=Math.pow(i-e,2);return o?i<e?c/2:2*c:c+Math.abs(r)*r}function Vp(i,e,r){let o=0;return i===10&&(o-=1e4),r&&(o+=150),i!==40&&i!==65288||(o+=50),e!==41&&e!==65289||(o+=50),o}function gu(i,e,r,o,c,h){let d=null,m=mu(e,r,c,h);for(const g of o){const x=mu(e-g.x,r,c,h)+g.badness;x<=m&&(d=g,m=x)}return{index:i,x:e,priorBreak:d,badness:m}}function _u(i){return i?_u(i.priorBreak).concat(i.index):[]}function tc(i,e,r,o,c,h,d){if(h!=="point")return[];if(!i)return[];const m=[],g=function(A,M,z,V,U,ee){let oe=0;for(let Y=0;Y<A.length();Y++){const re=A.getSection(Y);oe+=fu(A.getCharCode(Y),re,V,U,M,ee)}return oe/Math.max(1,Math.ceil(oe/z))}(i,e,r,o,c,d),x=i.text.indexOf("\u200B")>=0;let w=0;for(let A=0;A<i.length();A++){const M=i.getSection(A),z=i.getCharCode(A);if(Qa[z]||(w+=fu(z,M,o,c,e,d)),A<i.length()-1){const V=!((E=z)<11904||!(ze["Bopomofo Extended"](E)||ze.Bopomofo(E)||ze["CJK Compatibility Forms"](E)||ze["CJK Compatibility Ideographs"](E)||ze["CJK Compatibility"](E)||ze["CJK Radicals Supplement"](E)||ze["CJK Strokes"](E)||ze["CJK Symbols and Punctuation"](E)||ze["CJK Unified Ideographs Extension A"](E)||ze["CJK Unified Ideographs"](E)||ze["Enclosed CJK Letters and Months"](E)||ze["Halfwidth and Fullwidth Forms"](E)||ze.Hiragana(E)||ze["Ideographic Description Characters"](E)||ze["Kangxi Radicals"](E)||ze["Katakana Phonetic Extensions"](E)||ze.Katakana(E)||ze["Vertical Forms"](E)||ze["Yi Radicals"](E)||ze["Yi Syllables"](E)));($p[z]||V||M.imageName)&&m.push(gu(A+1,w,g,m,Vp(z,i.getCharCode(A+1),V&&x),!1))}}var E;return _u(gu(i.length(),w,g,m,0,!0))}function ic(i){let e=.5,r=.5;switch(i){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0}switch(i){case"bottom":case"bottom-right":case"bottom-left":r=1;break;case"top":case"top-right":case"top-left":r=0}return{horizontalAlign:e,verticalAlign:r}}function Np(i,e,r,o,c){if(!o&&!c)return;const h=i[r],d=(i[r].x+h.metrics.advance*h.scale)*o;for(let m=e;m<=r;m++)i[m].x-=d,i[m].y+=c}function Gp(i,e,r){const{horizontalAlign:o,verticalAlign:c}=ic(r),h=e[0]-i.displaySize[0]*o,d=e[1]-i.displaySize[1]*c;return{image:i,top:d,bottom:d+i.displaySize[1],left:h,right:h+i.displaySize[0]}}function yu(i,e,r,o,c,h){const d=i.image;let m;if(d.content){const U=d.content,ee=d.pixelRatio||1;m=[U[0]/ee,U[1]/ee,d.displaySize[0]-U[2]/ee,d.displaySize[1]-U[3]/ee]}const g=e.left*h,x=e.right*h;let w,E,A,M;r==="width"||r==="both"?(M=c[0]+g-o[3],E=c[0]+x+o[1]):(M=c[0]+(g+x-d.displaySize[0])/2,E=M+d.displaySize[0]);const z=e.top*h,V=e.bottom*h;return r==="height"||r==="both"?(w=c[1]+z-o[0],A=c[1]+V+o[2]):(w=c[1]+(z+V-d.displaySize[1])/2,A=w+d.displaySize[1]),{image:d,top:w,right:E,bottom:A,left:M,collisionPadding:m}}const sn=128;function xu(i,e){const{expression:r}=e;if(r.kind==="constant")return{kind:"constant",layoutSize:r.evaluate(new Rt(i+1))};if(r.kind==="source")return{kind:"source"};{const{zoomStops:o,interpolationType:c}=r;let h=0;for(;h<o.length&&o[h]<=i;)h++;h=Math.max(0,h-1);let d=h;for(;d<o.length&&o[d]<i+1;)d++;d=Math.min(o.length-1,d);const m=o[h],g=o[d];return r.kind==="composite"?{kind:"composite",minZoom:m,maxZoom:g,interpolationType:c}:{kind:"camera",minZoom:m,maxZoom:g,minSize:r.evaluate(new Rt(m)),maxSize:r.evaluate(new Rt(g)),interpolationType:c}}}class Fn extends We{constructor(e,r,o,c){super(e,r),this.angle=o,c!==void 0&&(this.segment=c)}clone(){return new Fn(this.x,this.y,this.angle,this.segment)}}function vu(i,e,r,o,c){if(e.segment===void 0)return!0;let h=e,d=e.segment+1,m=0;for(;m>-r/2;){if(d--,d<0)return!1;m-=i[d].dist(h),h=i[d]}m+=i[d].dist(i[d+1]),d++;const g=[];let x=0;for(;m<r/2;){const w=i[d],E=i[d+1];if(!E)return!1;let A=i[d-1].angleTo(w)-w.angleTo(E);for(A=Math.abs((A+3*Math.PI)%(2*Math.PI)-Math.PI),g.push({distance:m,angleDelta:A}),x+=A;m-g[0].distance>o;)x-=g.shift().angleDelta;if(x>c)return!1;d++,m+=w.dist(E)}return!0}function bu(i){let e=0;for(let r=0;r<i.length-1;r++)e+=i[r].dist(i[r+1]);return e}function wu(i,e,r){return i?.6*e*r:0}function Tu(i,e){return Math.max(i?i.right-i.left:0,e?e.right-e.left:0)}function qp(i,e,r,o,c,h){const d=wu(r,c,h),m=Tu(r,o)*h;let g=0;const x=bu(i)/2;for(let w=0;w<i.length-1;w++){const E=i[w],A=i[w+1],M=E.dist(A);if(g+M>x){const z=(x-g)/M,V=Dt(E.x,A.x,z),U=Dt(E.y,A.y,z),ee=new Fn(V,U,A.angleTo(E),w);return ee._round(),!d||vu(i,ee,m,d,e)?ee:void 0}g+=M}}function Zp(i,e,r,o,c,h,d,m,g){const x=wu(o,h,d),w=Tu(o,c),E=w*d,A=i[0].x===0||i[0].x===g||i[0].y===0||i[0].y===g;return e-E<e/4&&(e=E+e/4),Eu(i,A?e/2*m%e:(w/2+2*h)*d*m%e,e,x,r,E,A,!1,g)}function Eu(i,e,r,o,c,h,d,m,g){const x=h/2,w=bu(i);let E=0,A=e-r,M=[];for(let z=0;z<i.length-1;z++){const V=i[z],U=i[z+1],ee=V.dist(U),oe=U.angleTo(V);for(;A+r<E+ee;){A+=r;const Y=(A-E)/ee,re=Dt(V.x,U.x,Y),fe=Dt(V.y,U.y,Y);if(re>=0&&re<g&&fe>=0&&fe<g&&A-x>=0&&A+x<=w){const de=new Fn(re,fe,oe,z);de._round(),o&&!vu(i,de,h,o,c)||M.push(de)}}E+=ee}return m||M.length||d||(M=Eu(i,E/2,r,o,c,h,d,!0,g)),M}function Su(i,e,r,o,c){const h=[];for(let d=0;d<i.length;d++){const m=i[d];let g;for(let x=0;x<m.length-1;x++){let w=m[x],E=m[x+1];w.x<e&&E.x<e||(w.x<e?w=new We(e,w.y+(e-w.x)/(E.x-w.x)*(E.y-w.y))._round():E.x<e&&(E=new We(e,w.y+(e-w.x)/(E.x-w.x)*(E.y-w.y))._round()),w.y<r&&E.y<r||(w.y<r?w=new We(w.x+(r-w.y)/(E.y-w.y)*(E.x-w.x),r)._round():E.y<r&&(E=new We(w.x+(r-w.y)/(E.y-w.y)*(E.x-w.x),r)._round()),w.x>=o&&E.x>=o||(w.x>=o?w=new We(o,w.y+(o-w.x)/(E.x-w.x)*(E.y-w.y))._round():E.x>=o&&(E=new We(o,w.y+(o-w.x)/(E.x-w.x)*(E.y-w.y))._round()),w.y>=c&&E.y>=c||(w.y>=c?w=new We(w.x+(c-w.y)/(E.y-w.y)*(E.x-w.x),c)._round():E.y>=c&&(E=new We(w.x+(c-w.y)/(E.y-w.y)*(E.x-w.x),c)._round()),g&&w.equals(g[g.length-1])||(g=[w],h.push(g)),g.push(E)))))}}return h}function Iu(i,e,r,o){const c=[],h=i.image,d=h.pixelRatio,m=h.paddedRect.w-2,g=h.paddedRect.h-2,x=i.right-i.left,w=i.bottom-i.top,E=h.stretchX||[[0,m]],A=h.stretchY||[[0,g]],M=(we,ke)=>we+ke[1]-ke[0],z=E.reduce(M,0),V=A.reduce(M,0),U=m-z,ee=g-V;let oe=0,Y=z,re=0,fe=V,de=0,Be=U,Ue=0,Pe=ee;if(h.content&&o){const we=h.content;oe=el(E,0,we[0]),re=el(A,0,we[1]),Y=el(E,we[0],we[2]),fe=el(A,we[1],we[3]),de=we[0]-oe,Ue=we[1]-re,Be=we[2]-we[0]-Y,Pe=we[3]-we[1]-fe}const Ae=(we,ke,Me,be)=>{const qe=tl(we.stretch-oe,Y,x,i.left),Ne=il(we.fixed-de,Be,we.stretch,z),rt=tl(ke.stretch-re,fe,w,i.top),Pt=il(ke.fixed-Ue,Pe,ke.stretch,V),Ft=tl(Me.stretch-oe,Y,x,i.left),Jt=il(Me.fixed-de,Be,Me.stretch,z),Ji=tl(be.stretch-re,fe,w,i.top),ci=il(be.fixed-Ue,Pe,be.stretch,V),jt=new We(qe,rt),ri=new We(Ft,rt),ui=new We(Ft,Ji),gi=new We(qe,Ji),Pi=new We(Ne/d,Pt/d),Xt=new We(Jt/d,ci/d),hi=e*Math.PI/180;if(hi){const ki=Math.sin(hi),Di=Math.cos(hi),Ot=[Di,-ki,ki,Di];jt._matMult(Ot),ri._matMult(Ot),gi._matMult(Ot),ui._matMult(Ot)}const _i=we.stretch+we.fixed,Ei=ke.stretch+ke.fixed;return{tl:jt,tr:ri,bl:gi,br:ui,tex:{x:h.paddedRect.x+1+_i,y:h.paddedRect.y+1+Ei,w:Me.stretch+Me.fixed-_i,h:be.stretch+be.fixed-Ei},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Pi,pixelOffsetBR:Xt,minFontScaleX:Be/d/x,minFontScaleY:Pe/d/w,isSDF:r}};if(o&&(h.stretchX||h.stretchY)){const we=Au(E,U,z),ke=Au(A,ee,V);for(let Me=0;Me<we.length-1;Me++){const be=we[Me],qe=we[Me+1];for(let Ne=0;Ne<ke.length-1;Ne++)c.push(Ae(be,ke[Ne],qe,ke[Ne+1]))}}else c.push(Ae({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:m+1},{fixed:0,stretch:g+1}));return c}function el(i,e,r){let o=0;for(const c of i)o+=Math.max(e,Math.min(r,c[1]))-Math.max(e,Math.min(r,c[0]));return o}function Au(i,e,r){const o=[{fixed:-1,stretch:0}];for(const[c,h]of i){const d=o[o.length-1];o.push({fixed:c-d.stretch,stretch:d.stretch}),o.push({fixed:c-d.stretch,stretch:d.stretch+(h-c)})}return o.push({fixed:e+1,stretch:r}),o}function tl(i,e,r,o){return i/e*r+o}function il(i,e,r,o){return i-e*r/o}Fe("Anchor",Fn);class rl{constructor(e,r,o,c,h,d,m,g,x,w){if(this.boxStartIndex=e.length,x){let E=d.top,A=d.bottom;const M=d.collisionPadding;M&&(E-=M[1],A+=M[3]);let z=A-E;z>0&&(z=Math.max(10,z),this.circleDiameter=z)}else{let E=d.top*m-g[0],A=d.bottom*m+g[2],M=d.left*m-g[3],z=d.right*m+g[1];const V=d.collisionPadding;if(V&&(M-=V[0]*m,E-=V[1]*m,z+=V[2]*m,A+=V[3]*m),w){const U=new We(M,E),ee=new We(z,E),oe=new We(M,A),Y=new We(z,A),re=w*Math.PI/180;U._rotate(re),ee._rotate(re),oe._rotate(re),Y._rotate(re),M=Math.min(U.x,ee.x,oe.x,Y.x),z=Math.max(U.x,ee.x,oe.x,Y.x),E=Math.min(U.y,ee.y,oe.y,Y.y),A=Math.max(U.y,ee.y,oe.y,Y.y)}e.emplaceBack(r.x,r.y,M,E,z,A,o,c,h)}this.boxEndIndex=e.length}}class jp{constructor(e=[],r=Xp){if(this.data=e,this.length=this.data.length,this.compare=r,this.length>0)for(let o=(this.length>>1)-1;o>=0;o--)this._down(o)}push(e){this.data.push(e),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;const e=this.data[0],r=this.data.pop();return this.length--,this.length>0&&(this.data[0]=r,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:r,compare:o}=this,c=r[e];for(;e>0;){const h=e-1>>1,d=r[h];if(o(c,d)>=0)break;r[e]=d,e=h}r[e]=c}_down(e){const{data:r,compare:o}=this,c=this.length>>1,h=r[e];for(;e<c;){let d=1+(e<<1),m=r[d];const g=d+1;if(g<this.length&&o(r[g],m)<0&&(d=g,m=r[g]),o(m,h)>=0)break;r[e]=m,e=d}r[e]=h}}function Xp(i,e){return i<e?-1:i>e?1:0}function Wp(i,e=1,r=!1){let o=1/0,c=1/0,h=-1/0,d=-1/0;const m=i[0];for(let M=0;M<m.length;M++){const z=m[M];(!M||z.x<o)&&(o=z.x),(!M||z.y<c)&&(c=z.y),(!M||z.x>h)&&(h=z.x),(!M||z.y>d)&&(d=z.y)}const g=Math.min(h-o,d-c);let x=g/2;const w=new jp([],Hp);if(g===0)return new We(o,c);for(let M=o;M<h;M+=g)for(let z=c;z<d;z+=g)w.push(new Jo(M+x,z+x,x,i));let E=function(M){let z=0,V=0,U=0;const ee=M[0];for(let oe=0,Y=ee.length,re=Y-1;oe<Y;re=oe++){const fe=ee[oe],de=ee[re],Be=fe.x*de.y-de.x*fe.y;V+=(fe.x+de.x)*Be,U+=(fe.y+de.y)*Be,z+=3*Be}return new Jo(V/z,U/z,0,M)}(i),A=w.length;for(;w.length;){const M=w.pop();(M.d>E.d||!E.d)&&(E=M,r&&console.log("found best %d after %d probes",Math.round(1e4*M.d)/1e4,A)),M.max-E.d<=e||(x=M.h/2,w.push(new Jo(M.p.x-x,M.p.y-x,x,i)),w.push(new Jo(M.p.x+x,M.p.y-x,x,i)),w.push(new Jo(M.p.x-x,M.p.y+x,x,i)),w.push(new Jo(M.p.x+x,M.p.y+x,x,i)),A+=4)}return r&&(console.log(`num probes: ${A}`),console.log(`best distance: ${E.d}`)),E.p}function Hp(i,e){return e.max-i.max}function Jo(i,e,r,o){this.p=new We(i,e),this.h=r,this.d=function(c,h){let d=!1,m=1/0;for(let g=0;g<h.length;g++){const x=h[g];for(let w=0,E=x.length,A=E-1;w<E;A=w++){const M=x[w],z=x[A];M.y>c.y!=z.y>c.y&&c.x<(z.x-M.x)*(c.y-M.y)/(z.y-M.y)+M.x&&(d=!d),m=Math.min(m,Rc(c,M,z))}}return(d?1:-1)*Math.sqrt(m)}(this.p,o),this.max=this.d+this.h*Math.SQRT2}const rc=Number.POSITIVE_INFINITY;function Cu(i,e){return e[1]!==rc?function(r,o,c){let h=0,d=0;switch(o=Math.abs(o),c=Math.abs(c),r){case"top-right":case"top-left":case"top":d=c-7;break;case"bottom-right":case"bottom-left":case"bottom":d=7-c}switch(r){case"top-right":case"bottom-right":case"right":h=-o;break;case"top-left":case"bottom-left":case"left":h=o}return[h,d]}(i,e[0],e[1]):function(r,o){let c=0,h=0;o<0&&(o=0);const d=o/Math.sqrt(2);switch(r){case"top-right":case"top-left":h=d-7;break;case"bottom-right":case"bottom-left":h=7-d;break;case"bottom":h=7-o;break;case"top":h=o-7}switch(r){case"top-right":case"bottom-right":c=-d;break;case"top-left":case"bottom-left":c=d;break;case"left":c=o;break;case"right":c=-o}return[c,h]}(i,e[0])}function nc(i){switch(i){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function Kp(i,e,r,o,c,h,d,m,g,x,w){let E=h.textMaxSize.evaluate(e,{});E===void 0&&(E=d);const A=i.layers[0].layout,M=A.get("icon-offset").evaluate(e,{},w),z=zu(r.horizontal),V=d/24,U=i.tilePixelRatio*V,ee=i.tilePixelRatio*E/24,oe=i.tilePixelRatio*m,Y=i.tilePixelRatio*A.get("symbol-spacing"),re=A.get("text-padding")*i.tilePixelRatio,fe=function(be,qe,Ne,rt=1){const Pt=be.get("icon-padding").evaluate(qe,{},Ne),Ft=Pt&&Pt.values;return[Ft[0]*rt,Ft[1]*rt,Ft[2]*rt,Ft[3]*rt]}(A,e,w,i.tilePixelRatio),de=A.get("text-max-angle")/180*Math.PI,Be=A.get("text-rotation-alignment")!=="viewport"&&A.get("symbol-placement")!=="point",Ue=A.get("icon-rotation-alignment")==="map"&&A.get("symbol-placement")!=="point",Pe=A.get("symbol-placement"),Ae=Y/2,we=A.get("icon-text-fit");let ke;o&&we!=="none"&&(i.allowVerticalPlacement&&r.vertical&&(ke=yu(o,r.vertical,we,A.get("icon-text-fit-padding"),M,V)),z&&(o=yu(o,z,we,A.get("icon-text-fit-padding"),M,V)));const Me=(be,qe)=>{qe.x<0||qe.x>=Kt||qe.y<0||qe.y>=Kt||function(Ne,rt,Pt,Ft,Jt,Ji,ci,jt,ri,ui,gi,Pi,Xt,hi,_i,Ei,ki,Di,Ot,ni,st,Ni,pi,yi,sr){const br=Ne.addToLineVertexArray(rt,Pt);let wr,an,ar,Yi,Li=0,ln=0,Hs=0,ju=0,fc=-1,mc=-1;const cn={};let Xu=ii.exports(""),gc=0,_c=0;if(jt._unevaluatedLayout.getValue("text-radial-offset")===void 0?[gc,_c]=jt.layout.get("text-offset").evaluate(st,{},yi).map(Ri=>Ri*ai):(gc=jt.layout.get("text-radial-offset").evaluate(st,{},yi)*ai,_c=rc),Ne.allowVerticalPlacement&&Ft.vertical){const Ri=jt.layout.get("text-rotate").evaluate(st,{},yi)+90;ar=new rl(ri,rt,ui,gi,Pi,Ft.vertical,Xt,hi,_i,Ri),ci&&(Yi=new rl(ri,rt,ui,gi,Pi,ci,ki,Di,_i,Ri))}if(Jt){const Ri=jt.layout.get("icon-rotate").evaluate(st,{}),Nr=jt.layout.get("icon-text-fit")!=="none",Ks=Iu(Jt,Ri,pi,Nr),Js=ci?Iu(ci,Ri,pi,Nr):void 0;an=new rl(ri,rt,ui,gi,Pi,Jt,ki,Di,!1,Ri),Li=4*Ks.length;const Ku=Ne.iconSizeData;let xo=null;Ku.kind==="source"?(xo=[sn*jt.layout.get("icon-size").evaluate(st,{})],xo[0]>On&&$t(`${Ne.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)):Ku.kind==="composite"&&(xo=[sn*Ni.compositeIconSizes[0].evaluate(st,{},yi),sn*Ni.compositeIconSizes[1].evaluate(st,{},yi)],(xo[0]>On||xo[1]>On)&&$t(`${Ne.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),Ne.addSymbols(Ne.icon,Ks,xo,ni,Ot,st,l.WritingMode.none,rt,br.lineStartIndex,br.lineLength,-1,yi),fc=Ne.icon.placedSymbolArray.length-1,Js&&(ln=4*Js.length,Ne.addSymbols(Ne.icon,Js,xo,ni,Ot,st,l.WritingMode.vertical,rt,br.lineStartIndex,br.lineLength,-1,yi),mc=Ne.icon.placedSymbolArray.length-1)}const Wu=Object.keys(Ft.horizontal);for(const Ri of Wu){const Nr=Ft.horizontal[Ri];if(!wr){Xu=ii.exports(Nr.text);const Js=jt.layout.get("text-rotate").evaluate(st,{},yi);wr=new rl(ri,rt,ui,gi,Pi,Nr,Xt,hi,_i,Js)}const Ks=Nr.positionedLines.length===1;if(Hs+=Mu(Ne,rt,Nr,Ji,jt,_i,st,Ei,br,Ft.vertical?l.WritingMode.horizontal:l.WritingMode.horizontalOnly,Ks?Wu:[Ri],cn,fc,Ni,yi),Ks)break}Ft.vertical&&(ju+=Mu(Ne,rt,Ft.vertical,Ji,jt,_i,st,Ei,br,l.WritingMode.vertical,["vertical"],cn,mc,Ni,yi));const cd=wr?wr.boxStartIndex:Ne.collisionBoxArray.length,ud=wr?wr.boxEndIndex:Ne.collisionBoxArray.length,hd=ar?ar.boxStartIndex:Ne.collisionBoxArray.length,pd=ar?ar.boxEndIndex:Ne.collisionBoxArray.length,dd=an?an.boxStartIndex:Ne.collisionBoxArray.length,fd=an?an.boxEndIndex:Ne.collisionBoxArray.length,md=Yi?Yi.boxStartIndex:Ne.collisionBoxArray.length,gd=Yi?Yi.boxEndIndex:Ne.collisionBoxArray.length;let Tr=-1;const ll=(Ri,Nr)=>Ri&&Ri.circleDiameter?Math.max(Ri.circleDiameter,Nr):Nr;Tr=ll(wr,Tr),Tr=ll(ar,Tr),Tr=ll(an,Tr),Tr=ll(Yi,Tr);const Hu=Tr>-1?1:0;Hu&&(Tr*=sr/ai),Ne.glyphOffsetArray.length>=Yo.MAX_GLYPHS&&$t("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),st.sortKey!==void 0&&Ne.addToSortKeyRanges(Ne.symbolInstances.length,st.sortKey),Ne.symbolInstances.emplaceBack(rt.x,rt.y,cn.right>=0?cn.right:-1,cn.center>=0?cn.center:-1,cn.left>=0?cn.left:-1,cn.vertical||-1,fc,mc,Xu,cd,ud,hd,pd,dd,fd,md,gd,ui,Hs,ju,Li,ln,Hu,0,Xt,gc,_c,Tr)}(i,qe,be,r,o,c,ke,i.layers[0],i.collisionBoxArray,e.index,e.sourceLayerIndex,i.index,U,[re,re,re,re],Be,g,oe,fe,Ue,M,e,h,x,w,d)};if(Pe==="line")for(const be of Su(e.geometry,0,0,Kt,Kt)){const qe=Zp(be,Y,de,r.vertical||z,o,24,ee,i.overscaling,Kt);for(const Ne of qe){const rt=z;rt&&Jp(i,rt.text,Ae,Ne)||Me(be,Ne)}}else if(Pe==="line-center"){for(const be of e.geometry)if(be.length>1){const qe=qp(be,de,r.vertical||z,o,24,ee);qe&&Me(be,qe)}}else if(e.type==="Polygon")for(const be of Zl(e.geometry,0)){const qe=Wp(be,16);Me(be[0],new Fn(qe.x,qe.y,0))}else if(e.type==="LineString")for(const be of e.geometry)Me(be,new Fn(be[0].x,be[0].y,0));else if(e.type==="Point")for(const be of e.geometry)for(const qe of be)Me([qe],new Fn(qe.x,qe.y,0))}const On=32640;function Mu(i,e,r,o,c,h,d,m,g,x,w,E,A,M,z){const V=function(oe,Y,re,fe,de,Be,Ue,Pe){const Ae=fe.layout.get("text-rotate").evaluate(Be,{})*Math.PI/180,we=[];for(const ke of Y.positionedLines)for(const Me of ke.positionedGlyphs){if(!Me.rect)continue;const be=Me.rect||{};let qe=4,Ne=!0,rt=1,Pt=0;const Ft=(de||Pe)&&Me.vertical,Jt=Me.metrics.advance*Me.scale/2;if(Pe&&Y.verticalizable){const Ot=(Me.scale-1)*ai,ni=(ai-Me.metrics.width*Me.scale)/2;Pt=ke.lineOffset/2-(Me.imageName?-ni:Ot)}if(Me.imageName){const Ot=Ue[Me.imageName];Ne=Ot.sdf,rt=Ot.pixelRatio,qe=1/rt}const Ji=de?[Me.x+Jt,Me.y]:[0,0];let ci=de?[0,0]:[Me.x+Jt+re[0],Me.y+re[1]-Pt],jt=[0,0];Ft&&(jt=ci,ci=[0,0]);const ri=(Me.metrics.left-qe)*Me.scale-Jt+ci[0],ui=(-Me.metrics.top-qe)*Me.scale+ci[1],gi=ri+be.w*Me.scale/rt,Pi=ui+be.h*Me.scale/rt,Xt=new We(ri,ui),hi=new We(gi,ui),_i=new We(ri,Pi),Ei=new We(gi,Pi);if(Ft){const Ot=new We(-Jt,Jt-Ja),ni=-Math.PI/2,st=12-Jt,Ni=new We(22-st,-(Me.imageName?st:0)),pi=new We(...jt);Xt._rotateAround(ni,Ot)._add(Ni)._add(pi),hi._rotateAround(ni,Ot)._add(Ni)._add(pi),_i._rotateAround(ni,Ot)._add(Ni)._add(pi),Ei._rotateAround(ni,Ot)._add(Ni)._add(pi)}if(Ae){const Ot=Math.sin(Ae),ni=Math.cos(Ae),st=[ni,-Ot,Ot,ni];Xt._matMult(st),hi._matMult(st),_i._matMult(st),Ei._matMult(st)}const ki=new We(0,0),Di=new We(0,0);we.push({tl:Xt,tr:hi,bl:_i,br:Ei,tex:be,writingMode:Y.writingMode,glyphOffset:Ji,sectionIndex:Me.sectionIndex,isSDF:Ne,pixelOffsetTL:ki,pixelOffsetBR:Di,minFontScaleX:0,minFontScaleY:0})}return we}(0,r,m,c,h,d,o,i.allowVerticalPlacement),U=i.textSizeData;let ee=null;U.kind==="source"?(ee=[sn*c.layout.get("text-size").evaluate(d,{})],ee[0]>On&&$t(`${i.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)):U.kind==="composite"&&(ee=[sn*M.compositeTextSizes[0].evaluate(d,{},z),sn*M.compositeTextSizes[1].evaluate(d,{},z)],(ee[0]>On||ee[1]>On)&&$t(`${i.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),i.addSymbols(i.text,V,ee,m,h,d,x,e,g.lineStartIndex,g.lineLength,A,z);for(const oe of w)E[oe]=i.text.placedSymbolArray.length-1;return 4*V.length}function zu(i){for(const e in i)return i[e];return null}function Jp(i,e,r,o){const c=i.compareText;if(e in c){const h=c[e];for(let d=h.length-1;d>=0;d--)if(o.dist(h[d])<r)return!0}else c[e]=[];return c[e].push(o),!1}const Yp=Rn.VectorTileFeature.types,Qp=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function nl(i,e,r,o,c,h,d,m,g,x,w,E,A){const M=m?Math.min(On,Math.round(m[0])):0,z=m?Math.min(On,Math.round(m[1])):0;i.emplaceBack(e,r,Math.round(32*o),Math.round(32*c),h,d,(M<<1)+(g?1:0),z,16*x,16*w,256*E,256*A)}function oc(i,e,r){i.emplaceBack(e.x,e.y,r),i.emplaceBack(e.x,e.y,r),i.emplaceBack(e.x,e.y,r),i.emplaceBack(e.x,e.y,r)}function ed(i){for(const e of i.sections)if(Da(e.text))return!0;return!1}class sc{constructor(e){this.layoutVertexArray=new nr,this.indexArray=new bi,this.programConfigurations=e,this.segments=new ot,this.dynamicLayoutVertexArray=new Wi,this.opacityVertexArray=new or,this.placedSymbolArray=new ye}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(e,r,o,c){this.isEmpty()||(o&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Tp.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,r),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,Ep.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,Qp,!0),this.opacityVertexBuffer.itemSize=1),(o||c)&&this.programConfigurations.upload(e))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}}Fe("SymbolBuffers",sc);class ac{constructor(e,r,o){this.layoutVertexArray=new e,this.layoutAttributes=r,this.indexArray=new o,this.segments=new ot,this.collisionVertexArray=new $i}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,Sp.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}Fe("CollisionBuffers",ac);class Yo{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(d=>d.id),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=Ul([]),this.placementViewportMatrix=Ul([]);const r=this.layers[0]._unevaluatedLayout._values;this.textSizeData=xu(this.zoom,r["text-size"]),this.iconSizeData=xu(this.zoom,r["icon-size"]);const o=this.layers[0].layout,c=o.get("symbol-sort-key"),h=o.get("symbol-z-order");this.canOverlap=cc(o,"text-overlap","text-allow-overlap")!=="never"||cc(o,"icon-overlap","icon-allow-overlap")!=="never"||o.get("text-ignore-placement")||o.get("icon-ignore-placement"),this.sortFeaturesByKey=h!=="viewport-y"&&!c.isConstant(),this.sortFeaturesByY=(h==="viewport-y"||h==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,o.get("symbol-placement")==="point"&&(this.writingModes=o.get("text-writing-mode").map(d=>l.WritingMode[d])),this.stateDependentLayerIds=this.layers.filter(d=>d.isStateDependent()).map(d=>d.id),this.sourceID=e.sourceID}createArrays(){this.text=new sc(new fo(this.layers,this.zoom,e=>/^text/.test(e))),this.icon=new sc(new fo(this.layers,this.zoom,e=>/^icon/.test(e))),this.glyphOffsetArray=new Ie,this.lineVertexArray=new Re,this.symbolInstances=new Le}calculateGlyphDependencies(e,r,o,c,h){for(let d=0;d<e.length;d++)if(r[e.charCodeAt(d)]=!0,(o||c)&&h){const m=Zs[e.charAt(d)];m&&(r[m.charCodeAt(0)]=!0)}}populate(e,r,o){const c=this.layers[0],h=c.layout,d=h.get("text-font"),m=h.get("text-field"),g=h.get("icon-image"),x=(m.value.kind!=="constant"||m.value.value instanceof Z&&!m.value.value.isEmpty()||m.value.value.toString().length>0)&&(d.value.kind!=="constant"||d.value.value.length>0),w=g.value.kind!=="constant"||!!g.value.value||Object.keys(g.parameters).length>0,E=h.get("symbol-sort-key");if(this.features=[],!x&&!w)return;const A=r.iconDependencies,M=r.glyphDependencies,z=r.availableImages,V=new Rt(this.zoom);for(const{feature:U,id:ee,index:oe,sourceLayerIndex:Y}of e){const re=c._featureFilter.needGeometry,fe=go(U,re);if(!c._featureFilter.filter(V,fe,o))continue;let de,Be;if(re||(fe.geometry=mo(U)),x){const Pe=c.getValueAndResolveTokens("text-field",fe,o,z),Ae=Z.factory(Pe);ed(Ae)&&(this.hasRTLText=!0),(!this.hasRTLText||uo()==="unavailable"||this.hasRTLText&&Ui.isParsed())&&(de=Ap(Ae,c,fe))}if(w){const Pe=c.getValueAndResolveTokens("icon-image",fe,o,z);Be=Pe instanceof K?Pe:K.fromString(Pe)}if(!de&&!Be)continue;const Ue=this.sortFeaturesByKey?E.evaluate(fe,{},o):void 0;if(this.features.push({id:ee,text:de,icon:Be,index:oe,sourceLayerIndex:Y,geometry:fe.geometry,properties:U.properties,type:Yp[U.type],sortKey:Ue}),Be&&(A[Be.name]=!0),de){const Pe=d.evaluate(fe,{},o).join(","),Ae=h.get("text-rotation-alignment")!=="viewport"&&h.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(l.WritingMode.vertical)>=0;for(const we of de.sections)if(we.image)A[we.image.name]=!0;else{const ke=$o(de.toString()),Me=we.fontStack||Pe,be=M[Me]=M[Me]||{};this.calculateGlyphDependencies(we.text,be,Ae,this.allowVerticalPlacement,ke)}}}h.get("symbol-placement")==="line"&&(this.features=function(U){const ee={},oe={},Y=[];let re=0;function fe(Pe){Y.push(U[Pe]),re++}function de(Pe,Ae,we){const ke=oe[Pe];return delete oe[Pe],oe[Ae]=ke,Y[ke].geometry[0].pop(),Y[ke].geometry[0]=Y[ke].geometry[0].concat(we[0]),ke}function Be(Pe,Ae,we){const ke=ee[Ae];return delete ee[Ae],ee[Pe]=ke,Y[ke].geometry[0].shift(),Y[ke].geometry[0]=we[0].concat(Y[ke].geometry[0]),ke}function Ue(Pe,Ae,we){const ke=we?Ae[0][Ae[0].length-1]:Ae[0][0];return`${Pe}:${ke.x}:${ke.y}`}for(let Pe=0;Pe<U.length;Pe++){const Ae=U[Pe],we=Ae.geometry,ke=Ae.text?Ae.text.toString():null;if(!ke){fe(Pe);continue}const Me=Ue(ke,we),be=Ue(ke,we,!0);if(Me in oe&&be in ee&&oe[Me]!==ee[be]){const qe=Be(Me,be,we),Ne=de(Me,be,Y[qe].geometry);delete ee[Me],delete oe[be],oe[Ue(ke,Y[Ne].geometry,!0)]=Ne,Y[qe].geometry=null}else Me in oe?de(Me,be,we):be in ee?Be(Me,be,we):(fe(Pe),ee[Me]=re-1,oe[be]=re-1)}return Y.filter(Pe=>Pe.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((U,ee)=>U.sortKey-ee.sortKey)}update(e,r,o){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,r,this.layers,o),this.icon.programConfigurations.updatePaintArrays(e,r,this.layers,o))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(e,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(e,r){const o=this.lineVertexArray.length;if(e.segment!==void 0){let c=e.dist(r[e.segment+1]),h=e.dist(r[e.segment]);const d={};for(let m=e.segment+1;m<r.length;m++)d[m]={x:r[m].x,y:r[m].y,tileUnitDistanceFromAnchor:c},m<r.length-1&&(c+=r[m+1].dist(r[m]));for(let m=e.segment||0;m>=0;m--)d[m]={x:r[m].x,y:r[m].y,tileUnitDistanceFromAnchor:h},m>0&&(h+=r[m-1].dist(r[m]));for(let m=0;m<r.length;m++){const g=d[m];this.lineVertexArray.emplaceBack(g.x,g.y,g.tileUnitDistanceFromAnchor)}}return{lineStartIndex:o,lineLength:this.lineVertexArray.length-o}}addSymbols(e,r,o,c,h,d,m,g,x,w,E,A){const M=e.indexArray,z=e.layoutVertexArray,V=e.segments.prepareSegment(4*r.length,z,M,this.canOverlap?d.sortKey:void 0),U=this.glyphOffsetArray.length,ee=V.vertexLength,oe=this.allowVerticalPlacement&&m===l.WritingMode.vertical?Math.PI/2:0,Y=d.text&&d.text.sections;for(let re=0;re<r.length;re++){const{tl:fe,tr:de,bl:Be,br:Ue,tex:Pe,pixelOffsetTL:Ae,pixelOffsetBR:we,minFontScaleX:ke,minFontScaleY:Me,glyphOffset:be,isSDF:qe,sectionIndex:Ne}=r[re],rt=V.vertexLength,Pt=be[1];nl(z,g.x,g.y,fe.x,Pt+fe.y,Pe.x,Pe.y,o,qe,Ae.x,Ae.y,ke,Me),nl(z,g.x,g.y,de.x,Pt+de.y,Pe.x+Pe.w,Pe.y,o,qe,we.x,Ae.y,ke,Me),nl(z,g.x,g.y,Be.x,Pt+Be.y,Pe.x,Pe.y+Pe.h,o,qe,Ae.x,we.y,ke,Me),nl(z,g.x,g.y,Ue.x,Pt+Ue.y,Pe.x+Pe.w,Pe.y+Pe.h,o,qe,we.x,we.y,ke,Me),oc(e.dynamicLayoutVertexArray,g,oe),M.emplaceBack(rt,rt+1,rt+2),M.emplaceBack(rt+1,rt+2,rt+3),V.vertexLength+=4,V.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(be[0]),re!==r.length-1&&Ne===r[re+1].sectionIndex||e.programConfigurations.populatePaintArrays(z.length,d,d.index,{},A,Y&&Y[Ne])}e.placedSymbolArray.emplaceBack(g.x,g.y,U,this.glyphOffsetArray.length-U,ee,x,w,g.segment,o?o[0]:0,o?o[1]:0,c[0],c[1],m,0,!1,0,E)}_addCollisionDebugVertex(e,r,o,c,h,d){return r.emplaceBack(0,0),e.emplaceBack(o.x,o.y,c,h,Math.round(d.x),Math.round(d.y))}addCollisionDebugVertices(e,r,o,c,h,d,m){const g=h.segments.prepareSegment(4,h.layoutVertexArray,h.indexArray),x=g.vertexLength,w=h.layoutVertexArray,E=h.collisionVertexArray,A=m.anchorX,M=m.anchorY;this._addCollisionDebugVertex(w,E,d,A,M,new We(e,r)),this._addCollisionDebugVertex(w,E,d,A,M,new We(o,r)),this._addCollisionDebugVertex(w,E,d,A,M,new We(o,c)),this._addCollisionDebugVertex(w,E,d,A,M,new We(e,c)),g.vertexLength+=4;const z=h.indexArray;z.emplaceBack(x,x+1),z.emplaceBack(x+1,x+2),z.emplaceBack(x+2,x+3),z.emplaceBack(x+3,x),g.primitiveLength+=4}addDebugCollisionBoxes(e,r,o,c){for(let h=e;h<r;h++){const d=this.collisionBoxArray.get(h);this.addCollisionDebugVertices(d.x1,d.y1,d.x2,d.y2,c?this.textCollisionBox:this.iconCollisionBox,d.anchorPoint,o)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new ac($r,ou.members,xr),this.iconCollisionBox=new ac($r,ou.members,xr);for(let e=0;e<this.symbolInstances.length;e++){const r=this.symbolInstances.get(e);this.addDebugCollisionBoxes(r.textBoxStartIndex,r.textBoxEndIndex,r,!0),this.addDebugCollisionBoxes(r.verticalTextBoxStartIndex,r.verticalTextBoxEndIndex,r,!0),this.addDebugCollisionBoxes(r.iconBoxStartIndex,r.iconBoxEndIndex,r,!1),this.addDebugCollisionBoxes(r.verticalIconBoxStartIndex,r.verticalIconBoxEndIndex,r,!1)}}_deserializeCollisionBoxesForSymbol(e,r,o,c,h,d,m,g,x){const w={};for(let E=r;E<o;E++){const A=e.get(E);w.textBox={x1:A.x1,y1:A.y1,x2:A.x2,y2:A.y2,anchorPointX:A.anchorPointX,anchorPointY:A.anchorPointY},w.textFeatureIndex=A.featureIndex;break}for(let E=c;E<h;E++){const A=e.get(E);w.verticalTextBox={x1:A.x1,y1:A.y1,x2:A.x2,y2:A.y2,anchorPointX:A.anchorPointX,anchorPointY:A.anchorPointY},w.verticalTextFeatureIndex=A.featureIndex;break}for(let E=d;E<m;E++){const A=e.get(E);w.iconBox={x1:A.x1,y1:A.y1,x2:A.x2,y2:A.y2,anchorPointX:A.anchorPointX,anchorPointY:A.anchorPointY},w.iconFeatureIndex=A.featureIndex;break}for(let E=g;E<x;E++){const A=e.get(E);w.verticalIconBox={x1:A.x1,y1:A.y1,x2:A.x2,y2:A.y2,anchorPointX:A.anchorPointX,anchorPointY:A.anchorPointY},w.verticalIconFeatureIndex=A.featureIndex;break}return w}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let r=0;r<this.symbolInstances.length;r++){const o=this.symbolInstances.get(r);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,o.textBoxStartIndex,o.textBoxEndIndex,o.verticalTextBoxStartIndex,o.verticalTextBoxEndIndex,o.iconBoxStartIndex,o.iconBoxEndIndex,o.verticalIconBoxStartIndex,o.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(e,r){const o=e.placedSymbolArray.get(r),c=o.vertexStartIndex+4*o.numGlyphs;for(let h=o.vertexStartIndex;h<c;h+=4)e.indexArray.emplaceBack(h,h+1,h+2),e.indexArray.emplaceBack(h+1,h+2,h+3)}getSortedSymbolIndexes(e){if(this.sortedAngle===e&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const r=Math.sin(e),o=Math.cos(e),c=[],h=[],d=[];for(let m=0;m<this.symbolInstances.length;++m){d.push(m);const g=this.symbolInstances.get(m);c.push(0|Math.round(r*g.anchorX+o*g.anchorY)),h.push(g.featureIndex)}return d.sort((m,g)=>c[m]-c[g]||h[g]-h[m]),d}addToSortKeyRanges(e,r){const o=this.sortKeyRanges[this.sortKeyRanges.length-1];o&&o.sortKey===r?o.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:r,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const r of this.symbolInstanceIndexes){const o=this.symbolInstances.get(r);this.featureSortOrder.push(o.featureIndex),[o.rightJustifiedTextSymbolIndex,o.centerJustifiedTextSymbolIndex,o.leftJustifiedTextSymbolIndex].forEach((c,h,d)=>{c>=0&&d.indexOf(c)===h&&this.addIndicesForPlacedSymbol(this.text,c)}),o.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,o.verticalPlacedTextSymbolIndex),o.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,o.placedIconSymbolIndex),o.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,o.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}Fe("SymbolBucket",Yo,{omit:["layers","collisionBoxArray","features","compareText"]}),Yo.MAX_GLYPHS=65535,Yo.addDynamicAttributes=oc;const td=new si({"symbol-placement":new Ve(pe.layout_symbol["symbol-placement"]),"symbol-spacing":new Ve(pe.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Ve(pe.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new je(pe.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Ve(pe.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Ve(pe.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Ve(pe.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Ve(pe.layout_symbol["icon-ignore-placement"]),"icon-optional":new Ve(pe.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Ve(pe.layout_symbol["icon-rotation-alignment"]),"icon-size":new je(pe.layout_symbol["icon-size"]),"icon-text-fit":new Ve(pe.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Ve(pe.layout_symbol["icon-text-fit-padding"]),"icon-image":new je(pe.layout_symbol["icon-image"]),"icon-rotate":new je(pe.layout_symbol["icon-rotate"]),"icon-padding":new je(pe.layout_symbol["icon-padding"]),"icon-keep-upright":new Ve(pe.layout_symbol["icon-keep-upright"]),"icon-offset":new je(pe.layout_symbol["icon-offset"]),"icon-anchor":new je(pe.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Ve(pe.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Ve(pe.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Ve(pe.layout_symbol["text-rotation-alignment"]),"text-field":new je(pe.layout_symbol["text-field"]),"text-font":new je(pe.layout_symbol["text-font"]),"text-size":new je(pe.layout_symbol["text-size"]),"text-max-width":new je(pe.layout_symbol["text-max-width"]),"text-line-height":new Ve(pe.layout_symbol["text-line-height"]),"text-letter-spacing":new je(pe.layout_symbol["text-letter-spacing"]),"text-justify":new je(pe.layout_symbol["text-justify"]),"text-radial-offset":new je(pe.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Ve(pe.layout_symbol["text-variable-anchor"]),"text-anchor":new je(pe.layout_symbol["text-anchor"]),"text-max-angle":new Ve(pe.layout_symbol["text-max-angle"]),"text-writing-mode":new Ve(pe.layout_symbol["text-writing-mode"]),"text-rotate":new je(pe.layout_symbol["text-rotate"]),"text-padding":new Ve(pe.layout_symbol["text-padding"]),"text-keep-upright":new Ve(pe.layout_symbol["text-keep-upright"]),"text-transform":new je(pe.layout_symbol["text-transform"]),"text-offset":new je(pe.layout_symbol["text-offset"]),"text-allow-overlap":new Ve(pe.layout_symbol["text-allow-overlap"]),"text-overlap":new Ve(pe.layout_symbol["text-overlap"]),"text-ignore-placement":new Ve(pe.layout_symbol["text-ignore-placement"]),"text-optional":new Ve(pe.layout_symbol["text-optional"])});var lc={paint:new si({"icon-opacity":new je(pe.paint_symbol["icon-opacity"]),"icon-color":new je(pe.paint_symbol["icon-color"]),"icon-halo-color":new je(pe.paint_symbol["icon-halo-color"]),"icon-halo-width":new je(pe.paint_symbol["icon-halo-width"]),"icon-halo-blur":new je(pe.paint_symbol["icon-halo-blur"]),"icon-translate":new Ve(pe.paint_symbol["icon-translate"]),"icon-translate-anchor":new Ve(pe.paint_symbol["icon-translate-anchor"]),"text-opacity":new je(pe.paint_symbol["text-opacity"]),"text-color":new je(pe.paint_symbol["text-color"],{runtimeType:oi,getOverride:i=>i.textColor,hasOverride:i=>!!i.textColor}),"text-halo-color":new je(pe.paint_symbol["text-halo-color"]),"text-halo-width":new je(pe.paint_symbol["text-halo-width"]),"text-halo-blur":new je(pe.paint_symbol["text-halo-blur"]),"text-translate":new Ve(pe.paint_symbol["text-translate"]),"text-translate-anchor":new Ve(pe.paint_symbol["text-translate-anchor"])}),layout:td};class Pu{constructor(e){if(e.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=e.property.overrides?e.property.overrides.runtimeType:kr,this.defaultValue=e}evaluate(e){if(e.formattedSection){const r=this.defaultValue.property.overrides;if(r&&r.hasOverride(e.formattedSection))return r.getOverride(e.formattedSection)}return e.feature&&e.featureState?this.defaultValue.evaluate(e.feature,e.featureState):this.defaultValue.property.specification.default}eachChild(e){this.defaultValue.isConstant()||e(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}Fe("FormatSectionOverride",Pu,{omit:["defaultValue"]});class ol extends rr{constructor(e){super(e,lc)}recalculate(e,r){if(super.recalculate(e,r),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout._values["icon-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout._values["text-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")==="map"?"map":"viewport"),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),this.layout.get("symbol-placement")==="point"){const o=this.layout.get("text-writing-mode");if(o){const c=[];for(const h of o)c.indexOf(h)<0&&c.push(h);this.layout._values["text-writing-mode"]=c}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(e,r,o,c){const h=this.layout.get(e).evaluate(r,{},o,c),d=this._unevaluatedLayout._values[e];return d.isDataDriven()||Jn(d.value)||!h?h:function(m,g){return g.replace(/{([^{}]+)}/g,(x,w)=>w in m?String(m[w]):"")}(r.properties,h)}createBucket(e){return new Yo(e)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const e of lc.paint.overridableProperties){if(!ol.hasPaintOverride(this.layout,e))continue;const r=this.paint.get(e),o=new Pu(r),c=new Lo(o,r.property.specification);let h=null;h=r.value.kind==="constant"||r.value.kind==="source"?new Qn("source",c):new xs("composite",c,r.value.zoomStops),this.paint._values[e]=new ir(r.property,h,r.parameters)}}_handleOverridablePaintPropertyUpdate(e,r,o){return!(!this.layout||r.isDataDriven()||o.isDataDriven())&&ol.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,r){const o=e.get("text-field"),c=lc.paint.properties[r];let h=!1;const d=m=>{for(const g of m)if(c.overrides&&c.overrides.hasOverride(g))return void(h=!0)};if(o.value.kind==="constant"&&o.value.value instanceof Z)d(o.value.value.sections);else if(o.value.kind==="source"){const m=x=>{h||(x instanceof $e&&ae(x.value)===Yt?d(x.value.sections):x instanceof ko?d(x.sections):x.eachChild(m))},g=o.value;g._styleExpression&&m(g._styleExpression.expression)}return h}}function cc(i,e,r){let o="never";const c=i.get(e);return c?o=c:i.get(r)&&(o="always"),o}var id={paint:new si({"background-color":new Ve(pe.paint_background["background-color"]),"background-pattern":new Ps(pe.paint_background["background-pattern"]),"background-opacity":new Ve(pe.paint_background["background-opacity"])})},rd={paint:new si({"raster-opacity":new Ve(pe.paint_raster["raster-opacity"]),"raster-hue-rotate":new Ve(pe.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Ve(pe.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Ve(pe.paint_raster["raster-brightness-max"]),"raster-saturation":new Ve(pe.paint_raster["raster-saturation"]),"raster-contrast":new Ve(pe.paint_raster["raster-contrast"]),"raster-resampling":new Ve(pe.paint_raster["raster-resampling"]),"raster-fade-duration":new Ve(pe.paint_raster["raster-fade-duration"])})};class nd extends rr{constructor(e){super(e,{}),this.onAdd=r=>{this.implementation.onAdd&&this.implementation.onAdd(r,r.painter.context.gl)},this.onRemove=r=>{this.implementation.onRemove&&this.implementation.onRemove(r,r.painter.context.gl)},this.implementation=e}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}}const od={circle:class extends rr{constructor(i){super(i,Bh)}createBucket(i){return new Bl(i)}queryRadius(i){const e=i;return Bs("circle-radius",this,e)+Bs("circle-stroke-width",this,e)+Na(this.paint.get("circle-translate"))}queryIntersectsFeature(i,e,r,o,c,h,d,m){const g=Ga(i,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),h.angle,d),x=this.paint.get("circle-radius").evaluate(e,r)+this.paint.get("circle-stroke-width").evaluate(e,r),w=this.paint.get("circle-pitch-alignment")==="map",E=w?g:function(M,z){return M.map(V=>Nc(V,z))}(g,m),A=w?x*d:x;for(const M of o)for(const z of M){const V=w?z:Nc(z,m);let U=A;const ee=qa([],[z.x,z.y,0,1],m);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?U*=ee[3]/h.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(U*=h.cameraToCenterDistance/ee[3]),Ph(E,V,U))return!0}return!1}},heatmap:class extends rr{constructor(i){super(i,Oh),this._updateColorRamp()}createBucket(i){return new Gc(i)}_handleSpecialPaintPropertyUpdate(i){i==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=Zc({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}},hillshade:class extends rr{constructor(i){super(i,Uh)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}},fill:class extends rr{constructor(i){super(i,tp)}recalculate(i,e){super.recalculate(i,e);const r=this.paint._values["fill-outline-color"];r.value.kind==="constant"&&r.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(i){return new Wl(i)}queryRadius(){return Na(this.paint.get("fill-translate"))}queryIntersectsFeature(i,e,r,o,c,h,d){return Lc(Ga(i,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),h.angle,d),o)}isTileClipped(){return!0}},"fill-extrusion":class extends rr{constructor(i){super(i,mp)}createBucket(i){return new Kl(i)}queryRadius(){return Na(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(i,e,r,o,c,h,d,m){const g=Ga(i,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),h.angle,d),x=this.paint.get("fill-extrusion-height").evaluate(e,r),w=this.paint.get("fill-extrusion-base").evaluate(e,r),E=function(M,z,V,U){const ee=[];for(const oe of M){const Y=[oe.x,oe.y,0,1];qa(Y,Y,z),ee.push(new We(Y[0]/Y[3],Y[1]/Y[3]))}return ee}(g,m),A=function(M,z,V,U){const ee=[],oe=[],Y=U[8]*z,re=U[9]*z,fe=U[10]*z,de=U[11]*z,Be=U[8]*V,Ue=U[9]*V,Pe=U[10]*V,Ae=U[11]*V;for(const we of M){const ke=[],Me=[];for(const be of we){const qe=be.x,Ne=be.y,rt=U[0]*qe+U[4]*Ne+U[12],Pt=U[1]*qe+U[5]*Ne+U[13],Ft=U[2]*qe+U[6]*Ne+U[14],Jt=U[3]*qe+U[7]*Ne+U[15],Ji=Ft+fe,ci=Jt+de,jt=rt+Be,ri=Pt+Ue,ui=Ft+Pe,gi=Jt+Ae,Pi=new We((rt+Y)/ci,(Pt+re)/ci);Pi.z=Ji/ci,ke.push(Pi);const Xt=new We(jt/gi,ri/gi);Xt.z=ui/gi,Me.push(Xt)}ee.push(ke),oe.push(Me)}return[ee,oe]}(o,w,x,m);return function(M,z,V){let U=1/0;Lc(V,z)&&(U=eu(V,z[0]));for(let ee=0;ee<z.length;ee++){const oe=z[ee],Y=M[ee];for(let re=0;re<oe.length-1;re++){const fe=oe[re],de=[fe,oe[re+1],Y[re+1],Y[re],fe];Dc(V,de)&&(U=Math.min(U,eu(V,de)))}}return U!==1/0&&U}(A[0],A[1],E)}},line:class extends rr{constructor(i){super(i,iu),this.gradientVersion=0}_handleSpecialPaintPropertyUpdate(i){i==="line-gradient"&&(this.stepInterpolant=this._transitionablePaint._values["line-gradient"].value.expression._styleExpression.expression instanceof jn,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER)}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(i,e){super.recalculate(i,e),this.paint._values["line-floorwidth"]=ru.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,i)}createBucket(i){return new Jl(i)}queryRadius(i){const e=i,r=nu(Bs("line-width",this,e),Bs("line-gap-width",this,e)),o=Bs("line-offset",this,e);return r/2+Math.abs(o)+Na(this.paint.get("line-translate"))}queryIntersectsFeature(i,e,r,o,c,h,d){const m=Ga(i,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),h.angle,d),g=d/2*nu(this.paint.get("line-width").evaluate(e,r),this.paint.get("line-gap-width").evaluate(e,r)),x=this.paint.get("line-offset").evaluate(e,r);return x&&(o=function(w,E){const A=[];for(let M=0;M<w.length;M++){const z=w[M],V=[];for(let U=0;U<z.length;U++){const ee=z[U-1],oe=z[U],Y=z[U+1],re=U===0?new We(0,0):oe.sub(ee)._unit()._perp(),fe=U===z.length-1?new We(0,0):Y.sub(oe)._unit()._perp(),de=re._add(fe)._unit(),Be=de.x*fe.x+de.y*fe.y;Be!==0&&de._mult(1/Be),V.push(de._mult(E)._add(oe))}A.push(V)}return A}(o,x*d)),function(w,E,A){for(let M=0;M<E.length;M++){const z=E[M];if(w.length>=3){for(let V=0;V<z.length;V++)if(Zo(w,z[V]))return!0}if(kh(w,z,A))return!0}return!1}(m,o,g)}isTileClipped(){return!0}},symbol:ol,background:class extends rr{constructor(i){super(i,id)}},raster:class extends rr{constructor(i){super(i,rd)}}};class sd{constructor(e){this._callback=e,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._callback()},0))}remove(){delete this._channel,this._callback=()=>{}}}const ku=63710088e-1;class Nt{constructor(e,r){if(isNaN(e)||isNaN(r))throw new Error(`Invalid LngLat object: (${e}, ${r})`);if(this.lng=+e,this.lat=+r,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new Nt(gt(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){const r=Math.PI/180,o=this.lat*r,c=e.lat*r,h=Math.sin(o)*Math.sin(c)+Math.cos(o)*Math.cos(c)*Math.cos((e.lng-this.lng)*r);return ku*Math.acos(Math.min(h,1))}toBounds(e=0){const r=360*e/40075017,o=r/Math.cos(Math.PI/180*this.lat);return new yo(new Nt(this.lng-o,this.lat-r),new Nt(this.lng+o,this.lat+r))}static convert(e){if(e instanceof Nt)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new Nt(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e!==null)return new Nt(Number("lng"in e?e.lng:e.lon),Number(e.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}}class yo{constructor(e,r){e&&(r?this.setSouthWest(e).setNorthEast(r):e.length===4?this.setSouthWest([e[0],e[1]]).setNorthEast([e[2],e[3]]):this.setSouthWest(e[0]).setNorthEast(e[1]))}setNorthEast(e){return this._ne=e instanceof Nt?new Nt(e.lng,e.lat):Nt.convert(e),this}setSouthWest(e){return this._sw=e instanceof Nt?new Nt(e.lng,e.lat):Nt.convert(e),this}extend(e){const r=this._sw,o=this._ne;let c,h;if(e instanceof Nt)c=e,h=e;else{if(!(e instanceof yo))return Array.isArray(e)?e.length===4||e.every(Array.isArray)?this.extend(yo.convert(e)):this.extend(Nt.convert(e)):this;if(c=e._sw,h=e._ne,!c||!h)return this}return r||o?(r.lng=Math.min(c.lng,r.lng),r.lat=Math.min(c.lat,r.lat),o.lng=Math.max(h.lng,o.lng),o.lat=Math.max(h.lat,o.lat)):(this._sw=new Nt(c.lng,c.lat),this._ne=new Nt(h.lng,h.lat)),this}getCenter(){return new Nt((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 Nt(this.getWest(),this.getNorth())}getSouthEast(){return new Nt(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(e){const{lng:r,lat:o}=Nt.convert(e);let c=this._sw.lng<=r&&r<=this._ne.lng;return this._sw.lng>this._ne.lng&&(c=this._sw.lng>=r&&r>=this._ne.lng),this._sw.lat<=o&&o<=this._ne.lat&&c}static convert(e){return e instanceof yo?e:e&&new yo(e)}}const Du=2*Math.PI*ku;function Lu(i){return Du*Math.cos(i*Math.PI/180)}function Ru(i){return(180+i)/360}function Bu(i){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i*Math.PI/360)))/360}function Fu(i,e){return i/Lu(e)}function uc(i){return 360/Math.PI*Math.atan(Math.exp((180-360*i)*Math.PI/180))-90}class sl{constructor(e,r,o=0){this.x=+e,this.y=+r,this.z=+o}static fromLngLat(e,r=0){const o=Nt.convert(e);return new sl(Ru(o.lng),Bu(o.lat),Fu(r,o.lat))}toLngLat(){return new Nt(360*this.x-180,uc(this.y))}toAltitude(){return this.z*Lu(uc(this.y))}meterInMercatorCoordinateUnits(){return 1/Du*(e=uc(this.y),1/Math.cos(e*Math.PI/180));var e}}function Ou(i,e,r){var o=2*Math.PI*6378137/256/Math.pow(2,r);return[i*o-2*Math.PI*6378137/2,e*o-2*Math.PI*6378137/2]}class hc{constructor(e,r,o){if(e<0||e>25||o<0||o>=Math.pow(2,e)||r<0||r>=Math.pow(2,e))throw new Error(`x=${r}, y=${o}, z=${e} outside of bounds. 0<=x<${Math.pow(2,e)}, 0<=y<${Math.pow(2,e)} 0<=z<=25 `);this.z=e,this.x=r,this.y=o,this.key=Xs(0,e,e,r,o)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,r,o){const c=(d=this.y,m=this.z,g=Ou(256*(h=this.x),256*(d=Math.pow(2,m)-d-1),m),x=Ou(256*(h+1),256*(d+1),m),g[0]+","+g[1]+","+x[0]+","+x[1]);var h,d,m,g,x;const w=function(E,A,M){let z,V="";for(let U=E;U>0;U--)z=1<<U-1,V+=(A&z?1:0)+(M&z?2:0);return V}(this.z,this.x,this.y);return e[(this.x+this.y)%e.length].replace(/{prefix}/g,(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String(o==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,r>1?"@2x":"").replace(/{quadkey}/g,w).replace(/{bbox-epsg-3857}/g,c)}isChildOf(e){const r=this.z-e.z;return r>0&&e.x===this.x>>r&&e.y===this.y>>r}getTilePoint(e){const r=Math.pow(2,this.z);return new We((e.x*r-this.x)*Kt,(e.y*r-this.y)*Kt)}toString(){return`${this.z}/${this.x}/${this.y}`}}class Uu{constructor(e,r){this.wrap=e,this.canonical=r,this.key=Xs(e,r.z,r.z,r.x,r.y)}}class Ki{constructor(e,r,o,c,h){if(e<o)throw new Error(`overscaledZ should be >= z; overscaledZ = ${e}; z = ${o}`);this.overscaledZ=e,this.wrap=r,this.canonical=new hc(o,+c,+h),this.key=Xs(r,e,o,c,h)}clone(){return new Ki(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);const r=this.canonical.z-e;return e>this.canonical.z?new Ki(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Ki(e,this.wrap,e,this.canonical.x>>r,this.canonical.y>>r)}calculateScaledKey(e,r){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);const o=this.canonical.z-e;return e>this.canonical.z?Xs(this.wrap*+r,e,this.canonical.z,this.canonical.x,this.canonical.y):Xs(this.wrap*+r,e,e,this.canonical.x>>o,this.canonical.y>>o)}isChildOf(e){if(e.wrap!==this.wrap)return!1;const r=this.canonical.z-e.canonical.z;return e.overscaledZ===0||e.overscaledZ<this.overscaledZ&&e.canonical.x===this.canonical.x>>r&&e.canonical.y===this.canonical.y>>r}children(e){if(this.overscaledZ>=e)return[new Ki(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const r=this.canonical.z+1,o=2*this.canonical.x,c=2*this.canonical.y;return[new Ki(r,this.wrap,r,o,c),new Ki(r,this.wrap,r,o+1,c),new Ki(r,this.wrap,r,o,c+1),new Ki(r,this.wrap,r,o+1,c+1)]}isLessThan(e){return this.wrap<e.wrap||!(this.wrap>e.wrap)&&(this.overscaledZ<e.overscaledZ||!(this.overscaledZ>e.overscaledZ)&&(this.canonical.x<e.canonical.x||!(this.canonical.x>e.canonical.x)&&this.canonical.y<e.canonical.y))}wrapped(){return new Ki(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new Ki(this.overscaledZ,e,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new Uu(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(e){return this.canonical.getTilePoint(new sl(e.x-this.wrap,e.y))}}function Xs(i,e,r,o,c){(i*=2)<0&&(i=-1*i-1);const h=1<<r;return(h*h*i+h*c+o).toString(36)+r.toString(36)+e.toString(36)}Fe("CanonicalTileID",hc),Fe("OverscaledTileID",Ki,{omit:["posMatrix"]});class $u{constructor(e,r,o){if(this.uid=e,r.height!==r.width)throw new RangeError("DEM tiles must be square");if(o&&o!=="mapbox"&&o!=="terrarium")return void $t(`"${o}" is not a valid encoding type. Valid types include "mapbox" and "terrarium".`);this.stride=r.height;const c=this.dim=r.height-2;this.data=new Uint32Array(r.data.buffer),this.encoding=o||"mapbox";for(let h=0;h<c;h++)this.data[this._idx(-1,h)]=this.data[this._idx(0,h)],this.data[this._idx(c,h)]=this.data[this._idx(c-1,h)],this.data[this._idx(h,-1)]=this.data[this._idx(h,0)],this.data[this._idx(h,c)]=this.data[this._idx(h,c-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(c,-1)]=this.data[this._idx(c-1,0)],this.data[this._idx(-1,c)]=this.data[this._idx(0,c-1)],this.data[this._idx(c,c)]=this.data[this._idx(c-1,c-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let h=0;h<c;h++)for(let d=0;d<c;d++){const m=this.get(h,d);m>this.max&&(this.max=m),m<this.min&&(this.min=m)}}get(e,r){const o=new Uint8Array(this.data.buffer),c=4*this._idx(e,r);return(this.encoding==="terrarium"?this._unpackTerrarium:this._unpackMapbox)(o[c],o[c+1],o[c+2])}getUnpackVector(){return this.encoding==="terrarium"?[256,1,1/256,32768]:[6553.6,25.6,.1,1e4]}_idx(e,r){if(e<-1||e>=this.dim+1||r<-1||r>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(r+1)*this.stride+(e+1)}_unpackMapbox(e,r,o){return(256*e*256+256*r+o)/10-1e4}_unpackTerrarium(e,r,o){return 256*e+r+o/256-32768}getPixels(){return new Hi({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(e,r,o){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let c=r*this.dim,h=r*this.dim+this.dim,d=o*this.dim,m=o*this.dim+this.dim;switch(r){case-1:c=h-1;break;case 1:h=c+1}switch(o){case-1:d=m-1;break;case 1:m=d+1}const g=-r*this.dim,x=-o*this.dim;for(let w=d;w<m;w++)for(let E=c;E<h;E++)this.data[this._idx(E,w)]=e.data[this._idx(E+g,w+x)]}}Fe("DEMData",$u);class Vu{constructor(e){this._stringToNumber={},this._numberToString=[];for(let r=0;r<e.length;r++){const o=e[r];this._stringToNumber[o]=r,this._numberToString[r]=o}}encode(e){return this._stringToNumber[e]}decode(e){if(e>=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${e} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[e]}}class Nu{constructor(e,r,o,c,h){this.type="Feature",this._vectorTileFeature=e,e._z=r,e._x=o,e._y=c,this.properties=e.properties,this.id=h}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(e){this._geometry=e}toJSON(){const e={geometry:this.geometry};for(const r in this)r!=="_geometry"&&r!=="_vectorTileFeature"&&(e[r]=this[r]);return e}}class Gu{constructor(e,r){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new co(Kt,16,0),this.grid3D=new co(Kt,16,0),this.featureIndexArray=new it,this.promoteId=r}insert(e,r,o,c,h,d){const m=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(o,c,h);const g=d?this.grid3D:this.grid;for(let x=0;x<r.length;x++){const w=r[x],E=[1/0,1/0,-1/0,-1/0];for(let A=0;A<w.length;A++){const M=w[A];E[0]=Math.min(E[0],M.x),E[1]=Math.min(E[1],M.y),E[2]=Math.max(E[2],M.x),E[3]=Math.max(E[3],M.y)}E[0]<Kt&&E[1]<Kt&&E[2]>=0&&E[3]>=0&&g.insert(m,E[0],E[1],E[2],E[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new Rn.VectorTile(new Yl(this.rawTileData)).layers,this.sourceLayerCoder=new Vu(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(e,r,o,c){this.loadVTLayers();const h=e.params||{},d=Kt/e.tileSize/e.scale,m=Fo(h.filter),g=e.queryGeometry,x=e.queryPadding*d,w=Zu(g),E=this.grid.query(w.minX-x,w.minY-x,w.maxX+x,w.maxY+x),A=Zu(e.cameraQueryGeometry),M=this.grid3D.query(A.minX-x,A.minY-x,A.maxX+x,A.maxY+x,(U,ee,oe,Y)=>function(re,fe,de,Be,Ue){for(const Ae of re)if(fe<=Ae.x&&de<=Ae.y&&Be>=Ae.x&&Ue>=Ae.y)return!0;const Pe=[new We(fe,de),new We(fe,Ue),new We(Be,Ue),new We(Be,de)];if(re.length>2){for(const Ae of Pe)if(Zo(re,Ae))return!0}for(let Ae=0;Ae<re.length-1;Ae++)if(Lh(re[Ae],re[Ae+1],Pe))return!0;return!1}(e.cameraQueryGeometry,U-x,ee-x,oe+x,Y+x));for(const U of M)E.push(U);E.sort(ad);const z={};let V;for(let U=0;U<E.length;U++){const ee=E[U];if(ee===V)continue;V=ee;const oe=this.featureIndexArray.get(ee);let Y=null;this.loadMatchingFeature(z,oe.bucketIndex,oe.sourceLayerIndex,oe.featureIndex,m,h.layers,h.availableImages,r,o,c,(re,fe,de)=>(Y||(Y=mo(re)),fe.queryIntersectsFeature(g,re,de,Y,this.z,e.transform,d,e.pixelPosMatrix)))}return z}loadMatchingFeature(e,r,o,c,h,d,m,g,x,w,E){const A=this.bucketLayerIDs[r];if(d&&!function(U,ee){for(let oe=0;oe<U.length;oe++)if(ee.indexOf(U[oe])>=0)return!0;return!1}(d,A))return;const M=this.sourceLayerCoder.decode(o),z=this.vtLayers[M].feature(c);if(h.needGeometry){const U=go(z,!0);if(!h.filter(new Rt(this.tileID.overscaledZ),U,this.tileID.canonical))return}else if(!h.filter(new Rt(this.tileID.overscaledZ),z))return;const V=this.getId(z,M);for(let U=0;U<A.length;U++){const ee=A[U];if(d&&d.indexOf(ee)<0)continue;const oe=g[ee];if(!oe)continue;let Y={};V&&w&&(Y=w.getState(oe.sourceLayer||"_geojsonTileLayer",V));const re=nt({},x[ee]);re.paint=qu(re.paint,oe.paint,z,Y,m),re.layout=qu(re.layout,oe.layout,z,Y,m);const fe=!E||E(z,oe,Y);if(!fe)continue;const de=new Nu(z,this.z,this.x,this.y,V);de.layer=re;let Be=e[ee];Be===void 0&&(Be=e[ee]=[]),Be.push({featureIndex:c,feature:de,intersectionZ:fe})}}lookupSymbolFeatures(e,r,o,c,h,d,m,g){const x={};this.loadVTLayers();const w=Fo(h);for(const E of e)this.loadMatchingFeature(x,o,c,E,w,d,m,g,r);return x}hasLayer(e){for(const r of this.bucketLayerIDs)for(const o of r)if(e===o)return!0;return!1}getId(e,r){let o=e.id;return this.promoteId&&(o=e.properties[typeof this.promoteId=="string"?this.promoteId:this.promoteId[r]],typeof o=="boolean"&&(o=Number(o))),o}}function qu(i,e,r,o,c){return Mt(i,(h,d)=>{const m=e instanceof po?e.get(d):null;return m&&m.evaluate?m.evaluate(r,o,c):m})}function Zu(i){let e=1/0,r=1/0,o=-1/0,c=-1/0;for(const h of i)e=Math.min(e,h.x),r=Math.min(r,h.y),o=Math.max(o,h.x),c=Math.max(c,h.y);return{minX:e,minY:r,maxX:o,maxY:c}}function ad(i,e){return e-i}var pc;Fe("FeatureIndex",Gu,{omit:["rawTileData","sourceLayerCoder"]}),l.PerformanceMarkers=void 0,(pc=l.PerformanceMarkers||(l.PerformanceMarkers={})).create="create",pc.load="load",pc.fullLoad="fullLoad";let al=null,Ws=[];const dc=1e3/30,ld={mark(i){performance.mark(i)},frame(i){const e=i;al!=null&&Ws.push(e-al),al=e},clearMetrics(){al=null,Ws=[],performance.clearMeasures("loadTime"),performance.clearMeasures("fullLoadTime");for(const i in l.PerformanceMarkers)performance.clearMarks(l.PerformanceMarkers[i])},getPerformanceMetrics(){performance.measure("loadTime",l.PerformanceMarkers.create,l.PerformanceMarkers.load),performance.measure("fullLoadTime",l.PerformanceMarkers.create,l.PerformanceMarkers.fullLoad);const i=performance.getEntriesByName("loadTime")[0].duration,e=performance.getEntriesByName("fullLoadTime")[0].duration,r=Ws.length,o=1/(Ws.reduce((h,d)=>h+d,0)/r/1e3),c=Ws.filter(h=>h>dc).reduce((h,d)=>h+(d-dc)/dc,0);return{loadTime:i,fullLoadTime:e,fps:o,percentDroppedFrames:c/(r+c)*100}}};l.AJAXError=Si,l.ARRAY_TYPE=Ti,l.Actor=class{constructor(i,e,r){this.target=i,this.parent=e,this.mapId=r,this.callbacks={},this.tasks={},this.taskQueue=[],this.cancelCallbacks={},Ut(["receive","process"],this),this.invoker=new sd(this.process),this.target.addEventListener("message",this.receive,!1),this.globalScope=fi()?i:window}send(i,e,r,o,c=!1){const h=Math.round(1e18*Math.random()).toString(36).substring(0,10);r&&(this.callbacks[h]=r);const d=un(this.globalScope)?void 0:[];return this.target.postMessage({id:h,type:i,hasCallback:!!r,targetMapId:o,mustQueue:c,sourceMapId:this.mapId,data:Yr(e,d)},d),{cancel:()=>{r&&delete this.callbacks[h],this.target.postMessage({id:h,type:"<cancel>",targetMapId:o,sourceMapId:this.mapId})}}}receive(i){const e=i.data,r=e.id;if(r&&(!e.targetMapId||this.mapId===e.targetMapId))if(e.type==="<cancel>"){delete this.tasks[r];const o=this.cancelCallbacks[r];delete this.cancelCallbacks[r],o&&o()}else fi()||e.mustQueue?(this.tasks[r]=e,this.taskQueue.push(r),this.invoker.trigger()):this.processTask(r,e)}process(){if(!this.taskQueue.length)return;const i=this.taskQueue.shift(),e=this.tasks[i];delete this.tasks[i],this.taskQueue.length&&this.invoker.trigger(),e&&this.processTask(i,e)}processTask(i,e){if(e.type==="<response>"){const r=this.callbacks[i];delete this.callbacks[i],r&&(e.error?r(Rr(e.error)):r(null,Rr(e.data)))}else{let r=!1;const o=un(this.globalScope)?void 0:[],c=e.hasCallback?(m,g)=>{r=!0,delete this.cancelCallbacks[i],this.target.postMessage({id:i,type:"<response>",sourceMapId:this.mapId,error:m?Yr(m):null,data:Yr(g,o)},o)}:m=>{r=!0};let h=null;const d=Rr(e.data);if(this.parent[e.type])h=this.parent[e.type](e.sourceMapId,d,c);else if(this.parent.getWorkerSource){const m=e.type.split(".");h=this.parent.getWorkerSource(e.sourceMapId,m[0],d.source)[m[1]](d,c)}else c(new Error(`Could not find function ${e.type}`));!r&&h&&h.cancel&&(this.cancelCallbacks[i]=h.cancel)}}remove(){this.invoker.remove(),this.target.removeEventListener("message",this.receive,!1)}},l.AlphaImage=Os,l.CanonicalTileID=hc,l.CollisionBoxArray=ue,l.CollisionCircleLayoutArray=class extends T{},l.Color=D,l.DEMData=$u,l.DataConstantProperty=Ve,l.DictionaryCoder=Vu,l.EXTENT=Kt,l.ErrorEvent=_n,l.EvaluationParameters=Rt,l.Event=fr,l.Evented=mr,l.FeatureIndex=Gu,l.FillBucket=Wl,l.FillExtrusionBucket=Kl,l.GeoJSONFeature=Nu,l.ImageAtlas=du,l.ImagePosition=ec,l.LineBucket=Jl,l.LineStripIndexArray=class extends O{},l.LngLat=Nt,l.LngLatBounds=yo,l.MercatorCoordinate=sl,l.ONE_EM=ai,l.OverscaledTileID=Ki,l.PerformanceUtils=ld,l.PosArray=Ge,l.Properties=si,l.QuadTriangleArray=class extends C{},l.RGBAImage=Hi,l.RasterBoundsArray=class extends a{},l.RequestPerformance=class{constructor(i){this._marks={start:[i.url,"start"].join("#"),end:[i.url,"end"].join("#"),measure:i.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let i=performance.getEntriesByName(this._marks.measure);return i.length===0&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),i=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),i}},l.ResourceType=pr,l.SegmentVector=ot,l.SymbolBucket=Yo,l.Transitionable=Ba,l.TriangleIndexArray=bi,l.Uniform1f=rn,l.Uniform1i=class extends tn{constructor(i,e){super(i,e),this.current=0}set(i){this.current!==i&&(this.current=i,this.gl.uniform1i(this.location,i))}},l.Uniform2f=class extends tn{constructor(i,e){super(i,e),this.current=[0,0]}set(i){i[0]===this.current[0]&&i[1]===this.current[1]||(this.current=i,this.gl.uniform2f(this.location,i[0],i[1]))}},l.Uniform3f=class extends tn{constructor(i,e){super(i,e),this.current=[0,0,0]}set(i){i[0]===this.current[0]&&i[1]===this.current[1]&&i[2]===this.current[2]||(this.current=i,this.gl.uniform3f(this.location,i[0],i[1],i[2]))}},l.Uniform4f=Go,l.UniformColor=Mc,l.UniformMatrix4f=class extends tn{constructor(i,e){super(i,e),this.current=Mh}set(i){if(i[12]!==this.current[12]||i[0]!==this.current[0])return this.current=i,void this.gl.uniformMatrix4fv(this.location,!1,i);for(let e=1;e<16;e++)if(i[e]!==this.current[e]){this.current=i,this.gl.uniformMatrix4fv(this.location,!1,i);break}}},l.UnwrappedTileID=Uu,l.ValidationError=Ce,l.ZoomHistory=Ts,l.add=function(i,e,r){return i[0]=e[0]+r[0],i[1]=e[1]+r[1],i[2]=e[2]+r[2],i},l.addDynamicAttributes=oc,l.asyncAll=function(i,e,r){if(!i.length)return r(null,[]);let o=i.length;const c=new Array(i.length);let h=null;i.forEach((d,m)=>{e(d,(g,x)=>{g&&(h=g),c[m]=x,--o==0&&r(h,c)})})},l.bezier=Ee,l.bindAll=Ut,l.cacheEntryPossiblyAdded=function(i){Qi++,Qi>pn&&(i.getActor().send("enforceCacheSizeLimit",hn),Qi=0)},l.clamp=se,l.clearTileCache=function(i){const e=caches.delete(qi);i&&e.catch(i).then(()=>i())},l.clipLine=Su,l.clone=function(i){var e=new Ti(16);return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],e},l.clone$1=vt,l.clone$2=function(i){var e=new Ti(3);return e[0]=i[0],e[1]=i[1],e[2]=i[2],e},l.collisionCircleLayout=Ip,l.config=hr,l.copy=function(i,e){return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[4]=e[4],i[5]=e[5],i[6]=e[6],i[7]=e[7],i[8]=e[8],i[9]=e[9],i[10]=e[10],i[11]=e[11],i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15],i},l.create=function(){var i=new Ti(16);return Ti!=Float32Array&&(i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[11]=0,i[12]=0,i[13]=0,i[14]=0),i[0]=1,i[5]=1,i[10]=1,i[15]=1,i},l.create$1=Fc,l.createExpression=Yn,l.createFilter=Fo,l.createLayout=Zt,l.createStyleLayer=function(i){return i.type==="custom"?new nd(i):new od[i.type](i)},l.cross=function(i,e,r){var o=e[0],c=e[1],h=e[2],d=r[0],m=r[1],g=r[2];return i[0]=c*g-h*m,i[1]=h*d-o*g,i[2]=o*m-c*d,i},l.dot=function(i,e){return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]},l.dot$1=function(i,e){return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]+i[3]*e[3]},l.ease=Te,l.emitValidationErrors=Uo,l.enforceCacheSizeLimit=function(i){dn(),Zi&&Zi.then(e=>{e.keys().then(r=>{for(let o=0;o<r.length-i;o++)e.delete(r[o])})})},l.equals=function(i,e){var r=i[0],o=i[1],c=i[2],h=i[3],d=i[4],m=i[5],g=i[6],x=i[7],w=i[8],E=i[9],A=i[10],M=i[11],z=i[12],V=i[13],U=i[14],ee=i[15],oe=e[0],Y=e[1],re=e[2],fe=e[3],de=e[4],Be=e[5],Ue=e[6],Pe=e[7],Ae=e[8],we=e[9],ke=e[10],Me=e[11],be=e[12],qe=e[13],Ne=e[14],rt=e[15];return Math.abs(r-oe)<=wi*Math.max(1,Math.abs(r),Math.abs(oe))&&Math.abs(o-Y)<=wi*Math.max(1,Math.abs(o),Math.abs(Y))&&Math.abs(c-re)<=wi*Math.max(1,Math.abs(c),Math.abs(re))&&Math.abs(h-fe)<=wi*Math.max(1,Math.abs(h),Math.abs(fe))&&Math.abs(d-de)<=wi*Math.max(1,Math.abs(d),Math.abs(de))&&Math.abs(m-Be)<=wi*Math.max(1,Math.abs(m),Math.abs(Be))&&Math.abs(g-Ue)<=wi*Math.max(1,Math.abs(g),Math.abs(Ue))&&Math.abs(x-Pe)<=wi*Math.max(1,Math.abs(x),Math.abs(Pe))&&Math.abs(w-Ae)<=wi*Math.max(1,Math.abs(w),Math.abs(Ae))&&Math.abs(E-we)<=wi*Math.max(1,Math.abs(E),Math.abs(we))&&Math.abs(A-ke)<=wi*Math.max(1,Math.abs(A),Math.abs(ke))&&Math.abs(M-Me)<=wi*Math.max(1,Math.abs(M),Math.abs(Me))&&Math.abs(z-be)<=wi*Math.max(1,Math.abs(z),Math.abs(be))&&Math.abs(V-qe)<=wi*Math.max(1,Math.abs(V),Math.abs(qe))&&Math.abs(U-Ne)<=wi*Math.max(1,Math.abs(U),Math.abs(Ne))&&Math.abs(ee-rt)<=wi*Math.max(1,Math.abs(ee),Math.abs(rt))},l.evaluateSizeForFeature=function(i,{uSize:e,uSizeT:r},{lowerSize:o,upperSize:c}){return i.kind==="source"?o/sn:i.kind==="composite"?Dt(o/sn,c/sn,r):e},l.evaluateSizeForZoom=function(i,e){let r=0,o=0;if(i.kind==="constant")o=i.layoutSize;else if(i.kind!=="source"){const{interpolationType:c,minZoom:h,maxZoom:d}=i,m=c?se(Ci.interpolationFactor(c,e,h,d),0,1):0;i.kind==="camera"?o=Dt(i.minSize,i.maxSize,m):r=m}return{uSizeT:r,uSize:o}},l.evaluateVariableOffset=Cu,l.evented=zs,l.exported=Sr,l.exported$1=Ir,l.extend=nt,l.filterObject=ct,l.fromRotation=function(i,e){var r=Math.sin(e),o=Math.cos(e);return i[0]=o,i[1]=r,i[2]=0,i[3]=-r,i[4]=o,i[5]=0,i[6]=0,i[7]=0,i[8]=1,i},l.fromScaling=function(i,e){return i[0]=e[0],i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=e[1],i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=e[2],i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i},l.getAnchorAlignment=ic,l.getAnchorJustification=nc,l.getArrayBuffer=gn,l.getImage=Pr,l.getJSON=function(i,e){return mn(nt(i,{type:"json"}),e)},l.getOverlapMode=cc,l.getRTLTextPluginStatus=uo,l.getReferrer=Vn,l.getVideo=function(i,e){const r=window.document.createElement("video");r.muted=!0,r.onloadstart=function(){e(null,r)};for(let o=0;o<i.length;o++){const c=window.document.createElement("source");Nn(i[o])||(r.crossOrigin="Anonymous"),c.src=i[o],r.appendChild(c)}return{cancel:()=>{}}},l.identity=Ul,l.invert=function(i,e){var r=e[0],o=e[1],c=e[2],h=e[3],d=e[4],m=e[5],g=e[6],x=e[7],w=e[8],E=e[9],A=e[10],M=e[11],z=e[12],V=e[13],U=e[14],ee=e[15],oe=r*m-o*d,Y=r*g-c*d,re=r*x-h*d,fe=o*g-c*m,de=o*x-h*m,Be=c*x-h*g,Ue=w*V-E*z,Pe=w*U-A*z,Ae=w*ee-M*z,we=E*U-A*V,ke=E*ee-M*V,Me=A*ee-M*U,be=oe*Me-Y*ke+re*we+fe*Ae-de*Pe+Be*Ue;return be?(i[0]=(m*Me-g*ke+x*we)*(be=1/be),i[1]=(c*ke-o*Me-h*we)*be,i[2]=(V*Be-U*de+ee*fe)*be,i[3]=(A*de-E*Be-M*fe)*be,i[4]=(g*Ae-d*Me-x*Pe)*be,i[5]=(r*Me-c*Ae+h*Pe)*be,i[6]=(U*re-z*Be-ee*Y)*be,i[7]=(w*Be-A*re+M*Y)*be,i[8]=(d*ke-m*Ae+x*Ue)*be,i[9]=(o*Ae-r*ke-h*Ue)*be,i[10]=(z*de-V*re+ee*oe)*be,i[11]=(E*re-w*de-M*oe)*be,i[12]=(m*Pe-d*we-g*Ue)*be,i[13]=(r*we-o*Pe+c*Ue)*be,i[14]=(V*Y-z*fe-U*oe)*be,i[15]=(w*fe-E*Y+A*oe)*be,i):null},l.isImageBitmap=Er,l.isSafari=un,l.isWorker=fi,l.keysDifference=function(i,e){const r=[];for(const o in i)o in e||r.push(o);return r},l.lazyLoadRTLTextPlugin=function(){Ui.isLoading()||Ui.isLoaded()||uo()!=="deferred"||Ra()},l.makeRequest=mn,l.mapObject=Mt,l.mercatorXfromLng=Ru,l.mercatorYfromLat=Bu,l.mercatorZfromAltitude=Fu,l.mul=Fh,l.mul$1=function(i,e,r){return i[0]=e[0]*r[0],i[1]=e[1]*r[1],i[2]=e[2]*r[2],i[3]=e[3]*r[3],i},l.multiply=Oc,l.nextPowerOfTwo=function(i){return i<=1?1:Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))},l.normalize=function(i,e){var r=e[0],o=e[1],c=e[2],h=r*r+o*o+c*c;return h>0&&(h=1/Math.sqrt(h)),i[0]=e[0]*h,i[1]=e[1]*h,i[2]=e[2]*h,i},l.number=Dt,l.ortho=function(i,e,r,o,c,h,d){var m=1/(e-r),g=1/(o-c),x=1/(h-d);return i[0]=-2*m,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=-2*g,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=2*x,i[11]=0,i[12]=(e+r)*m,i[13]=(c+o)*g,i[14]=(d+h)*x,i[15]=1,i},l.parseCacheControl=wo,l.parseGlyphPbf=function(i){return new Yl(i).readFields(Fp,[])},l.pbf=Yl,l.performSymbolLayout=function(i){i.bucket.createArrays(),i.bucket.tilePixelRatio=Kt/(512*i.bucket.overscaling),i.bucket.compareText={},i.bucket.iconsNeedLinear=!1;const e=i.bucket.layers[0].layout,r=i.bucket.layers[0]._unevaluatedLayout._values,o={layoutIconSize:r["icon-size"].possiblyEvaluate(new Rt(i.bucket.zoom+1),i.canonical),layoutTextSize:r["text-size"].possiblyEvaluate(new Rt(i.bucket.zoom+1),i.canonical),textMaxSize:r["text-size"].possiblyEvaluate(new Rt(18))};if(i.bucket.textSizeData.kind==="composite"){const{minZoom:g,maxZoom:x}=i.bucket.textSizeData;o.compositeTextSizes=[r["text-size"].possiblyEvaluate(new Rt(g),i.canonical),r["text-size"].possiblyEvaluate(new Rt(x),i.canonical)]}if(i.bucket.iconSizeData.kind==="composite"){const{minZoom:g,maxZoom:x}=i.bucket.iconSizeData;o.compositeIconSizes=[r["icon-size"].possiblyEvaluate(new Rt(g),i.canonical),r["icon-size"].possiblyEvaluate(new Rt(x),i.canonical)]}const c=e.get("text-line-height")*ai,h=e.get("text-rotation-alignment")!=="viewport"&&e.get("symbol-placement")!=="point",d=e.get("text-keep-upright"),m=e.get("text-size");for(const g of i.bucket.features){const x=e.get("text-font").evaluate(g,{},i.canonical).join(","),w=m.evaluate(g,{},i.canonical),E=o.layoutTextSize.evaluate(g,{},i.canonical),A=o.layoutIconSize.evaluate(g,{},i.canonical),M={horizontal:{},vertical:void 0},z=g.text;let V,U=[0,0];if(z){const Y=z.toString(),re=e.get("text-letter-spacing").evaluate(g,{},i.canonical)*ai,fe=Pl(Y)?re:0,de=e.get("text-anchor").evaluate(g,{},i.canonical),Be=e.get("text-variable-anchor");if(!Be){const ke=e.get("text-radial-offset").evaluate(g,{},i.canonical);U=ke?Cu(de,[ke*ai,rc]):e.get("text-offset").evaluate(g,{},i.canonical).map(Me=>Me*ai)}let Ue=h?"center":e.get("text-justify").evaluate(g,{},i.canonical);const Pe=e.get("symbol-placement"),Ae=Pe==="point"?e.get("text-max-width").evaluate(g,{},i.canonical)*ai:0,we=()=>{i.bucket.allowVerticalPlacement&&$o(Y)&&(M.vertical=Ya(z,i.glyphMap,i.glyphPositions,i.imagePositions,x,Ae,c,de,"left",fe,U,l.WritingMode.vertical,!0,Pe,E,w))};if(!h&&Be){const ke=Ue==="auto"?Be.map(be=>nc(be)):[Ue];let Me=!1;for(let be=0;be<ke.length;be++){const qe=ke[be];if(!M.horizontal[qe])if(Me)M.horizontal[qe]=M.horizontal[0];else{const Ne=Ya(z,i.glyphMap,i.glyphPositions,i.imagePositions,x,Ae,c,"center",qe,fe,U,l.WritingMode.horizontal,!1,Pe,E,w);Ne&&(M.horizontal[qe]=Ne,Me=Ne.positionedLines.length===1)}}we()}else{Ue==="auto"&&(Ue=nc(de));const ke=Ya(z,i.glyphMap,i.glyphPositions,i.imagePositions,x,Ae,c,de,Ue,fe,U,l.WritingMode.horizontal,!1,Pe,E,w);ke&&(M.horizontal[Ue]=ke),we(),$o(Y)&&h&&d&&(M.vertical=Ya(z,i.glyphMap,i.glyphPositions,i.imagePositions,x,Ae,c,de,Ue,fe,U,l.WritingMode.vertical,!1,Pe,E,w))}}let ee=!1;if(g.icon&&g.icon.name){const Y=i.imageMap[g.icon.name];Y&&(V=Gp(i.imagePositions[g.icon.name],e.get("icon-offset").evaluate(g,{},i.canonical),e.get("icon-anchor").evaluate(g,{},i.canonical)),ee=!!Y.sdf,i.bucket.sdfIcons===void 0?i.bucket.sdfIcons=ee:i.bucket.sdfIcons!==ee&&$t("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(Y.pixelRatio!==i.bucket.pixelRatio||e.get("icon-rotate").constantOr(1)!==0)&&(i.bucket.iconsNeedLinear=!0))}const oe=zu(M.horizontal)||M.vertical;i.bucket.iconsInText=!!oe&&oe.iconsInText,(oe||V)&&Kp(i.bucket,g,M,V,i.imageMap,o,E,A,U,ee,i.canonical)}i.showCollisionBoxes&&i.bucket.generateCollisionDebugBuffers()},l.perspective=function(i,e,r,o,c){var h,d=1/Math.tan(e/2);return i[0]=d/r,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=d,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[11]=-1,i[12]=0,i[13]=0,i[15]=0,c!=null&&c!==1/0?(i[10]=(c+o)*(h=1/(o-c)),i[14]=2*c*o*h):(i[10]=-1,i[14]=-2*o),i},l.pick=function(i,e){const r={};for(let o=0;o<e.length;o++){const c=e[o];c in i&&(r[c]=i[c])}return r},l.plugin=Ui,l.pointGeometry=We,l.polygonIntersectsPolygon=Dc,l.potpack=pu,l.refProperties=["type","source","source-layer","minzoom","maxzoom","filter","layout"],l.register=Fe,l.registerForPluginStateChange=function(i){return i({pluginStatus:vi,pluginURL:Br}),zs.on("pluginStateChange",i),i},l.renderColorRamp=Zc,l.rotateX=function(i,e,r){var o=Math.sin(r),c=Math.cos(r),h=e[4],d=e[5],m=e[6],g=e[7],x=e[8],w=e[9],E=e[10],A=e[11];return e!==i&&(i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15]),i[4]=h*c+x*o,i[5]=d*c+w*o,i[6]=m*c+E*o,i[7]=g*c+A*o,i[8]=x*c-h*o,i[9]=w*c-d*o,i[10]=E*c-m*o,i[11]=A*c-g*o,i},l.rotateZ=function(i,e,r){var o=Math.sin(r),c=Math.cos(r),h=e[0],d=e[1],m=e[2],g=e[3],x=e[4],w=e[5],E=e[6],A=e[7];return e!==i&&(i[8]=e[8],i[9]=e[9],i[10]=e[10],i[11]=e[11],i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15]),i[0]=h*c+x*o,i[1]=d*c+w*o,i[2]=m*c+E*o,i[3]=g*c+A*o,i[4]=x*c-h*o,i[5]=w*c-d*o,i[6]=E*c-m*o,i[7]=A*c-g*o,i},l.scale=function(i,e,r){var o=r[0],c=r[1],h=r[2];return i[0]=e[0]*o,i[1]=e[1]*o,i[2]=e[2]*o,i[3]=e[3]*o,i[4]=e[4]*c,i[5]=e[5]*c,i[6]=e[6]*c,i[7]=e[7]*c,i[8]=e[8]*h,i[9]=e[9]*h,i[10]=e[10]*h,i[11]=e[11]*h,i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15],i},l.scale$1=function(i,e,r){return i[0]=e[0]*r,i[1]=e[1]*r,i[2]=e[2]*r,i},l.setCacheLimits=function(i,e){hn=i,pn=e},l.setRTLTextPlugin=function(i,e,r=!1){if(vi===Is||vi===As||vi===Cs)throw new Error("setRTLTextPlugin cannot be called multiple times.");Br=Sr.resolveURL(i),vi=Is,Ms=e,Pn(),r||Ra()},l.spec=pe,l.sphericalToCartesian=function([i,e,r]){return e+=90,e*=Math.PI/180,r*=Math.PI/180,{x:i*Math.cos(e)*Math.sin(r),y:i*Math.sin(e)*Math.sin(r),z:i*Math.cos(r)}},l.sqrLen=function(i){var e=i[0],r=i[1];return e*e+r*r},l.sub=function(i,e,r){return i[0]=e[0]-r[0],i[1]=e[1]-r[1],i[2]=e[2]-r[2],i},l.toEvaluationFeature=go,l.transformMat3=function(i,e,r){var o=e[0],c=e[1],h=e[2];return i[0]=o*r[0]+c*r[3]+h*r[6],i[1]=o*r[1]+c*r[4]+h*r[7],i[2]=o*r[2]+c*r[5]+h*r[8],i},l.transformMat4=qa,l.transformMat4$1=function(i,e,r){var o=e[0],c=e[1];return i[0]=r[0]*o+r[4]*c+r[12],i[1]=r[1]*o+r[5]*c+r[13],i},l.translate=function(i,e,r){var o,c,h,d,m,g,x,w,E,A,M,z,V=r[0],U=r[1],ee=r[2];return e===i?(i[12]=e[0]*V+e[4]*U+e[8]*ee+e[12],i[13]=e[1]*V+e[5]*U+e[9]*ee+e[13],i[14]=e[2]*V+e[6]*U+e[10]*ee+e[14],i[15]=e[3]*V+e[7]*U+e[11]*ee+e[15]):(c=e[1],h=e[2],d=e[3],m=e[4],g=e[5],x=e[6],w=e[7],E=e[8],A=e[9],M=e[10],z=e[11],i[0]=o=e[0],i[1]=c,i[2]=h,i[3]=d,i[4]=m,i[5]=g,i[6]=x,i[7]=w,i[8]=E,i[9]=A,i[10]=M,i[11]=z,i[12]=o*V+m*U+E*ee+e[12],i[13]=c*V+g*U+A*ee+e[13],i[14]=h*V+x*U+M*ee+e[14],i[15]=d*V+w*U+z*ee+e[15]),i},l.triggerPluginCompletionEvent=La,l.unicodeBlockLookup=ze,l.uniqueId=function(){return He++},l.validateCustomStyleLayer=function(i){const e=[],r=i.id;return r===void 0&&e.push({message:`layers.${r}: missing required property "id"`}),i.render===void 0&&e.push({message:`layers.${r}: missing required method "render"`}),i.renderingMode&&i.renderingMode!=="2d"&&i.renderingMode!=="3d"&&e.push({message:`layers.${r}: property "renderingMode" must be either "2d" or "3d"`}),e},l.validateLight=ws,l.validateStyle=lo,l.vectorTile=Rn,l.warnOnce=$t,l.wrap=gt}),Q(["./shared"],function(l){function ve(L){const b=typeof L;if(b==="number"||b==="boolean"||b==="string"||L==null)return JSON.stringify(L);if(Array.isArray(L)){let D="[";for(const G of L)D+=`${ve(G)},`;return`${D}]`}const S=Object.keys(L).sort();let k="{";for(let D=0;D<S.length;D++)k+=`${JSON.stringify(S[D])}:${ve(L[S[D]])},`;return`${k}}`}function me(L){let b="";for(const S of l.refProperties)b+=`/${ve(L[S])}`;return b}class Ee{constructor(b){this.keyCache={},b&&this.replace(b)}replace(b){this._layerConfigs={},this._layers={},this.update(b,[])}update(b,S){for(const D of b){this._layerConfigs[D.id]=D;const G=this._layers[D.id]=l.createStyleLayer(D);G._featureFilter=l.createFilter(G.filter),this.keyCache[D.id]&&delete this.keyCache[D.id]}for(const D of S)delete this.keyCache[D],delete this._layerConfigs[D],delete this._layers[D];this.familiesBySource={};const k=function(D,G){const H={};for(let q=0;q<D.length;q++){const K=G&&G[D[q].id]||me(D[q]);G&&(G[D[q].id]=K);let le=H[K];le||(le=H[K]=[]),le.push(D[q])}const Z=[];for(const q in H)Z.push(H[q]);return Z}(Object.values(this._layerConfigs),this.keyCache);for(const D of k){const G=D.map(_e=>this._layers[_e.id]),H=G[0];if(H.visibility==="none")continue;const Z=H.source||"";let q=this.familiesBySource[Z];q||(q=this.familiesBySource[Z]={});const K=H.sourceLayer||"_geojsonTileLayer";let le=q[K];le||(le=q[K]=[]),le.push(G)}}}class Te{constructor(b){const S={},k=[];for(const Z in b){const q=b[Z],K=S[Z]={};for(const le in q){const _e=q[+le];if(!_e||_e.bitmap.width===0||_e.bitmap.height===0)continue;const ae={x:0,y:0,w:_e.bitmap.width+2,h:_e.bitmap.height+2};k.push(ae),K[le]={rect:ae,metrics:_e.metrics}}}const{w:D,h:G}=l.potpack(k),H=new l.AlphaImage({width:D||1,height:G||1});for(const Z in b){const q=b[Z];for(const K in q){const le=q[+K];if(!le||le.bitmap.width===0||le.bitmap.height===0)continue;const _e=S[Z][K].rect;l.AlphaImage.copy(le.bitmap,H,{x:0,y:0},{x:_e.x+1,y:_e.y+1},le.bitmap)}}this.image=H,this.positions=S}}l.register("GlyphAtlas",Te);class se{constructor(b){this.tileID=new l.OverscaledTileID(b.tileID.overscaledZ,b.tileID.wrap,b.tileID.canonical.z,b.tileID.canonical.x,b.tileID.canonical.y),this.uid=b.uid,this.zoom=b.zoom,this.pixelRatio=b.pixelRatio,this.tileSize=b.tileSize,this.source=b.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=b.showCollisionBoxes,this.collectResourceTiming=!!b.collectResourceTiming,this.returnDependencies=!!b.returnDependencies,this.promoteId=b.promoteId}parse(b,S,k,D,G){this.status="parsing",this.data=b,this.collisionBoxArray=new l.CollisionBoxArray;const H=new l.DictionaryCoder(Object.keys(b.layers).sort()),Z=new l.FeatureIndex(this.tileID,this.promoteId);Z.bucketLayerIDs=[];const q={},K={featureIndex:Z,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:k},le=S.familiesBySource[this.source];for(const Ke in le){const tt=b.layers[Ke];if(!tt)continue;tt.version===1&&l.warnOnce(`Vector tile source "${this.source}" layer "${Ke}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const ft=H.encode(Ke),St=[];for(let Qt=0;Qt<tt.length;Qt++){const kt=tt.feature(Qt),li=Z.getId(kt,Ke);St.push({feature:kt,id:li,index:Qt,sourceLayerIndex:ft})}for(const Qt of le[Ke]){const kt=Qt[0];kt.source!==this.source&&l.warnOnce(`layer.source = ${kt.source} does not equal this.source = ${this.source}`),kt.minzoom&&this.zoom<Math.floor(kt.minzoom)||kt.maxzoom&&this.zoom>=kt.maxzoom||kt.visibility!=="none"&&(gt(Qt,this.zoom,k),(q[kt.id]=kt.createBucket({index:Z.bucketLayerIDs.length,layers:Qt,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:ft,sourceID:this.source})).populate(St,K,this.tileID.canonical),Z.bucketLayerIDs.push(Qt.map(li=>li.id)))}}let _e,ae,Oe,$e;const De=l.mapObject(K.glyphDependencies,Ke=>Object.keys(Ke).map(Number));Object.keys(De).length?D.send("getGlyphs",{uid:this.uid,stacks:De},(Ke,tt)=>{_e||(_e=Ke,ae=tt,dt.call(this))}):ae={};const Ze=Object.keys(K.iconDependencies);Ze.length?D.send("getImages",{icons:Ze,source:this.source,tileID:this.tileID,type:"icons"},(Ke,tt)=>{_e||(_e=Ke,Oe=tt,dt.call(this))}):Oe={};const Xe=Object.keys(K.patternDependencies);function dt(){if(_e)return G(_e);if(ae&&Oe&&$e){const Ke=new Te(ae),tt=new l.ImageAtlas(Oe,$e);for(const ft in q){const St=q[ft];St instanceof l.SymbolBucket?(gt(St.layers,this.zoom,k),l.performSymbolLayout({bucket:St,glyphMap:ae,glyphPositions:Ke.positions,imageMap:Oe,imagePositions:tt.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):St.hasPattern&&(St instanceof l.LineBucket||St instanceof l.FillBucket||St instanceof l.FillExtrusionBucket)&&(gt(St.layers,this.zoom,k),St.addFeatures(K,this.tileID.canonical,tt.patternPositions))}this.status="done",G(null,{buckets:Object.values(q).filter(ft=>!ft.isEmpty()),featureIndex:Z,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:Ke.image,imageAtlas:tt,glyphMap:this.returnDependencies?ae:null,iconMap:this.returnDependencies?Oe:null,glyphPositions:this.returnDependencies?Ke.positions:null})}}Xe.length?D.send("getImages",{icons:Xe,source:this.source,tileID:this.tileID,type:"patterns"},(Ke,tt)=>{_e||(_e=Ke,$e=tt,dt.call(this))}):$e={},dt.call(this)}}function gt(L,b,S){const k=new l.EvaluationParameters(b);for(const D of L)D.recalculate(k,S)}function nt(L,b){const S=l.getArrayBuffer(L.request,(k,D,G,H)=>{k?b(k):D&&b(null,{vectorTile:new l.vectorTile.VectorTile(new l.pbf(D)),rawData:D,cacheControl:G,expires:H})});return()=>{S.cancel(),b()}}class He{constructor(b,S,k,D){this.actor=b,this.layerIndex=S,this.availableImages=k,this.loadVectorData=D||nt,this.loading={},this.loaded={}}loadTile(b,S){const k=b.uid;this.loading||(this.loading={});const D=!!(b&&b.request&&b.request.collectResourceTiming)&&new l.RequestPerformance(b.request),G=this.loading[k]=new se(b);G.abort=this.loadVectorData(b,(H,Z)=>{if(delete this.loading[k],H||!Z)return G.status="done",this.loaded[k]=G,S(H);const q=Z.rawData,K={};Z.expires&&(K.expires=Z.expires),Z.cacheControl&&(K.cacheControl=Z.cacheControl);const le={};if(D){const _e=D.finish();_e&&(le.resourceTiming=JSON.parse(JSON.stringify(_e)))}G.vectorTile=Z.vectorTile,G.parse(Z.vectorTile,this.layerIndex,this.availableImages,this.actor,(_e,ae)=>{if(_e||!ae)return S(_e);S(null,l.extend({rawTileData:q.slice(0)},ae,K,le))}),this.loaded=this.loaded||{},this.loaded[k]=G})}reloadTile(b,S){const k=this.loaded,D=b.uid,G=this;if(k&&k[D]){const H=k[D];H.showCollisionBoxes=b.showCollisionBoxes;const Z=(q,K)=>{const le=H.reloadCallback;le&&(delete H.reloadCallback,H.parse(H.vectorTile,G.layerIndex,this.availableImages,G.actor,le)),S(q,K)};H.status==="parsing"?H.reloadCallback=Z:H.status==="done"&&(H.vectorTile?H.parse(H.vectorTile,this.layerIndex,this.availableImages,this.actor,Z):Z())}}abortTile(b,S){const k=this.loading,D=b.uid;k&&k[D]&&k[D].abort&&(k[D].abort(),delete k[D]),S()}removeTile(b,S){const k=this.loaded,D=b.uid;k&&k[D]&&delete k[D],S()}}class Ut{constructor(){this.loaded={}}loadTile(b,S){const{uid:k,encoding:D,rawImageData:G}=b,H=l.isImageBitmap(G)?this.getImageData(G):G,Z=new l.DEMData(k,H,D);this.loaded=this.loaded||{},this.loaded[k]=Z,S(null,Z)}getImageData(b){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(b.width,b.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d")),this.offscreenCanvas.width=b.width,this.offscreenCanvas.height=b.height,this.offscreenCanvasContext.drawImage(b,0,0,b.width,b.height);const S=this.offscreenCanvasContext.getImageData(-1,-1,b.width+2,b.height+2);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),new l.RGBAImage({width:S.width,height:S.height},S.data)}removeTile(b){const S=this.loaded,k=b.uid;S&&S[k]&&delete S[k]}}var Mt=function L(b,S){var k,D=b&&b.type;if(D==="FeatureCollection")for(k=0;k<b.features.length;k++)L(b.features[k],S);else if(D==="GeometryCollection")for(k=0;k<b.geometries.length;k++)L(b.geometries[k],S);else if(D==="Feature")L(b.geometry,S);else if(D==="Polygon")ct(b.coordinates,S);else if(D==="MultiPolygon")for(k=0;k<b.coordinates.length;k++)ct(b.coordinates[k],S);return b};function ct(L,b){if(L.length!==0){vt(L[0],b);for(var S=1;S<L.length;S++)vt(L[S],!b)}}function vt(L,b){for(var S=0,k=0,D=0,G=L.length,H=G-1;D<G;H=D++){var Z=(L[D][0]-L[H][0])*(L[H][1]+L[D][1]),q=S+Z;k+=Math.abs(S)>=Math.abs(Z)?S-q+Z:Z-q+S,S=q}S+k>=0!=!!b&&L.reverse()}const Wt=l.vectorTile.VectorTileFeature.prototype.toGeoJSON;class $t{constructor(b){this._feature=b,this.extent=l.EXTENT,this.type=b.type,this.properties=b.tags,"id"in b&&!isNaN(b.id)&&(this.id=parseInt(b.id,10))}loadGeometry(){if(this._feature.type===1){const b=[];for(const S of this._feature.geometry)b.push([new l.pointGeometry(S[0],S[1])]);return b}{const b=[];for(const S of this._feature.geometry){const k=[];for(const D of S)k.push(new l.pointGeometry(D[0],D[1]));b.push(k)}return b}}toGeoJSON(b,S,k){return Wt.call(this,b,S,k)}}class Gi{constructor(b){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=l.EXTENT,this.length=b.length,this._features=b}feature(b){return new $t(this._features[b])}}var Fi={exports:{}},fi=l.pointGeometry,wo=l.vectorTile.VectorTileFeature,lr=Gr;function Gr(L,b){this.options=b||{},this.features=L,this.length=L.length}function cr(L,b){this.id=typeof L.id=="number"?L.id:void 0,this.type=L.type,this.rawGeometry=L.type===1?[L.geometry]:L.geometry,this.properties=L.tags,this.extent=b||4096}Gr.prototype.feature=function(L){return new cr(this.features[L],this.options.extent)},cr.prototype.loadGeometry=function(){var L=this.rawGeometry;this.geometry=[];for(var b=0;b<L.length;b++){for(var S=L[b],k=[],D=0;D<S.length;D++)k.push(new fi(S[D][0],S[D][1]));this.geometry.push(k)}return this.geometry},cr.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var L=this.geometry,b=1/0,S=-1/0,k=1/0,D=-1/0,G=0;G<L.length;G++)for(var H=L[G],Z=0;Z<H.length;Z++){var q=H[Z];b=Math.min(b,q.x),S=Math.max(S,q.x),k=Math.min(k,q.y),D=Math.max(D,q.y)}return[b,k,S,D]},cr.prototype.toGeoJSON=wo.prototype.toGeoJSON;var un=l.pbf,Er=lr;function Sr(L){var b=new un;return function(S,k){for(var D in S.layers)k.writeMessage(3,We,S.layers[D])}(L,b),b.finish()}function We(L,b){var S;b.writeVarintField(15,L.version||1),b.writeStringField(1,L.name||""),b.writeVarintField(5,L.extent||4096);var k={keys:[],values:[],keycache:{},valuecache:{}};for(S=0;S<L.length;S++)k.feature=L.feature(S),b.writeMessage(2,ur,k);var D=k.keys;for(S=0;S<D.length;S++)b.writeStringField(3,D[S]);var G=k.values;for(S=0;S<G.length;S++)b.writeMessage(4,hn,G[S])}function ur(L,b){var S=L.feature;S.id!==void 0&&b.writeVarintField(1,S.id),b.writeMessage(2,hr,L),b.writeVarintField(3,S.type),b.writeMessage(4,qr,S)}function hr(L,b){var S=L.feature,k=L.keys,D=L.values,G=L.keycache,H=L.valuecache;for(var Z in S.properties){var q=S.properties[Z],K=G[Z];if(q!==null){K===void 0&&(k.push(Z),G[Z]=K=k.length-1),b.writeVarint(K);var le=typeof q;le!=="string"&&le!=="boolean"&&le!=="number"&&(q=JSON.stringify(q));var _e=le+":"+q,ae=H[_e];ae===void 0&&(D.push(q),H[_e]=ae=D.length-1),b.writeVarint(ae)}}}function qi(L,b){return(b<<3)+(7&L)}function Zi(L){return L<<1^L>>31}function qr(L,b){for(var S=L.loadGeometry(),k=L.type,D=0,G=0,H=S.length,Z=0;Z<H;Z++){var q=S[Z],K=1;k===1&&(K=q.length),b.writeVarint(qi(1,K));for(var le=k===3?q.length-1:q.length,_e=0;_e<le;_e++){_e===1&&k!==1&&b.writeVarint(qi(2,le-1));var ae=q[_e].x-D,Oe=q[_e].y-G;b.writeVarint(Zi(ae)),b.writeVarint(Zi(Oe)),D+=ae,G+=Oe}k===3&&b.writeVarint(qi(7,1))}}function hn(L,b){var S=typeof L;S==="string"?b.writeStringField(1,L):S==="boolean"?b.writeBooleanField(7,L):S==="number"&&(L%1!=0?b.writeDoubleField(3,L):L<0?b.writeSVarintField(6,L):b.writeVarintField(5,L))}function pn(L,b,S,k,D,G){if(D-k<=S)return;const H=k+D>>1;dn(L,b,H,k,D,G%2),pn(L,b,S,k,H-1,G+1),pn(L,b,S,H+1,D,G+1)}function dn(L,b,S,k,D,G){for(;D>k;){if(D-k>600){const K=D-k+1,le=S-k+1,_e=Math.log(K),ae=.5*Math.exp(2*_e/3),Oe=.5*Math.sqrt(_e*ae*(K-ae)/K)*(le-K/2<0?-1:1);dn(L,b,S,Math.max(k,Math.floor(S-le*ae/K+Oe)),Math.min(D,Math.floor(S+(K-le)*ae/K+Oe)),G)}const H=b[2*S+G];let Z=k,q=D;for(Qi(L,b,k,S),b[2*D+G]>H&&Qi(L,b,k,D);Z<q;){for(Qi(L,b,Z,q),Z++,q--;b[2*Z+G]<H;)Z++;for(;b[2*q+G]>H;)q--}b[2*k+G]===H?Qi(L,b,k,q):(q++,Qi(L,b,q,D)),q<=S&&(k=q+1),S<=q&&(D=q-1)}}function Qi(L,b,S,k){Ir(L,S,k),Ir(b,2*S,2*k),Ir(b,2*S+1,2*k+1)}function Ir(L,b,S){const k=L[b];L[b]=L[S],L[S]=k}function Ar(L,b,S,k){const D=L-S,G=b-k;return D*D+G*G}Fi.exports=Sr,Fi.exports.fromVectorTileJs=Sr,Fi.exports.fromGeojsonVt=function(L,b){b=b||{};var S={};for(var k in L)S[k]=new Er(L[k].features,b),S[k].name=k,S[k].version=b.version,S[k].extent=b.extent;return Sr({layers:S})},Fi.exports.GeoJSONWrapper=Er;const Cr=L=>L[0],xi=L=>L[1];class fn{constructor(b,S=Cr,k=xi,D=64,G=Float64Array){this.nodeSize=D,this.points=b;const H=b.length<65536?Uint16Array:Uint32Array,Z=this.ids=new H(b.length),q=this.coords=new G(2*b.length);for(let K=0;K<b.length;K++)Z[K]=K,q[2*K]=S(b[K]),q[2*K+1]=k(b[K]);pn(Z,q,D,0,Z.length-1,0)}range(b,S,k,D){return function(G,H,Z,q,K,le,_e){const ae=[0,G.length-1,0],Oe=[];let $e,De;for(;ae.length;){const Ze=ae.pop(),Xe=ae.pop(),dt=ae.pop();if(Xe-dt<=_e){for(let ft=dt;ft<=Xe;ft++)$e=H[2*ft],De=H[2*ft+1],$e>=Z&&$e<=K&&De>=q&&De<=le&&Oe.push(G[ft]);continue}const Ke=Math.floor((dt+Xe)/2);$e=H[2*Ke],De=H[2*Ke+1],$e>=Z&&$e<=K&&De>=q&&De<=le&&Oe.push(G[Ke]);const tt=(Ze+1)%2;(Ze===0?Z<=$e:q<=De)&&(ae.push(dt),ae.push(Ke-1),ae.push(tt)),(Ze===0?K>=$e:le>=De)&&(ae.push(Ke+1),ae.push(Xe),ae.push(tt))}return Oe}(this.ids,this.coords,b,S,k,D,this.nodeSize)}within(b,S,k){return function(D,G,H,Z,q,K){const le=[0,D.length-1,0],_e=[],ae=q*q;for(;le.length;){const Oe=le.pop(),$e=le.pop(),De=le.pop();if($e-De<=K){for(let tt=De;tt<=$e;tt++)Ar(G[2*tt],G[2*tt+1],H,Z)<=ae&&_e.push(D[tt]);continue}const Ze=Math.floor((De+$e)/2),Xe=G[2*Ze],dt=G[2*Ze+1];Ar(Xe,dt,H,Z)<=ae&&_e.push(D[Ze]);const Ke=(Oe+1)%2;(Oe===0?H-q<=Xe:Z-q<=dt)&&(le.push(De),le.push(Ze-1),le.push(Ke)),(Oe===0?H+q>=Xe:Z+q>=dt)&&(le.push(Ze+1),le.push($e),le.push(Ke))}return _e}(this.ids,this.coords,b,S,k,this.nodeSize)}}const $n={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:L=>L},pr=Math.fround||(Si=new Float32Array(1),L=>(Si[0]=+L,Si[0]));var Si;class Vn{constructor(b){this.options=Pr(Object.create($n),b),this.trees=new Array(this.options.maxZoom+1)}load(b){const{log:S,minZoom:k,maxZoom:D,nodeSize:G}=this.options;S&&console.time("total time");const H=`prepare ${b.length} points`;S&&console.time(H),this.points=b;let Z=[];for(let q=0;q<b.length;q++)b[q].geometry&&Z.push(mn(b[q],q));this.trees[D+1]=new fn(Z,Gn,dr,G,Float32Array),S&&console.timeEnd(H);for(let q=D;q>=k;q--){const K=+Date.now();Z=this._cluster(Z,q),this.trees[q]=new fn(Z,Gn,dr,G,Float32Array),S&&console.log("z%d: %d clusters in %dms",q,Z.length,+Date.now()-K)}return S&&console.timeEnd("total time"),this}getClusters(b,S){let k=((b[0]+180)%360+360)%360-180;const D=Math.max(-90,Math.min(90,b[1]));let G=b[2]===180?180:((b[2]+180)%360+360)%360-180;const H=Math.max(-90,Math.min(90,b[3]));if(b[2]-b[0]>=360)k=-180,G=180;else if(k>G){const le=this.getClusters([k,D,180,H],S),_e=this.getClusters([-180,D,G,H],S);return le.concat(_e)}const Z=this.trees[this._limitZoom(S)],q=Z.range(ht(k),er(H),ht(G),er(D)),K=[];for(const le of q){const _e=Z.points[le];K.push(_e.numPoints?gn(_e):this.points[_e.index])}return K}getChildren(b){const S=this._getOriginId(b),k=this._getOriginZoom(b),D="No cluster with the specified id.",G=this.trees[k];if(!G)throw new Error(D);const H=G.points[S];if(!H)throw new Error(D);const Z=this.options.radius/(this.options.extent*Math.pow(2,k-1)),q=G.within(H.x,H.y,Z),K=[];for(const le of q){const _e=G.points[le];_e.parentId===b&&K.push(_e.numPoints?gn(_e):this.points[_e.index])}if(K.length===0)throw new Error(D);return K}getLeaves(b,S,k){const D=[];return this._appendLeaves(D,b,S=S||10,k=k||0,0),D}getTile(b,S,k){const D=this.trees[this._limitZoom(b)],G=Math.pow(2,b),{extent:H,radius:Z}=this.options,q=Z/H,K=(k-q)/G,le=(k+1+q)/G,_e={features:[]};return this._addTileFeatures(D.range((S-q)/G,K,(S+1+q)/G,le),D.points,S,k,G,_e),S===0&&this._addTileFeatures(D.range(1-q/G,K,1,le),D.points,G,k,G,_e),S===G-1&&this._addTileFeatures(D.range(0,K,q/G,le),D.points,-1,k,G,_e),_e.features.length?_e:null}getClusterExpansionZoom(b){let S=this._getOriginZoom(b)-1;for(;S<=this.options.maxZoom;){const k=this.getChildren(b);if(S++,k.length!==1)break;b=k[0].properties.cluster_id}return S}_appendLeaves(b,S,k,D,G){const H=this.getChildren(S);for(const Z of H){const q=Z.properties;if(q&&q.cluster?G+q.point_count<=D?G+=q.point_count:G=this._appendLeaves(b,q.cluster_id,k,D,G):G<D?G++:b.push(Z),b.length===k)break}return G}_addTileFeatures(b,S,k,D,G,H){for(const Z of b){const q=S[Z],K=q.numPoints;let le,_e,ae;if(K)le=Nn(q),_e=q.x,ae=q.y;else{const De=this.points[q.index];le=De.properties,_e=ht(De.geometry.coordinates[0]),ae=er(De.geometry.coordinates[1])}const Oe={type:1,geometry:[[Math.round(this.options.extent*(_e*G-k)),Math.round(this.options.extent*(ae*G-D))]],tags:le};let $e;K?$e=q.id:this.options.generateId?$e=q.index:this.points[q.index].id&&($e=this.points[q.index].id),$e!==void 0&&(Oe.id=$e),H.features.push(Oe)}}_limitZoom(b){return Math.max(this.options.minZoom,Math.min(Math.floor(+b),this.options.maxZoom+1))}_cluster(b,S){const k=[],{radius:D,extent:G,reduce:H,minPoints:Z}=this.options,q=D/(G*Math.pow(2,S));for(let K=0;K<b.length;K++){const le=b[K];if(le.zoom<=S)continue;le.zoom=S;const _e=this.trees[S+1],ae=_e.within(le.x,le.y,q),Oe=le.numPoints||1;let $e=Oe;for(const De of ae){const Ze=_e.points[De];Ze.zoom>S&&($e+=Ze.numPoints||1)}if($e>Oe&&$e>=Z){let De=le.x*Oe,Ze=le.y*Oe,Xe=H&&Oe>1?this._map(le,!0):null;const dt=(K<<5)+(S+1)+this.points.length;for(const Ke of ae){const tt=_e.points[Ke];if(tt.zoom<=S)continue;tt.zoom=S;const ft=tt.numPoints||1;De+=tt.x*ft,Ze+=tt.y*ft,tt.parentId=dt,H&&(Xe||(Xe=this._map(le,!0)),H(Xe,this._map(tt)))}le.parentId=dt,k.push(Mr(De/$e,Ze/$e,dt,$e,Xe))}else if(k.push(le),$e>1)for(const De of ae){const Ze=_e.points[De];Ze.zoom<=S||(Ze.zoom=S,k.push(Ze))}}return k}_getOriginId(b){return b-this.points.length>>5}_getOriginZoom(b){return(b-this.points.length)%32}_map(b,S){if(b.numPoints)return S?Pr({},b.properties):b.properties;const k=this.points[b.index].properties,D=this.options.map(k);return S&&D===k?Pr({},D):D}}function Mr(L,b,S,k,D){return{x:pr(L),y:pr(b),zoom:1/0,id:S,parentId:-1,numPoints:k,properties:D}}function mn(L,b){const[S,k]=L.geometry.coordinates;return{x:pr(ht(S)),y:pr(er(k)),zoom:1/0,index:b,parentId:-1}}function gn(L){return{type:"Feature",id:L.id,properties:Nn(L),geometry:{type:"Point",coordinates:[(b=L.x,360*(b-.5)),zr(L.y)]}};var b}function Nn(L){const b=L.numPoints,S=b>=1e4?`${Math.round(b/1e3)}k`:b>=1e3?Math.round(b/100)/10+"k":b;return Pr(Pr({},L.properties),{cluster:!0,cluster_id:L.id,point_count:b,point_count_abbreviated:S})}function ht(L){return L/360+.5}function er(L){const b=Math.sin(L*Math.PI/180),S=.5-.25*Math.log((1+b)/(1-b))/Math.PI;return S<0?0:S>1?1:S}function zr(L){const b=(180-360*L)*Math.PI/180;return 360*Math.atan(Math.exp(b))/Math.PI-90}function Pr(L,b){for(const S in b)L[S]=b[S];return L}function Gn(L){return L.x}function dr(L){return L.y}function fr(L,b,S,k){for(var D,G=k,H=S-b>>1,Z=S-b,q=L[b],K=L[b+1],le=L[S],_e=L[S+1],ae=b+3;ae<S;ae+=3){var Oe=_n(L[ae],L[ae+1],q,K,le,_e);if(Oe>G)D=ae,G=Oe;else if(Oe===G){var $e=Math.abs(ae-H);$e<Z&&(D=ae,Z=$e)}}G>k&&(D-b>3&&fr(L,b,D,k),L[D+2]=G,S-D>3&&fr(L,D,S,k))}function _n(L,b,S,k,D,G){var H=D-S,Z=G-k;if(H!==0||Z!==0){var q=((L-S)*H+(b-k)*Z)/(H*H+Z*Z);q>1?(S=D,k=G):q>0&&(S+=H*q,k+=Z*q)}return(H=L-S)*H+(Z=b-k)*Z}function mr(L,b,S,k){var D={id:L===void 0?null:L,type:b,geometry:S,tags:k,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(G){var H=G.geometry,Z=G.type;if(Z==="Point"||Z==="MultiPoint"||Z==="LineString")pe(G,H);else if(Z==="Polygon"||Z==="MultiLineString")for(var q=0;q<H.length;q++)pe(G,H[q]);else if(Z==="MultiPolygon")for(q=0;q<H.length;q++)for(var K=0;K<H[q].length;K++)pe(G,H[q][K])}(D),D}function pe(L,b){for(var S=0;S<b.length;S+=3)L.minX=Math.min(L.minX,b[S]),L.minY=Math.min(L.minY,b[S+1]),L.maxX=Math.max(L.maxX,b[S]),L.maxY=Math.max(L.maxY,b[S+1])}function Ce(L,b,S,k){if(b.geometry){var D=b.geometry.coordinates,G=b.geometry.type,H=Math.pow(S.tolerance/((1<<S.maxZoom)*S.extent),2),Z=[],q=b.id;if(S.promoteId?q=b.properties[S.promoteId]:S.generateId&&(q=k||0),G==="Point")Zr(D,Z);else if(G==="MultiPoint")for(var K=0;K<D.length;K++)Zr(D[K],Z);else if(G==="LineString")ji(D,Z,H,!1);else if(G==="MultiLineString"){if(S.lineMetrics){for(K=0;K<D.length;K++)ji(D[K],Z=[],H,!1),L.push(mr(q,"LineString",Z,b.properties));return}pt(D,Z,H,!1)}else if(G==="Polygon")pt(D,Z,H,!0);else{if(G!=="MultiPolygon"){if(G==="GeometryCollection"){for(K=0;K<b.geometry.geometries.length;K++)Ce(L,{id:q,geometry:b.geometry.geometries[K],properties:b.properties},S,k);return}throw new Error("Input data is not a valid GeoJSON object.")}for(K=0;K<D.length;K++){var le=[];pt(D[K],le,H,!0),Z.push(le)}}L.push(mr(q,G,Z,b.properties))}}function Zr(L,b){b.push(Oi(L[0])),b.push(Ii(L[1])),b.push(0)}function ji(L,b,S,k){for(var D,G,H=0,Z=0;Z<L.length;Z++){var q=Oi(L[Z][0]),K=Ii(L[Z][1]);b.push(q),b.push(K),b.push(0),Z>0&&(H+=k?(D*K-q*G)/2:Math.sqrt(Math.pow(q-D,2)+Math.pow(K-G,2))),D=q,G=K}var le=b.length-3;b[2]=1,fr(b,0,le,S),b[le+2]=1,b.size=Math.abs(H),b.start=0,b.end=b.size}function pt(L,b,S,k){for(var D=0;D<L.length;D++){var G=[];ji(L[D],G,S,k),b.push(G)}}function Oi(L){return L/360+.5}function Ii(L){var b=Math.sin(L*Math.PI/180),S=.5-.25*Math.log((1+b)/(1-b))/Math.PI;return S<0?0:S>1?1:S}function Ai(L,b,S,k,D,G,H,Z){if(k/=b,G>=(S/=b)&&H<k)return L;if(H<S||G>=k)return null;for(var q=[],K=0;K<L.length;K++){var le=L[K],_e=le.geometry,ae=le.type,Oe=D===0?le.minX:le.minY,$e=D===0?le.maxX:le.maxY;if(Oe>=S&&$e<k)q.push(le);else if(!($e<S||Oe>=k)){var De=[];if(ae==="Point"||ae==="MultiPoint")kr(_e,De,S,k,D);else if(ae==="LineString")Se(_e,De,S,k,D,!1,Z.lineMetrics);else if(ae==="MultiLineString")Ye(_e,De,S,k,D,!1);else if(ae==="Polygon")Ye(_e,De,S,k,D,!0);else if(ae==="MultiPolygon")for(var Ze=0;Ze<_e.length;Ze++){var Xe=[];Ye(_e[Ze],Xe,S,k,D,!0),Xe.length&&De.push(Xe)}if(De.length){if(Z.lineMetrics&&ae==="LineString"){for(Ze=0;Ze<De.length;Ze++)q.push(mr(le.id,ae,De[Ze],le.tags));continue}ae!=="LineString"&&ae!=="MultiLineString"||(De.length===1?(ae="LineString",De=De[0]):ae="MultiLineString"),ae!=="Point"&&ae!=="MultiPoint"||(ae=De.length===3?"Point":"MultiPoint"),q.push(mr(le.id,ae,De,le.tags))}}}return q.length?q:null}function kr(L,b,S,k,D){for(var G=0;G<L.length;G+=3){var H=L[G+D];H>=S&&H<=k&&(b.push(L[G]),b.push(L[G+1]),b.push(L[G+2]))}}function Se(L,b,S,k,D,G,H){for(var Z,q,K=et(L),le=D===0?Dr:Je,_e=L.start,ae=0;ae<L.length-3;ae+=3){var Oe=L[ae],$e=L[ae+1],De=L[ae+2],Ze=L[ae+3],Xe=L[ae+4],dt=D===0?Oe:$e,Ke=D===0?Ze:Xe,tt=!1;H&&(Z=Math.sqrt(Math.pow(Oe-Ze,2)+Math.pow($e-Xe,2))),dt<S?Ke>S&&(q=le(K,Oe,$e,Ze,Xe,S),H&&(K.start=_e+Z*q)):dt>k?Ke<k&&(q=le(K,Oe,$e,Ze,Xe,k),H&&(K.start=_e+Z*q)):oi(K,Oe,$e,De),Ke<S&&dt>=S&&(q=le(K,Oe,$e,Ze,Xe,S),tt=!0),Ke>k&&dt<=k&&(q=le(K,Oe,$e,Ze,Xe,k),tt=!0),!G&&tt&&(H&&(K.end=_e+Z*q),b.push(K),K=et(L)),H&&(_e+=Z)}var ft=L.length-3;Oe=L[ft],$e=L[ft+1],De=L[ft+2],(dt=D===0?Oe:$e)>=S&&dt<=k&&oi(K,Oe,$e,De),ft=K.length-3,G&&ft>=3&&(K[ft]!==K[0]||K[ft+1]!==K[1])&&oi(K,K[0],K[1],K[2]),K.length&&b.push(K)}function et(L){var b=[];return b.size=L.size,b.start=L.start,b.end=L.end,b}function Ye(L,b,S,k,D,G){for(var H=0;H<L.length;H++)Se(L[H],b,S,k,D,G,!1)}function oi(L,b,S,k){L.push(b),L.push(S),L.push(k)}function Dr(L,b,S,k,D,G){var H=(G-b)/(k-b);return L.push(G),L.push(S+(D-S)*H),L.push(1),H}function Je(L,b,S,k,D,G){var H=(G-S)/(D-S);return L.push(b+(k-b)*H),L.push(G),L.push(1),H}function gr(L,b){for(var S=[],k=0;k<L.length;k++){var D,G=L[k],H=G.type;if(H==="Point"||H==="MultiPoint"||H==="LineString")D=Yt(G.geometry,b);else if(H==="MultiLineString"||H==="Polygon"){D=[];for(var Z=0;Z<G.geometry.length;Z++)D.push(Yt(G.geometry[Z],b))}else if(H==="MultiPolygon")for(D=[],Z=0;Z<G.geometry.length;Z++){for(var q=[],K=0;K<G.geometry[Z].length;K++)q.push(Yt(G.geometry[Z][K],b));D.push(q)}S.push(mr(G.id,H,D,G.tags))}return S}function Yt(L,b){var S=[];S.size=L.size,L.start!==void 0&&(S.start=L.start,S.end=L.end);for(var k=0;k<L.length;k+=3)S.push(L[k]+b,L[k+1],L[k+2]);return S}function yn(L,b){if(L.transformed)return L;var S,k,D,G=1<<L.z,H=L.x,Z=L.y;for(S=0;S<L.features.length;S++){var q=L.features[S],K=q.geometry,le=q.type;if(q.geometry=[],le===1)for(k=0;k<K.length;k+=2)q.geometry.push(qt(K[k],K[k+1],b,G,H,Z));else for(k=0;k<K.length;k++){var _e=[];for(D=0;D<K[k].length;D+=2)_e.push(qt(K[k][D],K[k][D+1],b,G,H,Z));q.geometry.push(_e)}}return L.transformed=!0,L}function qt(L,b,S,k,D,G){return[Math.round(S*(L*k-D)),Math.round(S*(b*k-G))]}function mi(L,b,S,k,D){for(var G=b===D.maxZoom?0:D.tolerance/((1<<b)*D.extent),H={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:S,y:k,z:b,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0},Z=0;Z<L.length;Z++){H.numFeatures++,Tt(H,L[Z],G,D);var q=L[Z].minX,K=L[Z].minY,le=L[Z].maxX,_e=L[Z].maxY;q<H.minX&&(H.minX=q),K<H.minY&&(H.minY=K),le>H.maxX&&(H.maxX=le),_e>H.maxY&&(H.maxY=_e)}return H}function Tt(L,b,S,k){var D=b.geometry,G=b.type,H=[];if(G==="Point"||G==="MultiPoint")for(var Z=0;Z<D.length;Z+=3)H.push(D[Z]),H.push(D[Z+1]),L.numPoints++,L.numSimplified++;else if(G==="LineString")xn(H,D,L,S,!1,!1);else if(G==="MultiLineString"||G==="Polygon")for(Z=0;Z<D.length;Z++)xn(H,D[Z],L,S,G==="Polygon",Z===0);else if(G==="MultiPolygon")for(var q=0;q<D.length;q++){var K=D[q];for(Z=0;Z<K.length;Z++)xn(H,K[Z],L,S,!0,Z===0)}if(H.length){var le=b.tags||null;if(G==="LineString"&&k.lineMetrics){for(var _e in le={},b.tags)le[_e]=b.tags[_e];le.mapbox_clip_start=D.start/D.size,le.mapbox_clip_end=D.end/D.size}var ae={geometry:H,type:G==="Polygon"||G==="MultiPolygon"?3:G==="LineString"||G==="MultiLineString"?2:1,tags:le};b.id!==null&&(ae.id=b.id),L.features.push(ae)}}function xn(L,b,S,k,D,G){var H=k*k;if(k>0&&b.size<(D?H:k))S.numPoints+=b.length/3;else{for(var Z=[],q=0;q<b.length;q+=3)(k===0||b[q+2]>H)&&(S.numSimplified++,Z.push(b[q]),Z.push(b[q+1])),S.numPoints++;D&&function(K,le){for(var _e=0,ae=0,Oe=K.length,$e=Oe-2;ae<Oe;$e=ae,ae+=2)_e+=(K[ae]-K[$e])*(K[ae+1]+K[$e+1]);if(_e>0===le)for(ae=0,Oe=K.length;ae<Oe/2;ae+=2){var De=K[ae],Ze=K[ae+1];K[ae]=K[Oe-2-ae],K[ae+1]=K[Oe-1-ae],K[Oe-2-ae]=De,K[Oe-1-ae]=Ze}}(Z,G),L.push(Z)}}function tr(L,b){var S=(b=this.options=function(D,G){for(var H in G)D[H]=G[H];return D}(Object.create(this.options),b)).debug;if(S&&console.time("preprocess data"),b.maxZoom<0||b.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(b.promoteId&&b.generateId)throw new Error("promoteId and generateId cannot be used together.");var k=function(D,G){var H=[];if(D.type==="FeatureCollection")for(var Z=0;Z<D.features.length;Z++)Ce(H,D.features[Z],G,Z);else Ce(H,D.type==="Feature"?D:{geometry:D},G);return H}(L,b);this.tiles={},this.tileCoords=[],S&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",b.indexMaxZoom,b.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),k=function(D,G){var H=G.buffer/G.extent,Z=D,q=Ai(D,1,-1-H,H,0,-1,2,G),K=Ai(D,1,1-H,2+H,0,-1,2,G);return(q||K)&&(Z=Ai(D,1,-H,1+H,0,-1,2,G)||[],q&&(Z=gr(q,1).concat(Z)),K&&(Z=Z.concat(gr(K,-1)))),Z}(k,b),k.length&&this.splitTile(k,0,0,0),S&&(k.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}function jr(L,b,S){return 32*((1<<L)*S+b)+L}function Xr(L,b){const S=L.tileID.canonical;if(!this._geoJSONIndex)return b(null,null);const k=this._geoJSONIndex.getTile(S.z,S.x,S.y);if(!k)return b(null,null);const D=new Gi(k.features);let G=Fi.exports(D);G.byteOffset===0&&G.byteLength===G.buffer.byteLength||(G=new Uint8Array(G)),b(null,{vectorTile:D,rawData:G.buffer})}tr.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},tr.prototype.splitTile=function(L,b,S,k,D,G,H){for(var Z=[L,b,S,k],q=this.options,K=q.debug;Z.length;){k=Z.pop(),S=Z.pop(),b=Z.pop(),L=Z.pop();var le=1<<b,_e=jr(b,S,k),ae=this.tiles[_e];if(!ae&&(K>1&&console.time("creation"),ae=this.tiles[_e]=mi(L,b,S,k,q),this.tileCoords.push({z:b,x:S,y:k}),K)){K>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",b,S,k,ae.numFeatures,ae.numPoints,ae.numSimplified),console.timeEnd("creation"));var Oe="z"+b;this.stats[Oe]=(this.stats[Oe]||0)+1,this.total++}if(ae.source=L,D){if(b===q.maxZoom||b===D)continue;var $e=1<<D-b;if(S!==Math.floor(G/$e)||k!==Math.floor(H/$e))continue}else if(b===q.indexMaxZoom||ae.numPoints<=q.indexMaxPoints)continue;if(ae.source=null,L.length!==0){K>1&&console.time("clipping");var De,Ze,Xe,dt,Ke,tt,ft=.5*q.buffer/q.extent,St=.5-ft,Qt=.5+ft,kt=1+ft;De=Ze=Xe=dt=null,Ke=Ai(L,le,S-ft,S+Qt,0,ae.minX,ae.maxX,q),tt=Ai(L,le,S+St,S+kt,0,ae.minX,ae.maxX,q),L=null,Ke&&(De=Ai(Ke,le,k-ft,k+Qt,1,ae.minY,ae.maxY,q),Ze=Ai(Ke,le,k+St,k+kt,1,ae.minY,ae.maxY,q),Ke=null),tt&&(Xe=Ai(tt,le,k-ft,k+Qt,1,ae.minY,ae.maxY,q),dt=Ai(tt,le,k+St,k+kt,1,ae.minY,ae.maxY,q),tt=null),K>1&&console.timeEnd("clipping"),Z.push(De||[],b+1,2*S,2*k),Z.push(Ze||[],b+1,2*S,2*k+1),Z.push(Xe||[],b+1,2*S+1,2*k),Z.push(dt||[],b+1,2*S+1,2*k+1)}}},tr.prototype.getTile=function(L,b,S){var k=this.options,D=k.extent,G=k.debug;if(L<0||L>24)return null;var H=1<<L,Z=jr(L,b=(b%H+H)%H,S);if(this.tiles[Z])return yn(this.tiles[Z],D);G>1&&console.log("drilling down to z%d-%d-%d",L,b,S);for(var q,K=L,le=b,_e=S;!q&&K>0;)K--,le=Math.floor(le/2),_e=Math.floor(_e/2),q=this.tiles[jr(K,le,_e)];return q&&q.source?(G>1&&console.log("found parent tile z%d-%d-%d",K,le,_e),G>1&&console.time("drilling down"),this.splitTile(q.source,K,le,_e,L,b,S),G>1&&console.timeEnd("drilling down"),this.tiles[Z]?yn(this.tiles[Z],D):null):null};class vn extends He{constructor(b,S,k,D){super(b,S,k,Xr),D&&(this.loadGeoJSON=D)}loadData(b,S){var k;(k=this._pendingRequest)===null||k===void 0||k.cancel(),this._pendingCallback&&this._pendingCallback(null,{abandoned:!0});const D=!!(b&&b.request&&b.request.collectResourceTiming)&&new l.RequestPerformance(b.request);this._pendingCallback=S,this._pendingRequest=this.loadGeoJSON(b,(G,H)=>{if(delete this._pendingCallback,delete this._pendingRequest,G||!H)return S(G);if(typeof H!="object")return S(new Error(`Input data given to '${b.source}' is not a valid GeoJSON object.`));{Mt(H,!0);try{if(b.filter){const q=l.createExpression(b.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(q.result==="error")throw new Error(q.value.map(le=>`${le.key}: ${le.message}`).join(", "));H={type:"FeatureCollection",features:H.features.filter(le=>q.value.evaluate({zoom:0},le))}}this._geoJSONIndex=b.cluster?new Vn(function({superclusterOptions:q,clusterProperties:K}){if(!K||!q)return q;const le={},_e={},ae={accumulated:null,zoom:0},Oe={properties:null},$e=Object.keys(K);for(const De of $e){const[Ze,Xe]=K[De],dt=l.createExpression(Xe),Ke=l.createExpression(typeof Ze=="string"?[Ze,["accumulated"],["get",De]]:Ze);le[De]=dt.value,_e[De]=Ke.value}return q.map=De=>{Oe.properties=De;const Ze={};for(const Xe of $e)Ze[Xe]=le[Xe].evaluate(ae,Oe);return Ze},q.reduce=(De,Ze)=>{Oe.properties=Ze;for(const Xe of $e)ae.accumulated=De[Xe],De[Xe]=_e[Xe].evaluate(ae,Oe)},q}(b)).load(H.features):function(q,K){return new tr(q,K)}(H,b.geojsonVtOptions)}catch(q){return S(q)}this.loaded={};const Z={};if(D){const q=D.finish();q&&(Z.resourceTiming={},Z.resourceTiming[b.source]=JSON.parse(JSON.stringify(q)))}S(null,Z)}})}reloadTile(b,S){const k=this.loaded;return k&&k[b.uid]?super.reloadTile(b,S):this.loadTile(b,S)}loadGeoJSON(b,S){if(b.request)return l.getJSON(b.request,S);if(typeof b.data=="string")try{S(null,JSON.parse(b.data))}catch(k){S(new Error(`Input data given to '${b.source}' is not a valid GeoJSON object.`))}else S(new Error(`Input data given to '${b.source}' is not a valid GeoJSON object.`));return{cancel:()=>{}}}removeSource(b,S){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),S()}getClusterExpansionZoom(b,S){try{S(null,this._geoJSONIndex.getClusterExpansionZoom(b.clusterId))}catch(k){S(k)}}getClusterChildren(b,S){try{S(null,this._geoJSONIndex.getChildren(b.clusterId))}catch(k){S(k)}}getClusterLeaves(b,S){try{S(null,this._geoJSONIndex.getLeaves(b.clusterId,b.limit,b.offset))}catch(k){S(k)}}}class Wr{constructor(b){this.self=b,this.actor=new l.Actor(b,this),this.layerIndexes={},this.availableImages={},this.workerSourceTypes={vector:He,geojson:vn},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(S,k)=>{if(this.workerSourceTypes[S])throw new Error(`Worker source with name "${S}" already registered.`);this.workerSourceTypes[S]=k},this.self.registerRTLTextPlugin=S=>{if(l.plugin.isParsed())throw new Error("RTL text plugin already registered.");l.plugin.applyArabicShaping=S.applyArabicShaping,l.plugin.processBidirectionalText=S.processBidirectionalText,l.plugin.processStyledBidirectionalText=S.processStyledBidirectionalText}}setReferrer(b,S){this.referrer=S}setImages(b,S,k){this.availableImages[b]=S;for(const D in this.workerSources[b]){const G=this.workerSources[b][D];for(const H in G)G[H].availableImages=S}k()}setLayers(b,S,k){this.getLayerIndex(b).replace(S),k()}updateLayers(b,S,k){this.getLayerIndex(b).update(S.layers,S.removedIds),k()}loadTile(b,S,k){this.getWorkerSource(b,S.type,S.source).loadTile(S,k)}loadDEMTile(b,S,k){this.getDEMWorkerSource(b,S.source).loadTile(S,k)}reloadTile(b,S,k){this.getWorkerSource(b,S.type,S.source).reloadTile(S,k)}abortTile(b,S,k){this.getWorkerSource(b,S.type,S.source).abortTile(S,k)}removeTile(b,S,k){this.getWorkerSource(b,S.type,S.source).removeTile(S,k)}removeDEMTile(b,S){this.getDEMWorkerSource(b,S.source).removeTile(S)}removeSource(b,S,k){if(!this.workerSources[b]||!this.workerSources[b][S.type]||!this.workerSources[b][S.type][S.source])return;const D=this.workerSources[b][S.type][S.source];delete this.workerSources[b][S.type][S.source],D.removeSource!==void 0?D.removeSource(S,k):k()}loadWorkerSource(b,S,k){try{this.self.importScripts(S.url),k()}catch(D){k(D.toString())}}syncRTLPluginState(b,S,k){try{l.plugin.setState(S);const D=l.plugin.getPluginURL();if(l.plugin.isLoaded()&&!l.plugin.isParsed()&&D!=null){this.self.importScripts(D);const G=l.plugin.isParsed();k(G?void 0:new Error(`RTL Text Plugin failed to import scripts from ${D}`),G)}}catch(D){k(D.toString())}}getAvailableImages(b){let S=this.availableImages[b];return S||(S=[]),S}getLayerIndex(b){let S=this.layerIndexes[b];return S||(S=this.layerIndexes[b]=new Ee),S}getWorkerSource(b,S,k){if(this.workerSources[b]||(this.workerSources[b]={}),this.workerSources[b][S]||(this.workerSources[b][S]={}),!this.workerSources[b][S][k]){const D={send:(G,H,Z)=>{this.actor.send(G,H,Z,b)}};this.workerSources[b][S][k]=new this.workerSourceTypes[S](D,this.getLayerIndex(b),this.getAvailableImages(b))}return this.workerSources[b][S][k]}getDEMWorkerSource(b,S){return this.demWorkerSources[b]||(this.demWorkerSources[b]={}),this.demWorkerSources[b][S]||(this.demWorkerSources[b][S]=new Ut),this.demWorkerSources[b][S]}enforceCacheSizeLimit(b,S){l.enforceCacheSizeLimit(S)}}return l.isWorker()&&(self.worker=new Wr(self)),Wr}),Q(["./shared"],function(l){var ve=me;function me(a){return!function(t){return typeof window>"u"||typeof document>"u"?"not a browser":Array.prototype&&Array.prototype.every&&Array.prototype.filter&&Array.prototype.forEach&&Array.prototype.indexOf&&Array.prototype.lastIndexOf&&Array.prototype.map&&Array.prototype.some&&Array.prototype.reduce&&Array.prototype.reduceRight&&Array.isArray?Function.prototype&&Function.prototype.bind?Object.keys&&Object.create&&Object.getPrototypeOf&&Object.getOwnPropertyNames&&Object.isSealed&&Object.isFrozen&&Object.isExtensible&&Object.getOwnPropertyDescriptor&&Object.defineProperty&&Object.defineProperties&&Object.seal&&Object.freeze&&Object.preventExtensions?"JSON"in window&&"parse"in JSON&&"stringify"in JSON?function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var s,u,p=new Blob([""],{type:"text/javascript"}),f=URL.createObjectURL(p);try{u=new Worker(f),s=!0}catch(_){s=!1}return u&&u.terminate(),URL.revokeObjectURL(f),s}()?"Uint8ClampedArray"in window?ArrayBuffer.isView?function(){var s=document.createElement("canvas");s.width=s.height=1;var u=s.getContext("2d");if(!u)return!1;var p=u.getImageData(0,0,1,1);return p&&p.width===s.width}()?(Ee[n=t&&t.failIfMajorPerformanceCaveat]===void 0&&(Ee[n]=function(s){var u,p=function(f){var _=document.createElement("canvas"),y=Object.create(me.webGLContextAttributes);return y.failIfMajorPerformanceCaveat=f,_.getContext("webgl",y)||_.getContext("experimental-webgl",y)}(s);if(!p)return!1;try{u=p.createShader(p.VERTEX_SHADER)}catch(f){return!1}return!(!u||p.isContextLost())&&(p.shaderSource(u,"void main() {}"),p.compileShader(u),p.getShaderParameter(u,p.COMPILE_STATUS)===!0)}(n)),Ee[n]?document.documentMode?"insufficient ECMAScript 6 support":void 0:"insufficient WebGL support"):"insufficient Canvas/getImageData support":"insufficient ArrayBuffer support":"insufficient Uint8ClampedArray support":"insufficient worker support":"insufficient JSON support":"insufficient Object support":"insufficient Function support":"insufficent Array support";var n}(a)}var Ee={};function Te(a,t){if(Array.isArray(a)){if(!Array.isArray(t)||a.length!==t.length)return!1;for(let n=0;n<a.length;n++)if(!Te(a[n],t[n]))return!1;return!0}if(typeof a=="object"&&a!==null&&t!==null){if(typeof t!="object"||Object.keys(a).length!==Object.keys(t).length)return!1;for(const n in a)if(!Te(a[n],t[n]))return!1;return!0}return a===t}me.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0};class se{static testProp(t){if(!se.docStyle)return t[0];for(let n=0;n<t.length;n++)if(t[n]in se.docStyle)return t[n];return t[0]}static create(t,n,s){const u=window.document.createElement(t);return n!==void 0&&(u.className=n),s&&s.appendChild(u),u}static createNS(t,n){return window.document.createElementNS(t,n)}static disableDrag(){se.docStyle&&se.selectProp&&(se.userSelect=se.docStyle[se.selectProp],se.docStyle[se.selectProp]="none")}static enableDrag(){se.docStyle&&se.selectProp&&(se.docStyle[se.selectProp]=se.userSelect)}static setTransform(t,n){t.style[se.transformProp]=n}static addEventListener(t,n,s,u={}){t.addEventListener(n,s,"passive"in u?u:u.capture)}static removeEventListener(t,n,s,u={}){t.removeEventListener(n,s,"passive"in u?u:u.capture)}static suppressClickInternal(t){t.preventDefault(),t.stopPropagation(),window.removeEventListener("click",se.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",se.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",se.suppressClickInternal,!0)},0)}static mousePos(t,n){const s=t.getBoundingClientRect();return new l.pointGeometry(n.clientX-s.left-t.clientLeft,n.clientY-s.top-t.clientTop)}static touchPos(t,n){const s=t.getBoundingClientRect(),u=[];for(let p=0;p<n.length;p++)u.push(new l.pointGeometry(n[p].clientX-s.left-t.clientLeft,n[p].clientY-s.top-t.clientTop));return u}static mouseButton(t){return t.button}static remove(t){t.parentNode&&t.parentNode.removeChild(t)}}se.docStyle=typeof window<"u"&&window.document&&window.document.documentElement.style,se.selectProp=se.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),se.transformProp=se.testProp(["transform","WebkitTransform"]);class gt{constructor(t){this._transformRequestFn=t}transformRequest(t,n){return this._transformRequestFn&&this._transformRequestFn(t,n)||{url:t}}normalizeSpriteURL(t,n,s){const u=function(p){const f=p.match(nt);if(!f)throw new Error(`Unable to parse URL "${p}"`);return{protocol:f[1],authority:f[2],path:f[3]||"/",params:f[4]?f[4].split("&"):[]}}(t);return u.path+=`${n}${s}`,function(p){const f=p.params.length?`?${p.params.join("&")}`:"";return`${p.protocol}://${p.authority}${p.path}${f}`}(u)}setTransformRequest(t){this._transformRequestFn=t}}const nt=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;class He{constructor(t,n,s,u){this.context=t,this.format=s,this.texture=t.gl.createTexture(),this.update(n,u)}update(t,n,s){const{width:u,height:p}=t,f=!(this.size&&this.size[0]===u&&this.size[1]===p||s),{context:_}=this,{gl:y}=_;if(this.useMipmap=Boolean(n&&n.useMipmap),y.bindTexture(y.TEXTURE_2D,this.texture),_.pixelStoreUnpackFlipY.set(!1),_.pixelStoreUnpack.set(1),_.pixelStoreUnpackPremultiplyAlpha.set(this.format===y.RGBA&&(!n||n.premultiply!==!1)),f)this.size=[u,p],t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||l.isImageBitmap(t)?y.texImage2D(y.TEXTURE_2D,0,this.format,this.format,y.UNSIGNED_BYTE,t):y.texImage2D(y.TEXTURE_2D,0,this.format,u,p,0,this.format,y.UNSIGNED_BYTE,t.data);else{const{x:v,y:T}=s||{x:0,y:0};t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||l.isImageBitmap(t)?y.texSubImage2D(y.TEXTURE_2D,0,v,T,y.RGBA,y.UNSIGNED_BYTE,t):y.texSubImage2D(y.TEXTURE_2D,0,v,T,u,p,y.RGBA,y.UNSIGNED_BYTE,t.data)}this.useMipmap&&this.isSizePowerOfTwo()&&y.generateMipmap(y.TEXTURE_2D)}bind(t,n,s){const{context:u}=this,{gl:p}=u;p.bindTexture(p.TEXTURE_2D,this.texture),s!==p.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(s=p.LINEAR),t!==this.filter&&(p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MAG_FILTER,t),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MIN_FILTER,s||t),this.filter=t),n!==this.wrap&&(p.texParameteri(p.TEXTURE_2D,p.TEXTURE_WRAP_S,n),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_WRAP_T,n),this.wrap=n)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:t}=this.context;t.deleteTexture(this.texture),this.texture=null}}function Ut(a){const{userImage:t}=a;return!!(t&&t.render&&t.render())&&(a.data.replace(new Uint8Array(t.data.buffer)),!0)}class Mt extends l.Evented{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new l.RGBAImage({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(t){if(this.loaded!==t&&(this.loaded=t,t)){for(const{ids:n,callback:s}of this.requestors)this._notify(n,s);this.requestors=[]}}getImage(t){return this.images[t]}addImage(t,n){if(this.images[t])throw new Error(`Image id ${t} already exist, use updateImage instead`);this._validate(t,n)&&(this.images[t]=n)}_validate(t,n){let s=!0;return this._validateStretch(n.stretchX,n.data&&n.data.width)||(this.fire(new l.ErrorEvent(new Error(`Image "${t}" has invalid "stretchX" value`))),s=!1),this._validateStretch(n.stretchY,n.data&&n.data.height)||(this.fire(new l.ErrorEvent(new Error(`Image "${t}" has invalid "stretchY" value`))),s=!1),this._validateContent(n.content,n)||(this.fire(new l.ErrorEvent(new Error(`Image "${t}" has invalid "content" value`))),s=!1),s}_validateStretch(t,n){if(!t)return!0;let s=0;for(const u of t){if(u[0]<s||u[1]<u[0]||n<u[1])return!1;s=u[1]}return!0}_validateContent(t,n){return!(t&&(t.length!==4||t[0]<0||n.data.width<t[0]||t[1]<0||n.data.height<t[1]||t[2]<0||n.data.width<t[2]||t[3]<0||n.data.height<t[3]||t[2]<t[0]||t[3]<t[1]))}updateImage(t,n){const s=this.images[t];if(s.data.width!==n.data.width||s.data.height!==n.data.height)throw new Error(`size mismatch between old image (${s.data.width}x${s.data.height}) and new image (${n.data.width}x${n.data.height}).`);n.version=s.version+1,this.images[t]=n,this.updatedImages[t]=!0}removeImage(t){const n=this.images[t];delete this.images[t],delete this.patterns[t],n.userImage&&n.userImage.onRemove&&n.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(t,n){let s=!0;if(!this.isLoaded())for(const u of t)this.images[u]||(s=!1);this.isLoaded()||s?this._notify(t,n):this.requestors.push({ids:t,callback:n})}_notify(t,n){const s={};for(const u of t){this.images[u]||this.fire(new l.Event("styleimagemissing",{id:u}));const p=this.images[u];p?s[u]={data:p.data.clone(),pixelRatio:p.pixelRatio,sdf:p.sdf,version:p.version,stretchX:p.stretchX,stretchY:p.stretchY,content:p.content,hasRenderCallback:Boolean(p.userImage&&p.userImage.render)}:l.warnOnce(`Image "${u}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`)}n(null,s)}getPixelSize(){const{width:t,height:n}=this.atlasImage;return{width:t,height:n}}getPattern(t){const n=this.patterns[t],s=this.getImage(t);if(!s)return null;if(n&&n.position.version===s.version)return n.position;if(n)n.position.version=s.version;else{const u={w:s.data.width+2,h:s.data.height+2,x:0,y:0},p=new l.ImagePosition(u,s);this.patterns[t]={bin:u,position:p}}return this._updatePatternAtlas(),this.patterns[t].position}bind(t){const n=t.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new He(t,this.atlasImage,n.RGBA),this.atlasTexture.bind(n.LINEAR,n.CLAMP_TO_EDGE)}_updatePatternAtlas(){const t=[];for(const p in this.patterns)t.push(this.patterns[p].bin);const{w:n,h:s}=l.potpack(t),u=this.atlasImage;u.resize({width:n||1,height:s||1});for(const p in this.patterns){const{bin:f}=this.patterns[p],_=f.x+1,y=f.y+1,v=this.images[p].data,T=v.width,I=v.height;l.RGBAImage.copy(v,u,{x:0,y:0},{x:_,y},{width:T,height:I}),l.RGBAImage.copy(v,u,{x:0,y:I-1},{x:_,y:y-1},{width:T,height:1}),l.RGBAImage.copy(v,u,{x:0,y:0},{x:_,y:y+I},{width:T,height:1}),l.RGBAImage.copy(v,u,{x:T-1,y:0},{x:_-1,y},{width:1,height:I}),l.RGBAImage.copy(v,u,{x:0,y:0},{x:_+T,y},{width:1,height:I})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(t){for(const n of t){if(this.callbackDispatchedThisFrame[n])continue;this.callbackDispatchedThisFrame[n]=!0;const s=this.images[n];s||l.warnOnce(`Image with ID: "${n}" was not found`),Ut(s)&&this.updateImage(n,s)}}}const ct=1e20;function vt(a,t,n,s,u,p,f,_,y){for(let v=t;v<t+s;v++)Wt(a,n*p+v,p,u,f,_,y);for(let v=n;v<n+u;v++)Wt(a,v*p+t,1,s,f,_,y)}function Wt(a,t,n,s,u,p,f){p[0]=0,f[0]=-ct,f[1]=ct,u[0]=a[t];for(let _=1,y=0,v=0;_<s;_++){u[_]=a[t+_*n];const T=_*_;do{const I=p[y];v=(u[_]-u[I]+T-I*I)/(_-I)/2}while(v<=f[y]&&--y>-1);y++,p[y]=_,f[y]=v,f[y+1]=ct}for(let _=0,y=0;_<s;_++){for(;f[y+1]<_;)y++;const v=p[y],T=_-v;a[t+_*n]=u[v]+T*T}}class $t{constructor(t,n){this.requestManager=t,this.localIdeographFontFamily=n,this.entries={}}setURL(t){this.url=t}getGlyphs(t,n){const s=[];for(const u in t)for(const p of t[u])s.push({stack:u,id:p});l.asyncAll(s,({stack:u,id:p},f)=>{let _=this.entries[u];_||(_=this.entries[u]={glyphs:{},requests:{},ranges:{}});let y=_.glyphs[p];if(y!==void 0)return void f(null,{stack:u,id:p,glyph:y});if(y=this._tinySDF(_,u,p),y)return _.glyphs[p]=y,void f(null,{stack:u,id:p,glyph:y});const v=Math.floor(p/256);if(256*v>65535)return void f(new Error("glyphs > 65535 not supported"));if(_.ranges[v])return void f(null,{stack:u,id:p,glyph:y});let T=_.requests[v];T||(T=_.requests[v]=[],$t.loadGlyphRange(u,v,this.url,this.requestManager,(I,C)=>{if(C){for(const F in C)this._doesCharSupportLocalGlyph(+F)||(_.glyphs[+F]=C[+F]);_.ranges[v]=!0}for(const F of T)F(I,C);delete _.requests[v]})),T.push((I,C)=>{I?f(I):C&&f(null,{stack:u,id:p,glyph:C[p]||null})})},(u,p)=>{if(u)n(u);else if(p){const f={};for(const{stack:_,id:y,glyph:v}of p)(f[_]||(f[_]={}))[y]=v&&{id:v.id,bitmap:v.bitmap.clone(),metrics:v.metrics};n(null,f)}})}_doesCharSupportLocalGlyph(t){return!!this.localIdeographFontFamily&&(l.unicodeBlockLookup["CJK Unified Ideographs"](t)||l.unicodeBlockLookup["Hangul Syllables"](t)||l.unicodeBlockLookup.Hiragana(t)||l.unicodeBlockLookup.Katakana(t))}_tinySDF(t,n,s){const u=this.localIdeographFontFamily;if(!u||!this._doesCharSupportLocalGlyph(s))return;let p=t.tinySDF;if(!p){let _="400";/bold/i.test(n)?_="900":/medium/i.test(n)?_="500":/light/i.test(n)&&(_="200"),p=t.tinySDF=new $t.TinySDF({fontSize:24,buffer:3,radius:8,cutoff:.25,fontFamily:u,fontWeight:_})}const f=p.draw(String.fromCharCode(s));return{id:s,bitmap:new l.AlphaImage({width:f.width||30,height:f.height||30},f.data),metrics:{width:f.glyphWidth||24,height:f.glyphHeight||24,left:f.glyphLeft||0,top:f.glyphTop-27||-8,advance:f.glyphAdvance||24}}}}$t.loadGlyphRange=function(a,t,n,s,u){const p=256*t,f=p+255,_=s.transformRequest(n.replace("{fontstack}",a).replace("{range}",`${p}-${f}`),l.ResourceType.Glyphs);l.getArrayBuffer(_,(y,v)=>{if(y)u(y);else if(v){const T={};for(const I of l.parseGlyphPbf(v))T[I.id]=I;u(null,T)}})},$t.TinySDF=class{constructor({fontSize:a=24,buffer:t=3,radius:n=8,cutoff:s=.25,fontFamily:u="sans-serif",fontWeight:p="normal",fontStyle:f="normal"}={}){this.buffer=t,this.cutoff=s,this.radius=n;const _=this.size=a+4*t,y=this._createCanvas(_),v=this.ctx=y.getContext("2d",{willReadFrequently:!0});v.font=`${f} ${p} ${a}px ${u}`,v.textBaseline="alphabetic",v.textAlign="left",v.fillStyle="black",this.gridOuter=new Float64Array(_*_),this.gridInner=new Float64Array(_*_),this.f=new Float64Array(_),this.z=new Float64Array(_+1),this.v=new Uint16Array(_)}_createCanvas(a){const t=document.createElement("canvas");return t.width=t.height=a,t}draw(a){const{width:t,actualBoundingBoxAscent:n,actualBoundingBoxDescent:s,actualBoundingBoxLeft:u,actualBoundingBoxRight:p}=this.ctx.measureText(a),f=Math.ceil(n),_=Math.min(this.size-this.buffer,Math.ceil(p-u)),y=Math.min(this.size-this.buffer,f+Math.ceil(s)),v=_+2*this.buffer,T=y+2*this.buffer,I=Math.max(v*T,0),C=new Uint8ClampedArray(I),F={data:C,width:v,height:T,glyphWidth:_,glyphHeight:y,glyphTop:f,glyphLeft:0,glyphAdvance:t};if(_===0||y===0)return F;const{ctx:R,buffer:B,gridInner:X,gridOuter:J}=this;R.clearRect(B,B,_,y),R.fillText(a,B,B+f);const te=R.getImageData(B,B,_,y);J.fill(ct,0,I),X.fill(0,0,I);for(let O=0;O<y;O++)for(let ne=0;ne<_;ne++){const ie=te.data[4*(O*_+ne)+3]/255;if(ie===0)continue;const ue=(O+B)*v+ne+B;if(ie===1)J[ue]=0,X[ue]=ct;else{const he=.5-ie;J[ue]=he>0?he*he:0,X[ue]=he<0?he*he:0}}vt(J,0,0,v,T,v,this.f,this.v,this.z),vt(X,B,B,_,y,v,this.f,this.v,this.z);for(let O=0;O<I;O++){const ne=Math.sqrt(J[O])-Math.sqrt(X[O]);C[O]=Math.round(255-255*(ne/this.radius+this.cutoff))}return F}};const Gi=new l.Properties({anchor:new l.DataConstantProperty(l.spec.light.anchor),position:new class{constructor(){this.specification=l.spec.light.position}possiblyEvaluate(a,t){return l.sphericalToCartesian(a.expression.evaluate(t))}interpolate(a,t,n){return{x:l.number(a.x,t.x,n),y:l.number(a.y,t.y,n),z:l.number(a.z,t.z,n)}}},color:new l.DataConstantProperty(l.spec.light.color),intensity:new l.DataConstantProperty(l.spec.light.intensity)}),Fi="-transition";class fi extends l.Evented{constructor(t){super(),this._transitionable=new l.Transitionable(Gi),this.setLight(t),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(t,n={}){if(!this._validate(l.validateLight,t,n))for(const s in t){const u=t[s];s.endsWith(Fi)?this._transitionable.setTransition(s.slice(0,-Fi.length),u):this._transitionable.setValue(s,u)}}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}_validate(t,n,s){return(!s||s.validate!==!1)&&l.emitValidationErrors(this,t.call(l.validateStyle,l.extend({value:n,style:{glyphs:!0,sprite:!0},styleSpec:l.spec})))}}class wo{constructor(t,n){this.width=t,this.height=n,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(t,n){const s=t.join(",")+String(n);return this.dashEntry[s]||(this.dashEntry[s]=this.addDash(t,n)),this.dashEntry[s]}getDashRanges(t,n,s){const u=[];let p=t.length%2==1?-t[t.length-1]*s:0,f=t[0]*s,_=!0;u.push({left:p,right:f,isDash:_,zeroLength:t[0]===0});let y=t[0];for(let v=1;v<t.length;v++){_=!_;const T=t[v];p=y*s,y+=T,f=y*s,u.push({left:p,right:f,isDash:_,zeroLength:T===0})}return u}addRoundDash(t,n,s){const u=n/2;for(let p=-s;p<=s;p++){const f=this.width*(this.nextRow+s+p);let _=0,y=t[_];for(let v=0;v<this.width;v++){v/y.right>1&&(y=t[++_]);const T=Math.abs(v-y.left),I=Math.abs(v-y.right),C=Math.min(T,I);let F;const R=p/s*(u+1);if(y.isDash){const B=u-Math.abs(R);F=Math.sqrt(C*C+B*B)}else F=u-Math.sqrt(C*C+R*R);this.data[f+v]=Math.max(0,Math.min(255,F+128))}}}addRegularDash(t){for(let _=t.length-1;_>=0;--_){const y=t[_],v=t[_+1];y.zeroLength?t.splice(_,1):v&&v.isDash===y.isDash&&(v.left=y.left,t.splice(_,1))}const n=t[0],s=t[t.length-1];n.isDash===s.isDash&&(n.left=s.left-this.width,s.right=n.right+this.width);const u=this.width*this.nextRow;let p=0,f=t[p];for(let _=0;_<this.width;_++){_/f.right>1&&(f=t[++p]);const y=Math.abs(_-f.left),v=Math.abs(_-f.right),T=Math.min(y,v);this.data[u+_]=Math.max(0,Math.min(255,(f.isDash?T:-T)+128))}}addDash(t,n){const s=n?7:0,u=2*s+1;if(this.nextRow+u>this.height)return l.warnOnce("LineAtlas out of space"),null;let p=0;for(let _=0;_<t.length;_++)p+=t[_];if(p!==0){const _=this.width/p,y=this.getDashRanges(t,this.width,_);n?this.addRoundDash(y,_,s):this.addRegularDash(y)}const f={y:(this.nextRow+s+.5)/this.height,height:2*s/this.height,width:p};return this.nextRow+=u,this.dirty=!0,f}bind(t){const n=t.gl;this.texture?(n.bindTexture(n.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,n.texSubImage2D(n.TEXTURE_2D,0,0,0,this.width,this.height,n.ALPHA,n.UNSIGNED_BYTE,this.data))):(this.texture=n.createTexture(),n.bindTexture(n.TEXTURE_2D,this.texture),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.REPEAT),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.REPEAT),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.LINEAR),n.texImage2D(n.TEXTURE_2D,0,n.ALPHA,this.width,this.height,0,n.ALPHA,n.UNSIGNED_BYTE,this.data))}}class lr{constructor(t,n){this.workerPool=t,this.actors=[],this.currentActor=0,this.id=l.uniqueId();const s=this.workerPool.acquire(this.id);for(let u=0;u<s.length;u++){const p=new lr.Actor(s[u],n,this.id);p.name=`Worker ${u}`,this.actors.push(p)}if(!this.actors.length)throw new Error("No actors found")}broadcast(t,n,s){l.asyncAll(this.actors,(u,p)=>{u.send(t,n,p)},s=s||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(){this.actors.forEach(t=>{t.remove()}),this.actors=[],this.workerPool.release(this.id)}}function Gr(a,t,n){const s=function(u,p){if(u)return n(u);if(p){const f=l.pick(l.extend(p,a),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);p.vector_layers&&(f.vectorLayers=p.vector_layers,f.vectorLayerIds=f.vectorLayers.map(_=>_.id)),n(null,f)}};return a.url?l.getJSON(t.transformRequest(a.url,l.ResourceType.Source),s):l.exported.frame(()=>s(null,a))}lr.Actor=l.Actor;class cr{constructor(t,n,s){this.bounds=l.LngLatBounds.convert(this.validateBounds(t)),this.minzoom=n||0,this.maxzoom=s||24}validateBounds(t){return Array.isArray(t)&&t.length===4?[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){const n=Math.pow(2,t.z),s=Math.floor(l.mercatorXfromLng(this.bounds.getWest())*n),u=Math.floor(l.mercatorYfromLat(this.bounds.getNorth())*n),p=Math.ceil(l.mercatorXfromLng(this.bounds.getEast())*n),f=Math.ceil(l.mercatorYfromLat(this.bounds.getSouth())*n);return t.x>=s&&t.x<p&&t.y>=u&&t.y<f}}class un extends l.Evented{constructor(t,n,s,u){if(super(),this.id=t,this.dispatcher=s,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,l.extend(this,l.pick(n,["url","scheme","tileSize","promoteId"])),this._options=l.extend({type:"vector"},n),this._collectResourceTiming=n.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(u)}load(){this._loaded=!1,this.fire(new l.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=Gr(this._options,this.map._requestManager,(t,n)=>{this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),t?this.fire(new l.ErrorEvent(t)):n&&(l.extend(this,n),n.bounds&&(this.tileBounds=new cr(n.bounds,this.minzoom,this.maxzoom)),this.fire(new l.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new l.Event("data",{dataType:"source",sourceDataType:"content"})))})}loaded(){return this._loaded}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}onAdd(t){this.map=t,this.load()}setSourceProperty(t){this._tileJSONRequest&&this._tileJSONRequest.cancel(),t(),this.load()}setTiles(t){return this.setSourceProperty(()=>{this._options.tiles=t}),this}setUrl(t){return this.setSourceProperty(()=>{this.url=t,this._options.url=t}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return l.extend({},this._options)}loadTile(t,n){const s=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),u={request:this.map._requestManager.transformRequest(s,l.ResourceType.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};function p(f,_){return delete t.request,t.aborted?n(null):f&&f.status!==404?n(f):(_&&_.resourceTiming&&(t.resourceTiming=_.resourceTiming),this.map._refreshExpiredTiles&&_&&t.setExpiryData(_),t.loadVectorData(_,this.map.painter),l.cacheEntryPossiblyAdded(this.dispatcher),n(null),void(t.reloadCallback&&(this.loadTile(t,t.reloadCallback),t.reloadCallback=null)))}u.request.collectResourceTiming=this._collectResourceTiming,t.actor&&t.state!=="expired"?t.state==="loading"?t.reloadCallback=n:t.request=t.actor.send("reloadTile",u,p.bind(this)):(t.actor=this.dispatcher.getActor(),t.request=t.actor.send("loadTile",u,p.bind(this)))}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.actor&&t.actor.send("abortTile",{uid:t.uid,type:this.type,source:this.id},void 0)}unloadTile(t){t.unloadVectorData(),t.actor&&t.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id},void 0)}hasTransition(){return!1}}class Er extends l.Evented{constructor(t,n,s,u){super(),this.id=t,this.dispatcher=s,this.setEventedParent(u),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=l.extend({type:"raster"},n),l.extend(this,l.pick(n,["url","scheme","tileSize"]))}load(){this._loaded=!1,this.fire(new l.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=Gr(this._options,this.map._requestManager,(t,n)=>{this._tileJSONRequest=null,this._loaded=!0,t?this.fire(new l.ErrorEvent(t)):n&&(l.extend(this,n),n.bounds&&(this.tileBounds=new cr(n.bounds,this.minzoom,this.maxzoom)),this.fire(new l.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new l.Event("data",{dataType:"source",sourceDataType:"content"})))})}loaded(){return this._loaded}onAdd(t){this.map=t,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return l.extend({},this._options)}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}loadTile(t,n){const s=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);t.request=l.getImage(this.map._requestManager.transformRequest(s,l.ResourceType.Tile),(u,p,f)=>{if(delete t.request,t.aborted)t.state="unloaded",n(null);else if(u)t.state="errored",n(u);else if(p){this.map._refreshExpiredTiles&&t.setExpiryData(f);const _=this.map.painter.context,y=_.gl;t.texture=this.map.painter.getTileTexture(p.width),t.texture?t.texture.update(p,{useMipmap:!0}):(t.texture=new He(_,p,y.RGBA,{useMipmap:!0}),t.texture.bind(y.LINEAR,y.CLAMP_TO_EDGE,y.LINEAR_MIPMAP_NEAREST),_.extTextureFilterAnisotropic&&y.texParameterf(y.TEXTURE_2D,_.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,_.extTextureFilterAnisotropicMax)),t.state="loaded",l.cacheEntryPossiblyAdded(this.dispatcher),n(null)}})}abortTile(t,n){t.request&&(t.request.cancel(),delete t.request),n()}unloadTile(t,n){t.texture&&this.map.painter.saveTileTexture(t.texture),n()}hasTransition(){return!1}}let Sr;class We extends Er{constructor(t,n,s,u){super(t,n,s,u),this.type="raster-dem",this.maxzoom=22,this._options=l.extend({type:"raster-dem"},n),this.encoding=n.encoding||"mapbox"}serialize(){return{type:"raster-dem",url:this.url,tileSize:this.tileSize,tiles:this.tiles,bounds:this.bounds,encoding:this.encoding}}loadTile(t,n){const s=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);function u(p,f){p&&(t.state="errored",n(p)),f&&(t.dem=f,t.needsHillshadePrepare=!0,t.needsTerrainPrepare=!0,t.state="loaded",n(null))}t.request=l.getImage(this.map._requestManager.transformRequest(s,l.ResourceType.Tile),function(p,f){if(delete t.request,t.aborted)t.state="unloaded",n(null);else if(p)t.state="errored",n(p);else if(f){this.map._refreshExpiredTiles&&t.setExpiryData(f),delete f.cacheControl,delete f.expires;const _=l.isImageBitmap(f)&&(Sr==null&&(Sr=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),Sr)?f:l.exported.getImageData(f,1),y={uid:t.uid,coord:t.tileID,source:this.id,rawImageData:_,encoding:this.encoding};t.actor&&t.state!=="expired"||(t.actor=this.dispatcher.getActor(),t.actor.send("loadDEMTile",y,u.bind(this)))}}.bind(this)),t.neighboringTiles=this._getNeighboringTiles(t.tileID)}_getNeighboringTiles(t){const n=t.canonical,s=Math.pow(2,n.z),u=(n.x-1+s)%s,p=n.x===0?t.wrap-1:t.wrap,f=(n.x+1+s)%s,_=n.x+1===s?t.wrap+1:t.wrap,y={};return y[new l.OverscaledTileID(t.overscaledZ,p,n.z,u,n.y).key]={backfilled:!1},y[new l.OverscaledTileID(t.overscaledZ,_,n.z,f,n.y).key]={backfilled:!1},n.y>0&&(y[new l.OverscaledTileID(t.overscaledZ,p,n.z,u,n.y-1).key]={backfilled:!1},y[new l.OverscaledTileID(t.overscaledZ,t.wrap,n.z,n.x,n.y-1).key]={backfilled:!1},y[new l.OverscaledTileID(t.overscaledZ,_,n.z,f,n.y-1).key]={backfilled:!1}),n.y+1<s&&(y[new l.OverscaledTileID(t.overscaledZ,p,n.z,u,n.y+1).key]={backfilled:!1},y[new l.OverscaledTileID(t.overscaledZ,t.wrap,n.z,n.x,n.y+1).key]={backfilled:!1},y[new l.OverscaledTileID(t.overscaledZ,_,n.z,f,n.y+1).key]={backfilled:!1}),y}unloadTile(t){t.demTexture&&this.map.painter.saveTileTexture(t.demTexture),t.fbo&&(t.fbo.destroy(),delete t.fbo),t.dem&&delete t.dem,delete t.neighboringTiles,t.state="unloaded",t.actor&&t.actor.send("removeDEMTile",{uid:t.uid,source:this.id})}}class ur extends l.Evented{constructor(t,n,s,u){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._pendingLoads=0,this.actor=s.getActor(),this.setEventedParent(u),this._data=n.data,this._options=l.extend({},n),this._collectResourceTiming=n.collectResourceTiming,n.maxzoom!==void 0&&(this.maxzoom=n.maxzoom),n.type&&(this.type=n.type),n.attribution&&(this.attribution=n.attribution),this.promoteId=n.promoteId;const p=l.EXTENT/this.tileSize;this.workerOptions=l.extend({source:this.id,cluster:n.cluster||!1,geojsonVtOptions:{buffer:(n.buffer!==void 0?n.buffer:128)*p,tolerance:(n.tolerance!==void 0?n.tolerance:.375)*p,extent:l.EXTENT,maxZoom:this.maxzoom,lineMetrics:n.lineMetrics||!1,generateId:n.generateId||!1},superclusterOptions:{maxZoom:n.clusterMaxZoom!==void 0?n.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,n.clusterMinPoints||2),extent:l.EXTENT,radius:(n.clusterRadius||50)*p,log:!1,generateId:n.generateId||!1},clusterProperties:n.clusterProperties,filter:n.filter},n.workerOptions)}load(){this._updateWorkerData("metadata")}onAdd(t){this.map=t,this.load()}setData(t){return this._data=t,this._updateWorkerData("content"),this}getClusterExpansionZoom(t,n){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:t,source:this.id},n),this}getClusterChildren(t,n){return this.actor.send("geojson.getClusterChildren",{clusterId:t,source:this.id},n),this}getClusterLeaves(t,n,s,u){return this.actor.send("geojson.getClusterLeaves",{source:this.id,clusterId:t,limit:n,offset:s},u),this}_updateWorkerData(t){const n=l.extend({},this.workerOptions),s=this._data;typeof s=="string"?(n.request=this.map._requestManager.transformRequest(l.exported.resolveURL(s),l.ResourceType.Source),n.request.collectResourceTiming=this._collectResourceTiming):n.data=JSON.stringify(s),this._pendingLoads++,this.fire(new l.Event("dataloading",{dataType:"source"})),this.actor.send(`${this.type}.loadData`,n,(u,p)=>{if(this._pendingLoads--,this._removed||p&&p.abandoned)return void this.fire(new l.Event("dataabort",{dataType:"source",sourceDataType:t}));let f=null;if(p&&p.resourceTiming&&p.resourceTiming[this.id]&&(f=p.resourceTiming[this.id].slice(0)),u)return void this.fire(new l.ErrorEvent(u));const _={dataType:"source",sourceDataType:t};this._collectResourceTiming&&f&&f.length>0&&l.extend(_,{resourceTiming:f}),this.fire(new l.Event("data",_))})}loaded(){return this._pendingLoads===0}loadTile(t,n){const s=t.actor?"reloadTile":"loadTile";t.actor=this.actor;const u={type:this.type,uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};t.request=this.actor.send(s,u,(p,f)=>(delete t.request,t.unloadVectorData(),t.aborted?n(null):p?n(p):(t.loadVectorData(f,this.map.painter,s==="reloadTile"),n(null))))}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.aborted=!0}unloadTile(t){t.unloadVectorData(),this.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id})}onRemove(){this._removed=!0,this.actor.send("removeSource",{type:this.type,source:this.id})}serialize(){return l.extend({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var hr=l.createLayout([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class qi extends l.Evented{constructor(t,n,s,u){super(),this.id=t,this.dispatcher=s,this.coordinates=n.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(u),this.options=n}load(t,n){this._loaded=!1,this.fire(new l.Event("dataloading",{dataType:"source"})),this.url=this.options.url,l.getImage(this.map._requestManager.transformRequest(this.url,l.ResourceType.Image),(s,u)=>{this._loaded=!0,s?this.fire(new l.ErrorEvent(s)):u&&(this.image=u,t&&(this.coordinates=t),n&&n(),this._finishLoading())})}loaded(){return this._loaded}updateImage(t){return this.image&&t.url?(this.options.url=t.url,this.load(t.coordinates,()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new l.Event("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(t){this.map=t,this.load()}setCoordinates(t){this.coordinates=t;const n=t.map(l.MercatorCoordinate.fromLngLat);this.tileID=function(u){let p=1/0,f=1/0,_=-1/0,y=-1/0;for(const C of u)p=Math.min(p,C.x),f=Math.min(f,C.y),_=Math.max(_,C.x),y=Math.max(y,C.y);const v=Math.max(_-p,y-f),T=Math.max(0,Math.floor(-Math.log(v)/Math.LN2)),I=Math.pow(2,T);return new l.CanonicalTileID(T,Math.floor((p+_)/2*I),Math.floor((f+y)/2*I))}(n),this.minzoom=this.maxzoom=this.tileID.z;const s=n.map(u=>this.tileID.getTilePoint(u)._round());return this._boundsArray=new l.RasterBoundsArray,this._boundsArray.emplaceBack(s[0].x,s[0].y,0,0),this._boundsArray.emplaceBack(s[1].x,s[1].y,l.EXTENT,0),this._boundsArray.emplaceBack(s[3].x,s[3].y,0,l.EXTENT),this._boundsArray.emplaceBack(s[2].x,s[2].y,l.EXTENT,l.EXTENT),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new l.Event("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;const t=this.map.painter.context,n=t.gl;this.boundsBuffer||(this.boundsBuffer=t.createVertexBuffer(this._boundsArray,hr.members)),this.boundsSegments||(this.boundsSegments=l.SegmentVector.simpleSegment(0,0,4,2)),this.texture||(this.texture=new He(t,this.image,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));for(const s in this.tiles){const u=this.tiles[s];u.state!=="loaded"&&(u.state="loaded",u.texture=this.texture)}}loadTile(t,n){this.tileID&&this.tileID.equals(t.tileID.canonical)?(this.tiles[String(t.tileID.wrap)]=t,t.buckets={},n(null)):(t.state="errored",n(null))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class Zi extends qi{constructor(t,n,s,u){super(t,n,s,u),this.roundZoom=!0,this.type="video",this.options=n}load(){this._loaded=!1;const t=this.options;this.urls=[];for(const n of t.urls)this.urls.push(this.map._requestManager.transformRequest(n,l.ResourceType.Source).url);l.getVideo(this.urls,(n,s)=>{this._loaded=!0,n?this.fire(new l.ErrorEvent(n)):s&&(this.video=s,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading())})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(t){if(this.video){const n=this.video.seekable;t<n.start(0)||t>n.end(0)?this.fire(new l.ErrorEvent(new l.ValidationError(`sources.${this.id}`,null,`Playback for this video can be set only between the ${n.start(0)} and ${n.end(0)}-second mark.`))):this.video.currentTime=t}}getVideo(){return this.video}onAdd(t){this.map||(this.map=t,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const t=this.map.painter.context,n=t.gl;this.boundsBuffer||(this.boundsBuffer=t.createVertexBuffer(this._boundsArray,hr.members)),this.boundsSegments||(this.boundsSegments=l.SegmentVector.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE),n.texSubImage2D(n.TEXTURE_2D,0,0,0,n.RGBA,n.UNSIGNED_BYTE,this.video)):(this.texture=new He(t,this.video,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));for(const s in this.tiles){const u=this.tiles[s];u.state!=="loaded"&&(u.state="loaded",u.texture=this.texture)}}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class qr extends qi{constructor(t,n,s,u){super(t,n,s,u),n.coordinates?Array.isArray(n.coordinates)&&n.coordinates.length===4&&!n.coordinates.some(p=>!Array.isArray(p)||p.length!==2||p.some(f=>typeof f!="number"))||this.fire(new l.ErrorEvent(new l.ValidationError(`sources.${t}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new l.ErrorEvent(new l.ValidationError(`sources.${t}`,null,'missing required property "coordinates"'))),n.animate&&typeof n.animate!="boolean"&&this.fire(new l.ErrorEvent(new l.ValidationError(`sources.${t}`,null,'optional "animate" property must be a boolean value'))),n.canvas?typeof n.canvas=="string"||n.canvas instanceof HTMLCanvasElement||this.fire(new l.ErrorEvent(new l.ValidationError(`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 l.ErrorEvent(new l.ValidationError(`sources.${t}`,null,'missing required property "canvas"'))),this.options=n,this.animate=n.animate===void 0||n.animate}load(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new l.ErrorEvent(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())}getCanvas(){return this.canvas}onAdd(t){this.map=t,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let 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()||Object.keys(this.tiles).length===0)return;const n=this.map.painter.context,s=n.gl;this.boundsBuffer||(this.boundsBuffer=n.createVertexBuffer(this._boundsArray,hr.members)),this.boundsSegments||(this.boundsSegments=l.SegmentVector.simpleSegment(0,0,4,2)),this.texture?(t||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new He(n,this.canvas,s.RGBA,{premultiply:!0});for(const u in this.tiles){const p=this.tiles[u];p.state!=="loaded"&&(p.state="loaded",p.texture=this.texture)}}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const t of[this.canvas.width,this.canvas.height])if(isNaN(t)||t<=0)return!0;return!1}}const hn={vector:un,raster:Er,"raster-dem":We,geojson:ur,video:Zi,image:qi,canvas:qr};function pn(a,t){const n=l.create();return l.translate(n,n,[1,1,0]),l.scale(n,n,[.5*a.width,.5*a.height,1]),l.multiply(n,n,a.calculatePosMatrix(t.toUnwrapped()))}function dn(a,t,n,s,u,p){const f=function(I,C,F){if(I)for(const R of I){const B=C[R];if(B&&B.source===F&&B.type==="fill-extrusion")return!0}else for(const R in C){const B=C[R];if(B.source===F&&B.type==="fill-extrusion")return!0}return!1}(u&&u.layers,t,a.id),_=p.maxPitchScaleFactor(),y=a.tilesIn(s,_,f);y.sort(Qi);const v=[];for(const I of y)v.push({wrappedTileID:I.tileID.wrapped().key,queryResults:I.tile.queryRenderedFeatures(t,n,a._state,I.queryGeometry,I.cameraQueryGeometry,I.scale,u,p,_,pn(a.transform,I.tileID))});const T=function(I){const C={},F={};for(const R of I){const B=R.queryResults,X=R.wrappedTileID,J=F[X]=F[X]||{};for(const te in B){const O=B[te],ne=J[te]=J[te]||{},ie=C[te]=C[te]||[];for(const ue of O)ne[ue.featureIndex]||(ne[ue.featureIndex]=!0,ie.push(ue))}}return C}(v);for(const I in T)T[I].forEach(C=>{const F=C.feature,R=a.getFeatureState(F.layer["source-layer"],F.id);F.source=F.layer.source,F.layer["source-layer"]&&(F.sourceLayer=F.layer["source-layer"]),F.state=R});return T}function Qi(a,t){const n=a.tileID,s=t.tileID;return n.overscaledZ-s.overscaledZ||n.canonical.y-s.canonical.y||n.wrap-s.wrap||n.canonical.x-s.canonical.x}class Ir{constructor(t,n){this.tileID=t,this.uid=l.uniqueId(),this.uses=0,this.tileSize=n,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.textures=[],this.textureCoords={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(t){const n=t+this.timeAdded;n<l.exported.now()||this.fadeEndTime&&n<this.fadeEndTime||(this.fadeEndTime=n)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}clearTextures(t){this.demTexture&&t.saveTileTexture(this.demTexture),this.textures.forEach(n=>t.saveTileTexture(n)),this.demTexture=null,this.textures=[],this.textureCoords={}}loadVectorData(t,n,s){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",t){t.featureIndex&&(this.latestFeatureIndex=t.featureIndex,t.rawTileData?(this.latestRawTileData=t.rawTileData,this.latestFeatureIndex.rawTileData=t.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=t.collisionBoxArray,this.buckets=function(u,p){const f={};if(!p)return f;for(const _ of u){const y=_.layerIds.map(v=>p.getLayer(v)).filter(Boolean);if(y.length!==0){_.layers=y,_.stateDependentLayerIds&&(_.stateDependentLayers=_.stateDependentLayerIds.map(v=>y.filter(T=>T.id===v)[0]));for(const v of y)f[v.id]=_}}return f}(t.buckets,n.style),this.hasSymbolBuckets=!1;for(const u in this.buckets){const p=this.buckets[u];if(p instanceof l.SymbolBucket){if(this.hasSymbolBuckets=!0,!s)break;p.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const u in this.buckets){const p=this.buckets[u];if(p instanceof l.SymbolBucket&&p.hasRTLText){this.hasRTLText=!0,l.lazyLoadRTLTextPlugin();break}}this.queryPadding=0;for(const u in this.buckets){const p=this.buckets[u];this.queryPadding=Math.max(this.queryPadding,n.style.getLayer(u).queryRadius(p))}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage)}else this.collisionBoxArray=new l.CollisionBoxArray}unloadVectorData(){for(const t in this.buckets)this.buckets[t].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(t){return this.buckets[t.id]}upload(t){for(const s in this.buckets){const u=this.buckets[s];u.uploadPending()&&u.upload(t)}const n=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new He(t,this.imageAtlas.image,n.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new He(t,this.glyphAtlasImage,n.ALPHA),this.glyphAtlasImage=null)}prepare(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture)}queryRenderedFeatures(t,n,s,u,p,f,_,y,v,T){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:u,cameraQueryGeometry:p,scale:f,tileSize:this.tileSize,pixelPosMatrix:T,transform:y,params:_,queryPadding:this.queryPadding*v},t,n,s):{}}querySourceFeatures(t,n){const s=this.latestFeatureIndex;if(!s||!s.rawTileData)return;const u=s.loadVTLayers(),p=n?n.sourceLayer:"",f=u._geojsonTileLayer||u[p];if(!f)return;const _=l.createFilter(n&&n.filter),{z:y,x:v,y:T}=this.tileID.canonical,I={z:y,x:v,y:T};for(let C=0;C<f.length;C++){const F=f.feature(C);if(_.needGeometry){const X=l.toEvaluationFeature(F,!0);if(!_.filter(new l.EvaluationParameters(this.tileID.overscaledZ),X,this.tileID.canonical))continue}else if(!_.filter(new l.EvaluationParameters(this.tileID.overscaledZ),F))continue;const R=s.getId(F,p),B=new l.GeoJSONFeature(F,y,v,T,R);B.tile=I,t.push(B)}}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(t){const n=this.expirationTime;if(t.cacheControl){const s=l.parseCacheControl(t.cacheControl);s["max-age"]&&(this.expirationTime=Date.now()+1e3*s["max-age"])}else t.expires&&(this.expirationTime=new Date(t.expires).getTime());if(this.expirationTime){const s=Date.now();let u=!1;if(this.expirationTime>s)u=!1;else if(n)if(this.expirationTime<n)u=!0;else{const p=this.expirationTime-n;p?this.expirationTime=s+Math.max(p,3e4):u=!0}else u=!0;u?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-new Date().getTime(),Math.pow(2,31)-1)}setFeatureState(t,n){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||Object.keys(t).length===0)return;const s=this.latestFeatureIndex.loadVTLayers();for(const u in this.buckets){if(!n.style.hasLayer(u))continue;const p=this.buckets[u],f=p.layers[0].sourceLayer||"_geojsonTileLayer",_=s[f],y=t[f];if(!_||!y||Object.keys(y).length===0)continue;p.update(y,_,this.imageAtlas&&this.imageAtlas.patternPositions||{});const v=n&&n.style&&n.style.getLayer(u);v&&(this.queryPadding=Math.max(this.queryPadding,v.queryRadius(p)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<l.exported.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(t){this.symbolFadeHoldUntil=l.exported.now()+t}setDependencies(t,n){const s={};for(const u of n)s[u]=!0;this.dependencies[t]=s}hasDependency(t,n){for(const s of t){const u=this.dependencies[s];if(u){for(const p of n)if(u[p])return!0}}return!1}}class Ar{constructor(t,n){this.max=t,this.onRemove=n,this.reset()}reset(){for(const t in this.data)for(const n of this.data[t])n.timeout&&clearTimeout(n.timeout),this.onRemove(n.value);return this.data={},this.order=[],this}add(t,n,s){const u=t.wrapped().key;this.data[u]===void 0&&(this.data[u]=[]);const p={value:n,timeout:void 0};if(s!==void 0&&(p.timeout=setTimeout(()=>{this.remove(t,p)},s)),this.data[u].push(p),this.order.push(u),this.order.length>this.max){const f=this._getAndRemoveByKey(this.order[0]);f&&this.onRemove(f)}return this}has(t){return t.wrapped().key in this.data}getAndRemove(t){return this.has(t)?this._getAndRemoveByKey(t.wrapped().key):null}_getAndRemoveByKey(t){const n=this.data[t].shift();return n.timeout&&clearTimeout(n.timeout),this.data[t].length===0&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),n.value}getByKey(t){const n=this.data[t];return n?n[0].value:null}get(t){return this.has(t)?this.data[t.wrapped().key][0].value:null}remove(t,n){if(!this.has(t))return this;const s=t.wrapped().key,u=n===void 0?0:this.data[s].indexOf(n),p=this.data[s][u];return this.data[s].splice(u,1),p.timeout&&clearTimeout(p.timeout),this.data[s].length===0&&delete this.data[s],this.onRemove(p.value),this.order.splice(this.order.indexOf(s),1),this}setMaxSize(t){for(this.max=t;this.order.length>this.max;){const n=this._getAndRemoveByKey(this.order[0]);n&&this.onRemove(n)}return this}filter(t){const n=[];for(const s in this.data)for(const u of this.data[s])t(u.value)||n.push(u);for(const s of n)this.remove(s.value.tileID,s)}}class Cr{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(t,n,s){const u=String(n);if(this.stateChanges[t]=this.stateChanges[t]||{},this.stateChanges[t][u]=this.stateChanges[t][u]||{},l.extend(this.stateChanges[t][u],s),this.deletedStates[t]===null){this.deletedStates[t]={};for(const p in this.state[t])p!==u&&(this.deletedStates[t][p]=null)}else if(this.deletedStates[t]&&this.deletedStates[t][u]===null){this.deletedStates[t][u]={};for(const p in this.state[t][u])s[p]||(this.deletedStates[t][u][p]=null)}else for(const p in s)this.deletedStates[t]&&this.deletedStates[t][u]&&this.deletedStates[t][u][p]===null&&delete this.deletedStates[t][u][p]}removeFeatureState(t,n,s){if(this.deletedStates[t]===null)return;const u=String(n);if(this.deletedStates[t]=this.deletedStates[t]||{},s&&n!==void 0)this.deletedStates[t][u]!==null&&(this.deletedStates[t][u]=this.deletedStates[t][u]||{},this.deletedStates[t][u][s]=null);else if(n!==void 0)if(this.stateChanges[t]&&this.stateChanges[t][u])for(s in this.deletedStates[t][u]={},this.stateChanges[t][u])this.deletedStates[t][u][s]=null;else this.deletedStates[t][u]=null;else this.deletedStates[t]=null}getState(t,n){const s=String(n),u=l.extend({},(this.state[t]||{})[s],(this.stateChanges[t]||{})[s]);if(this.deletedStates[t]===null)return{};if(this.deletedStates[t]){const p=this.deletedStates[t][n];if(p===null)return{};for(const f in p)delete u[f]}return u}initializeTileState(t,n){t.setFeatureState(this.state,n)}coalesceChanges(t,n){const s={};for(const u in this.stateChanges){this.state[u]=this.state[u]||{};const p={};for(const f in this.stateChanges[u])this.state[u][f]||(this.state[u][f]={}),l.extend(this.state[u][f],this.stateChanges[u][f]),p[f]=this.state[u][f];s[u]=p}for(const u in this.deletedStates){this.state[u]=this.state[u]||{};const p={};if(this.deletedStates[u]===null)for(const f in this.state[u])p[f]={},this.state[u][f]={};else for(const f in this.deletedStates[u]){if(this.deletedStates[u][f]===null)this.state[u][f]={};else for(const _ of Object.keys(this.deletedStates[u][f]))delete this.state[u][f][_];p[f]=this.state[u][f]}s[u]=s[u]||{},l.extend(s[u],p)}if(this.stateChanges={},this.deletedStates={},Object.keys(s).length!==0)for(const u in t)t[u].setFeatureState(s,n)}}class xi extends l.Evented{constructor(t,n,s){super(),this.id=t,this.dispatcher=s,this.on("data",u=>{u.dataType==="source"&&u.sourceDataType==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&u.dataType==="source"&&u.sourceDataType==="content"&&(this.reload(),this.transform&&this.update(this.transform,this.terrain))}),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=function(u,p,f,_){const y=new hn[p.type](u,p,f,_);if(y.id!==u)throw new Error(`Expected Source id to be ${u} instead of ${y.id}`);return l.bindAll(["load","abort","unload","serialize","prepare"],y),y}(t,n,s,this),this._tiles={},this._cache=new Ar(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new Cr}onAdd(t){this.map=t,this._maxTileCacheSize=t?t._maxTileCacheSize:null,this._source&&this._source.onAdd&&this._source.onAdd(t)}onRemove(t){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(t)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;for(const t in this._tiles){const n=this._tiles[t];if(n.state!=="loaded"&&n.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const t=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,t&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(t,n){return this._source.loadTile(t,n)}_unloadTile(t){if(this._source.unloadTile)return this._source.unloadTile(t,()=>{})}_abortTile(t){this._source.abortTile&&this._source.abortTile(t,()=>{}),this._source.fire(new l.Event("dataabort",{tile:t,coord:t.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(t){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const n in this._tiles){const s=this._tiles[n];s.upload(t),s.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(t=>t.tileID).sort(fn).map(t=>t.key)}getRenderableIds(t){const n=[];for(const s in this._tiles)this._isIdRenderable(s,t)&&n.push(this._tiles[s]);return t?n.sort((s,u)=>{const p=s.tileID,f=u.tileID,_=new l.pointGeometry(p.canonical.x,p.canonical.y)._rotate(this.transform.angle),y=new l.pointGeometry(f.canonical.x,f.canonical.y)._rotate(this.transform.angle);return p.overscaledZ-f.overscaledZ||y.y-_.y||y.x-_.x}).map(s=>s.tileID.key):n.map(s=>s.tileID).sort(fn).map(s=>s.key)}hasRenderableParent(t){const n=this.findLoadedParent(t,0);return!!n&&this._isIdRenderable(n.tileID.key)}_isIdRenderable(t,n){return this._tiles[t]&&this._tiles[t].hasData()&&!this._coveredTiles[t]&&(n||!this._tiles[t].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const t in this._tiles)this._tiles[t].state!=="errored"&&this._reloadTile(t,"reloading")}}_reloadTile(t,n){const s=this._tiles[t];s&&(s.state!=="loading"&&(s.state=n),this._loadTile(s,this._tileLoaded.bind(this,s,t,n)))}_tileLoaded(t,n,s,u){if(u)return t.state="errored",void(u.status!==404?this._source.fire(new l.ErrorEvent(u,{tile:t})):this.update(this.transform,this.terrain));t.timeAdded=l.exported.now(),s==="expired"&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(n,t),this.getSource().type==="raster-dem"&&t.dem&&this._backfillDEM(t),this._state.initializeTileState(t,this.map?this.map.painter:null),t.aborted||this._source.fire(new l.Event("data",{dataType:"source",tile:t,coord:t.tileID}))}_backfillDEM(t){const n=this.getRenderableIds();for(let u=0;u<n.length;u++){const p=n[u];if(t.neighboringTiles&&t.neighboringTiles[p]){const f=this.getTileByID(p);s(t,f),s(f,t)}}function s(u,p){u.needsHillshadePrepare=!0,u.needsTerrainPrepare=!0;let f=p.tileID.canonical.x-u.tileID.canonical.x;const _=p.tileID.canonical.y-u.tileID.canonical.y,y=Math.pow(2,u.tileID.canonical.z),v=p.tileID.key;f===0&&_===0||Math.abs(_)>1||(Math.abs(f)>1&&(Math.abs(f+y)===1?f+=y:Math.abs(f-y)===1&&(f-=y)),p.dem&&u.dem&&(u.dem.backfillBorder(p.dem,f,_),u.neighboringTiles&&u.neighboringTiles[v]&&(u.neighboringTiles[v].backfilled=!0)))}}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._tiles[t]}_retainLoadedChildren(t,n,s,u){for(const p in this._tiles){let f=this._tiles[p];if(u[p]||!f.hasData()||f.tileID.overscaledZ<=n||f.tileID.overscaledZ>s)continue;let _=f.tileID;for(;f&&f.tileID.overscaledZ>n+1;){const v=f.tileID.scaledTo(f.tileID.overscaledZ-1);f=this._tiles[v.key],f&&f.hasData()&&(_=v)}let y=_;for(;y.overscaledZ>n;)if(y=y.scaledTo(y.overscaledZ-1),t[y.key]){u[_.key]=_;break}}}findLoadedParent(t,n){if(t.key in this._loadedParentTiles){const s=this._loadedParentTiles[t.key];return s&&s.tileID.overscaledZ>=n?s:null}for(let s=t.overscaledZ-1;s>=n;s--){const u=t.scaledTo(s),p=this._getLoadedTile(u);if(p)return p}}_getLoadedTile(t){const n=this._tiles[t.key];return n&&n.hasData()?n:this._cache.getByKey(t.wrapped().key)}updateCacheSize(t){const n=Math.ceil(t.width/this._source.tileSize)+1,s=Math.ceil(t.height/this._source.tileSize)+1,u=Math.floor(n*s*5),p=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,u):u;this._cache.setMaxSize(p)}handleWrapJump(t){const n=Math.round((t-(this._prevLng===void 0?t:this._prevLng))/360);if(this._prevLng=t,n){const s={};for(const u in this._tiles){const p=this._tiles[u];p.tileID=p.tileID.unwrapTo(p.tileID.wrap+n),s[p.tileID.key]=p}this._tiles=s;for(const u in this._timers)clearTimeout(this._timers[u]),delete this._timers[u];for(const u in this._tiles)this._setTileReloadTimer(u,this._tiles[u])}}update(t,n){if(this.transform=t,this.terrain=n,!this._sourceLoaded||this._paused)return;let s;this.updateCacheSize(t),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?s=t.getVisibleUnwrappedCoordinates(this._source.tileID).map(v=>new l.OverscaledTileID(v.canonical.z,v.wrap,v.canonical.z,v.canonical.x,v.canonical.y)):(s=t.coveringTiles({tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:n}),this._source.hasTile&&(s=s.filter(v=>this._source.hasTile(v)))):s=[];const u=t.coveringZoomLevel(this._source),p=Math.max(u-xi.maxOverzooming,this._source.minzoom),f=Math.max(u+xi.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const v={};for(const T of s)if(T.canonical.z>this._source.minzoom){const I=T.scaledTo(T.canonical.z-1);v[I.key]=I;const C=T.scaledTo(Math.max(this._source.minzoom,Math.min(T.canonical.z,5)));v[C.key]=C}s=s.concat(Object.values(v))}const _=this._updateRetainedTiles(s,u);if($n(this._source.type)){const v={},T={},I=Object.keys(_);for(const C of I){const F=_[C],R=this._tiles[C];if(!R||R.fadeEndTime&&R.fadeEndTime<=l.exported.now())continue;const B=this.findLoadedParent(F,p);B&&(this._addTile(B.tileID),v[B.tileID.key]=B.tileID),T[C]=F}this._retainLoadedChildren(T,u,f,_);for(const C in v)_[C]||(this._coveredTiles[C]=!0,_[C]=v[C]);if(n){const C={},F={};for(const R of s)this._tiles[R.key].hasData()?C[R.key]=R:F[R.key]=R;for(const R in F){const B=F[R].children(this._source.maxzoom);this._tiles[B[0].key]&&this._tiles[B[1].key]&&this._tiles[B[2].key]&&this._tiles[B[3].key]&&(C[B[0].key]=_[B[0].key]=B[0],C[B[1].key]=_[B[1].key]=B[1],C[B[2].key]=_[B[2].key]=B[2],C[B[3].key]=_[B[3].key]=B[3],delete F[R])}for(const R in F){const B=this.findLoadedParent(F[R],this._source.minzoom);if(B){C[B.tileID.key]=_[B.tileID.key]=B.tileID;for(const X in C)C[X].isChildOf(B.tileID)&&delete C[X]}}for(const R in this._tiles)C[R]||(this._coveredTiles[R]=!0)}}for(const v in _)this._tiles[v].clearFadeHold();const y=l.keysDifference(this._tiles,_);for(const v of y){const T=this._tiles[v];T.hasSymbolBuckets&&!T.holdingForFade()?T.setHoldDuration(this.map._fadeDuration):T.hasSymbolBuckets&&!T.symbolFadeFinished()||this._removeTile(v)}this._updateLoadedParentTileCache()}releaseSymbolFadeTiles(){for(const t in this._tiles)this._tiles[t].holdingForFade()&&this._removeTile(t)}_updateRetainedTiles(t,n){const s={},u={},p=Math.max(n-xi.maxOverzooming,this._source.minzoom),f=Math.max(n+xi.maxUnderzooming,this._source.minzoom),_={};for(const y of t){const v=this._addTile(y);s[y.key]=y,v.hasData()||n<this._source.maxzoom&&(_[y.key]=y)}this._retainLoadedChildren(_,n,f,s);for(const y of t){let v=this._tiles[y.key];if(v.hasData())continue;if(n+1>this._source.maxzoom){const I=y.children(this._source.maxzoom)[0],C=this.getTile(I);if(C&&C.hasData()){s[I.key]=I;continue}}else{const I=y.children(this._source.maxzoom);if(s[I[0].key]&&s[I[1].key]&&s[I[2].key]&&s[I[3].key])continue}let T=v.wasRequested();for(let I=y.overscaledZ-1;I>=p;--I){const C=y.scaledTo(I);if(u[C.key]||(u[C.key]=!0,v=this.getTile(C),!v&&T&&(v=this._addTile(C)),v&&(s[C.key]=C,T=v.wasRequested(),v.hasData())))break}}return s}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const t in this._tiles){const n=[];let s,u=this._tiles[t].tileID;for(;u.overscaledZ>0;){if(u.key in this._loadedParentTiles){s=this._loadedParentTiles[u.key];break}n.push(u.key);const p=u.scaledTo(u.overscaledZ-1);if(s=this._getLoadedTile(p),s)break;u=p}for(const p of n)this._loadedParentTiles[p]=s}}_addTile(t){let n=this._tiles[t.key];if(n)return n;n=this._cache.getAndRemove(t),n&&(this._setTileReloadTimer(t.key,n),n.tileID=t,this._state.initializeTileState(n,this.map?this.map.painter:null),this._cacheTimers[t.key]&&(clearTimeout(this._cacheTimers[t.key]),delete this._cacheTimers[t.key],this._setTileReloadTimer(t.key,n)));const s=n;return n||(n=new Ir(t,this._source.tileSize*t.overscaleFactor()),this._loadTile(n,this._tileLoaded.bind(this,n,t.key,n.state))),n.uses++,this._tiles[t.key]=n,s||this._source.fire(new l.Event("dataloading",{tile:n,coord:n.tileID,dataType:"source"})),n}_setTileReloadTimer(t,n){t in this._timers&&(clearTimeout(this._timers[t]),delete this._timers[t]);const s=n.getExpiryTimeout();s&&(this._timers[t]=setTimeout(()=>{this._reloadTile(t,"expired"),delete this._timers[t]},s))}_removeTile(t){const n=this._tiles[t];n&&(n.uses--,delete this._tiles[t],this._timers[t]&&(clearTimeout(this._timers[t]),delete this._timers[t]),n.uses>0||(n.hasData()&&n.state!=="reloading"?this._cache.add(n.tileID,n,n.getExpiryTimeout()):(n.aborted=!0,this._abortTile(n),this._unloadTile(n))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const t in this._tiles)this._removeTile(t);this._cache.reset()}tilesIn(t,n,s){const u=[],p=this.transform;if(!p)return u;const f=s?p.getCameraQueryGeometry(t):t,_=t.map(R=>p.pointCoordinate(R,this.terrain)),y=f.map(R=>p.pointCoordinate(R,this.terrain)),v=this.getIds();let T=1/0,I=1/0,C=-1/0,F=-1/0;for(const R of y)T=Math.min(T,R.x),I=Math.min(I,R.y),C=Math.max(C,R.x),F=Math.max(F,R.y);for(let R=0;R<v.length;R++){const B=this._tiles[v[R]];if(B.holdingForFade())continue;const X=B.tileID,J=Math.pow(2,p.zoom-B.tileID.overscaledZ),te=n*B.queryPadding*l.EXTENT/B.tileSize/J,O=[X.getTilePoint(new l.MercatorCoordinate(T,I)),X.getTilePoint(new l.MercatorCoordinate(C,F))];if(O[0].x-te<l.EXTENT&&O[0].y-te<l.EXTENT&&O[1].x+te>=0&&O[1].y+te>=0){const ne=_.map(ue=>X.getTilePoint(ue)),ie=y.map(ue=>X.getTilePoint(ue));u.push({tile:B,tileID:X,queryGeometry:ne,cameraQueryGeometry:ie,scale:J})}}return u}getVisibleCoordinates(t){const n=this.getRenderableIds(t).map(s=>this._tiles[s].tileID);for(const s of n)s.posMatrix=this.transform.calculatePosMatrix(s.toUnwrapped());return n}hasTransition(){if(this._source.hasTransition())return!0;if($n(this._source.type))for(const t in this._tiles){const n=this._tiles[t];if(n.fadeEndTime!==void 0&&n.fadeEndTime>=l.exported.now())return!0}return!1}setFeatureState(t,n,s){this._state.updateState(t=t||"_geojsonTileLayer",n,s)}removeFeatureState(t,n,s){this._state.removeFeatureState(t=t||"_geojsonTileLayer",n,s)}getFeatureState(t,n){return this._state.getState(t=t||"_geojsonTileLayer",n)}setDependencies(t,n,s){const u=this._tiles[t];u&&u.setDependencies(n,s)}reloadTilesForDependencies(t,n){for(const s in this._tiles)this._tiles[s].hasDependency(t,n)&&this._reloadTile(s,"reloading");this._cache.filter(s=>!s.hasDependency(t,n))}}function fn(a,t){const n=Math.abs(2*a.wrap)-+(a.wrap<0),s=Math.abs(2*t.wrap)-+(t.wrap<0);return a.overscaledZ-t.overscaledZ||s-n||t.canonical.y-a.canonical.y||t.canonical.x-a.canonical.x}function $n(a){return a==="raster"||a==="image"||a==="video"}xi.maxOverzooming=10,xi.maxUnderzooming=3;const pr="mapboxgl_preloaded_worker_pool";class Si{constructor(){this.active={}}acquire(t){if(!this.workers)for(this.workers=[];this.workers.length<Si.workerCount;)this.workers.push(new Worker(Qr.workerUrl));return this.active[t]=!0,this.workers.slice()}release(t){delete this.active[t],this.numActive()===0&&(this.workers.forEach(n=>{n.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[pr]}numActive(){return Object.keys(this.active).length}}const Vn=Math.floor(l.exported.hardwareConcurrency/2);let Mr;function mn(){return Mr||(Mr=new Si),Mr}function gn(a,t){const n={};for(const s in a)s!=="ref"&&(n[s]=a[s]);return l.refProperties.forEach(s=>{s in t&&(n[s]=t[s])}),n}function Nn(a){a=a.slice();const t=Object.create(null);for(let n=0;n<a.length;n++)t[a[n].id]=a[n];for(let n=0;n<a.length;n++)"ref"in a[n]&&(a[n]=gn(a[n],t[a[n].ref]));return a}Si.workerCount=Math.max(Math.min(Vn,6),1);const ht={setStyle:"setStyle",addLayer:"addLayer",removeLayer:"removeLayer",setPaintProperty:"setPaintProperty",setLayoutProperty:"setLayoutProperty",setFilter:"setFilter",addSource:"addSource",removeSource:"removeSource",setGeoJSONSourceData:"setGeoJSONSourceData",setLayerZoomRange:"setLayerZoomRange",setLayerProperty:"setLayerProperty",setCenter:"setCenter",setZoom:"setZoom",setBearing:"setBearing",setPitch:"setPitch",setSprite:"setSprite",setGlyphs:"setGlyphs",setTransition:"setTransition",setLight:"setLight"};function er(a,t,n){n.push({command:ht.addSource,args:[a,t[a]]})}function zr(a,t,n){t.push({command:ht.removeSource,args:[a]}),n[a]=!0}function Pr(a,t,n,s){zr(a,n,s),er(a,t,n)}function Gn(a,t,n){let s;for(s in a[n])if(Object.prototype.hasOwnProperty.call(a[n],s)&&s!=="data"&&!Te(a[n][s],t[n][s]))return!1;for(s in t[n])if(Object.prototype.hasOwnProperty.call(t[n],s)&&s!=="data"&&!Te(a[n][s],t[n][s]))return!1;return!0}function dr(a,t,n,s,u,p){let f;for(f in t=t||{},a=a||{})Object.prototype.hasOwnProperty.call(a,f)&&(Te(a[f],t[f])||n.push({command:p,args:[s,f,t[f],u]}));for(f in t)Object.prototype.hasOwnProperty.call(t,f)&&!Object.prototype.hasOwnProperty.call(a,f)&&(Te(a[f],t[f])||n.push({command:p,args:[s,f,t[f],u]}))}function fr(a){return a.id}function _n(a,t){return a[t.id]=t,a}class mr{constructor(t,n){this.reset(t,n)}reset(t,n){this.points=t||[],this._distances=[0];for(let s=1;s<this.points.length;s++)this._distances[s]=this._distances[s-1]+this.points[s].dist(this.points[s-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(n||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(t){if(this.points.length===1)return this.points[0];t=l.clamp(t,0,1);let n=1,s=this._distances[n];const u=t*this.paddedLength+this.padding;for(;s<u&&n<this._distances.length;)s=this._distances[++n];const p=n-1,f=this._distances[p],_=s-f,y=_>0?(u-f)/_:0;return this.points[p].mult(1-y).add(this.points[n].mult(y))}}function pe(a,t){let n=!0;return a==="always"||a!=="never"&&t!=="never"||(n=!1),n}class Ce{constructor(t,n,s){const u=this.boxCells=[],p=this.circleCells=[];this.xCellCount=Math.ceil(t/s),this.yCellCount=Math.ceil(n/s);for(let f=0;f<this.xCellCount*this.yCellCount;f++)u.push([]),p.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=t,this.height=n,this.xScale=this.xCellCount/t,this.yScale=this.yCellCount/n,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(t,n,s,u,p){this._forEachCell(n,s,u,p,this._insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(n),this.bboxes.push(s),this.bboxes.push(u),this.bboxes.push(p)}insertCircle(t,n,s,u){this._forEachCell(n-u,s-u,n+u,s+u,this._insertCircleCell,this.circleUid++),this.circleKeys.push(t),this.circles.push(n),this.circles.push(s),this.circles.push(u)}_insertBoxCell(t,n,s,u,p,f){this.boxCells[p].push(f)}_insertCircleCell(t,n,s,u,p,f){this.circleCells[p].push(f)}_query(t,n,s,u,p,f,_){if(s<0||t>this.width||u<0||n>this.height)return[];const y=[];if(t<=0&&n<=0&&this.width<=s&&this.height<=u){if(p)return[{key:null,x1:t,y1:n,x2:s,y2:u}];for(let v=0;v<this.boxKeys.length;v++)y.push({key:this.boxKeys[v],x1:this.bboxes[4*v],y1:this.bboxes[4*v+1],x2:this.bboxes[4*v+2],y2:this.bboxes[4*v+3]});for(let v=0;v<this.circleKeys.length;v++){const T=this.circles[3*v],I=this.circles[3*v+1],C=this.circles[3*v+2];y.push({key:this.circleKeys[v],x1:T-C,y1:I-C,x2:T+C,y2:I+C})}}else this._forEachCell(t,n,s,u,this._queryCell,y,{hitTest:p,overlapMode:f,seenUids:{box:{},circle:{}}},_);return y}query(t,n,s,u){return this._query(t,n,s,u,!1,null)}hitTest(t,n,s,u,p,f){return this._query(t,n,s,u,!0,p,f).length>0}hitTestCircle(t,n,s,u,p){const f=t-s,_=t+s,y=n-s,v=n+s;if(_<0||f>this.width||v<0||y>this.height)return!1;const T=[];return this._forEachCell(f,y,_,v,this._queryCellCircle,T,{hitTest:!0,overlapMode:u,circle:{x:t,y:n,radius:s},seenUids:{box:{},circle:{}}},p),T.length>0}_queryCell(t,n,s,u,p,f,_,y){const{seenUids:v,hitTest:T,overlapMode:I}=_,C=this.boxCells[p];if(C!==null){const R=this.bboxes;for(const B of C)if(!v.box[B]){v.box[B]=!0;const X=4*B,J=this.boxKeys[B];if(t<=R[X+2]&&n<=R[X+3]&&s>=R[X+0]&&u>=R[X+1]&&(!y||y(J))&&(!T||!pe(I,J.overlapMode))&&(f.push({key:J,x1:R[X],y1:R[X+1],x2:R[X+2],y2:R[X+3]}),T))return!0}}const F=this.circleCells[p];if(F!==null){const R=this.circles;for(const B of F)if(!v.circle[B]){v.circle[B]=!0;const X=3*B,J=this.circleKeys[B];if(this._circleAndRectCollide(R[X],R[X+1],R[X+2],t,n,s,u)&&(!y||y(J))&&(!T||!pe(I,J.overlapMode))){const te=R[X],O=R[X+1],ne=R[X+2];if(f.push({key:J,x1:te-ne,y1:O-ne,x2:te+ne,y2:O+ne}),T)return!0}}}return!1}_queryCellCircle(t,n,s,u,p,f,_,y){const{circle:v,seenUids:T,overlapMode:I}=_,C=this.boxCells[p];if(C!==null){const R=this.bboxes;for(const B of C)if(!T.box[B]){T.box[B]=!0;const X=4*B,J=this.boxKeys[B];if(this._circleAndRectCollide(v.x,v.y,v.radius,R[X+0],R[X+1],R[X+2],R[X+3])&&(!y||y(J))&&!pe(I,J.overlapMode))return f.push(!0),!0}}const F=this.circleCells[p];if(F!==null){const R=this.circles;for(const B of F)if(!T.circle[B]){T.circle[B]=!0;const X=3*B,J=this.circleKeys[B];if(this._circlesCollide(R[X],R[X+1],R[X+2],v.x,v.y,v.radius)&&(!y||y(J))&&!pe(I,J.overlapMode))return f.push(!0),!0}}}_forEachCell(t,n,s,u,p,f,_,y){const v=this._convertToXCellCoord(t),T=this._convertToYCellCoord(n),I=this._convertToXCellCoord(s),C=this._convertToYCellCoord(u);for(let F=v;F<=I;F++)for(let R=T;R<=C;R++)if(p.call(this,t,n,s,u,this.xCellCount*R+F,f,_,y))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,n,s,u,p,f){const _=u-t,y=p-n,v=s+f;return v*v>_*_+y*y}_circleAndRectCollide(t,n,s,u,p,f,_){const y=(f-u)/2,v=Math.abs(t-(u+y));if(v>y+s)return!1;const T=(_-p)/2,I=Math.abs(n-(p+T));if(I>T+s)return!1;if(v<=y||I<=T)return!0;const C=v-y,F=I-T;return C*C+F*F<=s*s}}function Zr(a,t,n,s,u){const p=l.create();return t?(l.scale(p,p,[1/u,1/u,1]),n||l.rotateZ(p,p,s.angle)):l.multiply(p,s.labelPlaneMatrix,a),p}function ji(a,t,n,s,u){if(t){const p=l.clone(a);return l.scale(p,p,[u,u,1]),n||l.rotateZ(p,p,-s.angle),p}return s.glCoordMatrix}function pt(a,t,n){let s;n?(s=[a.x,a.y,n(a.x,a.y),1],l.transformMat4(s,s,t)):(s=[a.x,a.y,0,1],gr(s,s,t));const u=s[3];return{point:new l.pointGeometry(s[0]/u,s[1]/u),signedDistanceFromCamera:u}}function Oi(a,t){return .5+a/t*.5}function Ii(a,t){const n=a[0]/a[3],s=a[1]/a[3];return n>=-t[0]&&n<=t[0]&&s>=-t[1]&&s<=t[1]}function Ai(a,t,n,s,u,p,f,_,y,v){const T=s?a.textSizeData:a.iconSizeData,I=l.evaluateSizeForZoom(T,n.transform.zoom),C=[256/n.width*2+1,256/n.height*2+1],F=s?a.text.dynamicLayoutVertexArray:a.icon.dynamicLayoutVertexArray;F.clear();const R=a.lineVertexArray,B=s?a.text.placedSymbolArray:a.icon.placedSymbolArray,X=n.transform.width/n.transform.height;let J=!1;for(let te=0;te<B.length;te++){const O=B.get(te);if(O.hidden||O.writingMode===l.WritingMode.vertical&&!J){Je(O.numGlyphs,F);continue}let ne;if(J=!1,v?(ne=[O.anchorX,O.anchorY,v(O.anchorX,O.anchorY),1],l.transformMat4(ne,ne,t)):(ne=[O.anchorX,O.anchorY,0,1],gr(ne,ne,t)),!Ii(ne,C)){Je(O.numGlyphs,F);continue}const ie=Oi(n.transform.cameraToCenterDistance,ne[3]),ue=l.evaluateSizeForFeature(T,I,O),he=f?ue/ie:ue*ie,ye=new l.pointGeometry(O.anchorX,O.anchorY),ce=pt(ye,u,v).point,Le={},Ie=et(O,he,!1,_,t,u,p,a.glyphOffsetArray,R,F,ce,ye,Le,X,y,v);J=Ie.useVertical,(Ie.notEnoughRoom||J||Ie.needsFlipping&&et(O,he,!0,_,t,u,p,a.glyphOffsetArray,R,F,ce,ye,Le,X,y,v).notEnoughRoom)&&Je(O.numGlyphs,F)}s?a.text.dynamicLayoutVertexBuffer.updateData(F):a.icon.dynamicLayoutVertexBuffer.updateData(F)}function kr(a,t,n,s,u,p,f,_,y,v,T,I,C){const F=_.glyphStartIndex+_.numGlyphs,R=_.lineStartIndex,B=_.lineStartIndex+_.lineLength,X=t.getoffsetX(_.glyphStartIndex),J=t.getoffsetX(F-1),te=oi(a*X,n,s,u,p,f,_.segment,R,B,y,v,T,I,C);if(!te)return null;const O=oi(a*J,n,s,u,p,f,_.segment,R,B,y,v,T,I,C);return O?{first:te,last:O}:null}function Se(a,t,n,s){return a===l.WritingMode.horizontal&&Math.abs(n.y-t.y)>Math.abs(n.x-t.x)*s?{useVertical:!0}:(a===l.WritingMode.vertical?t.y<n.y:t.x>n.x)?{needsFlipping:!0}:null}function et(a,t,n,s,u,p,f,_,y,v,T,I,C,F,R,B){const X=t/24,J=a.lineOffsetX*X,te=a.lineOffsetY*X;let O;if(a.numGlyphs>1){const ne=a.glyphStartIndex+a.numGlyphs,ie=a.lineStartIndex,ue=a.lineStartIndex+a.lineLength,he=kr(X,_,J,te,n,T,I,a,y,p,C,R,B);if(!he)return{notEnoughRoom:!0};const ye=pt(he.first.point,f,B).point,ce=pt(he.last.point,f,B).point;if(s&&!n){const Le=Se(a.writingMode,ye,ce,F);if(Le)return Le}O=[he.first];for(let Le=a.glyphStartIndex+1;Le<ne-1;Le++)O.push(oi(X*_.getoffsetX(Le),J,te,n,T,I,a.segment,ie,ue,y,p,C,R,B));O.push(he.last)}else{if(s&&!n){const ie=pt(I,u,B).point,ue=a.lineStartIndex+a.segment+1,he=new l.pointGeometry(y.getx(ue),y.gety(ue)),ye=pt(he,u,B),ce=ye.signedDistanceFromCamera>0?ye.point:Ye(I,he,ie,1,u,B),Le=Se(a.writingMode,ie,ce,F);if(Le)return Le}const ne=oi(X*_.getoffsetX(a.glyphStartIndex),J,te,n,T,I,a.segment,a.lineStartIndex,a.lineStartIndex+a.lineLength,y,p,C,R,B);if(!ne)return{notEnoughRoom:!0};O=[ne]}for(const ne of O)l.addDynamicAttributes(v,ne.point,ne.angle);return{}}function Ye(a,t,n,s,u,p){const f=pt(a.add(a.sub(t)._unit()),u,p).point,_=n.sub(f);return n.add(_._mult(s/_.mag()))}function oi(a,t,n,s,u,p,f,_,y,v,T,I,C,F){const R=s?a-t:a+t;let B=R>0?1:-1,X=0;s&&(B*=-1,X=Math.PI),B<0&&(X+=Math.PI);let J=B>0?_+f:_+f+1,te=u,O=u,ne=0,ie=0;const ue=Math.abs(R),he=[];for(;ne+ie<=ue;){if(J+=B,J<_||J>=y)return null;if(O=te,he.push(te),te=I[J],te===void 0){const Re=new l.pointGeometry(v.getx(J),v.gety(J)),Qe=pt(Re,T,F);if(Qe.signedDistanceFromCamera>0)te=I[J]=Qe.point;else{const it=J-B;te=Ye(ne===0?p:new l.pointGeometry(v.getx(it),v.gety(it)),Re,O,ue-ne+1,T,F)}}ne+=ie,ie=O.dist(te)}const ye=(ue-ne)/ie,ce=te.sub(O),Le=ce.mult(ye)._add(O);Le._add(ce._unit()._perp()._mult(n*B));const Ie=X+Math.atan2(te.y-O.y,te.x-O.x);return he.push(Le),{point:Le,angle:C?Ie:0,path:he}}const Dr=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function Je(a,t){for(let n=0;n<a;n++){const s=t.length;t.resize(s+4),t.float32.set(Dr,3*s)}}function gr(a,t,n){const s=t[0],u=t[1];return a[0]=n[0]*s+n[4]*u+n[12],a[1]=n[1]*s+n[5]*u+n[13],a[3]=n[3]*s+n[7]*u+n[15],a}const Yt=100;class yn{constructor(t,n=new Ce(t.width+200,t.height+200,25),s=new Ce(t.width+200,t.height+200,25)){this.transform=t,this.grid=n,this.ignoredGrid=s,this.pitchfactor=Math.cos(t._pitch)*t.cameraToCenterDistance,this.screenRightBoundary=t.width+Yt,this.screenBottomBoundary=t.height+Yt,this.gridRightBoundary=t.width+200,this.gridBottomBoundary=t.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(t,n,s,u,p,f){const _=this.projectAndGetPerspectiveRatio(u,t.anchorPointX,t.anchorPointY,f),y=s*_.perspectiveRatio,v=t.x1*y+_.point.x,T=t.y1*y+_.point.y,I=t.x2*y+_.point.x,C=t.y2*y+_.point.y;return!this.isInsideGrid(v,T,I,C)||n!=="always"&&this.grid.hitTest(v,T,I,C,n,p)||_.perspectiveRatio<this.perspectiveRatioCutoff?{box:[],offscreen:!1}:{box:[v,T,I,C],offscreen:this.isOffscreen(v,T,I,C)}}placeCollisionCircles(t,n,s,u,p,f,_,y,v,T,I,C,F,R){const B=[],X=new l.pointGeometry(n.anchorX,n.anchorY),J=pt(X,f,R),te=Oi(this.transform.cameraToCenterDistance,J.signedDistanceFromCamera),O=(T?p/te:p*te)/l.ONE_EM,ne=pt(X,_,R).point,ie=kr(O,u,n.lineOffsetX*O,n.lineOffsetY*O,!1,ne,X,n,s,_,{},!1,R);let ue=!1,he=!1,ye=!0;if(ie){const ce=.5*C*te+F,Le=new l.pointGeometry(-100,-100),Ie=new l.pointGeometry(this.screenRightBoundary,this.screenBottomBoundary),Re=new mr,Qe=ie.first,it=ie.last;let Ge=[];for(let ut=Qe.path.length-1;ut>=1;ut--)Ge.push(Qe.path[ut]);for(let ut=1;ut<it.path.length;ut++)Ge.push(it.path[ut]);const bt=2.5*ce;if(y){const ut=Ge.map(mt=>pt(mt,y,R));Ge=ut.some(mt=>mt.signedDistanceFromCamera<=0)?[]:ut.map(mt=>mt.point)}let wt=[];if(Ge.length>0){const ut=Ge[0].clone(),mt=Ge[0].clone();for(let Et=1;Et<Ge.length;Et++)ut.x=Math.min(ut.x,Ge[Et].x),ut.y=Math.min(ut.y,Ge[Et].y),mt.x=Math.max(mt.x,Ge[Et].x),mt.y=Math.max(mt.y,Ge[Et].y);wt=ut.x>=Le.x&&mt.x<=Ie.x&&ut.y>=Le.y&&mt.y<=Ie.y?[Ge]:mt.x<Le.x||ut.x>Ie.x||mt.y<Le.y||ut.y>Ie.y?[]:l.clipLine([Ge],Le.x,Le.y,Ie.x,Ie.y)}for(const ut of wt){Re.reset(ut,.25*ce);let mt=0;mt=Re.length<=.5*ce?1:Math.ceil(Re.paddedLength/bt)+1;for(let Et=0;Et<mt;Et++){const ei=Et/Math.max(mt-1,1),nr=Re.lerp(ei),Wi=nr.x+Yt,or=nr.y+Yt;B.push(Wi,or,ce,0);const $r=Wi-ce,$i=or-ce,bi=Wi+ce,xr=or+ce;if(ye=ye&&this.isOffscreen($r,$i,bi,xr),he=he||this.isInsideGrid($r,$i,bi,xr),t!=="always"&&this.grid.hitTestCircle(Wi,or,ce,t,I)&&(ue=!0,!v))return{circles:[],offscreen:!1,collisionDetected:ue}}}}return{circles:!v&&ue||!he||te<this.perspectiveRatioCutoff?[]:B,offscreen:ye,collisionDetected:ue}}queryRenderedSymbols(t){if(t.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const n=[];let s=1/0,u=1/0,p=-1/0,f=-1/0;for(const T of t){const I=new l.pointGeometry(T.x+Yt,T.y+Yt);s=Math.min(s,I.x),u=Math.min(u,I.y),p=Math.max(p,I.x),f=Math.max(f,I.y),n.push(I)}const _=this.grid.query(s,u,p,f).concat(this.ignoredGrid.query(s,u,p,f)),y={},v={};for(const T of _){const I=T.key;if(y[I.bucketInstanceId]===void 0&&(y[I.bucketInstanceId]={}),y[I.bucketInstanceId][I.featureIndex])continue;const C=[new l.pointGeometry(T.x1,T.y1),new l.pointGeometry(T.x2,T.y1),new l.pointGeometry(T.x2,T.y2),new l.pointGeometry(T.x1,T.y2)];l.polygonIntersectsPolygon(n,C)&&(y[I.bucketInstanceId][I.featureIndex]=!0,v[I.bucketInstanceId]===void 0&&(v[I.bucketInstanceId]=[]),v[I.bucketInstanceId].push(I.featureIndex))}return v}insertCollisionBox(t,n,s,u,p,f){(s?this.ignoredGrid:this.grid).insert({bucketInstanceId:u,featureIndex:p,collisionGroupID:f,overlapMode:n},t[0],t[1],t[2],t[3])}insertCollisionCircles(t,n,s,u,p,f){const _=s?this.ignoredGrid:this.grid,y={bucketInstanceId:u,featureIndex:p,collisionGroupID:f,overlapMode:n};for(let v=0;v<t.length;v+=4)_.insertCircle(y,t[v],t[v+1],t[v+2])}projectAndGetPerspectiveRatio(t,n,s,u){let p;return u?(p=[n,s,u(n,s),1],l.transformMat4(p,p,t)):(p=[n,s,0,1],gr(p,p,t)),{point:new l.pointGeometry((p[0]/p[3]+1)/2*this.transform.width+Yt,(-p[1]/p[3]+1)/2*this.transform.height+Yt),perspectiveRatio:.5+this.transform.cameraToCenterDistance/p[3]*.5}}isOffscreen(t,n,s,u){return s<Yt||t>=this.screenRightBoundary||u<Yt||n>this.screenBottomBoundary}isInsideGrid(t,n,s,u){return s>=0&&t<this.gridRightBoundary&&u>=0&&n<this.gridBottomBoundary}getViewportMatrix(){const t=l.identity([]);return l.translate(t,t,[-100,-100,0]),t}}function qt(a,t,n){return t*(l.EXTENT/(a.tileSize*Math.pow(2,n-a.tileID.overscaledZ)))}class mi{constructor(t,n,s,u){this.opacity=t?Math.max(0,Math.min(1,t.opacity+(t.placed?n:-n))):u&&s?1:0,this.placed=s}isHidden(){return this.opacity===0&&!this.placed}}class Tt{constructor(t,n,s,u,p){this.text=new mi(t?t.text:null,n,s,p),this.icon=new mi(t?t.icon:null,n,u,p)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class xn{constructor(t,n,s){this.text=t,this.icon=n,this.skipFade=s}}class tr{constructor(){this.invProjMatrix=l.create(),this.viewportMatrix=l.create(),this.circles=[]}}class jr{constructor(t,n,s,u,p){this.bucketInstanceId=t,this.featureIndex=n,this.sourceLayerIndex=s,this.bucketIndex=u,this.tileID=p}}class Xr{constructor(t){this.crossSourceCollisions=t,this.maxGroupID=0,this.collisionGroups={}}get(t){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[t]){const n=++this.maxGroupID;this.collisionGroups[t]={ID:n,predicate:s=>s.collisionGroupID===n}}return this.collisionGroups[t]}}function vn(a,t,n,s,u){const{horizontalAlign:p,verticalAlign:f}=l.getAnchorAlignment(a),_=-(p-.5)*t,y=-(f-.5)*n,v=l.evaluateVariableOffset(a,s);return new l.pointGeometry(_+v[0]*u,y+v[1]*u)}function Wr(a,t,n,s,u,p){const{x1:f,x2:_,y1:y,y2:v,anchorPointX:T,anchorPointY:I}=a,C=new l.pointGeometry(t,n);return s&&C._rotate(u?p:-p),{x1:f+C.x,y1:y+C.y,x2:_+C.x,y2:v+C.y,anchorPointX:T,anchorPointY:I}}class L{constructor(t,n,s,u,p){this.transform=t.clone(),this.terrain=n,this.collisionIndex=new yn(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=s,this.retainedQueryData={},this.collisionGroups=new Xr(u),this.collisionCircleArrays={},this.prevPlacement=p,p&&(p.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(t,n,s,u){const p=s.getBucket(n),f=s.latestFeatureIndex;if(!p||!f||n.id!==p.layerIds[0])return;const _=s.collisionBoxArray,y=p.layers[0].layout,v=Math.pow(2,this.transform.zoom-s.tileID.overscaledZ),T=s.tileSize/l.EXTENT,I=this.transform.calculatePosMatrix(s.tileID.toUnwrapped()),C=y.get("text-pitch-alignment")==="map",F=y.get("text-rotation-alignment")==="map",R=qt(s,1,this.transform.zoom),B=Zr(I,C,F,this.transform,R);let X=null;if(C){const te=ji(I,C,F,this.transform,R);X=l.multiply([],this.transform.labelPlaneMatrix,te)}this.retainedQueryData[p.bucketInstanceId]=new jr(p.bucketInstanceId,f,p.sourceLayerIndex,p.index,s.tileID);const J={bucket:p,layout:y,posMatrix:I,textLabelPlaneMatrix:B,labelToScreenMatrix:X,scale:v,textPixelRatio:T,holdingForFade:s.holdingForFade(),collisionBoxArray:_,partiallyEvaluatedTextSize:l.evaluateSizeForZoom(p.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(p.sourceID)};if(u)for(const te of p.sortKeyRanges){const{sortKey:O,symbolInstanceStart:ne,symbolInstanceEnd:ie}=te;t.push({sortKey:O,symbolInstanceStart:ne,symbolInstanceEnd:ie,parameters:J})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:p.symbolInstances.length,parameters:J})}attemptAnchorPlacement(t,n,s,u,p,f,_,y,v,T,I,C,F,R,B,X){const J=[C.textOffset0,C.textOffset1],te=vn(t,s,u,J,p),O=this.collisionIndex.placeCollisionBox(Wr(n,te.x,te.y,f,_,this.transform.angle),I,y,v,T.predicate,X);if((!B||this.collisionIndex.placeCollisionBox(Wr(B,te.x,te.y,f,_,this.transform.angle),I,y,v,T.predicate,X).box.length!==0)&&O.box.length>0){let ne;if(this.prevPlacement&&this.prevPlacement.variableOffsets[C.crossTileID]&&this.prevPlacement.placements[C.crossTileID]&&this.prevPlacement.placements[C.crossTileID].text&&(ne=this.prevPlacement.variableOffsets[C.crossTileID].anchor),C.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[C.crossTileID]={textOffset:J,width:s,height:u,anchor:t,textBoxScale:p,prevAnchor:ne},this.markUsedJustification(F,t,C,R),F.allowVerticalPlacement&&(this.markUsedOrientation(F,R,C),this.placedOrientations[C.crossTileID]=R),{shift:te,placedGlyphBoxes:O}}}placeLayerBucketPart(t,n,s){const{bucket:u,layout:p,posMatrix:f,textLabelPlaneMatrix:_,labelToScreenMatrix:y,textPixelRatio:v,holdingForFade:T,collisionBoxArray:I,partiallyEvaluatedTextSize:C,collisionGroup:F}=t.parameters,R=p.get("text-optional"),B=p.get("icon-optional"),X=l.getOverlapMode(p,"text-overlap","text-allow-overlap"),J=X==="always",te=l.getOverlapMode(p,"icon-overlap","icon-allow-overlap"),O=te==="always",ne=p.get("text-rotation-alignment")==="map",ie=p.get("text-pitch-alignment")==="map",ue=p.get("icon-text-fit")!=="none",he=p.get("symbol-z-order")==="viewport-y",ye=J&&(O||!u.hasIconData()||B),ce=O&&(J||!u.hasTextData()||R);!u.collisionArrays&&I&&u.deserializeCollisionBoxes(I);const Le=(Ie,Re)=>{if(n[Ie.crossTileID])return;if(T)return void(this.placements[Ie.crossTileID]=new xn(!1,!1,!1));let Qe=!1,it=!1,Ge=!0,bt=null,wt={box:null,offscreen:null},ut={box:null,offscreen:null},mt=null,Et=null,ei=null,nr=0,Wi=0,or=0;Re.textFeatureIndex?nr=Re.textFeatureIndex:Ie.useRuntimeCollisionCircles&&(nr=Ie.featureIndex),Re.verticalTextFeatureIndex&&(Wi=Re.verticalTextFeatureIndex);const $r=this.retainedQueryData[u.bucketInstanceId].tileID,$i=this.terrain?(Ht,ot)=>this.terrain.getElevation($r,Ht,ot):null;for(const Ht of["textBox","verticalTextBox","iconBox","verticalIconBox"]){const ot=Re[Ht];ot&&(ot.elevation=$i?$i(ot.anchorPointX,ot.anchorPointY):0)}const bi=Re.textBox;if(bi){const Ht=xt=>{let ti=l.WritingMode.horizontal;if(u.allowVerticalPlacement&&!xt&&this.prevPlacement){const ii=this.prevPlacement.placedOrientations[Ie.crossTileID];ii&&(this.placedOrientations[Ie.crossTileID]=ii,ti=ii,this.markUsedOrientation(u,ti,Ie))}return ti},ot=(xt,ti)=>{if(u.allowVerticalPlacement&&Ie.numVerticalGlyphVertices>0&&Re.verticalTextBox){for(const ii of u.writingModes)if(ii===l.WritingMode.vertical?(wt=ti(),ut=wt):wt=xt(),wt&&wt.box&&wt.box.length)break}else wt=xt()};if(p.get("text-variable-anchor")){let xt=p.get("text-variable-anchor");if(this.prevPlacement&&this.prevPlacement.variableOffsets[Ie.crossTileID]){const Bt=this.prevPlacement.variableOffsets[Ie.crossTileID];xt.indexOf(Bt.anchor)>0&&(xt=xt.filter(Vi=>Vi!==Bt.anchor),xt.unshift(Bt.anchor))}const ti=(Bt,Vi,en)=>{const Ds=Bt.x2-Bt.x1,Dn=Bt.y2-Bt.y1,$a=Ie.textBoxScale,Ls=ue&&te==="never"?Vi:null;let Vr={box:[],offscreen:!1};const tn=X!=="never"?2*xt.length:xt.length;for(let rn=0;rn<tn;++rn){const Go=this.attemptAnchorPlacement(xt[rn%xt.length],Bt,Ds,Dn,$a,ne,ie,v,f,F,rn>=xt.length?X:"never",Ie,u,en,Ls,$i);if(Go&&(Vr=Go.placedGlyphBoxes,Vr&&Vr.box&&Vr.box.length)){Qe=!0,bt=Go.shift;break}}return Vr};ot(()=>ti(bi,Re.iconBox,l.WritingMode.horizontal),()=>{const Bt=Re.verticalTextBox;return u.allowVerticalPlacement&&!(wt&&wt.box&&wt.box.length)&&Ie.numVerticalGlyphVertices>0&&Bt?ti(Bt,Re.verticalIconBox,l.WritingMode.vertical):{box:null,offscreen:null}}),wt&&(Qe=wt.box,Ge=wt.offscreen);const ii=Ht(wt&&wt.box);if(!Qe&&this.prevPlacement){const Bt=this.prevPlacement.variableOffsets[Ie.crossTileID];Bt&&(this.variableOffsets[Ie.crossTileID]=Bt,this.markUsedJustification(u,Bt.anchor,Ie,ii))}}else{const xt=(ti,ii)=>{const Bt=this.collisionIndex.placeCollisionBox(ti,X,v,f,F.predicate,$i);return Bt&&Bt.box&&Bt.box.length&&(this.markUsedOrientation(u,ii,Ie),this.placedOrientations[Ie.crossTileID]=ii),Bt};ot(()=>xt(bi,l.WritingMode.horizontal),()=>{const ti=Re.verticalTextBox;return u.allowVerticalPlacement&&Ie.numVerticalGlyphVertices>0&&ti?xt(ti,l.WritingMode.vertical):{box:null,offscreen:null}}),Ht(wt&&wt.box&&wt.box.length)}}if(mt=wt,Qe=mt&&mt.box&&mt.box.length>0,Ge=mt&&mt.offscreen,Ie.useRuntimeCollisionCircles){const Ht=u.text.placedSymbolArray.get(Ie.centerJustifiedTextSymbolIndex),ot=l.evaluateSizeForFeature(u.textSizeData,C,Ht),xt=p.get("text-padding");Et=this.collisionIndex.placeCollisionCircles(X,Ht,u.lineVertexArray,u.glyphOffsetArray,ot,f,_,y,s,ie,F.predicate,Ie.collisionCircleDiameter,xt,$i),Et.circles.length&&Et.collisionDetected&&!s&&l.warnOnce("Collisions detected, but collision boxes are not shown"),Qe=J||Et.circles.length>0&&!Et.collisionDetected,Ge=Ge&&Et.offscreen}if(Re.iconFeatureIndex&&(or=Re.iconFeatureIndex),Re.iconBox){const Ht=ot=>{const xt=ue&&bt?Wr(ot,bt.x,bt.y,ne,ie,this.transform.angle):ot;return this.collisionIndex.placeCollisionBox(xt,te,v,f,F.predicate,$i)};ut&&ut.box&&ut.box.length&&Re.verticalIconBox?(ei=Ht(Re.verticalIconBox),it=ei.box.length>0):(ei=Ht(Re.iconBox),it=ei.box.length>0),Ge=Ge&&ei.offscreen}const xr=R||Ie.numHorizontalGlyphVertices===0&&Ie.numVerticalGlyphVertices===0,No=B||Ie.numIconVertices===0;if(xr||No?No?xr||(it=it&&Qe):Qe=it&&Qe:it=Qe=it&&Qe,Qe&&mt&&mt.box&&this.collisionIndex.insertCollisionBox(mt.box,X,p.get("text-ignore-placement"),u.bucketInstanceId,ut&&ut.box&&Wi?Wi:nr,F.ID),it&&ei&&this.collisionIndex.insertCollisionBox(ei.box,te,p.get("icon-ignore-placement"),u.bucketInstanceId,or,F.ID),Et&&(Qe&&this.collisionIndex.insertCollisionCircles(Et.circles,X,p.get("text-ignore-placement"),u.bucketInstanceId,nr,F.ID),s)){const Ht=u.bucketInstanceId;let ot=this.collisionCircleArrays[Ht];ot===void 0&&(ot=this.collisionCircleArrays[Ht]=new tr);for(let xt=0;xt<Et.circles.length;xt+=4)ot.circles.push(Et.circles[xt+0]),ot.circles.push(Et.circles[xt+1]),ot.circles.push(Et.circles[xt+2]),ot.circles.push(Et.collisionDetected?1:0)}if(Ie.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");if(u.bucketInstanceId===0)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[Ie.crossTileID]=new xn(Qe||ye,it||ce,Ge||u.justReloaded),n[Ie.crossTileID]=!0};if(he){if(t.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");const Ie=u.getSortedSymbolIndexes(this.transform.angle);for(let Re=Ie.length-1;Re>=0;--Re){const Qe=Ie[Re];Le(u.symbolInstances.get(Qe),u.collisionArrays[Qe])}}else for(let Ie=t.symbolInstanceStart;Ie<t.symbolInstanceEnd;Ie++)Le(u.symbolInstances.get(Ie),u.collisionArrays[Ie]);if(s&&u.bucketInstanceId in this.collisionCircleArrays){const Ie=this.collisionCircleArrays[u.bucketInstanceId];l.invert(Ie.invProjMatrix,f),Ie.viewportMatrix=this.collisionIndex.getViewportMatrix()}u.justReloaded=!1}markUsedJustification(t,n,s,u){let p;p=u===l.WritingMode.vertical?s.verticalPlacedTextSymbolIndex:{left:s.leftJustifiedTextSymbolIndex,center:s.centerJustifiedTextSymbolIndex,right:s.rightJustifiedTextSymbolIndex}[l.getAnchorJustification(n)];const f=[s.leftJustifiedTextSymbolIndex,s.centerJustifiedTextSymbolIndex,s.rightJustifiedTextSymbolIndex,s.verticalPlacedTextSymbolIndex];for(const _ of f)_>=0&&(t.text.placedSymbolArray.get(_).crossTileID=p>=0&&_!==p?0:s.crossTileID)}markUsedOrientation(t,n,s){const u=n===l.WritingMode.horizontal||n===l.WritingMode.horizontalOnly?n:0,p=n===l.WritingMode.vertical?n:0,f=[s.leftJustifiedTextSymbolIndex,s.centerJustifiedTextSymbolIndex,s.rightJustifiedTextSymbolIndex];for(const _ of f)t.text.placedSymbolArray.get(_).placedOrientation=u;s.verticalPlacedTextSymbolIndex&&(t.text.placedSymbolArray.get(s.verticalPlacedTextSymbolIndex).placedOrientation=p)}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;const n=this.prevPlacement;let s=!1;this.prevZoomAdjustment=n?n.zoomAdjustment(this.transform.zoom):0;const u=n?n.symbolFadeChange(t):1,p=n?n.opacities:{},f=n?n.variableOffsets:{},_=n?n.placedOrientations:{};for(const y in this.placements){const v=this.placements[y],T=p[y];T?(this.opacities[y]=new Tt(T,u,v.text,v.icon),s=s||v.text!==T.text.placed||v.icon!==T.icon.placed):(this.opacities[y]=new Tt(null,u,v.text,v.icon,v.skipFade),s=s||v.text||v.icon)}for(const y in p){const v=p[y];if(!this.opacities[y]){const T=new Tt(v,u,!1,!1);T.isHidden()||(this.opacities[y]=T,s=s||v.text.placed||v.icon.placed)}}for(const y in f)this.variableOffsets[y]||!this.opacities[y]||this.opacities[y].isHidden()||(this.variableOffsets[y]=f[y]);for(const y in _)this.placedOrientations[y]||!this.opacities[y]||this.opacities[y].isHidden()||(this.placedOrientations[y]=_[y]);if(n&&n.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");s?this.lastPlacementChangeTime=t:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=n?n.lastPlacementChangeTime:t)}updateLayerOpacities(t,n){const s={};for(const u of n){const p=u.getBucket(t);p&&u.latestFeatureIndex&&t.id===p.layerIds[0]&&this.updateBucketOpacities(p,s,u.collisionBoxArray)}}updateBucketOpacities(t,n,s){t.hasTextData()&&t.text.opacityVertexArray.clear(),t.hasIconData()&&t.icon.opacityVertexArray.clear(),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexArray.clear(),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexArray.clear();const u=t.layers[0].layout,p=new Tt(null,0,!1,!1,!0),f=u.get("text-allow-overlap"),_=u.get("icon-allow-overlap"),y=u.get("text-variable-anchor"),v=u.get("text-rotation-alignment")==="map",T=u.get("text-pitch-alignment")==="map",I=u.get("icon-text-fit")!=="none",C=new Tt(null,0,f&&(_||!t.hasIconData()||u.get("icon-optional")),_&&(f||!t.hasTextData()||u.get("text-optional")),!0);!t.collisionArrays&&s&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(s);const F=(R,B,X)=>{for(let J=0;J<B/4;J++)R.opacityVertexArray.emplaceBack(X)};for(let R=0;R<t.symbolInstances.length;R++){const B=t.symbolInstances.get(R),{numHorizontalGlyphVertices:X,numVerticalGlyphVertices:J,crossTileID:te}=B;let O=this.opacities[te];n[te]?O=p:O||(O=C,this.opacities[te]=O),n[te]=!0;const ne=B.numIconVertices>0,ie=this.placedOrientations[B.crossTileID],ue=ie===l.WritingMode.vertical,he=ie===l.WritingMode.horizontal||ie===l.WritingMode.horizontalOnly;if(X>0||J>0){const ye=K(O.text);F(t.text,X,ue?le:ye),F(t.text,J,he?le:ye);const ce=O.text.isHidden();[B.rightJustifiedTextSymbolIndex,B.centerJustifiedTextSymbolIndex,B.leftJustifiedTextSymbolIndex].forEach(Re=>{Re>=0&&(t.text.placedSymbolArray.get(Re).hidden=ce||ue?1:0)}),B.verticalPlacedTextSymbolIndex>=0&&(t.text.placedSymbolArray.get(B.verticalPlacedTextSymbolIndex).hidden=ce||he?1:0);const Le=this.variableOffsets[B.crossTileID];Le&&this.markUsedJustification(t,Le.anchor,B,ie);const Ie=this.placedOrientations[B.crossTileID];Ie&&(this.markUsedJustification(t,"left",B,Ie),this.markUsedOrientation(t,Ie,B))}if(ne){const ye=K(O.icon),ce=!(I&&B.verticalPlacedIconSymbolIndex&&ue);B.placedIconSymbolIndex>=0&&(F(t.icon,B.numIconVertices,ce?ye:le),t.icon.placedSymbolArray.get(B.placedIconSymbolIndex).hidden=O.icon.isHidden()),B.verticalPlacedIconSymbolIndex>=0&&(F(t.icon,B.numVerticalIconVertices,ce?le:ye),t.icon.placedSymbolArray.get(B.verticalPlacedIconSymbolIndex).hidden=O.icon.isHidden())}if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const ye=t.collisionArrays[R];if(ye){let ce=new l.pointGeometry(0,0);if(ye.textBox||ye.verticalTextBox){let Ie=!0;if(y){const Re=this.variableOffsets[te];Re?(ce=vn(Re.anchor,Re.width,Re.height,Re.textOffset,Re.textBoxScale),v&&ce._rotate(T?this.transform.angle:-this.transform.angle)):Ie=!1}ye.textBox&&b(t.textCollisionBox.collisionVertexArray,O.text.placed,!Ie||ue,ce.x,ce.y),ye.verticalTextBox&&b(t.textCollisionBox.collisionVertexArray,O.text.placed,!Ie||he,ce.x,ce.y)}const Le=Boolean(!he&&ye.verticalIconBox);ye.iconBox&&b(t.iconCollisionBox.collisionVertexArray,O.icon.placed,Le,I?ce.x:0,I?ce.y:0),ye.verticalIconBox&&b(t.iconCollisionBox.collisionVertexArray,O.icon.placed,!Le,I?ce.x:0,I?ce.y:0)}}}if(t.sortFeatures(this.transform.angle),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 new 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 new Error(`bucket.icon.opacityVertexArray.length (= ${t.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${t.icon.layoutVertexArray.length}) / 4`);if(t.bucketInstanceId in this.collisionCircleArrays){const R=this.collisionCircleArrays[t.bucketInstanceId];t.placementInvProjMatrix=R.invProjMatrix,t.placementViewportMatrix=R.viewportMatrix,t.collisionCircleArray=R.circles,delete this.collisionCircleArrays[t.bucketInstanceId]}}symbolFadeChange(t){return this.fadeDuration===0?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,n){const s=this.zoomAtLastRecencyCheck===n?1-this.zoomAdjustment(n):1;return this.zoomAtLastRecencyCheck=n,this.commitTime+this.fadeDuration*s>t}setStale(){this.stale=!0}}function b(a,t,n,s,u){a.emplaceBack(t?1:0,n?1:0,s||0,u||0),a.emplaceBack(t?1:0,n?1:0,s||0,u||0),a.emplaceBack(t?1:0,n?1:0,s||0,u||0),a.emplaceBack(t?1:0,n?1:0,s||0,u||0)}const S=Math.pow(2,25),k=Math.pow(2,24),D=Math.pow(2,17),G=Math.pow(2,16),H=Math.pow(2,9),Z=Math.pow(2,8),q=Math.pow(2,1);function K(a){if(a.opacity===0&&!a.placed)return 0;if(a.opacity===1&&a.placed)return 4294967295;const t=a.placed?1:0,n=Math.floor(127*a.opacity);return n*S+t*k+n*D+t*G+n*H+t*Z+n*q+t}const le=0;class _e{constructor(t){this._sortAcrossTiles=t.layout.get("symbol-z-order")!=="viewport-y"&&!t.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(t,n,s,u,p){const f=this._bucketParts;for(;this._currentTileIndex<t.length;)if(n.getBucketParts(f,u,t[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,p())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,f.sort((_,y)=>_.sortKey-y.sortKey));this._currentPartIndex<f.length;)if(n.placeLayerBucketPart(f[this._currentPartIndex],this._seenCrossTileIDs,s),this._currentPartIndex++,p())return!0;return!1}}class ae{constructor(t,n,s,u,p,f,_,y){this.placement=new L(t,n,f,_,y),this._currentPlacementIndex=s.length-1,this._forceFullPlacement=u,this._showCollisionBoxes=p,this._done=!1}isDone(){return this._done}continuePlacement(t,n,s){const u=l.exported.now(),p=()=>{const f=l.exported.now()-u;return!this._forceFullPlacement&&f>2};for(;this._currentPlacementIndex>=0;){const f=n[t[this._currentPlacementIndex]],_=this.placement.collisionIndex.transform.zoom;if(f.type==="symbol"&&(!f.minzoom||f.minzoom<=_)&&(!f.maxzoom||f.maxzoom>_)){if(this._inProgressLayer||(this._inProgressLayer=new _e(f)),this._inProgressLayer.continuePlacement(s[f.source],this.placement,this._showCollisionBoxes,f,p))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(t){return this.placement.commit(t),this.placement}}const Oe=512/l.EXTENT/2;class $e{constructor(t,n,s){this.tileID=t,this.indexedSymbolInstances={},this.bucketInstanceId=s;for(let u=0;u<n.length;u++){const p=n.get(u),f=p.key;this.indexedSymbolInstances[f]||(this.indexedSymbolInstances[f]=[]),this.indexedSymbolInstances[f].push({crossTileID:p.crossTileID,coord:this.getScaledCoordinates(p,t)})}}getScaledCoordinates(t,n){const s=Oe/Math.pow(2,n.canonical.z-this.tileID.canonical.z);return{x:Math.floor((n.canonical.x*l.EXTENT+t.anchorX)*s),y:Math.floor((n.canonical.y*l.EXTENT+t.anchorY)*s)}}findMatches(t,n,s){const u=this.tileID.canonical.z<n.canonical.z?1:Math.pow(2,this.tileID.canonical.z-n.canonical.z);for(let p=0;p<t.length;p++){const f=t.get(p);if(f.crossTileID)continue;const _=this.indexedSymbolInstances[f.key];if(!_)continue;const y=this.getScaledCoordinates(f,n);for(const v of _)if(Math.abs(v.coord.x-y.x)<=u&&Math.abs(v.coord.y-y.y)<=u&&!s[v.crossTileID]){s[v.crossTileID]=!0,f.crossTileID=v.crossTileID;break}}}}class De{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Ze{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(t){const n=Math.round((t-this.lng)/360);if(n!==0)for(const s in this.indexes){const u=this.indexes[s],p={};for(const f in u){const _=u[f];_.tileID=_.tileID.unwrapTo(_.tileID.wrap+n),p[_.tileID.key]=_}this.indexes[s]=p}this.lng=t}addBucket(t,n,s){if(this.indexes[t.overscaledZ]&&this.indexes[t.overscaledZ][t.key]){if(this.indexes[t.overscaledZ][t.key].bucketInstanceId===n.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(t.overscaledZ,this.indexes[t.overscaledZ][t.key])}for(let p=0;p<n.symbolInstances.length;p++)n.symbolInstances.get(p).crossTileID=0;this.usedCrossTileIDs[t.overscaledZ]||(this.usedCrossTileIDs[t.overscaledZ]={});const u=this.usedCrossTileIDs[t.overscaledZ];for(const p in this.indexes){const f=this.indexes[p];if(Number(p)>t.overscaledZ)for(const _ in f){const y=f[_];y.tileID.isChildOf(t)&&y.findMatches(n.symbolInstances,t,u)}else{const _=f[t.scaledTo(Number(p)).key];_&&_.findMatches(n.symbolInstances,t,u)}}for(let p=0;p<n.symbolInstances.length;p++){const f=n.symbolInstances.get(p);f.crossTileID||(f.crossTileID=s.generate(),u[f.crossTileID]=!0)}return this.indexes[t.overscaledZ]===void 0&&(this.indexes[t.overscaledZ]={}),this.indexes[t.overscaledZ][t.key]=new $e(t,n.symbolInstances,n.bucketInstanceId),!0}removeBucketCrossTileIDs(t,n){for(const s in n.indexedSymbolInstances)for(const u of n.indexedSymbolInstances[s])delete this.usedCrossTileIDs[t][u.crossTileID]}removeStaleBuckets(t){let n=!1;for(const s in this.indexes){const u=this.indexes[s];for(const p in u)t[u[p].bucketInstanceId]||(this.removeBucketCrossTileIDs(s,u[p]),delete u[p],n=!0)}return n}}class Xe{constructor(){this.layerIndexes={},this.crossTileIDs=new De,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(t,n,s){let u=this.layerIndexes[t.id];u===void 0&&(u=this.layerIndexes[t.id]=new Ze);let p=!1;const f={};u.handleWrapJump(s);for(const _ of n){const y=_.getBucket(t);y&&t.id===y.layerIds[0]&&(y.bucketInstanceId||(y.bucketInstanceId=++this.maxBucketInstanceId),u.addBucket(_.tileID,y,this.crossTileIDs)&&(p=!0),f[y.bucketInstanceId]=!0)}return u.removeStaleBuckets(f)&&(p=!0),p}pruneUnusedLayers(t){const n={};t.forEach(s=>{n[s]=!0});for(const s in this.layerIndexes)n[s]||delete this.layerIndexes[s]}}var dt=l.createLayout([{name:"a_pos",type:"Int16",components:2}]);class Ke extends l.Evented{constructor(t){super(),this.sourceCache=t,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.renderHistory=[],this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,this.renderHistorySize=t._cache.max,t.usedForTerrain=!0,t.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null;for(const t in this._tiles){const n=this._tiles[t];n.textures.forEach(s=>s.destroy()),n.textures=[]}}update(t,n){this.sourceCache.update(t,n),this._renderableTilesKeys=[];for(const s of t.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:n}))this._renderableTilesKeys.push(s.key),this._tiles[s.key]||(s.posMatrix=new Float64Array(16),l.ortho(s.posMatrix,0,l.EXTENT,0,l.EXTENT,0,1),this._tiles[s.key]=new Ir(s,this.tileSize))}removeOutdated(t){const n={};this.renderHistory=this.renderHistory.filter((s,u)=>this.renderHistory.indexOf(s)===u).slice(0,this.renderHistorySize);for(const s of this._renderableTilesKeys)n[s]=!0;for(const s of this.renderHistory)n[s]=!0;for(const s in this._tiles)n[s]||(this._tiles[s].clearTextures(t),delete this._tiles[s])}getRenderableTiles(){return this._renderableTilesKeys.map(t=>this.getTileByID(t))}getTileByID(t){return this._tiles[t]}getTerrainCoords(t){const n={};for(const s of this._renderableTilesKeys){const u=this._tiles[s].tileID;if(u.canonical.equals(t.canonical)){const p=t.clone();p.posMatrix=new Float64Array(16),l.ortho(p.posMatrix,0,l.EXTENT,0,l.EXTENT,0,1),n[s]=p}else if(u.canonical.isChildOf(t.canonical)){const p=t.clone();p.posMatrix=new Float64Array(16);const f=u.canonical.z-t.canonical.z,_=u.canonical.x-(u.canonical.x>>f<<f),y=u.canonical.y-(u.canonical.y>>f<<f),v=l.EXTENT>>f;l.ortho(p.posMatrix,0,v,0,v,0,1),l.translate(p.posMatrix,p.posMatrix,[-_*v,-y*v,0]),n[s]=p}else if(t.canonical.isChildOf(u.canonical)){const p=t.clone();p.posMatrix=new Float64Array(16);const f=t.canonical.z-u.canonical.z,_=t.canonical.x-(t.canonical.x>>f<<f),y=t.canonical.y-(t.canonical.y>>f<<f),v=l.EXTENT>>f;l.ortho(p.posMatrix,0,l.EXTENT,0,l.EXTENT,0,1),l.translate(p.posMatrix,p.posMatrix,[_*v,y*v,0]),l.scale(p.posMatrix,p.posMatrix,[1/2**f,1/2**f,0]),n[s]=p}}return n}getSourceTile(t,n){const s=this.sourceCache._source;let u=t.overscaledZ-this.deltaZoom;if(u>s.maxzoom&&(u=s.maxzoom),u<s.minzoom)return null;this._sourceTileCache[t.key]||(this._sourceTileCache[t.key]=t.scaledTo(u).key);let p=this.sourceCache.getTileByID(this._sourceTileCache[t.key]);if((!p||!p.dem)&&n)for(;u>=s.minzoom&&(!p||!p.dem);)p=this.sourceCache.getTileByID(t.scaledTo(u--).key);return p}tilesAfterTime(t=Date.now()){return Object.values(this._tiles).filter(n=>n.timeLoaded>=t)}}class tt{constructor(t,n,s){this.style=t,this.sourceCache=new Ke(n),this.options=s,this.exaggeration=typeof s.exaggeration=="number"?s.exaggeration:1,this.elevationOffset=typeof s.elevationOffset=="number"?s.elevationOffset:450,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024,this.clearRerenderCache()}getDEMElevation(t,n,s,u=l.EXTENT){if(!(n>=0&&n<u&&s>=0&&s<u))return this.elevationOffset;let p=0;const f=this.getTerrainData(t);if(f.tile&&f.tile.dem){const _=l.transformMat4$1([],[n/u*l.EXTENT,s/u*l.EXTENT],f.u_terrain_matrix),y=[_[0]*f.tile.dem.dim,_[1]*f.tile.dem.dim],v=[Math.floor(y[0]),Math.floor(y[1])],T=f.tile.dem.get(v[0],v[1]),I=f.tile.dem.get(v[0],v[1]+1),C=f.tile.dem.get(v[0]+1,v[1]),F=f.tile.dem.get(v[0]+1,v[1]+1);p=l.number(l.number(T,I,y[0]-v[0]),l.number(C,F,y[0]-v[0]),y[1]-v[1])}return p}rememberForRerender(t,n){for(const s in this.sourceCache._tiles){const u=this.sourceCache._tiles[s];(u.tileID.equals(n)||u.tileID.isChildOf(n))&&(t===this.sourceCache.sourceCache.id&&(u.timeLoaded=Date.now()),this._rerender[t]=this._rerender[t]||{},this._rerender[t][u.tileID.key]=!0)}}needsRerender(t,n){return this._rerender[t]&&this._rerender[t][n.key]}clearRerenderCache(){this._rerender={}}getElevation(t,n,s,u=l.EXTENT){return(this.getDEMElevation(t,n,s,u)+this.elevationOffset)*this.exaggeration}getTerrainData(t){if(!this._emptyDemTexture){const u=this.style.map.painter.context,p=new l.RGBAImage({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new He(u,p,u.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new He(u,new l.RGBAImage({width:1,height:1}),u.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(u.gl.NEAREST,u.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=l.identity([])}const n=this.sourceCache.getSourceTile(t,!0);if(n&&n.dem&&(!n.demTexture||n.needsTerrainPrepare)){const u=this.style.map.painter.context;n.demTexture=this.style.map.painter.getTileTexture(n.dem.stride),n.demTexture?n.demTexture.update(n.dem.getPixels(),{premultiply:!1}):n.demTexture=new He(u,n.dem.getPixels(),u.gl.RGBA,{premultiply:!1}),n.demTexture.bind(u.gl.NEAREST,u.gl.CLAMP_TO_EDGE),n.needsTerrainPrepare=!1}const s=n&&n+n.tileID.key+t.key;if(s&&!this._demMatrixCache[s]){const u=this.sourceCache.sourceCache._source.maxzoom;let p=t.canonical.z-n.tileID.canonical.z;t.overscaledZ>t.canonical.z&&(t.canonical.z>=u?p=t.canonical.z-u:l.warnOnce("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const f=t.canonical.x-(t.canonical.x>>p<<p),_=t.canonical.y-(t.canonical.y>>p<<p),y=l.fromScaling(new Float64Array(16),[1/(l.EXTENT<<p),1/(l.EXTENT<<p),0]);l.translate(y,y,[f*l.EXTENT,_*l.EXTENT,0]),this._demMatrixCache[t.key]={matrix:y,coord:t}}return{u_depth:2,u_terrain:3,u_terrain_dim:n&&n.dem&&n.dem.dim||1,u_terrain_matrix:s?this._demMatrixCache[t.key].matrix:this._emptyDemMatrix,u_terrain_unpack:n&&n.dem&&n.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_offset:this.elevationOffset,u_terrain_exaggeration:this.exaggeration,texture:(n&&n.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:n}}getRTTFramebuffer(){const t=this.style.map.painter;if(!this._rttFramebuffer){const n=this.sourceCache.tileSize*this.qualityFactor;this._rttFramebuffer=t.context.createFramebuffer(n,n,!0),this._rttFramebuffer.depthAttachment.set(t.context.createRenderbuffer(t.context.gl.DEPTH_COMPONENT16,n,n))}return this._rttFramebuffer}getFramebuffer(t){const n=this.style.map.painter,s=n.width/devicePixelRatio,u=n.height/devicePixelRatio;return!this._fbo||this._fbo.width===s&&this._fbo.height===u||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new He(n.context,{width:s,height:u,data:null},n.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(n.context.gl.NEAREST,n.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new He(n.context,{width:s,height:u,data:null},n.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(n.context.gl.NEAREST,n.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=n.context.createFramebuffer(s,u,!0),this._fbo.depthAttachment.set(n.context.createRenderbuffer(n.context.gl.DEPTH_COMPONENT16,s,u))),this._fbo.colorAttachment.set(t==="coords"?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){const t=this.style.map.painter.context;if(this._coordsTexture)return this._coordsTexture;const n=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let p=0,f=0;p<this._coordsTextureSize;p++)for(let _=0;_<this._coordsTextureSize;_++,f+=4)n[f+0]=255&_,n[f+1]=255&p,n[f+2]=_>>8<<4|p>>8,n[f+3]=0;const s=new l.RGBAImage({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(n.buffer)),u=new He(t,s,t.gl.RGBA,{premultiply:!1});return u.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),this._coordsTexture=u,u}pointCoordinate(t){const n=new Uint8Array(4),s=this.style.map.painter,u=s.context,p=u.gl;u.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),p.readPixels(t.x,s.height/devicePixelRatio-t.y-1,1,1,p.RGBA,p.UNSIGNED_BYTE,n),u.bindFramebuffer.set(null);const f=n[0]+(n[2]>>4<<8),_=n[1]+((15&n[2])<<8),y=this.coordsIndex[255-n[3]],v=y&&this.sourceCache.getTileByID(y);if(!v)return null;const T=this._coordsTextureSize,I=(1<<v.tileID.canonical.z)*T;return new l.MercatorCoordinate((v.tileID.canonical.x*T+f)/I,(v.tileID.canonical.y*T+_)/I,this.getElevation(v.tileID,f,_,T))}getTerrainMesh(){if(this._mesh)return this._mesh;const t=this.style.map.painter.context,n=new l.PosArray,s=new l.TriangleIndexArray,u=this.meshSize,p=l.EXTENT/u,f=u*u;for(let _=0;_<=u;_++)for(let y=0;y<=u;y++)n.emplaceBack(y*p,_*p);for(let _=0;_<f;_+=u+1)for(let y=0;y<u;y++)s.emplaceBack(y+_,u+y+_+1,u+y+_+2),s.emplaceBack(y+_,u+y+_+2,y+_+1);return this._mesh={indexBuffer:t.createIndexBuffer(s),vertexBuffer:t.createVertexBuffer(n,dt.members),segments:l.SegmentVector.simpleSegment(0,0,n.length,s.length)},this._mesh}getMinMaxElevation(t){const n=this.getTerrainData(t).tile,s={minElevation:null,maxElevation:null};return n&&n.dem&&(s.minElevation=(n.dem.min+this.elevationOffset)*this.exaggeration,s.maxElevation=(n.dem.max+this.elevationOffset)*this.exaggeration),s}}const ft=(a,t)=>l.emitValidationErrors(a,t&&t.filter(n=>n.identifier!=="source.canvas")),St=l.pick(ht,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData"]),Qt=l.pick(ht,["setCenter","setZoom","setBearing","setPitch"]),kt=function(){const a={},t=l.spec.$version;for(const n in l.spec.$root){const s=l.spec.$root[n];if(s.required){let u=null;u=n==="version"?t:s.type==="array"?[]:{},u!=null&&(a[n]=u)}}return a}();class li extends l.Evented{constructor(t,n={}){super(),this.map=t,this.dispatcher=new lr(mn(),this),this.imageManager=new Mt,this.imageManager.setEventedParent(this),this.glyphManager=new $t(t._requestManager,n.localIdeographFontFamily),this.lineAtlas=new wo(256,512),this.crossTileSymbolIndex=new Xe,this._layers={},this._serializedLayers={},this._order=[],this.sourceCaches={},this.zoomHistory=new l.ZoomHistory,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("setReferrer",l.getReferrer());const s=this;this._rtlTextPluginCallback=li.registerForPluginStateChange(u=>{s.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:u.pluginStatus,pluginURL:u.pluginURL},(p,f)=>{if(l.triggerPluginCompletionEvent(p),f&&f.every(_=>_))for(const _ in s.sourceCaches)s.sourceCaches[_].reload()})}),this.on("data",u=>{if(u.dataType!=="source"||u.sourceDataType!=="metadata")return;const p=this.sourceCaches[u.sourceId];if(!p)return;const f=p.getSource();if(f&&f.vectorLayerIds)for(const _ in this._layers){const y=this._layers[_];y.source===f.id&&this._validateLayer(y)}})}loadURL(t,n={}){this.fire(new l.Event("dataloading",{dataType:"style"}));const s=typeof n.validate!="boolean"||n.validate,u=this.map._requestManager.transformRequest(t,l.ResourceType.Style);this._request=l.getJSON(u,(p,f)=>{this._request=null,p?this.fire(new l.ErrorEvent(p)):f&&this._load(f,s)})}loadJSON(t,n={}){this.fire(new l.Event("dataloading",{dataType:"style"})),this._request=l.exported.frame(()=>{this._request=null,this._load(t,n.validate!==!1)})}loadEmpty(){this.fire(new l.Event("dataloading",{dataType:"style"})),this._load(kt,!1)}_load(t,n){if(n&&ft(this,l.validateStyle(t)))return;this._loaded=!0,this.stylesheet=t;for(const u in t.sources)this.addSource(u,t.sources[u],{validate:!1});t.sprite?this._loadSprite(t.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(t.glyphs);const s=Nn(this.stylesheet.layers);this._order=s.map(u=>u.id),this._layers={},this._serializedLayers={};for(let u of s)u=l.createStyleLayer(u),u.setEventedParent(this,{layer:{id:u.id}}),this._layers[u.id]=u,this._serializedLayers[u.id]=u.serialize();this.dispatcher.broadcast("setLayers",this._serializeLayers(this._order)),this.light=new fi(this.stylesheet.light),this.setTerrain(this.stylesheet.terrain),this.fire(new l.Event("data",{dataType:"style"})),this.fire(new l.Event("style.load"))}_loadSprite(t){this._spriteRequest=function(n,s,u,p){let f,_,y;const v=u>1?"@2x":"";let T=l.getJSON(s.transformRequest(s.normalizeSpriteURL(n,v,".json"),l.ResourceType.SpriteJSON),(F,R)=>{T=null,y||(y=F,f=R,C())}),I=l.getImage(s.transformRequest(s.normalizeSpriteURL(n,v,".png"),l.ResourceType.SpriteImage),(F,R)=>{I=null,y||(y=F,_=R,C())});function C(){if(y)p(y);else if(f&&_){const F=l.exported.getImageData(_),R={};for(const B in f){const{width:X,height:J,x:te,y:O,sdf:ne,pixelRatio:ie,stretchX:ue,stretchY:he,content:ye}=f[B],ce=new l.RGBAImage({width:X,height:J});l.RGBAImage.copy(F,ce,{x:te,y:O},{x:0,y:0},{width:X,height:J}),R[B]={data:ce,pixelRatio:ie,sdf:ne,stretchX:ue,stretchY:he,content:ye}}p(null,R)}}return{cancel(){T&&(T.cancel(),T=null),I&&(I.cancel(),I=null)}}}(t,this.map._requestManager,this.map.getPixelRatio(),(n,s)=>{if(this._spriteRequest=null,n)this.fire(new l.ErrorEvent(n));else if(s)for(const u in s)this.imageManager.addImage(u,s[u]);this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new l.Event("data",{dataType:"style"}))})}_validateLayer(t){const n=this.sourceCaches[t.source];if(!n)return;const s=t.sourceLayer;if(!s)return;const u=n.getSource();(u.type==="geojson"||u.vectorLayerIds&&u.vectorLayerIds.indexOf(s)===-1)&&this.fire(new l.ErrorEvent(new Error(`Source layer "${s}" does not exist on source "${u.id}" as specified by style layer "${t.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const t in this.sourceCaches)if(!this.sourceCaches[t].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeLayers(t){const n=[];for(const s of t){const u=this._layers[s];u.type!=="custom"&&n.push(u.serialize())}return n}hasTransitions(){if(this.light&&this.light.hasTransition())return!0;for(const t in this.sourceCaches)if(this.sourceCaches[t].hasTransition())return!0;for(const t in this._layers)if(this._layers[t].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(t){if(!this._loaded)return;const n=this._changed;if(this._changed){const u=Object.keys(this._updatedLayers),p=Object.keys(this._removedLayers);(u.length||p.length)&&this._updateWorkerLayers(u,p);for(const f in this._updatedSources){const _=this._updatedSources[f];if(_==="reload")this._reloadSource(f);else{if(_!=="clear")throw new Error(`Invalid action ${_}`);this._clearSource(f)}}this._updateTilesForChangedImages();for(const f in this._updatedPaintProps)this._layers[f].updateTransitions(t);this.light.updateTransitions(t),this._resetUpdates()}const s={};for(const u in this.sourceCaches){const p=this.sourceCaches[u];s[u]=p.used,p.used=!1}for(const u of this._order){const p=this._layers[u];p.recalculate(t,this._availableImages),!p.isHidden(t.zoom)&&p.source&&(this.sourceCaches[p.source].used=!0)}for(const u in s){const p=this.sourceCaches[u];s[u]!==p.used&&p.fire(new l.Event("data",{sourceDataType:"visibility",dataType:"source",sourceId:u}))}this.light.recalculate(t),this.z=t.zoom,n&&this.fire(new l.Event("data",{dataType:"style"}))}_updateTilesForChangedImages(){const t=Object.keys(this._changedImages);if(t.length){for(const n in this.sourceCaches)this.sourceCaches[n].reloadTilesForDependencies(["icons","patterns"],t);this._changedImages={}}}_updateWorkerLayers(t,n){this.dispatcher.broadcast("updateLayers",{layers:this._serializeLayers(t),removedIds:n})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={}}setTerrain(t){if(this._checkLoaded(),this._terrainDataCallback&&this.off("data",this._terrainDataCallback),this._terrainfreezeElevationCallback&&this.map.off("freezeElevation",this._terrainfreezeElevationCallback),t){const n=this.sourceCaches[t.source];if(!n)throw new Error(`cannot load terrain, because there exists no source with ID: ${t.source}`);this.terrain=new tt(this,n,t),this.map.transform.updateElevation(this.terrain),this._terrainfreezeElevationCallback=s=>{s.freeze?this.map.transform.freezeElevation=!0:(this.map.transform.freezeElevation=!1,this.map.transform.recalculateZoom(this.terrain))},this._terrainDataCallback=s=>{s.tile&&(s.sourceId===t.source?(this.map.transform.updateElevation(this.terrain),this.terrain.rememberForRerender(s.sourceId,s.tile.tileID)):s.source.type==="geojson"&&this.terrain.rememberForRerender(s.sourceId,s.tile.tileID))},this.on("data",this._terrainDataCallback),this.map.on("freezeElevation",this._terrainfreezeElevationCallback)}else this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.map.transform.updateElevation(this.terrain);this.map.fire(new l.Event("terrain",{terrain:t}))}setState(t){if(this._checkLoaded(),ft(this,l.validateStyle(t)))return!1;(t=l.clone$1(t)).layers=Nn(t.layers);const n=function(u,p){if(!u)return[{command:ht.setStyle,args:[p]}];let f=[];try{if(!Te(u.version,p.version))return[{command:ht.setStyle,args:[p]}];Te(u.center,p.center)||f.push({command:ht.setCenter,args:[p.center]}),Te(u.zoom,p.zoom)||f.push({command:ht.setZoom,args:[p.zoom]}),Te(u.bearing,p.bearing)||f.push({command:ht.setBearing,args:[p.bearing]}),Te(u.pitch,p.pitch)||f.push({command:ht.setPitch,args:[p.pitch]}),Te(u.sprite,p.sprite)||f.push({command:ht.setSprite,args:[p.sprite]}),Te(u.glyphs,p.glyphs)||f.push({command:ht.setGlyphs,args:[p.glyphs]}),Te(u.transition,p.transition)||f.push({command:ht.setTransition,args:[p.transition]}),Te(u.light,p.light)||f.push({command:ht.setLight,args:[p.light]});const _={},y=[];(function(T,I,C,F){let R;for(R in I=I||{},T=T||{})Object.prototype.hasOwnProperty.call(T,R)&&(Object.prototype.hasOwnProperty.call(I,R)||zr(R,C,F));for(R in I)Object.prototype.hasOwnProperty.call(I,R)&&(Object.prototype.hasOwnProperty.call(T,R)?Te(T[R],I[R])||(T[R].type==="geojson"&&I[R].type==="geojson"&&Gn(T,I,R)?C.push({command:ht.setGeoJSONSourceData,args:[R,I[R].data]}):Pr(R,I,C,F)):er(R,I,C))})(u.sources,p.sources,y,_);const v=[];u.layers&&u.layers.forEach(T=>{_[T.source]?f.push({command:ht.removeLayer,args:[T.id]}):v.push(T)}),f=f.concat(y),function(T,I,C){I=I||[];const F=(T=T||[]).map(fr),R=I.map(fr),B=T.reduce(_n,{}),X=I.reduce(_n,{}),J=F.slice(),te=Object.create(null);let O,ne,ie,ue,he,ye,ce;for(O=0,ne=0;O<F.length;O++)ie=F[O],Object.prototype.hasOwnProperty.call(X,ie)?ne++:(C.push({command:ht.removeLayer,args:[ie]}),J.splice(J.indexOf(ie,ne),1));for(O=0,ne=0;O<R.length;O++)ie=R[R.length-1-O],J[J.length-1-O]!==ie&&(Object.prototype.hasOwnProperty.call(B,ie)?(C.push({command:ht.removeLayer,args:[ie]}),J.splice(J.lastIndexOf(ie,J.length-ne),1)):ne++,ye=J[J.length-O],C.push({command:ht.addLayer,args:[X[ie],ye]}),J.splice(J.length-O,0,ie),te[ie]=!0);for(O=0;O<R.length;O++)if(ie=R[O],ue=B[ie],he=X[ie],!te[ie]&&!Te(ue,he))if(Te(ue.source,he.source)&&Te(ue["source-layer"],he["source-layer"])&&Te(ue.type,he.type)){for(ce in dr(ue.layout,he.layout,C,ie,null,ht.setLayoutProperty),dr(ue.paint,he.paint,C,ie,null,ht.setPaintProperty),Te(ue.filter,he.filter)||C.push({command:ht.setFilter,args:[ie,he.filter]}),Te(ue.minzoom,he.minzoom)&&Te(ue.maxzoom,he.maxzoom)||C.push({command:ht.setLayerZoomRange,args:[ie,he.minzoom,he.maxzoom]}),ue)Object.prototype.hasOwnProperty.call(ue,ce)&&ce!=="layout"&&ce!=="paint"&&ce!=="filter"&&ce!=="metadata"&&ce!=="minzoom"&&ce!=="maxzoom"&&(ce.indexOf("paint.")===0?dr(ue[ce],he[ce],C,ie,ce.slice(6),ht.setPaintProperty):Te(ue[ce],he[ce])||C.push({command:ht.setLayerProperty,args:[ie,ce,he[ce]]}));for(ce in he)Object.prototype.hasOwnProperty.call(he,ce)&&!Object.prototype.hasOwnProperty.call(ue,ce)&&ce!=="layout"&&ce!=="paint"&&ce!=="filter"&&ce!=="metadata"&&ce!=="minzoom"&&ce!=="maxzoom"&&(ce.indexOf("paint.")===0?dr(ue[ce],he[ce],C,ie,ce.slice(6),ht.setPaintProperty):Te(ue[ce],he[ce])||C.push({command:ht.setLayerProperty,args:[ie,ce,he[ce]]}))}else C.push({command:ht.removeLayer,args:[ie]}),ye=J[J.lastIndexOf(ie)+1],C.push({command:ht.addLayer,args:[he,ye]})}(v,p.layers,f)}catch(_){console.warn("Unable to compute style diff:",_),f=[{command:ht.setStyle,args:[p]}]}return f}(this.serialize(),t).filter(u=>!(u.command in Qt));if(n.length===0)return!1;const s=n.filter(u=>!(u.command in St));if(s.length>0)throw new Error(`Unimplemented: ${s.map(u=>u.command).join(", ")}.`);return n.forEach(u=>{u.command!=="setTransition"&&this[u.command].apply(this,u.args)}),this.stylesheet=t,!0}addImage(t,n){if(this.getImage(t))return this.fire(new l.ErrorEvent(new Error(`An image named "${t}" already exists.`)));this.imageManager.addImage(t,n),this._afterImageUpdated(t)}updateImage(t,n){this.imageManager.updateImage(t,n)}getImage(t){return this.imageManager.getImage(t)}removeImage(t){if(!this.getImage(t))return this.fire(new l.ErrorEvent(new Error(`An image named "${t}" does not exist.`)));this.imageManager.removeImage(t),this._afterImageUpdated(t)}_afterImageUpdated(t){this._availableImages=this.imageManager.listImages(),this._changedImages[t]=!0,this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new l.Event("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(t,n,s={}){if(this._checkLoaded(),this.sourceCaches[t]!==void 0)throw new Error(`Source "${t}" already exists.`);if(!n.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(n).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(n.type)>=0&&this._validate(l.validateStyle.source,`sources.${t}`,n,null,s))return;this.map&&this.map._collectResourceTiming&&(n.collectResourceTiming=!0);const u=this.sourceCaches[t]=new xi(t,n,this.dispatcher);u.style=this,u.setEventedParent(this,()=>({isSourceLoaded:this.loaded(),source:u.serialize(),sourceId:t})),u.onAdd(this.map),this._changed=!0}removeSource(t){if(this._checkLoaded(),this.sourceCaches[t]===void 0)throw new Error("There is no source with this ID");for(const s in this._layers)if(this._layers[s].source===t)return this.fire(new l.ErrorEvent(new Error(`Source "${t}" cannot be removed while layer "${s}" is using it.`)));const n=this.sourceCaches[t];delete this.sourceCaches[t],delete this._updatedSources[t],n.fire(new l.Event("data",{sourceDataType:"metadata",dataType:"source",sourceId:t})),n.setEventedParent(null),n.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(t,n){if(this._checkLoaded(),this.sourceCaches[t]===void 0)throw new Error(`There is no source with this ID=${t}`);const s=this.sourceCaches[t].getSource();if(s.type!=="geojson")throw new Error(`geojsonSource.type is ${s.type}, which is !== 'geojson`);s.setData(n),this._changed=!0}getSource(t){return this.sourceCaches[t]&&this.sourceCaches[t].getSource()}addLayer(t,n,s={}){this._checkLoaded();const u=t.id;if(this.getLayer(u))return void this.fire(new l.ErrorEvent(new Error(`Layer "${u}" already exists on this map.`)));let p;if(t.type==="custom"){if(ft(this,l.validateCustomStyleLayer(t)))return;p=l.createStyleLayer(t)}else{if(typeof t.source=="object"&&(this.addSource(u,t.source),t=l.clone$1(t),t=l.extend(t,{source:u})),this._validate(l.validateStyle.layer,`layers.${u}`,t,{arrayIndex:-1},s))return;p=l.createStyleLayer(t),this._validateLayer(p),p.setEventedParent(this,{layer:{id:u}}),this._serializedLayers[p.id]=p.serialize()}const f=n?this._order.indexOf(n):this._order.length;if(n&&f===-1)this.fire(new l.ErrorEvent(new Error(`Cannot add layer "${u}" before non-existing layer "${n}".`)));else{if(this._order.splice(f,0,u),this._layerOrderChanged=!0,this._layers[u]=p,this._removedLayers[u]&&p.source&&p.type!=="custom"){const _=this._removedLayers[u];delete this._removedLayers[u],_.type!==p.type?this._updatedSources[p.source]="clear":(this._updatedSources[p.source]="reload",this.sourceCaches[p.source].pause())}this._updateLayer(p),p.onAdd&&p.onAdd(this.map)}}moveLayer(t,n){if(this._checkLoaded(),this._changed=!0,!this._layers[t])return void this.fire(new l.ErrorEvent(new Error(`The layer '${t}' does not exist in the map's style and cannot be moved.`)));if(t===n)return;const s=this._order.indexOf(t);this._order.splice(s,1);const u=n?this._order.indexOf(n):this._order.length;n&&u===-1?this.fire(new l.ErrorEvent(new Error(`Cannot move layer "${t}" before non-existing layer "${n}".`))):(this._order.splice(u,0,t),this._layerOrderChanged=!0)}removeLayer(t){this._checkLoaded();const n=this._layers[t];if(!n)return void this.fire(new l.ErrorEvent(new Error(`Cannot remove non-existing layer "${t}".`)));n.setEventedParent(null);const s=this._order.indexOf(t);this._order.splice(s,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[t]=n,delete this._layers[t],delete this._serializedLayers[t],delete this._updatedLayers[t],delete this._updatedPaintProps[t],n.onRemove&&n.onRemove(this.map)}getLayer(t){return this._layers[t]}hasLayer(t){return t in this._layers}setLayerZoomRange(t,n,s){this._checkLoaded();const u=this.getLayer(t);u?u.minzoom===n&&u.maxzoom===s||(n!=null&&(u.minzoom=n),s!=null&&(u.maxzoom=s),this._updateLayer(u)):this.fire(new l.ErrorEvent(new Error(`Cannot set the zoom range of non-existing layer "${t}".`)))}setFilter(t,n,s={}){this._checkLoaded();const u=this.getLayer(t);if(u){if(!Te(u.filter,n))return n==null?(u.filter=void 0,void this._updateLayer(u)):void(this._validate(l.validateStyle.filter,`layers.${u.id}.filter`,n,null,s)||(u.filter=l.clone$1(n),this._updateLayer(u)))}else this.fire(new l.ErrorEvent(new Error(`Cannot filter non-existing layer "${t}".`)))}getFilter(t){return l.clone$1(this.getLayer(t).filter)}setLayoutProperty(t,n,s,u={}){this._checkLoaded();const p=this.getLayer(t);p?Te(p.getLayoutProperty(n),s)||(p.setLayoutProperty(n,s,u),this._updateLayer(p)):this.fire(new l.ErrorEvent(new Error(`Cannot style non-existing layer "${t}".`)))}getLayoutProperty(t,n){const s=this.getLayer(t);if(s)return s.getLayoutProperty(n);this.fire(new l.ErrorEvent(new Error(`Cannot get style of non-existing layer "${t}".`)))}setPaintProperty(t,n,s,u={}){this._checkLoaded();const p=this.getLayer(t);p?Te(p.getPaintProperty(n),s)||(p.setPaintProperty(n,s,u)&&this._updateLayer(p),this._changed=!0,this._updatedPaintProps[t]=!0):this.fire(new l.ErrorEvent(new Error(`Cannot style non-existing layer "${t}".`)))}getPaintProperty(t,n){return this.getLayer(t).getPaintProperty(n)}setFeatureState(t,n){this._checkLoaded();const s=t.source,u=t.sourceLayer,p=this.sourceCaches[s];if(p===void 0)return void this.fire(new l.ErrorEvent(new Error(`The source '${s}' does not exist in the map's style.`)));const f=p.getSource().type;f==="geojson"&&u?this.fire(new l.ErrorEvent(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):f!=="vector"||u?(t.id===void 0&&this.fire(new l.ErrorEvent(new Error("The feature id parameter must be provided."))),p.setFeatureState(u,t.id,n)):this.fire(new l.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(t,n){this._checkLoaded();const s=t.source,u=this.sourceCaches[s];if(u===void 0)return void this.fire(new l.ErrorEvent(new Error(`The source '${s}' does not exist in the map's style.`)));const p=u.getSource().type,f=p==="vector"?t.sourceLayer:void 0;p!=="vector"||f?n&&typeof t.id!="string"&&typeof t.id!="number"?this.fire(new l.ErrorEvent(new Error("A feature id is required to remove its specific state property."))):u.removeFeatureState(f,t.id,n):this.fire(new l.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(t){this._checkLoaded();const n=t.source,s=t.sourceLayer,u=this.sourceCaches[n];if(u!==void 0)return u.getSource().type!=="vector"||s?(t.id===void 0&&this.fire(new l.ErrorEvent(new Error("The feature id parameter must be provided."))),u.getFeatureState(s,t.id)):void this.fire(new l.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new l.ErrorEvent(new Error(`The source '${n}' does not exist in the map's style.`)))}getTransition(){return l.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){return l.filterObject({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,light:this.stylesheet.light,center:this.stylesheet.center,zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,sources:l.mapObject(this.sourceCaches,t=>t.serialize()),layers:this._serializeLayers(this._order)},t=>t!==void 0)}_updateLayer(t){this._updatedLayers[t.id]=!0,t.source&&!this._updatedSources[t.source]&&this.sourceCaches[t.source].getSource().type!=="raster"&&(this._updatedSources[t.source]="reload",this.sourceCaches[t.source].pause()),this._changed=!0}_flattenAndSortRenderedFeatures(t){const n=f=>this._layers[f].type==="fill-extrusion",s={},u=[];for(let f=this._order.length-1;f>=0;f--){const _=this._order[f];if(n(_)){s[_]=f;for(const y of t){const v=y[_];if(v)for(const T of v)u.push(T)}}}u.sort((f,_)=>_.intersectionZ-f.intersectionZ);const p=[];for(let f=this._order.length-1;f>=0;f--){const _=this._order[f];if(n(_))for(let y=u.length-1;y>=0;y--){const v=u[y].feature;if(s[v.layer.id]<f)break;p.push(v),u.pop()}else for(const y of t){const v=y[_];if(v)for(const T of v)p.push(T.feature)}}return p}queryRenderedFeatures(t,n,s){n&&n.filter&&this._validate(l.validateStyle.filter,"queryRenderedFeatures.filter",n.filter,null,n);const u={};if(n&&n.layers){if(!Array.isArray(n.layers))return this.fire(new l.ErrorEvent(new Error("parameters.layers must be an Array."))),[];for(const f of n.layers){const _=this._layers[f];if(!_)return this.fire(new l.ErrorEvent(new Error(`The layer '${f}' does not exist in the map's style and cannot be queried for features.`))),[];u[_.source]=!0}}const p=[];n.availableImages=this._availableImages;for(const f in this.sourceCaches)n.layers&&!u[f]||p.push(dn(this.sourceCaches[f],this._layers,this._serializedLayers,t,n,s));return this.placement&&p.push(function(f,_,y,v,T,I,C){const F={},R=I.queryRenderedSymbols(v),B=[];for(const X of Object.keys(R).map(Number))B.push(C[X]);B.sort(Qi);for(const X of B){const J=X.featureIndex.lookupSymbolFeatures(R[X.bucketInstanceId],_,X.bucketIndex,X.sourceLayerIndex,T.filter,T.layers,T.availableImages,f);for(const te in J){const O=F[te]=F[te]||[],ne=J[te];ne.sort((ie,ue)=>{const he=X.featureSortOrder;if(he){const ye=he.indexOf(ie.featureIndex);return he.indexOf(ue.featureIndex)-ye}return ue.featureIndex-ie.featureIndex});for(const ie of ne)O.push(ie)}}for(const X in F)F[X].forEach(J=>{const te=J.feature,O=y[f[X].source].getFeatureState(te.layer["source-layer"],te.id);te.source=te.layer.source,te.layer["source-layer"]&&(te.sourceLayer=te.layer["source-layer"]),te.state=O});return F}(this._layers,this._serializedLayers,this.sourceCaches,t,n,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(p)}querySourceFeatures(t,n){n&&n.filter&&this._validate(l.validateStyle.filter,"querySourceFeatures.filter",n.filter,null,n);const s=this.sourceCaches[t];return s?function(u,p){const f=u.getRenderableIds().map(v=>u.getTileByID(v)),_=[],y={};for(let v=0;v<f.length;v++){const T=f[v],I=T.tileID.canonical.key;y[I]||(y[I]=!0,T.querySourceFeatures(_,p))}return _}(s,n):[]}addSourceType(t,n,s){return li.getSourceType(t)?s(new Error(`A source type called "${t}" already exists.`)):(li.setSourceType(t,n),n.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:t,url:n.workerSourceURL},s):s(null,null))}getLight(){return this.light.getLight()}setLight(t,n={}){this._checkLoaded();const s=this.light.getLight();let u=!1;for(const f in t)if(!Te(t[f],s[f])){u=!0;break}if(!u)return;const p={now:l.exported.now(),transition:l.extend({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(t,n),this.light.updateTransitions(p)}_validate(t,n,s,u,p={}){return(!p||p.validate!==!1)&&ft(this,t.call(l.validateStyle,l.extend({key:n,style:this.serialize(),value:s,styleSpec:l.spec},u)))}_remove(){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),l.evented.off("pluginStateChange",this._rtlTextPluginCallback);for(const t in this._layers)this._layers[t].setEventedParent(null);for(const t in this.sourceCaches){const n=this.sourceCaches[t];n.setEventedParent(null),n.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),this.dispatcher.remove()}_clearSource(t){this.sourceCaches[t].clearTiles()}_reloadSource(t){this.sourceCaches[t].resume(),this.sourceCaches[t].reload()}_updateSources(t){for(const n in this.sourceCaches)this.sourceCaches[n].update(t,this.terrain)}_generateCollisionBoxes(){for(const t in this.sourceCaches)this._reloadSource(t)}_updatePlacement(t,n,s,u,p=!1){let f=!1,_=!1;const y={};for(const v of this._order){const T=this._layers[v];if(T.type!=="symbol")continue;if(!y[T.source]){const C=this.sourceCaches[T.source];y[T.source]=C.getRenderableIds(!0).map(F=>C.getTileByID(F)).sort((F,R)=>R.tileID.overscaledZ-F.tileID.overscaledZ||(F.tileID.isLessThan(R.tileID)?-1:1))}const I=this.crossTileSymbolIndex.addLayer(T,y[T.source],t.center.lng);f=f||I}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((p=p||this._layerOrderChanged||s===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(l.exported.now(),t.zoom))&&(this.pauseablePlacement=new ae(t,this.terrain,this._order,p,n,s,u,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,y),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(l.exported.now()),_=!0),f&&this.pauseablePlacement.placement.setStale()),_||f)for(const v of this._order){const T=this._layers[v];T.type==="symbol"&&this.placement.updateLayerOpacities(T,y[T.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(l.exported.now())}_releaseSymbolFadeTiles(){for(const t in this.sourceCaches)this.sourceCaches[t].releaseSymbolFadeTiles()}getImages(t,n,s){this.imageManager.getImages(n.icons,s),this._updateTilesForChangedImages();const u=this.sourceCaches[n.source];u&&u.setDependencies(n.tileID.key,n.type,n.icons)}getGlyphs(t,n,s){this.glyphManager.getGlyphs(n.stacks,s)}getResource(t,n,s){return l.makeRequest(n,s)}}li.getSourceType=function(a){return hn[a]},li.setSourceType=function(a,t){hn[a]=t},li.registerForPluginStateChange=l.registerForPluginStateChange;var bn="attribute vec2 a_pos;uniform mat4 u_matrix;varying vec2 v_texture_pos;varying float v_depth;void main() {v_texture_pos=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos,get_elevation(a_pos),1.0);v_depth=gl_Position.z/gl_Position.w;}";const qn={prelude:It(`#ifdef GL_ES
|
|
3
3
|
precision mediump float;
|
|
4
4
|
#else
|
|
5
5
|
#if !defined(lowp)
|
|
@@ -522,7 +522,7 @@ void main() {
|
|
|
522
522
|
#pragma mapbox: initialize lowp float halo_blur
|
|
523
523
|
vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
|
|
524
524
|
camera_to_anchor_distance/u_camera_to_center_distance :
|
|
525
|
-
u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale),z,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}`),terrain:It("uniform sampler2D u_texture;varying vec2 v_texture_pos;void main() {gl_FragColor=texture2D(u_texture,v_texture_pos);}",bn),terrainDepth:It("varying 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() {gl_FragColor=pack(v_depth);}",bn),terrainCoords:It("precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;varying vec2 v_texture_pos;void main() {vec4 rgba=texture2D(u_texture,v_texture_pos);gl_FragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}",bn)};function It(a,t){const n=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,s=t.match(/attribute ([\w]+) ([\w]+)/g),u=a.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),
|
|
525
|
+
u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale),z,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}`),terrain:It("uniform sampler2D u_texture;varying vec2 v_texture_pos;void main() {gl_FragColor=texture2D(u_texture,v_texture_pos);}",bn),terrainDepth:It("varying 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() {gl_FragColor=pack(v_depth);}",bn),terrainCoords:It("precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;varying vec2 v_texture_pos;void main() {vec4 rgba=texture2D(u_texture,v_texture_pos);gl_FragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}",bn)};function It(a,t){const n=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,s=t.match(/attribute ([\w]+) ([\w]+)/g),u=a.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),p=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),f=p?p.concat(u):u,_={};return{fragmentSource:a=a.replace(n,(y,v,T,I,C)=>(_[C]=!0,v==="define"?`
|
|
526
526
|
#ifndef HAS_UNIFORM_u_${C}
|
|
527
527
|
varying ${T} ${I} ${C};
|
|
528
528
|
#else
|
|
@@ -571,16 +571,16 @@ uniform ${T} ${I} u_${C};
|
|
|
571
571
|
#else
|
|
572
572
|
${T} ${I} ${C} = u_${C};
|
|
573
573
|
#endif
|
|
574
|
-
`}),staticAttributes:s,staticUniforms:f}}class ts{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(t,n,s,u,
|
|
574
|
+
`}),staticAttributes:s,staticUniforms:f}}class ts{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(t,n,s,u,p,f,_,y,v){this.context=t;let T=this.boundPaintVertexBuffers.length!==u.length;for(let I=0;!T&&I<u.length;I++)this.boundPaintVertexBuffers[I]!==u[I]&&(T=!0);t.extVertexArrayObject&&this.vao&&this.boundProgram===n&&this.boundLayoutVertexBuffer===s&&!T&&this.boundIndexBuffer===p&&this.boundVertexOffset===f&&this.boundDynamicVertexBuffer===_&&this.boundDynamicVertexBuffer2===y&&this.boundDynamicVertexBuffer3===v?(t.bindVertexArrayOES.set(this.vao),_&&_.bind(),p&&p.dynamicDraw&&p.bind(),y&&y.bind(),v&&v.bind()):this.freshBind(n,s,u,p,f,_,y,v)}freshBind(t,n,s,u,p,f,_,y){let v;const T=t.numAttributes,I=this.context,C=I.gl;if(I.extVertexArrayObject)this.vao&&this.destroy(),this.vao=I.extVertexArrayObject.createVertexArrayOES(),I.bindVertexArrayOES.set(this.vao),v=0,this.boundProgram=t,this.boundLayoutVertexBuffer=n,this.boundPaintVertexBuffers=s,this.boundIndexBuffer=u,this.boundVertexOffset=p,this.boundDynamicVertexBuffer=f,this.boundDynamicVertexBuffer2=_,this.boundDynamicVertexBuffer3=y;else{v=I.currentNumAttributes||0;for(let F=T;F<v;F++)C.disableVertexAttribArray(F)}n.enableAttributes(C,t);for(const F of s)F.enableAttributes(C,t);f&&f.enableAttributes(C,t),_&&_.enableAttributes(C,t),y&&y.enableAttributes(C,t),n.bind(),n.setVertexAttribPointers(C,t,p);for(const F of s)F.bind(),F.setVertexAttribPointers(C,t,p);f&&(f.bind(),f.setVertexAttribPointers(C,t,p)),u&&u.bind(),_&&(_.bind(),_.setVertexAttribPointers(C,t,p)),y&&(y.bind(),y.setVertexAttribPointers(C,t,p)),I.currentNumAttributes=T}destroy(){this.vao&&(this.context.extVertexArrayObject.deleteVertexArrayOES(this.vao),this.vao=null)}}function is(a){const t=[];for(let n=0;n<a.length;n++){if(a[n]===null)continue;const s=a[n].split(" ");t.push(s.pop())}return t}class ia{constructor(t,n,s,u,p,f,_){const y=t.gl;this.program=y.createProgram();const v=is(s.staticAttributes),T=u?u.getBinderAttributes():[],I=v.concat(T),C=qn.prelude.staticUniforms?is(qn.prelude.staticUniforms):[],F=s.staticUniforms?is(s.staticUniforms):[],R=u?u.getBinderUniforms():[],B=C.concat(F).concat(R),X=[];for(const he of B)X.indexOf(he)<0&&X.push(he);const J=u?u.defines():[];f&&J.push("#define OVERDRAW_INSPECTOR;"),_&&J.push("#define TERRAIN3D;");const te=J.concat(qn.prelude.fragmentSource,s.fragmentSource).join(`
|
|
575
575
|
`),O=J.concat(qn.prelude.vertexSource,s.vertexSource).join(`
|
|
576
|
-
`),ne=y.createShader(y.FRAGMENT_SHADER);if(y.isContextLost())return void(this.failedToCreate=!0);y.shaderSource(ne,te),y.compileShader(ne),y.attachShader(this.program,ne);const ie=y.createShader(y.VERTEX_SHADER);if(y.isContextLost())return void(this.failedToCreate=!0);y.shaderSource(ie,O),y.compileShader(ie),y.attachShader(this.program,ie),this.attributes={};const ue={};this.numAttributes=I.length;for(let he=0;he<this.numAttributes;he++)I[he]&&(y.bindAttribLocation(this.program,he,I[he]),this.attributes[I[he]]=he);y.linkProgram(this.program),y.deleteShader(ie),y.deleteShader(ne);for(let he=0;he<X.length;he++){const ye=X[he];if(ye&&!ue[ye]){const ce=y.getUniformLocation(this.program,ye);ce&&(ue[ye]=ce)}}this.fixedUniforms=d(t,ue),this.terrainUniforms=((he,ye)=>({u_depth:new l.Uniform1i(he,ye.u_depth),u_terrain:new l.Uniform1i(he,ye.u_terrain),u_terrain_dim:new l.Uniform1f(he,ye.u_terrain_dim),u_terrain_matrix:new l.UniformMatrix4f(he,ye.u_terrain_matrix),u_terrain_unpack:new l.Uniform4f(he,ye.u_terrain_unpack),u_terrain_offset:new l.Uniform1f(he,ye.u_terrain_offset),u_terrain_exaggeration:new l.Uniform1f(he,ye.u_terrain_exaggeration)}))(t,ue),this.binderUniforms=u?u.getUniforms(t,ue):[]}draw(t,n,s,u,d,f,_,y,v,T,I,C,F,R,B,X,J,te){const O=t.gl;if(this.failedToCreate)return;if(t.program.set(this.program),t.setDepthMode(s),t.setStencilMode(u),t.setColorMode(d),t.setCullFace(f),y){t.activeTexture.set(O.TEXTURE2),O.bindTexture(O.TEXTURE_2D,y.depthTexture),t.activeTexture.set(O.TEXTURE3),O.bindTexture(O.TEXTURE_2D,y.texture);for(const ie in this.terrainUniforms)this.terrainUniforms[ie].set(y[ie])}for(const ie in this.fixedUniforms)this.fixedUniforms[ie].set(_[ie]);B&&B.setUniforms(t,this.binderUniforms,F,{zoom:R});let ne=0;switch(n){case O.LINES:ne=2;break;case O.TRIANGLES:ne=3;break;case O.LINE_STRIP:ne=1}for(const ie of C.get()){const ue=ie.vaos||(ie.vaos={});(ue[v]||(ue[v]=new ts)).bind(t,this,T,B?B.getPaintVertexBuffers():[],I,ie.vertexOffset,X,J,te),O.drawElements(n,ie.primitiveLength*ne,O.UNSIGNED_SHORT,ie.primitiveOffset*ne*2)}}}function ra(a,t,n){const s=1/qt(n,1,t.transform.tileZoom),u=Math.pow(2,n.tileID.overscaledZ),d=n.tileSize*Math.pow(2,t.transform.tileZoom)/u,f=d*(n.tileID.canonical.x+n.tileID.wrap*u),_=d*n.tileID.canonical.y;return{u_image:0,u_texsize:n.imageAtlasTexture.size,u_scale:[s,a.fromScale,a.toScale],u_fade:a.t,u_pixel_coord_upper:[f>>16,_>>16],u_pixel_coord_lower:[65535&f,65535&_]}}const rs=(a,t,n,s)=>{const u=t.style.light,d=u.properties.get("position"),f=[d.x,d.y,d.z],_=l.create$1();u.properties.get("anchor")==="viewport"&&l.fromRotation(_,-t.transform.angle),l.transformMat3(f,f,_);const y=u.properties.get("color");return{u_matrix:a,u_lightpos:f,u_lightintensity:u.properties.get("intensity"),u_lightcolor:[y.r,y.g,y.b],u_vertical_gradient:+n,u_opacity:s}},fl=(a,t,n,s,u,d,f)=>l.extend(rs(a,t,n,s),ra(d,t,f),{u_height_factor:-Math.pow(2,u.overscaledZ)/f.tileSize/8}),To=a=>({u_matrix:a}),ns=(a,t,n,s)=>l.extend(To(a),ra(n,t,s)),na=(a,t)=>({u_matrix:a,u_world:t}),oa=(a,t,n,s,u)=>l.extend(ns(a,t,n,s),{u_world:u}),sa=(a,t,n,s)=>{const u=a.transform;let d,f;if(s.paint.get("circle-pitch-alignment")==="map"){const _=qt(n,1,u.zoom);d=!0,f=[_,_]}else d=!1,f=u.pixelsToGLUnits;return{u_camera_to_center_distance:u.cameraToCenterDistance,u_scale_with_map:+(s.paint.get("circle-pitch-scale")==="map"),u_matrix:a.translatePosMatrix(t.posMatrix,n,s.paint.get("circle-translate"),s.paint.get("circle-translate-anchor")),u_pitch_with_map:+d,u_device_pixel_ratio:a.pixelRatio,u_extrude_scale:f}},Hr=(a,t,n)=>{const s=qt(n,1,t.zoom),u=Math.pow(2,t.zoom-n.tileID.overscaledZ),d=n.tileID.overscaleFactor();return{u_matrix:a,u_camera_to_center_distance:t.cameraToCenterDistance,u_pixels_to_tile_units:s,u_extrude_scale:[t.pixelsToGLUnits[0]/(s*u),t.pixelsToGLUnits[1]/(s*u)],u_overscale_factor:d}},Zn=(a,t,n=1)=>({u_matrix:a,u_color:t,u_overlay:0,u_overlay_scale:n}),wn=a=>({u_matrix:a}),Eo=(a,t,n,s)=>({u_matrix:a,u_extrude_scale:qt(t,1,n),u_intensity:s});function So(a,t){const n=Math.pow(2,t.canonical.z),s=t.canonical.y;return[new l.MercatorCoordinate(0,s/n).toLngLat().lat,new l.MercatorCoordinate(0,(s+1)/n).toLngLat().lat]}const Tn=(a,t,n,s)=>{const u=a.transform;return{u_matrix:Xn(a,t,n,s),u_ratio:1/qt(t,1,u.zoom),u_device_pixel_ratio:a.pixelRatio,u_units_to_pixels:[1/u.pixelsToGLUnits[0],1/u.pixelsToGLUnits[1]]}},os=(a,t,n,s,u)=>l.extend(Tn(a,t,n,u),{u_image:0,u_image_height:s}),Io=(a,t,n,s,u)=>{const d=a.transform,f=Dt(t,d);return{u_matrix:Xn(a,t,n,u),u_texsize:t.imageAtlasTexture.size,u_ratio:1/qt(t,1,d.zoom),u_device_pixel_ratio:a.pixelRatio,u_image:0,u_scale:[f,s.fromScale,s.toScale],u_fade:s.t,u_units_to_pixels:[1/d.pixelsToGLUnits[0],1/d.pixelsToGLUnits[1]]}},jn=(a,t,n,s,u,d)=>{const f=a.lineAtlas,_=Dt(t,a.transform),y=n.layout.get("line-cap")==="round",v=f.getDash(s.from,y),T=f.getDash(s.to,y),I=v.width*u.fromScale,C=T.width*u.toScale;return l.extend(Tn(a,t,n,d),{u_patternscale_a:[_/I,-v.height/2],u_patternscale_b:[_/C,-T.height/2],u_sdfgamma:f.width/(256*Math.min(I,C)*a.pixelRatio)/2,u_image:0,u_tex_y_a:v.y,u_tex_y_b:T.y,u_mix:u.t})};function Dt(a,t){return 1/qt(a,1,t.tileZoom)}function Xn(a,t,n,s){return a.translatePosMatrix(s?s.posMatrix:t.tileID.posMatrix,t,n.paint.get("line-translate"),n.paint.get("line-translate-anchor"))}const aa=(a,t,n,s,u)=>{return{u_matrix:a,u_tl_parent:t,u_scale_parent:n,u_buffer_scale:1,u_fade_t:s.mix,u_opacity:s.opacity*u.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:u.paint.get("raster-brightness-min"),u_brightness_high:u.paint.get("raster-brightness-max"),u_saturation_factor:(f=u.paint.get("raster-saturation"),f>0?1-1/(1.001-f):-f),u_contrast_factor:(d=u.paint.get("raster-contrast"),d>0?1/(1-d):1+d),u_spin_weights:la(u.paint.get("raster-hue-rotate"))};var d,f};function la(a){a*=Math.PI/180;const t=Math.sin(a),n=Math.cos(a);return[(2*n+1)/3,(-Math.sqrt(3)*t-n+1)/3,(Math.sqrt(3)*t-n+1)/3]}const ss=(a,t,n,s,u,d,f,_,y,v)=>{const T=u.transform;return{u_is_size_zoom_constant:+(a==="constant"||a==="source"),u_is_size_feature_constant:+(a==="constant"||a==="camera"),u_size_t:t?t.uSizeT:0,u_size:t?t.uSize:0,u_camera_to_center_distance:T.cameraToCenterDistance,u_pitch:T.pitch/360*2*Math.PI,u_rotate_symbol:+n,u_aspect_ratio:T.width/T.height,u_fade_change:u.options.fadeDuration?u.symbolFadeChange:1,u_matrix:d,u_label_plane_matrix:f,u_coord_matrix:_,u_is_text:+y,u_pitch_with_map:+s,u_texsize:v,u_texture:0}},Ao=(a,t,n,s,u,d,f,_,y,v,T)=>{const I=u.transform;return l.extend(ss(a,t,n,s,u,d,f,_,y,v),{u_gamma_scale:s?Math.cos(I._pitch)*I.cameraToCenterDistance:1,u_device_pixel_ratio:u.pixelRatio,u_is_halo:+T})},ca=(a,t,n,s,u,d,f,_,y,v)=>l.extend(Ao(a,t,n,s,u,d,f,_,!0,y,!0),{u_texsize_icon:v,u_texture_icon:1}),ml=(a,t,n)=>({u_matrix:a,u_opacity:t,u_color:n}),gl=(a,t,n,s,u,d)=>l.extend(function(f,_,y,v){const T=y.imageManager.getPattern(f.from.toString()),I=y.imageManager.getPattern(f.to.toString()),{width:C,height:F}=y.imageManager.getPixelSize(),R=Math.pow(2,v.tileID.overscaledZ),B=v.tileSize*Math.pow(2,y.transform.tileZoom)/R,X=B*(v.tileID.canonical.x+v.tileID.wrap*R),J=B*v.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:T.tl,u_pattern_br_a:T.br,u_pattern_tl_b:I.tl,u_pattern_br_b:I.br,u_texsize:[C,F],u_mix:_.t,u_pattern_size_a:T.displaySize,u_pattern_size_b:I.displaySize,u_scale_a:_.fromScale,u_scale_b:_.toScale,u_tile_units_to_pixels:1/qt(v,1,y.transform.tileZoom),u_pixel_coord_upper:[X>>16,J>>16],u_pixel_coord_lower:[65535&X,65535&J]}}(s,d,n,u),{u_matrix:a,u_opacity:t}),as={fillExtrusion:(a,t)=>({u_matrix:new l.UniformMatrix4f(a,t.u_matrix),u_lightpos:new l.Uniform3f(a,t.u_lightpos),u_lightintensity:new l.Uniform1f(a,t.u_lightintensity),u_lightcolor:new l.Uniform3f(a,t.u_lightcolor),u_vertical_gradient:new l.Uniform1f(a,t.u_vertical_gradient),u_opacity:new l.Uniform1f(a,t.u_opacity)}),fillExtrusionPattern:(a,t)=>({u_matrix:new l.UniformMatrix4f(a,t.u_matrix),u_lightpos:new l.Uniform3f(a,t.u_lightpos),u_lightintensity:new l.Uniform1f(a,t.u_lightintensity),u_lightcolor:new l.Uniform3f(a,t.u_lightcolor),u_vertical_gradient:new l.Uniform1f(a,t.u_vertical_gradient),u_height_factor:new l.Uniform1f(a,t.u_height_factor),u_image:new l.Uniform1i(a,t.u_image),u_texsize:new l.Uniform2f(a,t.u_texsize),u_pixel_coord_upper:new l.Uniform2f(a,t.u_pixel_coord_upper),u_pixel_coord_lower:new l.Uniform2f(a,t.u_pixel_coord_lower),u_scale:new l.Uniform3f(a,t.u_scale),u_fade:new l.Uniform1f(a,t.u_fade),u_opacity:new l.Uniform1f(a,t.u_opacity)}),fill:(a,t)=>({u_matrix:new l.UniformMatrix4f(a,t.u_matrix)}),fillPattern:(a,t)=>({u_matrix:new l.UniformMatrix4f(a,t.u_matrix),u_image:new l.Uniform1i(a,t.u_image),u_texsize:new l.Uniform2f(a,t.u_texsize),u_pixel_coord_upper:new l.Uniform2f(a,t.u_pixel_coord_upper),u_pixel_coord_lower:new l.Uniform2f(a,t.u_pixel_coord_lower),u_scale:new l.Uniform3f(a,t.u_scale),u_fade:new l.Uniform1f(a,t.u_fade)}),fillOutline:(a,t)=>({u_matrix:new l.UniformMatrix4f(a,t.u_matrix),u_world:new l.Uniform2f(a,t.u_world)}),fillOutlinePattern:(a,t)=>({u_matrix:new l.UniformMatrix4f(a,t.u_matrix),u_world:new l.Uniform2f(a,t.u_world),u_image:new l.Uniform1i(a,t.u_image),u_texsize:new l.Uniform2f(a,t.u_texsize),u_pixel_coord_upper:new l.Uniform2f(a,t.u_pixel_coord_upper),u_pixel_coord_lower:new l.Uniform2f(a,t.u_pixel_coord_lower),u_scale:new l.Uniform3f(a,t.u_scale),u_fade:new l.Uniform1f(a,t.u_fade)}),circle:(a,t)=>({u_camera_to_center_distance:new l.Uniform1f(a,t.u_camera_to_center_distance),u_scale_with_map:new l.Uniform1i(a,t.u_scale_with_map),u_pitch_with_map:new l.Uniform1i(a,t.u_pitch_with_map),u_extrude_scale:new l.Uniform2f(a,t.u_extrude_scale),u_device_pixel_ratio:new l.Uniform1f(a,t.u_device_pixel_ratio),u_matrix:new l.UniformMatrix4f(a,t.u_matrix)}),collisionBox:(a,t)=>({u_matrix:new l.UniformMatrix4f(a,t.u_matrix),u_camera_to_center_distance:new l.Uniform1f(a,t.u_camera_to_center_distance),u_pixels_to_tile_units:new l.Uniform1f(a,t.u_pixels_to_tile_units),u_extrude_scale:new l.Uniform2f(a,t.u_extrude_scale),u_overscale_factor:new l.Uniform1f(a,t.u_overscale_factor)}),collisionCircle:(a,t)=>({u_matrix:new l.UniformMatrix4f(a,t.u_matrix),u_inv_matrix:new l.UniformMatrix4f(a,t.u_inv_matrix),u_camera_to_center_distance:new l.Uniform1f(a,t.u_camera_to_center_distance),u_viewport_size:new l.Uniform2f(a,t.u_viewport_size)}),debug:(a,t)=>({u_color:new l.UniformColor(a,t.u_color),u_matrix:new l.UniformMatrix4f(a,t.u_matrix),u_overlay:new l.Uniform1i(a,t.u_overlay),u_overlay_scale:new l.Uniform1f(a,t.u_overlay_scale)}),clippingMask:(a,t)=>({u_matrix:new l.UniformMatrix4f(a,t.u_matrix)}),heatmap:(a,t)=>({u_extrude_scale:new l.Uniform1f(a,t.u_extrude_scale),u_intensity:new l.Uniform1f(a,t.u_intensity),u_matrix:new l.UniformMatrix4f(a,t.u_matrix)}),heatmapTexture:(a,t)=>({u_matrix:new l.UniformMatrix4f(a,t.u_matrix),u_world:new l.Uniform2f(a,t.u_world),u_image:new l.Uniform1i(a,t.u_image),u_color_ramp:new l.Uniform1i(a,t.u_color_ramp),u_opacity:new l.Uniform1f(a,t.u_opacity)}),hillshade:(a,t)=>({u_matrix:new l.UniformMatrix4f(a,t.u_matrix),u_image:new l.Uniform1i(a,t.u_image),u_latrange:new l.Uniform2f(a,t.u_latrange),u_light:new l.Uniform2f(a,t.u_light),u_shadow:new l.UniformColor(a,t.u_shadow),u_highlight:new l.UniformColor(a,t.u_highlight),u_accent:new l.UniformColor(a,t.u_accent)}),hillshadePrepare:(a,t)=>({u_matrix:new l.UniformMatrix4f(a,t.u_matrix),u_image:new l.Uniform1i(a,t.u_image),u_dimension:new l.Uniform2f(a,t.u_dimension),u_zoom:new l.Uniform1f(a,t.u_zoom),u_unpack:new l.Uniform4f(a,t.u_unpack)}),line:(a,t)=>({u_matrix:new l.UniformMatrix4f(a,t.u_matrix),u_ratio:new l.Uniform1f(a,t.u_ratio),u_device_pixel_ratio:new l.Uniform1f(a,t.u_device_pixel_ratio),u_units_to_pixels:new l.Uniform2f(a,t.u_units_to_pixels)}),lineGradient:(a,t)=>({u_matrix:new l.UniformMatrix4f(a,t.u_matrix),u_ratio:new l.Uniform1f(a,t.u_ratio),u_device_pixel_ratio:new l.Uniform1f(a,t.u_device_pixel_ratio),u_units_to_pixels:new l.Uniform2f(a,t.u_units_to_pixels),u_image:new l.Uniform1i(a,t.u_image),u_image_height:new l.Uniform1f(a,t.u_image_height)}),linePattern:(a,t)=>({u_matrix:new l.UniformMatrix4f(a,t.u_matrix),u_texsize:new l.Uniform2f(a,t.u_texsize),u_ratio:new l.Uniform1f(a,t.u_ratio),u_device_pixel_ratio:new l.Uniform1f(a,t.u_device_pixel_ratio),u_image:new l.Uniform1i(a,t.u_image),u_units_to_pixels:new l.Uniform2f(a,t.u_units_to_pixels),u_scale:new l.Uniform3f(a,t.u_scale),u_fade:new l.Uniform1f(a,t.u_fade)}),lineSDF:(a,t)=>({u_matrix:new l.UniformMatrix4f(a,t.u_matrix),u_ratio:new l.Uniform1f(a,t.u_ratio),u_device_pixel_ratio:new l.Uniform1f(a,t.u_device_pixel_ratio),u_units_to_pixels:new l.Uniform2f(a,t.u_units_to_pixels),u_patternscale_a:new l.Uniform2f(a,t.u_patternscale_a),u_patternscale_b:new l.Uniform2f(a,t.u_patternscale_b),u_sdfgamma:new l.Uniform1f(a,t.u_sdfgamma),u_image:new l.Uniform1i(a,t.u_image),u_tex_y_a:new l.Uniform1f(a,t.u_tex_y_a),u_tex_y_b:new l.Uniform1f(a,t.u_tex_y_b),u_mix:new l.Uniform1f(a,t.u_mix)}),raster:(a,t)=>({u_matrix:new l.UniformMatrix4f(a,t.u_matrix),u_tl_parent:new l.Uniform2f(a,t.u_tl_parent),u_scale_parent:new l.Uniform1f(a,t.u_scale_parent),u_buffer_scale:new l.Uniform1f(a,t.u_buffer_scale),u_fade_t:new l.Uniform1f(a,t.u_fade_t),u_opacity:new l.Uniform1f(a,t.u_opacity),u_image0:new l.Uniform1i(a,t.u_image0),u_image1:new l.Uniform1i(a,t.u_image1),u_brightness_low:new l.Uniform1f(a,t.u_brightness_low),u_brightness_high:new l.Uniform1f(a,t.u_brightness_high),u_saturation_factor:new l.Uniform1f(a,t.u_saturation_factor),u_contrast_factor:new l.Uniform1f(a,t.u_contrast_factor),u_spin_weights:new l.Uniform3f(a,t.u_spin_weights)}),symbolIcon:(a,t)=>({u_is_size_zoom_constant:new l.Uniform1i(a,t.u_is_size_zoom_constant),u_is_size_feature_constant:new l.Uniform1i(a,t.u_is_size_feature_constant),u_size_t:new l.Uniform1f(a,t.u_size_t),u_size:new l.Uniform1f(a,t.u_size),u_camera_to_center_distance:new l.Uniform1f(a,t.u_camera_to_center_distance),u_pitch:new l.Uniform1f(a,t.u_pitch),u_rotate_symbol:new l.Uniform1i(a,t.u_rotate_symbol),u_aspect_ratio:new l.Uniform1f(a,t.u_aspect_ratio),u_fade_change:new l.Uniform1f(a,t.u_fade_change),u_matrix:new l.UniformMatrix4f(a,t.u_matrix),u_label_plane_matrix:new l.UniformMatrix4f(a,t.u_label_plane_matrix),u_coord_matrix:new l.UniformMatrix4f(a,t.u_coord_matrix),u_is_text:new l.Uniform1i(a,t.u_is_text),u_pitch_with_map:new l.Uniform1i(a,t.u_pitch_with_map),u_texsize:new l.Uniform2f(a,t.u_texsize),u_texture:new l.Uniform1i(a,t.u_texture)}),symbolSDF:(a,t)=>({u_is_size_zoom_constant:new l.Uniform1i(a,t.u_is_size_zoom_constant),u_is_size_feature_constant:new l.Uniform1i(a,t.u_is_size_feature_constant),u_size_t:new l.Uniform1f(a,t.u_size_t),u_size:new l.Uniform1f(a,t.u_size),u_camera_to_center_distance:new l.Uniform1f(a,t.u_camera_to_center_distance),u_pitch:new l.Uniform1f(a,t.u_pitch),u_rotate_symbol:new l.Uniform1i(a,t.u_rotate_symbol),u_aspect_ratio:new l.Uniform1f(a,t.u_aspect_ratio),u_fade_change:new l.Uniform1f(a,t.u_fade_change),u_matrix:new l.UniformMatrix4f(a,t.u_matrix),u_label_plane_matrix:new l.UniformMatrix4f(a,t.u_label_plane_matrix),u_coord_matrix:new l.UniformMatrix4f(a,t.u_coord_matrix),u_is_text:new l.Uniform1i(a,t.u_is_text),u_pitch_with_map:new l.Uniform1i(a,t.u_pitch_with_map),u_texsize:new l.Uniform2f(a,t.u_texsize),u_texture:new l.Uniform1i(a,t.u_texture),u_gamma_scale:new l.Uniform1f(a,t.u_gamma_scale),u_device_pixel_ratio:new l.Uniform1f(a,t.u_device_pixel_ratio),u_is_halo:new l.Uniform1i(a,t.u_is_halo)}),symbolTextAndIcon:(a,t)=>({u_is_size_zoom_constant:new l.Uniform1i(a,t.u_is_size_zoom_constant),u_is_size_feature_constant:new l.Uniform1i(a,t.u_is_size_feature_constant),u_size_t:new l.Uniform1f(a,t.u_size_t),u_size:new l.Uniform1f(a,t.u_size),u_camera_to_center_distance:new l.Uniform1f(a,t.u_camera_to_center_distance),u_pitch:new l.Uniform1f(a,t.u_pitch),u_rotate_symbol:new l.Uniform1i(a,t.u_rotate_symbol),u_aspect_ratio:new l.Uniform1f(a,t.u_aspect_ratio),u_fade_change:new l.Uniform1f(a,t.u_fade_change),u_matrix:new l.UniformMatrix4f(a,t.u_matrix),u_label_plane_matrix:new l.UniformMatrix4f(a,t.u_label_plane_matrix),u_coord_matrix:new l.UniformMatrix4f(a,t.u_coord_matrix),u_is_text:new l.Uniform1i(a,t.u_is_text),u_pitch_with_map:new l.Uniform1i(a,t.u_pitch_with_map),u_texsize:new l.Uniform2f(a,t.u_texsize),u_texsize_icon:new l.Uniform2f(a,t.u_texsize_icon),u_texture:new l.Uniform1i(a,t.u_texture),u_texture_icon:new l.Uniform1i(a,t.u_texture_icon),u_gamma_scale:new l.Uniform1f(a,t.u_gamma_scale),u_device_pixel_ratio:new l.Uniform1f(a,t.u_device_pixel_ratio),u_is_halo:new l.Uniform1i(a,t.u_is_halo)}),background:(a,t)=>({u_matrix:new l.UniformMatrix4f(a,t.u_matrix),u_opacity:new l.Uniform1f(a,t.u_opacity),u_color:new l.UniformColor(a,t.u_color)}),backgroundPattern:(a,t)=>({u_matrix:new l.UniformMatrix4f(a,t.u_matrix),u_opacity:new l.Uniform1f(a,t.u_opacity),u_image:new l.Uniform1i(a,t.u_image),u_pattern_tl_a:new l.Uniform2f(a,t.u_pattern_tl_a),u_pattern_br_a:new l.Uniform2f(a,t.u_pattern_br_a),u_pattern_tl_b:new l.Uniform2f(a,t.u_pattern_tl_b),u_pattern_br_b:new l.Uniform2f(a,t.u_pattern_br_b),u_texsize:new l.Uniform2f(a,t.u_texsize),u_mix:new l.Uniform1f(a,t.u_mix),u_pattern_size_a:new l.Uniform2f(a,t.u_pattern_size_a),u_pattern_size_b:new l.Uniform2f(a,t.u_pattern_size_b),u_scale_a:new l.Uniform1f(a,t.u_scale_a),u_scale_b:new l.Uniform1f(a,t.u_scale_b),u_pixel_coord_upper:new l.Uniform2f(a,t.u_pixel_coord_upper),u_pixel_coord_lower:new l.Uniform2f(a,t.u_pixel_coord_lower),u_tile_units_to_pixels:new l.Uniform1f(a,t.u_tile_units_to_pixels)}),terrain:(a,t)=>({u_matrix:new l.UniformMatrix4f(a,t.u_matrix),u_texture:new l.Uniform1i(a,t.u_texture)}),terrainDepth:(a,t)=>({u_matrix:new l.UniformMatrix4f(a,t.u_matrix)}),terrainCoords:(a,t)=>({u_matrix:new l.UniformMatrix4f(a,t.u_matrix),u_texture:new l.Uniform1i(a,t.u_texture),u_terrain_coords_id:new l.Uniform1f(a,t.u_terrain_coords_id)})};class ls{constructor(t,n,s){this.context=t;const u=t.gl;this.buffer=u.createBuffer(),this.dynamicDraw=Boolean(s),this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),u.bufferData(u.ELEMENT_ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?u.DYNAMIC_DRAW:u.STATIC_DRAW),this.dynamicDraw||delete n.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(t){const n=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),n.bufferSubData(n.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const cs={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class us{constructor(t,n,s,u){this.length=n.length,this.attributes=s,this.itemSize=n.bytesPerElement,this.dynamicDraw=u,this.context=t;const d=t.gl;this.buffer=d.createBuffer(),t.bindVertexBuffer.set(this.buffer),d.bufferData(d.ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?d.DYNAMIC_DRAW:d.STATIC_DRAW),this.dynamicDraw||delete n.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(t){if(t.length!==this.length)throw new Error(`Length of new data is ${t.length}, which doesn't match current length of ${this.length}`);const n=this.context.gl;this.bind(),n.bufferSubData(n.ARRAY_BUFFER,0,t.arrayBuffer)}enableAttributes(t,n){for(let s=0;s<this.attributes.length;s++){const u=n.attributes[this.attributes[s].name];u!==void 0&&t.enableVertexAttribArray(u)}}setVertexAttribPointers(t,n,s){for(let u=0;u<this.attributes.length;u++){const d=this.attributes[u],f=n.attributes[d.name];f!==void 0&&t.vertexAttribPointer(f,d.components,t[cs[d.type]],!1,this.itemSize,d.offset+this.itemSize*(s||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class _t{constructor(t){this.gl=t.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(t){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class ua extends _t{getDefault(){return l.Color.transparent}set(t){const n=this.current;(t.r!==n.r||t.g!==n.g||t.b!==n.b||t.a!==n.a||this.dirty)&&(this.gl.clearColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class _l extends _t{getDefault(){return 1}set(t){(t!==this.current||this.dirty)&&(this.gl.clearDepth(t),this.current=t,this.dirty=!1)}}class Wn extends _t{getDefault(){return 0}set(t){(t!==this.current||this.dirty)&&(this.gl.clearStencil(t),this.current=t,this.dirty=!1)}}class Hn extends _t{getDefault(){return[!0,!0,!0,!0]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||t[2]!==n[2]||t[3]!==n[3]||this.dirty)&&(this.gl.colorMask(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class ha extends _t{getDefault(){return!0}set(t){(t!==this.current||this.dirty)&&(this.gl.depthMask(t),this.current=t,this.dirty=!1)}}class Ci extends _t{getDefault(){return 255}set(t){(t!==this.current||this.dirty)&&(this.gl.stencilMask(t),this.current=t,this.dirty=!1)}}class hs extends _t{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(t){const n=this.current;(t.func!==n.func||t.ref!==n.ref||t.mask!==n.mask||this.dirty)&&(this.gl.stencilFunc(t.func,t.ref,t.mask),this.current=t,this.dirty=!1)}}class Co extends _t{getDefault(){const t=this.gl;return[t.KEEP,t.KEEP,t.KEEP]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||t[2]!==n[2]||this.dirty)&&(this.gl.stencilOp(t[0],t[1],t[2]),this.current=t,this.dirty=!1)}}class Mo extends _t{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.STENCIL_TEST):n.disable(n.STENCIL_TEST),this.current=t,this.dirty=!1}}class ds extends _t{getDefault(){return[0,1]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||this.dirty)&&(this.gl.depthRange(t[0],t[1]),this.current=t,this.dirty=!1)}}class ps extends _t{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.DEPTH_TEST):n.disable(n.DEPTH_TEST),this.current=t,this.dirty=!1}}class zo extends _t{getDefault(){return this.gl.LESS}set(t){(t!==this.current||this.dirty)&&(this.gl.depthFunc(t),this.current=t,this.dirty=!1)}}class fs extends _t{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.BLEND):n.disable(n.BLEND),this.current=t,this.dirty=!1}}class ms extends _t{getDefault(){const t=this.gl;return[t.ONE,t.ZERO]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||this.dirty)&&(this.gl.blendFunc(t[0],t[1]),this.current=t,this.dirty=!1)}}class Po extends _t{getDefault(){return l.Color.transparent}set(t){const n=this.current;(t.r!==n.r||t.g!==n.g||t.b!==n.b||t.a!==n.a||this.dirty)&&(this.gl.blendColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class da extends _t{getDefault(){return this.gl.FUNC_ADD}set(t){(t!==this.current||this.dirty)&&(this.gl.blendEquation(t),this.current=t,this.dirty=!1)}}class pa extends _t{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.CULL_FACE):n.disable(n.CULL_FACE),this.current=t,this.dirty=!1}}class En extends _t{getDefault(){return this.gl.BACK}set(t){(t!==this.current||this.dirty)&&(this.gl.cullFace(t),this.current=t,this.dirty=!1)}}class yl extends _t{getDefault(){return this.gl.CCW}set(t){(t!==this.current||this.dirty)&&(this.gl.frontFace(t),this.current=t,this.dirty=!1)}}class xl extends _t{getDefault(){return null}set(t){(t!==this.current||this.dirty)&&(this.gl.useProgram(t),this.current=t,this.dirty=!1)}}class vl extends _t{getDefault(){return this.gl.TEXTURE0}set(t){(t!==this.current||this.dirty)&&(this.gl.activeTexture(t),this.current=t,this.dirty=!1)}}class bl extends _t{getDefault(){const t=this.gl;return[0,0,t.drawingBufferWidth,t.drawingBufferHeight]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||t[2]!==n[2]||t[3]!==n[3]||this.dirty)&&(this.gl.viewport(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class wl extends _t{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindFramebuffer(n.FRAMEBUFFER,t),this.current=t,this.dirty=!1}}class Tl extends _t{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindRenderbuffer(n.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class gs extends _t{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindTexture(n.TEXTURE_2D,t),this.current=t,this.dirty=!1}}class ko extends _t{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindBuffer(n.ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class _s extends _t{getDefault(){return null}set(t){const n=this.gl;n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class ys extends _t{constructor(t){super(t),this.vao=t.extVertexArrayObject}getDefault(){return null}set(t){this.vao&&(t!==this.current||this.dirty)&&(this.vao.bindVertexArrayOES(t),this.current=t,this.dirty=!1)}}class Sn extends _t{getDefault(){return 4}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.pixelStorei(n.UNPACK_ALIGNMENT,t),this.current=t,this.dirty=!1}}class fa extends _t{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t),this.current=t,this.dirty=!1}}class ma extends _t{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,t),this.current=t,this.dirty=!1}}class Do extends _t{constructor(t,n){super(t),this.context=t,this.parent=n}getDefault(){return null}}class Kr extends Do{setDirty(){this.dirty=!0}set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const n=this.gl;n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,t,0),this.current=t,this.dirty=!1}}class ga extends Do{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const n=this.gl;n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class In{constructor(t,n,s,u){this.context=t,this.width=n,this.height=s;const d=t.gl,f=this.framebuffer=d.createFramebuffer();if(this.colorAttachment=new Kr(t,f),u&&(this.depthAttachment=new ga(t,f)),d.checkFramebufferStatus(d.FRAMEBUFFER)!==d.FRAMEBUFFER_COMPLETE)throw new Error("Framebuffer is not complete")}destroy(){const t=this.context.gl,n=this.colorAttachment.get();if(n&&t.deleteTexture(n),this.depthAttachment){const s=this.depthAttachment.get();s&&t.deleteRenderbuffer(s)}t.deleteFramebuffer(this.framebuffer)}}class zt{constructor(t,n,s){this.blendFunction=t,this.blendColor=n,this.mask=s}}zt.Replace=[1,0],zt.disabled=new zt(zt.Replace,l.Color.transparent,[!1,!1,!1,!1]),zt.unblended=new zt(zt.Replace,l.Color.transparent,[!0,!0,!0,!0]),zt.alphaBlended=new zt([1,771],l.Color.transparent,[!0,!0,!0,!0]);class _a{constructor(t){this.gl=t,this.extVertexArrayObject=this.gl.getExtension("OES_vertex_array_object"),this.clearColor=new ua(this),this.clearDepth=new _l(this),this.clearStencil=new Wn(this),this.colorMask=new Hn(this),this.depthMask=new ha(this),this.stencilMask=new Ci(this),this.stencilFunc=new hs(this),this.stencilOp=new Co(this),this.stencilTest=new Mo(this),this.depthRange=new ds(this),this.depthTest=new ps(this),this.depthFunc=new zo(this),this.blend=new fs(this),this.blendFunc=new ms(this),this.blendColor=new Po(this),this.blendEquation=new da(this),this.cullFace=new pa(this),this.cullFaceSide=new En(this),this.frontFace=new yl(this),this.program=new xl(this),this.activeTexture=new vl(this),this.viewport=new bl(this),this.bindFramebuffer=new wl(this),this.bindRenderbuffer=new Tl(this),this.bindTexture=new gs(this),this.bindVertexBuffer=new ko(this),this.bindElementBuffer=new _s(this),this.bindVertexArrayOES=this.extVertexArrayObject&&new ys(this),this.pixelStoreUnpack=new Sn(this),this.pixelStoreUnpackPremultiplyAlpha=new fa(this),this.pixelStoreUnpackFlipY=new ma(this),this.extTextureFilterAnisotropic=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=t.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.extTextureHalfFloat=t.getExtension("OES_texture_half_float"),this.extTextureHalfFloat&&(t.getExtension("OES_texture_half_float_linear"),this.extRenderToTextureHalfFloat=t.getExtension("EXT_color_buffer_half_float")),this.extTimerQuery=t.getExtension("EXT_disjoint_timer_query"),this.maxTextureSize=t.getParameter(t.MAX_TEXTURE_SIZE)}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.extVertexArrayObject&&(this.bindVertexArrayOES.dirty=!0),this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(t,n){return new ls(this,t,n)}createVertexBuffer(t,n,s){return new us(this,t,n,s)}createRenderbuffer(t,n,s){const u=this.gl,d=u.createRenderbuffer();return this.bindRenderbuffer.set(d),u.renderbufferStorage(u.RENDERBUFFER,t,n,s),this.bindRenderbuffer.set(null),d}createFramebuffer(t,n,s){return new In(this,t,n,s)}clear({color:t,depth:n}){const s=this.gl;let u=0;t&&(u|=s.COLOR_BUFFER_BIT,this.clearColor.set(t),this.colorMask.set([!0,!0,!0,!0])),n!==void 0&&(u|=s.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(n),this.depthMask.set(!0)),s.clear(u)}setCullFace(t){t.enable===!1?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){Te(t.blendFunction,zt.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(t.blendFunction),this.blendColor.set(t.blendColor)),this.colorMask.set(t.mask)}unbindVAO(){this.extVertexArrayObject&&this.bindVertexArrayOES.set(null)}}class at{constructor(t,n,s){this.func=t,this.mask=n,this.range=s}}at.ReadOnly=!1,at.ReadWrite=!0,at.disabled=new at(519,at.ReadOnly,[0,1]);const yt=7680;class Ct{constructor(t,n,s,u,d,f){this.test=t,this.ref=n,this.mask=s,this.fail=u,this.depthFail=d,this.pass=f}}Ct.disabled=new Ct({func:519,mask:0},0,0,yt,yt,yt);class Lt{constructor(t,n,s){this.enable=t,this.mode=n,this.frontFace=s}}let Kn;function An(a,t,n,s,u,d,f){const _=a.context,y=_.gl,v=a.useProgram("collisionBox"),T=[];let I=0,C=0;for(let O=0;O<s.length;O++){const ne=s[O],ie=t.getTile(ne),ue=ie.getBucket(n);if(!ue)continue;let he=ne.posMatrix;u[0]===0&&u[1]===0||(he=a.translatePosMatrix(ne.posMatrix,ie,u,d));const ye=f?ue.textCollisionBox:ue.iconCollisionBox,ce=ue.collisionCircleArray;if(ce.length>0){const Le=l.create(),Ie=he;l.mul(Le,ue.placementInvProjMatrix,a.transform.glCoordMatrix),l.mul(Le,Le,ue.placementViewportMatrix),T.push({circleArray:ce,circleOffset:C,transform:Ie,invTransform:Le,coord:ne}),I+=ce.length/4,C=I}ye&&v.draw(_,y.LINES,at.disabled,Ct.disabled,a.colorModeForRenderPass(),Lt.disabled,Hr(he,a.transform,ie),a.style.terrain&&a.style.terrain.getTerrainData(ne),n.id,ye.layoutVertexBuffer,ye.indexBuffer,ye.segments,null,a.transform.zoom,null,null,ye.collisionVertexBuffer)}if(!f||!T.length)return;const F=a.useProgram("collisionCircle"),R=new l.CollisionCircleLayoutArray;R.resize(4*I),R._trim();let B=0;for(const O of T)for(let ne=0;ne<O.circleArray.length/4;ne++){const ie=4*ne,ue=O.circleArray[ie+0],he=O.circleArray[ie+1],ye=O.circleArray[ie+2],ce=O.circleArray[ie+3];R.emplace(B++,ue,he,ye,ce,0),R.emplace(B++,ue,he,ye,ce,1),R.emplace(B++,ue,he,ye,ce,2),R.emplace(B++,ue,he,ye,ce,3)}(!Kn||Kn.length<2*I)&&(Kn=function(O){const ne=2*O,ie=new l.QuadTriangleArray;ie.resize(ne),ie._trim();for(let ue=0;ue<ne;ue++){const he=6*ue;ie.uint16[he+0]=4*ue+0,ie.uint16[he+1]=4*ue+1,ie.uint16[he+2]=4*ue+2,ie.uint16[he+3]=4*ue+2,ie.uint16[he+4]=4*ue+3,ie.uint16[he+5]=4*ue+0}return ie}(I));const X=_.createIndexBuffer(Kn,!0),J=_.createVertexBuffer(R,l.collisionCircleLayout.members,!0);for(const O of T){const ne={u_matrix:O.transform,u_inv_matrix:O.invTransform,u_camera_to_center_distance:(te=a.transform).cameraToCenterDistance,u_viewport_size:[te.width,te.height]};F.draw(_,y.TRIANGLES,at.disabled,Ct.disabled,a.colorModeForRenderPass(),Lt.disabled,ne,a.style.terrain&&a.style.terrain.getTerrainData(O.coord),n.id,J,X,l.SegmentVector.simpleSegment(0,2*O.circleOffset,O.circleArray.length,O.circleArray.length/2),null,a.transform.zoom,null,null,null)}var te;J.destroy(),X.destroy()}Lt.disabled=new Lt(!1,1029,2305),Lt.backCCW=new Lt(!0,1029,2305);const El=l.identity(new Float32Array(16));function Sl(a,t,n,s,u,d){const{horizontalAlign:f,verticalAlign:_}=l.getAnchorAlignment(a),y=-(f-.5)*t,v=-(_-.5)*n,T=l.evaluateVariableOffset(a,s);return new l.pointGeometry((y/u+T[0])*d,(v/u+T[1])*d)}function ya(a,t,n,s,u,d,f,_,y,v,T){const I=a.text.placedSymbolArray,C=a.text.dynamicLayoutVertexArray,F=a.icon.dynamicLayoutVertexArray,R={};C.clear();for(let B=0;B<I.length;B++){const X=I.get(B),J=a.allowVerticalPlacement&&!X.placedOrientation,te=X.hidden||!X.crossTileID||J?null:s[X.crossTileID];if(te){const O=new l.pointGeometry(X.anchorX,X.anchorY),ne=dt(O,n?f:d,T),ie=Oi(u.cameraToCenterDistance,ne.signedDistanceFromCamera);let ue=l.evaluateSizeForFeature(a.textSizeData,y,X)*ie/l.ONE_EM;n&&(ue*=a.tilePixelRatio/_);const{width:he,height:ye,anchor:ce,textOffset:Le,textBoxScale:Ie}=te,Re=Sl(ce,he,ye,Le,Ie,ue),Qe=n?dt(O.add(Re),d,T).point:ne.point.add(t?Re.rotate(-u.angle):Re),it=a.allowVerticalPlacement&&X.placedOrientation===l.WritingMode.vertical?Math.PI/2:0;for(let Ge=0;Ge<X.numGlyphs;Ge++)l.addDynamicAttributes(C,Qe,it);v&&X.associatedIconIndex>=0&&(R[X.associatedIconIndex]={shiftedAnchor:Qe,angle:it})}else Je(X.numGlyphs,C)}if(v){F.clear();const B=a.icon.placedSymbolArray;for(let X=0;X<B.length;X++){const J=B.get(X);if(J.hidden)Je(J.numGlyphs,F);else{const te=R[X];if(te)for(let O=0;O<J.numGlyphs;O++)l.addDynamicAttributes(F,te.shiftedAnchor,te.angle);else Je(J.numGlyphs,F)}}a.icon.dynamicLayoutVertexBuffer.updateData(F)}a.text.dynamicLayoutVertexBuffer.updateData(C)}function Il(a,t,n){return n.iconsInText&&t?"symbolTextAndIcon":a?"symbolSDF":"symbolIcon"}function Lo(a,t,n,s,u,d,f,_,y,v,T,I){const C=a.context,F=C.gl,R=a.transform,B=_==="map",X=y==="map",J=_!=="viewport"&&n.layout.get("symbol-placement")!=="point",te=B&&!X&&!J,O=!n.layout.get("symbol-sort-key").isConstant();let ne=!1;const ie=a.depthModeForSublayer(0,at.ReadOnly),ue=n.layout.get("text-variable-anchor"),he=[];for(const ye of s){const ce=t.getTile(ye),Le=ce.getBucket(n);if(!Le)continue;const Ie=u?Le.text:Le.icon;if(!Ie||!Ie.segments.get().length)continue;const Re=Ie.programConfigurations.get(n.id),Qe=u||Le.sdfIcons,it=u?Le.textSizeData:Le.iconSizeData,Ge=X||R.pitch!==0,bt=a.useProgram(Il(Qe,u,Le),Re),wt=l.evaluateSizeForZoom(it,R.zoom),ut=a.style.terrain&&a.style.terrain.getTerrainData(ye);let mt,Et,ei,nr,Wi=[0,0],or=null;if(u){if(Et=ce.glyphAtlasTexture,ei=F.LINEAR,mt=ce.glyphAtlasTexture.size,Le.iconsInText){Wi=ce.imageAtlasTexture.size,or=ce.imageAtlasTexture;const Vi=it.kind==="composite"||it.kind==="camera";nr=Ge||a.options.rotating||a.options.zooming||Vi?F.LINEAR:F.NEAREST}}else{const Vi=n.layout.get("icon-size").constantOr(0)!==1||Le.iconsNeedLinear;Et=ce.imageAtlasTexture,ei=Qe||a.options.rotating||a.options.zooming||Vi||Ge?F.LINEAR:F.NEAREST,mt=ce.imageAtlasTexture.size}const $r=qt(ce,1,a.transform.zoom),$i=Zr(ye.posMatrix,X,B,a.transform,$r),vi=ji(ye.posMatrix,X,B,a.transform,$r),xr=ue&&Le.hasTextData(),No=n.layout.get("icon-text-fit")!=="none"&&xr&&Le.hasIconData();if(J){const Vi=a.style.terrain?(Ds,Dn)=>a.style.terrain.getElevation(ye,Ds,Dn):null,en=n.layout.get("text-rotation-alignment")==="map";Ai(Le,ye.posMatrix,a,u,$i,vi,X,v,en,Vi)}const Ht=a.translatePosMatrix(ye.posMatrix,ce,d,f),ot=J||u&&ue||No?El:$i,xt=a.translatePosMatrix(vi,ce,d,f,!0),ti=Qe&&n.paint.get(u?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let ii;ii=Qe?Le.iconsInText?ca(it.kind,wt,te,X,a,Ht,ot,xt,mt,Wi):Ao(it.kind,wt,te,X,a,Ht,ot,xt,u,mt,!0):ss(it.kind,wt,te,X,a,Ht,ot,xt,u,mt);const Bt={program:bt,buffers:Ie,uniformValues:ii,atlasTexture:Et,atlasTextureIcon:or,atlasInterpolation:ei,atlasInterpolationIcon:nr,isSDF:Qe,hasHalo:ti};if(O&&Le.canOverlap){ne=!0;const Vi=Ie.segments.get();for(const en of Vi)he.push({segments:new l.SegmentVector([en]),sortKey:en.sortKey,state:Bt,terrainData:ut})}else he.push({segments:Ie.segments,sortKey:0,state:Bt,terrainData:ut})}ne&&he.sort((ye,ce)=>ye.sortKey-ce.sortKey);for(const ye of he){const ce=ye.state;if(C.activeTexture.set(F.TEXTURE0),ce.atlasTexture.bind(ce.atlasInterpolation,F.CLAMP_TO_EDGE),ce.atlasTextureIcon&&(C.activeTexture.set(F.TEXTURE1),ce.atlasTextureIcon&&ce.atlasTextureIcon.bind(ce.atlasInterpolationIcon,F.CLAMP_TO_EDGE)),ce.isSDF){const Le=ce.uniformValues;ce.hasHalo&&(Le.u_is_halo=1,Jn(ce.buffers,ye.segments,n,a,ce.program,ie,T,I,Le,ye.terrainData)),Le.u_is_halo=0}Jn(ce.buffers,ye.segments,n,a,ce.program,ie,T,I,ce.uniformValues,ye.terrainData)}}function Jn(a,t,n,s,u,d,f,_,y,v){const T=s.context;u.draw(T,T.gl.TRIANGLES,d,f,_,Lt.disabled,y,v,n.id,a.layoutVertexBuffer,a.indexBuffer,t,n.paint,s.transform.zoom,a.programConfigurations.get(n.id),a.dynamicLayoutVertexBuffer,a.opacityVertexBuffer)}function Yn(a,t,n,s,u,d,f){const _=a.context.gl,y=n.paint.get("fill-pattern"),v=y&&y.constantOr(1),T=n.getCrossfadeParameters();let I,C,F,R,B;f?(C=v&&!n.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",I=_.LINES):(C=v?"fillPattern":"fill",I=_.TRIANGLES);for(const X of s){const J=t.getTile(X);if(v&&!J.patternsLoaded())continue;const te=J.getBucket(n);if(!te)continue;const O=te.programConfigurations.get(n.id),ne=a.useProgram(C,O),ie=a.style.terrain&&a.style.terrain.getTerrainData(X);v&&(a.context.activeTexture.set(_.TEXTURE0),J.imageAtlasTexture.bind(_.LINEAR,_.CLAMP_TO_EDGE),O.updatePaintBuffers(T));const ue=y.constantOr(null);if(ue&&J.imageAtlas){const ce=J.imageAtlas,Le=ce.patternPositions[ue.to.toString()],Ie=ce.patternPositions[ue.from.toString()];Le&&Ie&&O.setConstantPatternPositions(Le,Ie)}const he=ie?X:null,ye=a.translatePosMatrix(he?he.posMatrix:X.posMatrix,J,n.paint.get("fill-translate"),n.paint.get("fill-translate-anchor"));if(f){R=te.indexBuffer2,B=te.segments2;const ce=[_.drawingBufferWidth,_.drawingBufferHeight];F=C==="fillOutlinePattern"&&v?oa(ye,a,T,J,ce):na(ye,ce)}else R=te.indexBuffer,B=te.segments,F=v?ns(ye,a,T,J):To(ye);ne.draw(a.context,I,u,a.stencilModeForClipping(X),d,Lt.disabled,F,ie,n.id,te.layoutVertexBuffer,R,B,n.paint,a.transform.zoom,O)}}function Qn(a,t,n,s,u,d,f){const _=a.context,y=_.gl,v=n.paint.get("fill-extrusion-pattern"),T=v.constantOr(1),I=n.getCrossfadeParameters(),C=n.paint.get("fill-extrusion-opacity");for(const F of s){const R=t.getTile(F),B=R.getBucket(n);if(!B)continue;const X=a.style.terrain&&a.style.terrain.getTerrainData(F),J=B.programConfigurations.get(n.id),te=a.useProgram(T?"fillExtrusionPattern":"fillExtrusion",J);T&&(a.context.activeTexture.set(y.TEXTURE0),R.imageAtlasTexture.bind(y.LINEAR,y.CLAMP_TO_EDGE),J.updatePaintBuffers(I));const O=v.constantOr(null);if(O&&R.imageAtlas){const he=R.imageAtlas,ye=he.patternPositions[O.to.toString()],ce=he.patternPositions[O.from.toString()];ye&&ce&&J.setConstantPatternPositions(ye,ce)}const ne=a.translatePosMatrix(F.posMatrix,R,n.paint.get("fill-extrusion-translate"),n.paint.get("fill-extrusion-translate-anchor")),ie=n.paint.get("fill-extrusion-vertical-gradient"),ue=T?fl(ne,a,ie,C,F,I,R):rs(ne,a,ie,C);te.draw(_,_.gl.TRIANGLES,u,d,f,Lt.backCCW,ue,X,n.id,B.layoutVertexBuffer,B.indexBuffer,B.segments,n.paint,a.transform.zoom,J,a.style.terrain&&B.centroidVertexBuffer)}}function xs(a,t,n,s,u,d,f){const _=a.context,y=_.gl,v=n.fbo;if(!v)return;const T=a.useProgram("hillshade"),I=a.style.terrain&&a.style.terrain.getTerrainData(t);_.activeTexture.set(y.TEXTURE0),y.bindTexture(y.TEXTURE_2D,v.colorAttachment.get()),T.draw(_,y.TRIANGLES,u,d,f,Lt.disabled,((C,F,R,B)=>{const X=R.paint.get("hillshade-shadow-color"),J=R.paint.get("hillshade-highlight-color"),te=R.paint.get("hillshade-accent-color");let O=R.paint.get("hillshade-illumination-direction")*(Math.PI/180);R.paint.get("hillshade-illumination-anchor")==="viewport"&&(O-=C.transform.angle);const ne=!C.options.moving;return{u_matrix:B?B.posMatrix:C.transform.calculatePosMatrix(F.tileID.toUnwrapped(),ne),u_image:0,u_latrange:So(0,F.tileID),u_light:[R.paint.get("hillshade-exaggeration"),O],u_shadow:X,u_highlight:J,u_accent:te}})(a,n,s,I?t:null),I,s.id,a.rasterBoundsBuffer,a.quadTriangleIndexBuffer,a.rasterBoundsSegments)}function xa(a,t,n,s,u,d){const f=a.context,_=f.gl,y=t.dem;if(y&&y.data){const v=y.dim,T=y.stride,I=y.getPixels();if(f.activeTexture.set(_.TEXTURE1),f.pixelStoreUnpackPremultiplyAlpha.set(!1),t.demTexture=t.demTexture||a.getTileTexture(T),t.demTexture){const F=t.demTexture;F.update(I,{premultiply:!1}),F.bind(_.NEAREST,_.CLAMP_TO_EDGE)}else t.demTexture=new He(f,I,_.RGBA,{premultiply:!1}),t.demTexture.bind(_.NEAREST,_.CLAMP_TO_EDGE);f.activeTexture.set(_.TEXTURE0);let C=t.fbo;if(!C){const F=new He(f,{width:v,height:v,data:null},_.RGBA);F.bind(_.LINEAR,_.CLAMP_TO_EDGE),C=t.fbo=f.createFramebuffer(v,v,!0),C.colorAttachment.set(F.texture)}f.bindFramebuffer.set(C.framebuffer),f.viewport.set([0,0,v,v]),a.useProgram("hillshadePrepare").draw(f,_.TRIANGLES,s,u,d,Lt.disabled,((F,R)=>{const B=R.stride,X=l.create();return l.ortho(X,0,l.EXTENT,-l.EXTENT,0,0,1),l.translate(X,X,[0,-l.EXTENT,0]),{u_matrix:X,u_image:1,u_dimension:[B,B],u_zoom:F.overscaledZ,u_unpack:R.getUnpackVector()}})(t.tileID,y),null,n.id,a.rasterBoundsBuffer,a.quadTriangleIndexBuffer,a.rasterBoundsSegments),t.needsHillshadePrepare=!1}}function Ro(a,t,n,s,u,d){const f=s.paint.get("raster-fade-duration");if(!d&&f>0){const _=l.exported.now(),y=(_-a.timeAdded)/f,v=t?(_-t.timeAdded)/f:-1,T=n.getSource(),I=u.coveringZoomLevel({tileSize:T.tileSize,roundZoom:T.roundZoom}),C=!t||Math.abs(t.tileID.overscaledZ-I)>Math.abs(a.tileID.overscaledZ-I),F=C&&a.refreshedUponExpiration?1:l.clamp(C?y:1-v,0,1);return a.refreshedUponExpiration&&y>=1&&(a.refreshedUponExpiration=!1),t?{opacity:1,mix:1-F}:{opacity:F,mix:0}}return{opacity:1,mix:0}}const Bo=new l.Color(1,0,0,1),Xi=new l.Color(0,1,0,1),va=new l.Color(0,0,1,1),vs=new l.Color(1,0,1,1),ba=new l.Color(0,1,1,1);function Jr(a,t,n,s){Cn(a,0,t+n/2,a.transform.width,n,s)}function eo(a,t,n,s){Cn(a,t-n/2,0,n,a.transform.height,s)}function Cn(a,t,n,s,u,d){const f=a.context,_=f.gl;_.enable(_.SCISSOR_TEST),_.scissor(t*a.pixelRatio,n*a.pixelRatio,s*a.pixelRatio,u*a.pixelRatio),f.clear({color:d}),_.disable(_.SCISSOR_TEST)}function Al(a,t,n){const s=a.context,u=s.gl,d=n.posMatrix,f=a.useProgram("debug"),_=at.disabled,y=Ct.disabled,v=a.colorModeForRenderPass(),T="$debug",I=a.style.terrain&&a.style.terrain.getTerrainData(n);s.activeTexture.set(u.TEXTURE0),a.emptyTexture.bind(u.LINEAR,u.CLAMP_TO_EDGE);const C=t.getTileByID(n.key).latestRawTileData,F=Math.floor((C&&C.byteLength||0)/1024),R=t.getTile(n).tileSize,B=512/Math.min(R,512)*(n.overscaledZ/a.transform.zoom)*.5;let X=n.canonical.toString();n.overscaledZ!==n.canonical.z&&(X+=` => ${n.overscaledZ}`),function(J,te){J.initDebugOverlayCanvas();const O=J.debugOverlayCanvas,ne=J.context.gl,ie=J.debugOverlayCanvas.getContext("2d");ie.clearRect(0,0,O.width,O.height),ie.shadowColor="white",ie.shadowBlur=2,ie.lineWidth=1.5,ie.strokeStyle="white",ie.textBaseline="top",ie.font="bold 36px Open Sans, sans-serif",ie.fillText(te,5,5),ie.strokeText(te,5,5),J.debugOverlayTexture.update(O),J.debugOverlayTexture.bind(ne.LINEAR,ne.CLAMP_TO_EDGE)}(a,`${X} ${F}kB`),f.draw(s,u.TRIANGLES,_,y,zt.alphaBlended,Lt.disabled,Zn(d,l.Color.transparent,B),null,T,a.debugBuffer,a.quadTriangleIndexBuffer,a.debugSegments),f.draw(s,u.LINE_STRIP,_,y,v,Lt.disabled,Zn(d,l.Color.red),I,T,a.debugBuffer,a.tileBorderIndexBuffer,a.debugSegments)}function Fo(a,t,n){const s=a.context,u=s.gl,d=a.colorModeForRenderPass(),f=new at(u.LEQUAL,at.ReadWrite,a.depthRangeFor3D),_=a.useProgram("terrain"),y=t.getTerrainMesh(),v=t.getTerrainData(n.tileID);s.bindFramebuffer.set(null),s.viewport.set([0,0,a.width,a.height]),s.activeTexture.set(u.TEXTURE0),u.bindTexture(u.TEXTURE_2D,t.getRTTFramebuffer().colorAttachment.get());const T=a.transform.calculatePosMatrix(n.tileID.toUnwrapped());_.draw(s,u.TRIANGLES,f,Ct.disabled,d,Lt.backCCW,{u_matrix:T,u_texture:0},v,"terrain",y.vertexBuffer,y.indexBuffer,y.segments)}function wa(a,t,n,s){const u=a.context,d=n.tileSize*t.qualityFactor;n.textures[s]||(n.textures[s]=a.getTileTexture(d)||new He(u,{width:d,height:d,data:null},u.gl.RGBA),n.textures[s].bind(u.gl.LINEAR,u.gl.CLAMP_TO_EDGE),s===0&&t.sourceCache.renderHistory.unshift(n.tileID.key));const f=t.getRTTFramebuffer();f.colorAttachment.set(n.textures[s].texture),u.bindFramebuffer.set(f.framebuffer),u.viewport.set([0,0,d,d])}class Ta{constructor(t){this._coordsDescendingInv={},this._coordsDescendingInvStr={},this.painter=t,this._renderToTexture={background:!0,fill:!0,line:!0,raster:!0},this._coordsDescendingInv={},this._coordsDescendingInvStr={},this._stacks=[],this._prevType=null,this._rerender={},this._renderableTiles=t.style.terrain.sourceCache.getRenderableTiles(),this._init()}_init(){const t=this.painter.style,n=t.terrain;for(const s in t.sourceCaches){this._coordsDescendingInv[s]={};const u=t.sourceCaches[s].getVisibleCoordinates();for(const d of u){const f=n.sourceCache.getTerrainCoords(d);for(const _ in f)this._coordsDescendingInv[s][_]||(this._coordsDescendingInv[s][_]=[]),this._coordsDescendingInv[s][_].push(f[_])}}for(const s of t._order){const u=t._layers[s],d=u.source;if(this._renderToTexture[u.type]&&!this._coordsDescendingInvStr[d]){this._coordsDescendingInvStr[d]={};for(const f in this._coordsDescendingInv[d])this._coordsDescendingInvStr[d][f]=this._coordsDescendingInv[d][f].map(_=>_.key).sort().join()}}return this._renderableTiles.forEach(s=>{for(const u in this._coordsDescendingInvStr){const d=this._coordsDescendingInvStr[u][s.tileID.key];d&&d!==s.textureCoords[u]&&s.clearTextures(this.painter),n.needsRerender(u,s.tileID)&&s.clearTextures(this.painter)}this._rerender[s.tileID.key]=!s.textures.length}),n.clearRerenderCache(),n.sourceCache.removeOutdated(this.painter),this}renderLayer(t){const n=t.type,s=this.painter,u=s.style._order,d=s.currentLayer,f=d+1===u.length;if(this._renderToTexture[n]&&(this._prevType&&this._renderToTexture[this._prevType]||this._stacks.push([]),this._prevType=n,this._stacks[this._stacks.length-1].push(u[d]),!f))return!0;if(this._renderToTexture[this._prevType]||n==="hillshade"||this._renderToTexture[n]&&f){this._prevType=n;const _=this._stacks.length-1,y=this._stacks[_]||[];for(const v of this._renderableTiles){if(wa(s,s.style.terrain,v,_),this._rerender[v.tileID.key]){s.context.clear({color:l.Color.transparent});for(let T=0;T<y.length;T++){const I=s.style._layers[y[T]],C=I.source?this._coordsDescendingInv[I.source][v.tileID.key]:[v.tileID];s._renderTileClippingMasks(I,C),s.renderLayer(s,s.style.sourceCaches[I.source],I,C),I.source&&(v.textureCoords[I.source]=this._coordsDescendingInvStr[I.source][v.tileID.key])}}Fo(s,s.style.terrain,v)}if(n==="hillshade"){this._stacks.push([u[d]]);for(const v of this._renderableTiles){const T=this._coordsDescendingInv[t.source][v.tileID.key];wa(s,s.style.terrain,v,this._stacks.length-1),s.context.clear({color:l.Color.transparent}),s._renderTileClippingMasks(t,T),s.renderLayer(s,s.style.sourceCaches[t.source],t,T),Fo(s,s.style.terrain,v)}return!0}return this._renderToTexture[n]}return!1}}const to={symbol:function(a,t,n,s,u){if(a.renderPass!=="translucent")return;const d=Ct.disabled,f=a.colorModeForRenderPass();n.layout.get("text-variable-anchor")&&function(_,y,v,T,I,C,F){const R=y.transform,B=I==="map",X=C==="map";for(const J of _){const te=T.getTile(J),O=te.getBucket(v);if(!O||!O.text||!O.text.segments.get().length)continue;const ne=l.evaluateSizeForZoom(O.textSizeData,R.zoom),ie=qt(te,1,y.transform.zoom),ue=Zr(J.posMatrix,X,B,y.transform,ie),he=v.layout.get("icon-text-fit")!=="none"&&O.hasIconData();if(ne){const ye=Math.pow(2,R.zoom-te.tileID.overscaledZ);ya(O,B,X,F,R,ue,J.posMatrix,ye,ne,he,y.style.terrain?(ce,Le)=>y.style.terrain.getElevation(J,ce,Le):null)}}}(s,a,n,t,n.layout.get("text-rotation-alignment"),n.layout.get("text-pitch-alignment"),u),n.paint.get("icon-opacity").constantOr(1)!==0&&Lo(a,t,n,s,!1,n.paint.get("icon-translate"),n.paint.get("icon-translate-anchor"),n.layout.get("icon-rotation-alignment"),n.layout.get("icon-pitch-alignment"),n.layout.get("icon-keep-upright"),d,f),n.paint.get("text-opacity").constantOr(1)!==0&&Lo(a,t,n,s,!0,n.paint.get("text-translate"),n.paint.get("text-translate-anchor"),n.layout.get("text-rotation-alignment"),n.layout.get("text-pitch-alignment"),n.layout.get("text-keep-upright"),d,f),t.map.showCollisionBoxes&&(An(a,t,n,s,n.paint.get("text-translate"),n.paint.get("text-translate-anchor"),!0),An(a,t,n,s,n.paint.get("icon-translate"),n.paint.get("icon-translate-anchor"),!1))},circle:function(a,t,n,s){if(a.renderPass!=="translucent")return;const u=n.paint.get("circle-opacity"),d=n.paint.get("circle-stroke-width"),f=n.paint.get("circle-stroke-opacity"),_=!n.layout.get("circle-sort-key").isConstant();if(u.constantOr(1)===0&&(d.constantOr(1)===0||f.constantOr(1)===0))return;const y=a.context,v=y.gl,T=a.depthModeForSublayer(0,at.ReadOnly),I=Ct.disabled,C=a.colorModeForRenderPass(),F=[];for(let R=0;R<s.length;R++){const B=s[R],X=t.getTile(B),J=X.getBucket(n);if(!J)continue;const te=J.programConfigurations.get(n.id),O=a.useProgram("circle",te),ne=J.layoutVertexBuffer,ie=J.indexBuffer,ue=a.style.terrain&&a.style.terrain.getTerrainData(B),he={programConfiguration:te,program:O,layoutVertexBuffer:ne,indexBuffer:ie,uniformValues:sa(a,B,X,n),terrainData:ue};if(_){const ye=J.segments.get();for(const ce of ye)F.push({segments:new l.SegmentVector([ce]),sortKey:ce.sortKey,state:he})}else F.push({segments:J.segments,sortKey:0,state:he})}_&&F.sort((R,B)=>R.sortKey-B.sortKey);for(const R of F){const{programConfiguration:B,program:X,layoutVertexBuffer:J,indexBuffer:te,uniformValues:O,terrainData:ne}=R.state;X.draw(y,v.TRIANGLES,T,I,C,Lt.disabled,O,ne,n.id,J,te,R.segments,n.paint,a.transform.zoom,B)}},heatmap:function(a,t,n,s){if(n.paint.get("heatmap-opacity")!==0)if(a.renderPass==="offscreen"){const u=a.context,d=u.gl,f=Ct.disabled,_=new zt([d.ONE,d.ONE],l.Color.transparent,[!0,!0,!0,!0]);(function(y,v,T){const I=y.gl;y.activeTexture.set(I.TEXTURE1),y.viewport.set([0,0,v.width/4,v.height/4]);let C=T.heatmapFbo;if(C)I.bindTexture(I.TEXTURE_2D,C.colorAttachment.get()),y.bindFramebuffer.set(C.framebuffer);else{const F=I.createTexture();I.bindTexture(I.TEXTURE_2D,F),I.texParameteri(I.TEXTURE_2D,I.TEXTURE_WRAP_S,I.CLAMP_TO_EDGE),I.texParameteri(I.TEXTURE_2D,I.TEXTURE_WRAP_T,I.CLAMP_TO_EDGE),I.texParameteri(I.TEXTURE_2D,I.TEXTURE_MIN_FILTER,I.LINEAR),I.texParameteri(I.TEXTURE_2D,I.TEXTURE_MAG_FILTER,I.LINEAR),C=T.heatmapFbo=y.createFramebuffer(v.width/4,v.height/4,!1),function(R,B,X,J){const te=R.gl;te.texImage2D(te.TEXTURE_2D,0,te.RGBA,B.width/4,B.height/4,0,te.RGBA,R.extRenderToTextureHalfFloat?R.extTextureHalfFloat.HALF_FLOAT_OES:te.UNSIGNED_BYTE,null),J.colorAttachment.set(X)}(y,v,F,C)}})(u,a,n),u.clear({color:l.Color.transparent});for(let y=0;y<s.length;y++){const v=s[y];if(t.hasRenderableParent(v))continue;const T=t.getTile(v),I=T.getBucket(n);if(!I)continue;const C=I.programConfigurations.get(n.id),F=a.useProgram("heatmap",C),{zoom:R}=a.transform;F.draw(u,d.TRIANGLES,at.disabled,f,_,Lt.disabled,Eo(v.posMatrix,T,R,n.paint.get("heatmap-intensity")),null,n.id,I.layoutVertexBuffer,I.indexBuffer,I.segments,n.paint,a.transform.zoom,C)}u.viewport.set([0,0,a.width,a.height])}else a.renderPass==="translucent"&&(a.context.setColorMode(a.colorModeForRenderPass()),function(u,d){const f=u.context,_=f.gl,y=d.heatmapFbo;if(!y)return;f.activeTexture.set(_.TEXTURE0),_.bindTexture(_.TEXTURE_2D,y.colorAttachment.get()),f.activeTexture.set(_.TEXTURE1);let v=d.colorRampTexture;v||(v=d.colorRampTexture=new He(f,d.colorRamp,_.RGBA)),v.bind(_.LINEAR,_.CLAMP_TO_EDGE),u.useProgram("heatmapTexture").draw(f,_.TRIANGLES,at.disabled,Ct.disabled,u.colorModeForRenderPass(),Lt.disabled,((T,I,C,F)=>{const R=l.create();l.ortho(R,0,T.width,T.height,0,0,1);const B=T.context.gl;return{u_matrix:R,u_world:[B.drawingBufferWidth,B.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:I.paint.get("heatmap-opacity")}})(u,d),null,d.id,u.viewportBuffer,u.quadTriangleIndexBuffer,u.viewportSegments,d.paint,u.transform.zoom)}(a,n))},line:function(a,t,n,s){if(a.renderPass!=="translucent")return;const u=n.paint.get("line-opacity"),d=n.paint.get("line-width");if(u.constantOr(1)===0||d.constantOr(1)===0)return;const f=a.depthModeForSublayer(0,at.ReadOnly),_=a.colorModeForRenderPass(),y=n.paint.get("line-dasharray"),v=n.paint.get("line-pattern"),T=v.constantOr(1),I=n.paint.get("line-gradient"),C=n.getCrossfadeParameters(),F=T?"linePattern":y?"lineSDF":I?"lineGradient":"line",R=a.context,B=R.gl;let X=!0;for(const J of s){const te=t.getTile(J);if(T&&!te.patternsLoaded())continue;const O=te.getBucket(n);if(!O)continue;const ne=O.programConfigurations.get(n.id),ie=a.context.program.get(),ue=a.useProgram(F,ne),he=X||ue.program!==ie,ye=a.style.terrain&&a.style.terrain.getTerrainData(J),ce=v.constantOr(null);if(ce&&te.imageAtlas){const Re=te.imageAtlas,Qe=Re.patternPositions[ce.to.toString()],it=Re.patternPositions[ce.from.toString()];Qe&&it&&ne.setConstantPatternPositions(Qe,it)}const Le=ye?J:null,Ie=T?Io(a,te,n,C,Le):y?jn(a,te,n,y,C,Le):I?os(a,te,n,O.lineClipsArray.length,Le):Tn(a,te,n,Le);if(T)R.activeTexture.set(B.TEXTURE0),te.imageAtlasTexture.bind(B.LINEAR,B.CLAMP_TO_EDGE),ne.updatePaintBuffers(C);else if(y&&(he||a.lineAtlas.dirty))R.activeTexture.set(B.TEXTURE0),a.lineAtlas.bind(R);else if(I){const Re=O.gradients[n.id];let Qe=Re.texture;if(n.gradientVersion!==Re.version){let it=256;if(n.stepInterpolant){const Ge=t.getSource().maxzoom,bt=J.canonical.z===Ge?Math.ceil(1<<a.transform.maxZoom-J.canonical.z):1;it=l.clamp(l.nextPowerOfTwo(O.maxLineLength/l.EXTENT*1024*bt),256,R.maxTextureSize)}Re.gradient=l.renderColorRamp({expression:n.gradientExpression(),evaluationKey:"lineProgress",resolution:it,image:Re.gradient||void 0,clips:O.lineClipsArray}),Re.texture?Re.texture.update(Re.gradient):Re.texture=new He(R,Re.gradient,B.RGBA),Re.version=n.gradientVersion,Qe=Re.texture}R.activeTexture.set(B.TEXTURE0),Qe.bind(n.stepInterpolant?B.NEAREST:B.LINEAR,B.CLAMP_TO_EDGE)}ue.draw(R,B.TRIANGLES,f,a.stencilModeForClipping(J),_,Lt.disabled,Ie,ye,n.id,O.layoutVertexBuffer,O.indexBuffer,O.segments,n.paint,a.transform.zoom,ne,O.layoutVertexBuffer2),X=!1}},fill:function(a,t,n,s){const u=n.paint.get("fill-color"),d=n.paint.get("fill-opacity");if(d.constantOr(1)===0)return;const f=a.colorModeForRenderPass(),_=n.paint.get("fill-pattern"),y=a.opaquePassEnabledForLayer()&&!_.constantOr(1)&&u.constantOr(l.Color.transparent).a===1&&d.constantOr(0)===1?"opaque":"translucent";if(a.renderPass===y){const v=a.depthModeForSublayer(1,a.renderPass==="opaque"?at.ReadWrite:at.ReadOnly);Yn(a,t,n,s,v,f,!1)}if(a.renderPass==="translucent"&&n.paint.get("fill-antialias")){const v=a.depthModeForSublayer(n.getPaintProperty("fill-outline-color")?2:0,at.ReadOnly);Yn(a,t,n,s,v,f,!0)}},"fill-extrusion":function(a,t,n,s){const u=n.paint.get("fill-extrusion-opacity");if(u!==0&&a.renderPass==="translucent"){const d=new at(a.context.gl.LEQUAL,at.ReadWrite,a.depthRangeFor3D);if(u!==1||n.paint.get("fill-extrusion-pattern").constantOr(1))Qn(a,t,n,s,d,Ct.disabled,zt.disabled),Qn(a,t,n,s,d,a.stencilModeFor3D(),a.colorModeForRenderPass());else{const f=a.colorModeForRenderPass();Qn(a,t,n,s,d,Ct.disabled,f)}}},hillshade:function(a,t,n,s){if(a.renderPass!=="offscreen"&&a.renderPass!=="translucent")return;const u=a.context,d=a.depthModeForSublayer(0,at.ReadOnly),f=a.colorModeForRenderPass(),[_,y]=a.renderPass==="translucent"?a.stencilConfigForOverlap(s):[{},s];for(const v of y){const T=t.getTile(v);T.needsHillshadePrepare!==void 0&&T.needsHillshadePrepare&&a.renderPass==="offscreen"?xa(a,T,n,d,Ct.disabled,f):a.renderPass==="translucent"&&xs(a,v,T,n,d,_[v.overscaledZ],f)}u.viewport.set([0,0,a.width,a.height])},raster:function(a,t,n,s){if(a.renderPass!=="translucent"||n.paint.get("raster-opacity")===0||!s.length)return;const u=a.context,d=u.gl,f=t.getSource(),_=a.useProgram("raster"),y=a.colorModeForRenderPass(),[v,T]=f instanceof qi?[{},s]:a.stencilConfigForOverlap(s),I=T[T.length-1].overscaledZ,C=!a.options.moving;for(const F of T){const R=a.depthModeForSublayer(F.overscaledZ-I,n.paint.get("raster-opacity")===1?at.ReadWrite:at.ReadOnly,d.LESS),B=t.getTile(F);B.registerFadeDuration(n.paint.get("raster-fade-duration"));const X=t.findLoadedParent(F,0),J=Ro(B,X,t,n,a.transform,a.style.terrain);let te,O;const ne=n.paint.get("raster-resampling")==="nearest"?d.NEAREST:d.LINEAR;u.activeTexture.set(d.TEXTURE0),B.texture.bind(ne,d.CLAMP_TO_EDGE,d.LINEAR_MIPMAP_NEAREST),u.activeTexture.set(d.TEXTURE1),X?(X.texture.bind(ne,d.CLAMP_TO_EDGE,d.LINEAR_MIPMAP_NEAREST),te=Math.pow(2,X.tileID.overscaledZ-B.tileID.overscaledZ),O=[B.tileID.canonical.x*te%1,B.tileID.canonical.y*te%1]):B.texture.bind(ne,d.CLAMP_TO_EDGE,d.LINEAR_MIPMAP_NEAREST);const ie=a.style.terrain&&a.style.terrain.getTerrainData(F),ue=ie?F:null,he=ue?ue.posMatrix:a.transform.calculatePosMatrix(F.toUnwrapped(),C),ye=aa(he,O||[0,0],te||1,J,n);f instanceof qi?_.draw(u,d.TRIANGLES,R,Ct.disabled,y,Lt.disabled,ye,ie,n.id,f.boundsBuffer,a.quadTriangleIndexBuffer,f.boundsSegments):_.draw(u,d.TRIANGLES,R,v[F.overscaledZ],y,Lt.disabled,ye,ie,n.id,a.rasterBoundsBuffer,a.quadTriangleIndexBuffer,a.rasterBoundsSegments)}},background:function(a,t,n,s){const u=n.paint.get("background-color"),d=n.paint.get("background-opacity");if(d===0)return;const f=a.context,_=f.gl,y=a.transform,v=y.tileSize,T=n.paint.get("background-pattern");if(a.isPatternMissing(T))return;const I=!T&&u.a===1&&d===1&&a.opaquePassEnabledForLayer()?"opaque":"translucent";if(a.renderPass!==I)return;const C=Ct.disabled,F=a.depthModeForSublayer(0,I==="opaque"?at.ReadWrite:at.ReadOnly),R=a.colorModeForRenderPass(),B=a.useProgram(T?"backgroundPattern":"background"),X=s||y.coveringTiles({tileSize:v,terrain:a.style.terrain});T&&(f.activeTexture.set(_.TEXTURE0),a.imageManager.bind(a.context));const J=n.getCrossfadeParameters();for(const te of X){const O=s?te.posMatrix:a.transform.calculatePosMatrix(te.toUnwrapped()),ne=T?gl(O,d,a,T,{tileID:te,tileSize:v},J):ml(O,d,u),ie=a.style.terrain&&a.style.terrain.getTerrainData(te);B.draw(f,_.TRIANGLES,F,C,R,Lt.disabled,ne,ie,n.id,a.tileExtentBuffer,a.quadTriangleIndexBuffer,a.tileExtentSegments)}},debug:function(a,t,n){for(let s=0;s<n.length;s++)Al(a,t,n[s])},custom:function(a,t,n){const s=a.context,u=n.implementation;if(a.renderPass==="offscreen"){const d=u.prerender;d&&(a.setCustomLayerDefaults(),s.setColorMode(a.colorModeForRenderPass()),d.call(u,s.gl,a.transform.customLayerMatrix()),s.setDirty(),a.setBaseState())}else if(a.renderPass==="translucent"){a.setCustomLayerDefaults(),s.setColorMode(a.colorModeForRenderPass()),s.setStencilMode(Ct.disabled);const d=u.renderingMode==="3d"?new at(a.context.gl.LEQUAL,at.ReadWrite,a.depthRangeFor3D):a.depthModeForSublayer(0,at.ReadOnly);s.setDepthMode(d),u.render(s.gl,a.transform.customLayerMatrix()),s.setDirty(),a.setBaseState(),s.bindFramebuffer.set(null)}}};class bs{constructor(t,n){this.context=new _a(t),this.transform=n,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:l.create(),renderTime:0},this.setup(),this.numSublayers=yi.maxUnderzooming+yi.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Xe,this.gpuTimers={}}resize(t,n,s){if(this.width=t*s,this.height=n*s,this.pixelRatio=s,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const u of this.style._order)this.style._layers[u].resize()}setup(){const t=this.context,n=new l.PosArray;n.emplaceBack(0,0),n.emplaceBack(l.EXTENT,0),n.emplaceBack(0,l.EXTENT),n.emplaceBack(l.EXTENT,l.EXTENT),this.tileExtentBuffer=t.createVertexBuffer(n,pt.members),this.tileExtentSegments=l.SegmentVector.simpleSegment(0,0,4,2);const s=new l.PosArray;s.emplaceBack(0,0),s.emplaceBack(l.EXTENT,0),s.emplaceBack(0,l.EXTENT),s.emplaceBack(l.EXTENT,l.EXTENT),this.debugBuffer=t.createVertexBuffer(s,pt.members),this.debugSegments=l.SegmentVector.simpleSegment(0,0,4,5);const u=new l.RasterBoundsArray;u.emplaceBack(0,0,0,0),u.emplaceBack(l.EXTENT,0,l.EXTENT,0),u.emplaceBack(0,l.EXTENT,0,l.EXTENT),u.emplaceBack(l.EXTENT,l.EXTENT,l.EXTENT,l.EXTENT),this.rasterBoundsBuffer=t.createVertexBuffer(u,hr.members),this.rasterBoundsSegments=l.SegmentVector.simpleSegment(0,0,4,2);const d=new l.PosArray;d.emplaceBack(0,0),d.emplaceBack(1,0),d.emplaceBack(0,1),d.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(d,pt.members),this.viewportSegments=l.SegmentVector.simpleSegment(0,0,4,2);const f=new l.LineStripIndexArray;f.emplaceBack(0),f.emplaceBack(1),f.emplaceBack(3),f.emplaceBack(2),f.emplaceBack(0),this.tileBorderIndexBuffer=t.createIndexBuffer(f);const _=new l.TriangleIndexArray;_.emplaceBack(0,1,2),_.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(_),this.emptyTexture=new He(t,{width:1,height:1,data:new Uint8Array([0,0,0,0])},t.gl.RGBA);const y=this.context.gl;this.stencilClearMode=new Ct({func:y.ALWAYS,mask:0},0,255,y.ZERO,y.ZERO,y.ZERO)}clearStencil(){const t=this.context,n=t.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const s=l.create();l.ortho(s,0,this.width,this.height,0,0,1),l.scale(s,s,[n.drawingBufferWidth,n.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(t,n.TRIANGLES,at.disabled,this.stencilClearMode,zt.disabled,Lt.disabled,wn(s),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(t,n){if(this.currentStencilSource===t.source||!t.isTileClipped()||!n||!n.length)return;this.currentStencilSource=t.source;const s=this.context,u=s.gl;this.nextStencilID+n.length>256&&this.clearStencil(),s.setColorMode(zt.disabled),s.setDepthMode(at.disabled);const d=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const f of n){const _=this._tileClippingMaskIDs[f.key]=this.nextStencilID++,y=this.style.terrain&&this.style.terrain.getTerrainData(f);d.draw(s,u.TRIANGLES,at.disabled,new Ct({func:u.ALWAYS,mask:0},_,255,u.KEEP,u.KEEP,u.REPLACE),zt.disabled,Lt.disabled,wn(f.posMatrix),y,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const t=this.nextStencilID++,n=this.context.gl;return new Ct({func:n.NOTEQUAL,mask:255},t,255,n.KEEP,n.KEEP,n.REPLACE)}stencilModeForClipping(t){const n=this.context.gl;return new Ct({func:n.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,n.KEEP,n.KEEP,n.REPLACE)}stencilConfigForOverlap(t){const n=this.context.gl,s=t.sort((f,_)=>_.overscaledZ-f.overscaledZ),u=s[s.length-1].overscaledZ,d=s[0].overscaledZ-u+1;if(d>1){this.currentStencilSource=void 0,this.nextStencilID+d>256&&this.clearStencil();const f={};for(let _=0;_<d;_++)f[_+u]=new Ct({func:n.GEQUAL,mask:255},_+this.nextStencilID,255,n.KEEP,n.KEEP,n.REPLACE);return this.nextStencilID+=d,[f,s]}return[{[u]:Ct.disabled},s]}colorModeForRenderPass(){const t=this.context.gl;return this._showOverdrawInspector?new zt([t.CONSTANT_COLOR,t.ONE],new l.Color(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?zt.unblended:zt.alphaBlended}depthModeForSublayer(t,n,s){if(!this.opaquePassEnabledForLayer())return at.disabled;const u=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new at(s||this.context.gl.LEQUAL,n,[u,u])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(t,n){this.style=t,this.options=n,this.lineAtlas=t.lineAtlas,this.imageManager=t.imageManager,this.glyphManager=t.glyphManager,this.symbolFadeChange=t.placement.symbolFadeChange(l.exported.now()),this.imageManager.beginFrame();const s=this.style._order,u=this.style.sourceCaches,d=this.style.terrain&&new Ta(this);for(const v in u){const T=u[v];T.used&&T.prepare(this.context)}const f={},_={},y={};for(const v in u){const T=u[v];f[v]=T.getVisibleCoordinates(),_[v]=f[v].slice().reverse(),y[v]=T.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let v=0;v<s.length;v++)if(this.style._layers[s[v]].is3D()){this.opaquePassCutoff=v;break}if(d){this.opaquePassCutoff=0;const v=this.style.terrain.sourceCache.tilesAfterTime(this.terrainFacilitator.renderTime);(this.terrainFacilitator.dirty||!l.equals(this.terrainFacilitator.matrix,this.transform.projMatrix)||v.length)&&(l.copy(this.terrainFacilitator.matrix,this.transform.projMatrix),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(T,I){const C=T.context,F=C.gl,R=zt.unblended,B=new at(F.LEQUAL,at.ReadWrite,[0,1]),X=I.getTerrainMesh(),J=I.sourceCache.getRenderableTiles(),te=T.useProgram("terrainDepth");C.bindFramebuffer.set(I.getFramebuffer("depth").framebuffer),C.viewport.set([0,0,T.width/devicePixelRatio,T.height/devicePixelRatio]),C.clear({color:l.Color.transparent,depth:1});for(const O of J){const ne=I.getTerrainData(O.tileID),ie=T.transform.calculatePosMatrix(O.tileID.toUnwrapped());te.draw(C,F.TRIANGLES,B,Ct.disabled,R,Lt.backCCW,{u_matrix:ie},ne,"terrain",X.vertexBuffer,X.indexBuffer,X.segments)}C.bindFramebuffer.set(null),C.viewport.set([0,0,T.width,T.height])}(this,this.style.terrain),function(T,I){const C=T.context,F=C.gl,R=zt.unblended,B=new at(F.LEQUAL,at.ReadWrite,[0,1]),X=I.getTerrainMesh(),J=I.getCoordsTexture(),te=I.sourceCache.getRenderableTiles(),O=T.useProgram("terrainCoords");C.bindFramebuffer.set(I.getFramebuffer("coords").framebuffer),C.viewport.set([0,0,T.width/devicePixelRatio,T.height/devicePixelRatio]),C.clear({color:l.Color.transparent,depth:1}),I.coordsIndex=[];for(const ne of te){const ie=I.getTerrainData(ne.tileID);C.activeTexture.set(F.TEXTURE0),F.bindTexture(F.TEXTURE_2D,J.texture);const ue=T.transform.calculatePosMatrix(ne.tileID.toUnwrapped());O.draw(C,F.TRIANGLES,B,Ct.disabled,R,Lt.backCCW,{u_matrix:ue,u_terrain_coords_id:(255-I.coordsIndex.length)/255,u_texture:0},ie,"terrain",X.vertexBuffer,X.indexBuffer,X.segments),I.coordsIndex.push(ne.tileID.key)}C.bindFramebuffer.set(null),C.viewport.set([0,0,T.width,T.height])}(this,this.style.terrain))}this.renderPass="offscreen";for(const v of s){const T=this.style._layers[v];if(!T.hasOffscreenPass()||T.isHidden(this.transform.zoom))continue;const I=_[T.source];(T.type==="custom"||I.length)&&this.renderLayer(this,u[T.source],T,I)}if(this.context.bindFramebuffer.set(null),this.context.clear({color:n.showOverdrawInspector?l.Color.black:l.Color.transparent,depth:1}),this.clearStencil(),this._showOverdrawInspector=n.showOverdrawInspector,this.depthRangeFor3D=[0,1-(t._order.length+2)*this.numSublayers*this.depthEpsilon],!d)for(this.renderPass="opaque",this.currentLayer=s.length-1;this.currentLayer>=0;this.currentLayer--){const v=this.style._layers[s[this.currentLayer]],T=u[v.source],I=f[v.source];this._renderTileClippingMasks(v,I),this.renderLayer(this,T,v,I)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<s.length;this.currentLayer++){const v=this.style._layers[s[this.currentLayer]],T=u[v.source];if(d&&d.renderLayer(v))continue;const I=(v.type==="symbol"?y:_)[v.source];this._renderTileClippingMasks(v,f[v.source]),this.renderLayer(this,T,v,I)}if(this.options.showTileBoundaries){let v,T;Object.values(this.style._layers).forEach(I=>{I.source&&!I.isHidden(this.transform.zoom)&&(I.source!==(T&&T.id)&&(T=this.style.sourceCaches[I.source]),(!v||v.getSource().maxzoom<T.getSource().maxzoom)&&(v=T))}),v&&to.debug(this,v,v.getVisibleCoordinates())}this.options.showPadding&&function(v){const T=v.transform.padding;Jr(v,v.transform.height-(T.top||0),3,Bo),Jr(v,T.bottom||0,3,Xi),eo(v,T.left||0,3,va),eo(v,v.transform.width-(T.right||0),3,vs);const I=v.transform.centerPoint;(function(C,F,R,B){Cn(C,F-1,R-10,2,20,B),Cn(C,F-10,R-1,20,2,B)})(v,I.x,v.transform.height-I.y,ba)}(this),this.context.setDefault()}renderLayer(t,n,s,u){s.isHidden(this.transform.zoom)||(s.type==="background"||s.type==="custom"||(u||[]).length)&&(this.id=s.id,this.gpuTimingStart(s),to[s.type](t,n,s,u,this.style.placement.variableOffsets),this.gpuTimingEnd())}gpuTimingStart(t){if(!this.options.gpuTiming)return;const n=this.context.extTimerQuery;let s=this.gpuTimers[t.id];s||(s=this.gpuTimers[t.id]={calls:0,cpuTime:0,query:n.createQueryEXT()}),s.calls++,n.beginQueryEXT(n.TIME_ELAPSED_EXT,s.query)}gpuTimingEnd(){if(!this.options.gpuTiming)return;const t=this.context.extTimerQuery;t.endQueryEXT(t.TIME_ELAPSED_EXT)}collectGpuTimers(){const t=this.gpuTimers;return this.gpuTimers={},t}queryGpuTimers(t){const n={};for(const s in t){const u=t[s],d=this.context.extTimerQuery,f=d.getQueryObjectEXT(u.query,d.QUERY_RESULT_EXT)/1e6;d.deleteQueryEXT(u.query),n[s]=f}return n}translatePosMatrix(t,n,s,u,d){if(!s[0]&&!s[1])return t;const f=d?u==="map"?this.transform.angle:0:u==="viewport"?-this.transform.angle:0;if(f){const v=Math.sin(f),T=Math.cos(f);s=[s[0]*T-s[1]*v,s[0]*v+s[1]*T]}const _=[d?s[0]:qt(n,s[0],this.transform.zoom),d?s[1]:qt(n,s[1],this.transform.zoom),0],y=new Float32Array(16);return l.translate(y,t,_),y}saveTileTexture(t){const n=this._tileTextures[t.size[0]];n?n.push(t):this._tileTextures[t.size[0]]=[t]}getTileTexture(t){const n=this._tileTextures[t];return n&&n.length>0?n.pop():null}isPatternMissing(t){if(!t)return!1;if(!t.from||!t.to)return!0;const n=this.imageManager.getPattern(t.from.toString()),s=this.imageManager.getPattern(t.to.toString());return!n||!s}useProgram(t,n){this.cache=this.cache||{};const s=t+(n?n.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.terrain?"/terrain":"");return this.cache[s]||(this.cache[s]=new ia(this.context,t,qn[t],n,as[t],this._showOverdrawInspector,this.style.terrain)),this.cache[s]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const t=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new He(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}}class Oo{constructor(t,n){this.points=t,this.planes=n}static fromInvProjectionMatrix(t,n,s){const u=Math.pow(2,s),d=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map(_=>{const y=1/(_=l.transformMat4([],_,t))[3]/n*u;return l.mul$1(_,_,[y,y,1/_[3],y])}),f=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(_=>{const y=l.sub([],d[_[0]],d[_[1]]),v=l.sub([],d[_[2]],d[_[1]]),T=l.normalize([],l.cross([],y,v)),I=-l.dot(T,d[_[1]]);return T.concat(I)});return new Oo(d,f)}}class io{constructor(t,n){this.min=t,this.max=n,this.center=l.scale$1([],l.add([],this.min,this.max),.5)}quadrant(t){const n=[t%2==0,t<2],s=l.clone$2(this.min),u=l.clone$2(this.max);for(let d=0;d<n.length;d++)s[d]=n[d]?this.min[d]:this.center[d],u[d]=n[d]?this.center[d]:this.max[d];return u[2]=this.max[2],new io(s,u)}distanceX(t){return Math.max(Math.min(this.max[0],t[0]),this.min[0])-t[0]}distanceY(t){return Math.max(Math.min(this.max[1],t[1]),this.min[1])-t[1]}intersects(t){const n=[[this.min[0],this.min[1],this.min[2],1],[this.max[0],this.min[1],this.min[2],1],[this.max[0],this.max[1],this.min[2],1],[this.min[0],this.max[1],this.min[2],1],[this.min[0],this.min[1],this.max[2],1],[this.max[0],this.min[1],this.max[2],1],[this.max[0],this.max[1],this.max[2],1],[this.min[0],this.max[1],this.max[2],1]];let s=!0;for(let u=0;u<t.planes.length;u++){const d=t.planes[u];let f=0;for(let _=0;_<n.length;_++)l.dot$1(d,n[_])>=0&&f++;if(f===0)return 0;f!==n.length&&(s=!1)}if(s)return 2;for(let u=0;u<3;u++){let d=Number.MAX_VALUE,f=-Number.MAX_VALUE;for(let _=0;_<t.points.length;_++){const y=t.points[_][u]-this.min[u];d=Math.min(d,y),f=Math.max(f,y)}if(f<0||d>this.max[u]-this.min[u])return 0}return 1}}class Mn{constructor(t=0,n=0,s=0,u=0){if(isNaN(t)||t<0||isNaN(n)||n<0||isNaN(s)||s<0||isNaN(u)||u<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=n,this.left=s,this.right=u}interpolate(t,n,s){return n.top!=null&&t.top!=null&&(this.top=l.number(t.top,n.top,s)),n.bottom!=null&&t.bottom!=null&&(this.bottom=l.number(t.bottom,n.bottom,s)),n.left!=null&&t.left!=null&&(this.left=l.number(t.left,n.left,s)),n.right!=null&&t.right!=null&&(this.right=l.number(t.right,n.right,s)),this}getCenter(t,n){const s=l.clamp((this.left+t-this.right)/2,0,t),u=l.clamp((this.top+n-this.bottom)/2,0,n);return new l.pointGeometry(s,u)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new Mn(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}class ro{constructor(t,n,s,u,d){this.tileSize=512,this.maxValidLatitude=85.051129,this.freezeElevation=!1,this._renderWorldCopies=d===void 0||!!d,this._minZoom=t||0,this._maxZoom=n||22,this._minPitch=s==null?0:s,this._maxPitch=u==null?60:u,this.setMaxBounds(),this.width=0,this.height=0,this._center=new l.LngLat(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new Mn,this._posMatrixCache={},this._alignedPosMatrixCache={}}clone(){const t=new ro(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return t.tileSize=this.tileSize,t.latRange=this.latRange,t.width=this.width,t.height=this.height,t._center=this._center,t._elevation=this._elevation,t.zoom=this.zoom,t.angle=this.angle,t._fov=this._fov,t._pitch=this._pitch,t._unmodified=this._unmodified,t._edgeInsets=this._edgeInsets.clone(),t._calcMatrices(),t}get minZoom(){return this._minZoom}set minZoom(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))}get maxZoom(){return this._maxZoom}set maxZoom(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))}get minPitch(){return this._minPitch}set minPitch(t){this._minPitch!==t&&(this._minPitch=t,this.pitch=Math.max(this.pitch,t))}get maxPitch(){return this._maxPitch}set maxPitch(t){this._maxPitch!==t&&(this._maxPitch=t,this.pitch=Math.min(this.pitch,t))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(t){t===void 0?t=!0:t===null&&(t=!1),this._renderWorldCopies=t}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new l.pointGeometry(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(t){const n=-l.wrap(t,-180,180)*Math.PI/180;var s;this.angle!==n&&(this._unmodified=!1,this.angle=n,this._calcMatrices(),this.rotationMatrix=(s=new l.ARRAY_TYPE(4),l.ARRAY_TYPE!=Float32Array&&(s[1]=0,s[2]=0),s[0]=1,s[3]=1,s),function(u,d,f){var _=d[0],y=d[1],v=d[2],T=d[3],I=Math.sin(f),C=Math.cos(f);u[0]=_*C+v*I,u[1]=y*C+T*I,u[2]=_*-I+v*C,u[3]=y*-I+T*C}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(t){const n=l.clamp(t,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==n&&(this._unmodified=!1,this._pitch=n,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(t){t=Math.max(.01,Math.min(60,t)),this._fov!==t&&(this._unmodified=!1,this._fov=t/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(t){const n=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==n&&(this._unmodified=!1,this._zoom=n,this.scale=this.zoomScale(n),this.tileZoom=Math.floor(n),this.zoomFraction=n-this.tileZoom,this._constrain(),this._calcMatrices())}get center(){return this._center}set center(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(t){t!==this._elevation&&(this._elevation=t,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(t){this._edgeInsets.equals(t)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,t,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(t){return this._edgeInsets.equals(t)}interpolatePadding(t,n,s){this._unmodified=!1,this._edgeInsets.interpolate(t,n,s),this._constrain(),this._calcMatrices()}coveringZoomLevel(t){const n=(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize));return Math.max(0,n)}getVisibleUnwrappedCoordinates(t){const n=[new l.UnwrappedTileID(0,t)];if(this._renderWorldCopies){const s=this.pointCoordinate(new l.pointGeometry(0,0)),u=this.pointCoordinate(new l.pointGeometry(this.width,0)),d=this.pointCoordinate(new l.pointGeometry(this.width,this.height)),f=this.pointCoordinate(new l.pointGeometry(0,this.height)),_=Math.floor(Math.min(s.x,u.x,d.x,f.x)),y=Math.floor(Math.max(s.x,u.x,d.x,f.x)),v=1;for(let T=_-v;T<=y+v;T++)T!==0&&n.push(new l.UnwrappedTileID(T,t))}return n}coveringTiles(t){var n,s;let u=this.coveringZoomLevel(t);const d=u;if(t.minzoom!==void 0&&u<t.minzoom)return[];t.maxzoom!==void 0&&u>t.maxzoom&&(u=t.maxzoom);const f=this.pointCoordinate(this.getCameraPoint()),_=l.MercatorCoordinate.fromLngLat(this.center),y=Math.pow(2,u),v=[y*f.x,y*f.y,0],T=[y*_.x,y*_.y,0],I=Oo.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,u);let C=t.minzoom||0;!t.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(C=u);const F=t.terrain?2/Math.min(this.tileSize,t.tileSize)*this.tileSize:3,R=O=>({aabb:new io([O*y,0,0],[(O+1)*y,y,0]),zoom:0,x:0,y:0,wrap:O,fullyVisible:!1}),B=[],X=[],J=u,te=t.reparseOverscaled?d:u;if(this._renderWorldCopies)for(let O=1;O<=3;O++)B.push(R(-O)),B.push(R(O));for(B.push(R(0));B.length>0;){const O=B.pop(),ne=O.x,ie=O.y;let ue=O.fullyVisible;if(!ue){const Re=O.aabb.intersects(I);if(Re===0)continue;ue=Re===2}const he=t.terrain?v:T,ye=O.aabb.distanceX(he),ce=O.aabb.distanceY(he),Le=Math.max(Math.abs(ye),Math.abs(ce)),Ie=F+(1<<J-O.zoom)-2;if(O.zoom===J||Le>Ie&&O.zoom>=C){const Re=J-O.zoom,Qe=v[0]-.5-(ne<<Re),it=v[1]-.5-(ie<<Re);X.push({tileID:new l.OverscaledTileID(O.zoom===J?te:O.zoom,O.wrap,O.zoom,ne,ie),distanceSq:l.sqrLen([T[0]-.5-ne,T[1]-.5-ie]),tileDistanceToCamera:Math.sqrt(Qe*Qe+it*it)})}else for(let Re=0;Re<4;Re++){const Qe=(ne<<1)+Re%2,it=(ie<<1)+(Re>>1),Ge=O.zoom+1;let bt=O.aabb.quadrant(Re);if(t.terrain){const wt=new l.OverscaledTileID(Ge,O.wrap,Ge,Qe,it),ut=t.terrain.getMinMaxElevation(wt),mt=(n=ut.minElevation)!==null&&n!==void 0?n:this.elevation,Et=(s=ut.maxElevation)!==null&&s!==void 0?s:this.elevation;bt=new io([bt.min[0],bt.min[1],mt],[bt.max[0],bt.max[1],Et])}B.push({aabb:bt,zoom:Ge,x:Qe,y:it,wrap:O.wrap,fullyVisible:ue})}}return X.sort((O,ne)=>O.distanceSq-ne.distanceSq).map(O=>O.tileID)}resize(t,n){this.width=t,this.height=n,this.pixelsToGLUnits=[2/t,-2/n],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(t){return Math.pow(2,t)}scaleZoom(t){return Math.log(t)/Math.LN2}project(t){const n=l.clamp(t.lat,-this.maxValidLatitude,this.maxValidLatitude);return new l.pointGeometry(l.mercatorXfromLng(t.lng)*this.worldSize,l.mercatorYfromLat(n)*this.worldSize)}unproject(t){return new l.MercatorCoordinate(t.x/this.worldSize,t.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}updateElevation(t){this.freezeElevation||(this.elevation=t?this.getElevation(this._center,t):0)}getElevation(t,n){const s=l.MercatorCoordinate.fromLngLat(t),u=(1<<this.tileZoom)*l.EXTENT,d=s.x*u,f=s.y*u,_=Math.floor(d/l.EXTENT),y=Math.floor(f/l.EXTENT),v=new l.OverscaledTileID(this.tileZoom,0,this.tileZoom,_,y);return n.getElevation(v,d%l.EXTENT,f%l.EXTENT,l.EXTENT)}getCameraPosition(){return{lngLat:this.pointLocation(this.getCameraPoint()),altitude:Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter+this.elevation}}recalculateZoom(t){const n=this.pointLocation(this.centerPoint,t),s=this.getElevation(n,t);if(!(this.elevation-s))return;const u=this.getCameraPosition(),d=l.MercatorCoordinate.fromLngLat(u.lngLat,u.altitude),f=l.MercatorCoordinate.fromLngLat(n,s),_=d.x-f.x,y=d.y-f.y,v=d.z-f.z,T=Math.sqrt(_*_+y*y+v*v),I=this.scaleZoom(this.cameraToCenterDistance/T/this.tileSize);this._elevation=s,this._center=n,this.zoom=I}setLocationAtPoint(t,n){const s=this.pointCoordinate(n),u=this.pointCoordinate(this.centerPoint),d=this.locationCoordinate(t),f=new l.MercatorCoordinate(d.x-(s.x-u.x),d.y-(s.y-u.y));this.center=this.coordinateLocation(f),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(t,n){return n?this.coordinatePoint(this.locationCoordinate(t),this.getElevation(t,n),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(t))}pointLocation(t,n){return this.coordinateLocation(this.pointCoordinate(t,n))}locationCoordinate(t){return l.MercatorCoordinate.fromLngLat(t)}coordinateLocation(t){return t&&t.toLngLat()}pointCoordinate(t,n){if(n){const C=n.pointCoordinate(t);if(C!=null)return C}const s=[t.x,t.y,0,1],u=[t.x,t.y,1,1];l.transformMat4(s,s,this.pixelMatrixInverse),l.transformMat4(u,u,this.pixelMatrixInverse);const d=s[3],f=u[3],_=s[1]/d,y=u[1]/f,v=s[2]/d,T=u[2]/f,I=v===T?0:(0-v)/(T-v);return new l.MercatorCoordinate(l.number(s[0]/d,u[0]/f,I)/this.worldSize,l.number(_,y,I)/this.worldSize)}coordinatePoint(t,n=0,s=this.pixelMatrix){const u=[t.x*this.worldSize,t.y*this.worldSize,n,1];return l.transformMat4(u,u,s),new l.pointGeometry(u[0]/u[3],u[1]/u[3])}getBounds(){const t=Math.max(0,this.height/2-this.getHorizon());return new l.LngLatBounds().extend(this.pointLocation(new l.pointGeometry(0,t))).extend(this.pointLocation(new l.pointGeometry(this.width,t))).extend(this.pointLocation(new l.pointGeometry(this.width,this.height))).extend(this.pointLocation(new l.pointGeometry(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new l.LngLatBounds([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}getHorizon(){return Math.tan(Math.PI/2-this._pitch)*this.cameraToCenterDistance*.85}setMaxBounds(t){t?(this.lngRange=[t.getWest(),t.getEast()],this.latRange=[t.getSouth(),t.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-this.maxValidLatitude,this.maxValidLatitude])}calculatePosMatrix(t,n=!1){const s=t.key,u=n?this._alignedPosMatrixCache:this._posMatrixCache;if(u[s])return u[s];const d=t.canonical,f=this.worldSize/this.zoomScale(d.z),_=d.x+Math.pow(2,d.z)*t.wrap,y=l.identity(new Float64Array(16));return l.translate(y,y,[_*f,d.y*f,0]),l.scale(y,y,[f/l.EXTENT,f/l.EXTENT,1]),l.multiply(y,n?this.alignedProjMatrix:this.projMatrix,y),u[s]=new Float32Array(y),u[s]}customLayerMatrix(){return this.mercatorMatrix.slice()}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;let t,n,s,u,d=-90,f=90,_=-180,y=180;const v=this.size,T=this._unmodified;if(this.latRange){const F=this.latRange;d=l.mercatorYfromLat(F[1])*this.worldSize,f=l.mercatorYfromLat(F[0])*this.worldSize,t=f-d<v.y?v.y/(f-d):0}if(this.lngRange){const F=this.lngRange;_=l.wrap(l.mercatorXfromLng(F[0])*this.worldSize,0,this.worldSize),y=l.wrap(l.mercatorXfromLng(F[1])*this.worldSize,0,this.worldSize),y<_&&(y+=this.worldSize),n=y-_<v.x?v.x/(y-_):0}const I=this.point,C=Math.max(n||0,t||0);if(C)return this.center=this.unproject(new l.pointGeometry(n?(y+_)/2:I.x,t?(f+d)/2:I.y)),this.zoom+=this.scaleZoom(C),this._unmodified=T,void(this._constraining=!1);if(this.latRange){const F=I.y,R=v.y/2;F-R<d&&(u=d+R),F+R>f&&(u=f-R)}if(this.lngRange){const F=(_+y)/2,R=l.wrap(I.x,F-this.worldSize/2,F+this.worldSize/2),B=v.x/2;R-B<_&&(s=_+B),R+B>y&&(s=y-B)}s===void 0&&u===void 0||(this.center=this.unproject(new l.pointGeometry(s!==void 0?s:I.x,u!==void 0?u:I.y)).wrap()),this._unmodified=T,this._constraining=!1}_calcMatrices(){if(!this.height)return;const t=this.centerOffset,n=this.point.x,s=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=l.mercatorZfromAltitude(1,this.center.lat)*this.worldSize;let u=l.identity(new Float64Array(16));l.scale(u,u,[this.width/2,-this.height/2,1]),l.translate(u,u,[1,-1,0]),this.labelPlaneMatrix=u,u=l.identity(new Float64Array(16)),l.scale(u,u,[1,-1,1]),l.translate(u,u,[-1,-1,0]),l.scale(u,u,[2/this.width,2/this.height,1]),this.glCoordMatrix=u,this.cameraToSeaLevelDistance=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch);const d=Math.PI/2+this._pitch,f=this._fov*(.5+t.y/this.height),_=Math.sin(f)*this.cameraToSeaLevelDistance/Math.sin(l.clamp(Math.PI-d-f,.01,Math.PI-.01)),y=this.getHorizon(),v=2*Math.atan(y/this.cameraToCenterDistance)*(.5+t.y/(2*y)),T=Math.sin(v)*this.cameraToSeaLevelDistance/Math.sin(l.clamp(Math.PI-d-v,.01,Math.PI-.01)),I=Math.cos(Math.PI/2-this._pitch)*_+this.cameraToSeaLevelDistance,C=Math.cos(Math.PI/2-this._pitch)*T+this.cameraToSeaLevelDistance,F=1.01*Math.min(I,C),R=this.height/50;u=new Float64Array(16),l.perspective(u,this._fov,this.width/this.height,R,F),u[8]=2*-t.x/this.width,u[9]=2*t.y/this.height,l.scale(u,u,[1,-1,1]),l.translate(u,u,[0,0,-this.cameraToCenterDistance]),l.rotateX(u,u,this._pitch),l.rotateZ(u,u,this.angle),l.translate(u,u,[-n,-s,0]),this.mercatorMatrix=l.scale([],u,[this.worldSize,this.worldSize,this.worldSize]),l.scale(u,u,[1,1,this._pixelPerMeter]),this.pixelMatrix=l.multiply(new Float64Array(16),this.labelPlaneMatrix,u),l.translate(u,u,[0,0,-this.elevation]),this.projMatrix=u,this.invProjMatrix=l.invert([],u),this.pixelMatrix3D=l.multiply(new Float64Array(16),this.labelPlaneMatrix,u);const B=this.width%2/2,X=this.height%2/2,J=Math.cos(this.angle),te=Math.sin(this.angle),O=n-Math.round(n)+J*B+te*X,ne=s-Math.round(s)+J*X+te*B,ie=new Float64Array(u);if(l.translate(ie,ie,[O>.5?O-1:O,ne>.5?ne-1:ne,0]),this.alignedProjMatrix=ie,u=l.invert(new Float64Array(16),this.pixelMatrix),!u)throw new Error("failed to invert matrix");this.pixelMatrixInverse=u,this._posMatrixCache={},this._alignedPosMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const t=this.pointCoordinate(new l.pointGeometry(0,0)),n=[t.x*this.worldSize,t.y*this.worldSize,0,1];return l.transformMat4(n,n,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const t=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new l.pointGeometry(0,t))}getCameraQueryGeometry(t){const n=this.getCameraPoint();if(t.length===1)return[t[0],n];{let s=n.x,u=n.y,d=n.x,f=n.y;for(const _ of t)s=Math.min(s,_.x),u=Math.min(u,_.y),d=Math.max(d,_.x),f=Math.max(f,_.y);return[new l.pointGeometry(s,u),new l.pointGeometry(d,u),new l.pointGeometry(d,f),new l.pointGeometry(s,f),new l.pointGeometry(s,u)]}}}class Ea{constructor(t){this._hashName=t&&encodeURIComponent(t),l.bindAll(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=function(n,s){let u=!1,d=null;const f=()=>{d=null,u&&(n(),d=setTimeout(f,300),u=!1)};return()=>(u=!0,d||f(),d)}(this._updateHashUnthrottled.bind(this))}addTo(t){return this._map=t,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),delete this._map,this}getHashString(t){const n=this._map.getCenter(),s=Math.round(100*this._map.getZoom())/100,u=Math.ceil((s*Math.LN2+Math.log(512/360/.5))/Math.LN10),d=Math.pow(10,u),f=Math.round(n.lng*d)/d,_=Math.round(n.lat*d)/d,y=this._map.getBearing(),v=this._map.getPitch();let T="";if(T+=t?`/${f}/${_}/${s}`:`${s}/${_}/${f}`,(y||v)&&(T+="/"+Math.round(10*y)/10),v&&(T+=`/${Math.round(v)}`),this._hashName){const I=this._hashName;let C=!1;const F=window.location.hash.slice(1).split("&").map(R=>{const B=R.split("=")[0];return B===I?(C=!0,`${B}=${T}`):R}).filter(R=>R);return C||F.push(`${I}=${T}`),`#${F.join("&")}`}return`#${T}`}_getCurrentHash(){const t=window.location.hash.replace("#","");if(this._hashName){let n;return t.split("&").map(s=>s.split("=")).forEach(s=>{s[0]===this._hashName&&(n=s)}),(n&&n[1]||"").split("/")}return t.split("/")}_onHashChange(){const t=this._getCurrentHash();if(t.length>=3&&!t.some(n=>isNaN(n))){const n=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:n,pitch:+(t[4]||0)}),!0}return!1}_updateHashUnthrottled(){const t=window.location.href.replace(/(#.+)?$/,this.getHashString());try{window.history.replaceState(window.history.state,null,t)}catch(n){}}}const no={linearity:.3,easing:l.bezier(0,0,.3,1)},Sa=l.extend({deceleration:2500,maxSpeed:1400},no),Ia=l.extend({deceleration:20,maxSpeed:1400},no),Aa=l.extend({deceleration:1e3,maxSpeed:360},no),zn=l.extend({deceleration:1e3,maxSpeed:90},no);class Ca{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:l.exported.now(),settings:t})}_drainInertiaBuffer(){const t=this._inertiaBuffer,n=l.exported.now();for(;t.length>0&&n-t[0].time>160;)t.shift()}_onMoveEnd(t){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const n={zoom:0,bearing:0,pitch:0,pan:new l.pointGeometry(0,0),pinchAround:void 0,around:void 0};for(const{settings:d}of this._inertiaBuffer)n.zoom+=d.zoomDelta||0,n.bearing+=d.bearingDelta||0,n.pitch+=d.pitchDelta||0,d.panDelta&&n.pan._add(d.panDelta),d.around&&(n.around=d.around),d.pinchAround&&(n.pinchAround=d.pinchAround);const s=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,u={};if(n.pan.mag()){const d=so(n.pan.mag(),s,l.extend({},Sa,t||{}));u.offset=n.pan.mult(d.amount/n.pan.mag()),u.center=this._map.transform.center,oo(u,d)}if(n.zoom){const d=so(n.zoom,s,Ia);u.zoom=this._map.transform.zoom+d.amount,oo(u,d)}if(n.bearing){const d=so(n.bearing,s,Aa);u.bearing=this._map.transform.bearing+l.clamp(d.amount,-179,179),oo(u,d)}if(n.pitch){const d=so(n.pitch,s,zn);u.pitch=this._map.transform.pitch+d.amount,oo(u,d)}if(u.zoom||u.bearing){const d=n.pinchAround===void 0?n.around:n.pinchAround;u.around=d?this._map.unproject(d):this._map.getCenter()}return this.clear(),l.extend(u,{noMoveStart:!0})}}function oo(a,t){(!a.duration||a.duration<t.duration)&&(a.duration=t.duration,a.easing=t.easing)}function so(a,t,n){const{maxSpeed:s,linearity:u,deceleration:d}=n,f=l.clamp(a*u/(t/1e3),-s,s),_=Math.abs(f)/(d*u);return{easing:n.easing,duration:1e3*_,amount:f*(_/2)}}class Mi extends l.Event{constructor(t,n,s,u={}){const d=se.mousePos(n.getCanvasContainer(),s),f=n.unproject(d);super(t,l.extend({point:d,lngLat:f,originalEvent:s},u)),this._defaultPrevented=!1,this.target=n}preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}}class ao extends l.Event{constructor(t,n,s){const u=t==="touchend"?s.changedTouches:s.touches,d=se.touchPos(n.getCanvasContainer(),u),f=d.map(y=>n.unproject(y)),_=d.reduce((y,v,T,I)=>y.add(v.div(I.length)),new l.pointGeometry(0,0));super(t,{points:d,point:_,lngLats:f,lngLat:n.unproject(_),originalEvent:s}),this._defaultPrevented=!1}preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}}class zi extends l.Event{constructor(t,n,s){super(t,{originalEvent:s}),this._defaultPrevented=!1}preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}}class Cl{constructor(t,n){this._map=t,this._clickTolerance=n.clickTolerance}reset(){delete this._mousedownPos}wheel(t){return this._firePreventable(new zi(t.type,this._map,t))}mousedown(t,n){return this._mousedownPos=n,this._firePreventable(new Mi(t.type,this._map,t))}mouseup(t){this._map.fire(new Mi(t.type,this._map,t))}click(t,n){this._mousedownPos&&this._mousedownPos.dist(n)>=this._clickTolerance||this._map.fire(new Mi(t.type,this._map,t))}dblclick(t){return this._firePreventable(new Mi(t.type,this._map,t))}mouseover(t){this._map.fire(new Mi(t.type,this._map,t))}mouseout(t){this._map.fire(new Mi(t.type,this._map,t))}touchstart(t){return this._firePreventable(new ao(t.type,this._map,t))}touchmove(t){this._map.fire(new ao(t.type,this._map,t))}touchend(t){this._map.fire(new ao(t.type,this._map,t))}touchcancel(t){this._map.fire(new ao(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Lr{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(t){this._map.fire(new Mi(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Mi("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._ignoreContextMenu||this._map.fire(new Mi(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Ma{constructor(t,n){this._map=t,this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=n.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(t,n){this.isEnabled()&&t.shiftKey&&t.button===0&&(se.disableDrag(),this._startPos=this._lastPos=n,this._active=!0)}mousemoveWindow(t,n){if(!this._active)return;const s=n;if(this._lastPos.equals(s)||!this._box&&s.dist(this._startPos)<this._clickTolerance)return;const u=this._startPos;this._lastPos=s,this._box||(this._box=se.create("div","maplibregl-boxzoom mapboxgl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair","mapboxgl-crosshair"),this._fireEvent("boxzoomstart",t));const d=Math.min(u.x,s.x),f=Math.max(u.x,s.x),_=Math.min(u.y,s.y),y=Math.max(u.y,s.y);se.setTransform(this._box,`translate(${d}px,${_}px)`),this._box.style.width=f-d+"px",this._box.style.height=y-_+"px"}mouseupWindow(t,n){if(!this._active||t.button!==0)return;const s=this._startPos,u=n;if(this.reset(),se.suppressClick(),s.x!==u.x||s.y!==u.y)return this._map.fire(new l.Event("boxzoomend",{originalEvent:t})),{cameraAnimation:d=>d.fitScreenCoordinates(s,u,this._map.getBearing(),{linear:!0})};this._fireEvent("boxzoomcancel",t)}keydown(t){this._active&&t.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",t))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair","mapboxgl-crosshair"),this._box&&(se.remove(this._box),this._box=null),se.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(t,n){return this._map.fire(new l.Event(t,{originalEvent:n}))}}function _r(a,t){if(a.length!==t.length)throw new Error(`The number of touches and points are not equal - touches ${a.length}, points ${t.length}`);const n={};for(let s=0;s<a.length;s++)n[a[s].identifier]=t[s];return n}class lo{constructor(t){this.reset(),this.numTouches=t.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(t,n,s){(this.centroid||s.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=t.timeStamp),s.length===this.numTouches&&(this.centroid=function(u){const d=new l.pointGeometry(0,0);for(const f of u)d._add(f);return d.div(u.length)}(n),this.touches=_r(s,n)))}touchmove(t,n,s){if(this.aborted||!this.centroid)return;const u=_r(s,n);for(const d in this.touches){const f=this.touches[d],_=u[d];(!_||_.dist(f)>30)&&(this.aborted=!0)}}touchend(t,n,s){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),s.length===0){const u=!this.aborted&&this.centroid;if(this.reset(),u)return u}}}class ws{constructor(t){this.singleTap=new lo(t),this.numTaps=t.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(t,n,s){this.singleTap.touchstart(t,n,s)}touchmove(t,n,s){this.singleTap.touchmove(t,n,s)}touchend(t,n,s){const u=this.singleTap.touchend(t,n,s);if(u){const d=t.timeStamp-this.lastTime<500,f=!this.lastTap||this.lastTap.dist(u)<30;if(d&&f||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=u,this.count===this.numTaps)return this.reset(),u}}}class Ml{constructor(){this._zoomIn=new ws({numTouches:1,numTaps:2}),this._zoomOut=new ws({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(t,n,s){this._zoomIn.touchstart(t,n,s),this._zoomOut.touchstart(t,n,s)}touchmove(t,n,s){this._zoomIn.touchmove(t,n,s),this._zoomOut.touchmove(t,n,s)}touchend(t,n,s){const u=this._zoomIn.touchend(t,n,s),d=this._zoomOut.touchend(t,n,s);return u?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:f=>f.easeTo({duration:300,zoom:f.getZoom()+1,around:f.unproject(u)},{originalEvent:t})}):d?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:f=>f.easeTo({duration:300,zoom:f.getZoom()-1,around:f.unproject(d)},{originalEvent:t})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}const zl={0:1,2:2};class Uo{constructor(t){this.reset(),this._clickTolerance=t.clickTolerance||1}reset(){this._active=!1,this._moved=!1,delete this._lastPoint,delete this._eventButton}_correctButton(t,n){return!1}_move(t,n){return{}}mousedown(t,n){if(this._lastPoint)return;const s=se.mouseButton(t);this._correctButton(t,s)&&(this._lastPoint=n,this._eventButton=s)}mousemoveWindow(t,n){const s=this._lastPoint;if(s){if(t.preventDefault(),function(u,d){const f=zl[d];return u.buttons===void 0||(u.buttons&f)!==f}(t,this._eventButton))this.reset();else if(this._moved||!(n.dist(s)<this._clickTolerance))return this._moved=!0,this._lastPoint=n,this._move(s,n)}}mouseupWindow(t){this._lastPoint&&se.mouseButton(t)===this._eventButton&&(this._moved&&se.suppressClick(),this.reset())}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class co extends Uo{mousedown(t,n){super.mousedown(t,n),this._lastPoint&&(this._active=!0)}_correctButton(t,n){return n===0&&!t.ctrlKey}_move(t,n){return{around:n,panDelta:n.sub(t)}}}class yr extends Uo{_correctButton(t,n){return n===0&&t.ctrlKey||n===2}_move(t,n){const s=.8*(n.x-t.x);if(s)return this._active=!0,{bearingDelta:s}}contextmenu(t){t.preventDefault()}}class Fe extends Uo{_correctButton(t,n){return n===0&&t.ctrlKey||n===2}_move(t,n){const s=-.5*(n.y-t.y);if(s)return this._active=!0,{pitchDelta:s}}contextmenu(t){t.preventDefault()}}class za{constructor(t,n){this._minTouches=t.cooperativeGestures?2:1,this._clickTolerance=t.clickTolerance||1,this._map=n,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new l.pointGeometry(0,0),setTimeout(()=>{this._cancelCooperativeMessage=!1},200)}touchstart(t,n,s){return this._calculateTransform(t,n,s)}touchmove(t,n,s){if(this._map._cooperativeGestures&&(this._minTouches===2&&s.length<2&&!this._cancelCooperativeMessage?this._map._onCooperativeGesture(t,!1,s.length):this._cancelCooperativeMessage||(this._cancelCooperativeMessage=!0)),this._active&&!(s.length<this._minTouches))return t.preventDefault(),this._calculateTransform(t,n,s)}touchend(t,n,s){this._calculateTransform(t,n,s),this._active&&s.length<this._minTouches&&this.reset()}touchcancel(){this.reset()}_calculateTransform(t,n,s){s.length>0&&(this._active=!0);const u=_r(s,n),d=new l.pointGeometry(0,0),f=new l.pointGeometry(0,0);let _=0;for(const v in u){const T=u[v],I=this._touches[v];I&&(d._add(T),f._add(T.sub(I)),_++,u[v]=T)}if(this._touches=u,_<this._minTouches||!f.mag())return;const y=f.div(_);return this._sum._add(y),this._sum.mag()<this._clickTolerance?void 0:{around:d.div(_),panDelta:y}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Yr{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}_start(t){}_move(t,n,s){return{}}touchstart(t,n,s){this._firstTwoTouches||s.length<2||(this._firstTwoTouches=[s[0].identifier,s[1].identifier],this._start([n[0],n[1]]))}touchmove(t,n,s){if(!this._firstTwoTouches)return;t.preventDefault();const[u,d]=this._firstTwoTouches,f=Rr(s,n,u),_=Rr(s,n,d);if(!f||!_)return;const y=this._aroundCenter?null:f.add(_).div(2);return this._move([f,_],y,t)}touchend(t,n,s){if(!this._firstTwoTouches)return;const[u,d]=this._firstTwoTouches,f=Rr(s,n,u),_=Rr(s,n,d);f&&_||(this._active&&se.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(t){this._enabled=!0,this._aroundCenter=!!t&&t.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}function Rr(a,t,n){for(let s=0;s<a.length;s++)if(a[s].identifier===n)return t[s]}function Ts(a,t){return Math.log(a/t)/Math.LN2}class ze extends Yr{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(t){this._startDistance=this._distance=t[0].dist(t[1])}_move(t,n){const s=this._distance;if(this._distance=t[0].dist(t[1]),this._active||!(Math.abs(Ts(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:Ts(this._distance,s),pinchAround:n}}}function $o(a,t){return 180*a.angleWith(t)/Math.PI}class Pl extends Yr{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,n){const s=this._vector;if(this._vector=t[0].sub(t[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:$o(this._vector,s),pinchAround:n}}_isBelowThreshold(t){this._minDiameter=Math.min(this._minDiameter,t.mag());const n=25/(Math.PI*this._minDiameter)*360,s=$o(t,this._startVector);return Math.abs(s)<n}}function Es(a){return Math.abs(a.y)>Math.abs(a.x)}class Ss extends Yr{constructor(t){super(),this._map=t}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(t,n,s){super.touchstart(t,n,s),this._currentTouchCount=s.length}_start(t){this._lastPoints=t,Es(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,n,s){if(this._map._cooperativeGestures&&this._currentTouchCount<3)return;const u=t[0].sub(this._lastPoints[0]),d=t[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(u,d,s.timeStamp),this._valid?(this._lastPoints=t,this._active=!0,{pitchDelta:(u.y+d.y)/2*-.5}):void 0}gestureBeginsVertically(t,n,s){if(this._valid!==void 0)return this._valid;const u=t.mag()>=2,d=n.mag()>=2;if(!u&&!d)return;if(!u||!d)return this._firstMove===void 0&&(this._firstMove=s),s-this._firstMove<100&&void 0;const f=t.y>0==n.y>0;return Es(t)&&Es(n)&&f}}const Pa={panStep:100,bearingStep:15,pitchStep:10};class ka{constructor(){const t=Pa;this._panStep=t.panStep,this._bearingStep=t.bearingStep,this._pitchStep=t.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(t){if(t.altKey||t.ctrlKey||t.metaKey)return;let n=0,s=0,u=0,d=0,f=0;switch(t.keyCode){case 61:case 107:case 171:case 187:n=1;break;case 189:case 109:case 173:n=-1;break;case 37:t.shiftKey?s=-1:(t.preventDefault(),d=-1);break;case 39:t.shiftKey?s=1:(t.preventDefault(),d=1);break;case 38:t.shiftKey?u=1:(t.preventDefault(),f=-1);break;case 40:t.shiftKey?u=-1:(t.preventDefault(),f=1);break;default:return}return this._rotationDisabled&&(s=0,u=0),{cameraAnimation:_=>{const y=_.getZoom();_.easeTo({duration:300,easeId:"keyboardHandler",easing:kl,zoom:n?Math.round(y)+n*(t.shiftKey?2:1):y,bearing:_.getBearing()+s*this._bearingStep,pitch:_.getPitch()+u*this._pitchStep,offset:[-d*this._panStep,-f*this._panStep],center:_.getCenter()},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function kl(a){return a*(2-a)}const Da=4.000244140625;class Is{constructor(t,n){this._map=t,this._el=t.getCanvasContainer(),this._handler=n,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222,l.bindAll(["_onTimeout"],this)}setZoomRate(t){this._defaultZoomRate=t}setWheelZoomRate(t){this._wheelZoomRate=t}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=t&&t.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}wheel(t){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!this._map._metaPress)return;t.preventDefault()}let n=t.deltaMode===WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY;const s=l.exported.now(),u=s-(this._lastWheelEventTime||0);this._lastWheelEventTime=s,n!==0&&n%Da==0?this._type="wheel":n!==0&&Math.abs(n)<4?this._type="trackpad":u>400?(this._type=null,this._lastValue=n,this._timeout=setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(u*n)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,n+=this._lastValue)),t.shiftKey&&n&&(n/=4),this._type&&(this._lastWheelEvent=t,this._delta-=n,this._active||this._start(t)),t.preventDefault()}_onTimeout(t){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(t)}_start(t){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const n=se.mousePos(this._el,t);this._around=l.LngLat.convert(this._aroundCenter?this._map.getCenter():this._map.unproject(n)),this._aroundPoint=this._map.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const t=this._map.transform;if(this._delta!==0){const _=this._type==="wheel"&&Math.abs(this._delta)>Da?this._wheelZoomRate:this._defaultZoomRate;let y=2/(1+Math.exp(-Math.abs(this._delta*_)));this._delta<0&&y!==0&&(y=1/y);const v=typeof this._targetZoom=="number"?t.zoomScale(this._targetZoom):t.scale;this._targetZoom=Math.min(t.maxZoom,Math.max(t.minZoom,t.scaleZoom(v*y))),this._type==="wheel"&&(this._startZoom=t.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const n=typeof this._targetZoom=="number"?this._targetZoom:t.zoom,s=this._startZoom,u=this._easing;let d,f=!1;if(this._type==="wheel"&&s&&u){const _=Math.min((l.exported.now()-this._lastWheelEventTime)/200,1),y=u(_);d=l.number(s,n,y),_<1?this._frameId||(this._frameId=!0):f=!0}else d=n,f=!0;return this._active=!0,f&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!f,zoomDelta:d-t.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let n=l.ease;if(this._prevEase){const s=this._prevEase,u=(l.exported.now()-s.start)/s.duration,d=s.easing(u+.01)-s.easing(u),f=.27/Math.sqrt(d*d+1e-4)*.01,_=Math.sqrt(.0729-f*f);n=l.bezier(f,_,.25,1)}return this._prevEase={start:l.exported.now(),duration:t,easing:n},n}reset(){this._active=!1}}class As{constructor(t,n){this._clickZoom=t,this._tapZoom=n}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class Cs{constructor(){this.reset()}reset(){this._active=!1}dblclick(t,n){return t.preventDefault(),{cameraAnimation:s=>{s.easeTo({duration:300,zoom:s.getZoom()+(t.shiftKey?-1:1),around:s.unproject(n)},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Ms{constructor(){this._tap=new ws({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,this._tap.reset()}touchstart(t,n,s){this._swipePoint||(this._tapTime&&t.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?s.length>0&&(this._swipePoint=n[0],this._swipeTouch=s[0].identifier):this._tap.touchstart(t,n,s))}touchmove(t,n,s){if(this._tapTime){if(this._swipePoint){if(s[0].identifier!==this._swipeTouch)return;const u=n[0],d=u.y-this._swipePoint.y;return this._swipePoint=u,t.preventDefault(),this._active=!0,{zoomDelta:d/128}}}else this._tap.touchmove(t,n,s)}touchend(t,n,s){this._tapTime?this._swipePoint&&s.length===0&&this.reset():this._tap.touchend(t,n,s)&&(this._tapTime=t.timeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class xi{constructor(t,n,s){this._el=t,this._mousePan=n,this._touchPan=s}enable(t){this._inertiaOptions=t||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan","mapboxgl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan","mapboxgl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class Br{constructor(t,n,s){this._pitchWithRotate=t.pitchWithRotate,this._mouseRotate=n,this._mousePitch=s}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class La{constructor(t,n,s,u){this._el=t,this._touchZoom=n,this._touchRotate=s,this._tapDragZoom=u,this._rotationDisabled=!1,this._enabled=!0}enable(t){this._touchZoom.enable(t),this._rotationDisabled||this._touchRotate.enable(t),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate","mapboxgl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate","mapboxgl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}const Pn=a=>a.zoom||a.drag||a.pitch||a.rotate;class zs extends l.Event{}function uo(a){return a.panDelta&&a.panDelta.mag()||a.zoomDelta||a.bearingDelta||a.pitchDelta}class Ra{constructor(t,n){this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Ca(t),this._bearingSnap=n.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(n),l.bindAll(["handleEvent","handleWindowEvent"],this);const s=this._el;this._listeners=[[s,"touchstart",{passive:!0}],[s,"touchmove",{passive:!1}],[s,"touchend",void 0],[s,"touchcancel",void 0],[s,"mousedown",void 0],[s,"mousemove",void 0],[s,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[s,"mouseover",void 0],[s,"mouseout",void 0],[s,"dblclick",void 0],[s,"click",void 0],[s,"keydown",{capture:!1}],[s,"keyup",void 0],[s,"wheel",{passive:!1}],[s,"contextmenu",void 0],[window,"blur",void 0]];for(const[u,d,f]of this._listeners)se.addEventListener(u,d,u===document?this.handleWindowEvent:this.handleEvent,f)}destroy(){for(const[t,n,s]of this._listeners)se.removeEventListener(t,n,t===document?this.handleWindowEvent:this.handleEvent,s)}_addDefaultHandlers(t){const n=this._map,s=n.getCanvasContainer();this._add("mapEvent",new Cl(n,t));const u=n.boxZoom=new Ma(n,t);this._add("boxZoom",u);const d=new Ml,f=new Cs;n.doubleClickZoom=new As(f,d),this._add("tapZoom",d),this._add("clickZoom",f);const _=new Ms;this._add("tapDragZoom",_);const y=n.touchPitch=new Ss(n);this._add("touchPitch",y);const v=new yr(t),T=new Fe(t);n.dragRotate=new Br(t,v,T),this._add("mouseRotate",v,["mousePitch"]),this._add("mousePitch",T,["mouseRotate"]);const I=new co(t),C=new za(t,n);n.dragPan=new xi(s,I,C),this._add("mousePan",I),this._add("touchPan",C,["touchZoom","touchRotate"]);const F=new Pl,R=new ze;n.touchZoomRotate=new La(s,R,F,_),this._add("touchRotate",F,["touchPan","touchZoom"]),this._add("touchZoom",R,["touchPan","touchRotate"]);const B=n.scrollZoom=new Is(n,this);this._add("scrollZoom",B,["mousePan"]);const X=n.keyboard=new ka;this._add("keyboard",X),this._add("blockableMapEvent",new Lr(n));for(const J of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])t.interactive&&t[J]&&n[J].enable(t[J])}_add(t,n,s){this._handlers.push({handlerName:t,handler:n,allowed:s}),this._handlersById[t]=n}stop(t){if(!this._updatingCamera){for(const{handler:n}of this._handlers)n.reset();this._inertia.clear(),this._fireEvents({},{},t),this._changes=[]}}isActive(){for(const{handler:t}of this._handlers)if(t.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return Boolean(Pn(this._eventsInProgress))||this.isZooming()}_blockedByActive(t,n,s){for(const u in t)if(u!==s&&(!n||n.indexOf(u)<0))return!0;return!1}handleWindowEvent(t){this.handleEvent(t,`${t.type}Window`)}_getMapTouches(t){const n=[];for(const s of t)this._el.contains(s.target)&&n.push(s);return n}handleEvent(t,n){if(t.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const s=t.type==="renderFrame"?void 0:t,u={needsRenderFrame:!1},d={},f={},_=t.touches,y=_?this._getMapTouches(_):void 0,v=y?se.touchPos(this._el,y):se.mousePos(this._el,t);for(const{handlerName:C,handler:F,allowed:R}of this._handlers){if(!F.isEnabled())continue;let B;this._blockedByActive(f,R,C)?F.reset():F[n||t.type]&&(B=F[n||t.type](t,v,y),this.mergeHandlerResult(u,d,B,C,s),B&&B.needsRenderFrame&&this._triggerRenderFrame()),(B||F.isActive())&&(f[C]=F)}const T={};for(const C in this._previousActiveHandlers)f[C]||(T[C]=s);this._previousActiveHandlers=f,(Object.keys(T).length||uo(u))&&(this._changes.push([u,d,T]),this._triggerRenderFrame()),(Object.keys(f).length||uo(u))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:I}=u;I&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],I(this._map))}mergeHandlerResult(t,n,s,u,d){if(!s)return;l.extend(t,s);const f={handlerName:u,originalEvent:s.originalEvent||d};s.zoomDelta!==void 0&&(n.zoom=f),s.panDelta!==void 0&&(n.drag=f),s.pitchDelta!==void 0&&(n.pitch=f),s.bearingDelta!==void 0&&(n.rotate=f)}_applyChanges(){const t={},n={},s={};for(const[u,d,f]of this._changes)u.panDelta&&(t.panDelta=(t.panDelta||new l.pointGeometry(0,0))._add(u.panDelta)),u.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+u.zoomDelta),u.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+u.bearingDelta),u.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+u.pitchDelta),u.around!==void 0&&(t.around=u.around),u.pinchAround!==void 0&&(t.pinchAround=u.pinchAround),u.noInertia&&(t.noInertia=u.noInertia),l.extend(n,d),l.extend(s,f);this._updateMapTransform(t,n,s),this._changes=[]}_updateMapTransform(t,n,s){const u=this._map,d=u.transform,f=u.style&&u.style.terrain;if(!(uo(t)||f&&this._drag))return this._fireEvents(n,s,!0);let{panDelta:_,zoomDelta:y,bearingDelta:v,pitchDelta:T,around:I,pinchAround:C}=t;C!==void 0&&(I=C),u._stop(!0),I=I||u.transform.centerPoint;const F=d.pointLocation(_?I.sub(_):I);v&&(d.bearing+=v),T&&(d.pitch+=T),y&&(d.zoom+=y),f?n.drag&&!this._drag?(this._drag={center:d.centerPoint,lngLat:d.pointLocation(I),point:I,handlerName:n.drag.handlerName},u.fire(new l.Event("freezeElevation",{freeze:!0}))):this._drag&&s[this._drag.handlerName]?(u.fire(new l.Event("freezeElevation",{freeze:!1})),this._drag=null):n.drag&&this._drag&&(d.center=d.pointLocation(d.centerPoint.sub(_))):d.setLocationAtPoint(F,I),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(n,s,!0)}_fireEvents(t,n,s){const u=Pn(this._eventsInProgress),d=Pn(t),f={};for(const T in t){const{originalEvent:I}=t[T];this._eventsInProgress[T]||(f[`${T}start`]=I),this._eventsInProgress[T]=t[T]}!u&&d&&this._fireEvent("movestart",d.originalEvent);for(const T in f)this._fireEvent(T,f[T]);d&&this._fireEvent("move",d.originalEvent);for(const T in t){const{originalEvent:I}=t[T];this._fireEvent(T,I)}const _={};let y;for(const T in this._eventsInProgress){const{handlerName:I,originalEvent:C}=this._eventsInProgress[T];this._handlersById[I].isActive()||(delete this._eventsInProgress[T],y=n[I]||C,_[`${T}end`]=y)}for(const T in _)this._fireEvent(T,_[T]);const v=Pn(this._eventsInProgress);if(s&&(u||d)&&!v){this._updatingCamera=!0;const T=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),I=C=>C!==0&&-this._bearingSnap<C&&C<this._bearingSnap;T?(I(T.bearing||this._map.getBearing())&&(T.bearing=0),this._map.easeTo(T,{originalEvent:y})):(this._map.fire(new l.Event("moveend",{originalEvent:y})),I(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(t,n){this._map.fire(new l.Event(t,n?{originalEvent:n}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(t=>{delete this._frameId,this.handleEvent(new zs("renderFrame",{timeStamp:t})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}const Ui={extend:(a,...t)=>l.extend(a,...t),run(a){a()},logToElement(a,t=!1,n="log"){const s=window.document.getElementById(n);s&&(t&&(s.innerHTML=""),s.innerHTML+=`<br>${a}`)}};class Rt extends l.Evented{constructor(t,n){super(),this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=n.bearingSnap,l.bindAll(["_renderFrameCallback"],this)}getCenter(){return new l.LngLat(this.transform.center.lng,this.transform.center.lat)}setCenter(t,n){return this.jumpTo({center:t},n)}panBy(t,n,s){return t=l.pointGeometry.convert(t).mult(-1),this.panTo(this.transform.center,l.extend({offset:t},n),s)}panTo(t,n,s){return this.easeTo(l.extend({center:t},n),s)}getZoom(){return this.transform.zoom}setZoom(t,n){return this.jumpTo({zoom:t},n),this}zoomTo(t,n,s){return this.easeTo(l.extend({zoom:t},n),s)}zoomIn(t,n){return this.zoomTo(this.getZoom()+1,t,n),this}zoomOut(t,n){return this.zoomTo(this.getZoom()-1,t,n),this}getBearing(){return this.transform.bearing}setBearing(t,n){return this.jumpTo({bearing:t},n),this}getPadding(){return this.transform.padding}setPadding(t,n){return this.jumpTo({padding:t},n),this}rotateTo(t,n,s){return this.easeTo(l.extend({bearing:t},n),s)}resetNorth(t,n){return this.rotateTo(0,l.extend({duration:1e3},t),n),this}resetNorthPitch(t,n){return this.easeTo(l.extend({bearing:0,pitch:0,duration:1e3},t),n),this}snapToNorth(t,n){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(t,n):this}getPitch(){return this.transform.pitch}setPitch(t,n){return this.jumpTo({pitch:t},n),this}cameraForBounds(t,n){t=l.LngLatBounds.convert(t);const s=n&&n.bearing||0;return this._cameraForBoxAndBearing(t.getNorthWest(),t.getSouthEast(),s,n)}_cameraForBoxAndBearing(t,n,s,u){const d={top:0,bottom:0,right:0,left:0};if(typeof(u=l.extend({padding:d,offset:[0,0],maxZoom:this.transform.maxZoom},u)).padding=="number"){const ie=u.padding;u.padding={top:ie,bottom:ie,right:ie,left:ie}}u.padding=l.extend(d,u.padding);const f=this.transform,_=f.padding,y=f.project(l.LngLat.convert(t)),v=f.project(l.LngLat.convert(n)),T=y.rotate(-s*Math.PI/180),I=v.rotate(-s*Math.PI/180),C=new l.pointGeometry(Math.max(T.x,I.x),Math.max(T.y,I.y)),F=new l.pointGeometry(Math.min(T.x,I.x),Math.min(T.y,I.y)),R=C.sub(F),B=(f.width-(_.left+_.right+u.padding.left+u.padding.right))/R.x,X=(f.height-(_.top+_.bottom+u.padding.top+u.padding.bottom))/R.y;if(X<0||B<0)return void l.warnOnce("Map cannot fit within canvas with the given bounds, padding, and/or offset.");const J=Math.min(f.scaleZoom(f.scale*Math.min(B,X)),u.maxZoom),te=l.pointGeometry.convert(u.offset),O=new l.pointGeometry((u.padding.left-u.padding.right)/2,(u.padding.top-u.padding.bottom)/2).rotate(s*Math.PI/180),ne=te.add(O).mult(f.scale/f.zoomScale(J));return{center:f.unproject(y.add(v).div(2).sub(ne)),zoom:J,bearing:s}}fitBounds(t,n,s){return this._fitInternal(this.cameraForBounds(t,n),n,s)}fitScreenCoordinates(t,n,s,u,d){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(l.pointGeometry.convert(t)),this.transform.pointLocation(l.pointGeometry.convert(n)),s,u),u,d)}_fitInternal(t,n,s){return t?(delete(n=l.extend(t,n)).padding,n.linear?this.easeTo(n,s):this.flyTo(n,s)):this}jumpTo(t,n){this.stop();const s=this.transform;let u=!1,d=!1,f=!1;return"zoom"in t&&s.zoom!==+t.zoom&&(u=!0,s.zoom=+t.zoom),t.center!==void 0&&(s.center=l.LngLat.convert(t.center)),"bearing"in t&&s.bearing!==+t.bearing&&(d=!0,s.bearing=+t.bearing),"pitch"in t&&s.pitch!==+t.pitch&&(f=!0,s.pitch=+t.pitch),t.padding==null||s.isPaddingEqual(t.padding)||(s.padding=t.padding),this.fire(new l.Event("movestart",n)).fire(new l.Event("move",n)),u&&this.fire(new l.Event("zoomstart",n)).fire(new l.Event("zoom",n)).fire(new l.Event("zoomend",n)),d&&this.fire(new l.Event("rotatestart",n)).fire(new l.Event("rotate",n)).fire(new l.Event("rotateend",n)),f&&this.fire(new l.Event("pitchstart",n)).fire(new l.Event("pitch",n)).fire(new l.Event("pitchend",n)),this.fire(new l.Event("moveend",n))}calculateCameraOptionsFromTo(t,n,s,u=0){const d=l.MercatorCoordinate.fromLngLat(t,n),f=l.MercatorCoordinate.fromLngLat(s,u),_=f.x-d.x,y=f.y-d.y,v=f.z-d.z,T=Math.hypot(_,y,v);if(T===0)throw new Error("Can't calculate camera options with same From and To");const I=Math.hypot(_,y),C=this.transform.scaleZoom(this.transform.cameraToCenterDistance/T/this.transform.tileSize),F=180*Math.atan2(_,-y)/Math.PI;let R=180*Math.acos(I/T)/Math.PI;return R=v<0?90-R:90+R,{center:f.toLngLat(),zoom:C,pitch:R,bearing:F}}easeTo(t,n){this._stop(!1,t.easeId),((t=l.extend({offset:[0,0],duration:500,easing:l.ease},t)).animate===!1||!t.essential&&l.exported.prefersReducedMotion)&&(t.duration=0);const s=this.transform,u=this.getZoom(),d=this.getBearing(),f=this.getPitch(),_=this.getPadding(),y="zoom"in t?+t.zoom:u,v="bearing"in t?this._normalizeBearing(t.bearing,d):d,T="pitch"in t?+t.pitch:f,I="padding"in t?t.padding:s.padding,C=l.pointGeometry.convert(t.offset);let F=s.centerPoint.add(C);const R=s.pointLocation(F),B=l.LngLat.convert(t.center||R);this._normalizeCenter(B);const X=s.project(R),J=s.project(B).sub(X),te=s.zoomScale(y-u);let O,ne;t.around&&(O=l.LngLat.convert(t.around),ne=s.locationPoint(O));const ie={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||y!==u,this._rotating=this._rotating||d!==v,this._pitching=this._pitching||T!==f,this._padding=!s.isPaddingEqual(I),this._easeId=t.easeId,this._prepareEase(n,t.noMoveStart,ie),this._ease(ue=>{if(this._zooming&&(s.zoom=l.number(u,y,ue)),this._rotating&&(s.bearing=l.number(d,v,ue)),this._pitching&&(s.pitch=l.number(f,T,ue)),this._padding&&(s.interpolatePadding(_,I,ue),F=s.centerPoint.add(C)),O)s.setLocationAtPoint(O,ne);else{const he=s.zoomScale(s.zoom-u),ye=y>u?Math.min(2,te):Math.max(.5,te),ce=Math.pow(ye,1-ue),Le=s.unproject(X.add(J.mult(ue*ce)).mult(he));s.setLocationAtPoint(s.renderWorldCopies?Le.wrap():Le,F)}this._fireMoveEvents(n)},ue=>{this._afterEase(n,ue)},t),this}_prepareEase(t,n,s={}){this._moving=!0,this.fire(new l.Event("freezeElevation",{freeze:!0})),n||s.moving||this.fire(new l.Event("movestart",t)),this._zooming&&!s.zooming&&this.fire(new l.Event("zoomstart",t)),this._rotating&&!s.rotating&&this.fire(new l.Event("rotatestart",t)),this._pitching&&!s.pitching&&this.fire(new l.Event("pitchstart",t))}_fireMoveEvents(t){this.fire(new l.Event("move",t)),this._zooming&&this.fire(new l.Event("zoom",t)),this._rotating&&this.fire(new l.Event("rotate",t)),this._pitching&&this.fire(new l.Event("pitch",t))}_afterEase(t,n){if(this._easeId&&n&&this._easeId===n)return;delete this._easeId,this.fire(new l.Event("freezeElevation",{freeze:!1}));const s=this._zooming,u=this._rotating,d=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,s&&this.fire(new l.Event("zoomend",t)),u&&this.fire(new l.Event("rotateend",t)),d&&this.fire(new l.Event("pitchend",t)),this.fire(new l.Event("moveend",t))}flyTo(t,n){if(!t.essential&&l.exported.prefersReducedMotion){const Ge=l.pick(t,["center","zoom","bearing","pitch","around"]);return this.jumpTo(Ge,n)}this.stop(),t=l.extend({offset:[0,0],speed:1.2,curve:1.42,easing:l.ease},t);const s=this.transform,u=this.getZoom(),d=this.getBearing(),f=this.getPitch(),_=this.getPadding(),y="zoom"in t?l.clamp(+t.zoom,s.minZoom,s.maxZoom):u,v="bearing"in t?this._normalizeBearing(t.bearing,d):d,T="pitch"in t?+t.pitch:f,I="padding"in t?t.padding:s.padding,C=s.zoomScale(y-u),F=l.pointGeometry.convert(t.offset);let R=s.centerPoint.add(F);const B=s.pointLocation(R),X=l.LngLat.convert(t.center||B);this._normalizeCenter(X);const J=s.project(B),te=s.project(X).sub(J);let O=t.curve;const ne=Math.max(s.width,s.height),ie=ne/C,ue=te.mag();if("minZoom"in t){const Ge=l.clamp(Math.min(t.minZoom,u,y),s.minZoom,s.maxZoom),bt=ne/s.zoomScale(Ge-u);O=Math.sqrt(bt/ue*2)}const he=O*O;function ye(Ge){const bt=(ie*ie-ne*ne+(Ge?-1:1)*he*he*ue*ue)/(2*(Ge?ie:ne)*he*ue);return Math.log(Math.sqrt(bt*bt+1)-bt)}function ce(Ge){return(Math.exp(Ge)-Math.exp(-Ge))/2}function Le(Ge){return(Math.exp(Ge)+Math.exp(-Ge))/2}const Ie=ye(0);let Re=function(Ge){return Le(Ie)/Le(Ie+O*Ge)},Qe=function(Ge){return ne*((Le(Ie)*(ce(bt=Ie+O*Ge)/Le(bt))-ce(Ie))/he)/ue;var bt},it=(ye(1)-Ie)/O;if(Math.abs(ue)<1e-6||!isFinite(it)){if(Math.abs(ne-ie)<1e-6)return this.easeTo(t,n);const Ge=ie<ne?-1:1;it=Math.abs(Math.log(ie/ne))/O,Qe=function(){return 0},Re=function(bt){return Math.exp(Ge*O*bt)}}return t.duration="duration"in t?+t.duration:1e3*it/("screenSpeed"in t?+t.screenSpeed/O:+t.speed),t.maxDuration&&t.duration>t.maxDuration&&(t.duration=0),this._zooming=!0,this._rotating=d!==v,this._pitching=T!==f,this._padding=!s.isPaddingEqual(I),this._prepareEase(n,!1),this._ease(Ge=>{const bt=Ge*it,wt=1/Re(bt);s.zoom=Ge===1?y:u+s.scaleZoom(wt),this._rotating&&(s.bearing=l.number(d,v,Ge)),this._pitching&&(s.pitch=l.number(f,T,Ge)),this._padding&&(s.interpolatePadding(_,I,Ge),R=s.centerPoint.add(F));const ut=Ge===1?X:s.unproject(J.add(te.mult(Qe(bt))).mult(wt));s.setLocationAtPoint(s.renderWorldCopies?ut.wrap():ut,R),this._fireMoveEvents(n)},()=>this._afterEase(n),t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(t,n){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const s=this._onEaseEnd;delete this._onEaseEnd,s.call(this,n)}if(!t){const s=this.handlers;s&&s.stop(!1)}return this}_ease(t,n,s){s.animate===!1||s.duration===0?(t(1),n()):(this._easeStart=l.exported.now(),this._easeOptions=s,this._onEaseFrame=t,this._onEaseEnd=n,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){const t=Math.min((l.exported.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(t)),t<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(t,n){t=l.wrap(t,-180,180);const s=Math.abs(t-n);return Math.abs(t-360-n)<s&&(t-=360),Math.abs(t+360-n)<s&&(t+=360),t}_normalizeCenter(t){const n=this.transform;if(!n.renderWorldCopies||n.lngRange)return;const s=t.lng-n.center.lng;t.lng+=s>180?-360:s<-180?360:0}}class ho{constructor(t={}){this.options=t,l.bindAll(["_toggleAttribution","_updateData","_updateCompact","_updateCompactMinimize"],this)}getDefaultPosition(){return"bottom-right"}onAdd(t){return this._map=t,this._compact=this.options&&this.options.compact,this._container=se.create("details","maplibregl-ctrl maplibregl-ctrl-attrib mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=se.create("summary","maplibregl-ctrl-attrib-button mapboxgl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=se.create("div","maplibregl-ctrl-attrib-inner mapboxgl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("terrain",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container}onRemove(){se.remove(this._container),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,n){const s=this._map._getUIString(`AttributionControl.${n}`);t.title=s,t.setAttribute("aria-label",s)}_toggleAttribution(){this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show","mapboxgl-compact-show")):(this._container.classList.add("maplibregl-compact-show","mapboxgl-compact-show"),this._container.removeAttribute("open")))}_updateData(t){!t||t.sourceDataType!=="metadata"&&t.sourceDataType!=="visibility"&&t.dataType!=="style"&&t.type!=="terrain"||this._updateAttributions()}_updateAttributions(){if(!this._map.style)return;let t=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=t.concat(this.options.customAttribution.map(u=>typeof u!="string"?"":u)):typeof this.options.customAttribution=="string"&&t.push(this.options.customAttribution)),this._map.style.stylesheet){const u=this._map.style.stylesheet;this.styleOwner=u.owner,this.styleId=u.id}const n=this._map.style.sourceCaches;for(const u in n){const d=n[u];if(d.used||d.usedForTerrain){const f=d.getSource();f.attribution&&t.indexOf(f.attribution)<0&&t.push(f.attribution)}}t=t.filter(u=>String(u).trim()),t.sort((u,d)=>u.length-d.length),t=t.filter((u,d)=>{for(let f=d+1;f<t.length;f++)if(t[f].indexOf(u)>=0)return!1;return!0});const s=t.join(" | ");s!==this._attribHTML&&(this._attribHTML=s,t.length?(this._innerContainer.innerHTML=s,this._container.classList.remove("maplibregl-attrib-empty","mapboxgl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty","mapboxgl-attrib-empty"),this._updateCompact(),this._editLink=null)}_updateCompact(){this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact===!1?this._container.setAttribute("open",""):this._container.classList.contains("maplibregl-compact")||this._container.classList.contains("maplibregl-attrib-empty")||(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","mapboxgl-compact","maplibregl-compact-show","mapboxgl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show","mapboxgl-compact","mapboxgl-compact-show"))}_updateCompactMinimize(){this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show","mapboxgl-compact-show")}}class Vo{constructor(t={}){this.options=t,l.bindAll(["_updateCompact"],this)}getDefaultPosition(){return"bottom-left"}onAdd(t){this._map=t,this._compact=this.options&&this.options.compact,this._container=se.create("div","maplibregl-ctrl mapboxgl-ctrl");const n=se.create("a","maplibregl-ctrl-logo mapboxgl-ctrl-logo");return n.target="_blank",n.rel="noopener nofollow",n.href="https://maplibre.org/",n.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),n.setAttribute("rel","noopener nofollow"),this._container.appendChild(n),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){se.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}_updateCompact(){const t=this._container.children;if(t.length){const n=t[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&n.classList.add("maplibregl-compact","mapboxgl-compact"):n.classList.remove("maplibregl-compact","mapboxgl-compact")}}}class Ba{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(t){const n=++this._id;return this._queue.push({callback:t,id:n,cancelled:!1}),n}remove(t){const n=this._currentlyRunning,s=n?this._queue.concat(n):this._queue;for(const u of s)if(u.id===t)return void(u.cancelled=!0)}run(t=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const n=this._currentlyRunning=this._queue;this._queue=[];for(const s of n)if(!s.cancelled&&(s.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}const Fa={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"Mapbox logo","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","TerrainControl.enableTerrain":"Enable terrain","TerrainControl.disableTerrain":"Disable terrain"},Oa={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:void 0,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,maplibreLogo:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,maxTileCacheSize:null,localIdeographFontFamily:"sans-serif",transformRequest:null,fadeDuration:300,crossSourceCollisions:!0},Dl={showCompass:!0,showZoom:!0,visualizePitch:!1};class ir{constructor(t,n,s=!1){this._clickTolerance=10,this.element=n,this.mouseRotate=new yr({clickTolerance:t.dragRotate._mouseRotate._clickTolerance}),this.map=t,s&&(this.mousePitch=new Fe({clickTolerance:t.dragRotate._mousePitch._clickTolerance})),l.bindAll(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),se.addEventListener(n,"mousedown",this.mousedown),se.addEventListener(n,"touchstart",this.touchstart,{passive:!1}),se.addEventListener(n,"touchmove",this.touchmove),se.addEventListener(n,"touchend",this.touchend),se.addEventListener(n,"touchcancel",this.reset)}down(t,n){this.mouseRotate.mousedown(t,n),this.mousePitch&&this.mousePitch.mousedown(t,n),se.disableDrag()}move(t,n){const s=this.map,u=this.mouseRotate.mousemoveWindow(t,n);if(u&&u.bearingDelta&&s.setBearing(s.getBearing()+u.bearingDelta),this.mousePitch){const d=this.mousePitch.mousemoveWindow(t,n);d&&d.pitchDelta&&s.setPitch(s.getPitch()+d.pitchDelta)}}off(){const t=this.element;se.removeEventListener(t,"mousedown",this.mousedown),se.removeEventListener(t,"touchstart",this.touchstart,{passive:!1}),se.removeEventListener(t,"touchmove",this.touchmove),se.removeEventListener(t,"touchend",this.touchend),se.removeEventListener(t,"touchcancel",this.reset),this.offTemp()}offTemp(){se.enableDrag(),se.removeEventListener(window,"mousemove",this.mousemove),se.removeEventListener(window,"mouseup",this.mouseup)}mousedown(t){this.down(l.extend({},t,{ctrlKey:!0,preventDefault:()=>t.preventDefault()}),se.mousePos(this.element,t)),se.addEventListener(window,"mousemove",this.mousemove),se.addEventListener(window,"mouseup",this.mouseup)}mousemove(t){this.move(t,se.mousePos(this.element,t))}mouseup(t){this.mouseRotate.mouseupWindow(t),this.mousePitch&&this.mousePitch.mouseupWindow(t),this.offTemp()}touchstart(t){t.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=se.touchPos(this.element,t.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:()=>t.preventDefault()},this._startPos))}touchmove(t){t.targetTouches.length!==1?this.reset():(this._lastPos=se.touchPos(this.element,t.targetTouches)[0],this.move({preventDefault:()=>t.preventDefault()},this._lastPos))}touchend(t){t.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),this.reset()}reset(){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()}}function po(a,t,n){if(a=new l.LngLat(a.lng,a.lat),t){const s=new l.LngLat(a.lng-360,a.lat),u=new l.LngLat(a.lng+360,a.lat),d=n.locationPoint(a).distSqr(t);n.locationPoint(s).distSqr(t)<d?a=s:n.locationPoint(u).distSqr(t)<d&&(a=u)}for(;Math.abs(a.lng-n.center.lng)>180;){const s=n.locationPoint(a);if(s.x>=0&&s.y>=0&&s.x<=n.width&&s.y<=n.height)break;a.lng>n.center.lng?a.lng-=360:a.lng+=360}return a}const Ve={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 je(a,t,n){const s=a.classList;for(const u in Ve)s.remove(`maplibregl-${n}-anchor-${u}`,`mapboxgl-${n}-anchor-${u}`);s.add(`maplibregl-${n}-anchor-${t}`,`mapboxgl-${n}-anchor-${t}`)}class kn extends l.Evented{constructor(t,n){if(super(),(t instanceof HTMLElement||n)&&(t=l.extend({element:t},n)),l.bindAll(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress"],this),this._anchor=t&&t.anchor||"center",this._color=t&&t.color||"#3FB1CE",this._scale=t&&t.scale||1,this._draggable=t&&t.draggable||!1,this._clickTolerance=t&&t.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=t&&t.rotation||0,this._rotationAlignment=t&&t.rotationAlignment||"auto",this._pitchAlignment=t&&t.pitchAlignment&&t.pitchAlignment!=="auto"?t.pitchAlignment:this._rotationAlignment,t&&t.element)this._element=t.element,this._offset=l.pointGeometry.convert(t&&t.offset||[0,0]);else{this._defaultMarker=!0,this._element=se.create("div"),this._element.setAttribute("aria-label","Map marker");const s=se.createNS("http://www.w3.org/2000/svg","svg"),u=41,d=27;s.setAttributeNS(null,"display","block"),s.setAttributeNS(null,"height",`${u}px`),s.setAttributeNS(null,"width",`${d}px`),s.setAttributeNS(null,"viewBox",`0 0 ${d} ${u}`);const f=se.createNS("http://www.w3.org/2000/svg","g");f.setAttributeNS(null,"stroke","none"),f.setAttributeNS(null,"stroke-width","1"),f.setAttributeNS(null,"fill","none"),f.setAttributeNS(null,"fill-rule","evenodd");const _=se.createNS("http://www.w3.org/2000/svg","g");_.setAttributeNS(null,"fill-rule","nonzero");const y=se.createNS("http://www.w3.org/2000/svg","g");y.setAttributeNS(null,"transform","translate(3.0, 29.0)"),y.setAttributeNS(null,"fill","#000000");const v=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(const te of v){const O=se.createNS("http://www.w3.org/2000/svg","ellipse");O.setAttributeNS(null,"opacity","0.04"),O.setAttributeNS(null,"cx","10.5"),O.setAttributeNS(null,"cy","5.80029008"),O.setAttributeNS(null,"rx",te.rx),O.setAttributeNS(null,"ry",te.ry),y.appendChild(O)}const T=se.createNS("http://www.w3.org/2000/svg","g");T.setAttributeNS(null,"fill",this._color);const I=se.createNS("http://www.w3.org/2000/svg","path");I.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),T.appendChild(I);const C=se.createNS("http://www.w3.org/2000/svg","g");C.setAttributeNS(null,"opacity","0.25"),C.setAttributeNS(null,"fill","#000000");const F=se.createNS("http://www.w3.org/2000/svg","path");F.setAttributeNS(null,"d","M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"),C.appendChild(F);const R=se.createNS("http://www.w3.org/2000/svg","g");R.setAttributeNS(null,"transform","translate(6.0, 7.0)"),R.setAttributeNS(null,"fill","#FFFFFF");const B=se.createNS("http://www.w3.org/2000/svg","g");B.setAttributeNS(null,"transform","translate(8.0, 8.0)");const X=se.createNS("http://www.w3.org/2000/svg","circle");X.setAttributeNS(null,"fill","#000000"),X.setAttributeNS(null,"opacity","0.25"),X.setAttributeNS(null,"cx","5.5"),X.setAttributeNS(null,"cy","5.5"),X.setAttributeNS(null,"r","5.4999962");const J=se.createNS("http://www.w3.org/2000/svg","circle");J.setAttributeNS(null,"fill","#FFFFFF"),J.setAttributeNS(null,"cx","5.5"),J.setAttributeNS(null,"cy","5.5"),J.setAttributeNS(null,"r","5.4999962"),B.appendChild(X),B.appendChild(J),_.appendChild(y),_.appendChild(T),_.appendChild(C),_.appendChild(R),_.appendChild(B),s.appendChild(_),s.setAttributeNS(null,"height",u*this._scale+"px"),s.setAttributeNS(null,"width",d*this._scale+"px"),this._element.appendChild(s),this._offset=l.pointGeometry.convert(t&&t.offset||[0,-14])}this._element.classList.add("maplibregl-marker","mapboxgl-marker"),this._element.addEventListener("dragstart",s=>{s.preventDefault()}),this._element.addEventListener("mousedown",s=>{s.preventDefault()}),je(this._element,this._anchor,"marker"),this._popup=null}addTo(t){return this.remove(),this._map=t,t.getCanvasContainer().appendChild(this._element),t.on("move",this._update),t.on("moveend",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("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),se.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=l.LngLat.convert(t),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(t){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),t){if(!("offset"in t.options)){const u=Math.sqrt(Math.pow(13.5,2)/2);t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[u,-1*(38.1-13.5+u)],"bottom-right":[-u,-1*(38.1-13.5+u)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=t,this._lngLat&&this._popup.setLngLat(this._lngLat),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}_onKeyPress(t){const n=t.code,s=t.charCode||t.keyCode;n!=="Space"&&n!=="Enter"&&s!==32&&s!==13||this.togglePopup()}_onMapClick(t){const n=t.originalEvent.target,s=this._element;this._popup&&(n===s||s.contains(n))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){const t=this._popup;return t?(t.isOpen()?t.remove():t.addTo(this._map),this):this}_update(t){if(!this._map)return;this._map.transform.renderWorldCopies&&(this._lngLat=po(this._lngLat,this._pos,this._map.transform)),this._pos=this._map.project(this._lngLat)._add(this._offset);let n="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?n=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(n=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let s="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?s="rotateX(0deg)":this._pitchAlignment==="map"&&(s=`rotateX(${this._map.getPitch()}deg)`),t&&t.type!=="moveend"||(this._pos=this._pos.round()),se.setTransform(this._element,`${Ve[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${s} ${n}`),this._map.style&&this._map.style.terrain&&!this._opacityTimeout&&(this._opacityTimeout=setTimeout(()=>{const u=this._map.unproject(this._pos),d=40075016686e-3*Math.abs(Math.cos(this._lngLat.lat*Math.PI/180))/Math.pow(2,this._map.transform.tileZoom+8);this._element.style.opacity=u.distanceTo(this._lngLat)>20*d?"0.2":"1.0",this._opacityTimeout=null},100))}getOffset(){return this._offset}setOffset(t){return this._offset=l.pointGeometry.convert(t),this._update(),this}_onMove(t){if(!this._isDragging){const n=this._clickTolerance||this._map._clickTolerance;this._isDragging=t.point.dist(this._pointerdownPos)>=n}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",this._state==="pending"&&(this._state="active",this.fire(new l.Event("dragstart"))),this.fire(new l.Event("drag")))}_onUp(){this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._state==="active"&&this.fire(new l.Event("dragend")),this._state="inactive"}_addDragHandler(t){this._element.contains(t.originalEvent.target)&&(t.preventDefault(),this._positionDelta=t.point.sub(this._pos).add(this._offset),this._pointerdownPos=t.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))}setDraggable(t){return this._draggable=!!t,this._map&&(t?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(t){return this._rotation=t||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(t){return this._rotationAlignment=t||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(t){return this._pitchAlignment=t&&t!=="auto"?t:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}}const Ps={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let Fr,si=0,Or=!1;const rr={maxWidth:100,unit:"metric"};function Ua(a,t,n){const s=n&&n.maxWidth||100,u=a._container.clientHeight/2,d=a.unproject([0,u]),f=a.unproject([s,u]),_=d.distanceTo(f);if(n&&n.unit==="imperial"){const y=3.2808*_;y>5280?Ur(t,s,y/5280,a._getUIString("ScaleControl.Miles")):Ur(t,s,y,a._getUIString("ScaleControl.Feet"))}else n&&n.unit==="nautical"?Ur(t,s,_/1852,a._getUIString("ScaleControl.NauticalMiles")):_>=1e3?Ur(t,s,_/1e3,a._getUIString("ScaleControl.Kilometers")):Ur(t,s,_,a._getUIString("ScaleControl.Meters"))}function Ur(a,t,n,s){const u=function(d){const f=Math.pow(10,`${Math.floor(d)}`.length-1);let _=d/f;return _=_>=10?10:_>=5?5:_>=3?3:_>=2?2:_>=1?1:function(y){const v=Math.pow(10,Math.ceil(-Math.log(y)/Math.LN10));return Math.round(y*v)/v}(_),f*_}(n);a.style.width=t*(u/n)+"px",a.innerHTML=`${u} ${s}`}const Vt={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},Zt=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function ks(a){if(a){if(typeof a=="number"){const t=Math.round(Math.sqrt(.5*Math.pow(a,2)));return{center:new l.pointGeometry(0,0),top:new l.pointGeometry(0,a),"top-left":new l.pointGeometry(t,t),"top-right":new l.pointGeometry(-t,t),bottom:new l.pointGeometry(0,-a),"bottom-left":new l.pointGeometry(t,-t),"bottom-right":new l.pointGeometry(-t,-t),left:new l.pointGeometry(a,0),right:new l.pointGeometry(-a,0)}}if(a instanceof l.pointGeometry||Array.isArray(a)){const t=l.pointGeometry.convert(a);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:l.pointGeometry.convert(a.center||[0,0]),top:l.pointGeometry.convert(a.top||[0,0]),"top-left":l.pointGeometry.convert(a["top-left"]||[0,0]),"top-right":l.pointGeometry.convert(a["top-right"]||[0,0]),bottom:l.pointGeometry.convert(a.bottom||[0,0]),"bottom-left":l.pointGeometry.convert(a["bottom-left"]||[0,0]),"bottom-right":l.pointGeometry.convert(a["bottom-right"]||[0,0]),left:l.pointGeometry.convert(a.left||[0,0]),right:l.pointGeometry.convert(a.right||[0,0])}}return ks(new l.pointGeometry(0,0))}const Qr={supported:ve,setRTLTextPlugin:l.setRTLTextPlugin,getRTLTextPluginStatus:l.getRTLTextPluginStatus,Map:class extends Rt{constructor(a){var t;if(l.PerformanceUtils.mark(l.PerformanceMarkers.create),(a=l.extend({},Oa,a)).minZoom!=null&&a.maxZoom!=null&&a.minZoom>a.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(a.minPitch!=null&&a.maxPitch!=null&&a.minPitch>a.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(a.minPitch!=null&&a.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(a.maxPitch!=null&&a.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new ro(a.minZoom,a.maxZoom,a.minPitch,a.maxPitch,a.renderWorldCopies),{bearingSnap:a.bearingSnap}),this._interactive=a.interactive,this._cooperativeGestures=a.cooperativeGestures,this._maxTileCacheSize=a.maxTileCacheSize,this._failIfMajorPerformanceCaveat=a.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=a.preserveDrawingBuffer,this._antialias=a.antialias,this._trackResize=a.trackResize,this._bearingSnap=a.bearingSnap,this._refreshExpiredTiles=a.refreshExpiredTiles,this._fadeDuration=a.fadeDuration,this._crossSourceCollisions=a.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=a.collectResourceTiming,this._renderTaskQueue=new Ba,this._controls=[],this._mapId=l.uniqueId(),this._locale=l.extend({},Fa,a.locale),this._clickTolerance=a.clickTolerance,this._pixelRatio=(t=a.pixelRatio)!==null&&t!==void 0?t:devicePixelRatio,this._requestManager=new gt(a.transformRequest),typeof a.container=="string"){if(this._container=document.getElementById(a.container),!this._container)throw new Error(`Container '${a.container}' not found.`)}else{if(!(a.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=a.container}if(a.maxBounds&&this.setMaxBounds(a.maxBounds),l.bindAll(["_onWindowOnline","_onWindowResize","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._setupPainter(),this.painter===void 0)throw new Error("Failed to initialize WebGL.");this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this.on("terrain",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}),typeof window<"u"&&(addEventListener("online",this._onWindowOnline,!1),addEventListener("resize",this._onWindowResize,!1),addEventListener("orientationchange",this._onWindowResize,!1)),this.handlers=new Ra(this,a),this._cooperativeGestures&&this._setupCooperativeGestures(),this._hash=a.hash&&new Ea(typeof a.hash=="string"&&a.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:a.center,zoom:a.zoom,bearing:a.bearing,pitch:a.pitch}),a.bounds&&(this.resize(),this.fitBounds(a.bounds,l.extend({},a.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=a.localIdeographFontFamily,a.style&&this.setStyle(a.style,{localIdeographFontFamily:a.localIdeographFontFamily}),a.attributionControl&&this.addControl(new ho({customAttribution:a.customAttribution})),a.maplibreLogo&&this.addControl(new Vo,a.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",n=>{this._update(n.dataType==="style"),this.fire(new l.Event(`${n.dataType}data`,n))}),this.on("dataloading",n=>{this.fire(new l.Event(`${n.dataType}dataloading`,n))}),this.on("dataabort",n=>{this.fire(new l.Event("sourcedataabort",n))})}_getMapId(){return this._mapId}addControl(a,t){if(t===void 0&&(t=a.getDefaultPosition?a.getDefaultPosition():"top-right"),!a||!a.onAdd)return this.fire(new l.ErrorEvent(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const n=a.onAdd(this);this._controls.push(a);const s=this._controlPositions[t];return t.indexOf("bottom")!==-1?s.insertBefore(n,s.firstChild):s.appendChild(n),this}removeControl(a){if(!a||!a.onRemove)return this.fire(new l.ErrorEvent(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const t=this._controls.indexOf(a);return t>-1&&this._controls.splice(t,1),a.onRemove(this),this}hasControl(a){return this._controls.indexOf(a)>-1}calculateCameraOptionsFromTo(a,t,n,s){return s==null&&this.style.terrain&&(s=this.transform.getElevation(n,this.style.terrain)),super.calculateCameraOptionsFromTo(a,t,n,s)}resize(a){const t=this._containerDimensions(),n=t[0],s=t[1];this._resizeCanvas(n,s,this.getPixelRatio()),this.transform.resize(n,s),this.painter.resize(n,s,this.getPixelRatio());const u=!this._moving;return u&&(this.stop(),this.fire(new l.Event("movestart",a)).fire(new l.Event("move",a))),this.fire(new l.Event("resize",a)),u&&this.fire(new l.Event("moveend",a)),this}getPixelRatio(){return this._pixelRatio}setPixelRatio(a){const[t,n]=this._containerDimensions();this._pixelRatio=a,this._resizeCanvas(t,n,a),this.painter.resize(t,n,a)}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(a){return this.transform.setMaxBounds(l.LngLatBounds.convert(a)),this._update()}setMinZoom(a){if((a=a==null?-2:a)>=-2&&a<=this.transform.maxZoom)return this.transform.minZoom=a,this._update(),this.getZoom()<a&&this.setZoom(a),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(a){if((a=a==null?22:a)>=this.transform.minZoom)return this.transform.maxZoom=a,this._update(),this.getZoom()>a&&this.setZoom(a),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(a){if((a=a==null?0:a)<0)throw new Error("minPitch must be greater than or equal to 0");if(a>=0&&a<=this.transform.maxPitch)return this.transform.minPitch=a,this._update(),this.getPitch()<a&&this.setPitch(a),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(a){if((a=a==null?60:a)>85)throw new Error("maxPitch must be less than or equal to 85");if(a>=this.transform.minPitch)return this.transform.maxPitch=a,this._update(),this.getPitch()>a&&this.setPitch(a),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(a){return this.transform.renderWorldCopies=a,this._update()}project(a){return this.transform.locationPoint(l.LngLat.convert(a),this.style&&this.style.terrain)}unproject(a){return this.transform.pointLocation(l.pointGeometry.convert(a),this.style&&this.style.terrain)}isMoving(){return this._moving||this.handlers.isMoving()}isZooming(){return this._zooming||this.handlers.isZooming()}isRotating(){return this._rotating||this.handlers.isRotating()}_createDelegatedListener(a,t,n){if(a==="mouseenter"||a==="mouseover"){let s=!1;return{layer:t,listener:n,delegates:{mousemove:d=>{const f=this.getLayer(t)?this.queryRenderedFeatures(d.point,{layers:[t]}):[];f.length?s||(s=!0,n.call(this,new Mi(a,this,d.originalEvent,{features:f}))):s=!1},mouseout:()=>{s=!1}}}}if(a==="mouseleave"||a==="mouseout"){let s=!1;return{layer:t,listener:n,delegates:{mousemove:f=>{(this.getLayer(t)?this.queryRenderedFeatures(f.point,{layers:[t]}):[]).length?s=!0:s&&(s=!1,n.call(this,new Mi(a,this,f.originalEvent)))},mouseout:f=>{s&&(s=!1,n.call(this,new Mi(a,this,f.originalEvent)))}}}}{const s=u=>{const d=this.getLayer(t)?this.queryRenderedFeatures(u.point,{layers:[t]}):[];d.length&&(u.features=d,n.call(this,u),delete u.features)};return{layer:t,listener:n,delegates:{[a]:s}}}}on(a,t,n){if(n===void 0)return super.on(a,t);const s=this._createDelegatedListener(a,t,n);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[a]=this._delegatedListeners[a]||[],this._delegatedListeners[a].push(s);for(const u in s.delegates)this.on(u,s.delegates[u]);return this}once(a,t,n){if(n===void 0)return super.once(a,t);const s=this._createDelegatedListener(a,t,n);for(const u in s.delegates)this.once(u,s.delegates[u]);return this}off(a,t,n){return n===void 0?super.off(a,t):(this._delegatedListeners&&this._delegatedListeners[a]&&(s=>{const u=this._delegatedListeners[a];for(let d=0;d<u.length;d++){const f=u[d];if(f.layer===t&&f.listener===n){for(const _ in f.delegates)this.off(_,f.delegates[_]);return u.splice(d,1),this}}})(),this)}queryRenderedFeatures(a,t){if(!this.style)return[];let n;if(t!==void 0||a===void 0||a instanceof l.pointGeometry||Array.isArray(a)||(t=a,a=void 0),t=t||{},(a=a||[[0,0],[this.transform.width,this.transform.height]])instanceof l.pointGeometry||typeof a[0]=="number")n=[l.pointGeometry.convert(a)];else{const s=l.pointGeometry.convert(a[0]),u=l.pointGeometry.convert(a[1]);n=[s,new l.pointGeometry(u.x,s.y),u,new l.pointGeometry(s.x,u.y),s]}return this.style.queryRenderedFeatures(n,t,this.transform)}querySourceFeatures(a,t){return this.style.querySourceFeatures(a,t)}setStyle(a,t){return(t=l.extend({},{localIdeographFontFamily:this._localIdeographFontFamily},t)).diff!==!1&&t.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&a?(this._diffStyle(a,t),this):(this._localIdeographFontFamily=t.localIdeographFontFamily,this._updateStyle(a,t))}setTransformRequest(a){return this._requestManager.setTransformRequest(a),this}_getUIString(a){const t=this._locale[a];if(t==null)throw new Error(`Missing UI string '${a}'`);return t}_updateStyle(a,t){return this.style&&(this.style.setEventedParent(null),this.style._remove()),a?(this.style=new li(this,t||{}),this.style.setEventedParent(this,{style:this.style}),typeof a=="string"?this.style.loadURL(a):this.style.loadJSON(a),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new li(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(a,t){if(typeof a=="string"){const n=this._requestManager.transformRequest(a,l.ResourceType.Style);l.getJSON(n,(s,u)=>{s?this.fire(new l.ErrorEvent(s)):u&&this._updateDiff(u,t)})}else typeof a=="object"&&this._updateDiff(a,t)}_updateDiff(a,t){try{this.style.setState(a)&&this._update(!0)}catch(n){l.warnOnce(`Unable to perform style diff: ${n.message||n.error||n}. Rebuilding the style from scratch.`),this._updateStyle(a,t)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():l.warnOnce("There is no style added to the map.")}addSource(a,t){return this._lazyInitEmptyStyle(),this.style.addSource(a,t),this._update(!0)}isSourceLoaded(a){const t=this.style&&this.style.sourceCaches[a];if(t!==void 0)return t.loaded();this.fire(new l.ErrorEvent(new Error(`There is no source with ID '${a}'`)))}setTerrain(a){return this.style.setTerrain(a),this}getTerrain(){return this.style.terrain&&this.style.terrain.options}areTilesLoaded(){const a=this.style&&this.style.sourceCaches;for(const t in a){const n=a[t]._tiles;for(const s in n){const u=n[s];if(u.state!=="loaded"&&u.state!=="errored")return!1}}return!0}addSourceType(a,t,n){return this._lazyInitEmptyStyle(),this.style.addSourceType(a,t,n)}removeSource(a){return this.style.removeSource(a),this._update(!0)}getSource(a){return this.style.getSource(a)}addImage(a,t,{pixelRatio:n=1,sdf:s=!1,stretchX:u,stretchY:d,content:f}={}){if(this._lazyInitEmptyStyle(),t instanceof HTMLImageElement||l.isImageBitmap(t)){const{width:_,height:y,data:v}=l.exported.getImageData(t);this.style.addImage(a,{data:new l.RGBAImage({width:_,height:y},v),pixelRatio:n,stretchX:u,stretchY:d,content:f,sdf:s,version:0})}else{if(t.width===void 0||t.height===void 0)return this.fire(new l.ErrorEvent(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{const{width:_,height:y,data:v}=t,T=t;this.style.addImage(a,{data:new l.RGBAImage({width:_,height:y},new Uint8Array(v)),pixelRatio:n,stretchX:u,stretchY:d,content:f,sdf:s,version:0,userImage:T}),T.onAdd&&T.onAdd(this,a)}}}updateImage(a,t){const n=this.style.getImage(a);if(!n)return this.fire(new l.ErrorEvent(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const s=t instanceof HTMLImageElement||l.isImageBitmap(t)?l.exported.getImageData(t):t,{width:u,height:d,data:f}=s;if(u===void 0||d===void 0)return this.fire(new l.ErrorEvent(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(u!==n.data.width||d!==n.data.height)return this.fire(new l.ErrorEvent(new Error("The width and height of the updated image must be that same as the previous version of the image")));const _=!(t instanceof HTMLImageElement||l.isImageBitmap(t));n.data.replace(f,_),this.style.updateImage(a,n)}hasImage(a){return a?!!this.style.getImage(a):(this.fire(new l.ErrorEvent(new Error("Missing required image id"))),!1)}removeImage(a){this.style.removeImage(a)}loadImage(a,t){l.getImage(this._requestManager.transformRequest(a,l.ResourceType.Image),t)}listImages(){return this.style.listImages()}addLayer(a,t){return this._lazyInitEmptyStyle(),this.style.addLayer(a,t),this._update(!0)}moveLayer(a,t){return this.style.moveLayer(a,t),this._update(!0)}removeLayer(a){return this.style.removeLayer(a),this._update(!0)}getLayer(a){return this.style.getLayer(a)}setLayerZoomRange(a,t,n){return this.style.setLayerZoomRange(a,t,n),this._update(!0)}setFilter(a,t,n={}){return this.style.setFilter(a,t,n),this._update(!0)}getFilter(a){return this.style.getFilter(a)}setPaintProperty(a,t,n,s={}){return this.style.setPaintProperty(a,t,n,s),this._update(!0)}getPaintProperty(a,t){return this.style.getPaintProperty(a,t)}setLayoutProperty(a,t,n,s={}){return this.style.setLayoutProperty(a,t,n,s),this._update(!0)}getLayoutProperty(a,t){return this.style.getLayoutProperty(a,t)}setLight(a,t={}){return this._lazyInitEmptyStyle(),this.style.setLight(a,t),this._update(!0)}getLight(){return this.style.getLight()}setFeatureState(a,t){return this.style.setFeatureState(a,t),this._update()}removeFeatureState(a,t){return this.style.removeFeatureState(a,t),this._update()}getFeatureState(a){return this.style.getFeatureState(a)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let a=0,t=0;return this._container&&(a=this._container.clientWidth||400,t=this._container.clientHeight||300),[a,t]}_setupContainer(){const a=this._container;a.classList.add("maplibregl-map","mapboxgl-map");const t=this._canvasContainer=se.create("div","maplibregl-canvas-container mapboxgl-canvas-container",a);this._interactive&&t.classList.add("maplibregl-interactive","mapboxgl-interactive"),this._canvas=se.create("canvas","maplibregl-canvas mapboxgl-canvas",t),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label","Map"),this._canvas.setAttribute("role","region");const n=this._containerDimensions();this._resizeCanvas(n[0],n[1],this.getPixelRatio());const s=this._controlContainer=se.create("div","maplibregl-control-container mapboxgl-control-container",a),u=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(d=>{u[d]=se.create("div",`maplibregl-ctrl-${d} mapboxgl-ctrl-${d}`,s)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_setupCooperativeGestures(){const a=this._container;this._metaPress=!1,this._cooperativeGesturesScreen=se.create("div","maplibregl-cooperative-gesture-screen",a);let t="Control",n=typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.windowsHelpText?this._cooperativeGestures.windowsHelpText:"Use Ctrl + scroll to zoom the map";navigator.platform.indexOf("Mac")===0&&(n=typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.macHelpText?this._cooperativeGestures.macHelpText:"Use \u2318 + scroll to zoom the map",t="Meta"),this._cooperativeGesturesScreen.innerHTML=`
|
|
576
|
+
`),ne=y.createShader(y.FRAGMENT_SHADER);if(y.isContextLost())return void(this.failedToCreate=!0);y.shaderSource(ne,te),y.compileShader(ne),y.attachShader(this.program,ne);const ie=y.createShader(y.VERTEX_SHADER);if(y.isContextLost())return void(this.failedToCreate=!0);y.shaderSource(ie,O),y.compileShader(ie),y.attachShader(this.program,ie),this.attributes={};const ue={};this.numAttributes=I.length;for(let he=0;he<this.numAttributes;he++)I[he]&&(y.bindAttribLocation(this.program,he,I[he]),this.attributes[I[he]]=he);y.linkProgram(this.program),y.deleteShader(ie),y.deleteShader(ne);for(let he=0;he<X.length;he++){const ye=X[he];if(ye&&!ue[ye]){const ce=y.getUniformLocation(this.program,ye);ce&&(ue[ye]=ce)}}this.fixedUniforms=p(t,ue),this.terrainUniforms=((he,ye)=>({u_depth:new l.Uniform1i(he,ye.u_depth),u_terrain:new l.Uniform1i(he,ye.u_terrain),u_terrain_dim:new l.Uniform1f(he,ye.u_terrain_dim),u_terrain_matrix:new l.UniformMatrix4f(he,ye.u_terrain_matrix),u_terrain_unpack:new l.Uniform4f(he,ye.u_terrain_unpack),u_terrain_offset:new l.Uniform1f(he,ye.u_terrain_offset),u_terrain_exaggeration:new l.Uniform1f(he,ye.u_terrain_exaggeration)}))(t,ue),this.binderUniforms=u?u.getUniforms(t,ue):[]}draw(t,n,s,u,p,f,_,y,v,T,I,C,F,R,B,X,J,te){const O=t.gl;if(this.failedToCreate)return;if(t.program.set(this.program),t.setDepthMode(s),t.setStencilMode(u),t.setColorMode(p),t.setCullFace(f),y){t.activeTexture.set(O.TEXTURE2),O.bindTexture(O.TEXTURE_2D,y.depthTexture),t.activeTexture.set(O.TEXTURE3),O.bindTexture(O.TEXTURE_2D,y.texture);for(const ie in this.terrainUniforms)this.terrainUniforms[ie].set(y[ie])}for(const ie in this.fixedUniforms)this.fixedUniforms[ie].set(_[ie]);B&&B.setUniforms(t,this.binderUniforms,F,{zoom:R});let ne=0;switch(n){case O.LINES:ne=2;break;case O.TRIANGLES:ne=3;break;case O.LINE_STRIP:ne=1}for(const ie of C.get()){const ue=ie.vaos||(ie.vaos={});(ue[v]||(ue[v]=new ts)).bind(t,this,T,B?B.getPaintVertexBuffers():[],I,ie.vertexOffset,X,J,te),O.drawElements(n,ie.primitiveLength*ne,O.UNSIGNED_SHORT,ie.primitiveOffset*ne*2)}}}function ra(a,t,n){const s=1/qt(n,1,t.transform.tileZoom),u=Math.pow(2,n.tileID.overscaledZ),p=n.tileSize*Math.pow(2,t.transform.tileZoom)/u,f=p*(n.tileID.canonical.x+n.tileID.wrap*u),_=p*n.tileID.canonical.y;return{u_image:0,u_texsize:n.imageAtlasTexture.size,u_scale:[s,a.fromScale,a.toScale],u_fade:a.t,u_pixel_coord_upper:[f>>16,_>>16],u_pixel_coord_lower:[65535&f,65535&_]}}const rs=(a,t,n,s)=>{const u=t.style.light,p=u.properties.get("position"),f=[p.x,p.y,p.z],_=l.create$1();u.properties.get("anchor")==="viewport"&&l.fromRotation(_,-t.transform.angle),l.transformMat3(f,f,_);const y=u.properties.get("color");return{u_matrix:a,u_lightpos:f,u_lightintensity:u.properties.get("intensity"),u_lightcolor:[y.r,y.g,y.b],u_vertical_gradient:+n,u_opacity:s}},fl=(a,t,n,s,u,p,f)=>l.extend(rs(a,t,n,s),ra(p,t,f),{u_height_factor:-Math.pow(2,u.overscaledZ)/f.tileSize/8}),To=a=>({u_matrix:a}),ns=(a,t,n,s)=>l.extend(To(a),ra(n,t,s)),na=(a,t)=>({u_matrix:a,u_world:t}),oa=(a,t,n,s,u)=>l.extend(ns(a,t,n,s),{u_world:u}),sa=(a,t,n,s)=>{const u=a.transform;let p,f;if(s.paint.get("circle-pitch-alignment")==="map"){const _=qt(n,1,u.zoom);p=!0,f=[_,_]}else p=!1,f=u.pixelsToGLUnits;return{u_camera_to_center_distance:u.cameraToCenterDistance,u_scale_with_map:+(s.paint.get("circle-pitch-scale")==="map"),u_matrix:a.translatePosMatrix(t.posMatrix,n,s.paint.get("circle-translate"),s.paint.get("circle-translate-anchor")),u_pitch_with_map:+p,u_device_pixel_ratio:a.pixelRatio,u_extrude_scale:f}},Hr=(a,t,n)=>{const s=qt(n,1,t.zoom),u=Math.pow(2,t.zoom-n.tileID.overscaledZ),p=n.tileID.overscaleFactor();return{u_matrix:a,u_camera_to_center_distance:t.cameraToCenterDistance,u_pixels_to_tile_units:s,u_extrude_scale:[t.pixelsToGLUnits[0]/(s*u),t.pixelsToGLUnits[1]/(s*u)],u_overscale_factor:p}},Zn=(a,t,n=1)=>({u_matrix:a,u_color:t,u_overlay:0,u_overlay_scale:n}),wn=a=>({u_matrix:a}),Eo=(a,t,n,s)=>({u_matrix:a,u_extrude_scale:qt(t,1,n),u_intensity:s});function So(a,t){const n=Math.pow(2,t.canonical.z),s=t.canonical.y;return[new l.MercatorCoordinate(0,s/n).toLngLat().lat,new l.MercatorCoordinate(0,(s+1)/n).toLngLat().lat]}const Tn=(a,t,n,s)=>{const u=a.transform;return{u_matrix:Xn(a,t,n,s),u_ratio:1/qt(t,1,u.zoom),u_device_pixel_ratio:a.pixelRatio,u_units_to_pixels:[1/u.pixelsToGLUnits[0],1/u.pixelsToGLUnits[1]]}},os=(a,t,n,s,u)=>l.extend(Tn(a,t,n,u),{u_image:0,u_image_height:s}),Io=(a,t,n,s,u)=>{const p=a.transform,f=Dt(t,p);return{u_matrix:Xn(a,t,n,u),u_texsize:t.imageAtlasTexture.size,u_ratio:1/qt(t,1,p.zoom),u_device_pixel_ratio:a.pixelRatio,u_image:0,u_scale:[f,s.fromScale,s.toScale],u_fade:s.t,u_units_to_pixels:[1/p.pixelsToGLUnits[0],1/p.pixelsToGLUnits[1]]}},jn=(a,t,n,s,u,p)=>{const f=a.lineAtlas,_=Dt(t,a.transform),y=n.layout.get("line-cap")==="round",v=f.getDash(s.from,y),T=f.getDash(s.to,y),I=v.width*u.fromScale,C=T.width*u.toScale;return l.extend(Tn(a,t,n,p),{u_patternscale_a:[_/I,-v.height/2],u_patternscale_b:[_/C,-T.height/2],u_sdfgamma:f.width/(256*Math.min(I,C)*a.pixelRatio)/2,u_image:0,u_tex_y_a:v.y,u_tex_y_b:T.y,u_mix:u.t})};function Dt(a,t){return 1/qt(a,1,t.tileZoom)}function Xn(a,t,n,s){return a.translatePosMatrix(s?s.posMatrix:t.tileID.posMatrix,t,n.paint.get("line-translate"),n.paint.get("line-translate-anchor"))}const aa=(a,t,n,s,u)=>{return{u_matrix:a,u_tl_parent:t,u_scale_parent:n,u_buffer_scale:1,u_fade_t:s.mix,u_opacity:s.opacity*u.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:u.paint.get("raster-brightness-min"),u_brightness_high:u.paint.get("raster-brightness-max"),u_saturation_factor:(f=u.paint.get("raster-saturation"),f>0?1-1/(1.001-f):-f),u_contrast_factor:(p=u.paint.get("raster-contrast"),p>0?1/(1-p):1+p),u_spin_weights:la(u.paint.get("raster-hue-rotate"))};var p,f};function la(a){a*=Math.PI/180;const t=Math.sin(a),n=Math.cos(a);return[(2*n+1)/3,(-Math.sqrt(3)*t-n+1)/3,(Math.sqrt(3)*t-n+1)/3]}const ss=(a,t,n,s,u,p,f,_,y,v)=>{const T=u.transform;return{u_is_size_zoom_constant:+(a==="constant"||a==="source"),u_is_size_feature_constant:+(a==="constant"||a==="camera"),u_size_t:t?t.uSizeT:0,u_size:t?t.uSize:0,u_camera_to_center_distance:T.cameraToCenterDistance,u_pitch:T.pitch/360*2*Math.PI,u_rotate_symbol:+n,u_aspect_ratio:T.width/T.height,u_fade_change:u.options.fadeDuration?u.symbolFadeChange:1,u_matrix:p,u_label_plane_matrix:f,u_coord_matrix:_,u_is_text:+y,u_pitch_with_map:+s,u_texsize:v,u_texture:0}},Ao=(a,t,n,s,u,p,f,_,y,v,T)=>{const I=u.transform;return l.extend(ss(a,t,n,s,u,p,f,_,y,v),{u_gamma_scale:s?Math.cos(I._pitch)*I.cameraToCenterDistance:1,u_device_pixel_ratio:u.pixelRatio,u_is_halo:+T})},ca=(a,t,n,s,u,p,f,_,y,v)=>l.extend(Ao(a,t,n,s,u,p,f,_,!0,y,!0),{u_texsize_icon:v,u_texture_icon:1}),ml=(a,t,n)=>({u_matrix:a,u_opacity:t,u_color:n}),gl=(a,t,n,s,u,p)=>l.extend(function(f,_,y,v){const T=y.imageManager.getPattern(f.from.toString()),I=y.imageManager.getPattern(f.to.toString()),{width:C,height:F}=y.imageManager.getPixelSize(),R=Math.pow(2,v.tileID.overscaledZ),B=v.tileSize*Math.pow(2,y.transform.tileZoom)/R,X=B*(v.tileID.canonical.x+v.tileID.wrap*R),J=B*v.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:T.tl,u_pattern_br_a:T.br,u_pattern_tl_b:I.tl,u_pattern_br_b:I.br,u_texsize:[C,F],u_mix:_.t,u_pattern_size_a:T.displaySize,u_pattern_size_b:I.displaySize,u_scale_a:_.fromScale,u_scale_b:_.toScale,u_tile_units_to_pixels:1/qt(v,1,y.transform.tileZoom),u_pixel_coord_upper:[X>>16,J>>16],u_pixel_coord_lower:[65535&X,65535&J]}}(s,p,n,u),{u_matrix:a,u_opacity:t}),as={fillExtrusion:(a,t)=>({u_matrix:new l.UniformMatrix4f(a,t.u_matrix),u_lightpos:new l.Uniform3f(a,t.u_lightpos),u_lightintensity:new l.Uniform1f(a,t.u_lightintensity),u_lightcolor:new l.Uniform3f(a,t.u_lightcolor),u_vertical_gradient:new l.Uniform1f(a,t.u_vertical_gradient),u_opacity:new l.Uniform1f(a,t.u_opacity)}),fillExtrusionPattern:(a,t)=>({u_matrix:new l.UniformMatrix4f(a,t.u_matrix),u_lightpos:new l.Uniform3f(a,t.u_lightpos),u_lightintensity:new l.Uniform1f(a,t.u_lightintensity),u_lightcolor:new l.Uniform3f(a,t.u_lightcolor),u_vertical_gradient:new l.Uniform1f(a,t.u_vertical_gradient),u_height_factor:new l.Uniform1f(a,t.u_height_factor),u_image:new l.Uniform1i(a,t.u_image),u_texsize:new l.Uniform2f(a,t.u_texsize),u_pixel_coord_upper:new l.Uniform2f(a,t.u_pixel_coord_upper),u_pixel_coord_lower:new l.Uniform2f(a,t.u_pixel_coord_lower),u_scale:new l.Uniform3f(a,t.u_scale),u_fade:new l.Uniform1f(a,t.u_fade),u_opacity:new l.Uniform1f(a,t.u_opacity)}),fill:(a,t)=>({u_matrix:new l.UniformMatrix4f(a,t.u_matrix)}),fillPattern:(a,t)=>({u_matrix:new l.UniformMatrix4f(a,t.u_matrix),u_image:new l.Uniform1i(a,t.u_image),u_texsize:new l.Uniform2f(a,t.u_texsize),u_pixel_coord_upper:new l.Uniform2f(a,t.u_pixel_coord_upper),u_pixel_coord_lower:new l.Uniform2f(a,t.u_pixel_coord_lower),u_scale:new l.Uniform3f(a,t.u_scale),u_fade:new l.Uniform1f(a,t.u_fade)}),fillOutline:(a,t)=>({u_matrix:new l.UniformMatrix4f(a,t.u_matrix),u_world:new l.Uniform2f(a,t.u_world)}),fillOutlinePattern:(a,t)=>({u_matrix:new l.UniformMatrix4f(a,t.u_matrix),u_world:new l.Uniform2f(a,t.u_world),u_image:new l.Uniform1i(a,t.u_image),u_texsize:new l.Uniform2f(a,t.u_texsize),u_pixel_coord_upper:new l.Uniform2f(a,t.u_pixel_coord_upper),u_pixel_coord_lower:new l.Uniform2f(a,t.u_pixel_coord_lower),u_scale:new l.Uniform3f(a,t.u_scale),u_fade:new l.Uniform1f(a,t.u_fade)}),circle:(a,t)=>({u_camera_to_center_distance:new l.Uniform1f(a,t.u_camera_to_center_distance),u_scale_with_map:new l.Uniform1i(a,t.u_scale_with_map),u_pitch_with_map:new l.Uniform1i(a,t.u_pitch_with_map),u_extrude_scale:new l.Uniform2f(a,t.u_extrude_scale),u_device_pixel_ratio:new l.Uniform1f(a,t.u_device_pixel_ratio),u_matrix:new l.UniformMatrix4f(a,t.u_matrix)}),collisionBox:(a,t)=>({u_matrix:new l.UniformMatrix4f(a,t.u_matrix),u_camera_to_center_distance:new l.Uniform1f(a,t.u_camera_to_center_distance),u_pixels_to_tile_units:new l.Uniform1f(a,t.u_pixels_to_tile_units),u_extrude_scale:new l.Uniform2f(a,t.u_extrude_scale),u_overscale_factor:new l.Uniform1f(a,t.u_overscale_factor)}),collisionCircle:(a,t)=>({u_matrix:new l.UniformMatrix4f(a,t.u_matrix),u_inv_matrix:new l.UniformMatrix4f(a,t.u_inv_matrix),u_camera_to_center_distance:new l.Uniform1f(a,t.u_camera_to_center_distance),u_viewport_size:new l.Uniform2f(a,t.u_viewport_size)}),debug:(a,t)=>({u_color:new l.UniformColor(a,t.u_color),u_matrix:new l.UniformMatrix4f(a,t.u_matrix),u_overlay:new l.Uniform1i(a,t.u_overlay),u_overlay_scale:new l.Uniform1f(a,t.u_overlay_scale)}),clippingMask:(a,t)=>({u_matrix:new l.UniformMatrix4f(a,t.u_matrix)}),heatmap:(a,t)=>({u_extrude_scale:new l.Uniform1f(a,t.u_extrude_scale),u_intensity:new l.Uniform1f(a,t.u_intensity),u_matrix:new l.UniformMatrix4f(a,t.u_matrix)}),heatmapTexture:(a,t)=>({u_matrix:new l.UniformMatrix4f(a,t.u_matrix),u_world:new l.Uniform2f(a,t.u_world),u_image:new l.Uniform1i(a,t.u_image),u_color_ramp:new l.Uniform1i(a,t.u_color_ramp),u_opacity:new l.Uniform1f(a,t.u_opacity)}),hillshade:(a,t)=>({u_matrix:new l.UniformMatrix4f(a,t.u_matrix),u_image:new l.Uniform1i(a,t.u_image),u_latrange:new l.Uniform2f(a,t.u_latrange),u_light:new l.Uniform2f(a,t.u_light),u_shadow:new l.UniformColor(a,t.u_shadow),u_highlight:new l.UniformColor(a,t.u_highlight),u_accent:new l.UniformColor(a,t.u_accent)}),hillshadePrepare:(a,t)=>({u_matrix:new l.UniformMatrix4f(a,t.u_matrix),u_image:new l.Uniform1i(a,t.u_image),u_dimension:new l.Uniform2f(a,t.u_dimension),u_zoom:new l.Uniform1f(a,t.u_zoom),u_unpack:new l.Uniform4f(a,t.u_unpack)}),line:(a,t)=>({u_matrix:new l.UniformMatrix4f(a,t.u_matrix),u_ratio:new l.Uniform1f(a,t.u_ratio),u_device_pixel_ratio:new l.Uniform1f(a,t.u_device_pixel_ratio),u_units_to_pixels:new l.Uniform2f(a,t.u_units_to_pixels)}),lineGradient:(a,t)=>({u_matrix:new l.UniformMatrix4f(a,t.u_matrix),u_ratio:new l.Uniform1f(a,t.u_ratio),u_device_pixel_ratio:new l.Uniform1f(a,t.u_device_pixel_ratio),u_units_to_pixels:new l.Uniform2f(a,t.u_units_to_pixels),u_image:new l.Uniform1i(a,t.u_image),u_image_height:new l.Uniform1f(a,t.u_image_height)}),linePattern:(a,t)=>({u_matrix:new l.UniformMatrix4f(a,t.u_matrix),u_texsize:new l.Uniform2f(a,t.u_texsize),u_ratio:new l.Uniform1f(a,t.u_ratio),u_device_pixel_ratio:new l.Uniform1f(a,t.u_device_pixel_ratio),u_image:new l.Uniform1i(a,t.u_image),u_units_to_pixels:new l.Uniform2f(a,t.u_units_to_pixels),u_scale:new l.Uniform3f(a,t.u_scale),u_fade:new l.Uniform1f(a,t.u_fade)}),lineSDF:(a,t)=>({u_matrix:new l.UniformMatrix4f(a,t.u_matrix),u_ratio:new l.Uniform1f(a,t.u_ratio),u_device_pixel_ratio:new l.Uniform1f(a,t.u_device_pixel_ratio),u_units_to_pixels:new l.Uniform2f(a,t.u_units_to_pixels),u_patternscale_a:new l.Uniform2f(a,t.u_patternscale_a),u_patternscale_b:new l.Uniform2f(a,t.u_patternscale_b),u_sdfgamma:new l.Uniform1f(a,t.u_sdfgamma),u_image:new l.Uniform1i(a,t.u_image),u_tex_y_a:new l.Uniform1f(a,t.u_tex_y_a),u_tex_y_b:new l.Uniform1f(a,t.u_tex_y_b),u_mix:new l.Uniform1f(a,t.u_mix)}),raster:(a,t)=>({u_matrix:new l.UniformMatrix4f(a,t.u_matrix),u_tl_parent:new l.Uniform2f(a,t.u_tl_parent),u_scale_parent:new l.Uniform1f(a,t.u_scale_parent),u_buffer_scale:new l.Uniform1f(a,t.u_buffer_scale),u_fade_t:new l.Uniform1f(a,t.u_fade_t),u_opacity:new l.Uniform1f(a,t.u_opacity),u_image0:new l.Uniform1i(a,t.u_image0),u_image1:new l.Uniform1i(a,t.u_image1),u_brightness_low:new l.Uniform1f(a,t.u_brightness_low),u_brightness_high:new l.Uniform1f(a,t.u_brightness_high),u_saturation_factor:new l.Uniform1f(a,t.u_saturation_factor),u_contrast_factor:new l.Uniform1f(a,t.u_contrast_factor),u_spin_weights:new l.Uniform3f(a,t.u_spin_weights)}),symbolIcon:(a,t)=>({u_is_size_zoom_constant:new l.Uniform1i(a,t.u_is_size_zoom_constant),u_is_size_feature_constant:new l.Uniform1i(a,t.u_is_size_feature_constant),u_size_t:new l.Uniform1f(a,t.u_size_t),u_size:new l.Uniform1f(a,t.u_size),u_camera_to_center_distance:new l.Uniform1f(a,t.u_camera_to_center_distance),u_pitch:new l.Uniform1f(a,t.u_pitch),u_rotate_symbol:new l.Uniform1i(a,t.u_rotate_symbol),u_aspect_ratio:new l.Uniform1f(a,t.u_aspect_ratio),u_fade_change:new l.Uniform1f(a,t.u_fade_change),u_matrix:new l.UniformMatrix4f(a,t.u_matrix),u_label_plane_matrix:new l.UniformMatrix4f(a,t.u_label_plane_matrix),u_coord_matrix:new l.UniformMatrix4f(a,t.u_coord_matrix),u_is_text:new l.Uniform1i(a,t.u_is_text),u_pitch_with_map:new l.Uniform1i(a,t.u_pitch_with_map),u_texsize:new l.Uniform2f(a,t.u_texsize),u_texture:new l.Uniform1i(a,t.u_texture)}),symbolSDF:(a,t)=>({u_is_size_zoom_constant:new l.Uniform1i(a,t.u_is_size_zoom_constant),u_is_size_feature_constant:new l.Uniform1i(a,t.u_is_size_feature_constant),u_size_t:new l.Uniform1f(a,t.u_size_t),u_size:new l.Uniform1f(a,t.u_size),u_camera_to_center_distance:new l.Uniform1f(a,t.u_camera_to_center_distance),u_pitch:new l.Uniform1f(a,t.u_pitch),u_rotate_symbol:new l.Uniform1i(a,t.u_rotate_symbol),u_aspect_ratio:new l.Uniform1f(a,t.u_aspect_ratio),u_fade_change:new l.Uniform1f(a,t.u_fade_change),u_matrix:new l.UniformMatrix4f(a,t.u_matrix),u_label_plane_matrix:new l.UniformMatrix4f(a,t.u_label_plane_matrix),u_coord_matrix:new l.UniformMatrix4f(a,t.u_coord_matrix),u_is_text:new l.Uniform1i(a,t.u_is_text),u_pitch_with_map:new l.Uniform1i(a,t.u_pitch_with_map),u_texsize:new l.Uniform2f(a,t.u_texsize),u_texture:new l.Uniform1i(a,t.u_texture),u_gamma_scale:new l.Uniform1f(a,t.u_gamma_scale),u_device_pixel_ratio:new l.Uniform1f(a,t.u_device_pixel_ratio),u_is_halo:new l.Uniform1i(a,t.u_is_halo)}),symbolTextAndIcon:(a,t)=>({u_is_size_zoom_constant:new l.Uniform1i(a,t.u_is_size_zoom_constant),u_is_size_feature_constant:new l.Uniform1i(a,t.u_is_size_feature_constant),u_size_t:new l.Uniform1f(a,t.u_size_t),u_size:new l.Uniform1f(a,t.u_size),u_camera_to_center_distance:new l.Uniform1f(a,t.u_camera_to_center_distance),u_pitch:new l.Uniform1f(a,t.u_pitch),u_rotate_symbol:new l.Uniform1i(a,t.u_rotate_symbol),u_aspect_ratio:new l.Uniform1f(a,t.u_aspect_ratio),u_fade_change:new l.Uniform1f(a,t.u_fade_change),u_matrix:new l.UniformMatrix4f(a,t.u_matrix),u_label_plane_matrix:new l.UniformMatrix4f(a,t.u_label_plane_matrix),u_coord_matrix:new l.UniformMatrix4f(a,t.u_coord_matrix),u_is_text:new l.Uniform1i(a,t.u_is_text),u_pitch_with_map:new l.Uniform1i(a,t.u_pitch_with_map),u_texsize:new l.Uniform2f(a,t.u_texsize),u_texsize_icon:new l.Uniform2f(a,t.u_texsize_icon),u_texture:new l.Uniform1i(a,t.u_texture),u_texture_icon:new l.Uniform1i(a,t.u_texture_icon),u_gamma_scale:new l.Uniform1f(a,t.u_gamma_scale),u_device_pixel_ratio:new l.Uniform1f(a,t.u_device_pixel_ratio),u_is_halo:new l.Uniform1i(a,t.u_is_halo)}),background:(a,t)=>({u_matrix:new l.UniformMatrix4f(a,t.u_matrix),u_opacity:new l.Uniform1f(a,t.u_opacity),u_color:new l.UniformColor(a,t.u_color)}),backgroundPattern:(a,t)=>({u_matrix:new l.UniformMatrix4f(a,t.u_matrix),u_opacity:new l.Uniform1f(a,t.u_opacity),u_image:new l.Uniform1i(a,t.u_image),u_pattern_tl_a:new l.Uniform2f(a,t.u_pattern_tl_a),u_pattern_br_a:new l.Uniform2f(a,t.u_pattern_br_a),u_pattern_tl_b:new l.Uniform2f(a,t.u_pattern_tl_b),u_pattern_br_b:new l.Uniform2f(a,t.u_pattern_br_b),u_texsize:new l.Uniform2f(a,t.u_texsize),u_mix:new l.Uniform1f(a,t.u_mix),u_pattern_size_a:new l.Uniform2f(a,t.u_pattern_size_a),u_pattern_size_b:new l.Uniform2f(a,t.u_pattern_size_b),u_scale_a:new l.Uniform1f(a,t.u_scale_a),u_scale_b:new l.Uniform1f(a,t.u_scale_b),u_pixel_coord_upper:new l.Uniform2f(a,t.u_pixel_coord_upper),u_pixel_coord_lower:new l.Uniform2f(a,t.u_pixel_coord_lower),u_tile_units_to_pixels:new l.Uniform1f(a,t.u_tile_units_to_pixels)}),terrain:(a,t)=>({u_matrix:new l.UniformMatrix4f(a,t.u_matrix),u_texture:new l.Uniform1i(a,t.u_texture)}),terrainDepth:(a,t)=>({u_matrix:new l.UniformMatrix4f(a,t.u_matrix)}),terrainCoords:(a,t)=>({u_matrix:new l.UniformMatrix4f(a,t.u_matrix),u_texture:new l.Uniform1i(a,t.u_texture),u_terrain_coords_id:new l.Uniform1f(a,t.u_terrain_coords_id)})};class ls{constructor(t,n,s){this.context=t;const u=t.gl;this.buffer=u.createBuffer(),this.dynamicDraw=Boolean(s),this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),u.bufferData(u.ELEMENT_ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?u.DYNAMIC_DRAW:u.STATIC_DRAW),this.dynamicDraw||delete n.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(t){const n=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),n.bufferSubData(n.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const cs={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class us{constructor(t,n,s,u){this.length=n.length,this.attributes=s,this.itemSize=n.bytesPerElement,this.dynamicDraw=u,this.context=t;const p=t.gl;this.buffer=p.createBuffer(),t.bindVertexBuffer.set(this.buffer),p.bufferData(p.ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?p.DYNAMIC_DRAW:p.STATIC_DRAW),this.dynamicDraw||delete n.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(t){if(t.length!==this.length)throw new Error(`Length of new data is ${t.length}, which doesn't match current length of ${this.length}`);const n=this.context.gl;this.bind(),n.bufferSubData(n.ARRAY_BUFFER,0,t.arrayBuffer)}enableAttributes(t,n){for(let s=0;s<this.attributes.length;s++){const u=n.attributes[this.attributes[s].name];u!==void 0&&t.enableVertexAttribArray(u)}}setVertexAttribPointers(t,n,s){for(let u=0;u<this.attributes.length;u++){const p=this.attributes[u],f=n.attributes[p.name];f!==void 0&&t.vertexAttribPointer(f,p.components,t[cs[p.type]],!1,this.itemSize,p.offset+this.itemSize*(s||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class _t{constructor(t){this.gl=t.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(t){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class ua extends _t{getDefault(){return l.Color.transparent}set(t){const n=this.current;(t.r!==n.r||t.g!==n.g||t.b!==n.b||t.a!==n.a||this.dirty)&&(this.gl.clearColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class _l extends _t{getDefault(){return 1}set(t){(t!==this.current||this.dirty)&&(this.gl.clearDepth(t),this.current=t,this.dirty=!1)}}class Wn extends _t{getDefault(){return 0}set(t){(t!==this.current||this.dirty)&&(this.gl.clearStencil(t),this.current=t,this.dirty=!1)}}class Hn extends _t{getDefault(){return[!0,!0,!0,!0]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||t[2]!==n[2]||t[3]!==n[3]||this.dirty)&&(this.gl.colorMask(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class ha extends _t{getDefault(){return!0}set(t){(t!==this.current||this.dirty)&&(this.gl.depthMask(t),this.current=t,this.dirty=!1)}}class Ci extends _t{getDefault(){return 255}set(t){(t!==this.current||this.dirty)&&(this.gl.stencilMask(t),this.current=t,this.dirty=!1)}}class hs extends _t{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(t){const n=this.current;(t.func!==n.func||t.ref!==n.ref||t.mask!==n.mask||this.dirty)&&(this.gl.stencilFunc(t.func,t.ref,t.mask),this.current=t,this.dirty=!1)}}class Co extends _t{getDefault(){const t=this.gl;return[t.KEEP,t.KEEP,t.KEEP]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||t[2]!==n[2]||this.dirty)&&(this.gl.stencilOp(t[0],t[1],t[2]),this.current=t,this.dirty=!1)}}class Mo extends _t{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.STENCIL_TEST):n.disable(n.STENCIL_TEST),this.current=t,this.dirty=!1}}class ps extends _t{getDefault(){return[0,1]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||this.dirty)&&(this.gl.depthRange(t[0],t[1]),this.current=t,this.dirty=!1)}}class ds extends _t{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.DEPTH_TEST):n.disable(n.DEPTH_TEST),this.current=t,this.dirty=!1}}class zo extends _t{getDefault(){return this.gl.LESS}set(t){(t!==this.current||this.dirty)&&(this.gl.depthFunc(t),this.current=t,this.dirty=!1)}}class fs extends _t{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.BLEND):n.disable(n.BLEND),this.current=t,this.dirty=!1}}class ms extends _t{getDefault(){const t=this.gl;return[t.ONE,t.ZERO]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||this.dirty)&&(this.gl.blendFunc(t[0],t[1]),this.current=t,this.dirty=!1)}}class Po extends _t{getDefault(){return l.Color.transparent}set(t){const n=this.current;(t.r!==n.r||t.g!==n.g||t.b!==n.b||t.a!==n.a||this.dirty)&&(this.gl.blendColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class pa extends _t{getDefault(){return this.gl.FUNC_ADD}set(t){(t!==this.current||this.dirty)&&(this.gl.blendEquation(t),this.current=t,this.dirty=!1)}}class da extends _t{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.CULL_FACE):n.disable(n.CULL_FACE),this.current=t,this.dirty=!1}}class En extends _t{getDefault(){return this.gl.BACK}set(t){(t!==this.current||this.dirty)&&(this.gl.cullFace(t),this.current=t,this.dirty=!1)}}class yl extends _t{getDefault(){return this.gl.CCW}set(t){(t!==this.current||this.dirty)&&(this.gl.frontFace(t),this.current=t,this.dirty=!1)}}class xl extends _t{getDefault(){return null}set(t){(t!==this.current||this.dirty)&&(this.gl.useProgram(t),this.current=t,this.dirty=!1)}}class vl extends _t{getDefault(){return this.gl.TEXTURE0}set(t){(t!==this.current||this.dirty)&&(this.gl.activeTexture(t),this.current=t,this.dirty=!1)}}class bl extends _t{getDefault(){const t=this.gl;return[0,0,t.drawingBufferWidth,t.drawingBufferHeight]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||t[2]!==n[2]||t[3]!==n[3]||this.dirty)&&(this.gl.viewport(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class wl extends _t{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindFramebuffer(n.FRAMEBUFFER,t),this.current=t,this.dirty=!1}}class Tl extends _t{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindRenderbuffer(n.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class gs extends _t{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindTexture(n.TEXTURE_2D,t),this.current=t,this.dirty=!1}}class ko extends _t{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindBuffer(n.ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class _s extends _t{getDefault(){return null}set(t){const n=this.gl;n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class ys extends _t{constructor(t){super(t),this.vao=t.extVertexArrayObject}getDefault(){return null}set(t){this.vao&&(t!==this.current||this.dirty)&&(this.vao.bindVertexArrayOES(t),this.current=t,this.dirty=!1)}}class Sn extends _t{getDefault(){return 4}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.pixelStorei(n.UNPACK_ALIGNMENT,t),this.current=t,this.dirty=!1}}class fa extends _t{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t),this.current=t,this.dirty=!1}}class ma extends _t{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,t),this.current=t,this.dirty=!1}}class Do extends _t{constructor(t,n){super(t),this.context=t,this.parent=n}getDefault(){return null}}class Kr extends Do{setDirty(){this.dirty=!0}set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const n=this.gl;n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,t,0),this.current=t,this.dirty=!1}}class ga extends Do{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const n=this.gl;n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class In{constructor(t,n,s,u){this.context=t,this.width=n,this.height=s;const p=t.gl,f=this.framebuffer=p.createFramebuffer();if(this.colorAttachment=new Kr(t,f),u&&(this.depthAttachment=new ga(t,f)),p.checkFramebufferStatus(p.FRAMEBUFFER)!==p.FRAMEBUFFER_COMPLETE)throw new Error("Framebuffer is not complete")}destroy(){const t=this.context.gl,n=this.colorAttachment.get();if(n&&t.deleteTexture(n),this.depthAttachment){const s=this.depthAttachment.get();s&&t.deleteRenderbuffer(s)}t.deleteFramebuffer(this.framebuffer)}}class zt{constructor(t,n,s){this.blendFunction=t,this.blendColor=n,this.mask=s}}zt.Replace=[1,0],zt.disabled=new zt(zt.Replace,l.Color.transparent,[!1,!1,!1,!1]),zt.unblended=new zt(zt.Replace,l.Color.transparent,[!0,!0,!0,!0]),zt.alphaBlended=new zt([1,771],l.Color.transparent,[!0,!0,!0,!0]);class _a{constructor(t){this.gl=t,this.extVertexArrayObject=this.gl.getExtension("OES_vertex_array_object"),this.clearColor=new ua(this),this.clearDepth=new _l(this),this.clearStencil=new Wn(this),this.colorMask=new Hn(this),this.depthMask=new ha(this),this.stencilMask=new Ci(this),this.stencilFunc=new hs(this),this.stencilOp=new Co(this),this.stencilTest=new Mo(this),this.depthRange=new ps(this),this.depthTest=new ds(this),this.depthFunc=new zo(this),this.blend=new fs(this),this.blendFunc=new ms(this),this.blendColor=new Po(this),this.blendEquation=new pa(this),this.cullFace=new da(this),this.cullFaceSide=new En(this),this.frontFace=new yl(this),this.program=new xl(this),this.activeTexture=new vl(this),this.viewport=new bl(this),this.bindFramebuffer=new wl(this),this.bindRenderbuffer=new Tl(this),this.bindTexture=new gs(this),this.bindVertexBuffer=new ko(this),this.bindElementBuffer=new _s(this),this.bindVertexArrayOES=this.extVertexArrayObject&&new ys(this),this.pixelStoreUnpack=new Sn(this),this.pixelStoreUnpackPremultiplyAlpha=new fa(this),this.pixelStoreUnpackFlipY=new ma(this),this.extTextureFilterAnisotropic=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=t.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.extTextureHalfFloat=t.getExtension("OES_texture_half_float"),this.extTextureHalfFloat&&(t.getExtension("OES_texture_half_float_linear"),this.extRenderToTextureHalfFloat=t.getExtension("EXT_color_buffer_half_float")),this.extTimerQuery=t.getExtension("EXT_disjoint_timer_query"),this.maxTextureSize=t.getParameter(t.MAX_TEXTURE_SIZE)}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.extVertexArrayObject&&(this.bindVertexArrayOES.dirty=!0),this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(t,n){return new ls(this,t,n)}createVertexBuffer(t,n,s){return new us(this,t,n,s)}createRenderbuffer(t,n,s){const u=this.gl,p=u.createRenderbuffer();return this.bindRenderbuffer.set(p),u.renderbufferStorage(u.RENDERBUFFER,t,n,s),this.bindRenderbuffer.set(null),p}createFramebuffer(t,n,s){return new In(this,t,n,s)}clear({color:t,depth:n}){const s=this.gl;let u=0;t&&(u|=s.COLOR_BUFFER_BIT,this.clearColor.set(t),this.colorMask.set([!0,!0,!0,!0])),n!==void 0&&(u|=s.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(n),this.depthMask.set(!0)),s.clear(u)}setCullFace(t){t.enable===!1?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){Te(t.blendFunction,zt.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(t.blendFunction),this.blendColor.set(t.blendColor)),this.colorMask.set(t.mask)}unbindVAO(){this.extVertexArrayObject&&this.bindVertexArrayOES.set(null)}}class at{constructor(t,n,s){this.func=t,this.mask=n,this.range=s}}at.ReadOnly=!1,at.ReadWrite=!0,at.disabled=new at(519,at.ReadOnly,[0,1]);const yt=7680;class Ct{constructor(t,n,s,u,p,f){this.test=t,this.ref=n,this.mask=s,this.fail=u,this.depthFail=p,this.pass=f}}Ct.disabled=new Ct({func:519,mask:0},0,0,yt,yt,yt);class Lt{constructor(t,n,s){this.enable=t,this.mode=n,this.frontFace=s}}let Kn;function An(a,t,n,s,u,p,f){const _=a.context,y=_.gl,v=a.useProgram("collisionBox"),T=[];let I=0,C=0;for(let O=0;O<s.length;O++){const ne=s[O],ie=t.getTile(ne),ue=ie.getBucket(n);if(!ue)continue;let he=ne.posMatrix;u[0]===0&&u[1]===0||(he=a.translatePosMatrix(ne.posMatrix,ie,u,p));const ye=f?ue.textCollisionBox:ue.iconCollisionBox,ce=ue.collisionCircleArray;if(ce.length>0){const Le=l.create(),Ie=he;l.mul(Le,ue.placementInvProjMatrix,a.transform.glCoordMatrix),l.mul(Le,Le,ue.placementViewportMatrix),T.push({circleArray:ce,circleOffset:C,transform:Ie,invTransform:Le,coord:ne}),I+=ce.length/4,C=I}ye&&v.draw(_,y.LINES,at.disabled,Ct.disabled,a.colorModeForRenderPass(),Lt.disabled,Hr(he,a.transform,ie),a.style.terrain&&a.style.terrain.getTerrainData(ne),n.id,ye.layoutVertexBuffer,ye.indexBuffer,ye.segments,null,a.transform.zoom,null,null,ye.collisionVertexBuffer)}if(!f||!T.length)return;const F=a.useProgram("collisionCircle"),R=new l.CollisionCircleLayoutArray;R.resize(4*I),R._trim();let B=0;for(const O of T)for(let ne=0;ne<O.circleArray.length/4;ne++){const ie=4*ne,ue=O.circleArray[ie+0],he=O.circleArray[ie+1],ye=O.circleArray[ie+2],ce=O.circleArray[ie+3];R.emplace(B++,ue,he,ye,ce,0),R.emplace(B++,ue,he,ye,ce,1),R.emplace(B++,ue,he,ye,ce,2),R.emplace(B++,ue,he,ye,ce,3)}(!Kn||Kn.length<2*I)&&(Kn=function(O){const ne=2*O,ie=new l.QuadTriangleArray;ie.resize(ne),ie._trim();for(let ue=0;ue<ne;ue++){const he=6*ue;ie.uint16[he+0]=4*ue+0,ie.uint16[he+1]=4*ue+1,ie.uint16[he+2]=4*ue+2,ie.uint16[he+3]=4*ue+2,ie.uint16[he+4]=4*ue+3,ie.uint16[he+5]=4*ue+0}return ie}(I));const X=_.createIndexBuffer(Kn,!0),J=_.createVertexBuffer(R,l.collisionCircleLayout.members,!0);for(const O of T){const ne={u_matrix:O.transform,u_inv_matrix:O.invTransform,u_camera_to_center_distance:(te=a.transform).cameraToCenterDistance,u_viewport_size:[te.width,te.height]};F.draw(_,y.TRIANGLES,at.disabled,Ct.disabled,a.colorModeForRenderPass(),Lt.disabled,ne,a.style.terrain&&a.style.terrain.getTerrainData(O.coord),n.id,J,X,l.SegmentVector.simpleSegment(0,2*O.circleOffset,O.circleArray.length,O.circleArray.length/2),null,a.transform.zoom,null,null,null)}var te;J.destroy(),X.destroy()}Lt.disabled=new Lt(!1,1029,2305),Lt.backCCW=new Lt(!0,1029,2305);const El=l.identity(new Float32Array(16));function Sl(a,t,n,s,u,p){const{horizontalAlign:f,verticalAlign:_}=l.getAnchorAlignment(a),y=-(f-.5)*t,v=-(_-.5)*n,T=l.evaluateVariableOffset(a,s);return new l.pointGeometry((y/u+T[0])*p,(v/u+T[1])*p)}function ya(a,t,n,s,u,p,f,_,y,v,T){const I=a.text.placedSymbolArray,C=a.text.dynamicLayoutVertexArray,F=a.icon.dynamicLayoutVertexArray,R={};C.clear();for(let B=0;B<I.length;B++){const X=I.get(B),J=a.allowVerticalPlacement&&!X.placedOrientation,te=X.hidden||!X.crossTileID||J?null:s[X.crossTileID];if(te){const O=new l.pointGeometry(X.anchorX,X.anchorY),ne=pt(O,n?f:p,T),ie=Oi(u.cameraToCenterDistance,ne.signedDistanceFromCamera);let ue=l.evaluateSizeForFeature(a.textSizeData,y,X)*ie/l.ONE_EM;n&&(ue*=a.tilePixelRatio/_);const{width:he,height:ye,anchor:ce,textOffset:Le,textBoxScale:Ie}=te,Re=Sl(ce,he,ye,Le,Ie,ue),Qe=n?pt(O.add(Re),p,T).point:ne.point.add(t?Re.rotate(-u.angle):Re),it=a.allowVerticalPlacement&&X.placedOrientation===l.WritingMode.vertical?Math.PI/2:0;for(let Ge=0;Ge<X.numGlyphs;Ge++)l.addDynamicAttributes(C,Qe,it);v&&X.associatedIconIndex>=0&&(R[X.associatedIconIndex]={shiftedAnchor:Qe,angle:it})}else Je(X.numGlyphs,C)}if(v){F.clear();const B=a.icon.placedSymbolArray;for(let X=0;X<B.length;X++){const J=B.get(X);if(J.hidden)Je(J.numGlyphs,F);else{const te=R[X];if(te)for(let O=0;O<J.numGlyphs;O++)l.addDynamicAttributes(F,te.shiftedAnchor,te.angle);else Je(J.numGlyphs,F)}}a.icon.dynamicLayoutVertexBuffer.updateData(F)}a.text.dynamicLayoutVertexBuffer.updateData(C)}function Il(a,t,n){return n.iconsInText&&t?"symbolTextAndIcon":a?"symbolSDF":"symbolIcon"}function Lo(a,t,n,s,u,p,f,_,y,v,T,I){const C=a.context,F=C.gl,R=a.transform,B=_==="map",X=y==="map",J=_!=="viewport"&&n.layout.get("symbol-placement")!=="point",te=B&&!X&&!J,O=!n.layout.get("symbol-sort-key").isConstant();let ne=!1;const ie=a.depthModeForSublayer(0,at.ReadOnly),ue=n.layout.get("text-variable-anchor"),he=[];for(const ye of s){const ce=t.getTile(ye),Le=ce.getBucket(n);if(!Le)continue;const Ie=u?Le.text:Le.icon;if(!Ie||!Ie.segments.get().length)continue;const Re=Ie.programConfigurations.get(n.id),Qe=u||Le.sdfIcons,it=u?Le.textSizeData:Le.iconSizeData,Ge=X||R.pitch!==0,bt=a.useProgram(Il(Qe,u,Le),Re),wt=l.evaluateSizeForZoom(it,R.zoom),ut=a.style.terrain&&a.style.terrain.getTerrainData(ye);let mt,Et,ei,nr,Wi=[0,0],or=null;if(u){if(Et=ce.glyphAtlasTexture,ei=F.LINEAR,mt=ce.glyphAtlasTexture.size,Le.iconsInText){Wi=ce.imageAtlasTexture.size,or=ce.imageAtlasTexture;const Vi=it.kind==="composite"||it.kind==="camera";nr=Ge||a.options.rotating||a.options.zooming||Vi?F.LINEAR:F.NEAREST}}else{const Vi=n.layout.get("icon-size").constantOr(0)!==1||Le.iconsNeedLinear;Et=ce.imageAtlasTexture,ei=Qe||a.options.rotating||a.options.zooming||Vi||Ge?F.LINEAR:F.NEAREST,mt=ce.imageAtlasTexture.size}const $r=qt(ce,1,a.transform.zoom),$i=Zr(ye.posMatrix,X,B,a.transform,$r),bi=ji(ye.posMatrix,X,B,a.transform,$r),xr=ue&&Le.hasTextData(),No=n.layout.get("icon-text-fit")!=="none"&&xr&&Le.hasIconData();if(J){const Vi=a.style.terrain?(Ds,Dn)=>a.style.terrain.getElevation(ye,Ds,Dn):null,en=n.layout.get("text-rotation-alignment")==="map";Ai(Le,ye.posMatrix,a,u,$i,bi,X,v,en,Vi)}const Ht=a.translatePosMatrix(ye.posMatrix,ce,p,f),ot=J||u&&ue||No?El:$i,xt=a.translatePosMatrix(bi,ce,p,f,!0),ti=Qe&&n.paint.get(u?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let ii;ii=Qe?Le.iconsInText?ca(it.kind,wt,te,X,a,Ht,ot,xt,mt,Wi):Ao(it.kind,wt,te,X,a,Ht,ot,xt,u,mt,!0):ss(it.kind,wt,te,X,a,Ht,ot,xt,u,mt);const Bt={program:bt,buffers:Ie,uniformValues:ii,atlasTexture:Et,atlasTextureIcon:or,atlasInterpolation:ei,atlasInterpolationIcon:nr,isSDF:Qe,hasHalo:ti};if(O&&Le.canOverlap){ne=!0;const Vi=Ie.segments.get();for(const en of Vi)he.push({segments:new l.SegmentVector([en]),sortKey:en.sortKey,state:Bt,terrainData:ut})}else he.push({segments:Ie.segments,sortKey:0,state:Bt,terrainData:ut})}ne&&he.sort((ye,ce)=>ye.sortKey-ce.sortKey);for(const ye of he){const ce=ye.state;if(C.activeTexture.set(F.TEXTURE0),ce.atlasTexture.bind(ce.atlasInterpolation,F.CLAMP_TO_EDGE),ce.atlasTextureIcon&&(C.activeTexture.set(F.TEXTURE1),ce.atlasTextureIcon&&ce.atlasTextureIcon.bind(ce.atlasInterpolationIcon,F.CLAMP_TO_EDGE)),ce.isSDF){const Le=ce.uniformValues;ce.hasHalo&&(Le.u_is_halo=1,Jn(ce.buffers,ye.segments,n,a,ce.program,ie,T,I,Le,ye.terrainData)),Le.u_is_halo=0}Jn(ce.buffers,ye.segments,n,a,ce.program,ie,T,I,ce.uniformValues,ye.terrainData)}}function Jn(a,t,n,s,u,p,f,_,y,v){const T=s.context;u.draw(T,T.gl.TRIANGLES,p,f,_,Lt.disabled,y,v,n.id,a.layoutVertexBuffer,a.indexBuffer,t,n.paint,s.transform.zoom,a.programConfigurations.get(n.id),a.dynamicLayoutVertexBuffer,a.opacityVertexBuffer)}function Yn(a,t,n,s,u,p,f){const _=a.context.gl,y=n.paint.get("fill-pattern"),v=y&&y.constantOr(1),T=n.getCrossfadeParameters();let I,C,F,R,B;f?(C=v&&!n.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",I=_.LINES):(C=v?"fillPattern":"fill",I=_.TRIANGLES);for(const X of s){const J=t.getTile(X);if(v&&!J.patternsLoaded())continue;const te=J.getBucket(n);if(!te)continue;const O=te.programConfigurations.get(n.id),ne=a.useProgram(C,O),ie=a.style.terrain&&a.style.terrain.getTerrainData(X);v&&(a.context.activeTexture.set(_.TEXTURE0),J.imageAtlasTexture.bind(_.LINEAR,_.CLAMP_TO_EDGE),O.updatePaintBuffers(T));const ue=y.constantOr(null);if(ue&&J.imageAtlas){const ce=J.imageAtlas,Le=ce.patternPositions[ue.to.toString()],Ie=ce.patternPositions[ue.from.toString()];Le&&Ie&&O.setConstantPatternPositions(Le,Ie)}const he=ie?X:null,ye=a.translatePosMatrix(he?he.posMatrix:X.posMatrix,J,n.paint.get("fill-translate"),n.paint.get("fill-translate-anchor"));if(f){R=te.indexBuffer2,B=te.segments2;const ce=[_.drawingBufferWidth,_.drawingBufferHeight];F=C==="fillOutlinePattern"&&v?oa(ye,a,T,J,ce):na(ye,ce)}else R=te.indexBuffer,B=te.segments,F=v?ns(ye,a,T,J):To(ye);ne.draw(a.context,I,u,a.stencilModeForClipping(X),p,Lt.disabled,F,ie,n.id,te.layoutVertexBuffer,R,B,n.paint,a.transform.zoom,O)}}function Qn(a,t,n,s,u,p,f){const _=a.context,y=_.gl,v=n.paint.get("fill-extrusion-pattern"),T=v.constantOr(1),I=n.getCrossfadeParameters(),C=n.paint.get("fill-extrusion-opacity");for(const F of s){const R=t.getTile(F),B=R.getBucket(n);if(!B)continue;const X=a.style.terrain&&a.style.terrain.getTerrainData(F),J=B.programConfigurations.get(n.id),te=a.useProgram(T?"fillExtrusionPattern":"fillExtrusion",J);T&&(a.context.activeTexture.set(y.TEXTURE0),R.imageAtlasTexture.bind(y.LINEAR,y.CLAMP_TO_EDGE),J.updatePaintBuffers(I));const O=v.constantOr(null);if(O&&R.imageAtlas){const he=R.imageAtlas,ye=he.patternPositions[O.to.toString()],ce=he.patternPositions[O.from.toString()];ye&&ce&&J.setConstantPatternPositions(ye,ce)}const ne=a.translatePosMatrix(F.posMatrix,R,n.paint.get("fill-extrusion-translate"),n.paint.get("fill-extrusion-translate-anchor")),ie=n.paint.get("fill-extrusion-vertical-gradient"),ue=T?fl(ne,a,ie,C,F,I,R):rs(ne,a,ie,C);te.draw(_,_.gl.TRIANGLES,u,p,f,Lt.backCCW,ue,X,n.id,B.layoutVertexBuffer,B.indexBuffer,B.segments,n.paint,a.transform.zoom,J,a.style.terrain&&B.centroidVertexBuffer)}}function xs(a,t,n,s,u,p,f){const _=a.context,y=_.gl,v=n.fbo;if(!v)return;const T=a.useProgram("hillshade"),I=a.style.terrain&&a.style.terrain.getTerrainData(t);_.activeTexture.set(y.TEXTURE0),y.bindTexture(y.TEXTURE_2D,v.colorAttachment.get()),T.draw(_,y.TRIANGLES,u,p,f,Lt.disabled,((C,F,R,B)=>{const X=R.paint.get("hillshade-shadow-color"),J=R.paint.get("hillshade-highlight-color"),te=R.paint.get("hillshade-accent-color");let O=R.paint.get("hillshade-illumination-direction")*(Math.PI/180);R.paint.get("hillshade-illumination-anchor")==="viewport"&&(O-=C.transform.angle);const ne=!C.options.moving;return{u_matrix:B?B.posMatrix:C.transform.calculatePosMatrix(F.tileID.toUnwrapped(),ne),u_image:0,u_latrange:So(0,F.tileID),u_light:[R.paint.get("hillshade-exaggeration"),O],u_shadow:X,u_highlight:J,u_accent:te}})(a,n,s,I?t:null),I,s.id,a.rasterBoundsBuffer,a.quadTriangleIndexBuffer,a.rasterBoundsSegments)}function xa(a,t,n,s,u,p){const f=a.context,_=f.gl,y=t.dem;if(y&&y.data){const v=y.dim,T=y.stride,I=y.getPixels();if(f.activeTexture.set(_.TEXTURE1),f.pixelStoreUnpackPremultiplyAlpha.set(!1),t.demTexture=t.demTexture||a.getTileTexture(T),t.demTexture){const F=t.demTexture;F.update(I,{premultiply:!1}),F.bind(_.NEAREST,_.CLAMP_TO_EDGE)}else t.demTexture=new He(f,I,_.RGBA,{premultiply:!1}),t.demTexture.bind(_.NEAREST,_.CLAMP_TO_EDGE);f.activeTexture.set(_.TEXTURE0);let C=t.fbo;if(!C){const F=new He(f,{width:v,height:v,data:null},_.RGBA);F.bind(_.LINEAR,_.CLAMP_TO_EDGE),C=t.fbo=f.createFramebuffer(v,v,!0),C.colorAttachment.set(F.texture)}f.bindFramebuffer.set(C.framebuffer),f.viewport.set([0,0,v,v]),a.useProgram("hillshadePrepare").draw(f,_.TRIANGLES,s,u,p,Lt.disabled,((F,R)=>{const B=R.stride,X=l.create();return l.ortho(X,0,l.EXTENT,-l.EXTENT,0,0,1),l.translate(X,X,[0,-l.EXTENT,0]),{u_matrix:X,u_image:1,u_dimension:[B,B],u_zoom:F.overscaledZ,u_unpack:R.getUnpackVector()}})(t.tileID,y),null,n.id,a.rasterBoundsBuffer,a.quadTriangleIndexBuffer,a.rasterBoundsSegments),t.needsHillshadePrepare=!1}}function Ro(a,t,n,s,u,p){const f=s.paint.get("raster-fade-duration");if(!p&&f>0){const _=l.exported.now(),y=(_-a.timeAdded)/f,v=t?(_-t.timeAdded)/f:-1,T=n.getSource(),I=u.coveringZoomLevel({tileSize:T.tileSize,roundZoom:T.roundZoom}),C=!t||Math.abs(t.tileID.overscaledZ-I)>Math.abs(a.tileID.overscaledZ-I),F=C&&a.refreshedUponExpiration?1:l.clamp(C?y:1-v,0,1);return a.refreshedUponExpiration&&y>=1&&(a.refreshedUponExpiration=!1),t?{opacity:1,mix:1-F}:{opacity:F,mix:0}}return{opacity:1,mix:0}}const Bo=new l.Color(1,0,0,1),Xi=new l.Color(0,1,0,1),va=new l.Color(0,0,1,1),vs=new l.Color(1,0,1,1),ba=new l.Color(0,1,1,1);function Jr(a,t,n,s){Cn(a,0,t+n/2,a.transform.width,n,s)}function eo(a,t,n,s){Cn(a,t-n/2,0,n,a.transform.height,s)}function Cn(a,t,n,s,u,p){const f=a.context,_=f.gl;_.enable(_.SCISSOR_TEST),_.scissor(t*a.pixelRatio,n*a.pixelRatio,s*a.pixelRatio,u*a.pixelRatio),f.clear({color:p}),_.disable(_.SCISSOR_TEST)}function Al(a,t,n){const s=a.context,u=s.gl,p=n.posMatrix,f=a.useProgram("debug"),_=at.disabled,y=Ct.disabled,v=a.colorModeForRenderPass(),T="$debug",I=a.style.terrain&&a.style.terrain.getTerrainData(n);s.activeTexture.set(u.TEXTURE0),a.emptyTexture.bind(u.LINEAR,u.CLAMP_TO_EDGE);const C=t.getTileByID(n.key).latestRawTileData,F=Math.floor((C&&C.byteLength||0)/1024),R=t.getTile(n).tileSize,B=512/Math.min(R,512)*(n.overscaledZ/a.transform.zoom)*.5;let X=n.canonical.toString();n.overscaledZ!==n.canonical.z&&(X+=` => ${n.overscaledZ}`),function(J,te){J.initDebugOverlayCanvas();const O=J.debugOverlayCanvas,ne=J.context.gl,ie=J.debugOverlayCanvas.getContext("2d");ie.clearRect(0,0,O.width,O.height),ie.shadowColor="white",ie.shadowBlur=2,ie.lineWidth=1.5,ie.strokeStyle="white",ie.textBaseline="top",ie.font="bold 36px Open Sans, sans-serif",ie.fillText(te,5,5),ie.strokeText(te,5,5),J.debugOverlayTexture.update(O),J.debugOverlayTexture.bind(ne.LINEAR,ne.CLAMP_TO_EDGE)}(a,`${X} ${F}kB`),f.draw(s,u.TRIANGLES,_,y,zt.alphaBlended,Lt.disabled,Zn(p,l.Color.transparent,B),null,T,a.debugBuffer,a.quadTriangleIndexBuffer,a.debugSegments),f.draw(s,u.LINE_STRIP,_,y,v,Lt.disabled,Zn(p,l.Color.red),I,T,a.debugBuffer,a.tileBorderIndexBuffer,a.debugSegments)}function Fo(a,t,n){const s=a.context,u=s.gl,p=a.colorModeForRenderPass(),f=new at(u.LEQUAL,at.ReadWrite,a.depthRangeFor3D),_=a.useProgram("terrain"),y=t.getTerrainMesh(),v=t.getTerrainData(n.tileID);s.bindFramebuffer.set(null),s.viewport.set([0,0,a.width,a.height]),s.activeTexture.set(u.TEXTURE0),u.bindTexture(u.TEXTURE_2D,t.getRTTFramebuffer().colorAttachment.get());const T=a.transform.calculatePosMatrix(n.tileID.toUnwrapped());_.draw(s,u.TRIANGLES,f,Ct.disabled,p,Lt.backCCW,{u_matrix:T,u_texture:0},v,"terrain",y.vertexBuffer,y.indexBuffer,y.segments)}function wa(a,t,n,s){const u=a.context,p=n.tileSize*t.qualityFactor;n.textures[s]||(n.textures[s]=a.getTileTexture(p)||new He(u,{width:p,height:p,data:null},u.gl.RGBA),n.textures[s].bind(u.gl.LINEAR,u.gl.CLAMP_TO_EDGE),s===0&&t.sourceCache.renderHistory.unshift(n.tileID.key));const f=t.getRTTFramebuffer();f.colorAttachment.set(n.textures[s].texture),u.bindFramebuffer.set(f.framebuffer),u.viewport.set([0,0,p,p])}class Ta{constructor(t){this._coordsDescendingInv={},this._coordsDescendingInvStr={},this.painter=t,this._renderToTexture={background:!0,fill:!0,line:!0,raster:!0},this._coordsDescendingInv={},this._coordsDescendingInvStr={},this._stacks=[],this._prevType=null,this._rerender={},this._renderableTiles=t.style.terrain.sourceCache.getRenderableTiles(),this._init()}_init(){const t=this.painter.style,n=t.terrain;for(const s in t.sourceCaches){this._coordsDescendingInv[s]={};const u=t.sourceCaches[s].getVisibleCoordinates();for(const p of u){const f=n.sourceCache.getTerrainCoords(p);for(const _ in f)this._coordsDescendingInv[s][_]||(this._coordsDescendingInv[s][_]=[]),this._coordsDescendingInv[s][_].push(f[_])}}for(const s of t._order){const u=t._layers[s],p=u.source;if(this._renderToTexture[u.type]&&!this._coordsDescendingInvStr[p]){this._coordsDescendingInvStr[p]={};for(const f in this._coordsDescendingInv[p])this._coordsDescendingInvStr[p][f]=this._coordsDescendingInv[p][f].map(_=>_.key).sort().join()}}return this._renderableTiles.forEach(s=>{for(const u in this._coordsDescendingInvStr){const p=this._coordsDescendingInvStr[u][s.tileID.key];p&&p!==s.textureCoords[u]&&s.clearTextures(this.painter),n.needsRerender(u,s.tileID)&&s.clearTextures(this.painter)}this._rerender[s.tileID.key]=!s.textures.length}),n.clearRerenderCache(),n.sourceCache.removeOutdated(this.painter),this}renderLayer(t){const n=t.type,s=this.painter,u=s.style._order,p=s.currentLayer,f=p+1===u.length;if(this._renderToTexture[n]&&(this._prevType&&this._renderToTexture[this._prevType]||this._stacks.push([]),this._prevType=n,this._stacks[this._stacks.length-1].push(u[p]),!f))return!0;if(this._renderToTexture[this._prevType]||n==="hillshade"||this._renderToTexture[n]&&f){this._prevType=n;const _=this._stacks.length-1,y=this._stacks[_]||[];for(const v of this._renderableTiles){if(wa(s,s.style.terrain,v,_),this._rerender[v.tileID.key]){s.context.clear({color:l.Color.transparent});for(let T=0;T<y.length;T++){const I=s.style._layers[y[T]],C=I.source?this._coordsDescendingInv[I.source][v.tileID.key]:[v.tileID];s._renderTileClippingMasks(I,C),s.renderLayer(s,s.style.sourceCaches[I.source],I,C),I.source&&(v.textureCoords[I.source]=this._coordsDescendingInvStr[I.source][v.tileID.key])}}Fo(s,s.style.terrain,v)}if(n==="hillshade"){this._stacks.push([u[p]]);for(const v of this._renderableTiles){const T=this._coordsDescendingInv[t.source][v.tileID.key];wa(s,s.style.terrain,v,this._stacks.length-1),s.context.clear({color:l.Color.transparent}),s._renderTileClippingMasks(t,T),s.renderLayer(s,s.style.sourceCaches[t.source],t,T),Fo(s,s.style.terrain,v)}return!0}return this._renderToTexture[n]}return!1}}const to={symbol:function(a,t,n,s,u){if(a.renderPass!=="translucent")return;const p=Ct.disabled,f=a.colorModeForRenderPass();n.layout.get("text-variable-anchor")&&function(_,y,v,T,I,C,F){const R=y.transform,B=I==="map",X=C==="map";for(const J of _){const te=T.getTile(J),O=te.getBucket(v);if(!O||!O.text||!O.text.segments.get().length)continue;const ne=l.evaluateSizeForZoom(O.textSizeData,R.zoom),ie=qt(te,1,y.transform.zoom),ue=Zr(J.posMatrix,X,B,y.transform,ie),he=v.layout.get("icon-text-fit")!=="none"&&O.hasIconData();if(ne){const ye=Math.pow(2,R.zoom-te.tileID.overscaledZ);ya(O,B,X,F,R,ue,J.posMatrix,ye,ne,he,y.style.terrain?(ce,Le)=>y.style.terrain.getElevation(J,ce,Le):null)}}}(s,a,n,t,n.layout.get("text-rotation-alignment"),n.layout.get("text-pitch-alignment"),u),n.paint.get("icon-opacity").constantOr(1)!==0&&Lo(a,t,n,s,!1,n.paint.get("icon-translate"),n.paint.get("icon-translate-anchor"),n.layout.get("icon-rotation-alignment"),n.layout.get("icon-pitch-alignment"),n.layout.get("icon-keep-upright"),p,f),n.paint.get("text-opacity").constantOr(1)!==0&&Lo(a,t,n,s,!0,n.paint.get("text-translate"),n.paint.get("text-translate-anchor"),n.layout.get("text-rotation-alignment"),n.layout.get("text-pitch-alignment"),n.layout.get("text-keep-upright"),p,f),t.map.showCollisionBoxes&&(An(a,t,n,s,n.paint.get("text-translate"),n.paint.get("text-translate-anchor"),!0),An(a,t,n,s,n.paint.get("icon-translate"),n.paint.get("icon-translate-anchor"),!1))},circle:function(a,t,n,s){if(a.renderPass!=="translucent")return;const u=n.paint.get("circle-opacity"),p=n.paint.get("circle-stroke-width"),f=n.paint.get("circle-stroke-opacity"),_=!n.layout.get("circle-sort-key").isConstant();if(u.constantOr(1)===0&&(p.constantOr(1)===0||f.constantOr(1)===0))return;const y=a.context,v=y.gl,T=a.depthModeForSublayer(0,at.ReadOnly),I=Ct.disabled,C=a.colorModeForRenderPass(),F=[];for(let R=0;R<s.length;R++){const B=s[R],X=t.getTile(B),J=X.getBucket(n);if(!J)continue;const te=J.programConfigurations.get(n.id),O=a.useProgram("circle",te),ne=J.layoutVertexBuffer,ie=J.indexBuffer,ue=a.style.terrain&&a.style.terrain.getTerrainData(B),he={programConfiguration:te,program:O,layoutVertexBuffer:ne,indexBuffer:ie,uniformValues:sa(a,B,X,n),terrainData:ue};if(_){const ye=J.segments.get();for(const ce of ye)F.push({segments:new l.SegmentVector([ce]),sortKey:ce.sortKey,state:he})}else F.push({segments:J.segments,sortKey:0,state:he})}_&&F.sort((R,B)=>R.sortKey-B.sortKey);for(const R of F){const{programConfiguration:B,program:X,layoutVertexBuffer:J,indexBuffer:te,uniformValues:O,terrainData:ne}=R.state;X.draw(y,v.TRIANGLES,T,I,C,Lt.disabled,O,ne,n.id,J,te,R.segments,n.paint,a.transform.zoom,B)}},heatmap:function(a,t,n,s){if(n.paint.get("heatmap-opacity")!==0)if(a.renderPass==="offscreen"){const u=a.context,p=u.gl,f=Ct.disabled,_=new zt([p.ONE,p.ONE],l.Color.transparent,[!0,!0,!0,!0]);(function(y,v,T){const I=y.gl;y.activeTexture.set(I.TEXTURE1),y.viewport.set([0,0,v.width/4,v.height/4]);let C=T.heatmapFbo;if(C)I.bindTexture(I.TEXTURE_2D,C.colorAttachment.get()),y.bindFramebuffer.set(C.framebuffer);else{const F=I.createTexture();I.bindTexture(I.TEXTURE_2D,F),I.texParameteri(I.TEXTURE_2D,I.TEXTURE_WRAP_S,I.CLAMP_TO_EDGE),I.texParameteri(I.TEXTURE_2D,I.TEXTURE_WRAP_T,I.CLAMP_TO_EDGE),I.texParameteri(I.TEXTURE_2D,I.TEXTURE_MIN_FILTER,I.LINEAR),I.texParameteri(I.TEXTURE_2D,I.TEXTURE_MAG_FILTER,I.LINEAR),C=T.heatmapFbo=y.createFramebuffer(v.width/4,v.height/4,!1),function(R,B,X,J){const te=R.gl;te.texImage2D(te.TEXTURE_2D,0,te.RGBA,B.width/4,B.height/4,0,te.RGBA,R.extRenderToTextureHalfFloat?R.extTextureHalfFloat.HALF_FLOAT_OES:te.UNSIGNED_BYTE,null),J.colorAttachment.set(X)}(y,v,F,C)}})(u,a,n),u.clear({color:l.Color.transparent});for(let y=0;y<s.length;y++){const v=s[y];if(t.hasRenderableParent(v))continue;const T=t.getTile(v),I=T.getBucket(n);if(!I)continue;const C=I.programConfigurations.get(n.id),F=a.useProgram("heatmap",C),{zoom:R}=a.transform;F.draw(u,p.TRIANGLES,at.disabled,f,_,Lt.disabled,Eo(v.posMatrix,T,R,n.paint.get("heatmap-intensity")),null,n.id,I.layoutVertexBuffer,I.indexBuffer,I.segments,n.paint,a.transform.zoom,C)}u.viewport.set([0,0,a.width,a.height])}else a.renderPass==="translucent"&&(a.context.setColorMode(a.colorModeForRenderPass()),function(u,p){const f=u.context,_=f.gl,y=p.heatmapFbo;if(!y)return;f.activeTexture.set(_.TEXTURE0),_.bindTexture(_.TEXTURE_2D,y.colorAttachment.get()),f.activeTexture.set(_.TEXTURE1);let v=p.colorRampTexture;v||(v=p.colorRampTexture=new He(f,p.colorRamp,_.RGBA)),v.bind(_.LINEAR,_.CLAMP_TO_EDGE),u.useProgram("heatmapTexture").draw(f,_.TRIANGLES,at.disabled,Ct.disabled,u.colorModeForRenderPass(),Lt.disabled,((T,I,C,F)=>{const R=l.create();l.ortho(R,0,T.width,T.height,0,0,1);const B=T.context.gl;return{u_matrix:R,u_world:[B.drawingBufferWidth,B.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:I.paint.get("heatmap-opacity")}})(u,p),null,p.id,u.viewportBuffer,u.quadTriangleIndexBuffer,u.viewportSegments,p.paint,u.transform.zoom)}(a,n))},line:function(a,t,n,s){if(a.renderPass!=="translucent")return;const u=n.paint.get("line-opacity"),p=n.paint.get("line-width");if(u.constantOr(1)===0||p.constantOr(1)===0)return;const f=a.depthModeForSublayer(0,at.ReadOnly),_=a.colorModeForRenderPass(),y=n.paint.get("line-dasharray"),v=n.paint.get("line-pattern"),T=v.constantOr(1),I=n.paint.get("line-gradient"),C=n.getCrossfadeParameters(),F=T?"linePattern":y?"lineSDF":I?"lineGradient":"line",R=a.context,B=R.gl;let X=!0;for(const J of s){const te=t.getTile(J);if(T&&!te.patternsLoaded())continue;const O=te.getBucket(n);if(!O)continue;const ne=O.programConfigurations.get(n.id),ie=a.context.program.get(),ue=a.useProgram(F,ne),he=X||ue.program!==ie,ye=a.style.terrain&&a.style.terrain.getTerrainData(J),ce=v.constantOr(null);if(ce&&te.imageAtlas){const Re=te.imageAtlas,Qe=Re.patternPositions[ce.to.toString()],it=Re.patternPositions[ce.from.toString()];Qe&&it&&ne.setConstantPatternPositions(Qe,it)}const Le=ye?J:null,Ie=T?Io(a,te,n,C,Le):y?jn(a,te,n,y,C,Le):I?os(a,te,n,O.lineClipsArray.length,Le):Tn(a,te,n,Le);if(T)R.activeTexture.set(B.TEXTURE0),te.imageAtlasTexture.bind(B.LINEAR,B.CLAMP_TO_EDGE),ne.updatePaintBuffers(C);else if(y&&(he||a.lineAtlas.dirty))R.activeTexture.set(B.TEXTURE0),a.lineAtlas.bind(R);else if(I){const Re=O.gradients[n.id];let Qe=Re.texture;if(n.gradientVersion!==Re.version){let it=256;if(n.stepInterpolant){const Ge=t.getSource().maxzoom,bt=J.canonical.z===Ge?Math.ceil(1<<a.transform.maxZoom-J.canonical.z):1;it=l.clamp(l.nextPowerOfTwo(O.maxLineLength/l.EXTENT*1024*bt),256,R.maxTextureSize)}Re.gradient=l.renderColorRamp({expression:n.gradientExpression(),evaluationKey:"lineProgress",resolution:it,image:Re.gradient||void 0,clips:O.lineClipsArray}),Re.texture?Re.texture.update(Re.gradient):Re.texture=new He(R,Re.gradient,B.RGBA),Re.version=n.gradientVersion,Qe=Re.texture}R.activeTexture.set(B.TEXTURE0),Qe.bind(n.stepInterpolant?B.NEAREST:B.LINEAR,B.CLAMP_TO_EDGE)}ue.draw(R,B.TRIANGLES,f,a.stencilModeForClipping(J),_,Lt.disabled,Ie,ye,n.id,O.layoutVertexBuffer,O.indexBuffer,O.segments,n.paint,a.transform.zoom,ne,O.layoutVertexBuffer2),X=!1}},fill:function(a,t,n,s){const u=n.paint.get("fill-color"),p=n.paint.get("fill-opacity");if(p.constantOr(1)===0)return;const f=a.colorModeForRenderPass(),_=n.paint.get("fill-pattern"),y=a.opaquePassEnabledForLayer()&&!_.constantOr(1)&&u.constantOr(l.Color.transparent).a===1&&p.constantOr(0)===1?"opaque":"translucent";if(a.renderPass===y){const v=a.depthModeForSublayer(1,a.renderPass==="opaque"?at.ReadWrite:at.ReadOnly);Yn(a,t,n,s,v,f,!1)}if(a.renderPass==="translucent"&&n.paint.get("fill-antialias")){const v=a.depthModeForSublayer(n.getPaintProperty("fill-outline-color")?2:0,at.ReadOnly);Yn(a,t,n,s,v,f,!0)}},"fill-extrusion":function(a,t,n,s){const u=n.paint.get("fill-extrusion-opacity");if(u!==0&&a.renderPass==="translucent"){const p=new at(a.context.gl.LEQUAL,at.ReadWrite,a.depthRangeFor3D);if(u!==1||n.paint.get("fill-extrusion-pattern").constantOr(1))Qn(a,t,n,s,p,Ct.disabled,zt.disabled),Qn(a,t,n,s,p,a.stencilModeFor3D(),a.colorModeForRenderPass());else{const f=a.colorModeForRenderPass();Qn(a,t,n,s,p,Ct.disabled,f)}}},hillshade:function(a,t,n,s){if(a.renderPass!=="offscreen"&&a.renderPass!=="translucent")return;const u=a.context,p=a.depthModeForSublayer(0,at.ReadOnly),f=a.colorModeForRenderPass(),[_,y]=a.renderPass==="translucent"?a.stencilConfigForOverlap(s):[{},s];for(const v of y){const T=t.getTile(v);T.needsHillshadePrepare!==void 0&&T.needsHillshadePrepare&&a.renderPass==="offscreen"?xa(a,T,n,p,Ct.disabled,f):a.renderPass==="translucent"&&xs(a,v,T,n,p,_[v.overscaledZ],f)}u.viewport.set([0,0,a.width,a.height])},raster:function(a,t,n,s){if(a.renderPass!=="translucent"||n.paint.get("raster-opacity")===0||!s.length)return;const u=a.context,p=u.gl,f=t.getSource(),_=a.useProgram("raster"),y=a.colorModeForRenderPass(),[v,T]=f instanceof qi?[{},s]:a.stencilConfigForOverlap(s),I=T[T.length-1].overscaledZ,C=!a.options.moving;for(const F of T){const R=a.depthModeForSublayer(F.overscaledZ-I,n.paint.get("raster-opacity")===1?at.ReadWrite:at.ReadOnly,p.LESS),B=t.getTile(F);B.registerFadeDuration(n.paint.get("raster-fade-duration"));const X=t.findLoadedParent(F,0),J=Ro(B,X,t,n,a.transform,a.style.terrain);let te,O;const ne=n.paint.get("raster-resampling")==="nearest"?p.NEAREST:p.LINEAR;u.activeTexture.set(p.TEXTURE0),B.texture.bind(ne,p.CLAMP_TO_EDGE,p.LINEAR_MIPMAP_NEAREST),u.activeTexture.set(p.TEXTURE1),X?(X.texture.bind(ne,p.CLAMP_TO_EDGE,p.LINEAR_MIPMAP_NEAREST),te=Math.pow(2,X.tileID.overscaledZ-B.tileID.overscaledZ),O=[B.tileID.canonical.x*te%1,B.tileID.canonical.y*te%1]):B.texture.bind(ne,p.CLAMP_TO_EDGE,p.LINEAR_MIPMAP_NEAREST);const ie=a.style.terrain&&a.style.terrain.getTerrainData(F),ue=ie?F:null,he=ue?ue.posMatrix:a.transform.calculatePosMatrix(F.toUnwrapped(),C),ye=aa(he,O||[0,0],te||1,J,n);f instanceof qi?_.draw(u,p.TRIANGLES,R,Ct.disabled,y,Lt.disabled,ye,ie,n.id,f.boundsBuffer,a.quadTriangleIndexBuffer,f.boundsSegments):_.draw(u,p.TRIANGLES,R,v[F.overscaledZ],y,Lt.disabled,ye,ie,n.id,a.rasterBoundsBuffer,a.quadTriangleIndexBuffer,a.rasterBoundsSegments)}},background:function(a,t,n,s){const u=n.paint.get("background-color"),p=n.paint.get("background-opacity");if(p===0)return;const f=a.context,_=f.gl,y=a.transform,v=y.tileSize,T=n.paint.get("background-pattern");if(a.isPatternMissing(T))return;const I=!T&&u.a===1&&p===1&&a.opaquePassEnabledForLayer()?"opaque":"translucent";if(a.renderPass!==I)return;const C=Ct.disabled,F=a.depthModeForSublayer(0,I==="opaque"?at.ReadWrite:at.ReadOnly),R=a.colorModeForRenderPass(),B=a.useProgram(T?"backgroundPattern":"background"),X=s||y.coveringTiles({tileSize:v,terrain:a.style.terrain});T&&(f.activeTexture.set(_.TEXTURE0),a.imageManager.bind(a.context));const J=n.getCrossfadeParameters();for(const te of X){const O=s?te.posMatrix:a.transform.calculatePosMatrix(te.toUnwrapped()),ne=T?gl(O,p,a,T,{tileID:te,tileSize:v},J):ml(O,p,u),ie=a.style.terrain&&a.style.terrain.getTerrainData(te);B.draw(f,_.TRIANGLES,F,C,R,Lt.disabled,ne,ie,n.id,a.tileExtentBuffer,a.quadTriangleIndexBuffer,a.tileExtentSegments)}},debug:function(a,t,n){for(let s=0;s<n.length;s++)Al(a,t,n[s])},custom:function(a,t,n){const s=a.context,u=n.implementation;if(a.renderPass==="offscreen"){const p=u.prerender;p&&(a.setCustomLayerDefaults(),s.setColorMode(a.colorModeForRenderPass()),p.call(u,s.gl,a.transform.customLayerMatrix()),s.setDirty(),a.setBaseState())}else if(a.renderPass==="translucent"){a.setCustomLayerDefaults(),s.setColorMode(a.colorModeForRenderPass()),s.setStencilMode(Ct.disabled);const p=u.renderingMode==="3d"?new at(a.context.gl.LEQUAL,at.ReadWrite,a.depthRangeFor3D):a.depthModeForSublayer(0,at.ReadOnly);s.setDepthMode(p),u.render(s.gl,a.transform.customLayerMatrix()),s.setDirty(),a.setBaseState(),s.bindFramebuffer.set(null)}}};class bs{constructor(t,n){this.context=new _a(t),this.transform=n,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:l.create(),renderTime:0},this.setup(),this.numSublayers=xi.maxUnderzooming+xi.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Xe,this.gpuTimers={}}resize(t,n,s){if(this.width=t*s,this.height=n*s,this.pixelRatio=s,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const u of this.style._order)this.style._layers[u].resize()}setup(){const t=this.context,n=new l.PosArray;n.emplaceBack(0,0),n.emplaceBack(l.EXTENT,0),n.emplaceBack(0,l.EXTENT),n.emplaceBack(l.EXTENT,l.EXTENT),this.tileExtentBuffer=t.createVertexBuffer(n,dt.members),this.tileExtentSegments=l.SegmentVector.simpleSegment(0,0,4,2);const s=new l.PosArray;s.emplaceBack(0,0),s.emplaceBack(l.EXTENT,0),s.emplaceBack(0,l.EXTENT),s.emplaceBack(l.EXTENT,l.EXTENT),this.debugBuffer=t.createVertexBuffer(s,dt.members),this.debugSegments=l.SegmentVector.simpleSegment(0,0,4,5);const u=new l.RasterBoundsArray;u.emplaceBack(0,0,0,0),u.emplaceBack(l.EXTENT,0,l.EXTENT,0),u.emplaceBack(0,l.EXTENT,0,l.EXTENT),u.emplaceBack(l.EXTENT,l.EXTENT,l.EXTENT,l.EXTENT),this.rasterBoundsBuffer=t.createVertexBuffer(u,hr.members),this.rasterBoundsSegments=l.SegmentVector.simpleSegment(0,0,4,2);const p=new l.PosArray;p.emplaceBack(0,0),p.emplaceBack(1,0),p.emplaceBack(0,1),p.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(p,dt.members),this.viewportSegments=l.SegmentVector.simpleSegment(0,0,4,2);const f=new l.LineStripIndexArray;f.emplaceBack(0),f.emplaceBack(1),f.emplaceBack(3),f.emplaceBack(2),f.emplaceBack(0),this.tileBorderIndexBuffer=t.createIndexBuffer(f);const _=new l.TriangleIndexArray;_.emplaceBack(0,1,2),_.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(_),this.emptyTexture=new He(t,{width:1,height:1,data:new Uint8Array([0,0,0,0])},t.gl.RGBA);const y=this.context.gl;this.stencilClearMode=new Ct({func:y.ALWAYS,mask:0},0,255,y.ZERO,y.ZERO,y.ZERO)}clearStencil(){const t=this.context,n=t.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const s=l.create();l.ortho(s,0,this.width,this.height,0,0,1),l.scale(s,s,[n.drawingBufferWidth,n.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(t,n.TRIANGLES,at.disabled,this.stencilClearMode,zt.disabled,Lt.disabled,wn(s),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(t,n){if(this.currentStencilSource===t.source||!t.isTileClipped()||!n||!n.length)return;this.currentStencilSource=t.source;const s=this.context,u=s.gl;this.nextStencilID+n.length>256&&this.clearStencil(),s.setColorMode(zt.disabled),s.setDepthMode(at.disabled);const p=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const f of n){const _=this._tileClippingMaskIDs[f.key]=this.nextStencilID++,y=this.style.terrain&&this.style.terrain.getTerrainData(f);p.draw(s,u.TRIANGLES,at.disabled,new Ct({func:u.ALWAYS,mask:0},_,255,u.KEEP,u.KEEP,u.REPLACE),zt.disabled,Lt.disabled,wn(f.posMatrix),y,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const t=this.nextStencilID++,n=this.context.gl;return new Ct({func:n.NOTEQUAL,mask:255},t,255,n.KEEP,n.KEEP,n.REPLACE)}stencilModeForClipping(t){const n=this.context.gl;return new Ct({func:n.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,n.KEEP,n.KEEP,n.REPLACE)}stencilConfigForOverlap(t){const n=this.context.gl,s=t.sort((f,_)=>_.overscaledZ-f.overscaledZ),u=s[s.length-1].overscaledZ,p=s[0].overscaledZ-u+1;if(p>1){this.currentStencilSource=void 0,this.nextStencilID+p>256&&this.clearStencil();const f={};for(let _=0;_<p;_++)f[_+u]=new Ct({func:n.GEQUAL,mask:255},_+this.nextStencilID,255,n.KEEP,n.KEEP,n.REPLACE);return this.nextStencilID+=p,[f,s]}return[{[u]:Ct.disabled},s]}colorModeForRenderPass(){const t=this.context.gl;return this._showOverdrawInspector?new zt([t.CONSTANT_COLOR,t.ONE],new l.Color(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?zt.unblended:zt.alphaBlended}depthModeForSublayer(t,n,s){if(!this.opaquePassEnabledForLayer())return at.disabled;const u=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new at(s||this.context.gl.LEQUAL,n,[u,u])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(t,n){this.style=t,this.options=n,this.lineAtlas=t.lineAtlas,this.imageManager=t.imageManager,this.glyphManager=t.glyphManager,this.symbolFadeChange=t.placement.symbolFadeChange(l.exported.now()),this.imageManager.beginFrame();const s=this.style._order,u=this.style.sourceCaches,p=this.style.terrain&&new Ta(this);for(const v in u){const T=u[v];T.used&&T.prepare(this.context)}const f={},_={},y={};for(const v in u){const T=u[v];f[v]=T.getVisibleCoordinates(),_[v]=f[v].slice().reverse(),y[v]=T.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let v=0;v<s.length;v++)if(this.style._layers[s[v]].is3D()){this.opaquePassCutoff=v;break}if(p){this.opaquePassCutoff=0;const v=this.style.terrain.sourceCache.tilesAfterTime(this.terrainFacilitator.renderTime);(this.terrainFacilitator.dirty||!l.equals(this.terrainFacilitator.matrix,this.transform.projMatrix)||v.length)&&(l.copy(this.terrainFacilitator.matrix,this.transform.projMatrix),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(T,I){const C=T.context,F=C.gl,R=zt.unblended,B=new at(F.LEQUAL,at.ReadWrite,[0,1]),X=I.getTerrainMesh(),J=I.sourceCache.getRenderableTiles(),te=T.useProgram("terrainDepth");C.bindFramebuffer.set(I.getFramebuffer("depth").framebuffer),C.viewport.set([0,0,T.width/devicePixelRatio,T.height/devicePixelRatio]),C.clear({color:l.Color.transparent,depth:1});for(const O of J){const ne=I.getTerrainData(O.tileID),ie=T.transform.calculatePosMatrix(O.tileID.toUnwrapped());te.draw(C,F.TRIANGLES,B,Ct.disabled,R,Lt.backCCW,{u_matrix:ie},ne,"terrain",X.vertexBuffer,X.indexBuffer,X.segments)}C.bindFramebuffer.set(null),C.viewport.set([0,0,T.width,T.height])}(this,this.style.terrain),function(T,I){const C=T.context,F=C.gl,R=zt.unblended,B=new at(F.LEQUAL,at.ReadWrite,[0,1]),X=I.getTerrainMesh(),J=I.getCoordsTexture(),te=I.sourceCache.getRenderableTiles(),O=T.useProgram("terrainCoords");C.bindFramebuffer.set(I.getFramebuffer("coords").framebuffer),C.viewport.set([0,0,T.width/devicePixelRatio,T.height/devicePixelRatio]),C.clear({color:l.Color.transparent,depth:1}),I.coordsIndex=[];for(const ne of te){const ie=I.getTerrainData(ne.tileID);C.activeTexture.set(F.TEXTURE0),F.bindTexture(F.TEXTURE_2D,J.texture);const ue=T.transform.calculatePosMatrix(ne.tileID.toUnwrapped());O.draw(C,F.TRIANGLES,B,Ct.disabled,R,Lt.backCCW,{u_matrix:ue,u_terrain_coords_id:(255-I.coordsIndex.length)/255,u_texture:0},ie,"terrain",X.vertexBuffer,X.indexBuffer,X.segments),I.coordsIndex.push(ne.tileID.key)}C.bindFramebuffer.set(null),C.viewport.set([0,0,T.width,T.height])}(this,this.style.terrain))}this.renderPass="offscreen";for(const v of s){const T=this.style._layers[v];if(!T.hasOffscreenPass()||T.isHidden(this.transform.zoom))continue;const I=_[T.source];(T.type==="custom"||I.length)&&this.renderLayer(this,u[T.source],T,I)}if(this.context.bindFramebuffer.set(null),this.context.clear({color:n.showOverdrawInspector?l.Color.black:l.Color.transparent,depth:1}),this.clearStencil(),this._showOverdrawInspector=n.showOverdrawInspector,this.depthRangeFor3D=[0,1-(t._order.length+2)*this.numSublayers*this.depthEpsilon],!p)for(this.renderPass="opaque",this.currentLayer=s.length-1;this.currentLayer>=0;this.currentLayer--){const v=this.style._layers[s[this.currentLayer]],T=u[v.source],I=f[v.source];this._renderTileClippingMasks(v,I),this.renderLayer(this,T,v,I)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<s.length;this.currentLayer++){const v=this.style._layers[s[this.currentLayer]],T=u[v.source];if(p&&p.renderLayer(v))continue;const I=(v.type==="symbol"?y:_)[v.source];this._renderTileClippingMasks(v,f[v.source]),this.renderLayer(this,T,v,I)}if(this.options.showTileBoundaries){let v,T;Object.values(this.style._layers).forEach(I=>{I.source&&!I.isHidden(this.transform.zoom)&&(I.source!==(T&&T.id)&&(T=this.style.sourceCaches[I.source]),(!v||v.getSource().maxzoom<T.getSource().maxzoom)&&(v=T))}),v&&to.debug(this,v,v.getVisibleCoordinates())}this.options.showPadding&&function(v){const T=v.transform.padding;Jr(v,v.transform.height-(T.top||0),3,Bo),Jr(v,T.bottom||0,3,Xi),eo(v,T.left||0,3,va),eo(v,v.transform.width-(T.right||0),3,vs);const I=v.transform.centerPoint;(function(C,F,R,B){Cn(C,F-1,R-10,2,20,B),Cn(C,F-10,R-1,20,2,B)})(v,I.x,v.transform.height-I.y,ba)}(this),this.context.setDefault()}renderLayer(t,n,s,u){s.isHidden(this.transform.zoom)||(s.type==="background"||s.type==="custom"||(u||[]).length)&&(this.id=s.id,this.gpuTimingStart(s),to[s.type](t,n,s,u,this.style.placement.variableOffsets),this.gpuTimingEnd())}gpuTimingStart(t){if(!this.options.gpuTiming)return;const n=this.context.extTimerQuery;let s=this.gpuTimers[t.id];s||(s=this.gpuTimers[t.id]={calls:0,cpuTime:0,query:n.createQueryEXT()}),s.calls++,n.beginQueryEXT(n.TIME_ELAPSED_EXT,s.query)}gpuTimingEnd(){if(!this.options.gpuTiming)return;const t=this.context.extTimerQuery;t.endQueryEXT(t.TIME_ELAPSED_EXT)}collectGpuTimers(){const t=this.gpuTimers;return this.gpuTimers={},t}queryGpuTimers(t){const n={};for(const s in t){const u=t[s],p=this.context.extTimerQuery,f=p.getQueryObjectEXT(u.query,p.QUERY_RESULT_EXT)/1e6;p.deleteQueryEXT(u.query),n[s]=f}return n}translatePosMatrix(t,n,s,u,p){if(!s[0]&&!s[1])return t;const f=p?u==="map"?this.transform.angle:0:u==="viewport"?-this.transform.angle:0;if(f){const v=Math.sin(f),T=Math.cos(f);s=[s[0]*T-s[1]*v,s[0]*v+s[1]*T]}const _=[p?s[0]:qt(n,s[0],this.transform.zoom),p?s[1]:qt(n,s[1],this.transform.zoom),0],y=new Float32Array(16);return l.translate(y,t,_),y}saveTileTexture(t){const n=this._tileTextures[t.size[0]];n?n.push(t):this._tileTextures[t.size[0]]=[t]}getTileTexture(t){const n=this._tileTextures[t];return n&&n.length>0?n.pop():null}isPatternMissing(t){if(!t)return!1;if(!t.from||!t.to)return!0;const n=this.imageManager.getPattern(t.from.toString()),s=this.imageManager.getPattern(t.to.toString());return!n||!s}useProgram(t,n){this.cache=this.cache||{};const s=t+(n?n.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.terrain?"/terrain":"");return this.cache[s]||(this.cache[s]=new ia(this.context,t,qn[t],n,as[t],this._showOverdrawInspector,this.style.terrain)),this.cache[s]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const t=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new He(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}}class Oo{constructor(t,n){this.points=t,this.planes=n}static fromInvProjectionMatrix(t,n,s){const u=Math.pow(2,s),p=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map(_=>{const y=1/(_=l.transformMat4([],_,t))[3]/n*u;return l.mul$1(_,_,[y,y,1/_[3],y])}),f=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(_=>{const y=l.sub([],p[_[0]],p[_[1]]),v=l.sub([],p[_[2]],p[_[1]]),T=l.normalize([],l.cross([],y,v)),I=-l.dot(T,p[_[1]]);return T.concat(I)});return new Oo(p,f)}}class io{constructor(t,n){this.min=t,this.max=n,this.center=l.scale$1([],l.add([],this.min,this.max),.5)}quadrant(t){const n=[t%2==0,t<2],s=l.clone$2(this.min),u=l.clone$2(this.max);for(let p=0;p<n.length;p++)s[p]=n[p]?this.min[p]:this.center[p],u[p]=n[p]?this.center[p]:this.max[p];return u[2]=this.max[2],new io(s,u)}distanceX(t){return Math.max(Math.min(this.max[0],t[0]),this.min[0])-t[0]}distanceY(t){return Math.max(Math.min(this.max[1],t[1]),this.min[1])-t[1]}intersects(t){const n=[[this.min[0],this.min[1],this.min[2],1],[this.max[0],this.min[1],this.min[2],1],[this.max[0],this.max[1],this.min[2],1],[this.min[0],this.max[1],this.min[2],1],[this.min[0],this.min[1],this.max[2],1],[this.max[0],this.min[1],this.max[2],1],[this.max[0],this.max[1],this.max[2],1],[this.min[0],this.max[1],this.max[2],1]];let s=!0;for(let u=0;u<t.planes.length;u++){const p=t.planes[u];let f=0;for(let _=0;_<n.length;_++)l.dot$1(p,n[_])>=0&&f++;if(f===0)return 0;f!==n.length&&(s=!1)}if(s)return 2;for(let u=0;u<3;u++){let p=Number.MAX_VALUE,f=-Number.MAX_VALUE;for(let _=0;_<t.points.length;_++){const y=t.points[_][u]-this.min[u];p=Math.min(p,y),f=Math.max(f,y)}if(f<0||p>this.max[u]-this.min[u])return 0}return 1}}class Mn{constructor(t=0,n=0,s=0,u=0){if(isNaN(t)||t<0||isNaN(n)||n<0||isNaN(s)||s<0||isNaN(u)||u<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=n,this.left=s,this.right=u}interpolate(t,n,s){return n.top!=null&&t.top!=null&&(this.top=l.number(t.top,n.top,s)),n.bottom!=null&&t.bottom!=null&&(this.bottom=l.number(t.bottom,n.bottom,s)),n.left!=null&&t.left!=null&&(this.left=l.number(t.left,n.left,s)),n.right!=null&&t.right!=null&&(this.right=l.number(t.right,n.right,s)),this}getCenter(t,n){const s=l.clamp((this.left+t-this.right)/2,0,t),u=l.clamp((this.top+n-this.bottom)/2,0,n);return new l.pointGeometry(s,u)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new Mn(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}class ro{constructor(t,n,s,u,p){this.tileSize=512,this.maxValidLatitude=85.051129,this.freezeElevation=!1,this._renderWorldCopies=p===void 0||!!p,this._minZoom=t||0,this._maxZoom=n||22,this._minPitch=s==null?0:s,this._maxPitch=u==null?60:u,this.setMaxBounds(),this.width=0,this.height=0,this._center=new l.LngLat(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new Mn,this._posMatrixCache={},this._alignedPosMatrixCache={}}clone(){const t=new ro(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return t.tileSize=this.tileSize,t.latRange=this.latRange,t.width=this.width,t.height=this.height,t._center=this._center,t._elevation=this._elevation,t.zoom=this.zoom,t.angle=this.angle,t._fov=this._fov,t._pitch=this._pitch,t._unmodified=this._unmodified,t._edgeInsets=this._edgeInsets.clone(),t._calcMatrices(),t}get minZoom(){return this._minZoom}set minZoom(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))}get maxZoom(){return this._maxZoom}set maxZoom(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))}get minPitch(){return this._minPitch}set minPitch(t){this._minPitch!==t&&(this._minPitch=t,this.pitch=Math.max(this.pitch,t))}get maxPitch(){return this._maxPitch}set maxPitch(t){this._maxPitch!==t&&(this._maxPitch=t,this.pitch=Math.min(this.pitch,t))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(t){t===void 0?t=!0:t===null&&(t=!1),this._renderWorldCopies=t}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new l.pointGeometry(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(t){const n=-l.wrap(t,-180,180)*Math.PI/180;var s;this.angle!==n&&(this._unmodified=!1,this.angle=n,this._calcMatrices(),this.rotationMatrix=(s=new l.ARRAY_TYPE(4),l.ARRAY_TYPE!=Float32Array&&(s[1]=0,s[2]=0),s[0]=1,s[3]=1,s),function(u,p,f){var _=p[0],y=p[1],v=p[2],T=p[3],I=Math.sin(f),C=Math.cos(f);u[0]=_*C+v*I,u[1]=y*C+T*I,u[2]=_*-I+v*C,u[3]=y*-I+T*C}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(t){const n=l.clamp(t,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==n&&(this._unmodified=!1,this._pitch=n,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(t){t=Math.max(.01,Math.min(60,t)),this._fov!==t&&(this._unmodified=!1,this._fov=t/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(t){const n=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==n&&(this._unmodified=!1,this._zoom=n,this.scale=this.zoomScale(n),this.tileZoom=Math.floor(n),this.zoomFraction=n-this.tileZoom,this._constrain(),this._calcMatrices())}get center(){return this._center}set center(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(t){t!==this._elevation&&(this._elevation=t,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(t){this._edgeInsets.equals(t)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,t,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(t){return this._edgeInsets.equals(t)}interpolatePadding(t,n,s){this._unmodified=!1,this._edgeInsets.interpolate(t,n,s),this._constrain(),this._calcMatrices()}coveringZoomLevel(t){const n=(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize));return Math.max(0,n)}getVisibleUnwrappedCoordinates(t){const n=[new l.UnwrappedTileID(0,t)];if(this._renderWorldCopies){const s=this.pointCoordinate(new l.pointGeometry(0,0)),u=this.pointCoordinate(new l.pointGeometry(this.width,0)),p=this.pointCoordinate(new l.pointGeometry(this.width,this.height)),f=this.pointCoordinate(new l.pointGeometry(0,this.height)),_=Math.floor(Math.min(s.x,u.x,p.x,f.x)),y=Math.floor(Math.max(s.x,u.x,p.x,f.x)),v=1;for(let T=_-v;T<=y+v;T++)T!==0&&n.push(new l.UnwrappedTileID(T,t))}return n}coveringTiles(t){var n,s;let u=this.coveringZoomLevel(t);const p=u;if(t.minzoom!==void 0&&u<t.minzoom)return[];t.maxzoom!==void 0&&u>t.maxzoom&&(u=t.maxzoom);const f=this.pointCoordinate(this.getCameraPoint()),_=l.MercatorCoordinate.fromLngLat(this.center),y=Math.pow(2,u),v=[y*f.x,y*f.y,0],T=[y*_.x,y*_.y,0],I=Oo.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,u);let C=t.minzoom||0;!t.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(C=u);const F=t.terrain?2/Math.min(this.tileSize,t.tileSize)*this.tileSize:3,R=O=>({aabb:new io([O*y,0,0],[(O+1)*y,y,0]),zoom:0,x:0,y:0,wrap:O,fullyVisible:!1}),B=[],X=[],J=u,te=t.reparseOverscaled?p:u;if(this._renderWorldCopies)for(let O=1;O<=3;O++)B.push(R(-O)),B.push(R(O));for(B.push(R(0));B.length>0;){const O=B.pop(),ne=O.x,ie=O.y;let ue=O.fullyVisible;if(!ue){const Re=O.aabb.intersects(I);if(Re===0)continue;ue=Re===2}const he=t.terrain?v:T,ye=O.aabb.distanceX(he),ce=O.aabb.distanceY(he),Le=Math.max(Math.abs(ye),Math.abs(ce)),Ie=F+(1<<J-O.zoom)-2;if(O.zoom===J||Le>Ie&&O.zoom>=C){const Re=J-O.zoom,Qe=v[0]-.5-(ne<<Re),it=v[1]-.5-(ie<<Re);X.push({tileID:new l.OverscaledTileID(O.zoom===J?te:O.zoom,O.wrap,O.zoom,ne,ie),distanceSq:l.sqrLen([T[0]-.5-ne,T[1]-.5-ie]),tileDistanceToCamera:Math.sqrt(Qe*Qe+it*it)})}else for(let Re=0;Re<4;Re++){const Qe=(ne<<1)+Re%2,it=(ie<<1)+(Re>>1),Ge=O.zoom+1;let bt=O.aabb.quadrant(Re);if(t.terrain){const wt=new l.OverscaledTileID(Ge,O.wrap,Ge,Qe,it),ut=t.terrain.getMinMaxElevation(wt),mt=(n=ut.minElevation)!==null&&n!==void 0?n:this.elevation,Et=(s=ut.maxElevation)!==null&&s!==void 0?s:this.elevation;bt=new io([bt.min[0],bt.min[1],mt],[bt.max[0],bt.max[1],Et])}B.push({aabb:bt,zoom:Ge,x:Qe,y:it,wrap:O.wrap,fullyVisible:ue})}}return X.sort((O,ne)=>O.distanceSq-ne.distanceSq).map(O=>O.tileID)}resize(t,n){this.width=t,this.height=n,this.pixelsToGLUnits=[2/t,-2/n],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(t){return Math.pow(2,t)}scaleZoom(t){return Math.log(t)/Math.LN2}project(t){const n=l.clamp(t.lat,-this.maxValidLatitude,this.maxValidLatitude);return new l.pointGeometry(l.mercatorXfromLng(t.lng)*this.worldSize,l.mercatorYfromLat(n)*this.worldSize)}unproject(t){return new l.MercatorCoordinate(t.x/this.worldSize,t.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}updateElevation(t){this.freezeElevation||(this.elevation=t?this.getElevation(this._center,t):0)}getElevation(t,n){const s=l.MercatorCoordinate.fromLngLat(t),u=(1<<this.tileZoom)*l.EXTENT,p=s.x*u,f=s.y*u,_=Math.floor(p/l.EXTENT),y=Math.floor(f/l.EXTENT),v=new l.OverscaledTileID(this.tileZoom,0,this.tileZoom,_,y);return n.getElevation(v,p%l.EXTENT,f%l.EXTENT,l.EXTENT)}getCameraPosition(){return{lngLat:this.pointLocation(this.getCameraPoint()),altitude:Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter+this.elevation}}recalculateZoom(t){const n=this.pointLocation(this.centerPoint,t),s=this.getElevation(n,t);if(!(this.elevation-s))return;const u=this.getCameraPosition(),p=l.MercatorCoordinate.fromLngLat(u.lngLat,u.altitude),f=l.MercatorCoordinate.fromLngLat(n,s),_=p.x-f.x,y=p.y-f.y,v=p.z-f.z,T=Math.sqrt(_*_+y*y+v*v),I=this.scaleZoom(this.cameraToCenterDistance/T/this.tileSize);this._elevation=s,this._center=n,this.zoom=I}setLocationAtPoint(t,n){const s=this.pointCoordinate(n),u=this.pointCoordinate(this.centerPoint),p=this.locationCoordinate(t),f=new l.MercatorCoordinate(p.x-(s.x-u.x),p.y-(s.y-u.y));this.center=this.coordinateLocation(f),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(t,n){return n?this.coordinatePoint(this.locationCoordinate(t),this.getElevation(t,n),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(t))}pointLocation(t,n){return this.coordinateLocation(this.pointCoordinate(t,n))}locationCoordinate(t){return l.MercatorCoordinate.fromLngLat(t)}coordinateLocation(t){return t&&t.toLngLat()}pointCoordinate(t,n){if(n){const C=n.pointCoordinate(t);if(C!=null)return C}const s=[t.x,t.y,0,1],u=[t.x,t.y,1,1];l.transformMat4(s,s,this.pixelMatrixInverse),l.transformMat4(u,u,this.pixelMatrixInverse);const p=s[3],f=u[3],_=s[1]/p,y=u[1]/f,v=s[2]/p,T=u[2]/f,I=v===T?0:(0-v)/(T-v);return new l.MercatorCoordinate(l.number(s[0]/p,u[0]/f,I)/this.worldSize,l.number(_,y,I)/this.worldSize)}coordinatePoint(t,n=0,s=this.pixelMatrix){const u=[t.x*this.worldSize,t.y*this.worldSize,n,1];return l.transformMat4(u,u,s),new l.pointGeometry(u[0]/u[3],u[1]/u[3])}getBounds(){const t=Math.max(0,this.height/2-this.getHorizon());return new l.LngLatBounds().extend(this.pointLocation(new l.pointGeometry(0,t))).extend(this.pointLocation(new l.pointGeometry(this.width,t))).extend(this.pointLocation(new l.pointGeometry(this.width,this.height))).extend(this.pointLocation(new l.pointGeometry(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new l.LngLatBounds([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}getHorizon(){return Math.tan(Math.PI/2-this._pitch)*this.cameraToCenterDistance*.85}setMaxBounds(t){t?(this.lngRange=[t.getWest(),t.getEast()],this.latRange=[t.getSouth(),t.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-this.maxValidLatitude,this.maxValidLatitude])}calculatePosMatrix(t,n=!1){const s=t.key,u=n?this._alignedPosMatrixCache:this._posMatrixCache;if(u[s])return u[s];const p=t.canonical,f=this.worldSize/this.zoomScale(p.z),_=p.x+Math.pow(2,p.z)*t.wrap,y=l.identity(new Float64Array(16));return l.translate(y,y,[_*f,p.y*f,0]),l.scale(y,y,[f/l.EXTENT,f/l.EXTENT,1]),l.multiply(y,n?this.alignedProjMatrix:this.projMatrix,y),u[s]=new Float32Array(y),u[s]}customLayerMatrix(){return this.mercatorMatrix.slice()}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;let t,n,s,u,p=-90,f=90,_=-180,y=180;const v=this.size,T=this._unmodified;if(this.latRange){const F=this.latRange;p=l.mercatorYfromLat(F[1])*this.worldSize,f=l.mercatorYfromLat(F[0])*this.worldSize,t=f-p<v.y?v.y/(f-p):0}if(this.lngRange){const F=this.lngRange;_=l.wrap(l.mercatorXfromLng(F[0])*this.worldSize,0,this.worldSize),y=l.wrap(l.mercatorXfromLng(F[1])*this.worldSize,0,this.worldSize),y<_&&(y+=this.worldSize),n=y-_<v.x?v.x/(y-_):0}const I=this.point,C=Math.max(n||0,t||0);if(C)return this.center=this.unproject(new l.pointGeometry(n?(y+_)/2:I.x,t?(f+p)/2:I.y)),this.zoom+=this.scaleZoom(C),this._unmodified=T,void(this._constraining=!1);if(this.latRange){const F=I.y,R=v.y/2;F-R<p&&(u=p+R),F+R>f&&(u=f-R)}if(this.lngRange){const F=(_+y)/2,R=l.wrap(I.x,F-this.worldSize/2,F+this.worldSize/2),B=v.x/2;R-B<_&&(s=_+B),R+B>y&&(s=y-B)}s===void 0&&u===void 0||(this.center=this.unproject(new l.pointGeometry(s!==void 0?s:I.x,u!==void 0?u:I.y)).wrap()),this._unmodified=T,this._constraining=!1}_calcMatrices(){if(!this.height)return;const t=this.centerOffset,n=this.point.x,s=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=l.mercatorZfromAltitude(1,this.center.lat)*this.worldSize;let u=l.identity(new Float64Array(16));l.scale(u,u,[this.width/2,-this.height/2,1]),l.translate(u,u,[1,-1,0]),this.labelPlaneMatrix=u,u=l.identity(new Float64Array(16)),l.scale(u,u,[1,-1,1]),l.translate(u,u,[-1,-1,0]),l.scale(u,u,[2/this.width,2/this.height,1]),this.glCoordMatrix=u,this.cameraToSeaLevelDistance=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch);const p=Math.PI/2+this._pitch,f=this._fov*(.5+t.y/this.height),_=Math.sin(f)*this.cameraToSeaLevelDistance/Math.sin(l.clamp(Math.PI-p-f,.01,Math.PI-.01)),y=this.getHorizon(),v=2*Math.atan(y/this.cameraToCenterDistance)*(.5+t.y/(2*y)),T=Math.sin(v)*this.cameraToSeaLevelDistance/Math.sin(l.clamp(Math.PI-p-v,.01,Math.PI-.01)),I=Math.cos(Math.PI/2-this._pitch)*_+this.cameraToSeaLevelDistance,C=Math.cos(Math.PI/2-this._pitch)*T+this.cameraToSeaLevelDistance,F=1.01*Math.min(I,C),R=this.height/50;u=new Float64Array(16),l.perspective(u,this._fov,this.width/this.height,R,F),u[8]=2*-t.x/this.width,u[9]=2*t.y/this.height,l.scale(u,u,[1,-1,1]),l.translate(u,u,[0,0,-this.cameraToCenterDistance]),l.rotateX(u,u,this._pitch),l.rotateZ(u,u,this.angle),l.translate(u,u,[-n,-s,0]),this.mercatorMatrix=l.scale([],u,[this.worldSize,this.worldSize,this.worldSize]),l.scale(u,u,[1,1,this._pixelPerMeter]),this.pixelMatrix=l.multiply(new Float64Array(16),this.labelPlaneMatrix,u),l.translate(u,u,[0,0,-this.elevation]),this.projMatrix=u,this.invProjMatrix=l.invert([],u),this.pixelMatrix3D=l.multiply(new Float64Array(16),this.labelPlaneMatrix,u);const B=this.width%2/2,X=this.height%2/2,J=Math.cos(this.angle),te=Math.sin(this.angle),O=n-Math.round(n)+J*B+te*X,ne=s-Math.round(s)+J*X+te*B,ie=new Float64Array(u);if(l.translate(ie,ie,[O>.5?O-1:O,ne>.5?ne-1:ne,0]),this.alignedProjMatrix=ie,u=l.invert(new Float64Array(16),this.pixelMatrix),!u)throw new Error("failed to invert matrix");this.pixelMatrixInverse=u,this._posMatrixCache={},this._alignedPosMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const t=this.pointCoordinate(new l.pointGeometry(0,0)),n=[t.x*this.worldSize,t.y*this.worldSize,0,1];return l.transformMat4(n,n,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const t=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new l.pointGeometry(0,t))}getCameraQueryGeometry(t){const n=this.getCameraPoint();if(t.length===1)return[t[0],n];{let s=n.x,u=n.y,p=n.x,f=n.y;for(const _ of t)s=Math.min(s,_.x),u=Math.min(u,_.y),p=Math.max(p,_.x),f=Math.max(f,_.y);return[new l.pointGeometry(s,u),new l.pointGeometry(p,u),new l.pointGeometry(p,f),new l.pointGeometry(s,f),new l.pointGeometry(s,u)]}}}class Ea{constructor(t){this._hashName=t&&encodeURIComponent(t),l.bindAll(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=function(n,s){let u=!1,p=null;const f=()=>{p=null,u&&(n(),p=setTimeout(f,300),u=!1)};return()=>(u=!0,p||f(),p)}(this._updateHashUnthrottled.bind(this))}addTo(t){return this._map=t,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),delete this._map,this}getHashString(t){const n=this._map.getCenter(),s=Math.round(100*this._map.getZoom())/100,u=Math.ceil((s*Math.LN2+Math.log(512/360/.5))/Math.LN10),p=Math.pow(10,u),f=Math.round(n.lng*p)/p,_=Math.round(n.lat*p)/p,y=this._map.getBearing(),v=this._map.getPitch();let T="";if(T+=t?`/${f}/${_}/${s}`:`${s}/${_}/${f}`,(y||v)&&(T+="/"+Math.round(10*y)/10),v&&(T+=`/${Math.round(v)}`),this._hashName){const I=this._hashName;let C=!1;const F=window.location.hash.slice(1).split("&").map(R=>{const B=R.split("=")[0];return B===I?(C=!0,`${B}=${T}`):R}).filter(R=>R);return C||F.push(`${I}=${T}`),`#${F.join("&")}`}return`#${T}`}_getCurrentHash(){const t=window.location.hash.replace("#","");if(this._hashName){let n;return t.split("&").map(s=>s.split("=")).forEach(s=>{s[0]===this._hashName&&(n=s)}),(n&&n[1]||"").split("/")}return t.split("/")}_onHashChange(){const t=this._getCurrentHash();if(t.length>=3&&!t.some(n=>isNaN(n))){const n=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:n,pitch:+(t[4]||0)}),!0}return!1}_updateHashUnthrottled(){const t=window.location.href.replace(/(#.+)?$/,this.getHashString());try{window.history.replaceState(window.history.state,null,t)}catch(n){}}}const no={linearity:.3,easing:l.bezier(0,0,.3,1)},Sa=l.extend({deceleration:2500,maxSpeed:1400},no),Ia=l.extend({deceleration:20,maxSpeed:1400},no),Aa=l.extend({deceleration:1e3,maxSpeed:360},no),zn=l.extend({deceleration:1e3,maxSpeed:90},no);class Ca{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:l.exported.now(),settings:t})}_drainInertiaBuffer(){const t=this._inertiaBuffer,n=l.exported.now();for(;t.length>0&&n-t[0].time>160;)t.shift()}_onMoveEnd(t){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const n={zoom:0,bearing:0,pitch:0,pan:new l.pointGeometry(0,0),pinchAround:void 0,around:void 0};for(const{settings:p}of this._inertiaBuffer)n.zoom+=p.zoomDelta||0,n.bearing+=p.bearingDelta||0,n.pitch+=p.pitchDelta||0,p.panDelta&&n.pan._add(p.panDelta),p.around&&(n.around=p.around),p.pinchAround&&(n.pinchAround=p.pinchAround);const s=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,u={};if(n.pan.mag()){const p=so(n.pan.mag(),s,l.extend({},Sa,t||{}));u.offset=n.pan.mult(p.amount/n.pan.mag()),u.center=this._map.transform.center,oo(u,p)}if(n.zoom){const p=so(n.zoom,s,Ia);u.zoom=this._map.transform.zoom+p.amount,oo(u,p)}if(n.bearing){const p=so(n.bearing,s,Aa);u.bearing=this._map.transform.bearing+l.clamp(p.amount,-179,179),oo(u,p)}if(n.pitch){const p=so(n.pitch,s,zn);u.pitch=this._map.transform.pitch+p.amount,oo(u,p)}if(u.zoom||u.bearing){const p=n.pinchAround===void 0?n.around:n.pinchAround;u.around=p?this._map.unproject(p):this._map.getCenter()}return this.clear(),l.extend(u,{noMoveStart:!0})}}function oo(a,t){(!a.duration||a.duration<t.duration)&&(a.duration=t.duration,a.easing=t.easing)}function so(a,t,n){const{maxSpeed:s,linearity:u,deceleration:p}=n,f=l.clamp(a*u/(t/1e3),-s,s),_=Math.abs(f)/(p*u);return{easing:n.easing,duration:1e3*_,amount:f*(_/2)}}class Mi extends l.Event{constructor(t,n,s,u={}){const p=se.mousePos(n.getCanvasContainer(),s),f=n.unproject(p);super(t,l.extend({point:p,lngLat:f,originalEvent:s},u)),this._defaultPrevented=!1,this.target=n}preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}}class ao extends l.Event{constructor(t,n,s){const u=t==="touchend"?s.changedTouches:s.touches,p=se.touchPos(n.getCanvasContainer(),u),f=p.map(y=>n.unproject(y)),_=p.reduce((y,v,T,I)=>y.add(v.div(I.length)),new l.pointGeometry(0,0));super(t,{points:p,point:_,lngLats:f,lngLat:n.unproject(_),originalEvent:s}),this._defaultPrevented=!1}preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}}class zi extends l.Event{constructor(t,n,s){super(t,{originalEvent:s}),this._defaultPrevented=!1}preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}}class Cl{constructor(t,n){this._map=t,this._clickTolerance=n.clickTolerance}reset(){delete this._mousedownPos}wheel(t){return this._firePreventable(new zi(t.type,this._map,t))}mousedown(t,n){return this._mousedownPos=n,this._firePreventable(new Mi(t.type,this._map,t))}mouseup(t){this._map.fire(new Mi(t.type,this._map,t))}click(t,n){this._mousedownPos&&this._mousedownPos.dist(n)>=this._clickTolerance||this._map.fire(new Mi(t.type,this._map,t))}dblclick(t){return this._firePreventable(new Mi(t.type,this._map,t))}mouseover(t){this._map.fire(new Mi(t.type,this._map,t))}mouseout(t){this._map.fire(new Mi(t.type,this._map,t))}touchstart(t){return this._firePreventable(new ao(t.type,this._map,t))}touchmove(t){this._map.fire(new ao(t.type,this._map,t))}touchend(t){this._map.fire(new ao(t.type,this._map,t))}touchcancel(t){this._map.fire(new ao(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Lr{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(t){this._map.fire(new Mi(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Mi("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._ignoreContextMenu||this._map.fire(new Mi(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Ma{constructor(t,n){this._map=t,this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=n.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(t,n){this.isEnabled()&&t.shiftKey&&t.button===0&&(se.disableDrag(),this._startPos=this._lastPos=n,this._active=!0)}mousemoveWindow(t,n){if(!this._active)return;const s=n;if(this._lastPos.equals(s)||!this._box&&s.dist(this._startPos)<this._clickTolerance)return;const u=this._startPos;this._lastPos=s,this._box||(this._box=se.create("div","maplibregl-boxzoom mapboxgl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair","mapboxgl-crosshair"),this._fireEvent("boxzoomstart",t));const p=Math.min(u.x,s.x),f=Math.max(u.x,s.x),_=Math.min(u.y,s.y),y=Math.max(u.y,s.y);se.setTransform(this._box,`translate(${p}px,${_}px)`),this._box.style.width=f-p+"px",this._box.style.height=y-_+"px"}mouseupWindow(t,n){if(!this._active||t.button!==0)return;const s=this._startPos,u=n;if(this.reset(),se.suppressClick(),s.x!==u.x||s.y!==u.y)return this._map.fire(new l.Event("boxzoomend",{originalEvent:t})),{cameraAnimation:p=>p.fitScreenCoordinates(s,u,this._map.getBearing(),{linear:!0})};this._fireEvent("boxzoomcancel",t)}keydown(t){this._active&&t.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",t))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair","mapboxgl-crosshair"),this._box&&(se.remove(this._box),this._box=null),se.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(t,n){return this._map.fire(new l.Event(t,{originalEvent:n}))}}function _r(a,t){if(a.length!==t.length)throw new Error(`The number of touches and points are not equal - touches ${a.length}, points ${t.length}`);const n={};for(let s=0;s<a.length;s++)n[a[s].identifier]=t[s];return n}class lo{constructor(t){this.reset(),this.numTouches=t.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(t,n,s){(this.centroid||s.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=t.timeStamp),s.length===this.numTouches&&(this.centroid=function(u){const p=new l.pointGeometry(0,0);for(const f of u)p._add(f);return p.div(u.length)}(n),this.touches=_r(s,n)))}touchmove(t,n,s){if(this.aborted||!this.centroid)return;const u=_r(s,n);for(const p in this.touches){const f=this.touches[p],_=u[p];(!_||_.dist(f)>30)&&(this.aborted=!0)}}touchend(t,n,s){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),s.length===0){const u=!this.aborted&&this.centroid;if(this.reset(),u)return u}}}class ws{constructor(t){this.singleTap=new lo(t),this.numTaps=t.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(t,n,s){this.singleTap.touchstart(t,n,s)}touchmove(t,n,s){this.singleTap.touchmove(t,n,s)}touchend(t,n,s){const u=this.singleTap.touchend(t,n,s);if(u){const p=t.timeStamp-this.lastTime<500,f=!this.lastTap||this.lastTap.dist(u)<30;if(p&&f||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=u,this.count===this.numTaps)return this.reset(),u}}}class Ml{constructor(){this._zoomIn=new ws({numTouches:1,numTaps:2}),this._zoomOut=new ws({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(t,n,s){this._zoomIn.touchstart(t,n,s),this._zoomOut.touchstart(t,n,s)}touchmove(t,n,s){this._zoomIn.touchmove(t,n,s),this._zoomOut.touchmove(t,n,s)}touchend(t,n,s){const u=this._zoomIn.touchend(t,n,s),p=this._zoomOut.touchend(t,n,s);return u?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:f=>f.easeTo({duration:300,zoom:f.getZoom()+1,around:f.unproject(u)},{originalEvent:t})}):p?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:f=>f.easeTo({duration:300,zoom:f.getZoom()-1,around:f.unproject(p)},{originalEvent:t})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}const zl={0:1,2:2};class Uo{constructor(t){this.reset(),this._clickTolerance=t.clickTolerance||1}reset(){this._active=!1,this._moved=!1,delete this._lastPoint,delete this._eventButton}_correctButton(t,n){return!1}_move(t,n){return{}}mousedown(t,n){if(this._lastPoint)return;const s=se.mouseButton(t);this._correctButton(t,s)&&(this._lastPoint=n,this._eventButton=s)}mousemoveWindow(t,n){const s=this._lastPoint;if(s){if(t.preventDefault(),function(u,p){const f=zl[p];return u.buttons===void 0||(u.buttons&f)!==f}(t,this._eventButton))this.reset();else if(this._moved||!(n.dist(s)<this._clickTolerance))return this._moved=!0,this._lastPoint=n,this._move(s,n)}}mouseupWindow(t){this._lastPoint&&se.mouseButton(t)===this._eventButton&&(this._moved&&se.suppressClick(),this.reset())}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class co extends Uo{mousedown(t,n){super.mousedown(t,n),this._lastPoint&&(this._active=!0)}_correctButton(t,n){return n===0&&!t.ctrlKey}_move(t,n){return{around:n,panDelta:n.sub(t)}}}class yr extends Uo{_correctButton(t,n){return n===0&&t.ctrlKey||n===2}_move(t,n){const s=.8*(n.x-t.x);if(s)return this._active=!0,{bearingDelta:s}}contextmenu(t){t.preventDefault()}}class Fe extends Uo{_correctButton(t,n){return n===0&&t.ctrlKey||n===2}_move(t,n){const s=-.5*(n.y-t.y);if(s)return this._active=!0,{pitchDelta:s}}contextmenu(t){t.preventDefault()}}class za{constructor(t,n){this._minTouches=t.cooperativeGestures?2:1,this._clickTolerance=t.clickTolerance||1,this._map=n,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new l.pointGeometry(0,0),setTimeout(()=>{this._cancelCooperativeMessage=!1},200)}touchstart(t,n,s){return this._calculateTransform(t,n,s)}touchmove(t,n,s){if(this._map._cooperativeGestures&&(this._minTouches===2&&s.length<2&&!this._cancelCooperativeMessage?this._map._onCooperativeGesture(t,!1,s.length):this._cancelCooperativeMessage||(this._cancelCooperativeMessage=!0)),this._active&&!(s.length<this._minTouches))return t.preventDefault(),this._calculateTransform(t,n,s)}touchend(t,n,s){this._calculateTransform(t,n,s),this._active&&s.length<this._minTouches&&this.reset()}touchcancel(){this.reset()}_calculateTransform(t,n,s){s.length>0&&(this._active=!0);const u=_r(s,n),p=new l.pointGeometry(0,0),f=new l.pointGeometry(0,0);let _=0;for(const v in u){const T=u[v],I=this._touches[v];I&&(p._add(T),f._add(T.sub(I)),_++,u[v]=T)}if(this._touches=u,_<this._minTouches||!f.mag())return;const y=f.div(_);return this._sum._add(y),this._sum.mag()<this._clickTolerance?void 0:{around:p.div(_),panDelta:y}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Yr{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}_start(t){}_move(t,n,s){return{}}touchstart(t,n,s){this._firstTwoTouches||s.length<2||(this._firstTwoTouches=[s[0].identifier,s[1].identifier],this._start([n[0],n[1]]))}touchmove(t,n,s){if(!this._firstTwoTouches)return;t.preventDefault();const[u,p]=this._firstTwoTouches,f=Rr(s,n,u),_=Rr(s,n,p);if(!f||!_)return;const y=this._aroundCenter?null:f.add(_).div(2);return this._move([f,_],y,t)}touchend(t,n,s){if(!this._firstTwoTouches)return;const[u,p]=this._firstTwoTouches,f=Rr(s,n,u),_=Rr(s,n,p);f&&_||(this._active&&se.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(t){this._enabled=!0,this._aroundCenter=!!t&&t.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}function Rr(a,t,n){for(let s=0;s<a.length;s++)if(a[s].identifier===n)return t[s]}function Ts(a,t){return Math.log(a/t)/Math.LN2}class ze extends Yr{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(t){this._startDistance=this._distance=t[0].dist(t[1])}_move(t,n){const s=this._distance;if(this._distance=t[0].dist(t[1]),this._active||!(Math.abs(Ts(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:Ts(this._distance,s),pinchAround:n}}}function $o(a,t){return 180*a.angleWith(t)/Math.PI}class Pl extends Yr{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,n){const s=this._vector;if(this._vector=t[0].sub(t[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:$o(this._vector,s),pinchAround:n}}_isBelowThreshold(t){this._minDiameter=Math.min(this._minDiameter,t.mag());const n=25/(Math.PI*this._minDiameter)*360,s=$o(t,this._startVector);return Math.abs(s)<n}}function Es(a){return Math.abs(a.y)>Math.abs(a.x)}class Ss extends Yr{constructor(t){super(),this._map=t}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(t,n,s){super.touchstart(t,n,s),this._currentTouchCount=s.length}_start(t){this._lastPoints=t,Es(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,n,s){if(this._map._cooperativeGestures&&this._currentTouchCount<3)return;const u=t[0].sub(this._lastPoints[0]),p=t[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(u,p,s.timeStamp),this._valid?(this._lastPoints=t,this._active=!0,{pitchDelta:(u.y+p.y)/2*-.5}):void 0}gestureBeginsVertically(t,n,s){if(this._valid!==void 0)return this._valid;const u=t.mag()>=2,p=n.mag()>=2;if(!u&&!p)return;if(!u||!p)return this._firstMove===void 0&&(this._firstMove=s),s-this._firstMove<100&&void 0;const f=t.y>0==n.y>0;return Es(t)&&Es(n)&&f}}const Pa={panStep:100,bearingStep:15,pitchStep:10};class ka{constructor(){const t=Pa;this._panStep=t.panStep,this._bearingStep=t.bearingStep,this._pitchStep=t.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(t){if(t.altKey||t.ctrlKey||t.metaKey)return;let n=0,s=0,u=0,p=0,f=0;switch(t.keyCode){case 61:case 107:case 171:case 187:n=1;break;case 189:case 109:case 173:n=-1;break;case 37:t.shiftKey?s=-1:(t.preventDefault(),p=-1);break;case 39:t.shiftKey?s=1:(t.preventDefault(),p=1);break;case 38:t.shiftKey?u=1:(t.preventDefault(),f=-1);break;case 40:t.shiftKey?u=-1:(t.preventDefault(),f=1);break;default:return}return this._rotationDisabled&&(s=0,u=0),{cameraAnimation:_=>{const y=_.getZoom();_.easeTo({duration:300,easeId:"keyboardHandler",easing:kl,zoom:n?Math.round(y)+n*(t.shiftKey?2:1):y,bearing:_.getBearing()+s*this._bearingStep,pitch:_.getPitch()+u*this._pitchStep,offset:[-p*this._panStep,-f*this._panStep],center:_.getCenter()},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function kl(a){return a*(2-a)}const Da=4.000244140625;class Is{constructor(t,n){this._map=t,this._el=t.getCanvasContainer(),this._handler=n,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222,l.bindAll(["_onTimeout"],this)}setZoomRate(t){this._defaultZoomRate=t}setWheelZoomRate(t){this._wheelZoomRate=t}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=t&&t.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}wheel(t){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!this._map._metaPress)return;t.preventDefault()}let n=t.deltaMode===WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY;const s=l.exported.now(),u=s-(this._lastWheelEventTime||0);this._lastWheelEventTime=s,n!==0&&n%Da==0?this._type="wheel":n!==0&&Math.abs(n)<4?this._type="trackpad":u>400?(this._type=null,this._lastValue=n,this._timeout=setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(u*n)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,n+=this._lastValue)),t.shiftKey&&n&&(n/=4),this._type&&(this._lastWheelEvent=t,this._delta-=n,this._active||this._start(t)),t.preventDefault()}_onTimeout(t){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(t)}_start(t){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const n=se.mousePos(this._el,t);this._around=l.LngLat.convert(this._aroundCenter?this._map.getCenter():this._map.unproject(n)),this._aroundPoint=this._map.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const t=this._map.transform;if(this._delta!==0){const _=this._type==="wheel"&&Math.abs(this._delta)>Da?this._wheelZoomRate:this._defaultZoomRate;let y=2/(1+Math.exp(-Math.abs(this._delta*_)));this._delta<0&&y!==0&&(y=1/y);const v=typeof this._targetZoom=="number"?t.zoomScale(this._targetZoom):t.scale;this._targetZoom=Math.min(t.maxZoom,Math.max(t.minZoom,t.scaleZoom(v*y))),this._type==="wheel"&&(this._startZoom=t.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const n=typeof this._targetZoom=="number"?this._targetZoom:t.zoom,s=this._startZoom,u=this._easing;let p,f=!1;if(this._type==="wheel"&&s&&u){const _=Math.min((l.exported.now()-this._lastWheelEventTime)/200,1),y=u(_);p=l.number(s,n,y),_<1?this._frameId||(this._frameId=!0):f=!0}else p=n,f=!0;return this._active=!0,f&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!f,zoomDelta:p-t.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let n=l.ease;if(this._prevEase){const s=this._prevEase,u=(l.exported.now()-s.start)/s.duration,p=s.easing(u+.01)-s.easing(u),f=.27/Math.sqrt(p*p+1e-4)*.01,_=Math.sqrt(.0729-f*f);n=l.bezier(f,_,.25,1)}return this._prevEase={start:l.exported.now(),duration:t,easing:n},n}reset(){this._active=!1}}class As{constructor(t,n){this._clickZoom=t,this._tapZoom=n}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class Cs{constructor(){this.reset()}reset(){this._active=!1}dblclick(t,n){return t.preventDefault(),{cameraAnimation:s=>{s.easeTo({duration:300,zoom:s.getZoom()+(t.shiftKey?-1:1),around:s.unproject(n)},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Ms{constructor(){this._tap=new ws({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,this._tap.reset()}touchstart(t,n,s){this._swipePoint||(this._tapTime&&t.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?s.length>0&&(this._swipePoint=n[0],this._swipeTouch=s[0].identifier):this._tap.touchstart(t,n,s))}touchmove(t,n,s){if(this._tapTime){if(this._swipePoint){if(s[0].identifier!==this._swipeTouch)return;const u=n[0],p=u.y-this._swipePoint.y;return this._swipePoint=u,t.preventDefault(),this._active=!0,{zoomDelta:p/128}}}else this._tap.touchmove(t,n,s)}touchend(t,n,s){this._tapTime?this._swipePoint&&s.length===0&&this.reset():this._tap.touchend(t,n,s)&&(this._tapTime=t.timeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class vi{constructor(t,n,s){this._el=t,this._mousePan=n,this._touchPan=s}enable(t){this._inertiaOptions=t||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan","mapboxgl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan","mapboxgl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class Br{constructor(t,n,s){this._pitchWithRotate=t.pitchWithRotate,this._mouseRotate=n,this._mousePitch=s}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class La{constructor(t,n,s,u){this._el=t,this._touchZoom=n,this._touchRotate=s,this._tapDragZoom=u,this._rotationDisabled=!1,this._enabled=!0}enable(t){this._touchZoom.enable(t),this._rotationDisabled||this._touchRotate.enable(t),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate","mapboxgl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate","mapboxgl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}const Pn=a=>a.zoom||a.drag||a.pitch||a.rotate;class zs extends l.Event{}function uo(a){return a.panDelta&&a.panDelta.mag()||a.zoomDelta||a.bearingDelta||a.pitchDelta}class Ra{constructor(t,n){this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Ca(t),this._bearingSnap=n.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(n),l.bindAll(["handleEvent","handleWindowEvent"],this);const s=this._el;this._listeners=[[s,"touchstart",{passive:!0}],[s,"touchmove",{passive:!1}],[s,"touchend",void 0],[s,"touchcancel",void 0],[s,"mousedown",void 0],[s,"mousemove",void 0],[s,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[s,"mouseover",void 0],[s,"mouseout",void 0],[s,"dblclick",void 0],[s,"click",void 0],[s,"keydown",{capture:!1}],[s,"keyup",void 0],[s,"wheel",{passive:!1}],[s,"contextmenu",void 0],[window,"blur",void 0]];for(const[u,p,f]of this._listeners)se.addEventListener(u,p,u===document?this.handleWindowEvent:this.handleEvent,f)}destroy(){for(const[t,n,s]of this._listeners)se.removeEventListener(t,n,t===document?this.handleWindowEvent:this.handleEvent,s)}_addDefaultHandlers(t){const n=this._map,s=n.getCanvasContainer();this._add("mapEvent",new Cl(n,t));const u=n.boxZoom=new Ma(n,t);this._add("boxZoom",u);const p=new Ml,f=new Cs;n.doubleClickZoom=new As(f,p),this._add("tapZoom",p),this._add("clickZoom",f);const _=new Ms;this._add("tapDragZoom",_);const y=n.touchPitch=new Ss(n);this._add("touchPitch",y);const v=new yr(t),T=new Fe(t);n.dragRotate=new Br(t,v,T),this._add("mouseRotate",v,["mousePitch"]),this._add("mousePitch",T,["mouseRotate"]);const I=new co(t),C=new za(t,n);n.dragPan=new vi(s,I,C),this._add("mousePan",I),this._add("touchPan",C,["touchZoom","touchRotate"]);const F=new Pl,R=new ze;n.touchZoomRotate=new La(s,R,F,_),this._add("touchRotate",F,["touchPan","touchZoom"]),this._add("touchZoom",R,["touchPan","touchRotate"]);const B=n.scrollZoom=new Is(n,this);this._add("scrollZoom",B,["mousePan"]);const X=n.keyboard=new ka;this._add("keyboard",X),this._add("blockableMapEvent",new Lr(n));for(const J of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])t.interactive&&t[J]&&n[J].enable(t[J])}_add(t,n,s){this._handlers.push({handlerName:t,handler:n,allowed:s}),this._handlersById[t]=n}stop(t){if(!this._updatingCamera){for(const{handler:n}of this._handlers)n.reset();this._inertia.clear(),this._fireEvents({},{},t),this._changes=[]}}isActive(){for(const{handler:t}of this._handlers)if(t.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return Boolean(Pn(this._eventsInProgress))||this.isZooming()}_blockedByActive(t,n,s){for(const u in t)if(u!==s&&(!n||n.indexOf(u)<0))return!0;return!1}handleWindowEvent(t){this.handleEvent(t,`${t.type}Window`)}_getMapTouches(t){const n=[];for(const s of t)this._el.contains(s.target)&&n.push(s);return n}handleEvent(t,n){if(t.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const s=t.type==="renderFrame"?void 0:t,u={needsRenderFrame:!1},p={},f={},_=t.touches,y=_?this._getMapTouches(_):void 0,v=y?se.touchPos(this._el,y):se.mousePos(this._el,t);for(const{handlerName:C,handler:F,allowed:R}of this._handlers){if(!F.isEnabled())continue;let B;this._blockedByActive(f,R,C)?F.reset():F[n||t.type]&&(B=F[n||t.type](t,v,y),this.mergeHandlerResult(u,p,B,C,s),B&&B.needsRenderFrame&&this._triggerRenderFrame()),(B||F.isActive())&&(f[C]=F)}const T={};for(const C in this._previousActiveHandlers)f[C]||(T[C]=s);this._previousActiveHandlers=f,(Object.keys(T).length||uo(u))&&(this._changes.push([u,p,T]),this._triggerRenderFrame()),(Object.keys(f).length||uo(u))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:I}=u;I&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],I(this._map))}mergeHandlerResult(t,n,s,u,p){if(!s)return;l.extend(t,s);const f={handlerName:u,originalEvent:s.originalEvent||p};s.zoomDelta!==void 0&&(n.zoom=f),s.panDelta!==void 0&&(n.drag=f),s.pitchDelta!==void 0&&(n.pitch=f),s.bearingDelta!==void 0&&(n.rotate=f)}_applyChanges(){const t={},n={},s={};for(const[u,p,f]of this._changes)u.panDelta&&(t.panDelta=(t.panDelta||new l.pointGeometry(0,0))._add(u.panDelta)),u.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+u.zoomDelta),u.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+u.bearingDelta),u.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+u.pitchDelta),u.around!==void 0&&(t.around=u.around),u.pinchAround!==void 0&&(t.pinchAround=u.pinchAround),u.noInertia&&(t.noInertia=u.noInertia),l.extend(n,p),l.extend(s,f);this._updateMapTransform(t,n,s),this._changes=[]}_updateMapTransform(t,n,s){const u=this._map,p=u.transform,f=u.style&&u.style.terrain;if(!(uo(t)||f&&this._drag))return this._fireEvents(n,s,!0);let{panDelta:_,zoomDelta:y,bearingDelta:v,pitchDelta:T,around:I,pinchAround:C}=t;C!==void 0&&(I=C),u._stop(!0),I=I||u.transform.centerPoint;const F=p.pointLocation(_?I.sub(_):I);v&&(p.bearing+=v),T&&(p.pitch+=T),y&&(p.zoom+=y),f?n.drag&&!this._drag?(this._drag={center:p.centerPoint,lngLat:p.pointLocation(I),point:I,handlerName:n.drag.handlerName},u.fire(new l.Event("freezeElevation",{freeze:!0}))):this._drag&&s[this._drag.handlerName]?(u.fire(new l.Event("freezeElevation",{freeze:!1})),this._drag=null):n.drag&&this._drag&&(p.center=p.pointLocation(p.centerPoint.sub(_))):p.setLocationAtPoint(F,I),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(n,s,!0)}_fireEvents(t,n,s){const u=Pn(this._eventsInProgress),p=Pn(t),f={};for(const T in t){const{originalEvent:I}=t[T];this._eventsInProgress[T]||(f[`${T}start`]=I),this._eventsInProgress[T]=t[T]}!u&&p&&this._fireEvent("movestart",p.originalEvent);for(const T in f)this._fireEvent(T,f[T]);p&&this._fireEvent("move",p.originalEvent);for(const T in t){const{originalEvent:I}=t[T];this._fireEvent(T,I)}const _={};let y;for(const T in this._eventsInProgress){const{handlerName:I,originalEvent:C}=this._eventsInProgress[T];this._handlersById[I].isActive()||(delete this._eventsInProgress[T],y=n[I]||C,_[`${T}end`]=y)}for(const T in _)this._fireEvent(T,_[T]);const v=Pn(this._eventsInProgress);if(s&&(u||p)&&!v){this._updatingCamera=!0;const T=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),I=C=>C!==0&&-this._bearingSnap<C&&C<this._bearingSnap;T?(I(T.bearing||this._map.getBearing())&&(T.bearing=0),this._map.easeTo(T,{originalEvent:y})):(this._map.fire(new l.Event("moveend",{originalEvent:y})),I(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(t,n){this._map.fire(new l.Event(t,n?{originalEvent:n}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(t=>{delete this._frameId,this.handleEvent(new zs("renderFrame",{timeStamp:t})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}const Ui={extend:(a,...t)=>l.extend(a,...t),run(a){a()},logToElement(a,t=!1,n="log"){const s=window.document.getElementById(n);s&&(t&&(s.innerHTML=""),s.innerHTML+=`<br>${a}`)}};class Rt extends l.Evented{constructor(t,n){super(),this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=n.bearingSnap,l.bindAll(["_renderFrameCallback"],this)}getCenter(){return new l.LngLat(this.transform.center.lng,this.transform.center.lat)}setCenter(t,n){return this.jumpTo({center:t},n)}panBy(t,n,s){return t=l.pointGeometry.convert(t).mult(-1),this.panTo(this.transform.center,l.extend({offset:t},n),s)}panTo(t,n,s){return this.easeTo(l.extend({center:t},n),s)}getZoom(){return this.transform.zoom}setZoom(t,n){return this.jumpTo({zoom:t},n),this}zoomTo(t,n,s){return this.easeTo(l.extend({zoom:t},n),s)}zoomIn(t,n){return this.zoomTo(this.getZoom()+1,t,n),this}zoomOut(t,n){return this.zoomTo(this.getZoom()-1,t,n),this}getBearing(){return this.transform.bearing}setBearing(t,n){return this.jumpTo({bearing:t},n),this}getPadding(){return this.transform.padding}setPadding(t,n){return this.jumpTo({padding:t},n),this}rotateTo(t,n,s){return this.easeTo(l.extend({bearing:t},n),s)}resetNorth(t,n){return this.rotateTo(0,l.extend({duration:1e3},t),n),this}resetNorthPitch(t,n){return this.easeTo(l.extend({bearing:0,pitch:0,duration:1e3},t),n),this}snapToNorth(t,n){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(t,n):this}getPitch(){return this.transform.pitch}setPitch(t,n){return this.jumpTo({pitch:t},n),this}cameraForBounds(t,n){t=l.LngLatBounds.convert(t);const s=n&&n.bearing||0;return this._cameraForBoxAndBearing(t.getNorthWest(),t.getSouthEast(),s,n)}_cameraForBoxAndBearing(t,n,s,u){const p={top:0,bottom:0,right:0,left:0};if(typeof(u=l.extend({padding:p,offset:[0,0],maxZoom:this.transform.maxZoom},u)).padding=="number"){const ie=u.padding;u.padding={top:ie,bottom:ie,right:ie,left:ie}}u.padding=l.extend(p,u.padding);const f=this.transform,_=f.padding,y=f.project(l.LngLat.convert(t)),v=f.project(l.LngLat.convert(n)),T=y.rotate(-s*Math.PI/180),I=v.rotate(-s*Math.PI/180),C=new l.pointGeometry(Math.max(T.x,I.x),Math.max(T.y,I.y)),F=new l.pointGeometry(Math.min(T.x,I.x),Math.min(T.y,I.y)),R=C.sub(F),B=(f.width-(_.left+_.right+u.padding.left+u.padding.right))/R.x,X=(f.height-(_.top+_.bottom+u.padding.top+u.padding.bottom))/R.y;if(X<0||B<0)return void l.warnOnce("Map cannot fit within canvas with the given bounds, padding, and/or offset.");const J=Math.min(f.scaleZoom(f.scale*Math.min(B,X)),u.maxZoom),te=l.pointGeometry.convert(u.offset),O=new l.pointGeometry((u.padding.left-u.padding.right)/2,(u.padding.top-u.padding.bottom)/2).rotate(s*Math.PI/180),ne=te.add(O).mult(f.scale/f.zoomScale(J));return{center:f.unproject(y.add(v).div(2).sub(ne)),zoom:J,bearing:s}}fitBounds(t,n,s){return this._fitInternal(this.cameraForBounds(t,n),n,s)}fitScreenCoordinates(t,n,s,u,p){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(l.pointGeometry.convert(t)),this.transform.pointLocation(l.pointGeometry.convert(n)),s,u),u,p)}_fitInternal(t,n,s){return t?(delete(n=l.extend(t,n)).padding,n.linear?this.easeTo(n,s):this.flyTo(n,s)):this}jumpTo(t,n){this.stop();const s=this.transform;let u=!1,p=!1,f=!1;return"zoom"in t&&s.zoom!==+t.zoom&&(u=!0,s.zoom=+t.zoom),t.center!==void 0&&(s.center=l.LngLat.convert(t.center)),"bearing"in t&&s.bearing!==+t.bearing&&(p=!0,s.bearing=+t.bearing),"pitch"in t&&s.pitch!==+t.pitch&&(f=!0,s.pitch=+t.pitch),t.padding==null||s.isPaddingEqual(t.padding)||(s.padding=t.padding),this.fire(new l.Event("movestart",n)).fire(new l.Event("move",n)),u&&this.fire(new l.Event("zoomstart",n)).fire(new l.Event("zoom",n)).fire(new l.Event("zoomend",n)),p&&this.fire(new l.Event("rotatestart",n)).fire(new l.Event("rotate",n)).fire(new l.Event("rotateend",n)),f&&this.fire(new l.Event("pitchstart",n)).fire(new l.Event("pitch",n)).fire(new l.Event("pitchend",n)),this.fire(new l.Event("moveend",n))}calculateCameraOptionsFromTo(t,n,s,u=0){const p=l.MercatorCoordinate.fromLngLat(t,n),f=l.MercatorCoordinate.fromLngLat(s,u),_=f.x-p.x,y=f.y-p.y,v=f.z-p.z,T=Math.hypot(_,y,v);if(T===0)throw new Error("Can't calculate camera options with same From and To");const I=Math.hypot(_,y),C=this.transform.scaleZoom(this.transform.cameraToCenterDistance/T/this.transform.tileSize),F=180*Math.atan2(_,-y)/Math.PI;let R=180*Math.acos(I/T)/Math.PI;return R=v<0?90-R:90+R,{center:f.toLngLat(),zoom:C,pitch:R,bearing:F}}easeTo(t,n){this._stop(!1,t.easeId),((t=l.extend({offset:[0,0],duration:500,easing:l.ease},t)).animate===!1||!t.essential&&l.exported.prefersReducedMotion)&&(t.duration=0);const s=this.transform,u=this.getZoom(),p=this.getBearing(),f=this.getPitch(),_=this.getPadding(),y="zoom"in t?+t.zoom:u,v="bearing"in t?this._normalizeBearing(t.bearing,p):p,T="pitch"in t?+t.pitch:f,I="padding"in t?t.padding:s.padding,C=l.pointGeometry.convert(t.offset);let F=s.centerPoint.add(C);const R=s.pointLocation(F),B=l.LngLat.convert(t.center||R);this._normalizeCenter(B);const X=s.project(R),J=s.project(B).sub(X),te=s.zoomScale(y-u);let O,ne;t.around&&(O=l.LngLat.convert(t.around),ne=s.locationPoint(O));const ie={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||y!==u,this._rotating=this._rotating||p!==v,this._pitching=this._pitching||T!==f,this._padding=!s.isPaddingEqual(I),this._easeId=t.easeId,this._prepareEase(n,t.noMoveStart,ie),this._ease(ue=>{if(this._zooming&&(s.zoom=l.number(u,y,ue)),this._rotating&&(s.bearing=l.number(p,v,ue)),this._pitching&&(s.pitch=l.number(f,T,ue)),this._padding&&(s.interpolatePadding(_,I,ue),F=s.centerPoint.add(C)),O)s.setLocationAtPoint(O,ne);else{const he=s.zoomScale(s.zoom-u),ye=y>u?Math.min(2,te):Math.max(.5,te),ce=Math.pow(ye,1-ue),Le=s.unproject(X.add(J.mult(ue*ce)).mult(he));s.setLocationAtPoint(s.renderWorldCopies?Le.wrap():Le,F)}this._fireMoveEvents(n)},ue=>{this._afterEase(n,ue)},t),this}_prepareEase(t,n,s={}){this._moving=!0,this.fire(new l.Event("freezeElevation",{freeze:!0})),n||s.moving||this.fire(new l.Event("movestart",t)),this._zooming&&!s.zooming&&this.fire(new l.Event("zoomstart",t)),this._rotating&&!s.rotating&&this.fire(new l.Event("rotatestart",t)),this._pitching&&!s.pitching&&this.fire(new l.Event("pitchstart",t))}_fireMoveEvents(t){this.fire(new l.Event("move",t)),this._zooming&&this.fire(new l.Event("zoom",t)),this._rotating&&this.fire(new l.Event("rotate",t)),this._pitching&&this.fire(new l.Event("pitch",t))}_afterEase(t,n){if(this._easeId&&n&&this._easeId===n)return;delete this._easeId,this.fire(new l.Event("freezeElevation",{freeze:!1}));const s=this._zooming,u=this._rotating,p=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,s&&this.fire(new l.Event("zoomend",t)),u&&this.fire(new l.Event("rotateend",t)),p&&this.fire(new l.Event("pitchend",t)),this.fire(new l.Event("moveend",t))}flyTo(t,n){if(!t.essential&&l.exported.prefersReducedMotion){const Ge=l.pick(t,["center","zoom","bearing","pitch","around"]);return this.jumpTo(Ge,n)}this.stop(),t=l.extend({offset:[0,0],speed:1.2,curve:1.42,easing:l.ease},t);const s=this.transform,u=this.getZoom(),p=this.getBearing(),f=this.getPitch(),_=this.getPadding(),y="zoom"in t?l.clamp(+t.zoom,s.minZoom,s.maxZoom):u,v="bearing"in t?this._normalizeBearing(t.bearing,p):p,T="pitch"in t?+t.pitch:f,I="padding"in t?t.padding:s.padding,C=s.zoomScale(y-u),F=l.pointGeometry.convert(t.offset);let R=s.centerPoint.add(F);const B=s.pointLocation(R),X=l.LngLat.convert(t.center||B);this._normalizeCenter(X);const J=s.project(B),te=s.project(X).sub(J);let O=t.curve;const ne=Math.max(s.width,s.height),ie=ne/C,ue=te.mag();if("minZoom"in t){const Ge=l.clamp(Math.min(t.minZoom,u,y),s.minZoom,s.maxZoom),bt=ne/s.zoomScale(Ge-u);O=Math.sqrt(bt/ue*2)}const he=O*O;function ye(Ge){const bt=(ie*ie-ne*ne+(Ge?-1:1)*he*he*ue*ue)/(2*(Ge?ie:ne)*he*ue);return Math.log(Math.sqrt(bt*bt+1)-bt)}function ce(Ge){return(Math.exp(Ge)-Math.exp(-Ge))/2}function Le(Ge){return(Math.exp(Ge)+Math.exp(-Ge))/2}const Ie=ye(0);let Re=function(Ge){return Le(Ie)/Le(Ie+O*Ge)},Qe=function(Ge){return ne*((Le(Ie)*(ce(bt=Ie+O*Ge)/Le(bt))-ce(Ie))/he)/ue;var bt},it=(ye(1)-Ie)/O;if(Math.abs(ue)<1e-6||!isFinite(it)){if(Math.abs(ne-ie)<1e-6)return this.easeTo(t,n);const Ge=ie<ne?-1:1;it=Math.abs(Math.log(ie/ne))/O,Qe=function(){return 0},Re=function(bt){return Math.exp(Ge*O*bt)}}return t.duration="duration"in t?+t.duration:1e3*it/("screenSpeed"in t?+t.screenSpeed/O:+t.speed),t.maxDuration&&t.duration>t.maxDuration&&(t.duration=0),this._zooming=!0,this._rotating=p!==v,this._pitching=T!==f,this._padding=!s.isPaddingEqual(I),this._prepareEase(n,!1),this._ease(Ge=>{const bt=Ge*it,wt=1/Re(bt);s.zoom=Ge===1?y:u+s.scaleZoom(wt),this._rotating&&(s.bearing=l.number(p,v,Ge)),this._pitching&&(s.pitch=l.number(f,T,Ge)),this._padding&&(s.interpolatePadding(_,I,Ge),R=s.centerPoint.add(F));const ut=Ge===1?X:s.unproject(J.add(te.mult(Qe(bt))).mult(wt));s.setLocationAtPoint(s.renderWorldCopies?ut.wrap():ut,R),this._fireMoveEvents(n)},()=>this._afterEase(n),t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(t,n){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const s=this._onEaseEnd;delete this._onEaseEnd,s.call(this,n)}if(!t){const s=this.handlers;s&&s.stop(!1)}return this}_ease(t,n,s){s.animate===!1||s.duration===0?(t(1),n()):(this._easeStart=l.exported.now(),this._easeOptions=s,this._onEaseFrame=t,this._onEaseEnd=n,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){const t=Math.min((l.exported.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(t)),t<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(t,n){t=l.wrap(t,-180,180);const s=Math.abs(t-n);return Math.abs(t-360-n)<s&&(t-=360),Math.abs(t+360-n)<s&&(t+=360),t}_normalizeCenter(t){const n=this.transform;if(!n.renderWorldCopies||n.lngRange)return;const s=t.lng-n.center.lng;t.lng+=s>180?-360:s<-180?360:0}}class ho{constructor(t={}){this.options=t,l.bindAll(["_toggleAttribution","_updateData","_updateCompact","_updateCompactMinimize"],this)}getDefaultPosition(){return"bottom-right"}onAdd(t){return this._map=t,this._compact=this.options&&this.options.compact,this._container=se.create("details","maplibregl-ctrl maplibregl-ctrl-attrib mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=se.create("summary","maplibregl-ctrl-attrib-button mapboxgl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=se.create("div","maplibregl-ctrl-attrib-inner mapboxgl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("terrain",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container}onRemove(){se.remove(this._container),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,n){const s=this._map._getUIString(`AttributionControl.${n}`);t.title=s,t.setAttribute("aria-label",s)}_toggleAttribution(){this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show","mapboxgl-compact-show")):(this._container.classList.add("maplibregl-compact-show","mapboxgl-compact-show"),this._container.removeAttribute("open")))}_updateData(t){!t||t.sourceDataType!=="metadata"&&t.sourceDataType!=="visibility"&&t.dataType!=="style"&&t.type!=="terrain"||this._updateAttributions()}_updateAttributions(){if(!this._map.style)return;let t=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=t.concat(this.options.customAttribution.map(u=>typeof u!="string"?"":u)):typeof this.options.customAttribution=="string"&&t.push(this.options.customAttribution)),this._map.style.stylesheet){const u=this._map.style.stylesheet;this.styleOwner=u.owner,this.styleId=u.id}const n=this._map.style.sourceCaches;for(const u in n){const p=n[u];if(p.used||p.usedForTerrain){const f=p.getSource();f.attribution&&t.indexOf(f.attribution)<0&&t.push(f.attribution)}}t=t.filter(u=>String(u).trim()),t.sort((u,p)=>u.length-p.length),t=t.filter((u,p)=>{for(let f=p+1;f<t.length;f++)if(t[f].indexOf(u)>=0)return!1;return!0});const s=t.join(" | ");s!==this._attribHTML&&(this._attribHTML=s,t.length?(this._innerContainer.innerHTML=s,this._container.classList.remove("maplibregl-attrib-empty","mapboxgl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty","mapboxgl-attrib-empty"),this._updateCompact(),this._editLink=null)}_updateCompact(){this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact===!1?this._container.setAttribute("open",""):this._container.classList.contains("maplibregl-compact")||this._container.classList.contains("maplibregl-attrib-empty")||(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","mapboxgl-compact","maplibregl-compact-show","mapboxgl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show","mapboxgl-compact","mapboxgl-compact-show"))}_updateCompactMinimize(){this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show","mapboxgl-compact-show")}}class Vo{constructor(t={}){this.options=t,l.bindAll(["_updateCompact"],this)}getDefaultPosition(){return"bottom-left"}onAdd(t){this._map=t,this._compact=this.options&&this.options.compact,this._container=se.create("div","maplibregl-ctrl mapboxgl-ctrl");const n=se.create("a","maplibregl-ctrl-logo mapboxgl-ctrl-logo");return n.target="_blank",n.rel="noopener nofollow",n.href="https://maplibre.org/",n.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),n.setAttribute("rel","noopener nofollow"),this._container.appendChild(n),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){se.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}_updateCompact(){const t=this._container.children;if(t.length){const n=t[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&n.classList.add("maplibregl-compact","mapboxgl-compact"):n.classList.remove("maplibregl-compact","mapboxgl-compact")}}}class Ba{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(t){const n=++this._id;return this._queue.push({callback:t,id:n,cancelled:!1}),n}remove(t){const n=this._currentlyRunning,s=n?this._queue.concat(n):this._queue;for(const u of s)if(u.id===t)return void(u.cancelled=!0)}run(t=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const n=this._currentlyRunning=this._queue;this._queue=[];for(const s of n)if(!s.cancelled&&(s.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}const Fa={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"Mapbox logo","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","TerrainControl.enableTerrain":"Enable terrain","TerrainControl.disableTerrain":"Disable terrain"},Oa={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:void 0,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,maplibreLogo:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,maxTileCacheSize:null,localIdeographFontFamily:"sans-serif",transformRequest:null,fadeDuration:300,crossSourceCollisions:!0},Dl={showCompass:!0,showZoom:!0,visualizePitch:!1};class ir{constructor(t,n,s=!1){this._clickTolerance=10,this.element=n,this.mouseRotate=new yr({clickTolerance:t.dragRotate._mouseRotate._clickTolerance}),this.map=t,s&&(this.mousePitch=new Fe({clickTolerance:t.dragRotate._mousePitch._clickTolerance})),l.bindAll(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),se.addEventListener(n,"mousedown",this.mousedown),se.addEventListener(n,"touchstart",this.touchstart,{passive:!1}),se.addEventListener(n,"touchmove",this.touchmove),se.addEventListener(n,"touchend",this.touchend),se.addEventListener(n,"touchcancel",this.reset)}down(t,n){this.mouseRotate.mousedown(t,n),this.mousePitch&&this.mousePitch.mousedown(t,n),se.disableDrag()}move(t,n){const s=this.map,u=this.mouseRotate.mousemoveWindow(t,n);if(u&&u.bearingDelta&&s.setBearing(s.getBearing()+u.bearingDelta),this.mousePitch){const p=this.mousePitch.mousemoveWindow(t,n);p&&p.pitchDelta&&s.setPitch(s.getPitch()+p.pitchDelta)}}off(){const t=this.element;se.removeEventListener(t,"mousedown",this.mousedown),se.removeEventListener(t,"touchstart",this.touchstart,{passive:!1}),se.removeEventListener(t,"touchmove",this.touchmove),se.removeEventListener(t,"touchend",this.touchend),se.removeEventListener(t,"touchcancel",this.reset),this.offTemp()}offTemp(){se.enableDrag(),se.removeEventListener(window,"mousemove",this.mousemove),se.removeEventListener(window,"mouseup",this.mouseup)}mousedown(t){this.down(l.extend({},t,{ctrlKey:!0,preventDefault:()=>t.preventDefault()}),se.mousePos(this.element,t)),se.addEventListener(window,"mousemove",this.mousemove),se.addEventListener(window,"mouseup",this.mouseup)}mousemove(t){this.move(t,se.mousePos(this.element,t))}mouseup(t){this.mouseRotate.mouseupWindow(t),this.mousePitch&&this.mousePitch.mouseupWindow(t),this.offTemp()}touchstart(t){t.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=se.touchPos(this.element,t.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:()=>t.preventDefault()},this._startPos))}touchmove(t){t.targetTouches.length!==1?this.reset():(this._lastPos=se.touchPos(this.element,t.targetTouches)[0],this.move({preventDefault:()=>t.preventDefault()},this._lastPos))}touchend(t){t.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),this.reset()}reset(){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()}}function po(a,t,n){if(a=new l.LngLat(a.lng,a.lat),t){const s=new l.LngLat(a.lng-360,a.lat),u=new l.LngLat(a.lng+360,a.lat),p=n.locationPoint(a).distSqr(t);n.locationPoint(s).distSqr(t)<p?a=s:n.locationPoint(u).distSqr(t)<p&&(a=u)}for(;Math.abs(a.lng-n.center.lng)>180;){const s=n.locationPoint(a);if(s.x>=0&&s.y>=0&&s.x<=n.width&&s.y<=n.height)break;a.lng>n.center.lng?a.lng-=360:a.lng+=360}return a}const Ve={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 je(a,t,n){const s=a.classList;for(const u in Ve)s.remove(`maplibregl-${n}-anchor-${u}`,`mapboxgl-${n}-anchor-${u}`);s.add(`maplibregl-${n}-anchor-${t}`,`mapboxgl-${n}-anchor-${t}`)}class kn extends l.Evented{constructor(t,n){if(super(),(t instanceof HTMLElement||n)&&(t=l.extend({element:t},n)),l.bindAll(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress"],this),this._anchor=t&&t.anchor||"center",this._color=t&&t.color||"#3FB1CE",this._scale=t&&t.scale||1,this._draggable=t&&t.draggable||!1,this._clickTolerance=t&&t.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=t&&t.rotation||0,this._rotationAlignment=t&&t.rotationAlignment||"auto",this._pitchAlignment=t&&t.pitchAlignment&&t.pitchAlignment!=="auto"?t.pitchAlignment:this._rotationAlignment,t&&t.element)this._element=t.element,this._offset=l.pointGeometry.convert(t&&t.offset||[0,0]);else{this._defaultMarker=!0,this._element=se.create("div"),this._element.setAttribute("aria-label","Map marker");const s=se.createNS("http://www.w3.org/2000/svg","svg"),u=41,p=27;s.setAttributeNS(null,"display","block"),s.setAttributeNS(null,"height",`${u}px`),s.setAttributeNS(null,"width",`${p}px`),s.setAttributeNS(null,"viewBox",`0 0 ${p} ${u}`);const f=se.createNS("http://www.w3.org/2000/svg","g");f.setAttributeNS(null,"stroke","none"),f.setAttributeNS(null,"stroke-width","1"),f.setAttributeNS(null,"fill","none"),f.setAttributeNS(null,"fill-rule","evenodd");const _=se.createNS("http://www.w3.org/2000/svg","g");_.setAttributeNS(null,"fill-rule","nonzero");const y=se.createNS("http://www.w3.org/2000/svg","g");y.setAttributeNS(null,"transform","translate(3.0, 29.0)"),y.setAttributeNS(null,"fill","#000000");const v=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(const te of v){const O=se.createNS("http://www.w3.org/2000/svg","ellipse");O.setAttributeNS(null,"opacity","0.04"),O.setAttributeNS(null,"cx","10.5"),O.setAttributeNS(null,"cy","5.80029008"),O.setAttributeNS(null,"rx",te.rx),O.setAttributeNS(null,"ry",te.ry),y.appendChild(O)}const T=se.createNS("http://www.w3.org/2000/svg","g");T.setAttributeNS(null,"fill",this._color);const I=se.createNS("http://www.w3.org/2000/svg","path");I.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),T.appendChild(I);const C=se.createNS("http://www.w3.org/2000/svg","g");C.setAttributeNS(null,"opacity","0.25"),C.setAttributeNS(null,"fill","#000000");const F=se.createNS("http://www.w3.org/2000/svg","path");F.setAttributeNS(null,"d","M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"),C.appendChild(F);const R=se.createNS("http://www.w3.org/2000/svg","g");R.setAttributeNS(null,"transform","translate(6.0, 7.0)"),R.setAttributeNS(null,"fill","#FFFFFF");const B=se.createNS("http://www.w3.org/2000/svg","g");B.setAttributeNS(null,"transform","translate(8.0, 8.0)");const X=se.createNS("http://www.w3.org/2000/svg","circle");X.setAttributeNS(null,"fill","#000000"),X.setAttributeNS(null,"opacity","0.25"),X.setAttributeNS(null,"cx","5.5"),X.setAttributeNS(null,"cy","5.5"),X.setAttributeNS(null,"r","5.4999962");const J=se.createNS("http://www.w3.org/2000/svg","circle");J.setAttributeNS(null,"fill","#FFFFFF"),J.setAttributeNS(null,"cx","5.5"),J.setAttributeNS(null,"cy","5.5"),J.setAttributeNS(null,"r","5.4999962"),B.appendChild(X),B.appendChild(J),_.appendChild(y),_.appendChild(T),_.appendChild(C),_.appendChild(R),_.appendChild(B),s.appendChild(_),s.setAttributeNS(null,"height",u*this._scale+"px"),s.setAttributeNS(null,"width",p*this._scale+"px"),this._element.appendChild(s),this._offset=l.pointGeometry.convert(t&&t.offset||[0,-14])}this._element.classList.add("maplibregl-marker","mapboxgl-marker"),this._element.addEventListener("dragstart",s=>{s.preventDefault()}),this._element.addEventListener("mousedown",s=>{s.preventDefault()}),je(this._element,this._anchor,"marker"),this._popup=null}addTo(t){return this.remove(),this._map=t,t.getCanvasContainer().appendChild(this._element),t.on("move",this._update),t.on("moveend",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("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),se.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=l.LngLat.convert(t),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(t){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),t){if(!("offset"in t.options)){const u=Math.sqrt(Math.pow(13.5,2)/2);t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[u,-1*(38.1-13.5+u)],"bottom-right":[-u,-1*(38.1-13.5+u)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=t,this._lngLat&&this._popup.setLngLat(this._lngLat),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}_onKeyPress(t){const n=t.code,s=t.charCode||t.keyCode;n!=="Space"&&n!=="Enter"&&s!==32&&s!==13||this.togglePopup()}_onMapClick(t){const n=t.originalEvent.target,s=this._element;this._popup&&(n===s||s.contains(n))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){const t=this._popup;return t?(t.isOpen()?t.remove():t.addTo(this._map),this):this}_update(t){if(!this._map)return;this._map.transform.renderWorldCopies&&(this._lngLat=po(this._lngLat,this._pos,this._map.transform)),this._pos=this._map.project(this._lngLat)._add(this._offset);let n="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?n=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(n=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let s="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?s="rotateX(0deg)":this._pitchAlignment==="map"&&(s=`rotateX(${this._map.getPitch()}deg)`),t&&t.type!=="moveend"||(this._pos=this._pos.round()),se.setTransform(this._element,`${Ve[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${s} ${n}`),this._map.style&&this._map.style.terrain&&!this._opacityTimeout&&(this._opacityTimeout=setTimeout(()=>{const u=this._map.unproject(this._pos),p=40075016686e-3*Math.abs(Math.cos(this._lngLat.lat*Math.PI/180))/Math.pow(2,this._map.transform.tileZoom+8);this._element.style.opacity=u.distanceTo(this._lngLat)>20*p?"0.2":"1.0",this._opacityTimeout=null},100))}getOffset(){return this._offset}setOffset(t){return this._offset=l.pointGeometry.convert(t),this._update(),this}_onMove(t){if(!this._isDragging){const n=this._clickTolerance||this._map._clickTolerance;this._isDragging=t.point.dist(this._pointerdownPos)>=n}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",this._state==="pending"&&(this._state="active",this.fire(new l.Event("dragstart"))),this.fire(new l.Event("drag")))}_onUp(){this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._state==="active"&&this.fire(new l.Event("dragend")),this._state="inactive"}_addDragHandler(t){this._element.contains(t.originalEvent.target)&&(t.preventDefault(),this._positionDelta=t.point.sub(this._pos).add(this._offset),this._pointerdownPos=t.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))}setDraggable(t){return this._draggable=!!t,this._map&&(t?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(t){return this._rotation=t||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(t){return this._rotationAlignment=t||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(t){return this._pitchAlignment=t&&t!=="auto"?t:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}}const Ps={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let Fr,si=0,Or=!1;const rr={maxWidth:100,unit:"metric"};function Ua(a,t,n){const s=n&&n.maxWidth||100,u=a._container.clientHeight/2,p=a.unproject([0,u]),f=a.unproject([s,u]),_=p.distanceTo(f);if(n&&n.unit==="imperial"){const y=3.2808*_;y>5280?Ur(t,s,y/5280,a._getUIString("ScaleControl.Miles")):Ur(t,s,y,a._getUIString("ScaleControl.Feet"))}else n&&n.unit==="nautical"?Ur(t,s,_/1852,a._getUIString("ScaleControl.NauticalMiles")):_>=1e3?Ur(t,s,_/1e3,a._getUIString("ScaleControl.Kilometers")):Ur(t,s,_,a._getUIString("ScaleControl.Meters"))}function Ur(a,t,n,s){const u=function(p){const f=Math.pow(10,`${Math.floor(p)}`.length-1);let _=p/f;return _=_>=10?10:_>=5?5:_>=3?3:_>=2?2:_>=1?1:function(y){const v=Math.pow(10,Math.ceil(-Math.log(y)/Math.LN10));return Math.round(y*v)/v}(_),f*_}(n);a.style.width=t*(u/n)+"px",a.innerHTML=`${u} ${s}`}const Vt={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},Zt=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function ks(a){if(a){if(typeof a=="number"){const t=Math.round(Math.sqrt(.5*Math.pow(a,2)));return{center:new l.pointGeometry(0,0),top:new l.pointGeometry(0,a),"top-left":new l.pointGeometry(t,t),"top-right":new l.pointGeometry(-t,t),bottom:new l.pointGeometry(0,-a),"bottom-left":new l.pointGeometry(t,-t),"bottom-right":new l.pointGeometry(-t,-t),left:new l.pointGeometry(a,0),right:new l.pointGeometry(-a,0)}}if(a instanceof l.pointGeometry||Array.isArray(a)){const t=l.pointGeometry.convert(a);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:l.pointGeometry.convert(a.center||[0,0]),top:l.pointGeometry.convert(a.top||[0,0]),"top-left":l.pointGeometry.convert(a["top-left"]||[0,0]),"top-right":l.pointGeometry.convert(a["top-right"]||[0,0]),bottom:l.pointGeometry.convert(a.bottom||[0,0]),"bottom-left":l.pointGeometry.convert(a["bottom-left"]||[0,0]),"bottom-right":l.pointGeometry.convert(a["bottom-right"]||[0,0]),left:l.pointGeometry.convert(a.left||[0,0]),right:l.pointGeometry.convert(a.right||[0,0])}}return ks(new l.pointGeometry(0,0))}const Qr={supported:ve,setRTLTextPlugin:l.setRTLTextPlugin,getRTLTextPluginStatus:l.getRTLTextPluginStatus,Map:class extends Rt{constructor(a){var t;if(l.PerformanceUtils.mark(l.PerformanceMarkers.create),(a=l.extend({},Oa,a)).minZoom!=null&&a.maxZoom!=null&&a.minZoom>a.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(a.minPitch!=null&&a.maxPitch!=null&&a.minPitch>a.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(a.minPitch!=null&&a.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(a.maxPitch!=null&&a.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new ro(a.minZoom,a.maxZoom,a.minPitch,a.maxPitch,a.renderWorldCopies),{bearingSnap:a.bearingSnap}),this._interactive=a.interactive,this._cooperativeGestures=a.cooperativeGestures,this._maxTileCacheSize=a.maxTileCacheSize,this._failIfMajorPerformanceCaveat=a.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=a.preserveDrawingBuffer,this._antialias=a.antialias,this._trackResize=a.trackResize,this._bearingSnap=a.bearingSnap,this._refreshExpiredTiles=a.refreshExpiredTiles,this._fadeDuration=a.fadeDuration,this._crossSourceCollisions=a.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=a.collectResourceTiming,this._renderTaskQueue=new Ba,this._controls=[],this._mapId=l.uniqueId(),this._locale=l.extend({},Fa,a.locale),this._clickTolerance=a.clickTolerance,this._pixelRatio=(t=a.pixelRatio)!==null&&t!==void 0?t:devicePixelRatio,this._requestManager=new gt(a.transformRequest),typeof a.container=="string"){if(this._container=document.getElementById(a.container),!this._container)throw new Error(`Container '${a.container}' not found.`)}else{if(!(a.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=a.container}if(a.maxBounds&&this.setMaxBounds(a.maxBounds),l.bindAll(["_onWindowOnline","_onWindowResize","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._setupPainter(),this.painter===void 0)throw new Error("Failed to initialize WebGL.");this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this.on("terrain",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}),typeof window<"u"&&(addEventListener("online",this._onWindowOnline,!1),addEventListener("resize",this._onWindowResize,!1),addEventListener("orientationchange",this._onWindowResize,!1)),this.handlers=new Ra(this,a),this._cooperativeGestures&&this._setupCooperativeGestures(),this._hash=a.hash&&new Ea(typeof a.hash=="string"&&a.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:a.center,zoom:a.zoom,bearing:a.bearing,pitch:a.pitch}),a.bounds&&(this.resize(),this.fitBounds(a.bounds,l.extend({},a.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=a.localIdeographFontFamily,a.style&&this.setStyle(a.style,{localIdeographFontFamily:a.localIdeographFontFamily}),a.attributionControl&&this.addControl(new ho({customAttribution:a.customAttribution})),a.maplibreLogo&&this.addControl(new Vo,a.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",n=>{this._update(n.dataType==="style"),this.fire(new l.Event(`${n.dataType}data`,n))}),this.on("dataloading",n=>{this.fire(new l.Event(`${n.dataType}dataloading`,n))}),this.on("dataabort",n=>{this.fire(new l.Event("sourcedataabort",n))})}_getMapId(){return this._mapId}addControl(a,t){if(t===void 0&&(t=a.getDefaultPosition?a.getDefaultPosition():"top-right"),!a||!a.onAdd)return this.fire(new l.ErrorEvent(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const n=a.onAdd(this);this._controls.push(a);const s=this._controlPositions[t];return t.indexOf("bottom")!==-1?s.insertBefore(n,s.firstChild):s.appendChild(n),this}removeControl(a){if(!a||!a.onRemove)return this.fire(new l.ErrorEvent(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const t=this._controls.indexOf(a);return t>-1&&this._controls.splice(t,1),a.onRemove(this),this}hasControl(a){return this._controls.indexOf(a)>-1}calculateCameraOptionsFromTo(a,t,n,s){return s==null&&this.style.terrain&&(s=this.transform.getElevation(n,this.style.terrain)),super.calculateCameraOptionsFromTo(a,t,n,s)}resize(a){const t=this._containerDimensions(),n=t[0],s=t[1];this._resizeCanvas(n,s,this.getPixelRatio()),this.transform.resize(n,s),this.painter.resize(n,s,this.getPixelRatio());const u=!this._moving;return u&&(this.stop(),this.fire(new l.Event("movestart",a)).fire(new l.Event("move",a))),this.fire(new l.Event("resize",a)),u&&this.fire(new l.Event("moveend",a)),this}getPixelRatio(){return this._pixelRatio}setPixelRatio(a){const[t,n]=this._containerDimensions();this._pixelRatio=a,this._resizeCanvas(t,n,a),this.painter.resize(t,n,a)}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(a){return this.transform.setMaxBounds(l.LngLatBounds.convert(a)),this._update()}setMinZoom(a){if((a=a==null?-2:a)>=-2&&a<=this.transform.maxZoom)return this.transform.minZoom=a,this._update(),this.getZoom()<a&&this.setZoom(a),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(a){if((a=a==null?22:a)>=this.transform.minZoom)return this.transform.maxZoom=a,this._update(),this.getZoom()>a&&this.setZoom(a),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(a){if((a=a==null?0:a)<0)throw new Error("minPitch must be greater than or equal to 0");if(a>=0&&a<=this.transform.maxPitch)return this.transform.minPitch=a,this._update(),this.getPitch()<a&&this.setPitch(a),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(a){if((a=a==null?60:a)>85)throw new Error("maxPitch must be less than or equal to 85");if(a>=this.transform.minPitch)return this.transform.maxPitch=a,this._update(),this.getPitch()>a&&this.setPitch(a),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(a){return this.transform.renderWorldCopies=a,this._update()}project(a){return this.transform.locationPoint(l.LngLat.convert(a),this.style&&this.style.terrain)}unproject(a){return this.transform.pointLocation(l.pointGeometry.convert(a),this.style&&this.style.terrain)}isMoving(){return this._moving||this.handlers.isMoving()}isZooming(){return this._zooming||this.handlers.isZooming()}isRotating(){return this._rotating||this.handlers.isRotating()}_createDelegatedListener(a,t,n){if(a==="mouseenter"||a==="mouseover"){let s=!1;return{layer:t,listener:n,delegates:{mousemove:p=>{const f=this.getLayer(t)?this.queryRenderedFeatures(p.point,{layers:[t]}):[];f.length?s||(s=!0,n.call(this,new Mi(a,this,p.originalEvent,{features:f}))):s=!1},mouseout:()=>{s=!1}}}}if(a==="mouseleave"||a==="mouseout"){let s=!1;return{layer:t,listener:n,delegates:{mousemove:f=>{(this.getLayer(t)?this.queryRenderedFeatures(f.point,{layers:[t]}):[]).length?s=!0:s&&(s=!1,n.call(this,new Mi(a,this,f.originalEvent)))},mouseout:f=>{s&&(s=!1,n.call(this,new Mi(a,this,f.originalEvent)))}}}}{const s=u=>{const p=this.getLayer(t)?this.queryRenderedFeatures(u.point,{layers:[t]}):[];p.length&&(u.features=p,n.call(this,u),delete u.features)};return{layer:t,listener:n,delegates:{[a]:s}}}}on(a,t,n){if(n===void 0)return super.on(a,t);const s=this._createDelegatedListener(a,t,n);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[a]=this._delegatedListeners[a]||[],this._delegatedListeners[a].push(s);for(const u in s.delegates)this.on(u,s.delegates[u]);return this}once(a,t,n){if(n===void 0)return super.once(a,t);const s=this._createDelegatedListener(a,t,n);for(const u in s.delegates)this.once(u,s.delegates[u]);return this}off(a,t,n){return n===void 0?super.off(a,t):(this._delegatedListeners&&this._delegatedListeners[a]&&(s=>{const u=this._delegatedListeners[a];for(let p=0;p<u.length;p++){const f=u[p];if(f.layer===t&&f.listener===n){for(const _ in f.delegates)this.off(_,f.delegates[_]);return u.splice(p,1),this}}})(),this)}queryRenderedFeatures(a,t){if(!this.style)return[];let n;if(t!==void 0||a===void 0||a instanceof l.pointGeometry||Array.isArray(a)||(t=a,a=void 0),t=t||{},(a=a||[[0,0],[this.transform.width,this.transform.height]])instanceof l.pointGeometry||typeof a[0]=="number")n=[l.pointGeometry.convert(a)];else{const s=l.pointGeometry.convert(a[0]),u=l.pointGeometry.convert(a[1]);n=[s,new l.pointGeometry(u.x,s.y),u,new l.pointGeometry(s.x,u.y),s]}return this.style.queryRenderedFeatures(n,t,this.transform)}querySourceFeatures(a,t){return this.style.querySourceFeatures(a,t)}setStyle(a,t){return(t=l.extend({},{localIdeographFontFamily:this._localIdeographFontFamily},t)).diff!==!1&&t.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&a?(this._diffStyle(a,t),this):(this._localIdeographFontFamily=t.localIdeographFontFamily,this._updateStyle(a,t))}setTransformRequest(a){return this._requestManager.setTransformRequest(a),this}_getUIString(a){const t=this._locale[a];if(t==null)throw new Error(`Missing UI string '${a}'`);return t}_updateStyle(a,t){return this.style&&(this.style.setEventedParent(null),this.style._remove()),a?(this.style=new li(this,t||{}),this.style.setEventedParent(this,{style:this.style}),typeof a=="string"?this.style.loadURL(a):this.style.loadJSON(a),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new li(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(a,t){if(typeof a=="string"){const n=this._requestManager.transformRequest(a,l.ResourceType.Style);l.getJSON(n,(s,u)=>{s?this.fire(new l.ErrorEvent(s)):u&&this._updateDiff(u,t)})}else typeof a=="object"&&this._updateDiff(a,t)}_updateDiff(a,t){try{this.style.setState(a)&&this._update(!0)}catch(n){l.warnOnce(`Unable to perform style diff: ${n.message||n.error||n}. Rebuilding the style from scratch.`),this._updateStyle(a,t)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():l.warnOnce("There is no style added to the map.")}addSource(a,t){return this._lazyInitEmptyStyle(),this.style.addSource(a,t),this._update(!0)}isSourceLoaded(a){const t=this.style&&this.style.sourceCaches[a];if(t!==void 0)return t.loaded();this.fire(new l.ErrorEvent(new Error(`There is no source with ID '${a}'`)))}setTerrain(a){return this.style.setTerrain(a),this}getTerrain(){return this.style.terrain&&this.style.terrain.options}areTilesLoaded(){const a=this.style&&this.style.sourceCaches;for(const t in a){const n=a[t]._tiles;for(const s in n){const u=n[s];if(u.state!=="loaded"&&u.state!=="errored")return!1}}return!0}addSourceType(a,t,n){return this._lazyInitEmptyStyle(),this.style.addSourceType(a,t,n)}removeSource(a){return this.style.removeSource(a),this._update(!0)}getSource(a){return this.style.getSource(a)}addImage(a,t,{pixelRatio:n=1,sdf:s=!1,stretchX:u,stretchY:p,content:f}={}){if(this._lazyInitEmptyStyle(),t instanceof HTMLImageElement||l.isImageBitmap(t)){const{width:_,height:y,data:v}=l.exported.getImageData(t);this.style.addImage(a,{data:new l.RGBAImage({width:_,height:y},v),pixelRatio:n,stretchX:u,stretchY:p,content:f,sdf:s,version:0})}else{if(t.width===void 0||t.height===void 0)return this.fire(new l.ErrorEvent(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{const{width:_,height:y,data:v}=t,T=t;this.style.addImage(a,{data:new l.RGBAImage({width:_,height:y},new Uint8Array(v)),pixelRatio:n,stretchX:u,stretchY:p,content:f,sdf:s,version:0,userImage:T}),T.onAdd&&T.onAdd(this,a)}}}updateImage(a,t){const n=this.style.getImage(a);if(!n)return this.fire(new l.ErrorEvent(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const s=t instanceof HTMLImageElement||l.isImageBitmap(t)?l.exported.getImageData(t):t,{width:u,height:p,data:f}=s;if(u===void 0||p===void 0)return this.fire(new l.ErrorEvent(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(u!==n.data.width||p!==n.data.height)return this.fire(new l.ErrorEvent(new Error("The width and height of the updated image must be that same as the previous version of the image")));const _=!(t instanceof HTMLImageElement||l.isImageBitmap(t));n.data.replace(f,_),this.style.updateImage(a,n)}hasImage(a){return a?!!this.style.getImage(a):(this.fire(new l.ErrorEvent(new Error("Missing required image id"))),!1)}removeImage(a){this.style.removeImage(a)}loadImage(a,t){l.getImage(this._requestManager.transformRequest(a,l.ResourceType.Image),t)}listImages(){return this.style.listImages()}addLayer(a,t){return this._lazyInitEmptyStyle(),this.style.addLayer(a,t),this._update(!0)}moveLayer(a,t){return this.style.moveLayer(a,t),this._update(!0)}removeLayer(a){return this.style.removeLayer(a),this._update(!0)}getLayer(a){return this.style.getLayer(a)}setLayerZoomRange(a,t,n){return this.style.setLayerZoomRange(a,t,n),this._update(!0)}setFilter(a,t,n={}){return this.style.setFilter(a,t,n),this._update(!0)}getFilter(a){return this.style.getFilter(a)}setPaintProperty(a,t,n,s={}){return this.style.setPaintProperty(a,t,n,s),this._update(!0)}getPaintProperty(a,t){return this.style.getPaintProperty(a,t)}setLayoutProperty(a,t,n,s={}){return this.style.setLayoutProperty(a,t,n,s),this._update(!0)}getLayoutProperty(a,t){return this.style.getLayoutProperty(a,t)}setLight(a,t={}){return this._lazyInitEmptyStyle(),this.style.setLight(a,t),this._update(!0)}getLight(){return this.style.getLight()}setFeatureState(a,t){return this.style.setFeatureState(a,t),this._update()}removeFeatureState(a,t){return this.style.removeFeatureState(a,t),this._update()}getFeatureState(a){return this.style.getFeatureState(a)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let a=0,t=0;return this._container&&(a=this._container.clientWidth||400,t=this._container.clientHeight||300),[a,t]}_setupContainer(){const a=this._container;a.classList.add("maplibregl-map","mapboxgl-map");const t=this._canvasContainer=se.create("div","maplibregl-canvas-container mapboxgl-canvas-container",a);this._interactive&&t.classList.add("maplibregl-interactive","mapboxgl-interactive"),this._canvas=se.create("canvas","maplibregl-canvas mapboxgl-canvas",t),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label","Map"),this._canvas.setAttribute("role","region");const n=this._containerDimensions();this._resizeCanvas(n[0],n[1],this.getPixelRatio());const s=this._controlContainer=se.create("div","maplibregl-control-container mapboxgl-control-container",a),u=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(p=>{u[p]=se.create("div",`maplibregl-ctrl-${p} mapboxgl-ctrl-${p}`,s)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_setupCooperativeGestures(){const a=this._container;this._metaPress=!1,this._cooperativeGesturesScreen=se.create("div","maplibregl-cooperative-gesture-screen",a);let t="Control",n=typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.windowsHelpText?this._cooperativeGestures.windowsHelpText:"Use Ctrl + scroll to zoom the map";navigator.platform.indexOf("Mac")===0&&(n=typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.macHelpText?this._cooperativeGestures.macHelpText:"Use \u2318 + scroll to zoom the map",t="Meta"),this._cooperativeGesturesScreen.innerHTML=`
|
|
577
577
|
<div class="maplibregl-desktop-message">${n}</div>
|
|
578
578
|
<div class="maplibregl-mobile-message">${typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.mobileHelpText?this._cooperativeGestures.mobileHelpText:"Use two fingers to move the map"}</div>
|
|
579
|
-
`,document.addEventListener("keydown",s=>{s.key===t&&(this._metaPress=!0)}),document.addEventListener("keyup",s=>{s.key===t&&(this._metaPress=!1)}),this._canvasContainer.addEventListener("wheel",s=>{this._onCooperativeGesture(s,this._metaPress,1)},!1),this._canvasContainer.classList.remove("mapboxgl-touch-drag-pan","maplibregl-touch-drag-pan")}_resizeCanvas(a,t,n){this._canvas.width=n*a,this._canvas.height=n*t,this._canvas.style.width=`${a}px`,this._canvas.style.height=`${t}px`}_setupPainter(){const a=l.extend({},ve.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),t=this._canvas.getContext("webgl",a)||this._canvas.getContext("experimental-webgl",a);t?(this.painter=new bs(t,this.transform),l.exported$1.testSupport(t)):this.fire(new l.ErrorEvent(new Error("Failed to initialize WebGL")))}_contextLost(a){a.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new l.Event("webglcontextlost",{originalEvent:a}))}_contextRestored(a){this._setupPainter(),this.resize(),this._update(),this.fire(new l.Event("webglcontextrestored",{originalEvent:a}))}_onMapScroll(a){if(a.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}_onCooperativeGesture(a,t,n){return!t&&n<2&&(this._cooperativeGesturesScreen.classList.add("maplibregl-show"),setTimeout(()=>{this._cooperativeGesturesScreen.classList.remove("maplibregl-show")},100)),!1}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(a){return this.style?(this._styleDirty=this._styleDirty||a,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(a){return this._update(),this._renderTaskQueue.add(a)}_cancelRenderFrame(a){this._renderTaskQueue.remove(a)}_render(a){let t,n=0;const s=this.painter.context.extTimerQuery;if(this.listens("gpu-timing-frame")&&(t=s.createQueryEXT(),s.beginQueryEXT(s.TIME_ELAPSED_EXT,t),n=l.exported.now()),this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(a),this._removed)return;let u=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const f=this.transform.zoom,_=l.exported.now();this.style.zoomHistory.update(f,_);const y=new l.EvaluationParameters(f,{now:_,fadeDuration:this._fadeDuration,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),v=y.crossFadingFactor();v===1&&v===this._crossFadingFactor||(u=!0,this._crossFadingFactor=v),this.style.update(y)}if(this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.style.terrain&&this.style.terrain.sourceCache.update(this.transform,this.style.terrain),this.transform.updateElevation(this.style.terrain),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,this._fadeDuration,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:this._fadeDuration,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer")}),this.fire(new l.Event("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,l.PerformanceUtils.mark(l.PerformanceMarkers.load),this.fire(new l.Event("load"))),this.style&&(this.style.hasTransitions()||u)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),this.listens("gpu-timing-frame")){const f=l.exported.now()-n;s.endQueryEXT(s.TIME_ELAPSED_EXT,t),setTimeout(()=>{const _=s.getQueryObjectEXT(t,s.QUERY_RESULT_EXT)/1e6;s.deleteQueryEXT(t),this.fire(new l.Event("gpu-timing-frame",{cpuTime:f,gpuTime:_}))},50)}if(this.listens("gpu-timing-layer")){const f=this.painter.collectGpuTimers();setTimeout(()=>{const _=this.painter.queryGpuTimers(f);this.fire(new l.Event("gpu-timing-layer",{layerTimes:_}))},50)}const d=this._sourcesDirty||this._styleDirty||this._placementDirty;return d||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new l.Event("idle")),!this._loaded||this._fullyLoaded||d||(this._fullyLoaded=!0,l.PerformanceUtils.mark(l.PerformanceMarkers.fullLoad)),this}redraw(){return this.style&&(this._frame&&(this._frame.cancel(),this._frame=null),this._render(0)),this}remove(){this._hash&&this._hash.remove();for(const t of this._controls)t.onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&(removeEventListener("resize",this._onWindowResize,!1),removeEventListener("orientationchange",this._onWindowResize,!1),removeEventListener("online",this._onWindowOnline,!1));const a=this.painter.context.gl.getExtension("WEBGL_lose_context");a&&a.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),se.remove(this._canvasContainer),se.remove(this._controlContainer),this._cooperativeGestures&&se.remove(this._cooperativeGesturesScreen),this._container.classList.remove("maplibregl-map","mapboxgl-map"),l.PerformanceUtils.clearMetrics(),this._removed=!0,this.fire(new l.Event("remove"))}triggerRepaint(){this.style&&!this._frame&&(this._frame=l.exported.frame(a=>{l.PerformanceUtils.frame(a),this._frame=null,this._render(a)}))}_onWindowOnline(){this._update()}_onWindowResize(a){this._trackResize&&this.resize({originalEvent:a})._update()}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(a){this._showTileBoundaries!==a&&(this._showTileBoundaries=a,this._update())}get showPadding(){return!!this._showPadding}set showPadding(a){this._showPadding!==a&&(this._showPadding=a,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(a){this._showCollisionBoxes!==a&&(this._showCollisionBoxes=a,a?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(a){this._showOverdrawInspector!==a&&(this._showOverdrawInspector=a,this._update())}get repaint(){return!!this._repaint}set repaint(a){this._repaint!==a&&(this._repaint=a,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(a){this._vertices=a,this._update()}_setCacheLimits(a,t){l.setCacheLimits(a,t)}get version(){return"2.4.0"}},NavigationControl:class{constructor(a){this.options=l.extend({},Dl,a),this._container=se.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",t=>t.preventDefault()),this.options.showZoom&&(l.bindAll(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in mapboxgl-ctrl-zoom-in",t=>this._map.zoomIn({},{originalEvent:t})),se.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out mapboxgl-ctrl-zoom-out",t=>this._map.zoomOut({},{originalEvent:t})),se.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(l.bindAll(["_rotateCompassArrow"],this),this._compass=this._createButton("maplibregl-ctrl-compass mapboxgl-ctrl-compass",t=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:t}):this._map.resetNorth({},{originalEvent:t})}),this._compassIcon=se.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){const a=this._map.getZoom(),t=a===this._map.getMaxZoom(),n=a===this._map.getMinZoom();this._zoomInButton.disabled=t,this._zoomOutButton.disabled=n,this._zoomInButton.setAttribute("aria-disabled",t.toString()),this._zoomOutButton.setAttribute("aria-disabled",n.toString())}_rotateCompassArrow(){const a=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=a}onAdd(a){return this._map=a,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new ir(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){se.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(a,t){const n=se.create("button",a,this._container);return n.type="button",n.addEventListener("click",t),n}_setButtonTitle(a,t){const n=this._map._getUIString(`NavigationControl.${t}`);a.title=n,a.setAttribute("aria-label",n)}},GeolocateControl:class extends l.Evented{constructor(a){super(),this.options=l.extend({},Ps,a),l.bindAll(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker"],this)}onAdd(a){var t;return this._map=a,this._container=se.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),t=this._setupUI,Fr!==void 0?t(Fr):window.navigator.permissions!==void 0?window.navigator.permissions.query({name:"geolocation"}).then(n=>{Fr=n.state!=="denied",t(Fr)}):(Fr=!!window.navigator.geolocation,t(Fr)),this._container}onRemove(){this._geolocationWatchID!==void 0&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),se.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,si=0,Or=!1}_isOutOfMapMaxBounds(a){const t=this._map.getMaxBounds(),n=a.coords;return t&&(n.longitude<t.getWest()||n.longitude>t.getEast()||n.latitude<t.getSouth()||n.latitude>t.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_onSuccess(a){if(this._map){if(this._isOutOfMapMaxBounds(a))return this._setErrorState(),this.fire(new l.Event("outofmaxbounds",a)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=a,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(a),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(a),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale","mapboxgl-user-location-dot-stale"),this.fire(new l.Event("geolocate",a)),this._finish()}}_updateCamera(a){const t=new l.LngLat(a.coords.longitude,a.coords.latitude),n=a.coords.accuracy,s=this._map.getBearing(),u=l.extend({bearing:s},this.options.fitBoundsOptions);this._map.fitBounds(t.toBounds(n),u,{geolocateSource:!0})}_updateMarker(a){if(a){const t=new l.LngLat(a.coords.longitude,a.coords.latitude);this._accuracyCircleMarker.setLngLat(t).addTo(this._map),this._userLocationDotMarker.setLngLat(t).addTo(this._map),this._accuracy=a.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){const a=this._map._container.clientHeight/2,t=this._map.unproject([0,a]),n=this._map.unproject([1,a]),s=t.distanceTo(n),u=Math.ceil(2*this._accuracy/s);this._circleElement.style.width=`${u}px`,this._circleElement.style.height=`${u}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}_onError(a){if(this._map){if(this.options.trackUserLocation)if(a.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(a.code===3&&Or)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale","mapboxgl-user-location-dot-stale"),this.fire(new l.Event("error",a)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(a){if(this._container.addEventListener("contextmenu",t=>t.preventDefault()),this._geolocateButton=se.create("button","maplibregl-ctrl-geolocate mapboxgl-ctrl-geolocate",this._container),se.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",a===!1){l.warnOnce("Geolocation support is not available so the GeolocateControl will be disabled.");const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t)}else{const t=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=se.create("div","maplibregl-user-location-dot mapboxgl-user-location-dot"),this._userLocationDotMarker=new kn(this._dotElement),this._circleElement=se.create("div","maplibregl-user-location-accuracy-circle mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new kn({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",t=>{t.geolocateSource||this._watchState!=="ACTIVE_LOCK"||t.originalEvent&&t.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this.fire(new l.Event("trackuserlocationend")))})}trigger(){if(!this._setup)return l.warnOnce("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new l.Event("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":si--,Or=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this.fire(new l.Event("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new l.Event("trackuserlocationstart"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let a;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),si++,si>1?(a={maximumAge:6e5,timeout:0},Or=!0):(a=this.options.positionOptions,Or=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,a)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},AttributionControl:ho,LogoControl:Vo,ScaleControl:class{constructor(a){this.options=l.extend({},rr,a),l.bindAll(["_onMove","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_onMove(){Ua(this._map,this._container,this.options)}onAdd(a){return this._map=a,this._container=se.create("div","maplibregl-ctrl maplibregl-ctrl-scale mapboxgl-ctrl mapboxgl-ctrl-scale",a.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){se.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}setUnit(a){this.options.unit=a,Ua(this._map,this._container,this.options)}},FullscreenControl:class{constructor(a){this._fullscreen=!1,a&&a.container&&(a.container instanceof HTMLElement?this._container=a.container:l.warnOnce("Full screen control 'container' must be a DOM element.")),l.bindAll(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(a){return this._map=a,this._container||(this._container=this._map.getContainer()),this._controlContainer=se.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",l.warnOnce("This device does not support fullscreen mode.")),this._controlContainer}onRemove(){se.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._changeIcon)}_checkFullscreenSupport(){return!!(document.fullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled||document.webkitFullscreenEnabled)}_setupUI(){const a=this._fullscreenButton=se.create("button","maplibregl-ctrl-fullscreen mapboxgl-ctrl-fullscreen",this._controlContainer);se.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",a).setAttribute("aria-hidden","true"),a.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){const a=this._getTitle();this._fullscreenButton.setAttribute("aria-label",a),this._fullscreenButton.title=a}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_changeIcon(){(window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement)===this._container!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"),this._updateTitle())}_onClickFullscreen(){this._isFullscreen()?window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen&&window.document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()}},TerrainControl:class{constructor(a){this.options=a,l.bindAll(["_toggleTerrain","_updateTerrainIcon"],this)}onAdd(a){return this._map=a,this._container=se.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._terrainButton=se.create("button","maplibregl-ctrl-terrain mapboxgl-ctrl-terrain",this._container),se.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){se.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}_toggleTerrain(){this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()}_updateTerrainIcon(){this._terrainButton.classList.remove("maplibregl-ctrl-terrain","mapboxgl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled","mapboxgl-ctrl-terrain-enabled"),this._map.style.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled","mapboxgl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.disableTerrain")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain","mapboxgl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.enableTerrain"))}},Popup:class extends l.Evented{constructor(a){super(),this.options=l.extend(Object.create(Vt),a),l.bindAll(["_update","_onClose","remove","_onMouseMove","_onMouseUp","_onDrag"],this)}addTo(a){return this._map&&this.remove(),this._map=a,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer","mapboxgl-track-pointer")):this._map.on("move",this._update),this.fire(new l.Event("open")),this}isOpen(){return!!this._map}remove(){return this._content&&se.remove(this._content),this._container&&(se.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),delete this._map),this.fire(new l.Event("close")),this}getLngLat(){return this._lngLat}setLngLat(a){return this._lngLat=l.LngLat.convert(a),this._pos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer","mapboxgl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer","mapboxgl-track-pointer")),this}getElement(){return this._container}setText(a){return this.setDOMContent(document.createTextNode(a))}setHTML(a){const t=document.createDocumentFragment(),n=document.createElement("body");let s;for(n.innerHTML=a;s=n.firstChild,s;)t.appendChild(s);return this.setDOMContent(t)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(a){return this.options.maxWidth=a,this._update(),this}setDOMContent(a){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=se.create("div","maplibregl-popup-content mapboxgl-popup-content",this._container);return this._content.appendChild(a),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(a){this._container&&this._container.classList.add(a)}removeClassName(a){this._container&&this._container.classList.remove(a)}setOffset(a){return this.options.offset=a,this._update(),this}toggleClassName(a){if(this._container)return this._container.classList.toggle(a)}_createCloseButton(){this.options.closeButton&&(this._closeButton=se.create("button","maplibregl-popup-close-button mapboxgl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_onMouseUp(a){this._update(a.point)}_onMouseMove(a){this._update(a.point)}_onDrag(a){this._update(a.point)}_update(a){if(!this._map||!this._lngLat&&!this._trackPointer||!this._content||(this._container||(this._container=se.create("div","maplibregl-popup mapboxgl-popup",this._map.getContainer()),this._tip=se.create("div","maplibregl-popup-tip mapboxgl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className&&this.options.className.split(" ").forEach(d=>this._container.classList.add(d)),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer")),this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._map.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=po(this._lngLat,this._pos,this._map.transform)),this._trackPointer&&!a))return;const t=this._pos=this._trackPointer&&a?a:this._map.project(this._lngLat);let n=this.options.anchor;const s=ks(this.options.offset);if(!n){const d=this._container.offsetWidth,f=this._container.offsetHeight;let _;_=t.y+s.bottom.y<f?["top"]:t.y>this._map.transform.height-f?["bottom"]:[],t.x<d/2?_.push("left"):t.x>this._map.transform.width-d/2&&_.push("right"),n=_.length===0?"bottom":_.join("-")}const u=t.add(s[n]).round();se.setTransform(this._container,`${Ve[n]} translate(${u.x}px,${u.y}px)`),je(this._container,n,"popup")}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const a=this._container.querySelector(Zt);a&&a.focus()}_onClose(){this.remove()}},Marker:kn,Style:li,LngLat:l.LngLat,LngLatBounds:l.LngLatBounds,Point:l.pointGeometry,MercatorCoordinate:l.MercatorCoordinate,Evented:l.Evented,AJAXError:l.AJAXError,config:l.config,CanvasSource:qr,GeoJSONSource:ur,ImageSource:qi,RasterDEMTileSource:We,RasterTileSource:Er,VectorTileSource:un,VideoSource:Zi,prewarm:function(){mn().acquire(dr)},clearPrewarmedResources:function(){const a=Mr;a&&(a.isPreloaded()&&a.numActive()===1?(a.release(dr),Mr=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},get version(){return"2.4.0"},get workerCount(){return Si.workerCount},set workerCount(a){Si.workerCount=a},get maxParallelImageRequests(){return l.config.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(a){l.config.MAX_PARALLEL_IMAGE_REQUESTS=a},clearStorage(a){l.clearTileCache(a)},workerUrl:"",addProtocol(a,t){l.config.REGISTERED_PROTOCOLS[a]=t},removeProtocol(a){delete l.config.REGISTERED_PROTOCOLS[a]}};return Ui.extend(Qr,{isSafari:l.isSafari,getPerformanceMetrics:l.PerformanceUtils.getPerformanceMetrics}),Qr});var xe=j;return xe})})(dh);const Qf=dh.exports,Xp={x:0,y:0,width:0,height:0,top:0,left:0,bottom:0,right:0},Wp=()=>{const[P,V]=ge.exports.useState(null),[q,W]=ge.exports.useState(Xp),j=ge.exports.useMemo(()=>new window.ResizeObserver(Q=>{if(Q[0]){const{x:xe,y:l,width:ve,height:me,top:Ee,left:Te,bottom:se,right:gt}=Q[0].contentRect;W({x:xe,y:l,width:ve,height:me,top:Ee,left:Te,bottom:se,right:gt})}}),[]);return ge.exports.useLayoutEffect(()=>{if(!!P)return j.observe(P),()=>{j.disconnect()}},[P]),[V,q,P]},Hp=lt.memo(({marker:P})=>Bi(Vp,{latitude:P.lat,longitude:P.lng,style:{zIndex:1},children:Bi(xp.Root,{options:{style:P.icon||"house"}})}));Hp.displayName="Pin";const Kp={all:()=>["pois"],list:P=>[...Kp.all(),P]},Jp={all:()=>["schools"],list:P=>[...Jp.all(),P]},Yp={all:()=>["scores"],list:P=>[...Yp.all(),P]};function wc(P,V=[]){let q=[];function W(Q,xe){const l=ge.exports.createContext(xe),ve=q.length;q=[...q,xe];function me(Te){const{scope:se,children:gt,...nt}=Te,He=(se==null?void 0:se[P][ve])||l,Ut=ge.exports.useMemo(()=>nt,Object.values(nt));return ge.exports.createElement(He.Provider,{value:Ut},gt)}function Ee(Te,se){const gt=(se==null?void 0:se[P][ve])||l,nt=ge.exports.useContext(gt);if(nt)return nt;if(xe!==void 0)return xe;throw new Error(`\`${Te}\` must be used within \`${Q}\``)}return me.displayName=Q+"Provider",[me,Ee]}const j=()=>{const Q=q.map(xe=>ge.exports.createContext(xe));return function(l){const ve=(l==null?void 0:l[P])||Q;return ge.exports.useMemo(()=>({[`__scope${P}`]:{...l,[P]:ve}}),[l,ve])}};return j.scopeName=P,[W,Qp(j,...V)]}function Qp(...P){const V=P[0];if(P.length===1)return V;const q=()=>{const W=P.map(j=>({useScope:j(),scopeName:j.scopeName}));return function(Q){const xe=W.reduce((l,{useScope:ve,scopeName:me})=>{const Te=ve(Q)[`__scope${me}`];return{...l,...Te}},{});return ge.exports.useMemo(()=>({[`__scope${V.scopeName}`]:xe}),[xe])}};return q.scopeName=V.scopeName,q}function ef(P,V){typeof P=="function"?P(V):P!=null&&(P.current=V)}function fh(...P){return V=>P.forEach(q=>ef(q,V))}function Ys(...P){return ge.exports.useCallback(fh(...P),P)}const ul=ge.exports.forwardRef((P,V)=>{const{children:q,...W}=P,j=ge.exports.Children.toArray(q),Q=j.find(rf);if(Q){const xe=Q.props.children,l=j.map(ve=>ve===Q?ge.exports.Children.count(xe)>1?ge.exports.Children.only(null):ge.exports.isValidElement(xe)?xe.props.children:null:ve);return ge.exports.createElement(xc,Ei({},W,{ref:V}),ge.exports.isValidElement(xe)?ge.exports.cloneElement(xe,void 0,l):null)}return ge.exports.createElement(xc,Ei({},W,{ref:V}),q)});ul.displayName="Slot";const xc=ge.exports.forwardRef((P,V)=>{const{children:q,...W}=P;return ge.exports.isValidElement(q)?ge.exports.cloneElement(q,{...nf(W,q.props),ref:fh(V,q.ref)}):ge.exports.Children.count(q)>1?ge.exports.Children.only(null):null});xc.displayName="SlotClone";const tf=({children:P})=>ge.exports.createElement(ge.exports.Fragment,null,P);function rf(P){return ge.exports.isValidElement(P)&&P.type===tf}function nf(P,V){const q={...V};for(const W in V){const j=P[W],Q=V[W];/^on[A-Z]/.test(W)?q[W]=(...l)=>{Q==null||Q(...l),j==null||j(...l)}:W==="style"?q[W]={...j,...Q}:W==="className"&&(q[W]=[j,Q].filter(Boolean).join(" "))}return{...P,...q}}function of(P){const V=P+"CollectionProvider",[q,W]=wc(V),[j,Q]=q(V,{collectionRef:{current:null},itemMap:new Map}),xe=gt=>{const{scope:nt,children:He}=gt,Ut=lt.useRef(null),Mt=lt.useRef(new Map).current;return lt.createElement(j,{scope:nt,itemMap:Mt,collectionRef:Ut},He)},l=P+"CollectionSlot",ve=lt.forwardRef((gt,nt)=>{const{scope:He,children:Ut}=gt,Mt=Q(l,He),ct=Ys(nt,Mt.collectionRef);return lt.createElement(ul,{ref:ct},Ut)}),me=P+"CollectionItemSlot",Ee="data-radix-collection-item",Te=lt.forwardRef((gt,nt)=>{const{scope:He,children:Ut,...Mt}=gt,ct=lt.useRef(null),vt=Ys(nt,ct),Wt=Q(me,He);return lt.useEffect(()=>(Wt.itemMap.set(ct,{ref:ct,...Mt}),()=>void Wt.itemMap.delete(ct))),lt.createElement(ul,{[Ee]:"",ref:vt},Ut)});function se(gt){const nt=Q(P+"CollectionConsumer",gt);return lt.useCallback(()=>{const Ut=nt.collectionRef.current;if(!Ut)return[];const Mt=Array.from(Ut.querySelectorAll(`[${Ee}]`));return Array.from(nt.itemMap.values()).sort((Wt,$t)=>Mt.indexOf(Wt.ref.current)-Mt.indexOf($t.ref.current))},[nt.collectionRef,nt.itemMap])}return[{Provider:xe,Slot:ve,ItemSlot:Te},se,W]}function mh(P,V,{checkForDefaultPrevented:q=!0}={}){return function(j){if(P==null||P(j),q===!1||!j.defaultPrevented)return V==null?void 0:V(j)}}function gh(P){const V=ge.exports.useRef(P);return ge.exports.useEffect(()=>{V.current=P}),ge.exports.useMemo(()=>(...q)=>{var W;return(W=V.current)===null||W===void 0?void 0:W.call(V,...q)},[])}function Tc({prop:P,defaultProp:V,onChange:q=()=>{}}){const[W,j]=sf({defaultProp:V,onChange:q}),Q=P!==void 0,xe=Q?P:W,l=gh(q),ve=ge.exports.useCallback(me=>{if(Q){const Te=typeof me=="function"?me(P):me;Te!==P&&l(Te)}else j(me)},[Q,P,j,l]);return[xe,ve]}function sf({defaultProp:P,onChange:V}){const q=ge.exports.useState(P),[W]=q,j=ge.exports.useRef(W),Q=gh(V);return ge.exports.useEffect(()=>{j.current!==W&&(Q(W),j.current=W)},[W,j,Q]),q}const af=["a","button","div","h2","h3","img","li","nav","ol","p","span","svg","ul"],ea=af.reduce((P,V)=>{const q=ge.exports.forwardRef((W,j)=>{const{asChild:Q,...xe}=W,l=Q?ul:V;return ge.exports.useEffect(()=>{window[Symbol.for("radix-ui")]=!0},[]),ge.exports.createElement(l,Ei({},xe,{ref:j}))});return q.displayName=`Primitive.${V}`,{...P,[V]:q}},{}),hl=Boolean(globalThis==null?void 0:globalThis.document)?ge.exports.useLayoutEffect:()=>{};function lf(P,V){return ge.exports.useReducer((q,W)=>{const j=V[q][W];return j!=null?j:q},P)}const _h=P=>{const{present:V,children:q}=P,W=cf(V),j=typeof q=="function"?q({present:W.isPresent}):ge.exports.Children.only(q),Q=Ys(W.ref,j.ref);return typeof q=="function"||W.isPresent?ge.exports.cloneElement(j,{ref:Q}):null};_h.displayName="Presence";function cf(P){const[V,q]=ge.exports.useState(),W=ge.exports.useRef({}),j=ge.exports.useRef(P),Q=ge.exports.useRef("none"),xe=P?"mounted":"unmounted",[l,ve]=lf(xe,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return ge.exports.useEffect(()=>{const me=cl(W.current);Q.current=l==="mounted"?me:"none"},[l]),hl(()=>{const me=W.current,Ee=j.current;if(Ee!==P){const se=Q.current,gt=cl(me);P?ve("MOUNT"):gt==="none"||(me==null?void 0:me.display)==="none"?ve("UNMOUNT"):ve(Ee&&se!==gt?"ANIMATION_OUT":"UNMOUNT"),j.current=P}},[P,ve]),hl(()=>{if(V){const me=Te=>{const gt=cl(W.current).includes(Te.animationName);Te.target===V&>&&bc.exports.flushSync(()=>ve("ANIMATION_END"))},Ee=Te=>{Te.target===V&&(Q.current=cl(W.current))};return V.addEventListener("animationstart",Ee),V.addEventListener("animationcancel",me),V.addEventListener("animationend",me),()=>{V.removeEventListener("animationstart",Ee),V.removeEventListener("animationcancel",me),V.removeEventListener("animationend",me)}}else ve("ANIMATION_END")},[V,ve]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:ge.exports.useCallback(me=>{me&&(W.current=getComputedStyle(me)),q(me)},[])}}function cl(P){return(P==null?void 0:P.animationName)||"none"}const uf=vp["useId".toString()]||(()=>{});let hf=0;function yh(P){const[V,q]=ge.exports.useState(uf());return hl(()=>{P||q(W=>W!=null?W:String(hf++))},[P]),P||(V?`radix-${V}`:"")}const xh="Collapsible",[df,vh]=wc(xh),[pf,Ec]=df(xh),ff=ge.exports.forwardRef((P,V)=>{const{__scopeCollapsible:q,open:W,defaultOpen:j,disabled:Q,onOpenChange:xe,...l}=P,[ve=!1,me]=Tc({prop:W,defaultProp:j,onChange:xe});return ge.exports.createElement(pf,{scope:q,disabled:Q,contentId:yh(),open:ve,onOpenToggle:ge.exports.useCallback(()=>me(Ee=>!Ee),[me])},ge.exports.createElement(ea.div,Ei({"data-state":Sc(ve),"data-disabled":Q?"":void 0},l,{ref:V})))}),mf="CollapsibleTrigger",gf=ge.exports.forwardRef((P,V)=>{const{__scopeCollapsible:q,...W}=P,j=Ec(mf,q);return ge.exports.createElement(ea.button,Ei({type:"button","aria-controls":j.contentId,"aria-expanded":j.open||!1,"data-state":Sc(j.open),"data-disabled":j.disabled?"":void 0,disabled:j.disabled},W,{ref:V,onClick:mh(P.onClick,j.onOpenToggle)}))}),bh="CollapsibleContent",_f=ge.exports.forwardRef((P,V)=>{const{forceMount:q,...W}=P,j=Ec(bh,P.__scopeCollapsible);return ge.exports.createElement(_h,{present:q||j.open},({present:Q})=>ge.exports.createElement(yf,Ei({},W,{ref:V,present:Q})))}),yf=ge.exports.forwardRef((P,V)=>{const{__scopeCollapsible:q,present:W,children:j,...Q}=P,xe=Ec(bh,q),[l,ve]=ge.exports.useState(W),me=ge.exports.useRef(null),Ee=Ys(V,me),Te=ge.exports.useRef(0),se=Te.current,gt=ge.exports.useRef(0),nt=gt.current,He=xe.open||l,Ut=ge.exports.useRef(He),Mt=ge.exports.useRef();return ge.exports.useEffect(()=>{const ct=requestAnimationFrame(()=>Ut.current=!1);return()=>cancelAnimationFrame(ct)},[]),hl(()=>{const ct=me.current;if(ct){Mt.current=Mt.current||{transitionDuration:ct.style.transitionDuration,animationDuration:ct.style.animationDuration,animationFillMode:ct.style.animationFillMode},ct.style.transitionDuration="0s",ct.style.animationDuration="0s",ct.style.animationFillMode="none";const vt=ct.getBoundingClientRect();Te.current=vt.height,gt.current=vt.width,Ut.current||(ct.style.transitionDuration=Mt.current.transitionDuration,ct.style.animationDuration=Mt.current.animationDuration,ct.style.animationFillMode=Mt.current.animationFillMode),ve(W)}},[xe.open,W]),ge.exports.createElement(ea.div,Ei({"data-state":Sc(xe.open),"data-disabled":xe.disabled?"":void 0,id:xe.contentId,hidden:!He},Q,{ref:Ee,style:{["--radix-collapsible-content-height"]:se?`${se}px`:void 0,["--radix-collapsible-content-width"]:nt?`${nt}px`:void 0,...P.style}}),He&&j)});function Sc(P){return P?"open":"closed"}const xf=ff,vf=gf,bf=_f,ta="Accordion",wf=["Home","End","ArrowDown","ArrowUp"],[Ic,Tf,Ef]=of(ta),[pl,em]=wc(ta,[Ef,vh]),Ac=vh(),wh=lt.forwardRef((P,V)=>{const{type:q,...W}=P,j=W,Q=W;return lt.createElement(Ic.Provider,{scope:P.__scopeAccordion},q==="multiple"?lt.createElement(Cf,Ei({},Q,{ref:V})):lt.createElement(Af,Ei({},j,{ref:V})))});wh.propTypes={type(P){const V=P.value||P.defaultValue;return P.type&&!["single","multiple"].includes(P.type)?new Error("Invalid prop `type` supplied to `Accordion`. Expected one of `single | multiple`."):P.type==="multiple"&&typeof V=="string"?new Error("Invalid prop `type` supplied to `Accordion`. Expected `single` when `defaultValue` or `value` is type `string`."):P.type==="single"&&Array.isArray(V)?new Error("Invalid prop `type` supplied to `Accordion`. Expected `multiple` when `defaultValue` or `value` is type `string[]`."):null}};const[Th,Sf]=pl(ta),[Eh,If]=pl(ta,{collapsible:!1}),Af=lt.forwardRef((P,V)=>{const{value:q,defaultValue:W,onValueChange:j=()=>{},collapsible:Q=!1,...xe}=P,[l,ve]=Tc({prop:q,defaultProp:W,onChange:j});return lt.createElement(Th,{scope:P.__scopeAccordion,value:l?[l]:[],onItemOpen:ve,onItemClose:lt.useCallback(()=>Q&&ve(""),[Q,ve])},lt.createElement(Eh,{scope:P.__scopeAccordion,collapsible:Q},lt.createElement(Sh,Ei({},xe,{ref:V}))))}),Cf=lt.forwardRef((P,V)=>{const{value:q,defaultValue:W,onValueChange:j=()=>{},...Q}=P,[xe=[],l]=Tc({prop:q,defaultProp:W,onChange:j}),ve=lt.useCallback(Ee=>l((Te=[])=>[...Te,Ee]),[l]),me=lt.useCallback(Ee=>l((Te=[])=>Te.filter(se=>se!==Ee)),[l]);return lt.createElement(Th,{scope:P.__scopeAccordion,value:xe,onItemOpen:ve,onItemClose:me},lt.createElement(Eh,{scope:P.__scopeAccordion,collapsible:!0},lt.createElement(Sh,Ei({},Q,{ref:V}))))}),[Mf,zf]=pl(ta),Sh=lt.forwardRef((P,V)=>{const{__scopeAccordion:q,disabled:W,...j}=P,Q=lt.useRef(null),xe=Ys(Q,V),l=Tf(q),ve=mh(P.onKeyDown,me=>{var Ee;if(!wf.includes(me.key))return;const Te=me.target,se=l().filter(Mt=>{var ct;return!((ct=Mt.ref.current)!==null&&ct!==void 0&&ct.disabled)}),gt=se.findIndex(Mt=>Mt.ref.current===Te),nt=se.length;if(gt===-1)return;me.preventDefault();let He=gt;switch(me.key){case"Home":He=0;break;case"End":He=nt-1;break;case"ArrowDown":He=gt+1;break;case"ArrowUp":He=gt-1,He<0&&(He=nt-1);break}const Ut=He%nt;(Ee=se[Ut].ref.current)===null||Ee===void 0||Ee.focus()});return lt.createElement(Mf,{scope:q,disabled:W},lt.createElement(Ic.Slot,{scope:q},lt.createElement(ea.div,Ei({},j,{ref:xe,onKeyDown:W?void 0:ve}))))}),vc="AccordionItem",[Pf,Cc]=pl(vc),kf=lt.forwardRef((P,V)=>{const{__scopeAccordion:q,value:W,...j}=P,Q=zf(vc,q),xe=Sf(vc,q),l=Ac(q),ve=yh(),me=W&&xe.value.includes(W)||!1,Ee=Q.disabled||P.disabled;return lt.createElement(Pf,{scope:q,open:me,disabled:Ee,triggerId:ve},lt.createElement(xf,Ei({"data-state":me?"open":"closed"},l,j,{ref:V,disabled:Ee,open:me,onOpenChange:Te=>{Te?xe.onItemOpen(W):xe.onItemClose(W)}})))}),Df="AccordionHeader",Lf=lt.forwardRef((P,V)=>{const{__scopeAccordion:q,...W}=P,j=Cc(Df,q);return lt.createElement(ea.h3,Ei({"data-state":Of(j.open),"data-disabled":j.disabled?"":void 0},W,{ref:V}))}),oh="AccordionTrigger",Rf=lt.forwardRef((P,V)=>{const{__scopeAccordion:q,...W}=P,j=Cc(oh,q),Q=If(oh,q),xe=Ac(q);return lt.createElement(Ic.ItemSlot,{scope:q},lt.createElement(vf,Ei({"aria-disabled":j.open&&!Q.collapsible||void 0,id:j.triggerId},xe,W,{ref:V})))}),Bf="AccordionContent",Ff=lt.forwardRef((P,V)=>{const{__scopeAccordion:q,...W}=P,j=Cc(Bf,q),Q=Ac(q);return lt.createElement(bf,Ei({role:"region","aria-labelledby":j.triggerId},Q,W,{ref:V,style:{["--radix-accordion-content-height"]:"var(--radix-collapsible-content-height)",["--radix-accordion-content-width"]:"var(--radix-collapsible-content-width)",...P.style}}))});function Of(P){return P?"open":"closed"}const tm=wh,im=kf,rm=Lf,nm=Rf,om=Ff,sm=P=>ge.exports.createElement("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",...P},ge.exports.createElement("path",{d:"M9.99984 6L8.58984 7.41L13.1698 12L8.58984 16.59L9.99984 18L15.9998 12L9.99984 6Z"})),Uf=es(sh.div)`
|
|
579
|
+
`,document.addEventListener("keydown",s=>{s.key===t&&(this._metaPress=!0)}),document.addEventListener("keyup",s=>{s.key===t&&(this._metaPress=!1)}),this._canvasContainer.addEventListener("wheel",s=>{this._onCooperativeGesture(s,this._metaPress,1)},!1),this._canvasContainer.classList.remove("mapboxgl-touch-drag-pan","maplibregl-touch-drag-pan")}_resizeCanvas(a,t,n){this._canvas.width=n*a,this._canvas.height=n*t,this._canvas.style.width=`${a}px`,this._canvas.style.height=`${t}px`}_setupPainter(){const a=l.extend({},ve.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),t=this._canvas.getContext("webgl",a)||this._canvas.getContext("experimental-webgl",a);t?(this.painter=new bs(t,this.transform),l.exported$1.testSupport(t)):this.fire(new l.ErrorEvent(new Error("Failed to initialize WebGL")))}_contextLost(a){a.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new l.Event("webglcontextlost",{originalEvent:a}))}_contextRestored(a){this._setupPainter(),this.resize(),this._update(),this.fire(new l.Event("webglcontextrestored",{originalEvent:a}))}_onMapScroll(a){if(a.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}_onCooperativeGesture(a,t,n){return!t&&n<2&&(this._cooperativeGesturesScreen.classList.add("maplibregl-show"),setTimeout(()=>{this._cooperativeGesturesScreen.classList.remove("maplibregl-show")},100)),!1}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(a){return this.style?(this._styleDirty=this._styleDirty||a,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(a){return this._update(),this._renderTaskQueue.add(a)}_cancelRenderFrame(a){this._renderTaskQueue.remove(a)}_render(a){let t,n=0;const s=this.painter.context.extTimerQuery;if(this.listens("gpu-timing-frame")&&(t=s.createQueryEXT(),s.beginQueryEXT(s.TIME_ELAPSED_EXT,t),n=l.exported.now()),this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(a),this._removed)return;let u=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const f=this.transform.zoom,_=l.exported.now();this.style.zoomHistory.update(f,_);const y=new l.EvaluationParameters(f,{now:_,fadeDuration:this._fadeDuration,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),v=y.crossFadingFactor();v===1&&v===this._crossFadingFactor||(u=!0,this._crossFadingFactor=v),this.style.update(y)}if(this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.style.terrain&&this.style.terrain.sourceCache.update(this.transform,this.style.terrain),this.transform.updateElevation(this.style.terrain),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,this._fadeDuration,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:this._fadeDuration,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer")}),this.fire(new l.Event("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,l.PerformanceUtils.mark(l.PerformanceMarkers.load),this.fire(new l.Event("load"))),this.style&&(this.style.hasTransitions()||u)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),this.listens("gpu-timing-frame")){const f=l.exported.now()-n;s.endQueryEXT(s.TIME_ELAPSED_EXT,t),setTimeout(()=>{const _=s.getQueryObjectEXT(t,s.QUERY_RESULT_EXT)/1e6;s.deleteQueryEXT(t),this.fire(new l.Event("gpu-timing-frame",{cpuTime:f,gpuTime:_}))},50)}if(this.listens("gpu-timing-layer")){const f=this.painter.collectGpuTimers();setTimeout(()=>{const _=this.painter.queryGpuTimers(f);this.fire(new l.Event("gpu-timing-layer",{layerTimes:_}))},50)}const p=this._sourcesDirty||this._styleDirty||this._placementDirty;return p||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new l.Event("idle")),!this._loaded||this._fullyLoaded||p||(this._fullyLoaded=!0,l.PerformanceUtils.mark(l.PerformanceMarkers.fullLoad)),this}redraw(){return this.style&&(this._frame&&(this._frame.cancel(),this._frame=null),this._render(0)),this}remove(){this._hash&&this._hash.remove();for(const t of this._controls)t.onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&(removeEventListener("resize",this._onWindowResize,!1),removeEventListener("orientationchange",this._onWindowResize,!1),removeEventListener("online",this._onWindowOnline,!1));const a=this.painter.context.gl.getExtension("WEBGL_lose_context");a&&a.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),se.remove(this._canvasContainer),se.remove(this._controlContainer),this._cooperativeGestures&&se.remove(this._cooperativeGesturesScreen),this._container.classList.remove("maplibregl-map","mapboxgl-map"),l.PerformanceUtils.clearMetrics(),this._removed=!0,this.fire(new l.Event("remove"))}triggerRepaint(){this.style&&!this._frame&&(this._frame=l.exported.frame(a=>{l.PerformanceUtils.frame(a),this._frame=null,this._render(a)}))}_onWindowOnline(){this._update()}_onWindowResize(a){this._trackResize&&this.resize({originalEvent:a})._update()}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(a){this._showTileBoundaries!==a&&(this._showTileBoundaries=a,this._update())}get showPadding(){return!!this._showPadding}set showPadding(a){this._showPadding!==a&&(this._showPadding=a,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(a){this._showCollisionBoxes!==a&&(this._showCollisionBoxes=a,a?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(a){this._showOverdrawInspector!==a&&(this._showOverdrawInspector=a,this._update())}get repaint(){return!!this._repaint}set repaint(a){this._repaint!==a&&(this._repaint=a,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(a){this._vertices=a,this._update()}_setCacheLimits(a,t){l.setCacheLimits(a,t)}get version(){return"2.4.0"}},NavigationControl:class{constructor(a){this.options=l.extend({},Dl,a),this._container=se.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",t=>t.preventDefault()),this.options.showZoom&&(l.bindAll(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in mapboxgl-ctrl-zoom-in",t=>this._map.zoomIn({},{originalEvent:t})),se.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out mapboxgl-ctrl-zoom-out",t=>this._map.zoomOut({},{originalEvent:t})),se.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(l.bindAll(["_rotateCompassArrow"],this),this._compass=this._createButton("maplibregl-ctrl-compass mapboxgl-ctrl-compass",t=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:t}):this._map.resetNorth({},{originalEvent:t})}),this._compassIcon=se.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){const a=this._map.getZoom(),t=a===this._map.getMaxZoom(),n=a===this._map.getMinZoom();this._zoomInButton.disabled=t,this._zoomOutButton.disabled=n,this._zoomInButton.setAttribute("aria-disabled",t.toString()),this._zoomOutButton.setAttribute("aria-disabled",n.toString())}_rotateCompassArrow(){const a=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=a}onAdd(a){return this._map=a,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new ir(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){se.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(a,t){const n=se.create("button",a,this._container);return n.type="button",n.addEventListener("click",t),n}_setButtonTitle(a,t){const n=this._map._getUIString(`NavigationControl.${t}`);a.title=n,a.setAttribute("aria-label",n)}},GeolocateControl:class extends l.Evented{constructor(a){super(),this.options=l.extend({},Ps,a),l.bindAll(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker"],this)}onAdd(a){var t;return this._map=a,this._container=se.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),t=this._setupUI,Fr!==void 0?t(Fr):window.navigator.permissions!==void 0?window.navigator.permissions.query({name:"geolocation"}).then(n=>{Fr=n.state!=="denied",t(Fr)}):(Fr=!!window.navigator.geolocation,t(Fr)),this._container}onRemove(){this._geolocationWatchID!==void 0&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),se.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,si=0,Or=!1}_isOutOfMapMaxBounds(a){const t=this._map.getMaxBounds(),n=a.coords;return t&&(n.longitude<t.getWest()||n.longitude>t.getEast()||n.latitude<t.getSouth()||n.latitude>t.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_onSuccess(a){if(this._map){if(this._isOutOfMapMaxBounds(a))return this._setErrorState(),this.fire(new l.Event("outofmaxbounds",a)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=a,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(a),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(a),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale","mapboxgl-user-location-dot-stale"),this.fire(new l.Event("geolocate",a)),this._finish()}}_updateCamera(a){const t=new l.LngLat(a.coords.longitude,a.coords.latitude),n=a.coords.accuracy,s=this._map.getBearing(),u=l.extend({bearing:s},this.options.fitBoundsOptions);this._map.fitBounds(t.toBounds(n),u,{geolocateSource:!0})}_updateMarker(a){if(a){const t=new l.LngLat(a.coords.longitude,a.coords.latitude);this._accuracyCircleMarker.setLngLat(t).addTo(this._map),this._userLocationDotMarker.setLngLat(t).addTo(this._map),this._accuracy=a.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){const a=this._map._container.clientHeight/2,t=this._map.unproject([0,a]),n=this._map.unproject([1,a]),s=t.distanceTo(n),u=Math.ceil(2*this._accuracy/s);this._circleElement.style.width=`${u}px`,this._circleElement.style.height=`${u}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}_onError(a){if(this._map){if(this.options.trackUserLocation)if(a.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(a.code===3&&Or)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale","mapboxgl-user-location-dot-stale"),this.fire(new l.Event("error",a)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(a){if(this._container.addEventListener("contextmenu",t=>t.preventDefault()),this._geolocateButton=se.create("button","maplibregl-ctrl-geolocate mapboxgl-ctrl-geolocate",this._container),se.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",a===!1){l.warnOnce("Geolocation support is not available so the GeolocateControl will be disabled.");const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t)}else{const t=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=se.create("div","maplibregl-user-location-dot mapboxgl-user-location-dot"),this._userLocationDotMarker=new kn(this._dotElement),this._circleElement=se.create("div","maplibregl-user-location-accuracy-circle mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new kn({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",t=>{t.geolocateSource||this._watchState!=="ACTIVE_LOCK"||t.originalEvent&&t.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this.fire(new l.Event("trackuserlocationend")))})}trigger(){if(!this._setup)return l.warnOnce("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new l.Event("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":si--,Or=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this.fire(new l.Event("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new l.Event("trackuserlocationstart"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let a;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),si++,si>1?(a={maximumAge:6e5,timeout:0},Or=!0):(a=this.options.positionOptions,Or=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,a)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},AttributionControl:ho,LogoControl:Vo,ScaleControl:class{constructor(a){this.options=l.extend({},rr,a),l.bindAll(["_onMove","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_onMove(){Ua(this._map,this._container,this.options)}onAdd(a){return this._map=a,this._container=se.create("div","maplibregl-ctrl maplibregl-ctrl-scale mapboxgl-ctrl mapboxgl-ctrl-scale",a.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){se.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}setUnit(a){this.options.unit=a,Ua(this._map,this._container,this.options)}},FullscreenControl:class{constructor(a){this._fullscreen=!1,a&&a.container&&(a.container instanceof HTMLElement?this._container=a.container:l.warnOnce("Full screen control 'container' must be a DOM element.")),l.bindAll(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(a){return this._map=a,this._container||(this._container=this._map.getContainer()),this._controlContainer=se.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",l.warnOnce("This device does not support fullscreen mode.")),this._controlContainer}onRemove(){se.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._changeIcon)}_checkFullscreenSupport(){return!!(document.fullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled||document.webkitFullscreenEnabled)}_setupUI(){const a=this._fullscreenButton=se.create("button","maplibregl-ctrl-fullscreen mapboxgl-ctrl-fullscreen",this._controlContainer);se.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",a).setAttribute("aria-hidden","true"),a.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){const a=this._getTitle();this._fullscreenButton.setAttribute("aria-label",a),this._fullscreenButton.title=a}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_changeIcon(){(window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement)===this._container!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"),this._updateTitle())}_onClickFullscreen(){this._isFullscreen()?window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen&&window.document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()}},TerrainControl:class{constructor(a){this.options=a,l.bindAll(["_toggleTerrain","_updateTerrainIcon"],this)}onAdd(a){return this._map=a,this._container=se.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._terrainButton=se.create("button","maplibregl-ctrl-terrain mapboxgl-ctrl-terrain",this._container),se.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){se.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}_toggleTerrain(){this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()}_updateTerrainIcon(){this._terrainButton.classList.remove("maplibregl-ctrl-terrain","mapboxgl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled","mapboxgl-ctrl-terrain-enabled"),this._map.style.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled","mapboxgl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.disableTerrain")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain","mapboxgl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.enableTerrain"))}},Popup:class extends l.Evented{constructor(a){super(),this.options=l.extend(Object.create(Vt),a),l.bindAll(["_update","_onClose","remove","_onMouseMove","_onMouseUp","_onDrag"],this)}addTo(a){return this._map&&this.remove(),this._map=a,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer","mapboxgl-track-pointer")):this._map.on("move",this._update),this.fire(new l.Event("open")),this}isOpen(){return!!this._map}remove(){return this._content&&se.remove(this._content),this._container&&(se.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),delete this._map),this.fire(new l.Event("close")),this}getLngLat(){return this._lngLat}setLngLat(a){return this._lngLat=l.LngLat.convert(a),this._pos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer","mapboxgl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer","mapboxgl-track-pointer")),this}getElement(){return this._container}setText(a){return this.setDOMContent(document.createTextNode(a))}setHTML(a){const t=document.createDocumentFragment(),n=document.createElement("body");let s;for(n.innerHTML=a;s=n.firstChild,s;)t.appendChild(s);return this.setDOMContent(t)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(a){return this.options.maxWidth=a,this._update(),this}setDOMContent(a){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=se.create("div","maplibregl-popup-content mapboxgl-popup-content",this._container);return this._content.appendChild(a),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(a){this._container&&this._container.classList.add(a)}removeClassName(a){this._container&&this._container.classList.remove(a)}setOffset(a){return this.options.offset=a,this._update(),this}toggleClassName(a){if(this._container)return this._container.classList.toggle(a)}_createCloseButton(){this.options.closeButton&&(this._closeButton=se.create("button","maplibregl-popup-close-button mapboxgl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_onMouseUp(a){this._update(a.point)}_onMouseMove(a){this._update(a.point)}_onDrag(a){this._update(a.point)}_update(a){if(!this._map||!this._lngLat&&!this._trackPointer||!this._content||(this._container||(this._container=se.create("div","maplibregl-popup mapboxgl-popup",this._map.getContainer()),this._tip=se.create("div","maplibregl-popup-tip mapboxgl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className&&this.options.className.split(" ").forEach(p=>this._container.classList.add(p)),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer")),this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._map.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=po(this._lngLat,this._pos,this._map.transform)),this._trackPointer&&!a))return;const t=this._pos=this._trackPointer&&a?a:this._map.project(this._lngLat);let n=this.options.anchor;const s=ks(this.options.offset);if(!n){const p=this._container.offsetWidth,f=this._container.offsetHeight;let _;_=t.y+s.bottom.y<f?["top"]:t.y>this._map.transform.height-f?["bottom"]:[],t.x<p/2?_.push("left"):t.x>this._map.transform.width-p/2&&_.push("right"),n=_.length===0?"bottom":_.join("-")}const u=t.add(s[n]).round();se.setTransform(this._container,`${Ve[n]} translate(${u.x}px,${u.y}px)`),je(this._container,n,"popup")}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const a=this._container.querySelector(Zt);a&&a.focus()}_onClose(){this.remove()}},Marker:kn,Style:li,LngLat:l.LngLat,LngLatBounds:l.LngLatBounds,Point:l.pointGeometry,MercatorCoordinate:l.MercatorCoordinate,Evented:l.Evented,AJAXError:l.AJAXError,config:l.config,CanvasSource:qr,GeoJSONSource:ur,ImageSource:qi,RasterDEMTileSource:We,RasterTileSource:Er,VectorTileSource:un,VideoSource:Zi,prewarm:function(){mn().acquire(pr)},clearPrewarmedResources:function(){const a=Mr;a&&(a.isPreloaded()&&a.numActive()===1?(a.release(pr),Mr=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},get version(){return"2.4.0"},get workerCount(){return Si.workerCount},set workerCount(a){Si.workerCount=a},get maxParallelImageRequests(){return l.config.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(a){l.config.MAX_PARALLEL_IMAGE_REQUESTS=a},clearStorage(a){l.clearTileCache(a)},workerUrl:"",addProtocol(a,t){l.config.REGISTERED_PROTOCOLS[a]=t},removeProtocol(a){delete l.config.REGISTERED_PROTOCOLS[a]}};return Ui.extend(Qr,{isSafari:l.isSafari,getPerformanceMetrics:l.PerformanceUtils.getPerformanceMetrics}),Qr});var xe=j;return xe})})(ph);const Kf=ph.exports,Xd={x:0,y:0,width:0,height:0,top:0,left:0,bottom:0,right:0},Wd=()=>{const[P,$]=ge.exports.useState(null),[N,W]=ge.exports.useState(Xd),j=ge.exports.useMemo(()=>new window.ResizeObserver(Q=>{if(Q[0]){const{x:xe,y:l,width:ve,height:me,top:Ee,left:Te,bottom:se,right:gt}=Q[0].contentRect;W({x:xe,y:l,width:ve,height:me,top:Ee,left:Te,bottom:se,right:gt})}}),[]);return ge.exports.useLayoutEffect(()=>{if(!!P)return j.observe(P),()=>{j.disconnect()}},[P]),[$,N,P]},Hd=lt.memo(({marker:P})=>Bi(Vd,{latitude:P.lat,longitude:P.lng,style:{zIndex:1},children:Bi(xd.Root,{options:{style:P.icon||"house"}})}));Hd.displayName="Pin";function di(){return di=Object.assign?Object.assign.bind():function(P){for(var $=1;$<arguments.length;$++){var N=arguments[$];for(var W in N)Object.prototype.hasOwnProperty.call(N,W)&&(P[W]=N[W])}return P},di.apply(this,arguments)}function wc(P,$=[]){let N=[];function W(Q,xe){const l=ge.exports.createContext(xe),ve=N.length;N=[...N,xe];function me(Te){const{scope:se,children:gt,...nt}=Te,He=(se==null?void 0:se[P][ve])||l,Ut=ge.exports.useMemo(()=>nt,Object.values(nt));return ge.exports.createElement(He.Provider,{value:Ut},gt)}function Ee(Te,se){const gt=(se==null?void 0:se[P][ve])||l,nt=ge.exports.useContext(gt);if(nt)return nt;if(xe!==void 0)return xe;throw new Error(`\`${Te}\` must be used within \`${Q}\``)}return me.displayName=Q+"Provider",[me,Ee]}const j=()=>{const Q=N.map(xe=>ge.exports.createContext(xe));return function(l){const ve=(l==null?void 0:l[P])||Q;return ge.exports.useMemo(()=>({[`__scope${P}`]:{...l,[P]:ve}}),[l,ve])}};return j.scopeName=P,[W,Kd(j,...$)]}function Kd(...P){const $=P[0];if(P.length===1)return $;const N=()=>{const W=P.map(j=>({useScope:j(),scopeName:j.scopeName}));return function(Q){const xe=W.reduce((l,{useScope:ve,scopeName:me})=>{const Te=ve(Q)[`__scope${me}`];return{...l,...Te}},{});return ge.exports.useMemo(()=>({[`__scope${$.scopeName}`]:xe}),[xe])}};return N.scopeName=$.scopeName,N}function Jd(P,$){typeof P=="function"?P($):P!=null&&(P.current=$)}function fh(...P){return $=>P.forEach(N=>Jd(N,$))}function Ys(...P){return ge.exports.useCallback(fh(...P),P)}const ul=ge.exports.forwardRef((P,$)=>{const{children:N,...W}=P,j=ge.exports.Children.toArray(N),Q=j.find(Qd);if(Q){const xe=Q.props.children,l=j.map(ve=>ve===Q?ge.exports.Children.count(xe)>1?ge.exports.Children.only(null):ge.exports.isValidElement(xe)?xe.props.children:null:ve);return ge.exports.createElement(xc,di({},W,{ref:$}),ge.exports.isValidElement(xe)?ge.exports.cloneElement(xe,void 0,l):null)}return ge.exports.createElement(xc,di({},W,{ref:$}),N)});ul.displayName="Slot";const xc=ge.exports.forwardRef((P,$)=>{const{children:N,...W}=P;return ge.exports.isValidElement(N)?ge.exports.cloneElement(N,{...ef(W,N.props),ref:fh($,N.ref)}):ge.exports.Children.count(N)>1?ge.exports.Children.only(null):null});xc.displayName="SlotClone";const Yd=({children:P})=>ge.exports.createElement(ge.exports.Fragment,null,P);function Qd(P){return ge.exports.isValidElement(P)&&P.type===Yd}function ef(P,$){const N={...$};for(const W in $){const j=P[W],Q=$[W];/^on[A-Z]/.test(W)?N[W]=(...l)=>{Q==null||Q(...l),j==null||j(...l)}:W==="style"?N[W]={...j,...Q}:W==="className"&&(N[W]=[j,Q].filter(Boolean).join(" "))}return{...P,...N}}function tf(P){const $=P+"CollectionProvider",[N,W]=wc($),[j,Q]=N($,{collectionRef:{current:null},itemMap:new Map}),xe=gt=>{const{scope:nt,children:He}=gt,Ut=lt.useRef(null),Mt=lt.useRef(new Map).current;return lt.createElement(j,{scope:nt,itemMap:Mt,collectionRef:Ut},He)},l=P+"CollectionSlot",ve=lt.forwardRef((gt,nt)=>{const{scope:He,children:Ut}=gt,Mt=Q(l,He),ct=Ys(nt,Mt.collectionRef);return lt.createElement(ul,{ref:ct},Ut)}),me=P+"CollectionItemSlot",Ee="data-radix-collection-item",Te=lt.forwardRef((gt,nt)=>{const{scope:He,children:Ut,...Mt}=gt,ct=lt.useRef(null),vt=Ys(nt,ct),Wt=Q(me,He);return lt.useEffect(()=>(Wt.itemMap.set(ct,{ref:ct,...Mt}),()=>void Wt.itemMap.delete(ct))),lt.createElement(ul,{[Ee]:"",ref:vt},Ut)});function se(gt){const nt=Q(P+"CollectionConsumer",gt);return lt.useCallback(()=>{const Ut=nt.collectionRef.current;if(!Ut)return[];const Mt=Array.from(Ut.querySelectorAll(`[${Ee}]`));return Array.from(nt.itemMap.values()).sort((Wt,$t)=>Mt.indexOf(Wt.ref.current)-Mt.indexOf($t.ref.current))},[nt.collectionRef,nt.itemMap])}return[{Provider:xe,Slot:ve,ItemSlot:Te},se,W]}function mh(P,$,{checkForDefaultPrevented:N=!0}={}){return function(j){if(P==null||P(j),N===!1||!j.defaultPrevented)return $==null?void 0:$(j)}}function gh(P){const $=ge.exports.useRef(P);return ge.exports.useEffect(()=>{$.current=P}),ge.exports.useMemo(()=>(...N)=>{var W;return(W=$.current)===null||W===void 0?void 0:W.call($,...N)},[])}function Tc({prop:P,defaultProp:$,onChange:N=()=>{}}){const[W,j]=rf({defaultProp:$,onChange:N}),Q=P!==void 0,xe=Q?P:W,l=gh(N),ve=ge.exports.useCallback(me=>{if(Q){const Te=typeof me=="function"?me(P):me;Te!==P&&l(Te)}else j(me)},[Q,P,j,l]);return[xe,ve]}function rf({defaultProp:P,onChange:$}){const N=ge.exports.useState(P),[W]=N,j=ge.exports.useRef(W),Q=gh($);return ge.exports.useEffect(()=>{j.current!==W&&(Q(W),j.current=W)},[W,j,Q]),N}const nf=["a","button","div","h2","h3","img","li","nav","ol","p","span","svg","ul"],ea=nf.reduce((P,$)=>{const N=ge.exports.forwardRef((W,j)=>{const{asChild:Q,...xe}=W,l=Q?ul:$;return ge.exports.useEffect(()=>{window[Symbol.for("radix-ui")]=!0},[]),ge.exports.createElement(l,di({},xe,{ref:j}))});return N.displayName=`Primitive.${$}`,{...P,[$]:N}},{}),hl=Boolean(globalThis==null?void 0:globalThis.document)?ge.exports.useLayoutEffect:()=>{};function of(P,$){return ge.exports.useReducer((N,W)=>{const j=$[N][W];return j!=null?j:N},P)}const _h=P=>{const{present:$,children:N}=P,W=sf($),j=typeof N=="function"?N({present:W.isPresent}):ge.exports.Children.only(N),Q=Ys(W.ref,j.ref);return typeof N=="function"||W.isPresent?ge.exports.cloneElement(j,{ref:Q}):null};_h.displayName="Presence";function sf(P){const[$,N]=ge.exports.useState(),W=ge.exports.useRef({}),j=ge.exports.useRef(P),Q=ge.exports.useRef("none"),xe=P?"mounted":"unmounted",[l,ve]=of(xe,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return ge.exports.useEffect(()=>{const me=cl(W.current);Q.current=l==="mounted"?me:"none"},[l]),hl(()=>{const me=W.current,Ee=j.current;if(Ee!==P){const se=Q.current,gt=cl(me);P?ve("MOUNT"):gt==="none"||(me==null?void 0:me.display)==="none"?ve("UNMOUNT"):ve(Ee&&se!==gt?"ANIMATION_OUT":"UNMOUNT"),j.current=P}},[P,ve]),hl(()=>{if($){const me=Te=>{const gt=cl(W.current).includes(Te.animationName);Te.target===$&>&&bc.exports.flushSync(()=>ve("ANIMATION_END"))},Ee=Te=>{Te.target===$&&(Q.current=cl(W.current))};return $.addEventListener("animationstart",Ee),$.addEventListener("animationcancel",me),$.addEventListener("animationend",me),()=>{$.removeEventListener("animationstart",Ee),$.removeEventListener("animationcancel",me),$.removeEventListener("animationend",me)}}else ve("ANIMATION_END")},[$,ve]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:ge.exports.useCallback(me=>{me&&(W.current=getComputedStyle(me)),N(me)},[])}}function cl(P){return(P==null?void 0:P.animationName)||"none"}const af=vd["useId".toString()]||(()=>{});let lf=0;function yh(P){const[$,N]=ge.exports.useState(af());return hl(()=>{P||N(W=>W!=null?W:String(lf++))},[P]),P||($?`radix-${$}`:"")}const xh="Collapsible",[cf,vh]=wc(xh),[uf,Ec]=cf(xh),hf=ge.exports.forwardRef((P,$)=>{const{__scopeCollapsible:N,open:W,defaultOpen:j,disabled:Q,onOpenChange:xe,...l}=P,[ve=!1,me]=Tc({prop:W,defaultProp:j,onChange:xe});return ge.exports.createElement(uf,{scope:N,disabled:Q,contentId:yh(),open:ve,onOpenToggle:ge.exports.useCallback(()=>me(Ee=>!Ee),[me])},ge.exports.createElement(ea.div,di({"data-state":Sc(ve),"data-disabled":Q?"":void 0},l,{ref:$})))}),pf="CollapsibleTrigger",df=ge.exports.forwardRef((P,$)=>{const{__scopeCollapsible:N,...W}=P,j=Ec(pf,N);return ge.exports.createElement(ea.button,di({type:"button","aria-controls":j.contentId,"aria-expanded":j.open||!1,"data-state":Sc(j.open),"data-disabled":j.disabled?"":void 0,disabled:j.disabled},W,{ref:$,onClick:mh(P.onClick,j.onOpenToggle)}))}),bh="CollapsibleContent",ff=ge.exports.forwardRef((P,$)=>{const{forceMount:N,...W}=P,j=Ec(bh,P.__scopeCollapsible);return ge.exports.createElement(_h,{present:N||j.open},({present:Q})=>ge.exports.createElement(mf,di({},W,{ref:$,present:Q})))}),mf=ge.exports.forwardRef((P,$)=>{const{__scopeCollapsible:N,present:W,children:j,...Q}=P,xe=Ec(bh,N),[l,ve]=ge.exports.useState(W),me=ge.exports.useRef(null),Ee=Ys($,me),Te=ge.exports.useRef(0),se=Te.current,gt=ge.exports.useRef(0),nt=gt.current,He=xe.open||l,Ut=ge.exports.useRef(He),Mt=ge.exports.useRef();return ge.exports.useEffect(()=>{const ct=requestAnimationFrame(()=>Ut.current=!1);return()=>cancelAnimationFrame(ct)},[]),hl(()=>{const ct=me.current;if(ct){Mt.current=Mt.current||{transitionDuration:ct.style.transitionDuration,animationDuration:ct.style.animationDuration,animationFillMode:ct.style.animationFillMode},ct.style.transitionDuration="0s",ct.style.animationDuration="0s",ct.style.animationFillMode="none";const vt=ct.getBoundingClientRect();Te.current=vt.height,gt.current=vt.width,Ut.current||(ct.style.transitionDuration=Mt.current.transitionDuration,ct.style.animationDuration=Mt.current.animationDuration,ct.style.animationFillMode=Mt.current.animationFillMode),ve(W)}},[xe.open,W]),ge.exports.createElement(ea.div,di({"data-state":Sc(xe.open),"data-disabled":xe.disabled?"":void 0,id:xe.contentId,hidden:!He},Q,{ref:Ee,style:{["--radix-collapsible-content-height"]:se?`${se}px`:void 0,["--radix-collapsible-content-width"]:nt?`${nt}px`:void 0,...P.style}}),He&&j)});function Sc(P){return P?"open":"closed"}const gf=hf,_f=df,yf=ff,ta="Accordion",xf=["Home","End","ArrowDown","ArrowUp"],[Ic,vf,bf]=tf(ta),[dl,Jf]=wc(ta,[bf,vh]),Ac=vh(),wh=lt.forwardRef((P,$)=>{const{type:N,...W}=P,j=W,Q=W;return lt.createElement(Ic.Provider,{scope:P.__scopeAccordion},N==="multiple"?lt.createElement(Sf,di({},Q,{ref:$})):lt.createElement(Ef,di({},j,{ref:$})))});wh.propTypes={type(P){const $=P.value||P.defaultValue;return P.type&&!["single","multiple"].includes(P.type)?new Error("Invalid prop `type` supplied to `Accordion`. Expected one of `single | multiple`."):P.type==="multiple"&&typeof $=="string"?new Error("Invalid prop `type` supplied to `Accordion`. Expected `single` when `defaultValue` or `value` is type `string`."):P.type==="single"&&Array.isArray($)?new Error("Invalid prop `type` supplied to `Accordion`. Expected `multiple` when `defaultValue` or `value` is type `string[]`."):null}};const[Th,wf]=dl(ta),[Eh,Tf]=dl(ta,{collapsible:!1}),Ef=lt.forwardRef((P,$)=>{const{value:N,defaultValue:W,onValueChange:j=()=>{},collapsible:Q=!1,...xe}=P,[l,ve]=Tc({prop:N,defaultProp:W,onChange:j});return lt.createElement(Th,{scope:P.__scopeAccordion,value:l?[l]:[],onItemOpen:ve,onItemClose:lt.useCallback(()=>Q&&ve(""),[Q,ve])},lt.createElement(Eh,{scope:P.__scopeAccordion,collapsible:Q},lt.createElement(Sh,di({},xe,{ref:$}))))}),Sf=lt.forwardRef((P,$)=>{const{value:N,defaultValue:W,onValueChange:j=()=>{},...Q}=P,[xe=[],l]=Tc({prop:N,defaultProp:W,onChange:j}),ve=lt.useCallback(Ee=>l((Te=[])=>[...Te,Ee]),[l]),me=lt.useCallback(Ee=>l((Te=[])=>Te.filter(se=>se!==Ee)),[l]);return lt.createElement(Th,{scope:P.__scopeAccordion,value:xe,onItemOpen:ve,onItemClose:me},lt.createElement(Eh,{scope:P.__scopeAccordion,collapsible:!0},lt.createElement(Sh,di({},Q,{ref:$}))))}),[If,Af]=dl(ta),Sh=lt.forwardRef((P,$)=>{const{__scopeAccordion:N,disabled:W,...j}=P,Q=lt.useRef(null),xe=Ys(Q,$),l=vf(N),ve=mh(P.onKeyDown,me=>{var Ee;if(!xf.includes(me.key))return;const Te=me.target,se=l().filter(Mt=>{var ct;return!((ct=Mt.ref.current)!==null&&ct!==void 0&&ct.disabled)}),gt=se.findIndex(Mt=>Mt.ref.current===Te),nt=se.length;if(gt===-1)return;me.preventDefault();let He=gt;switch(me.key){case"Home":He=0;break;case"End":He=nt-1;break;case"ArrowDown":He=gt+1;break;case"ArrowUp":He=gt-1,He<0&&(He=nt-1);break}const Ut=He%nt;(Ee=se[Ut].ref.current)===null||Ee===void 0||Ee.focus()});return lt.createElement(If,{scope:N,disabled:W},lt.createElement(Ic.Slot,{scope:N},lt.createElement(ea.div,di({},j,{ref:xe,onKeyDown:W?void 0:ve}))))}),vc="AccordionItem",[Cf,Cc]=dl(vc),Mf=lt.forwardRef((P,$)=>{const{__scopeAccordion:N,value:W,...j}=P,Q=Af(vc,N),xe=wf(vc,N),l=Ac(N),ve=yh(),me=W&&xe.value.includes(W)||!1,Ee=Q.disabled||P.disabled;return lt.createElement(Cf,{scope:N,open:me,disabled:Ee,triggerId:ve},lt.createElement(gf,di({"data-state":me?"open":"closed"},l,j,{ref:$,disabled:Ee,open:me,onOpenChange:Te=>{Te?xe.onItemOpen(W):xe.onItemClose(W)}})))}),zf="AccordionHeader",Pf=lt.forwardRef((P,$)=>{const{__scopeAccordion:N,...W}=P,j=Cc(zf,N);return lt.createElement(ea.h3,di({"data-state":Rf(j.open),"data-disabled":j.disabled?"":void 0},W,{ref:$}))}),oh="AccordionTrigger",kf=lt.forwardRef((P,$)=>{const{__scopeAccordion:N,...W}=P,j=Cc(oh,N),Q=Tf(oh,N),xe=Ac(N);return lt.createElement(Ic.ItemSlot,{scope:N},lt.createElement(_f,di({"aria-disabled":j.open&&!Q.collapsible||void 0,id:j.triggerId},xe,W,{ref:$})))}),Df="AccordionContent",Lf=lt.forwardRef((P,$)=>{const{__scopeAccordion:N,...W}=P,j=Cc(Df,N),Q=Ac(N);return lt.createElement(yf,di({role:"region","aria-labelledby":j.triggerId},Q,W,{ref:$,style:{["--radix-accordion-content-height"]:"var(--radix-collapsible-content-height)",["--radix-accordion-content-width"]:"var(--radix-collapsible-content-width)",...P.style}}))});function Rf(P){return P?"open":"closed"}const Yf=wh,Qf=Mf,em=Pf,tm=kf,im=Lf,rm=P=>ge.exports.createElement("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",...P},ge.exports.createElement("path",{d:"M9.99984 6L8.58984 7.41L13.1698 12L8.58984 16.59L9.99984 18L15.9998 12L9.99984 6Z"})),Bf=es(sh.div)`
|
|
580
580
|
overflow: hidden;
|
|
581
|
-
|
|
581
|
+
`,Ff=({transitionOpacity:P=!0,defaultHeight:$=0,open:N,children:W})=>{const[j,Q]=Wd(),xe={open:{height:Q.height,opacity:1},closed:{height:$,opacity:P?0:1}};return Bi(Bf,{variants:xe,initial:N?"open":"closed",animate:N?"open":"closed",transition:{ease:"easeInOut"},children:Bi("div",{ref:j,children:W})})},Ih={all:()=>["geocodes"],list:P=>[...Ih.all(),P]},Of="https://geocoder.ls.hereapi.com/6.2/geocode.json?";function Uf(P){const $={locationid:P,country:"CAN,USA",apiKey:"KDL0aAzsbOcv7p53P2ovno2izfDOe93hyzZRrayktbE"},N=()=>fetch(Of+new URLSearchParams($)).then(W=>W.json()).then(W=>W.Response.View[0].Result[0]);return ah(Ih.list($),N,{enabled:!!P})}const Ah={all:()=>["suggestions"],list:P=>[...Ah.all(),P]},$f="https://autocomplete.geocoder.ls.hereapi.com/6.2/suggest.json?";function Vf(P,$){const N={query:P,country:"CAN,USA",apiKey:"KDL0aAzsbOcv7p53P2ovno2izfDOe93hyzZRrayktbE",prox:`${$},2500`},W=()=>fetch($f+new URLSearchParams(N)).then(j=>j.json());return ah(Ah.list(N),W,{enabled:!!P.length})}const Nf=es.div`
|
|
582
582
|
position: relative;
|
|
583
|
-
`,
|
|
583
|
+
`,Gf=es.div`
|
|
584
584
|
position: absolute;
|
|
585
585
|
top: calc(100% + 6px);
|
|
586
586
|
width: 100%;
|
|
@@ -590,9 +590,9 @@ uniform ${T} ${I} u_${C};
|
|
|
590
590
|
border-radius: ${vo["--ll-border-radius-small"]};
|
|
591
591
|
z-index: 3;
|
|
592
592
|
|
|
593
|
-
${({renderListAbove:P,renderListAbovePosition
|
|
593
|
+
${({renderListAbove:P,renderListAbovePosition:$})=>P&&bd`
|
|
594
594
|
top: inherit;
|
|
595
|
-
bottom: ${
|
|
595
|
+
bottom: ${$}px;
|
|
596
596
|
`}
|
|
597
597
|
`,Ch=es.button`
|
|
598
598
|
width: 100%;
|
|
@@ -606,11 +606,11 @@ uniform ${T} ${I} u_${C};
|
|
|
606
606
|
&:focus {
|
|
607
607
|
transform: translate3d(0, 0, 0);
|
|
608
608
|
}
|
|
609
|
-
`,
|
|
609
|
+
`,qf=es.ul`
|
|
610
610
|
list-style-type: none;
|
|
611
611
|
padding: 0;
|
|
612
612
|
margin: 0;
|
|
613
|
-
`,
|
|
613
|
+
`,Zf=es.li`
|
|
614
614
|
&:last-child {
|
|
615
615
|
${Ch} {
|
|
616
616
|
overflow: hidden;
|
|
@@ -622,4 +622,4 @@ uniform ${T} ${I} u_${C};
|
|
|
622
622
|
&:hover {
|
|
623
623
|
background-color: ${vo["--ll-color-surface"]};
|
|
624
624
|
}
|
|
625
|
-
`,
|
|
625
|
+
`,nm=({label:P,onSearch:$,onSelect:N,placeholder:W,renderListAbove:j=!0,renderListAbovePosition:Q=0})=>{const[xe,l]=ge.exports.useState(""),[ve,me]=ge.exports.useState(""),{data:Ee,isLoading:Te}=Uf(ve),se=wd(xe,300),[gt,nt]=ge.exports.useState(!0),{data:He}=Vf(se,`${Ee==null?void 0:Ee.Location.DisplayPosition.Latitude},${Ee==null?void 0:Ee.Location.DisplayPosition.Longitude}`),Ut=ge.exports.useMemo(()=>xe?(He==null?void 0:He.suggestions)||[]:Ju.getSuggestionHistory(),[xe,He==null?void 0:He.suggestions]);ge.exports.useEffect(()=>{!Ee||Te||($({longitude:Ee.Location.DisplayPosition.Longitude,latitude:Ee.Location.DisplayPosition.Latitude}),nt(!1))},[Ee]);const Mt=({locationId:vt,address:Wt})=>{!vt||!Wt||(me(vt),l(Yu.formatAddress(Wt)),Ju.push({locationId:vt,address:Wt}))},ct=(vt,Wt)=>Yu.formatAddress(vt).split(new RegExp(`(${Wt})`,"gi")).map((Fi,fi)=>Fi.toLowerCase()===Wt.toLowerCase()?Bi("strong",{children:Fi},fi):Bi("span",{children:Fi},fi));return Td(Nf,{onSelect:N,children:[Bi(Ed,{autofocus:!0,value:xe,label:P,placeholder:W,onFocus:()=>nt(!0),onBlur:()=>nt(!1),onChange:vt=>{l(vt.currentTarget.value),nt(!0)}}),Bi(Gf,{renderListAbove:j,renderListAbovePosition:Q,children:Bi(Ff,{open:gt&&!!Ut.length,children:Bi(qf,{children:Ut.map((vt,Wt)=>Bi(Zf,{children:Bi(Ch,{onClick:()=>Mt(vt),children:Bi(sh.div,{animate:{y:[10,0],opacity:[0,1]},transition:{delay:(Wt+1)*.03,type:"spring",duration:.4},children:ct(vt.address,xe)})})},vt.locationId))})})})]})};export{em as $,Ff as A,pl as M,Hf as N,Hd as P,rm as S,Vd as a,tm as b,im as c,Un as d,Qf as e,Yf as f,Nf as g,nm as h,lh as i,Wf as j,Lf as k,Kf as m,Wd as u};
|