@local-logic/sdks-app 1.0.0-beta.44 → 1.0.0-beta.47

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.
Files changed (40) hide show
  1. package/dist/assets/{index.e4acce0a.js → index.5f83f8f9.js} +98 -90
  2. package/dist/assets/{index.bffff470.js → index.d57859aa.js} +126 -126
  3. package/dist/index.html +1 -1
  4. package/dist/types/constants/routes.d.ts +1 -2
  5. package/dist/types/constants/routes.d.ts.map +1 -1
  6. package/dist/types/constants/routes.js +0 -1
  7. package/dist/types/constants/routes.js.map +1 -1
  8. package/dist/types/context/stateManager/defaultState.d.ts +4 -1
  9. package/dist/types/context/stateManager/defaultState.d.ts.map +1 -1
  10. package/dist/types/context/stateManager/defaultState.js +7 -2
  11. package/dist/types/context/stateManager/defaultState.js.map +1 -1
  12. package/dist/types/context/stateManager/index.d.ts.map +1 -1
  13. package/dist/types/context/stateManager/index.js +3 -8
  14. package/dist/types/context/stateManager/index.js.map +1 -1
  15. package/dist/types/sdks/LocalContent/Map/Markers/index.d.ts.map +1 -1
  16. package/dist/types/sdks/LocalContent/Map/Markers/index.js +9 -1
  17. package/dist/types/sdks/LocalContent/Map/Markers/index.js.map +1 -1
  18. package/dist/types/sdks/LocalContent/Map/MobileScores/ScoreCategory/index.d.ts.map +1 -1
  19. package/dist/types/sdks/LocalContent/Map/MobileScores/ScoreCategory/index.js +23 -32
  20. package/dist/types/sdks/LocalContent/Map/MobileScores/ScoreCategory/index.js.map +1 -1
  21. package/dist/types/sdks/LocalContent/Map/MobileScores/ScoreCategory/styles.d.ts +1 -0
  22. package/dist/types/sdks/LocalContent/Map/MobileScores/ScoreCategory/styles.d.ts.map +1 -1
  23. package/dist/types/sdks/LocalContent/Map/MobileScores/ScoreCategory/styles.js +6 -2
  24. package/dist/types/sdks/LocalContent/Map/MobileScores/ScoreCategory/styles.js.map +1 -1
  25. package/dist/types/sdks/LocalContent/Map/MobileScores/ScoreInfo/styles.d.ts.map +1 -1
  26. package/dist/types/sdks/LocalContent/Map/MobileScores/ScoreInfo/styles.js +4 -0
  27. package/dist/types/sdks/LocalContent/Map/MobileScores/ScoreInfo/styles.js.map +1 -1
  28. package/dist/types/sdks/LocalContent/Map/MobileScores/styles.d.ts.map +1 -1
  29. package/dist/types/sdks/LocalContent/Map/MobileScores/styles.js +2 -1
  30. package/dist/types/sdks/LocalContent/Map/MobileScores/styles.js.map +1 -1
  31. package/dist/types/sdks/LocalContent/Map/index.d.ts.map +1 -1
  32. package/dist/types/sdks/LocalContent/Map/index.js +7 -6
  33. package/dist/types/sdks/LocalContent/Map/index.js.map +1 -1
  34. package/dist/types/sdks/LocalContent/context.d.ts.map +1 -1
  35. package/dist/types/sdks/LocalContent/context.js +23 -10
  36. package/dist/types/sdks/LocalContent/context.js.map +1 -1
  37. package/dist/types/sdks/LocalContent/defaultState.d.ts +4 -1
  38. package/dist/types/sdks/LocalContent/defaultState.d.ts.map +1 -1
  39. package/dist/types/sdks/LocalContent/defaultState.js.map +1 -1
  40. package/package.json +2 -2
@@ -1,5 +1,5 @@
1
- import{R as Tf,r as Te,$ as jh,a as Xh,b as nt,j as Se,s as Tl,_ as Ef,c as Wh,d as Sf,i as Co,u as El,e as Sl,f as qc,g as Zc,h as If,k as Zt,t as Tt,F as Il,l as Ri,m as Lc,n as os,o as jc,p as bl,q as Sh,v as la,w as cr,x as Hh,y as Cf,U as Kh,z as Jh,L as Cl,A as tr,S as Ih,B as Af,C as oa,D as yl,E as Mf,T as Pf,G as zf,H as kf}from"./index.bffff470.js";var sa=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};const Df=Tf["useId".toString()]||(()=>{});let Lf=0;function Yh(b){const[I,A]=Te.exports.useState(Df());return jh(()=>{b||A(D=>D!=null?D:String(Lf++))},[b]),b||(I?`radix-${I}`:"")}function Xc({prop:b,defaultProp:I,onChange:A=()=>{}}){const[D,F]=Rf({defaultProp:I,onChange:A}),N=b!==void 0,oe=N?b:D,a=Xh(A),Y=Te.exports.useCallback(te=>{if(N){const ue=typeof te=="function"?te(b):te;ue!==b&&a(ue)}else F(te)},[N,b,F,a]);return[oe,Y]}function Rf({defaultProp:b,onChange:I}){const A=Te.exports.useState(b),[D]=A,F=Te.exports.useRef(D),N=Xh(I);return Te.exports.useEffect(()=>{F.current!==D&&(N(D),F.current=D)},[D,F,N]),A}const Qh=nt.createContext({}),Zn=()=>Te.exports.useContext(Qh),Bf=(b,I)=>{switch(I.type){case"CATEGORY":return{...b,activeCategory:I.value};case"SCORE":{const A=Tl.find(D=>I.value===""?D.value===b.activeCategory:D.scores.includes(I.value)).value;return{activeCategory:A,activeScoreByCategory:{...b.activeScoreByCategory,[A]:I.value}}}}},Ff=({children:b})=>{const[I,A]=Te.exports.useState(!1),[D,F]=Te.exports.useReducer(Bf,{activeCategory:"commute",activeScoreByCategory:{commute:"pedestrian_friendly",amenities:"groceries",character:"vibrant",nature:"parks",education:"high_schools"}}),[N,oe]=Te.exports.useState(),[a,Y]=Te.exports.useState(),{activeCategory:te}=D,fe=D.activeScoreByCategory[te],ue=$e=>{F({type:"SCORE",value:$e})},ie=$e=>{F({type:"CATEGORY",value:$e})},Ge=Te.exports.useMemo(()=>({activeScore:fe,setActiveScore:ue,activeCategory:te,setActiveCategory:ie,activePOI:N,setActivePOI:oe,hoveredPOI:a,setHoveredPOI:Y,showMobileList:I,setShowMobileList:A}),[fe,ue,te,ie,N,oe,a,Y,I,A]);return Se(Qh.Provider,{value:Ge,children:b})},Of=Te.exports.createContext(null);function $f(b){const I=b.clone();return I.pixelsToGLUnits=b.pixelsToGLUnits,I}function Ch(b){return{longitude:b.center.lng,latitude:b.center.lat,zoom:b.zoom,pitch:b.pitch,bearing:b.bearing,padding:b.padding}}function Ah(b,I){const A=I.viewState||I;let D=!1;if("longitude"in A&&"latitude"in A){const F=b.center;b.center=new F.constructor(A.longitude,A.latitude),D=D||F!==b.center}if("zoom"in A){const F=b.zoom;b.zoom=A.zoom,D=D||F!==b.zoom}if("bearing"in A){const F=b.bearing;b.bearing=A.bearing,D=D||F!==b.bearing}if("pitch"in A){const F=b.pitch;b.pitch=A.pitch,D=D||F!==b.pitch}return A.padding&&!b.isPaddingEqual(A.padding)&&(D=!0,b.padding=A.padding),D}const Uf=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function Mh(b){if(!b)return null;if(typeof b=="string"||("toJS"in b&&(b=b.toJS()),!b.layers))return b;const I={};for(const D of b.layers)I[D.id]=D;const A=b.layers.map(D=>{const F=I[D.ref];let N=null;if("interactive"in D&&(N={...D},delete N.interactive),F){N=N||{...D},delete N.ref;for(const oe of Uf)oe in F&&(N[oe]=F[oe])}return N||D});return{...b,layers:A}}function Vf(b,I){const A=Array.isArray(b)?b[0]:b?b.x:0,D=Array.isArray(b)?b[1]:b?b.y:0,F=Array.isArray(I)?I[0]:I?I.x:0,N=Array.isArray(I)?I[1]:I?I.y:0;return A===F&&D===N}function qn(b,I){if(b===I)return!0;if(!b||!I)return!1;if(Array.isArray(b)){if(!Array.isArray(I)||b.length!==I.length)return!1;for(let A=0;A<b.length;A++)if(!qn(b[A],I[A]))return!1;return!0}else if(Array.isArray(I))return!1;if(typeof b=="object"&&typeof I=="object"){const A=Object.keys(b),D=Object.keys(I);if(A.length!==D.length)return!1;for(const F of A)if(!I.hasOwnProperty(F)||!qn(b[F],I[F]))return!1;return!0}return!1}const Ph={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"},Rc={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"},zh={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"},Nf=["minZoom","maxZoom","minPitch","maxPitch","maxBounds","projection","renderWorldCopies"],Gf=["scrollZoom","boxZoom","dragRotate","dragPan","keyboard","doubleClickZoom","touchZoomRotate","touchPitch"];class ss{constructor(I,A,D){this._map=null,this._internalUpdate=!1,this._inRender=!1,this._hoveredFeatures=null,this._deferredEvents={move:!1,zoom:!1,pitch:!1,rotate:!1},this._onEvent=F=>{const N=this.props[zh[F.type]];N&&N(F)},this._onPointerEvent=F=>{(F.type==="mousemove"||F.type==="mouseout")&&this._updateHover(F);const N=this.props[Ph[F.type]];if(N){if(this.props.interactiveLayerIds&&F.type!=="mouseover"&&F.type!=="mouseout"){const oe=this._hoveredFeatures||this._map.queryRenderedFeatures(F.point,{layers:this.props.interactiveLayerIds});F.features=oe}N(F),delete F.features}},this._onCameraEvent=F=>{if(!this._internalUpdate){const N=this.props[Rc[F.type]];N&&N(F)}F.type in this._deferredEvents&&(this._deferredEvents[F.type]=!1)},this._MapClass=I,this.props=A,this._initialize(D)}get map(){return this._map}get transform(){return this._renderTransform}setProps(I){const A=this.props;this.props=I;const D=this._updateSettings(I,A);D&&this._createShadowTransform(this._map);const F=this._updateSize(I),N=this._updateViewState(I,!0);this._updateStyle(I,A),this._updateStyleComponents(I,A),this._updateHandlers(I,A),(D||F||N&&!this._map.isMoving())&&this.redraw()}static reuse(I,A){const D=ss.savedMaps.pop();if(!D)return null;const F=D.map,N=F.getContainer();for(A.className=N.className;N.childNodes.length>0;)A.appendChild(N.childNodes[0]);F._container=A,D.setProps({...I,styleDiffing:!1}),F.resize();const{initialViewState:oe}=I;return oe&&(oe.bounds?F.fitBounds(oe.bounds,{...oe.fitBoundsOptions,duration:0}):D._updateViewState(oe,!1)),F.isStyleLoaded()?F.fire("load"):F.once("styledata",()=>F.fire("load")),D}_initialize(I){const{props:A}=this,D={...A,...A.initialViewState,accessToken:A.mapboxAccessToken||qf()||null,container:I,style:Mh(A.mapStyle)},F=D.initialViewState||D.viewState||D;if(Object.assign(D,{center:[F.longitude||0,F.latitude||0],zoom:F.zoom||0,pitch:F.pitch||0,bearing:F.bearing||0}),A.gl){const te=HTMLCanvasElement.prototype.getContext;HTMLCanvasElement.prototype.getContext=()=>(HTMLCanvasElement.prototype.getContext=te,A.gl)}const N=new this._MapClass(D);F.padding&&N.setPadding(F.padding),A.cursor&&(N.getCanvas().style.cursor=A.cursor),this._createShadowTransform(N);const oe=N._render;N._render=te=>{this._inRender=!0,oe.call(N,te),this._inRender=!1};const a=N._renderTaskQueue.run;N._renderTaskQueue.run=te=>{a.call(N._renderTaskQueue,te),this._onBeforeRepaint()},N.on("render",()=>this._onAfterRepaint());const Y=N.fire;N.fire=this._fireEvent.bind(this,Y),N.on("resize",()=>{this._renderTransform.resize(N.transform.width,N.transform.height)}),N.on("styledata",()=>this._updateStyleComponents(this.props,{})),N.on("sourcedata",()=>this._updateStyleComponents(this.props,{}));for(const te in Ph)N.on(te,this._onPointerEvent);for(const te in Rc)N.on(te,this._onCameraEvent);for(const te in zh)N.on(te,this._onEvent);this._map=N}recycle(){ss.savedMaps.push(this)}destroy(){this._map.remove()}redraw(){const I=this._map;!this._inRender&&I.style&&(I._frame&&(I._frame.cancel(),I._frame=null),I._render())}_createShadowTransform(I){const A=$f(I.transform);I.painter.transform=A,this._renderTransform=A}_updateSize(I){const{viewState:A}=I;if(A){const D=this._map;if(A.width!==D.transform.width||A.height!==D.transform.height)return D.resize(),!0}return!1}_updateViewState(I,A){if(this._internalUpdate)return!1;const D=this._map,F=this._renderTransform,{zoom:N,pitch:oe,bearing:a}=F,Y=D.isMoving();Y&&(F.cameraElevationReference="sea");const te=Ah(F,{...Ch(D.transform),...I});if(Y&&(F.cameraElevationReference="ground"),te&&A){const fe=this._deferredEvents;fe.move=!0,fe.zoom||(fe.zoom=N!==F.zoom),fe.rotate||(fe.rotate=a!==F.bearing),fe.pitch||(fe.pitch=oe!==F.pitch)}return Y||Ah(D.transform,I),te}_updateSettings(I,A){const D=this._map;let F=!1;for(const N of Nf)N in I&&!qn(I[N],A[N])&&(F=!0,D[`set${N[0].toUpperCase()}${N.slice(1)}`](I[N]));return F}_updateStyle(I,A){if(I.cursor!==A.cursor&&(this._map.getCanvas().style.cursor=I.cursor),I.mapStyle!==A.mapStyle){const D={diff:I.styleDiffing};return"localIdeographFontFamily"in I&&(D.localIdeographFontFamily=I.localIdeographFontFamily),this._map.setStyle(Mh(I.mapStyle),D),!0}return!1}_updateStyleComponents(I,A){const D=this._map;let F=!1;return D.style.loaded()&&("light"in I&&!qn(I.light,A.light)&&(F=!0,D.setLight(I.light)),"fog"in I&&!qn(I.fog,A.fog)&&(F=!0,D.setFog(I.fog)),"terrain"in I&&!qn(I.terrain,A.terrain)&&(!I.terrain||D.getSource(I.terrain.source))&&(F=!0,D.setTerrain(I.terrain))),F}_updateHandlers(I,A){const D=this._map;let F=!1;for(const N of Gf){const oe=I[N];qn(oe,A[N])||(F=!0,oe?D[N].enable(oe):D[N].disable())}return F}_updateHover(I){var A;const{props:D}=this;if(D.interactiveLayerIds&&(D.onMouseMove||D.onMouseEnter||D.onMouseLeave)){const N=I.type,oe=((A=this._hoveredFeatures)===null||A===void 0?void 0:A.length)>0;let a;if(N==="mousemove")try{a=this._map.queryRenderedFeatures(I.point,{layers:D.interactiveLayerIds})}catch{a=[]}else a=[];const Y=a.length>0;!Y&&oe&&(I.type="mouseleave",this._onPointerEvent(I)),this._hoveredFeatures=a,Y&&!oe&&(I.type="mouseenter",this._onPointerEvent(I)),I.type=N}else this._hoveredFeatures=null}_fireEvent(I,A,D){const F=this._map,N=F.transform,oe=typeof A=="string"?A:A.type;return oe==="move"&&this._updateViewState(this.props,!1),oe in Rc&&(typeof A=="object"&&(A.viewState=Ch(N)),this._map.isMoving())?(F.transform=this._renderTransform,I.call(F,A,D),F.transform=N,F):(I.call(F,A,D),F)}_onBeforeRepaint(){const I=this._map;this._internalUpdate=!0;for(const D in this._deferredEvents)this._deferredEvents[D]&&I.fire(D);this._internalUpdate=!1;const A=this._map.transform;this._map.transform=this._renderTransform,this._onAfterRepaint=()=>{this._map.transform=A}}}ss.savedMaps=[];function qf(){let b=null;if(typeof location!="undefined"){const I=/access_token=([^&\/]*)/.exec(location.search);b=I&&I[1]}try{b=b||{}.MapboxAccessToken}catch{}try{b=b||{}.REACT_APP_MAPBOX_ACCESS_TOKEN}catch{}return b}const Zf=["setMaxBounds","setMinZoom","setMaxZoom","setMinPitch","setMaxPitch","setRenderWorldCopies","setProjection","setStyle","addSource","removeSource","addLayer","removeLayer","setLayerZoomRange","setFilter","setPaintProperty","setLayoutProperty","setLight","setTerrain","setFog","remove"];function jf(b,I){if(!b)return null;const A=b.map,D={getMap:()=>A,getCenter:()=>b.transform.center,getZoom:()=>b.transform.zoom,getBearing:()=>b.transform.bearing,getPitch:()=>b.transform.pitch,getPadding:()=>b.transform.padding,getBounds:()=>b.transform.getBounds(),project:F=>b.transform.locationPoint(I.LngLat.convert(F)),unproject:F=>b.transform.pointLocation(I.Point.convert(F)),queryTerrainElevation:(F,N)=>{const oe=A.transform;A.transform=b.transform;const a=A.queryTerrainElevation(F,N);return A.transform=oe,a}};for(const F of Xf(A))!(F in D)&&!Zf.includes(F)&&(D[F]=A[F].bind(A));return D}function Xf(b){const I=new Set;let A=b;for(;A;){for(const D of Object.getOwnPropertyNames(A))D[0]!=="_"&&typeof b[D]=="function"&&D!=="fire"&&D!=="setEventedParent"&&I.add(D);A=Object.getPrototypeOf(A)}return Array.from(I)}const Wf=typeof document!="undefined"?Te.exports.useLayoutEffect:Te.exports.useEffect,Hf=["baseApiUrl","maxParallelImageRequests","workerClass","workerCount","workerUrl"];function Kf(b,I){for(const A of Hf)A in I&&(b[A]=I[A]);I.RTLTextPlugin&&b.getRTLTextPluginStatus&&b.getRTLTextPluginStatus()==="unavailable"&&b.setRTLTextPlugin(I.RTLTextPlugin,A=>{A&&console.error(A)},!1)}const Al=Te.exports.createContext(null),Jf={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:b=>console.error(b.error),RTLTextPlugin:"https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.2.3/mapbox-gl-rtl-text.js"},Wc=Te.exports.forwardRef((b,I)=>{const A=Te.exports.useContext(Of),[D,F]=Te.exports.useState(null),N=Te.exports.useRef(),{current:oe}=Te.exports.useRef({mapLib:null,map:null});Te.exports.useEffect(()=>{const Y=b.mapLib;let te=!0,fe;return Promise.resolve(Y||Ef(()=>import("./index.c629d6a1.js").then(function(ue){return ue.i}),[])).then(ue=>{if(!!te){if(ue.Map||(ue=ue.default),!ue||!ue.Map)throw new Error("Invalid mapLib");if(ue.supported(b))Kf(ue,b),b.reuseMaps&&(fe=ss.reuse(b,N.current)),fe||(fe=new ss(ue.Map,b,N.current)),oe.map=jf(fe,ue),oe.mapLib=ue,F(fe),A==null||A.onMapMount(oe.map,b.id);else throw new Error("Map is not supported by this browser")}}).catch(ue=>{b.onError({type:"error",target:null,originalEvent:null,error:ue})}),()=>{te=!1,fe&&(A==null||A.onMapUnmount(b.id),b.reuseMaps?fe.recycle():fe.destroy())}},[]),Wf(()=>{D&&D.setProps(b)}),Te.exports.useImperativeHandle(I,()=>oe.map,[D]);const a=Te.exports.useMemo(()=>({position:"relative",width:"100%",height:"100%",...b.style}),[b.style]);return Te.exports.createElement("div",{id:b.id,ref:N,style:a},D&&Te.exports.createElement(Al.Provider,{value:oe},b.children))});Wc.displayName="Map";Wc.defaultProps=Jf;const Yf=/box|flex|grid|column|lineHeight|fontWeight|opacity|order|tabSize|zIndex/;function Ao(b,I){if(!b||!I)return;const A=b.style;for(const D in I){const F=I[D];Number.isFinite(F)&&!Yf.test(D)?A[D]=`${F}px`:A[D]=F}}const Qf={draggable:!1,popup:null,rotation:0,rotationAlignment:"auto",pitchAlignment:"auto"};function ep(b){const{map:I,mapLib:A}=Te.exports.useContext(Al),D=Te.exports.useRef({props:b});D.current.props=b;const F=Te.exports.useMemo(()=>{let N=!1;Te.exports.Children.forEach(b.children,Y=>{Y&&(N=!0)});const oe={...b,element:N?document.createElement("div"):null},a=new A.Marker(oe).setLngLat([b.longitude,b.latitude]);return a.getElement().addEventListener("click",Y=>{var te,fe;(fe=(te=D.current.props).onClick)===null||fe===void 0||fe.call(te,{type:"click",target:a,originalEvent:Y})}),a.on("dragstart",Y=>{var te,fe;const ue=Y;ue.lngLat=F.getLngLat(),(fe=(te=D.current.props).onDragStart)===null||fe===void 0||fe.call(te,ue)}),a.on("drag",Y=>{var te,fe;const ue=Y;ue.lngLat=F.getLngLat(),(fe=(te=D.current.props).onDrag)===null||fe===void 0||fe.call(te,ue)}),a.on("dragend",Y=>{var te,fe;const ue=Y;ue.lngLat=F.getLngLat(),(fe=(te=D.current.props).onDragEnd)===null||fe===void 0||fe.call(te,ue)}),a},[]);return Te.exports.useEffect(()=>(F.addTo(I.getMap()),()=>{F.remove()}),[]),Te.exports.useEffect(()=>{Ao(F.getElement(),b.style)},[b.style]),(F.getLngLat().lng!==b.longitude||F.getLngLat().lat!==b.latitude)&&F.setLngLat([b.longitude,b.latitude]),b.offset&&!Vf(F.getOffset(),b.offset)&&F.setOffset(b.offset),F.isDraggable()!==b.draggable&&F.setDraggable(b.draggable),F.getRotation()!==b.rotation&&F.setRotation(b.rotation),F.getRotationAlignment()!==b.rotationAlignment&&F.setRotationAlignment(b.rotationAlignment),F.getPitchAlignment()!==b.pitchAlignment&&F.setPitchAlignment(b.pitchAlignment),F.getPopup()!==b.popup&&F.setPopup(b.popup),Wh.exports.createPortal(b.children,F.getElement())}ep.defaultProps=Qf;var $c=Te.exports.memo(ep);function kh(b){return new Set(b?b.trim().split(/\s+/):[])}function em(b){const{map:I,mapLib:A}=Te.exports.useContext(Al),D=Te.exports.useMemo(()=>document.createElement("div"),[]),F=Te.exports.useRef({props:b});F.current.props=b;const N=Te.exports.useMemo(()=>{const oe={...b},a=new A.Popup(oe).setLngLat([b.longitude,b.latitude]);return a.once("open",Y=>{var te,fe;(fe=(te=F.current.props).onOpen)===null||fe===void 0||fe.call(te,Y)}),a},[]);if(Te.exports.useEffect(()=>{const oe=a=>{var Y,te;(te=(Y=F.current.props).onClose)===null||te===void 0||te.call(Y,a)};return N.on("close",oe),N.setDOMContent(D).addTo(I.getMap()),()=>{N.off("close",oe),N.isOpen()&&N.remove()}},[]),Te.exports.useEffect(()=>{Ao(N.getElement(),b.style)},[b.style]),N.isOpen()&&((N.getLngLat().lng!==b.longitude||N.getLngLat().lat!==b.latitude)&&N.setLngLat([b.longitude,b.latitude]),b.offset&&!qn(N.options.offset,b.offset)&&N.setOffset(b.offset),(N.options.anchor!==b.anchor||N.options.maxWidth!==b.maxWidth)&&(N.options.anchor=b.anchor,N.setMaxWidth(b.maxWidth)),N.options.className!==b.className)){const oe=kh(N.options.className),a=kh(b.className);for(const Y of oe)a.has(Y)||N.removeClassName(Y);for(const Y of a)oe.has(Y)||N.addClassName(Y);N.options.className=b.className}return Wh.exports.createPortal(b.children,D)}Te.exports.memo(em);function ca(b,I,A,D){const F=Te.exports.useContext(Al),N=Te.exports.useMemo(()=>b(F),[]);return Te.exports.useEffect(()=>{const oe=D||A||I,a=typeof I=="function"&&typeof A=="function"?I:null,Y=typeof A=="function"?A:typeof I=="function"?I:null,{map:te}=F;return te.hasControl(N)||(te.addControl(N,oe==null?void 0:oe.position),a&&a(F)),()=>{Y&&Y(F),te.hasControl(N)&&te.removeControl(N)}},[]),N}function tm(b){const I=ca(({mapLib:A})=>new A.AttributionControl(b),{position:b.position});return Te.exports.useEffect(()=>{Ao(I._container,b.style)},[b.style]),null}Te.exports.memo(tm);function im(b){const I=ca(({mapLib:A})=>new A.FullscreenControl({container:b.containerId&&document.getElementById(b.containerId)}),{position:b.position});return Te.exports.useEffect(()=>{Ao(I._controlContainer,b.style)},[b.style]),null}Te.exports.memo(im);const tp=Te.exports.forwardRef((b,I)=>{const A=Te.exports.useRef({props:b}),D=ca(({mapLib:F})=>{const N=new F.GeolocateControl(b),oe=N._setupUI;return N._setupUI=a=>{N._container.hasChildNodes()||oe(a)},N.on("geolocate",a=>{var Y,te;(te=(Y=A.current.props).onGeolocate)===null||te===void 0||te.call(Y,a)}),N.on("error",a=>{var Y,te;(te=(Y=A.current.props).onError)===null||te===void 0||te.call(Y,a)}),N.on("outofmaxbounds",a=>{var Y,te;(te=(Y=A.current.props).onOutOfMaxBounds)===null||te===void 0||te.call(Y,a)}),N.on("trackuserlocationstart",a=>{var Y,te;(te=(Y=A.current.props).onTrackUserLocationStart)===null||te===void 0||te.call(Y,a)}),N.on("trackuserlocationend",a=>{var Y,te;(te=(Y=A.current.props).onTrackUserLocationEnd)===null||te===void 0||te.call(Y,a)}),N},{position:b.position});return A.current.props=b,Te.exports.useImperativeHandle(I,()=>({trigger:()=>D.trigger()}),[]),Te.exports.useEffect(()=>{Ao(D._container,b.style)},[b.style]),null});tp.displayName="GeolocateControl";Te.exports.memo(tp);function rm(b){const I=ca(({mapLib:A})=>new A.NavigationControl(b),{position:b.position});return Te.exports.useEffect(()=>{Ao(I._container,b.style)},[b.style]),null}var nm=Te.exports.memo(rm);const om={unit:"metric",maxWidth:100};function ip(b){const I=ca(({mapLib:A})=>new A.ScaleControl(b),{position:b.position});return(I.options.unit!==b.unit||I.options.maxWidth!==b.maxWidth)&&(I.options.maxWidth=b.maxWidth,I.setUnit(b.unit)),Te.exports.useEffect(()=>{Ao(I._container,b.style)},[b.style]),null}ip.defaultProps=om;Te.exports.memo(ip);var rp={exports:{}};(function(b,I){(function(A,D){b.exports=D()})(sa,function(){var A,D,F;function N(a,Y){if(!A)A=Y;else if(!D)D=Y;else{var te="var sharedChunk = {}; ("+A+")(sharedChunk); ("+D+")(sharedChunk);",fe={};A(fe),F=Y(fe),typeof window!="undefined"&&(F.workerUrl=window.URL.createObjectURL(new Blob([te],{type:"text/javascript"})))}}N(["exports"],function(a){var Y=te;function te(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 fe(i,e,r,o){const c=new Y(i,e,r,o);return function(h){return c.solve(h)}}te.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 ue=fe(.25,.1,.25,1);function ie(i,e,r){return Math.min(r,Math.max(e,i))}function Ge(i,e,r){const o=r-e,c=((i-e)%o+o)%o+e;return c===e?r:c}function $e(i,...e){for(const r of e)for(const o in r)i[o]=r[o];return i}let Ue=1;function et(i,e){i.forEach(r=>{e[r]&&(e[r]=e[r].bind(e))})}function Ke(i,e,r){const o={};for(const c in i)o[c]=e.call(r||this,i[c],c,i);return o}function tt(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 lt(i){return Array.isArray(i)?i.map(lt):typeof i=="object"&&i?Ke(i,lt):i}const It={};function at(i){It[i]||(typeof console!="undefined"&&console.warn(i),It[i]=!0)}function gt(i,e,r){return(r.y-i.y)*(e.x-i.x)>(e.y-i.y)*(r.x-i.x)}function ti(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 Kt(){return typeof WorkerGlobalScope!="undefined"&&typeof self!="undefined"&&self instanceof WorkerGlobalScope}function ur(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 Wi,hr,Hi=null;function Rt(i){if(Hi==null){const e=i.navigator?i.navigator.userAgent:null;Hi=!!i.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return Hi}function pi(i){return typeof ImageBitmap!="undefined"&&i instanceof ImageBitmap}const di={now:typeof performance!="undefined"&&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=>(Wi||(Wi=document.createElement("a")),Wi.href=i,Wi.href),hardwareConcurrency:typeof navigator!="undefined"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(hr==null&&(hr=matchMedia("(prefers-reduced-motion: reduce)")),hr.matches)}};var Xe=Bi;function Bi(i,e){this.x=i,this.y=e}Bi.prototype={clone:function(){return new Bi(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}},Bi.convert=function(i){return i instanceof Bi?i:Array.isArray(i)?new Bi(i[0],i[1]):i};const wi={MAX_PARALLEL_IMAGE_REQUESTS:16,REGISTERED_PROTOCOLS:{}},Ci="mapbox-tiles";let Ai,Kr,gn=500,_n=50;function yn(){typeof caches=="undefined"||Ai||(Ai=caches.open(Ci))}let pr=1/0;const Dr={supported:!1,testSupport:function(i){!Mi&&Rr&&(xn?jn(i):Lr=i)}};let Lr,Rr,Mi=!1,xn=!1;function jn(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,Rr),i.isContextLost())return;Dr.supported=!0}catch{}i.deleteTexture(e),Mi=!0}typeof document!="undefined"&&(Rr=document.createElement("img"),Rr.onload=function(){Lr&&jn(Lr),Lr=null,xn=!0},Rr.onerror=function(){Mi=!0,Lr=null},Rr.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const br={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image"};typeof Object.freeze=="function"&&Object.freeze(br);class Fi 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 Xn=Kt()?()=>self.worker&&self.worker.referrer:()=>(window.location.protocol==="blob:"?window.parent:window).location.href;function Br(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:Xn(),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(T=>T.ok?((S,P,k)=>{(i.type==="arrayBuffer"?S.arrayBuffer():i.type==="json"?S.json():S.text()).then(L=>{h||(P&&k&&function(Z,q,re){if(yn(),!Ai)return;const ce={status:q.status,statusText:q.statusText,headers:new Headers};q.headers.forEach((ae,xe)=>ce.headers.set(xe,ae));const ee=ur(q.headers.get("Cache-Control")||"");ee["no-store"]||(ee["max-age"]&&ce.headers.set("Expires",new Date(re+1e3*ee["max-age"]).toUTCString()),new Date(ce.headers.get("Expires")).getTime()-re<42e4||function(ae,xe){if(Kr===void 0)try{new Response(new ReadableStream),Kr=!0}catch{Kr=!1}Kr?xe(ae.body):ae.blob().then(xe)}(q,ae=>{const xe=new Response(ae,ce);yn(),Ai&&Ai.then(ye=>ye.put(function(Fe){const Ne=Fe.indexOf("?");return Ne<0?Fe:Fe.slice(0,Ne)}(Z.url),xe)).catch(ye=>at(ye.message))}))}(o,P,k),c=!0,e(null,L,S.headers.get("Cache-Control"),S.headers.get("Expires")))}).catch(L=>{h||e(new Error(L.message))})})(T,null,x):T.blob().then(S=>e(new Fi(T.status,T.statusText,i.url,S)))).catch(T=>{T.code!==20&&e(new Error(T.message))})})(),{cancel:()=>{h=!0,c||r.abort()}}}const vn=function(i,e){if(/:\/\//.test(i.url)&&!/^https?:|^file:/.test(i.url)){if(Kt()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",i,e);if(!Kt()){const o=i.url.substring(0,i.url.indexOf("://"));return(wi.REGISTERED_PROTOCOLS[o]||Br)(i,e)}}if(!(/^file:/.test(r=i.url)||/^file:/.test(Xn())&&!/^\w+:/.test(r))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return Br(i,e);if(Kt()&&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 Fi(h.status,h.statusText,o.url,d))}},h.send(o.body),{cancel:()=>h.abort()}}(i,e)},bn=function(i,e){return vn($e(i,{type:"arrayBuffer"}),e)};function Wn(i){const e=window.document.createElement("a");return e.href=i,e.protocol===window.document.location.protocol&&e.host===window.document.location.host}const yt="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let dr,Fr;dr=[],Fr=0;const Or=function(i,e){if(Dr.supported&&(i.headers||(i.headers={}),i.headers.accept="image/webp,*/*"),Fr>=wi.MAX_PARALLEL_IMAGE_REQUESTS){const h={requestParameters:i,callback:e,cancelled:!1,cancel(){this.cancelled=!0}};return dr.push(h),h}Fr++;let r=!1;const o=()=>{if(!r)for(r=!0,Fr--;dr.length&&Fr<wi.MAX_PARALLEL_IMAGE_REQUESTS;){const h=dr.shift(),{requestParameters:d,callback:m,cancelled:g}=h;g||(h.cancel=Or(d,m).cancel)}},c=bn(i,(h,d,m,g)=>{o(),h?e(h):d&&function(x,T){typeof createImageBitmap=="function"?function(S,P){const k=new Blob([new Uint8Array(S)],{type:"image/png"});createImageBitmap(k).then(L=>{P(null,L)}).catch(L=>{P(new Error(`Could not load image because of ${L.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})}(x,T):function(S,P){const k=new Image;k.onload=()=>{P(null,k),URL.revokeObjectURL(k.src),k.onload=null,window.requestAnimationFrame(()=>{k.src=yt})},k.onerror=()=>P(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 L=new Blob([new Uint8Array(S)],{type:"image/png"});k.src=S.byteLength?URL.createObjectURL(L):yt}(x,T)}(d,(x,T)=>{x!=null?e(x):T!=null&&e(null,T,{cacheControl:m,expires:g})})});return{cancel:()=>{c.cancel(),o()}}};function Hn(i,e,r){r[i]&&r[i].indexOf(e)!==-1||(r[i]=r[i]||[],r[i].push(e))}function wr(i,e,r){if(r&&r[i]){const o=r[i].indexOf(e);o!==-1&&r[i].splice(o,1)}}class Tr{constructor(e,r={}){$e(this,r),this.type=e}}class wn extends Tr{constructor(e,r={}){super("error",$e({error:e},r))}}class Er{on(e,r){return this._listeners=this._listeners||{},Hn(e,r,this._listeners),this}off(e,r){return wr(e,r,this._listeners),wr(e,r,this._oneTimeListeners),this}once(e,r){return this._oneTimeListeners=this._oneTimeListeners||{},Hn(e,r,this._oneTimeListeners),this}fire(e,r){typeof e=="string"&&(e=new Tr(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)wr(o,m,this._oneTimeListeners),m.call(this,e);const d=this._eventedParent;d&&($e(e,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),d.fire(e))}else e instanceof wn&&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 _e={$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 Me{constructor(e,r,o,c){this.message=(e?`${e}: `:"")+o,c&&(this.identifier=c),r!=null&&r.__line__&&(this.line=r.__line__)}}function Jr(i){const e=i.value;return e?[new Me(i.key,e,"constants have been deprecated as of v8")]:[]}function ir(i,...e){for(const r of e)for(const o in r)i[o]=r[o];return i}function xt(i){return i instanceof Number||i instanceof String||i instanceof Boolean?i.valueOf():i}function Ki(i){if(Array.isArray(i))return i.map(Ki);if(i instanceof Object&&!(i instanceof Number||i instanceof String||i instanceof Boolean)){const e={};for(const r in i)e[r]=Ki(i[r]);return e}return xt(i)}class Oi extends Error{constructor(e,r){super(r),this.message=r,this.key=e}}class $i{constructor(e,r=[]){this.parent=e,this.bindings={};for(const[o,c]of r)this.bindings[o]=c}concat(e){return new $i(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 $r={kind:"null"},Ie={kind:"number"},ct={kind:"string"},ot={kind:"boolean"},fi={kind:"color"},Ur={kind:"object"},rt={kind:"value"},Sr={kind:"collator"},oi={kind:"formatted"},Tn={kind:"padding"},Jt={kind:"resolvedImage"};function Ti(i,e){return{kind:"array",itemType:i,N:e}}function Pt(i){if(i.kind==="array"){const e=Pt(i.itemType);return typeof i.N=="number"?`array<${e}, ${i.N}>`:i.itemType.kind==="value"?"array":`array<${e}>`}return i.kind}const En=[$r,Ie,ct,ot,fi,oi,Ur,Ti(rt),Tn,Jt];function fr(i,e){if(e.kind==="error")return null;if(i.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!fr(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 En)if(!fr(r,e))return null}}return`Expected ${Pt(i)} but found ${Pt(e)} instead.`}function Yr(i,e){return e.some(r=>r.kind===i.kind)}function Qr(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 Sn,en={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 O(i){return(i=Math.round(i))<0?0:i>255?255:i}function w(i){return O(i[i.length-1]==="%"?parseFloat(i)/100*255:parseInt(i))}function C(i){return(e=i[i.length-1]==="%"?parseFloat(i)/100:parseFloat(i))<0?0:e>1?1:e;var e}function R(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{Sn={}.parseCSSColor=function(i){var e,r=i.replace(/ /g,"").toLowerCase();if(r in en)return en[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=C(d.pop());case"rgb":return d.length!==3?null:[w(d[0]),w(d[1]),w(d[2]),m];case"hsla":if(d.length!==4)return null;m=C(d.pop());case"hsl":if(d.length!==3)return null;var g=(parseFloat(d[0])%360+360)%360/360,x=C(d[1]),T=C(d[2]),S=T<=.5?T*(x+1):T+x-T*x,P=2*T-S;return[O(255*R(P,S,g+1/3)),O(255*R(P,S,g)),O(255*R(P,S,g-1/3)),m];default:return null}}return null}}catch{}class B{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 B)return e;if(typeof e!="string")return;const r=Sn(e);return r?new B(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]}}B.black=new B(0,0,0,1),B.white=new B(1,1,1,1),B.transparent=new B(0,0,0,0),B.red=new B(1,0,0,1);class j{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 K{constructor(e,r,o,c,h){this.text=e,this.image=r,this.scale=o,this.fontStack=c,this.textColor=h}}class W{constructor(e){this.sections=e}static fromString(e){return new W([new K(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 W?e:W.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map(e=>e.text).join("")}}class X{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof X)return e;if(typeof e=="number")return new X([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 X(e)}}toString(){return JSON.stringify(this.values)}}class J{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new J({name:e,available:!1}):null}}function pe(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 ve(i){if(i===null||typeof i=="string"||typeof i=="boolean"||typeof i=="number"||i instanceof B||i instanceof j||i instanceof W||i instanceof X||i instanceof J)return!0;if(Array.isArray(i)){for(const e of i)if(!ve(e))return!1;return!0}if(typeof i=="object"){for(const e in i)if(!ve(i[e]))return!1;return!0}return!1}function he(i){if(i===null)return $r;if(typeof i=="string")return ct;if(typeof i=="boolean")return ot;if(typeof i=="number")return Ie;if(i instanceof B)return fi;if(i instanceof j)return Sr;if(i instanceof W)return oi;if(i instanceof X)return Tn;if(i instanceof J)return Jt;if(Array.isArray(i)){const e=i.length;let r;for(const o of i){const c=he(o);if(r){if(r===c)continue;r=rt;break}r=c}return Ti(r||rt,e)}return Ur}function Ve(i){const e=typeof i;return i===null?"":e==="string"||e==="number"||e==="boolean"?String(i):i instanceof B||i instanceof W||i instanceof X||i instanceof J?i.toString():JSON.stringify(i)}class qe{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(!ve(e[1]))return r.error("invalid value");const o=e[1];let c=he(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 qe(c,o)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class Le{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}}const Je={string:ct,number:Ie,boolean:ot,object:Ur};class Qe{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 Je)||x==="object")return r.error('The item type argument of "array" must be one of string, number, boolean',1);m=Je[x],c++}else m=rt;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=Ti(m,g)}else{if(!Je[h])throw new Error(`Types doesn't contain name = ${h}`);o=Je[h]}const d=[];for(;c<e.length;c++){const m=r.parse(e[c],c,rt);if(!m)return null;d.push(m)}return new Qe(o,d)}evaluate(e){for(let r=0;r<this.args.length;r++){const o=this.args[r].evaluate(e);if(!fr(this.type,he(o)))return o;if(r===this.args.length-1)throw new Le(`Expected value to be of type ${Pt(this.type)}, but found ${Pt(he(o))} instead.`)}throw new Error}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const vt={"to-boolean":ot,"to-color":fi,"to-number":Ie,"to-string":ct};class it{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(!vt[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=vt[o],h=[];for(let d=1;d<e.length;d++){const m=r.parse(e[d],d,rt);if(!m)return null;h.push(m)}return new it(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 B)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.`:pe(r[0],r[1],r[2],r[3]),!o))return new B(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new Le(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=X.parse(r);if(c)return c}throw new Le(`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 Le(`Could not convert ${JSON.stringify(r)} to number.`)}return this.type.kind==="formatted"?W.fromString(Ve(this.args[0].evaluate(e))):this.type.kind==="resolvedImage"?J.fromString(Ve(this.args[0].evaluate(e))):Ve(this.args[0].evaluate(e))}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const ut=["Unknown","Point","LineString","Polygon"];class bt{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"?ut[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]=B.parse(e)),r}}class kt{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=kt.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,T]of m){g=new An(r.registry,r.path,null,r.scope);const S=[];let P=!1;for(let k=1;k<e.length;k++){const L=e[k],Z=Array.isArray(x)?x[k-1]:x.type,q=g.parse(L,1+S.length,Z);if(!q){P=!0;break}S.push(q)}if(!P)if(Array.isArray(x)&&x.length!==S.length)g.error(`Expected ${x.length} arguments, but found ${S.length} instead.`);else{for(let k=0;k<S.length;k++){const L=Array.isArray(x)?x[k]:x.type,Z=S[k];g.concat(k+1).checkSubtype(L,Z.type)}if(g.errors.length===0)return new kt(o,h,T,S)}}if(m.length===1)r.errors.push(...g.errors);else{const x=(m.length?m:d).map(([S])=>{return P=S,Array.isArray(P)?`(${P.map(Pt).join(", ")})`:`(${Pt(P.type)}...)`;var P}).join(" | "),T=[];for(let S=1;S<e.length;S++){const P=r.parse(e[S],1+T.length);if(!P)return null;T.push(Pt(P.type))}r.error(`Expected arguments of type ${x}, but found (${T.join(", ")}) instead.`)}return null}static register(e,r){kt.definitions=r;for(const o in r)e[o]=kt}}class si{constructor(e,r,o){this.type=Sr,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,ot);if(!c)return null;const h=r.parse(o["diacritic-sensitive"]!==void 0&&o["diacritic-sensitive"],1,ot);if(!h)return null;let d=null;return o.locale&&(d=r.parse(o.locale,1,ct),!d)?null:new si(c,h,d)}evaluate(e){return new j(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 $t=8192;function _i(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 In(i,e){return!(i[0]<=e[0]||i[2]>=e[2]||i[1]<=e[1]||i[3]>=e[3])}function Kn(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*$t),Math.round(o*c*$t)]}function Dt(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 as(i,e){let r=!1;for(let d=0,m=e.length;d<m;d++){const g=e[d];for(let x=0,T=g.length;x<T-1;x++){if(Dt(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 ls(i,e){for(let r=0;r<e.length;r++)if(as(i,e[r]))return!0;return!1}function ha(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 pa(i,e,r){for(const x of r)for(let T=0;T<x.length-1;++T)if((m=[(d=x[T+1])[0]-(h=x[T])[0],d[1]-h[1]])[0]*(g=[(c=e)[0]-(o=i)[0],c[1]-o[1]])[1]-m[1]*g[0]!=0&&ha(o,c,h,d)&&ha(h,d,o,c))return!0;var o,c,h,d,m,g;return!1}function cs(i,e){for(let r=0;r<i.length;++r)if(!as(i[r],e))return!1;for(let r=0;r<i.length-1;++r)if(pa(i[r],i[r+1],e))return!1;return!0}function Pl(i,e){for(let r=0;r<e.length;r++)if(cs(i,e[r]))return!0;return!1}function Mo(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=Kn(i[c][d],r);_i(e,m),h.push(m)}o.push(h)}return o}function us(i,e,r){const o=[];for(let c=0;c<i.length;c++){const h=Mo(i[c],e,r);o.push(h)}return o}function da(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}_i(e,i)}function fa(i,e,r,o){const c=Math.pow(2,o.z)*$t,h=[o.x*$t,o.y*$t],d=[];for(const m of i)for(const g of m){const x=[g.x+h[0],g.y+h[1]];da(x,e,r,c),d.push(x)}return d}function ma(i,e,r,o){const c=Math.pow(2,o.z)*$t,h=[o.x*$t,o.y*$t],d=[];for(const g of i){const x=[];for(const T of g){const S=[T.x+h[0],T.y+h[1]];_i(e,S),x.push(S)}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)da(x,e,r,c)}var m;return d}class tn{constructor(e,r){this.type=ot,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(ve(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 tn(o,o.features[c].geometry)}else if(o.type==="Feature"){const c=o.geometry.type;if(c==="Polygon"||c==="MultiPolygon")return new tn(o,o.geometry)}else if(o.type==="Polygon"||o.type==="MultiPolygon")return new tn(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=Mo(o.coordinates,h,d),g=fa(r.geometry(),c,h,d);if(!In(c,h))return!1;for(const x of g)if(!as(x,m))return!1}if(o.type==="MultiPolygon"){const m=us(o.coordinates,h,d),g=fa(r.geometry(),c,h,d);if(!In(c,h))return!1;for(const x of g)if(!ls(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=Mo(o.coordinates,h,d),g=ma(r.geometry(),c,h,d);if(!In(c,h))return!1;for(const x of g)if(!cs(x,m))return!1}if(o.type==="MultiPolygon"){const m=us(o.coordinates,h,d),g=ma(r.geometry(),c,h,d);if(!In(c,h))return!1;for(const x of g)if(!Pl(x,m))return!1}return!0}(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}function Jn(i){if(i instanceof kt&&(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 tn)return!1;let e=!0;return i.eachChild(r=>{e&&!Jn(r)&&(e=!1)}),e}function Cn(i){if(i instanceof kt&&i.name==="feature-state")return!1;let e=!0;return i.eachChild(r=>{e&&!Cn(r)&&(e=!1)}),e}function Po(i,e){if(i instanceof kt&&e.indexOf(i.name)>=0)return!1;let r=!0;return i.eachChild(o=>{r&&!Po(o,e)&&(r=!1)}),r}class zo{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 zo(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 An{constructor(e,r=[],o,c=new $i,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 Qe(h,[c]):d==="coerce"?new it(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 qe)&&d.type.kind!=="resolvedImage"&&hs(d)){const m=new bt;try{d=new qe(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 An(this.registry,c,r||null,h,this.errors)}error(e,...r){const o=`${this.key}${r.map(c=>`[${c}]`).join("")}`;this.errors.push(new Oi(o,e))}checkSubtype(e,r){const o=fr(e,r);return o&&this.error(o),o}}function hs(i){if(i instanceof zo)return hs(i.boundExpression);if(i instanceof kt&&i.name==="error"||i instanceof si||i instanceof tn)return!1;const e=i instanceof it||i instanceof Qe;let r=!0;return i.eachChild(o=>{r=e?r&&hs(o):r&&o instanceof qe}),!!r&&Jn(i)&&Po(i,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function ko(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 Le("Input is not a number.");d=m-1}return 0}class Yn{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,Ie);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,T=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 S=r.parse(g,T,h);if(!S)return null;h=h||S.type,c.push([m,S])}return new Yn(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[ko(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 Ut(i,e,r){return i*(1-r)+e*r}var Qn=Object.freeze({__proto__:null,number:Ut,color:function(i,e,r){return new B(Ut(i.r,e.r,r),Ut(i.g,e.g,r),Ut(i.b,e.b,r),Ut(i.a,e.a,r))},array:function(i,e,r){return i.map((o,c)=>Ut(o,e[c],r))},padding:function(i,e,r){const o=i.values,c=e.values;return new X([Ut(o[0],c[0],r),Ut(o[1],c[1],r),Ut(o[2],c[2],r),Ut(o[3],c[3],r)])}});const ga=.95047,_a=1.08883,ps=4/29,Do=6/29,ya=3*Do*Do,zl=Math.PI/180,kl=180/Math.PI;function ds(i){return i>.008856451679035631?Math.pow(i,1/3):i/ya+ps}function fs(i){return i>Do?i*i*i:ya*(i-ps)}function ms(i){return 255*(i<=.0031308?12.92*i:1.055*Math.pow(i,1/2.4)-.055)}function gs(i){return(i/=255)<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4)}function Et(i){const e=gs(i.r),r=gs(i.g),o=gs(i.b),c=ds((.4124564*e+.3575761*r+.1804375*o)/ga),h=ds((.2126729*e+.7151522*r+.072175*o)/1);return{l:116*h-16,a:500*(c-h),b:200*(h-ds((.0193339*e+.119192*r+.9503041*o)/_a)),alpha:i.a}}function xa(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*fs(e),r=ga*fs(r),o=_a*fs(o),new B(ms(3.2404542*r-1.5371385*e-.4985314*o),ms(-.969266*r+1.8760108*e+.041556*o),ms(.0556434*r-.2040259*e+1.0572252*o),i.alpha)}function Dl(i,e,r){const o=e-i;return i+r*(o>180||o<-180?o-360*Math.round(o/360):o)}const eo={forward:Et,reverse:xa,interpolate:function(i,e,r){return{l:Ut(i.l,e.l,r),a:Ut(i.a,e.a,r),b:Ut(i.b,e.b,r),alpha:Ut(i.alpha,e.alpha,r)}}},to={forward:function(i){const{l:e,a:r,b:o}=Et(i),c=Math.atan2(o,r)*kl;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*zl,r=i.c;return xa({l:i.l,a:Math.cos(e)*r,b:Math.sin(e)*r,alpha:i.alpha})},interpolate:function(i,e,r){return{h:Dl(i.h,e.h,r),c:Ut(i.c,e.c,r),l:Ut(i.l,e.l,r),alpha:Ut(i.alpha,e.alpha,r)}}};var va=Object.freeze({__proto__:null,lab:eo,hcl:to});class Ui{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=_s(r,e.base,o,c);else if(e.name==="linear")h=_s(r,1,o,c);else if(e.name==="cubic-bezier"){const d=e.controlPoints;h=new Y(d[0],d[1],d[2],d[3]).solve(_s(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(T=>typeof T!="number"||T<0||T>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,Ie),!h)return null;const m=[];let g=null;o==="interpolate-hcl"||o==="interpolate-lab"?g=fi:r.expectedType&&r.expectedType.kind!=="value"&&(g=r.expectedType);for(let x=0;x<d.length;x+=2){const T=d[x],S=d[x+1],P=x+3,k=x+4;if(typeof T!="number")return r.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',P);if(m.length&&m[m.length-1][0]>=T)return r.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',P);const L=r.parse(S,k,g);if(!L)return null;g=g||L.type,m.push([T,L])}return g.kind==="number"||g.kind==="color"||g.kind==="padding"||g.kind==="array"&&g.itemType.kind==="number"&&typeof g.N=="number"?new Ui(g,o,c,h,m):r.error(`Type ${Pt(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=ko(r,c),m=Ui.interpolationFactor(this.interpolation,c,r[d],r[d+1]),g=o[d].evaluate(e),x=o[d+1].evaluate(e);return this.operator==="interpolate"?Qn[this.type.kind.toLowerCase()](g,x,m):this.operator==="interpolate-hcl"?to.reverse(to.interpolate(to.forward(g),to.forward(x),m)):eo.reverse(eo.interpolate(eo.forward(g),eo.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 _s(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 Lo{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=>fr(c,m.type));return new Lo(d?rt: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 J&&!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 Ro{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 Ro(o,c):null}outputDefined(){return this.result.outputDefined()}}class ys{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,Ie),c=r.parse(e[2],2,Ti(r.expectedType||rt));return o&&c?new ys(c.type.itemType,o,c):null}evaluate(e){const r=this.index.evaluate(e),o=this.input.evaluate(e);if(r<0)throw new Le(`Array index out of bounds: ${r} < 0.`);if(r>=o.length)throw new Le(`Array index out of bounds: ${r} > ${o.length-1}.`);if(r!==Math.floor(r))throw new Le(`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 xs{constructor(e,r){this.type=ot,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,rt),c=r.parse(e[2],2,rt);return o&&c?Yr(o.type,[ot,ct,Ie,$r,rt])?new xs(o,c):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${Pt(o.type)} instead`):null}evaluate(e){const r=this.needle.evaluate(e),o=this.haystack.evaluate(e);if(!o)return!1;if(!Qr(r,["boolean","string","number","null"]))throw new Le(`Expected first argument to be of type boolean, string, number or null, but found ${Pt(he(r))} instead.`);if(!Qr(o,["string","array"]))throw new Le(`Expected second argument to be of type array or string, but found ${Pt(he(o))} instead.`);return o.indexOf(r)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}}class Bo{constructor(e,r,o){this.type=Ie,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,rt),c=r.parse(e[2],2,rt);if(!o||!c)return null;if(!Yr(o.type,[ot,ct,Ie,$r,rt]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${Pt(o.type)} instead`);if(e.length===4){const h=r.parse(e[3],3,Ie);return h?new Bo(o,c,h):null}return new Bo(o,c)}evaluate(e){const r=this.needle.evaluate(e),o=this.haystack.evaluate(e);if(!Qr(r,["boolean","string","number","null"]))throw new Le(`Expected first argument to be of type boolean, string, number or null, but found ${Pt(he(r))} instead.`);if(!Qr(o,["string","array"]))throw new Le(`Expected second argument to be of type array or string, but found ${Pt(he(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 vs{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 T=e[x];const S=e[x+1];Array.isArray(T)||(T=[T]);const P=r.concat(x);if(T.length===0)return P.error("Expected at least one branch label.");for(const L of T){if(typeof L!="number"&&typeof L!="string")return P.error("Branch labels must be numbers or strings.");if(typeof L=="number"&&Math.abs(L)>Number.MAX_SAFE_INTEGER)return P.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof L=="number"&&Math.floor(L)!==L)return P.error("Numeric branch labels must be integer values.");if(o){if(P.checkSubtype(o,he(L)))return null}else o=he(L);if(h[String(L)]!==void 0)return P.error("Branch labels must be unique.");h[String(L)]=d.length}const k=r.parse(S,x,c);if(!k)return null;c=c||k.type,d.push(k)}const m=r.parse(e[1],1,rt);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 vs(o,c,m,h,d,g):null}evaluate(e){const r=this.input.evaluate(e);return(he(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 bs{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,ot);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 bs(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 Fo{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,rt),c=r.parse(e[2],2,Ie);if(!o||!c)return null;if(!Yr(o.type,[Ti(rt),ct,rt]))return r.error(`Expected first argument to be of type array or string, but found ${Pt(o.type)} instead`);if(e.length===4){const h=r.parse(e[3],3,Ie);return h?new Fo(o.type,o,c,h):null}return new Fo(o.type,o,c)}evaluate(e){const r=this.input.evaluate(e),o=this.beginIndex.evaluate(e);if(!Qr(r,["string","array"]))throw new Le(`Expected first argument to be of type array or string, but found ${Pt(he(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 ba(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 wa(i,e,r,o){return o.compare(e,r)===0}function Mn(i,e,r){const o=i!=="=="&&i!=="!=";return class np{constructor(h,d,m){this.type=ot,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,rt);if(!g)return null;if(!ba(m,g.type))return d.concat(1).error(`"${m}" comparisons are not supported for type '${Pt(g.type)}'.`);let x=d.parse(h[2],2,rt);if(!x)return null;if(!ba(m,x.type))return d.concat(2).error(`"${m}" comparisons are not supported for type '${Pt(x.type)}'.`);if(g.type.kind!==x.type.kind&&g.type.kind!=="value"&&x.type.kind!=="value")return d.error(`Cannot compare types '${Pt(g.type)}' and '${Pt(x.type)}'.`);o&&(g.type.kind==="value"&&x.type.kind!=="value"?g=new Qe(x.type,[g]):g.type.kind!=="value"&&x.type.kind==="value"&&(x=new Qe(g.type,[x])));let T=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(T=d.parse(h[3],3,Sr),!T)return null}return new np(g,x,T)}evaluate(h){const d=this.lhs.evaluate(h),m=this.rhs.evaluate(h);if(o&&this.hasUntypedArgument){const g=he(d),x=he(m);if(g.kind!==x.kind||g.kind!=="string"&&g.kind!=="number")throw new Le(`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=he(d),x=he(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 Ll=Mn("==",function(i,e,r){return e===r},wa),Rl=Mn("!=",function(i,e,r){return e!==r},function(i,e,r,o){return!wa(0,e,r,o)}),Bl=Mn("<",function(i,e,r){return e<r},function(i,e,r,o){return o.compare(e,r)<0}),Fl=Mn(">",function(i,e,r){return e>r},function(i,e,r,o){return o.compare(e,r)>0}),Ol=Mn("<=",function(i,e,r){return e<=r},function(i,e,r,o){return o.compare(e,r)<=0}),$l=Mn(">=",function(i,e,r){return e>=r},function(i,e,r,o){return o.compare(e,r)>=0});class ws{constructor(e,r,o,c,h){this.type=ct,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,Ie);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,ct),!h))return null;let d=null;if(c.currency&&(d=r.parse(c.currency,1,ct),!d))return null;let m=null;if(c["min-fraction-digits"]&&(m=r.parse(c["min-fraction-digits"],1,Ie),!m))return null;let g=null;return c["max-fraction-digits"]&&(g=r.parse(c["max-fraction-digits"],1,Ie),!g)?null:new ws(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 Oo{constructor(e){this.type=oi,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,Ie),!g))return null;let x=null;if(m["text-font"]&&(x=r.parse(m["text-font"],1,Ti(ct)),!x))return null;let T=null;if(m["text-color"]&&(T=r.parse(m["text-color"],1,fi),!T))return null;const S=c[c.length-1];S.scale=g,S.font=x,S.textColor=T}else{const g=r.parse(e[d],1,rt);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 Oo(c)}evaluate(e){return new W(this.sections.map(r=>{const o=r.content.evaluate(e);return he(o)===Jt?new K("",o,null,null,null):new K(Ve(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 Ts{constructor(e){this.type=Jt,this.input=e}static parse(e,r){if(e.length!==2)return r.error("Expected two arguments.");const o=r.parse(e[1],1,ct);return o?new Ts(o):r.error("No image name provided.")}evaluate(e){const r=this.input.evaluate(e),o=J.fromString(r);return o&&e.availableImages&&(o.available=e.availableImages.indexOf(r)>-1),o}eachChild(e){e(this.input)}outputDefined(){return!1}}class Es{constructor(e){this.type=Ie,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 ${Pt(o.type)} instead.`):new Es(o):null}evaluate(e){const r=this.input.evaluate(e);if(typeof r=="string"||Array.isArray(r))return r.length;throw new Le(`Expected value to be of type string or array, but found ${Pt(he(r))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}}const Pn={"==":Ll,"!=":Rl,">":Fl,"<":Bl,">=":$l,"<=":Ol,array:Qe,at:ys,boolean:Qe,case:bs,coalesce:Lo,collator:si,format:Oo,image:Ts,in:xs,"index-of":Bo,interpolate:Ui,"interpolate-hcl":Ui,"interpolate-lab":Ui,length:Es,let:Ro,literal:qe,match:vs,number:Qe,"number-format":ws,object:Qe,slice:Fo,step:Yn,string:Qe,"to-boolean":it,"to-color":it,"to-number":it,"to-string":it,var:zo,within:tn};function Ta(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=pe(e,r,o,h);if(d)throw new Le(d);return new B(e/255*h,r/255*h,o/255*h,h)}function Ea(i,e){return i in e}function $o(i,e){const r=e[i];return r===void 0?null:r}function rn(i){return{type:i}}function Sa(i){return{result:"success",value:i}}function zn(i){return{result:"error",value:i}}function Ft(i){return i["property-type"]==="data-driven"||i["property-type"]==="cross-faded-data-driven"}function Ia(i){return!!i.expression&&i.expression.parameters.indexOf("zoom")>-1}function mt(i){return!!i.expression&&i.expression.interpolated}function St(i){return i instanceof Number?"number":i instanceof String?"string":i instanceof Boolean?"boolean":Array.isArray(i)?"array":i===null?"null":typeof i}function Bt(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)}function Vt(i){return i}function io(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||(mt(e)?"exponential":"interval");if(r||e.type==="padding"){const x=r?B.parse:X.parse;(i=ir({},i)).stops&&(i.stops=i.stops.map(T=>[T[0],x(T[1])])),i.default=x(i.default?i.default:e.default)}if(i.colorSpace&&i.colorSpace!=="rgb"&&!va[i.colorSpace])throw new Error(`Unknown color space: ${i.colorSpace}`);let d,m,g;if(h==="exponential")d=Ca;else if(h==="interval")d=Vl;else if(h==="categorical"){d=Ul,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=Nl}if(o){const x={},T=[];for(let k=0;k<i.stops.length;k++){const L=i.stops[k],Z=L[0].zoom;x[Z]===void 0&&(x[Z]={zoom:Z,type:i.type,property:i.property,default:i.default,stops:[]},T.push(Z)),x[Z].stops.push([L[0].value,L[1]])}const S=[];for(const k of T)S.push([x[k].zoom,io(x[k],e)]);const P={name:"linear"};return{kind:"composite",interpolationType:P,interpolationFactor:Ui.interpolationFactor.bind(void 0,P),zoomStops:S.map(k=>k[0]),evaluate:({zoom:k},L)=>Ca({stops:S,base:i.base},e,k).evaluate(k,L)}}if(c){const x=h==="exponential"?{name:"exponential",base:i.base!==void 0?i.base:1}:null;return{kind:"camera",interpolationType:x,interpolationFactor:Ui.interpolationFactor.bind(void 0,x),zoomStops:i.stops.map(T=>T[0]),evaluate:({zoom:T})=>d(i,e,T,m,g)}}return{kind:"source",evaluate(x,T){const S=T&&T.properties?T.properties[i.property]:void 0;return S===void 0?kn(i.default,e.default):d(i,e,S,m,g)}}}function kn(i,e,r){return i!==void 0?i:e!==void 0?e:r!==void 0?r:void 0}function Ul(i,e,r,o,c){return kn(typeof r===c?o[r]:void 0,i.default,e.default)}function Vl(i,e,r){if(St(r)!=="number")return kn(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=ko(i.stops.map(h=>h[0]),r);return i.stops[c][1]}function Ca(i,e,r){const o=i.base!==void 0?i.base:1;if(St(r)!=="number")return kn(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=ko(i.stops.map(T=>T[0]),r),d=function(T,S,P,k){const L=k-P,Z=T-P;return L===0?0:S===1?Z/L:(Math.pow(S,Z)-1)/(Math.pow(S,L)-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=Qn[e.type]||Vt;if(i.colorSpace&&i.colorSpace!=="rgb"){const T=va[i.colorSpace];x=(S,P)=>T.reverse(T.interpolate(T.forward(S),T.forward(P),d))}return typeof m.evaluate=="function"?{evaluate(...T){const S=m.evaluate.apply(void 0,T),P=g.evaluate.apply(void 0,T);if(S!==void 0&&P!==void 0)return x(S,P,d)}}:x(m,g,d)}function Nl(i,e,r){switch(e.type){case"color":r=B.parse(r);break;case"formatted":r=W.fromString(r.toString());break;case"resolvedImage":r=J.fromString(r.toString());break;case"padding":r=X.parse(r);break;default:St(r)===e.type||e.type==="enum"&&e.values[r]||(r=void 0)}return kn(r,i.default,e.default)}kt.register(Pn,{error:[{kind:"error"},[ct],(i,[e])=>{throw new Le(e.evaluate(i))}],typeof:[ct,[rt],(i,[e])=>Pt(he(e.evaluate(i)))],"to-rgba":[Ti(Ie,4),[fi],(i,[e])=>e.evaluate(i).toArray()],rgb:[fi,[Ie,Ie,Ie],Ta],rgba:[fi,[Ie,Ie,Ie,Ie],Ta],has:{type:ot,overloads:[[[ct],(i,[e])=>Ea(e.evaluate(i),i.properties())],[[ct,Ur],(i,[e,r])=>Ea(e.evaluate(i),r.evaluate(i))]]},get:{type:rt,overloads:[[[ct],(i,[e])=>$o(e.evaluate(i),i.properties())],[[ct,Ur],(i,[e,r])=>$o(e.evaluate(i),r.evaluate(i))]]},"feature-state":[rt,[ct],(i,[e])=>$o(e.evaluate(i),i.featureState||{})],properties:[Ur,[],i=>i.properties()],"geometry-type":[ct,[],i=>i.geometryType()],id:[rt,[],i=>i.id()],zoom:[Ie,[],i=>i.globals.zoom],"heatmap-density":[Ie,[],i=>i.globals.heatmapDensity||0],"line-progress":[Ie,[],i=>i.globals.lineProgress||0],accumulated:[rt,[],i=>i.globals.accumulated===void 0?null:i.globals.accumulated],"+":[Ie,rn(Ie),(i,e)=>{let r=0;for(const o of e)r+=o.evaluate(i);return r}],"*":[Ie,rn(Ie),(i,e)=>{let r=1;for(const o of e)r*=o.evaluate(i);return r}],"-":{type:Ie,overloads:[[[Ie,Ie],(i,[e,r])=>e.evaluate(i)-r.evaluate(i)],[[Ie],(i,[e])=>-e.evaluate(i)]]},"/":[Ie,[Ie,Ie],(i,[e,r])=>e.evaluate(i)/r.evaluate(i)],"%":[Ie,[Ie,Ie],(i,[e,r])=>e.evaluate(i)%r.evaluate(i)],ln2:[Ie,[],()=>Math.LN2],pi:[Ie,[],()=>Math.PI],e:[Ie,[],()=>Math.E],"^":[Ie,[Ie,Ie],(i,[e,r])=>Math.pow(e.evaluate(i),r.evaluate(i))],sqrt:[Ie,[Ie],(i,[e])=>Math.sqrt(e.evaluate(i))],log10:[Ie,[Ie],(i,[e])=>Math.log(e.evaluate(i))/Math.LN10],ln:[Ie,[Ie],(i,[e])=>Math.log(e.evaluate(i))],log2:[Ie,[Ie],(i,[e])=>Math.log(e.evaluate(i))/Math.LN2],sin:[Ie,[Ie],(i,[e])=>Math.sin(e.evaluate(i))],cos:[Ie,[Ie],(i,[e])=>Math.cos(e.evaluate(i))],tan:[Ie,[Ie],(i,[e])=>Math.tan(e.evaluate(i))],asin:[Ie,[Ie],(i,[e])=>Math.asin(e.evaluate(i))],acos:[Ie,[Ie],(i,[e])=>Math.acos(e.evaluate(i))],atan:[Ie,[Ie],(i,[e])=>Math.atan(e.evaluate(i))],min:[Ie,rn(Ie),(i,e)=>Math.min(...e.map(r=>r.evaluate(i)))],max:[Ie,rn(Ie),(i,e)=>Math.max(...e.map(r=>r.evaluate(i)))],abs:[Ie,[Ie],(i,[e])=>Math.abs(e.evaluate(i))],round:[Ie,[Ie],(i,[e])=>{const r=e.evaluate(i);return r<0?-Math.round(-r):Math.round(r)}],floor:[Ie,[Ie],(i,[e])=>Math.floor(e.evaluate(i))],ceil:[Ie,[Ie],(i,[e])=>Math.ceil(e.evaluate(i))],"filter-==":[ot,[ct,rt],(i,[e,r])=>i.properties()[e.value]===r.value],"filter-id-==":[ot,[rt],(i,[e])=>i.id()===e.value],"filter-type-==":[ot,[ct],(i,[e])=>i.geometryType()===e.value],"filter-<":[ot,[ct,rt],(i,[e,r])=>{const o=i.properties()[e.value],c=r.value;return typeof o==typeof c&&o<c}],"filter-id-<":[ot,[rt],(i,[e])=>{const r=i.id(),o=e.value;return typeof r==typeof o&&r<o}],"filter->":[ot,[ct,rt],(i,[e,r])=>{const o=i.properties()[e.value],c=r.value;return typeof o==typeof c&&o>c}],"filter-id->":[ot,[rt],(i,[e])=>{const r=i.id(),o=e.value;return typeof r==typeof o&&r>o}],"filter-<=":[ot,[ct,rt],(i,[e,r])=>{const o=i.properties()[e.value],c=r.value;return typeof o==typeof c&&o<=c}],"filter-id-<=":[ot,[rt],(i,[e])=>{const r=i.id(),o=e.value;return typeof r==typeof o&&r<=o}],"filter->=":[ot,[ct,rt],(i,[e,r])=>{const o=i.properties()[e.value],c=r.value;return typeof o==typeof c&&o>=c}],"filter-id->=":[ot,[rt],(i,[e])=>{const r=i.id(),o=e.value;return typeof r==typeof o&&r>=o}],"filter-has":[ot,[rt],(i,[e])=>e.value in i.properties()],"filter-has-id":[ot,[],i=>i.id()!==null&&i.id()!==void 0],"filter-type-in":[ot,[Ti(ct)],(i,[e])=>e.value.indexOf(i.geometryType())>=0],"filter-id-in":[ot,[Ti(rt)],(i,[e])=>e.value.indexOf(i.id())>=0],"filter-in-small":[ot,[ct,Ti(rt)],(i,[e,r])=>r.value.indexOf(i.properties()[e.value])>=0],"filter-in-large":[ot,[ct,Ti(rt)],(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:ot,overloads:[[[ot,ot],(i,[e,r])=>e.evaluate(i)&&r.evaluate(i)],[rn(ot),(i,e)=>{for(const r of e)if(!r.evaluate(i))return!1;return!0}]]},any:{type:ot,overloads:[[[ot,ot],(i,[e,r])=>e.evaluate(i)||r.evaluate(i)],[rn(ot),(i,e)=>{for(const r of e)if(r.evaluate(i))return!0;return!1}]]},"!":[ot,[ot],(i,[e])=>!e.evaluate(i)],"is-supported-script":[ot,[ct],(i,[e])=>{const r=i.globals&&i.globals.isSupportedScript;return!r||r(e.evaluate(i))}],upcase:[ct,[ct],(i,[e])=>e.evaluate(i).toUpperCase()],downcase:[ct,[ct],(i,[e])=>e.evaluate(i).toLowerCase()],concat:[ct,rn(rt),(i,e)=>e.map(r=>Ve(r.evaluate(i))).join("")],"resolved-locale":[ct,[Sr],(i,[e])=>e.evaluate(i).resolvedLocale()]});class Uo{constructor(e,r){this.expression=e,this._warningHistory={},this._evaluator=new bt,this._defaultValue=r?function(o){return o.type==="color"&&Bt(o.default)?new B(0,0,0,0):o.type==="color"?B.parse(o.default)||null:o.type==="padding"?X.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 Le(`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!="undefined"&&console.warn(m.message)),this._defaultValue}}}function ro(i){return Array.isArray(i)&&i.length>0&&typeof i[0]=="string"&&i[0]in Pn}function no(i,e){const r=new An(Pn,[],e?function(c){const h={color:fi,string:ct,number:Ie,enum:ct,boolean:ot,formatted:oi,padding:Tn,resolvedImage:Jt};return c.type==="array"?Ti(h[c.value]||rt,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?Sa(new Uo(o,e)):zn(r.errors)}class oo{constructor(e,r){this.kind=e,this._styleExpression=r,this.isStateDependent=e!=="constant"&&!Cn(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 Ss{constructor(e,r,o,c){this.kind=e,this.zoomStops=o,this._styleExpression=r,this.isStateDependent=e!=="camera"&&!Cn(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?Ui.interpolationFactor(this.interpolationType,e,r,o):0}}function Aa(i,e){const r=no(i,e);if(r.result==="error")return r;const o=r.value.expression,c=Jn(o);if(!c&&!Ft(e))return zn([new Oi("","data expressions not supported")]);const h=Po(o,["zoom"]);if(!h&&!Ia(e))return zn([new Oi("","zoom expressions not supported")]);const d=No(o);return d||h?d instanceof Oi?zn([d]):d instanceof Ui&&!mt(e)?zn([new Oi("",'"interpolate" expressions cannot be used with this property')]):Sa(d?new Ss(c?"camera":"composite",r.value,d.labels,d instanceof Ui?d.interpolation:void 0):new oo(c?"constant":"source",r.value)):zn([new Oi("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Vo{constructor(e,r){this._parameters=e,this._specification=r,ir(this,io(this._parameters,this._specification))}static deserialize(e){return new Vo(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function No(i){let e=null;if(i instanceof Ro)e=No(i.result);else if(i instanceof Lo){for(const r of i.args)if(e=No(r),e)break}else(i instanceof Yn||i instanceof Ui)&&i.input instanceof kt&&i.input.name==="zoom"&&(e=i);return e instanceof Oi||i.eachChild(r=>{const o=No(r);o instanceof Oi?e=o:!e&&o?e=new Oi("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&o&&e!==o&&(e=new Oi("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}function rr(i){const e=i.key,r=i.value,o=i.valueSpec||{},c=i.objectElementValidators||{},h=i.style,d=i.styleSpec;let m=[];const g=St(r);if(g!=="object")return[new Me(e,r,`object expected, ${g} found`)];for(const x in r){const T=x.split(".")[0],S=o[T]||o["*"];let P;if(c[T])P=c[T];else if(o[T])P=Ni;else if(c["*"])P=c["*"];else{if(!o["*"]){m.push(new Me(e,r[x],`unknown property "${x}"`));continue}P=Ni}m=m.concat(P({key:(e&&`${e}.`)+x,value:r[x],valueSpec:S,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 Me(e,r,`missing required property "${x}"`));return m}function Ma(i){const e=i.value,r=i.valueSpec,o=i.style,c=i.styleSpec,h=i.key,d=i.arrayElementValidator||Ni;if(St(e)!=="array")return[new Me(h,e,`array expected, ${St(e)} found`)];if(r.length&&e.length!==r.length)return[new Me(h,e,`array length ${r.length} expected, length ${e.length} found`)];if(r["min-length"]&&e.length<r["min-length"])return[new Me(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),St(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 Is(i){const e=i.key,r=i.value,o=i.valueSpec;let c=St(r);return c==="number"&&r!=r&&(c="NaN"),c!=="number"?[new Me(e,r,`number expected, ${c} found`)]:"minimum"in o&&r<o.minimum?[new Me(e,r,`${r} is less than the minimum value ${o.minimum}`)]:"maximum"in o&&r>o.maximum?[new Me(e,r,`${r} is greater than the maximum value ${o.maximum}`)]:[]}function Pa(i){const e=i.valueSpec,r=xt(i.value.type);let o,c,h,d={};const m=r!=="categorical"&&i.value.property===void 0,g=!m,x=St(i.value.stops)==="array"&&St(i.value.stops[0])==="array"&&St(i.value.stops[0][0])==="object",T=rr({key:i.key,value:i.value,valueSpec:i.styleSpec.function,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{stops:function(k){if(r==="identity")return[new Me(k.key,k.value,'identity function may not have a "stops" property')];let L=[];const Z=k.value;return L=L.concat(Ma({key:k.key,value:Z,valueSpec:k.valueSpec,style:k.style,styleSpec:k.styleSpec,arrayElementValidator:S})),St(Z)==="array"&&Z.length===0&&L.push(new Me(k.key,Z,"array must have at least one stop")),L},default:function(k){return Ni({key:k.key,value:k.value,valueSpec:e,style:k.style,styleSpec:k.styleSpec})}}});return r==="identity"&&m&&T.push(new Me(i.key,i.value,'missing required property "property"')),r==="identity"||i.value.stops||T.push(new Me(i.key,i.value,'missing required property "stops"')),r==="exponential"&&i.valueSpec.expression&&!mt(i.valueSpec)&&T.push(new Me(i.key,i.value,"exponential functions not supported")),i.styleSpec.$version>=8&&(g&&!Ft(i.valueSpec)?T.push(new Me(i.key,i.value,"property functions not supported")):m&&!Ia(i.valueSpec)&&T.push(new Me(i.key,i.value,"zoom functions not supported"))),r!=="categorical"&&!x||i.value.property!==void 0||T.push(new Me(i.key,i.value,'"property" property is required')),T;function S(k){let L=[];const Z=k.value,q=k.key;if(St(Z)!=="array")return[new Me(q,Z,`array expected, ${St(Z)} found`)];if(Z.length!==2)return[new Me(q,Z,`array length 2 expected, length ${Z.length} found`)];if(x){if(St(Z[0])!=="object")return[new Me(q,Z,`object expected, ${St(Z[0])} found`)];if(Z[0].zoom===void 0)return[new Me(q,Z,"object stop key must have zoom")];if(Z[0].value===void 0)return[new Me(q,Z,"object stop key must have value")];if(h&&h>xt(Z[0].zoom))return[new Me(q,Z[0].zoom,"stop zoom values must appear in ascending order")];xt(Z[0].zoom)!==h&&(h=xt(Z[0].zoom),c=void 0,d={}),L=L.concat(rr({key:`${q}[0]`,value:Z[0],valueSpec:{zoom:{}},style:k.style,styleSpec:k.styleSpec,objectElementValidators:{zoom:Is,value:P}}))}else L=L.concat(P({key:`${q}[0]`,value:Z[0],valueSpec:{},style:k.style,styleSpec:k.styleSpec},Z));return ro(Ki(Z[1]))?L.concat([new Me(`${q}[1]`,Z[1],"expressions are not allowed in function stops.")]):L.concat(Ni({key:`${q}[1]`,value:Z[1],valueSpec:e,style:k.style,styleSpec:k.styleSpec}))}function P(k,L){const Z=St(k.value),q=xt(k.value),re=k.value!==null?k.value:L;if(o){if(Z!==o)return[new Me(k.key,re,`${Z} stop domain type must match previous stop domain type ${o}`)]}else o=Z;if(Z!=="number"&&Z!=="string"&&Z!=="boolean")return[new Me(k.key,re,"stop domain value must be a number, string, or boolean")];if(Z!=="number"&&r!=="categorical"){let ce=`number expected, ${Z} found`;return Ft(e)&&r===void 0&&(ce+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new Me(k.key,re,ce)]}return r!=="categorical"||Z!=="number"||isFinite(q)&&Math.floor(q)===q?r!=="categorical"&&Z==="number"&&c!==void 0&&q<c?[new Me(k.key,re,"stop domain values must appear in ascending order")]:(c=q,r==="categorical"&&q in d?[new Me(k.key,re,"stop domain values must be unique")]:(d[q]=!0,[])):[new Me(k.key,re,`integer expected, found ${q}`)]}}function nn(i){const e=(i.expressionContext==="property"?Aa:no)(Ki(i.value),i.valueSpec);if(e.result==="error")return e.value.map(o=>new Me(`${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 Me(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"&&!Cn(r))return[new Me(i.key,i.value,'"feature-state" data expressions are not supported with layout properties.')];if(i.expressionContext==="filter"&&!Cn(r))return[new Me(i.key,i.value,'"feature-state" data expressions are not supported with filters.')];if(i.expressionContext&&i.expressionContext.indexOf("cluster")===0){if(!Po(r,["zoom","feature-state"]))return[new Me(i.key,i.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(i.expressionContext==="cluster-initial"&&!Jn(r))return[new Me(i.key,i.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function so(i){const e=i.key,r=i.value,o=i.valueSpec,c=[];return Array.isArray(o.values)?o.values.indexOf(xt(r))===-1&&c.push(new Me(e,r,`expected one of [${o.values.join(", ")}], ${JSON.stringify(r)} found`)):Object.keys(o.values).indexOf(xt(r))===-1&&c.push(new Me(e,r,`expected one of [${Object.keys(o.values).join(", ")}], ${JSON.stringify(r)} found`)),c}function Dn(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(!Dn(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}const Gl={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Go(i){if(i==null)return{filter:()=>!0,needGeometry:!1};Dn(i)||(i=ao(i));const e=no(i,Gl);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:ka(i)}}function za(i,e){return i<e?-1:i>e?1:0}function ka(i){if(!Array.isArray(i))return!1;if(i[0]==="within")return!0;for(let e=1;e<i.length;e++)if(ka(i[e]))return!0;return!1}function ao(i){if(!i)return!0;const e=i[0];return i.length<=1?e!=="any":e==="=="?Cs(i[1],i[2],"=="):e==="!="?Ln(Cs(i[1],i[2],"==")):e==="<"||e===">"||e==="<="||e===">="?Cs(i[1],i[2],e):e==="any"?(r=i.slice(1),["any"].concat(r.map(ao))):e==="all"?["all"].concat(i.slice(1).map(ao)):e==="none"?["all"].concat(i.slice(1).map(ao).map(Ln)):e==="in"?qo(i[1],i.slice(2)):e==="!in"?Ln(qo(i[1],i.slice(2))):e==="has"?lo(i[1]):e==="!has"?Ln(lo(i[1])):e!=="within"||i;var r}function Cs(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 qo(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(za)]]:["filter-in-small",i,["literal",e]]}}function lo(i){switch(i){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",i]}}function Ln(i){return["!",i]}function co(i){return Dn(Ki(i.value))?nn(ir({},i,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Da(i)}function Da(i){const e=i.value,r=i.key;if(St(e)!=="array")return[new Me(r,e,`array expected, ${St(e)} found`)];const o=i.styleSpec;let c,h=[];if(e.length<1)return[new Me(r,e,"filter array must have at least 1 element")];switch(h=h.concat(so({key:`${r}[0]`,value:e[0],valueSpec:o.filter_operator,style:i.style,styleSpec:i.styleSpec})),xt(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&xt(e[1])==="$type"&&h.push(new Me(r,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":e.length!==3&&h.push(new Me(r,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(c=St(e[1]),c!=="string"&&h.push(new Me(`${r}[1]`,e[1],`string expected, ${c} found`)));for(let d=2;d<e.length;d++)c=St(e[d]),xt(e[1])==="$type"?h=h.concat(so({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 Me(`${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(Da({key:`${r}[${d}]`,value:e[d],style:i.style,styleSpec:i.styleSpec}));break;case"has":case"!has":c=St(e[1]),e.length!==2?h.push(new Me(r,e,`filter array for "${e[0]}" operator must have 2 elements`)):c!=="string"&&h.push(new Me(`${r}[1]`,e[1],`string expected, ${c} found`));break;case"within":c=St(e[1]),e.length!==2?h.push(new Me(r,e,`filter array for "${e[0]}" operator must have 2 elements`)):c!=="object"&&h.push(new Me(`${r}[1]`,e[1],`object expected, ${c} found`))}return h}function uo(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 Ni({key:r,value:h,valueSpec:c.transition,style:o,styleSpec:c});const x=i.valueSpec||m[d];if(!x)return[new Me(r,h,`unknown property "${d}"`)];let T;if(St(h)==="string"&&Ft(x)&&!x.tokens&&(T=/^{([^}]+)}$/.exec(h)))return[new Me(r,h,`"${d}" does not support interpolation syntax
2
- Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(T[1])} }\`.`)];const S=[];return i.layerType==="symbol"&&(d==="text-field"&&o&&!o.glyphs&&S.push(new Me(r,h,'use of "text-field" requires a style "glyphs" property')),d==="text-font"&&Bt(Ki(h))&&xt(h.type)==="identity"&&S.push(new Me(r,h,'"text-font" does not support identity functions'))),S.concat(Ni({key:i.key,value:h,valueSpec:x,style:o,styleSpec:c,expressionContext:"property",propertyType:e,propertyKey:d}))}function La(i){return uo(i,"paint")}function Ra(i){return uo(i,"layout")}function Ba(i){let e=[];const r=i.value,o=i.key,c=i.style,h=i.styleSpec;r.type||r.ref||e.push(new Me(o,r,'either "type" or "ref" is required'));let d=xt(r.type);const m=xt(r.ref);if(r.id){const g=xt(r.id);for(let x=0;x<i.arrayIndex;x++){const T=c.layers[x];xt(T.id)===g&&e.push(new Me(o,r.id,`duplicate layer id "${r.id}", previously used at line ${T.id.__line__}`))}}if("ref"in r){let g;["type","source","source-layer","filter","layout"].forEach(x=>{x in r&&e.push(new Me(o,r[x],`"${x}" is prohibited for ref layers`))}),c.layers.forEach(x=>{xt(x.id)===m&&(g=x)}),g?g.ref?e.push(new Me(o,r.ref,"ref cannot reference another ref layer")):d=xt(g.type):e.push(new Me(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&&xt(g.type);g?x==="vector"&&d==="raster"?e.push(new Me(o,r.source,`layer "${r.id}" requires a raster source`)):x==="raster"&&d!=="raster"?e.push(new Me(o,r.source,`layer "${r.id}" requires a vector source`)):x!=="vector"||r["source-layer"]?x==="raster-dem"&&d!=="hillshade"?e.push(new Me(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 Me(o,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):e.push(new Me(o,r,`layer "${r.id}" must specify a "source-layer"`)):e.push(new Me(o,r.source,`source "${r.source}" not found`))}else e.push(new Me(o,r,'missing required property "source"'));return e=e.concat(rr({key:o,value:r,valueSpec:h.layer,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{"*":()=>[],type:()=>Ni({key:`${o}.type`,value:r.type,valueSpec:h.layer.type,style:i.style,styleSpec:i.styleSpec,object:r,objectKey:"type"}),filter:co,layout:g=>rr({layer:r,key:g.key,value:g.value,style:g.style,styleSpec:g.styleSpec,objectElementValidators:{"*":x=>Ra(ir({layerType:d},x))}}),paint:g=>rr({layer:r,key:g.key,value:g.value,style:g.style,styleSpec:g.styleSpec,objectElementValidators:{"*":x=>La(ir({layerType:d},x))}})}})),e}function Rn(i){const e=i.value,r=i.key,o=St(e);return o!=="string"?[new Me(r,e,`string expected, ${o} found`)]:[]}const Fa={promoteId:function({key:i,value:e}){if(St(e)==="string")return Rn({key:i,value:e});{const r=[];for(const o in e)r.push(...Rn({key:`${i}.${o}`,value:e[o]}));return r}}};function ho(i){const e=i.value,r=i.key,o=i.styleSpec,c=i.style;if(!e.type)return[new Me(r,e,'"type" is required')];const h=xt(e.type);let d;switch(h){case"vector":case"raster":case"raster-dem":return d=rr({key:r,value:e,valueSpec:o[`source_${h.replace("-","_")}`],style:i.style,styleSpec:o,objectElementValidators:Fa}),d;case"geojson":if(d=rr({key:r,value:e,valueSpec:o.source_geojson,style:c,styleSpec:o,objectElementValidators:Fa}),e.cluster)for(const m in e.clusterProperties){const[g,x]=e.clusterProperties[m],T=typeof g=="string"?[g,["accumulated"],["get",m]]:g;d.push(...nn({key:`${r}.${m}.map`,value:x,expressionContext:"cluster-map"})),d.push(...nn({key:`${r}.${m}.reduce`,value:T,expressionContext:"cluster-reduce"}))}return d;case"video":return rr({key:r,value:e,valueSpec:o.source_video,style:c,styleSpec:o});case"image":return rr({key:r,value:e,valueSpec:o.source_image,style:c,styleSpec:o});case"canvas":return[new Me(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return so({key:`${r}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:c,styleSpec:o})}}function po(i){const e=i.value,r=i.styleSpec,o=r.light,c=i.style;let h=[];const d=St(e);if(e===void 0)return h;if(d!=="object")return h=h.concat([new Me("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?Ni({key:m,value:e[m],valueSpec:r.transition,style:c,styleSpec:r}):o[m]?Ni({key:m,value:e[m],valueSpec:o[m],style:c,styleSpec:r}):[new Me(m,e[m],`unknown property "${m}"`)])}return h}function Vi(i){const e=i.value,r=i.styleSpec,o=r.terrain,c=i.style;let h=[];const d=St(e);if(e===void 0)return h;if(d!=="object")return h=h.concat([new Me("terrain",e,`object expected, ${d} found`)]),h;for(const m in e)h=h.concat(o[m]?Ni({key:m,value:e[m],valueSpec:o[m],style:c,styleSpec:r}):[new Me(m,e[m],`unknown property "${m}"`)]);return h}const fo={"*":()=>[],array:Ma,boolean:function(i){const e=i.value,r=i.key,o=St(e);return o!=="boolean"?[new Me(r,e,`boolean expected, ${o} found`)]:[]},number:Is,color:function(i){const e=i.key,r=i.value,o=St(r);return o!=="string"?[new Me(e,r,`color expected, ${o} found`)]:Sn(r)===null?[new Me(e,r,`color expected, "${r}" found`)]:[]},constants:Jr,enum:so,filter:co,function:Pa,layer:Ba,object:rr,source:ho,light:po,terrain:Vi,string:Rn,formatted:function(i){return Rn(i).length===0?[]:nn(i)},resolvedImage:function(i){return Rn(i).length===0?[]:nn(i)},padding:function(i){const e=i.key,r=i.value;if(St(r)==="array"){if(r.length<1||r.length>4)return[new Me(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(Ni({key:`${e}[${h}]`,value:r[h],valueSpec:o}));return c}return Is({key:e,value:r,valueSpec:{}})}};function Ni(i){const e=i.value,r=i.valueSpec,o=i.styleSpec;return r.expression&&Bt(xt(e))?Pa(i):r.expression&&ro(Ki(e))?nn(i):r.type&&fo[r.type]?fo[r.type](i):rr(ir({},i,{valueSpec:r.type?o[r.type]:r}))}function ql(i){const e=i.value,r=i.key,o=Rn(i);return o.length||(e.indexOf("{fontstack}")===-1&&o.push(new Me(r,e,'"glyphs" url must include a "{fontstack}" token')),e.indexOf("{range}")===-1&&o.push(new Me(r,e,'"glyphs" url must include a "{range}" token'))),o}function Vr(i,e=_e){let r=[];return r=r.concat(Ni({key:"",value:i,valueSpec:e.$root,styleSpec:e,style:i,objectElementValidators:{glyphs:ql,"*":()=>[]}})),i.constants&&(r=r.concat(Jr({key:"constants",value:i.constants,style:i,styleSpec:e}))),Oa(r)}function Oa(i){return[].concat(i).sort((e,r)=>e.line-r.line)}function Ir(i){return function(...e){return Oa(i.apply(this,e))}}Vr.source=Ir(ho),Vr.light=Ir(po),Vr.terrain=Ir(Vi),Vr.layer=Ir(Ba),Vr.filter=Ir(co),Vr.paintProperty=Ir(La),Vr.layoutProperty=Ir(Ra);const mo=Vr,As=mo.light,Zl=mo.paintProperty,jl=mo.layoutProperty;function Zo(i,e){let r=!1;if(e&&e.length)for(const o of e)i.fire(new wn(new Error(o.message))),r=!0;return r}class go{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],T=d[3+g+1];c.push(x===T?null:d.subarray(x,T))}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 T=this.keys,S=this.bboxes;for(let P=0;P<x.length;P++){const k=x[P];if(m[k]===void 0){const L=4*k;(g?g(S[L+0],S[L+1],S[L+2],S[L+3]):e<=S[L+2]&&r<=S[L+3]&&o>=S[L+0]&&c>=S[L+1])?(m[k]=!0,d.push(T[k])):m[k]=!1}}}}_forEachCell(e,r,o,c,h,d,m,g){const x=this._convertToCellCoord(e),T=this._convertToCellCoord(r),S=this._convertToCellCoord(o),P=this._convertToCellCoord(c);for(let k=x;k<=S;k++)for(let L=T;L<=P;L++){const Z=this.d*L+k;if((!g||g(this._convertFromCellCoord(k),this._convertFromCellCoord(L),this._convertFromCellCoord(k+1),this._convertFromCellCoord(L+1)))&&h.call(this,e,r,o,c,Z,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 go(e.buffer)}}const Cr={};function Oe(i,e,r={}){if(Cr[i])throw new Error(`${i} is already registered.`);Object.defineProperty(e,"_classRegistryKey",{value:i,writeable:!1}),Cr[i]={klass:e,omit:r.omit||[],shallow:r.shallow||[]}}Oe("Object",Object),Oe("TransferableGridIndex",go),Oe("Color",B),Oe("Error",Error),Oe("AJAXError",Fi),Oe("ResolvedImage",J),Oe("StylePropertyFunction",Vo),Oe("StyleExpression",Uo,{omit:["_evaluator"]}),Oe("ZoomDependentExpression",Ss),Oe("ZoomConstantExpression",oo),Oe("CompoundExpression",kt,{omit:["_evaluate"]});for(const i in Pn)Pn[i]._classRegistryKey||Oe(`Expression_${i}`,Pn[i]);function $a(i){return i&&typeof ArrayBuffer!="undefined"&&(i instanceof ArrayBuffer||i.constructor&&i.constructor.name==="ArrayBuffer")}function on(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($a(i)||pi(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(on(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(!Cr[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)||Cr[o].omit.indexOf(h)>=0)continue;const d=i[h];c[h]=Cr[o].shallow.indexOf(h)>=0?d:on(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 Nr(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||$a(i)||pi(i)||ArrayBuffer.isView(i)||i instanceof ImageData)return i;if(Array.isArray(i))return i.map(Nr);if(typeof i=="object"){const e=i.$name||"Object";if(!Cr[e])throw new Error(`can't deserialize unregistered class ${e}`);const{klass:r}=Cr[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]=Cr[e].shallow.indexOf(c)>=0?h:Nr(h)}return o}throw new Error("can't deserialize object of type "+typeof i)}class Ms{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 jo(i){for(const e of i)if(zs(e.charCodeAt(0)))return!0;return!1}function Xl(i){for(const e of i)if(!Ps(e.charCodeAt(0)))return!1;return!0}function Ps(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 zs(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 Ua(i){return!(zs(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 Va(i){return i>=1424&&i<=2303||ze["Arabic Presentation Forms-A"](i)||ze["Arabic Presentation Forms-B"](i)}function Wl(i,e){return!(!e&&Va(i)||i>=2304&&i<=3583||i>=3840&&i<=4255||ze.Khmer(i))}function Na(i){for(const e of i)if(Va(e.charCodeAt(0)))return!0;return!1}const ks="deferred",Ds="loading",Ls="loaded";let Rs=null,Pi="unavailable",Gr=null;const Ga=function(i){i&&typeof i=="string"&&i.indexOf("NetworkError")>-1&&(Pi="error"),Rs&&Rs(i)};function Bn(){Bs.fire(new Tr("pluginStateChange",{pluginStatus:Pi,pluginURL:Gr}))}const Bs=new Er,_o=function(){return Pi},qa=function(){if(Pi!==ks||!Gr)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");Pi=Ds,Bn(),Gr&&bn({url:Gr},i=>{i?Ga(i):(Pi=Ls,Bn())})},Ji={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>Pi===Ls||Ji.applyArabicShaping!=null,isLoading:()=>Pi===Ds,setState(i){if(!Kt())throw new Error("Cannot set the state of the rtl-text-plugin when not in the web-worker context");Pi=i.pluginStatus,Gr=i.pluginURL},isParsed(){if(!Kt())throw new Error("rtl-text-plugin is only parsed on the worker-threads");return Ji.applyArabicShaping!=null&&Ji.processBidirectionalText!=null&&Ji.processStyledBidirectionalText!=null},getPluginURL(){if(!Kt())throw new Error("rtl-text-plugin url can only be queried from the worker threads");return Gr}};class Nt{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 Ms,this.transition={})}isSupportedScript(e){return function(r,o){for(const c of r)if(!Wl(c.charCodeAt(0),o))return!1;return!0}(e,Ji.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 yo{constructor(e,r){this.property=e,this.value=r,this.expression=function(o,c){if(Bt(o))return new Vo(o,c);if(ro(o)){const h=Aa(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=B.parse(o):c.type!=="padding"||typeof o!="number"&&!Array.isArray(o)||(h=X.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 Xo{constructor(e){this.property=e,this.value=new yo(e,void 0)}transitioned(e,r){return new ja(this.property,this.value,r,$e({},e.transition,this.transition),e.now)}untransitioned(){return new ja(this.property,this.value,null,{},0)}}class Za{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues)}getValue(e){return lt(this._values[e].value.value)}setValue(e,r){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Xo(this._values[e].property)),this._values[e].value=new yo(this._values[e].property,r===null?void 0:lt(r))}getTransition(e){return lt(this._values[e].transition)}setTransition(e,r){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Xo(this._values[e].property)),this._values[e].transition=lt(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 Xa(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 Xa(this._properties);for(const r of Object.keys(this._values))e._values[r]=this._values[r].untransitioned();return e}}class ja{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,T=x*g;return 4*(g<.5?T:3*(g-x)+T-.75)}(m))}}return h}}class Xa{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,r,o){const c=new xo(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 Hl{constructor(e){this._properties=e,this._values=Object.create(e.defaultPropertyValues)}getValue(e){return lt(this._values[e].value)}setValue(e,r){this._values[e]=new yo(this._values[e].property,r===null?void 0:lt(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 xo(this._properties);for(const h of Object.keys(this._values))c._values[h]=this._values[h].possiblyEvaluate(e,r,o);return c}}class mr{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 xo{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class Ze{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=Qn[this.specification.type];return c?c(e,r,o):e}}class Ye{constructor(e,r){this.specification=e,this.overrides=r}possiblyEvaluate(e,r,o,c){return new mr(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 mr(this,{kind:"constant",value:void 0},e.parameters);const c=Qn[this.specification.type];return c?new mr(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 Fn extends Ye{possiblyEvaluate(e,r,o,c){if(e.value===void 0)return new mr(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 mr(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 mr(this,{kind:"constant",value:h},r)}return new mr(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 Fs{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 Nt(Math.floor(r.zoom-1),r)),e.expression.evaluate(new Nt(Math.floor(r.zoom),r)),e.expression.evaluate(new Nt(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 qr{constructor(e){this.specification=e}possiblyEvaluate(e,r,o,c){return!!e.expression.evaluate(r,null,{},o,c)}interpolate(){return!1}}class mi{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 yo(o,void 0),h=this.defaultTransitionablePropertyValues[r]=new Xo(o);this.defaultTransitioningPropertyValues[r]=h.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=c.possiblyEvaluate({})}}}Oe("DataDrivenProperty",Ye),Oe("DataConstantProperty",Ze),Oe("CrossFadedDataDrivenProperty",Fn),Oe("CrossFadedProperty",Fs),Oe("ColorRampProperty",qr);const Zr="-transition";class gr extends Er{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 Hl(r.layout)),r.paint)){this._transitionablePaint=new Za(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 xo(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(jl,`layers.${this.id}.layout.${e}`,e,r,o)||(e!=="visibility"?this._unevaluatedLayout.setValue(e,r):this.visibility=r)}getPaintProperty(e){return e.endsWith(Zr)?this._transitionablePaint.getTransition(e.slice(0,-Zr.length)):this._transitionablePaint.getValue(e)}setPaintProperty(e,r,o={}){if(r!=null&&this._validate(Zl,`layers.${this.id}.paint.${e}`,e,r,o))return!1;if(e.endsWith(Zr))return this._transitionablePaint.setTransition(e.slice(0,-Zr.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),tt(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)&&Zo(this,e.call(mo,{key:r,layerType:this.type,objectKey:o,value:c,styleSpec:_e,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 mr&&Ft(r.property.specification)&&(r.value.kind==="source"||r.value.kind==="composite")&&r.value.isStateDependent)return!0}return!1}}const Wa={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class jr{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 Xt{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 Yt(i,e=1){let r=0,o=0;return{members:i.map(c=>{const h=Wa[c.type].BYTES_PER_ELEMENT,d=r=Os(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:Os(r,Math.max(o,e)),alignment:e}}function Os(i,e){return Math.ceil(i/e)*e}class sn extends Xt{_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}}sn.prototype.bytesPerElement=4,Oe("StructArrayLayout2i4",sn);class l extends Xt{_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}}l.prototype.bytesPerElement=8,Oe("StructArrayLayout4i8",l);class t extends Xt{_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,Oe("StructArrayLayout2i4i12",t);class n extends Xt{_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,Oe("StructArrayLayout2i4ub8",n);class s extends Xt{_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,Oe("StructArrayLayout2f8",s);class u extends Xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,o,c,h,d,m,g,x,T){const S=this.length;return this.resize(S+1),this.emplace(S,e,r,o,c,h,d,m,g,x,T)}emplace(e,r,o,c,h,d,m,g,x,T,S){const P=10*e;return this.uint16[P+0]=r,this.uint16[P+1]=o,this.uint16[P+2]=c,this.uint16[P+3]=h,this.uint16[P+4]=d,this.uint16[P+5]=m,this.uint16[P+6]=g,this.uint16[P+7]=x,this.uint16[P+8]=T,this.uint16[P+9]=S,e}}u.prototype.bytesPerElement=20,Oe("StructArrayLayout10ui20",u);class p extends Xt{_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,T,S,P){const k=this.length;return this.resize(k+1),this.emplace(k,e,r,o,c,h,d,m,g,x,T,S,P)}emplace(e,r,o,c,h,d,m,g,x,T,S,P,k){const L=12*e;return this.int16[L+0]=r,this.int16[L+1]=o,this.int16[L+2]=c,this.int16[L+3]=h,this.uint16[L+4]=d,this.uint16[L+5]=m,this.uint16[L+6]=g,this.uint16[L+7]=x,this.int16[L+8]=T,this.int16[L+9]=S,this.int16[L+10]=P,this.int16[L+11]=k,e}}p.prototype.bytesPerElement=24,Oe("StructArrayLayout4i4ui4i24",p);class f extends Xt{_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,Oe("StructArrayLayout3f12",f);class _ extends Xt{_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,Oe("StructArrayLayout1ul4",_);class y extends Xt{_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 T=this.length;return this.resize(T+1),this.emplace(T,e,r,o,c,h,d,m,g,x)}emplace(e,r,o,c,h,d,m,g,x,T){const S=10*e,P=5*e;return this.int16[S+0]=r,this.int16[S+1]=o,this.int16[S+2]=c,this.int16[S+3]=h,this.int16[S+4]=d,this.int16[S+5]=m,this.uint32[P+3]=g,this.uint16[S+8]=x,this.uint16[S+9]=T,e}}y.prototype.bytesPerElement=20,Oe("StructArrayLayout6i1ul2ui20",y);class v extends Xt{_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,Oe("StructArrayLayout2i2i2i12",v);class E extends Xt{_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}}E.prototype.bytesPerElement=16,Oe("StructArrayLayout2f1f2i16",E);class M extends Xt{_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}}M.prototype.bytesPerElement=12,Oe("StructArrayLayout2ub2f12",M);class z extends Xt{_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}}z.prototype.bytesPerElement=6,Oe("StructArrayLayout3ui6",z);class V extends Xt{_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,T,S,P,k,L,Z,q,re){const ce=this.length;return this.resize(ce+1),this.emplace(ce,e,r,o,c,h,d,m,g,x,T,S,P,k,L,Z,q,re)}emplace(e,r,o,c,h,d,m,g,x,T,S,P,k,L,Z,q,re,ce){const ee=24*e,ae=12*e,xe=48*e;return this.int16[ee+0]=r,this.int16[ee+1]=o,this.uint16[ee+2]=c,this.uint16[ee+3]=h,this.uint32[ae+2]=d,this.uint32[ae+3]=m,this.uint32[ae+4]=g,this.uint16[ee+10]=x,this.uint16[ee+11]=T,this.uint16[ee+12]=S,this.float32[ae+7]=P,this.float32[ae+8]=k,this.uint8[xe+36]=L,this.uint8[xe+37]=Z,this.uint8[xe+38]=q,this.uint32[ae+10]=re,this.int16[ee+22]=ce,e}}V.prototype.bytesPerElement=48,Oe("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",V);class $ extends Xt{_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,T,S,P,k,L,Z,q,re,ce,ee,ae,xe,ye,Fe,Ne,ke,Ae,Ee,De){const Pe=this.length;return this.resize(Pe+1),this.emplace(Pe,e,r,o,c,h,d,m,g,x,T,S,P,k,L,Z,q,re,ce,ee,ae,xe,ye,Fe,Ne,ke,Ae,Ee,De)}emplace(e,r,o,c,h,d,m,g,x,T,S,P,k,L,Z,q,re,ce,ee,ae,xe,ye,Fe,Ne,ke,Ae,Ee,De,Pe){const we=34*e,He=17*e;return this.int16[we+0]=r,this.int16[we+1]=o,this.int16[we+2]=c,this.int16[we+3]=h,this.int16[we+4]=d,this.int16[we+5]=m,this.int16[we+6]=g,this.int16[we+7]=x,this.uint16[we+8]=T,this.uint16[we+9]=S,this.uint16[we+10]=P,this.uint16[we+11]=k,this.uint16[we+12]=L,this.uint16[we+13]=Z,this.uint16[we+14]=q,this.uint16[we+15]=re,this.uint16[we+16]=ce,this.uint16[we+17]=ee,this.uint16[we+18]=ae,this.uint16[we+19]=xe,this.uint16[we+20]=ye,this.uint16[we+21]=Fe,this.uint16[we+22]=Ne,this.uint32[He+12]=ke,this.float32[He+13]=Ae,this.float32[He+14]=Ee,this.float32[He+15]=De,this.float32[He+16]=Pe,e}}$.prototype.bytesPerElement=68,Oe("StructArrayLayout8i15ui1ul4f68",$);class U extends Xt{_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}}U.prototype.bytesPerElement=4,Oe("StructArrayLayout1f4",U);class H extends Xt{_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}}H.prototype.bytesPerElement=6,Oe("StructArrayLayout3i6",H);class Q extends Xt{_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}}Q.prototype.bytesPerElement=8,Oe("StructArrayLayout1ul2ui8",Q);class ne extends Xt{_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}}ne.prototype.bytesPerElement=4,Oe("StructArrayLayout2ui4",ne);class G extends Xt{_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}}G.prototype.bytesPerElement=2,Oe("StructArrayLayout1ui2",G);class le extends Xt{_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}}le.prototype.bytesPerElement=16,Oe("StructArrayLayout4f16",le);class se extends jr{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 Xe(this.anchorPointX,this.anchorPointY)}}se.prototype.size=20;class me extends y{get(e){return new se(this,e)}}Oe("CollisionBoxArray",me);class ge extends jr{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]}}ge.prototype.size=48;class be extends V{get(e){return new ge(this,e)}}Oe("PlacedSymbolArray",be);class de extends jr{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]}}de.prototype.size=68;class Re extends ${get(e){return new de(this,e)}}Oe("SymbolInstanceArray",Re);class Ce extends U{getoffsetX(e){return this.float32[1*e+0]}}Oe("GlyphOffsetArray",Ce);class Be extends H{getx(e){return this.int16[3*e+0]}gety(e){return this.int16[3*e+1]}gettileUnitDistanceFromAnchor(e){return this.int16[3*e+2]}}Oe("SymbolLineVertexArray",Be);class st extends jr{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]}}st.prototype.size=8;class ht extends Q{get(e){return new st(this,e)}}Oe("FeatureIndexArray",ht);class We extends sn{}class At extends sn{}class Mt extends sn{}class _t extends t{}class wt extends n{}class zt extends s{}class ai extends u{}class _r extends p{}class nr extends f{}class yr extends _{}class Xr extends v{}class Yi extends M{}class zi extends z{}class Ar extends ne{}const Wo=Yt([{name:"a_pos",components:2,type:"Int16"}],4),{members:ii}=Wo;class dt{constructor(e=[]){this.segments=e}prepareSegment(e,r,o,c){let h=this.segments[this.segments.length-1];return e>dt.MAX_VERTEX_ARRAY_LENGTH&&at(`Max vertices per segment is ${dt.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),(!h||h.vertexLength+e>dt.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 dt([{vertexOffset:e,primitiveOffset:r,vertexLength:o,primitiveLength:c,vaos:{},sortKey:0}])}}function Ct(i,e){return 256*(i=ie(Math.floor(i),0,255))+ie(Math.floor(e),0,255)}dt.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Oe("SegmentVector",dt);const li=Yt([{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 ci={exports:{}},Gt={exports:{}};Gt.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 Qi={exports:{}};Qi.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 an=Gt.exports,$s=Qi.exports;ci.exports=an,ci.exports.murmur3=an,ci.exports.murmur2=$s;class On{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,r,o,c){this.ids.push(Ha(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=Ha(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 Us(o,c,0,o.length-1),r&&r.push(o.buffer,c.buffer),{ids:o,positions:c}}static deserialize(e){const r=new On;return r.ids=e.ids,r.positions=e.positions,r.indexed=!0,r}}function Ha(i){const e=+i;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:ci.exports(String(i))}function Us(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;Wr(i,h,d),Wr(e,3*h,3*d),Wr(e,3*h+1,3*d+1),Wr(e,3*h+2,3*d+2)}d-r<o-d?(Us(i,e,r,d),r=d+1):(Us(i,e,d+1,o),o=d)}}function Wr(i,e,r){const o=i[e];i[e]=i[r],i[r]=o}Oe("FeaturePositionMap",On);class ln{constructor(e,r){this.gl=e.gl,this.location=r}}class cn extends ln{constructor(e,r){super(e,r),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1f(this.location,e))}}class Ho extends ln{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 ru extends ln{constructor(e,r){super(e,r),this.current=B.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 Lp=new Float32Array(16);function Kl(i){return[Ct(255*i.r,255*i.g),Ct(255*i.b,255*i.a)]}class Vs{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 ru(e,r):new cn(e,r)}}class Ko{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 Ho(e,r):new cn(e,r)}}class un{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 Nt(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=Kl(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 Mr{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 Nt(this.zoom),r,{},c,[],h),m=this.expression.evaluate(new Nt(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=Kl(o),d=Kl(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=ie(this.expression.interpolationFactor(o,this.zoom,this.zoom+1),0,1);e.set(c)}getBinding(e,r,o){return new cn(e,r)}}class $n{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],T=c[m];if(g&&x&&T)for(let S=e;S<r;S++)this.zoomInPaintVertexArray.emplace(S,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(S,x.tl[0],x.tl[1],x.br[0],x.br[1],T.tl[0],T.tl[1],T.br[0],T.br[1],x.pixelRatio,T.pixelRatio)}upload(e){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=e.createVertexBuffer(this.zoomInPaintVertexArray,li.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=e.createVertexBuffer(this.zoomOutPaintVertexArray,li.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class nu{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 mr&&Ft(d.property.specification)))continue;const m=Rp(h,e.type),g=d.value,x=d.property.specification.type,T=d.property.useIntegerZoom,S=d.property.specification["property-type"],P=S==="cross-faded"||S==="cross-faded-data-driven";if(g.kind==="constant")this.binders[h]=P?new Ko(g.value,m):new Vs(g.value,m,x),c.push(`/u_${h}`);else if(g.kind==="source"||P){const k=ou(h,x,"source");this.binders[h]=P?new $n(g,x,T,r,k,e.id):new un(g,m,x,k),c.push(`/a_${h}`)}else{const k=ou(h,x,"composite");this.binders[h]=new Mr(g,m,x,T,r,k),c.push(`/z_${h}`)}}this.cacheKey=c.sort().join("")}getMaxValue(e){const r=this.binders[e];return r instanceof un||r instanceof Mr?r.maxValue:0}populatePaintArrays(e,r,o,c,h){for(const d in this.binders){const m=this.binders[d];(m instanceof un||m instanceof Mr||m instanceof $n)&&m.populatePaintArray(e,r,o,c,h)}}setConstantPatternPositions(e,r){for(const o in this.binders){const c=this.binders[o];c instanceof Ko&&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 T=o.feature(x.index);for(const S in this.binders){const P=this.binders[S];if((P instanceof un||P instanceof Mr||P instanceof $n)&&P.expression.isStateDependent===!0){const k=c.paint.get(S);P.expression=k.value,P.updatePaintArray(x.start,x.end,T,e[m],h),d=!0}}}}return d}defines(){const e=[];for(const r in this.binders){const o=this.binders[r];(o instanceof Vs||o instanceof Ko)&&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 un||o instanceof Mr)for(let c=0;c<o.paintVertexAttributes.length;c++)e.push(o.paintVertexAttributes[c].name);else if(o instanceof $n)for(let c=0;c<li.members.length;c++)e.push(li.members[c].name)}return e}getBinderUniforms(){const e=[];for(const r in this.binders){const o=this.binders[r];if(o instanceof Vs||o instanceof Ko||o instanceof Mr)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 Vs||h instanceof Ko||h instanceof Mr){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 $n){const c=e.fromScale===2?o.zoomInPaintVertexBuffer:o.zoomOutPaintVertexBuffer;c&&this._buffers.push(c)}else(o instanceof un||o instanceof Mr)&&o.paintVertexBuffer&&this._buffers.push(o.paintVertexBuffer)}}upload(e){for(const r in this.binders){const o=this.binders[r];(o instanceof un||o instanceof Mr||o instanceof $n)&&o.upload(e)}this.updatePaintBuffers()}destroy(){for(const e in this.binders){const r=this.binders[e];(r instanceof un||r instanceof Mr||r instanceof $n)&&r.destroy()}}}class vo{constructor(e,r,o=()=>!0){this.programConfigurations={};for(const c of e)this.programConfigurations[c.id]=new nu(c,r,o);this.needsUpload=!1,this._featureMap=new On,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 Rp(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 ou(i,e,r){const o={color:{source:s,composite:le},number:{source:U,composite:s}},c=function(h){return{"line-pattern":{source:ai,composite:ai},"fill-pattern":{source:ai,composite:ai},"fill-extrusion-pattern":{source:ai,composite:ai}}[h]}(i);return c&&c[r]||o[e][r]}Oe("ConstantBinder",Vs),Oe("CrossFadedConstantBinder",Ko),Oe("SourceExpressionBinder",un),Oe("CrossFadedCompositeBinder",$n),Oe("CompositeExpressionBinder",Mr),Oe("ProgramConfiguration",nu,{omit:["_buffers"]}),Oe("ProgramConfigurationSet",vo);var ri=8192;const Jl=Math.pow(2,14)-1,su=-Jl-1;function bo(i){const e=ri/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=ie(m,su,Jl),d.y=ie(g,su,Jl),(m<d.x||m>d.x+1||g<d.y||g>d.y+1)&&at("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return r}function wo(i,e){return{type:i.type,id:i.id,properties:i.properties,geometry:e?bo(i):[]}}function Ka(i,e,r,o,c){i.emplaceBack(2*e+(o+1)/2,2*r+(c+1)/2)}class Yl{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 At,this.indexArray=new zi,this.segments=new dt,this.programConfigurations=new vo(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:T,sourceLayerIndex:S}of e){const P=this.layers[0]._featureFilter.needGeometry,k=wo(g,P);if(!this.layers[0]._featureFilter.filter(new Nt(this.zoom),k,o))continue;const L=m?d.evaluate(k,{},o):void 0,Z={id:x,properties:g.properties,type:g.type,sourceLayerIndex:S,index:T,geometry:P?k.geometry:bo(g),patterns:{},sortKey:L};h.push(Z)}m&&h.sort((g,x)=>g.sortKey-x.sortKey);for(const g of h){const{geometry:x,index:T,sourceLayerIndex:S}=g,P=e[T].feature;this.addFeature(g,x,T,o),r.featureIndex.insert(P,x,T,S,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,ii),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>=ri||g<0||g>=ri)continue;const x=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),T=x.vertexLength;Ka(this.layoutVertexArray,m,g,-1,-1),Ka(this.layoutVertexArray,m,g,1,-1),Ka(this.layoutVertexArray,m,g,1,1),Ka(this.layoutVertexArray,m,g,-1,1),this.indexArray.emplaceBack(T,T+1,T+2),this.indexArray.emplaceBack(T,T+3,T+2),x.vertexLength+=4,x.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,o,{},c)}}function au(i,e){for(let r=0;r<i.length;r++)if(Jo(e,i[r]))return!0;for(let r=0;r<e.length;r++)if(Jo(i,e[r]))return!0;return!!Ql(i,e)}function Bp(i,e,r){return!!Jo(i,e)||!!ec(e,i,r)}function lu(i,e){if(i.length===1)return uu(e,i[0]);for(let r=0;r<e.length;r++){const o=e[r];for(let c=0;c<o.length;c++)if(Jo(i,o[c]))return!0}for(let r=0;r<i.length;r++)if(uu(e,i[r]))return!0;for(let r=0;r<e.length;r++)if(Ql(i,e[r]))return!0;return!1}function Fp(i,e,r){if(i.length>1){if(Ql(i,e))return!0;for(let o=0;o<e.length;o++)if(ec(e[o],i,r))return!0}for(let o=0;o<i.length;o++)if(ec(i[o],e,r))return!0;return!1}function Ql(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(Op(o,c,e[h],e[h+1]))return!0}return!1}function Op(i,e,r,o){return gt(i,r,o)!==gt(e,r,o)&&gt(i,e,r)!==gt(i,e,o)}function ec(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(cu(i,e[c-1],e[c])<o)return!0;return!1}function cu(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 uu(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 Jo(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 $p(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=gt(i,e,r[0]);return h!==gt(i,e,r[1])||h!==gt(i,e,r[2])||h!==gt(i,e,r[3])}function Ns(i,e,r){const o=e.paint.get(i).value;return o.kind==="constant"?o.value:r.programConfigurations.get(e.id).getMaxValue(i)}function Ja(i){return Math.sqrt(i[0]*i[0]+i[1]*i[1])}function Ya(i,e,r,o,c){if(!e[0]&&!e[1])return i;const h=Xe.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}Oe("CircleBucket",Yl,{omit:["layers"]});const Up=new mi({"circle-sort-key":new Ye(_e.layout_circle["circle-sort-key"])});var Vp={paint:new mi({"circle-radius":new Ye(_e.paint_circle["circle-radius"]),"circle-color":new Ye(_e.paint_circle["circle-color"]),"circle-blur":new Ye(_e.paint_circle["circle-blur"]),"circle-opacity":new Ye(_e.paint_circle["circle-opacity"]),"circle-translate":new Ze(_e.paint_circle["circle-translate"]),"circle-translate-anchor":new Ze(_e.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new Ze(_e.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new Ze(_e.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new Ye(_e.paint_circle["circle-stroke-width"]),"circle-stroke-color":new Ye(_e.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new Ye(_e.paint_circle["circle-stroke-opacity"])}),layout:Up},ki=1e-6,Di=typeof Float32Array!="undefined"?Float32Array:Array;function hu(){var i=new Di(9);return Di!=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 tc(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 pu(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],T=e[7],S=e[8],P=e[9],k=e[10],L=e[11],Z=e[12],q=e[13],re=e[14],ce=e[15],ee=r[0],ae=r[1],xe=r[2],ye=r[3];return i[0]=ee*o+ae*m+xe*S+ye*Z,i[1]=ee*c+ae*g+xe*P+ye*q,i[2]=ee*h+ae*x+xe*k+ye*re,i[3]=ee*d+ae*T+xe*L+ye*ce,i[4]=(ee=r[4])*o+(ae=r[5])*m+(xe=r[6])*S+(ye=r[7])*Z,i[5]=ee*c+ae*g+xe*P+ye*q,i[6]=ee*h+ae*x+xe*k+ye*re,i[7]=ee*d+ae*T+xe*L+ye*ce,i[8]=(ee=r[8])*o+(ae=r[9])*m+(xe=r[10])*S+(ye=r[11])*Z,i[9]=ee*c+ae*g+xe*P+ye*q,i[10]=ee*h+ae*x+xe*k+ye*re,i[11]=ee*d+ae*T+xe*L+ye*ce,i[12]=(ee=r[12])*o+(ae=r[13])*m+(xe=r[14])*S+(ye=r[15])*Z,i[13]=ee*c+ae*g+xe*P+ye*q,i[14]=ee*h+ae*x+xe*k+ye*re,i[15]=ee*d+ae*T+xe*L+ye*ce,i}Math.hypot||(Math.hypot=function(){for(var i=0,e=arguments.length;e--;)i+=arguments[e]*arguments[e];return Math.sqrt(i)});var Gs,Np=pu;function du(){var i=new Di(3);return Di!=Float32Array&&(i[0]=0,i[1]=0,i[2]=0),i}function fu(i,e,r){var o=new Di(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 mu(){var i=new Di(4);return Di!=Float32Array&&(i[0]=0,i[1]=0,i[2]=0),i[3]=1,i}function gu(i,e){const r=Qa([],[i.x,i.y,0,1],e);return new Xe(r[0]/r[3],r[1]/r[3])}du(),Gs=new Di(4),Di!=Float32Array&&(Gs[0]=0,Gs[1]=0,Gs[2]=0,Gs[3]=0),du(),fu(1,0,0),fu(0,1,0),mu(),mu(),hu(),function(){var i;i=new Di(2),Di!=Float32Array&&(i[0]=0,i[1]=0)}();class _u extends Yl{}Oe("HeatmapBucket",_u,{omit:["layers"]});var Gp={paint:new mi({"heatmap-radius":new Ye(_e.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Ye(_e.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Ze(_e.paint_heatmap["heatmap-intensity"]),"heatmap-color":new qr(_e.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Ze(_e.paint_heatmap["heatmap-opacity"])})};function ic(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 yu(i,{width:e,height:r},o){if(e===i.width&&r===i.height)return;const c=ic({},{width:e,height:r},o);rc(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 rc(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,T=((o.y+g)*e.width+o.x)*h;for(let S=0;S<c.width*h;S++)m[T+S]=d[x+S]}return e}class qs{constructor(e,r){ic(this,e,1,r)}resize(e){yu(this,e,1)}clone(){return new qs({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,r,o,c,h){rc(e,r,o,c,h,1)}}class or{constructor(e,r){ic(this,e,4,r)}resize(e){yu(this,e,4)}replace(e,r){r?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new or({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,r,o,c,h){rc(e,r,o,c,h,4)}}function xu(i){const e={},r=i.resolution||256,o=i.clips?i.clips.length:1,c=i.image||new or({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 T=g/(r-1),{start:S,end:P}=i.clips[d];h(m,x,S*(1-T)+P*T)}else for(let d=0,m=0;d<r;d++,m+=4)h(0,m,d/(r-1));return c}Oe("AlphaImage",qs),Oe("RGBAImage",or);var qp={paint:new mi({"hillshade-illumination-direction":new Ze(_e.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new Ze(_e.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new Ze(_e.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new Ze(_e.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new Ze(_e.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new Ze(_e.paint_hillshade["hillshade-accent-color"])})};const Zp=Yt([{name:"a_pos",components:2,type:"Int16"}],4),{members:jp}=Zp;var el={exports:{}};function tl(i,e,r){r=r||2;var o,c,h,d,m,g,x,T=e&&e.length,S=T?e[0]*r:i.length,P=vu(i,0,S,r,!0),k=[];if(!P||P.next===P.prev)return k;if(T&&(P=function(Z,q,re,ce){var ee,ae,xe,ye=[];for(ee=0,ae=q.length;ee<ae;ee++)(xe=vu(Z,q[ee]*ce,ee<ae-1?q[ee+1]*ce:Z.length,ce,!1))===xe.next&&(xe.steiner=!0),ye.push(ed(xe));for(ye.sort(Jp),ee=0;ee<ye.length;ee++)re=Yp(ye[ee],re);return re}(i,e,P,r)),i.length>80*r){o=h=i[0],c=d=i[1];for(var L=r;L<S;L+=r)(m=i[L])<o&&(o=m),(g=i[L+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 Zs(P,k,r,o,c,x,0),k}function vu(i,e,r,o,c){var h,d;if(c===sc(i,e,r,o)>0)for(h=e;h<r;h+=o)d=Tu(h,i[h],i[h+1],d);else for(h=r-o;h>=e;h-=o)d=Tu(h,i[h],i[h+1],d);return d&&il(d,d.next)&&(Xs(d),d=d.next),d}function To(i,e){if(!i)return i;e||(e=i);var r,o=i;do if(r=!1,o.steiner||!il(o,o.next)&&Ht(o.prev,o,o.next)!==0)o=o.next;else{if(Xs(o),(o=e=o.prev)===o.next)break;r=!0}while(r||o!==e);return e}function Zs(i,e,r,o,c,h,d){if(i){!d&&h&&function(T,S,P,k){var L=T;do L.z===0&&(L.z=nc(L.x,L.y,S,P,k)),L.prevZ=L.prev,L.nextZ=L.next,L=L.next;while(L!==T);L.prevZ.nextZ=null,L.prevZ=null,function(Z){var q,re,ce,ee,ae,xe,ye,Fe,Ne=1;do{for(re=Z,Z=null,ae=null,xe=0;re;){for(xe++,ce=re,ye=0,q=0;q<Ne&&(ye++,ce=ce.nextZ);q++);for(Fe=Ne;ye>0||Fe>0&&ce;)ye!==0&&(Fe===0||!ce||re.z<=ce.z)?(ee=re,re=re.nextZ,ye--):(ee=ce,ce=ce.nextZ,Fe--),ae?ae.nextZ=ee:Z=ee,ee.prevZ=ae,ae=ee;re=ce}ae.nextZ=null,Ne*=2}while(xe>1)}(L)}(i,o,c,h);for(var m,g,x=i;i.prev!==i.next;)if(m=i.prev,g=i.next,h?Wp(i,o,c,h):Xp(i))e.push(m.i/r|0),e.push(i.i/r|0),e.push(g.i/r|0),Xs(i),i=g.next,x=g.next;else if((i=g)===x){d?d===1?Zs(i=Hp(To(i),e,r),e,r,o,c,h,2):d===2&&Kp(i,e,r,o,c,h):Zs(To(i),e,r,o,c,h,1);break}}}function Xp(i){var e=i.prev,r=i,o=i.next;if(Ht(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,T=c<h?c<d?c:d:h<d?h:d,S=m<g?m<x?m:x:g<x?g:x,P=c>h?c>d?c:d:h>d?h:d,k=m>g?m>x?m:x:g>x?g:x,L=o.next;L!==e;){if(L.x>=T&&L.x<=P&&L.y>=S&&L.y<=k&&Yo(c,m,h,g,d,x,L.x,L.y)&&Ht(L.prev,L,L.next)>=0)return!1;L=L.next}return!0}function Wp(i,e,r,o){var c=i.prev,h=i,d=i.next;if(Ht(c,h,d)>=0)return!1;for(var m=c.x,g=h.x,x=d.x,T=c.y,S=h.y,P=d.y,k=m<g?m<x?m:x:g<x?g:x,L=T<S?T<P?T:P:S<P?S:P,Z=m>g?m>x?m:x:g>x?g:x,q=T>S?T>P?T:P:S>P?S:P,re=nc(k,L,e,r,o),ce=nc(Z,q,e,r,o),ee=i.prevZ,ae=i.nextZ;ee&&ee.z>=re&&ae&&ae.z<=ce;){if(ee.x>=k&&ee.x<=Z&&ee.y>=L&&ee.y<=q&&ee!==c&&ee!==d&&Yo(m,T,g,S,x,P,ee.x,ee.y)&&Ht(ee.prev,ee,ee.next)>=0||(ee=ee.prevZ,ae.x>=k&&ae.x<=Z&&ae.y>=L&&ae.y<=q&&ae!==c&&ae!==d&&Yo(m,T,g,S,x,P,ae.x,ae.y)&&Ht(ae.prev,ae,ae.next)>=0))return!1;ae=ae.nextZ}for(;ee&&ee.z>=re;){if(ee.x>=k&&ee.x<=Z&&ee.y>=L&&ee.y<=q&&ee!==c&&ee!==d&&Yo(m,T,g,S,x,P,ee.x,ee.y)&&Ht(ee.prev,ee,ee.next)>=0)return!1;ee=ee.prevZ}for(;ae&&ae.z<=ce;){if(ae.x>=k&&ae.x<=Z&&ae.y>=L&&ae.y<=q&&ae!==c&&ae!==d&&Yo(m,T,g,S,x,P,ae.x,ae.y)&&Ht(ae.prev,ae,ae.next)>=0)return!1;ae=ae.nextZ}return!0}function Hp(i,e,r){var o=i;do{var c=o.prev,h=o.next.next;!il(c,h)&&bu(c,o,o.next,h)&&js(c,h)&&js(h,c)&&(e.push(c.i/r|0),e.push(o.i/r|0),e.push(h.i/r|0),Xs(o),Xs(o.next),o=i=h),o=o.next}while(o!==i);return To(o)}function Kp(i,e,r,o,c,h){var d=i;do{for(var m=d.next.next;m!==d.prev;){if(d.i!==m.i&&td(d,m)){var g=wu(d,m);return d=To(d,d.next),g=To(g,g.next),Zs(d,e,r,o,c,h,0),void Zs(g,e,r,o,c,h,0)}m=m.next}d=d.next}while(d!==i)}function Jp(i,e){return i.x-e.x}function Yp(i,e){var r=function(c,h){var d,m=h,g=c.x,x=c.y,T=-1/0;do{if(x<=m.y&&x>=m.next.y&&m.next.y!==m.y){var S=m.x+(x-m.y)*(m.next.x-m.x)/(m.next.y-m.y);if(S<=g&&S>T&&(T=S,d=m.x<m.next.x?m:m.next,S===g))return d}m=m.next}while(m!==h);if(!d)return null;var P,k=d,L=d.x,Z=d.y,q=1/0;m=d;do g>=m.x&&m.x>=L&&g!==m.x&&Yo(x<Z?g:T,x,L,Z,x<Z?T:g,x,m.x,m.y)&&(P=Math.abs(x-m.y)/(g-m.x),js(m,c)&&(P<q||P===q&&(m.x>d.x||m.x===d.x&&Qp(d,m)))&&(d=m,q=P)),m=m.next;while(m!==k);return d}(i,e);if(!r)return e;var o=wu(r,i);return To(o,o.next),To(r,r.next)}function Qp(i,e){return Ht(i.prev,i,e.prev)<0&&Ht(e.next,i,i.next)<0}function nc(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 ed(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 Yo(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 td(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&&bu(c,c.next,r,o))return!0;c=c.next}while(c!==r);return!1}(i,e)&&(js(i,e)&&js(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)&&(Ht(i.prev,i,e.prev)||Ht(i,e.prev,e))||il(i,e)&&Ht(i.prev,i,i.next)>0&&Ht(e.prev,e,e.next)>0)}function Ht(i,e,r){return(e.y-i.y)*(r.x-e.x)-(e.x-i.x)*(r.y-e.y)}function il(i,e){return i.x===e.x&&i.y===e.y}function bu(i,e,r,o){var c=nl(Ht(i,e,r)),h=nl(Ht(i,e,o)),d=nl(Ht(r,o,i)),m=nl(Ht(r,o,e));return c!==h&&d!==m||!(c!==0||!rl(i,r,e))||!(h!==0||!rl(i,o,e))||!(d!==0||!rl(r,i,o))||!(m!==0||!rl(r,e,o))}function rl(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 nl(i){return i>0?1:i<0?-1:0}function js(i,e){return Ht(i.prev,i,i.next)<0?Ht(i,e,i.next)>=0&&Ht(i,i.prev,e)>=0:Ht(i,e,i.prev)<0||Ht(i,i.next,e)<0}function wu(i,e){var r=new oc(i.i,i.x,i.y),o=new oc(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 Tu(i,e,r,o){var c=new oc(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 Xs(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 oc(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 sc(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 id(i,e,r,o,c){Eu(i,e,r||0,o||i.length-1,c||rd)}function Eu(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);Eu(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 T=i[e],S=r,P=o;for(Ws(i,r,e),c(i[o],T)>0&&Ws(i,r,o);S<P;){for(Ws(i,S,P),S++,P--;c(i[S],T)<0;)S++;for(;c(i[P],T)>0;)P--}c(i[r],T)===0?Ws(i,r,P):Ws(i,++P,o),P<=e&&(r=P+1),e<=P&&(o=P-1)}}function Ws(i,e,r){var o=i[e];i[e]=i[r],i[r]=o}function rd(i,e){return i<e?-1:i>e?1:0}function ac(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=ti(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||(id(o[d],e,1,o[d].length-1,nd),o[d]=o[d].slice(0,e));return o}function nd(i,e){return e.area-i.area}function lc(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 cc(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),T=m.evaluate({zoom:o+1},r,{},c.availableImages);g=g&&g.name?g.name:g,x=x&&x.name?x.name:x,T=T&&T.name?T.name:T,h[g]=!0,h[x]=!0,h[T]=!0,r.patterns[d.id]={min:g,mid:x,max:T}}}return r}el.exports=tl,el.exports.default=tl,tl.deviation=function(i,e,r,o){var c=e&&e.length,h=Math.abs(sc(i,0,c?e[0]*r:i.length,r));if(c)for(var d=0,m=e.length;d<m;d++)h-=Math.abs(sc(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,T=o[d+1]*r,S=o[d+2]*r;g+=Math.abs((i[x]-i[S])*(i[T+1]-i[x+1])-(i[x]-i[T])*(i[S+1]-i[x+1]))}return h===0&&g===0?0:Math.abs((g-h)/h)},tl.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 uc{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 Mt,this.indexArray=new zi,this.indexArray2=new Ar,this.programConfigurations=new vo(e.layers,e.zoom),this.segments=new dt,this.segments2=new dt,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,o){this.hasPattern=lc("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:T}of e){const S=this.layers[0]._featureFilter.needGeometry,P=wo(m,S);if(!this.layers[0]._featureFilter.filter(new Nt(this.zoom),P,o))continue;const k=h?c.evaluate(P,{},o,r.availableImages):void 0,L={id:g,properties:m.properties,type:m.type,sourceLayerIndex:T,index:x,geometry:S?P.geometry:bo(m),patterns:{},sortKey:k};d.push(L)}h&&d.sort((m,g)=>m.sortKey-g.sortKey);for(const m of d){const{geometry:g,index:x,sourceLayerIndex:T}=m;if(this.hasPattern){const S=cc("fill",this.layers,m,this.zoom,r);this.patternFeatures.push(S)}else this.addFeature(m,g,x,o,{});r.featureIndex.insert(e[x].feature,g,x,T,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,jp),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 ac(r,500)){let m=0;for(const k of d)m+=k.length;const g=this.segments.prepareSegment(m,this.layoutVertexArray,this.indexArray),x=g.vertexLength,T=[],S=[];for(const k of d){if(k.length===0)continue;k!==d[0]&&S.push(T.length/2);const L=this.segments2.prepareSegment(k.length,this.layoutVertexArray,this.indexArray2),Z=L.vertexLength;this.layoutVertexArray.emplaceBack(k[0].x,k[0].y),this.indexArray2.emplaceBack(Z+k.length-1,Z),T.push(k[0].x),T.push(k[0].y);for(let q=1;q<k.length;q++)this.layoutVertexArray.emplaceBack(k[q].x,k[q].y),this.indexArray2.emplaceBack(Z+q-1,Z+q),T.push(k[q].x),T.push(k[q].y);L.vertexLength+=k.length,L.primitiveLength+=k.length}const P=el.exports(T,S);for(let k=0;k<P.length;k+=3)this.indexArray.emplaceBack(x+P[k],x+P[k+1],x+P[k+2]);g.vertexLength+=m,g.primitiveLength+=P.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,o,h,c)}}Oe("FillBucket",uc,{omit:["layers","patternFeatures"]});const od=new mi({"fill-sort-key":new Ye(_e.layout_fill["fill-sort-key"])});var sd={paint:new mi({"fill-antialias":new Ze(_e.paint_fill["fill-antialias"]),"fill-opacity":new Ye(_e.paint_fill["fill-opacity"]),"fill-color":new Ye(_e.paint_fill["fill-color"]),"fill-outline-color":new Ye(_e.paint_fill["fill-outline-color"]),"fill-translate":new Ze(_e.paint_fill["fill-translate"]),"fill-translate-anchor":new Ze(_e.paint_fill["fill-translate-anchor"]),"fill-pattern":new Fn(_e.paint_fill["fill-pattern"])}),layout:od};const ad=Yt([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),ld=Yt([{name:"a_centroid",components:2,type:"Int16"}],4),{members:cd}=ad;var Un={},ud=Xe,Su=Qo;function Qo(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(hd,this,e)}function hd(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 pd(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}Qo.types=["Unknown","Point","LineString","Polygon"],Qo.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 ud(h,d));else{if(o!==7)throw new Error("unknown command "+o);e&&e.push(e[0].clone())}}return e&&m.push(e),m},Qo.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 T=i.readVarint();r=7&T,o=T>>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]},Qo.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=Qo.types[this.type];function T(k){for(var L=0;L<k.length;L++){var Z=k[L];k[L]=[360*(Z.x+d)/h-180,360/Math.PI*Math.atan(Math.exp((180-360*(Z.y+m)/h)*Math.PI/180))-90]}}switch(this.type){case 1:var S=[];for(o=0;o<g.length;o++)S[o]=g[o][0];T(g=S);break;case 2:for(o=0;o<g.length;o++)T(g[o]);break;case 3:for(g=function(k){var L=k.length;if(L<=1)return[k];for(var Z,q,re=[],ce=0;ce<L;ce++){var ee=pd(k[ce]);ee!==0&&(q===void 0&&(q=ee<0),q===ee<0?(Z&&re.push(Z),Z=[k[ce]]):Z.push(k[ce]))}return Z&&re.push(Z),re}(g),o=0;o<g.length;o++)for(c=0;c<g[o].length;c++)T(g[o][c])}g.length===1?g=g[0]:x="Multi"+x;var P={type:"Feature",geometry:{type:x,coordinates:g},properties:this.properties};return"id"in this&&(P.id=this.id),P};var dd=Su,Iu=Cu;function Cu(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(fd,this,e),this.length=this._features.length}function fd(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))}Cu.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 dd(this._pbf,e,this.extent,this._keys,this._values)};var md=Iu;function gd(i,e,r){if(i===3){var o=new md(r,r.readVarint()+r.pos);o.length&&(e[o.name]=o)}}Un.VectorTile=function(i,e){this.layers=i.readFields(gd,{},e)},Un.VectorTileFeature=Su,Un.VectorTileLayer=Iu;const _d=Un.VectorTileFeature.types,hc=Math.pow(2,13);function Hs(i,e,r,o,c,h,d,m){i.emplaceBack(e,r,2*Math.floor(o*hc)+d,c*hc*2,h*hc*2,Math.round(m))}class pc{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 _t,this.centroidVertexArray=new We,this.indexArray=new zi,this.programConfigurations=new vo(e.layers,e.zoom),this.segments=new dt,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,o){this.features=[],this.hasPattern=lc("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=wo(c,g);if(!this.layers[0]._featureFilter.filter(new Nt(this.zoom),x,o))continue;const T={id:h,sourceLayerIndex:m,index:d,geometry:g?x.geometry:bo(c),properties:c.properties,type:c.type,patterns:{}};this.hasPattern?this.features.push(cc("fill-extrusion",this.layers,T,this.zoom,r)):this.addFeature(T,T.geometry,d,o,{}),r.featureIndex.insert(c,T.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,cd),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,ld.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 ac(r,500)){let g=0;for(const L of m)g+=L.length;let x=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const L of m){if(L.length===0||xd(L))continue;let Z=0;for(let q=0;q<L.length;q++){const re=L[q];if(q>=1){const ce=L[q-1];if(!yd(re,ce)){x.vertexLength+4>dt.MAX_VERTEX_ARRAY_LENGTH&&(x=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const ee=re.sub(ce)._perp()._unit(),ae=ce.dist(re);Z+ae>32768&&(Z=0),Hs(this.layoutVertexArray,re.x,re.y,ee.x,ee.y,0,0,Z),Hs(this.layoutVertexArray,re.x,re.y,ee.x,ee.y,0,1,Z),d.x+=2*re.x,d.y+=2*re.y,d.vertexCount+=2,Z+=ae,Hs(this.layoutVertexArray,ce.x,ce.y,ee.x,ee.y,0,0,Z),Hs(this.layoutVertexArray,ce.x,ce.y,ee.x,ee.y,0,1,Z),d.x+=2*ce.x,d.y+=2*ce.y,d.vertexCount+=2;const xe=x.vertexLength;this.indexArray.emplaceBack(xe,xe+2,xe+1),this.indexArray.emplaceBack(xe+1,xe+2,xe+3),x.vertexLength+=4,x.primitiveLength+=2}}}}if(x.vertexLength+g>dt.MAX_VERTEX_ARRAY_LENGTH&&(x=this.segments.prepareSegment(g,this.layoutVertexArray,this.indexArray)),_d[e.type]!=="Polygon")continue;const T=[],S=[],P=x.vertexLength;for(const L of m)if(L.length!==0){L!==m[0]&&S.push(T.length/2);for(let Z=0;Z<L.length;Z++){const q=L[Z];Hs(this.layoutVertexArray,q.x,q.y,0,0,1,1,0),d.x+=q.x,d.y+=q.y,d.vertexCount+=1,T.push(q.x),T.push(q.y)}}const k=el.exports(T,S);for(let L=0;L<k.length;L+=3)this.indexArray.emplaceBack(P+k[L],P+k[L+2],P+k[L+1]);x.primitiveLength+=k.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 yd(i,e){return i.x===e.x&&(i.x<0||i.x>ri)||i.y===e.y&&(i.y<0||i.y>ri)}function xd(i){return i.every(e=>e.x<0)||i.every(e=>e.x>ri)||i.every(e=>e.y<0)||i.every(e=>e.y>ri)}Oe("FillExtrusionBucket",pc,{omit:["layers","features"]});var vd={paint:new mi({"fill-extrusion-opacity":new Ze(_e["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Ye(_e["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Ze(_e["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Ze(_e["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Fn(_e["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Ye(_e["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Ye(_e["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Ze(_e["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})};function Ks(i,e){return i.x*e.x+i.y*e.y}function Au(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),T=Ks(m,m),S=Ks(m,g),P=Ks(g,g),k=Ks(x,m),L=Ks(x,g),Z=T*P-S*S,q=(P*k-S*L)/Z,re=(T*L-S*k)/Z,ce=o.z*(1-q-re)+c.z*q+h.z*re;if(isFinite(ce))return ce}return 1/0}{let r=1/0;for(const o of e)r=Math.min(r,o.z);return r}}const bd=Yt([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:wd}=bd,Td=Yt([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:Ed}=Td,Sd=Un.VectorTileFeature.types,Id=Math.cos(Math.PI/180*37.5),Mu=Math.pow(2,14)/.5;class dc{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 wt,this.layoutVertexArray2=new zt,this.indexArray=new zi,this.programConfigurations=new vo(e.layers,e.zoom),this.segments=new dt,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,o){this.hasPattern=lc("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:T}of e){const S=this.layers[0]._featureFilter.needGeometry,P=wo(m,S);if(!this.layers[0]._featureFilter.filter(new Nt(this.zoom),P,o))continue;const k=h?c.evaluate(P,{},o):void 0,L={id:g,properties:m.properties,type:m.type,sourceLayerIndex:T,index:x,geometry:S?P.geometry:bo(m),patterns:{},sortKey:k};d.push(L)}h&&d.sort((m,g)=>m.sortKey-g.sortKey);for(const m of d){const{geometry:g,index:x,sourceLayerIndex:T}=m;if(this.hasPattern){const S=cc("line",this.layers,m,this.zoom,r);this.patternFeatures.push(S)}else this.addFeature(m,g,x,o,{});r.featureIndex.insert(e[x].feature,g,x,T,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,Ed)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,wd),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"),T=d.get("line-round-limit");this.lineClips=this.lineFeatureClips(e);for(const S of r)this.addLine(S,e,m,g,x,T);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 re=0;re<e.length-1;re++)this.totalDistance+=e[re].dist(e[re+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const m=Sd[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 T=this.overscaling<=16?122880/(512*this.overscaling):0,S=this.segments.prepareSegment(10*g,this.layoutVertexArray,this.indexArray);let P,k,L,Z,q;this.e1=this.e2=-1,m&&(P=e[g-2],q=e[x].sub(P)._unit()._perp());for(let re=x;re<g;re++){if(L=re===g-1?m?e[x+1]:void 0:e[re+1],L&&e[re].equals(L))continue;q&&(Z=q),P&&(k=P),P=e[re],q=L?L.sub(P)._unit()._perp():Z,Z=Z||q;let ce=Z.add(q);ce.x===0&&ce.y===0||ce._unit();const ee=Z.x*q.x+Z.y*q.y,ae=ce.x*q.x+ce.y*q.y,xe=ae!==0?1/ae:1/0,ye=2*Math.sqrt(2-2*ae),Fe=ae<Id&&k&&L,Ne=Z.x*q.y-Z.y*q.x>0;if(Fe&&re>x){const Ee=P.dist(k);if(Ee>2*T){const De=P.sub(P.sub(k)._mult(T/Ee)._round());this.updateDistance(k,De),this.addCurrentVertex(De,Z,0,0,S),k=De}}const ke=k&&L;let Ae=ke?o:m?"butt":c;if(ke&&Ae==="round"&&(xe<d?Ae="miter":xe<=2&&(Ae="fakeround")),Ae==="miter"&&xe>h&&(Ae="bevel"),Ae==="bevel"&&(xe>2&&(Ae="flipbevel"),xe<h&&(Ae="miter")),k&&this.updateDistance(k,P),Ae==="miter")ce._mult(xe),this.addCurrentVertex(P,ce,0,0,S);else if(Ae==="flipbevel"){if(xe>100)ce=q.mult(-1);else{const Ee=xe*Z.add(q).mag()/Z.sub(q).mag();ce._perp()._mult(Ee*(Ne?-1:1))}this.addCurrentVertex(P,ce,0,0,S),this.addCurrentVertex(P,ce.mult(-1),0,0,S)}else if(Ae==="bevel"||Ae==="fakeround"){const Ee=-Math.sqrt(xe*xe-1),De=Ne?Ee:0,Pe=Ne?0:Ee;if(k&&this.addCurrentVertex(P,Z,De,Pe,S),Ae==="fakeround"){const we=Math.round(180*ye/Math.PI/20);for(let He=1;He<we;He++){let je=He/we;if(je!==.5){const Ot=je-.5;je+=je*Ot*(je-1)*((1.0904+ee*(ee*(3.55645-1.43519*ee)-3.2452))*Ot*Ot+(.848013+ee*(.215638*ee-1.06021)))}const pt=q.sub(Z)._mult(je)._add(Z)._unit()._mult(Ne?-1:1);this.addHalfVertex(P,pt.x,pt.y,!1,Ne,0,S)}}L&&this.addCurrentVertex(P,q,-De,-Pe,S)}else if(Ae==="butt")this.addCurrentVertex(P,ce,0,0,S);else if(Ae==="square"){const Ee=k?1:-1;this.addCurrentVertex(P,ce,Ee,Ee,S)}else Ae==="round"&&(k&&(this.addCurrentVertex(P,Z,0,0,S),this.addCurrentVertex(P,Z,1,1,S,!0)),L&&(this.addCurrentVertex(P,q,-1,-1,S,!0),this.addCurrentVertex(P,q,0,0,S)));if(Fe&&re<g-1){const Ee=P.dist(L);if(Ee>2*T){const De=P.add(L.sub(P)._mult(T/Ee)._round());this.updateDistance(P,De),this.addCurrentVertex(De,q,0,0,S),P=De}}}}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>Mu/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*(Mu-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 T=g.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,T),g.primitiveLength++),d?this.e2=T:this.e1=T}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()}}Oe("LineBucket",dc,{omit:["layers","patternFeatures"]});const Cd=new mi({"line-cap":new Ze(_e.layout_line["line-cap"]),"line-join":new Ye(_e.layout_line["line-join"]),"line-miter-limit":new Ze(_e.layout_line["line-miter-limit"]),"line-round-limit":new Ze(_e.layout_line["line-round-limit"]),"line-sort-key":new Ye(_e.layout_line["line-sort-key"])});var Pu={paint:new mi({"line-opacity":new Ye(_e.paint_line["line-opacity"]),"line-color":new Ye(_e.paint_line["line-color"]),"line-translate":new Ze(_e.paint_line["line-translate"]),"line-translate-anchor":new Ze(_e.paint_line["line-translate-anchor"]),"line-width":new Ye(_e.paint_line["line-width"]),"line-gap-width":new Ye(_e.paint_line["line-gap-width"]),"line-offset":new Ye(_e.paint_line["line-offset"]),"line-blur":new Ye(_e.paint_line["line-blur"]),"line-dasharray":new Fs(_e.paint_line["line-dasharray"]),"line-pattern":new Fn(_e.paint_line["line-pattern"]),"line-gradient":new qr(_e.paint_line["line-gradient"])}),layout:Cd};const zu=new class extends Ye{possiblyEvaluate(i,e){return e=new Nt(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=$e({},e,{zoom:Math.floor(e.zoom)}),super.evaluate(i,e,r,o)}}(Pu.paint.properties["line-width"].specification);function ku(i,e){return e>0?e+2*i:i}zu.useIntegerZoom=!0;const Ad=Yt([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Md=Yt([{name:"a_projected_pos",components:3,type:"Float32"}],4);Yt([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const Pd=Yt([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]);Yt([{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 Du=Yt([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),zd=Yt([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function kd(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()),Ji.applyArabicShaping&&(c=Ji.applyArabicShaping(c)),c}(o.text,e,r)}),i}Yt([{name:"triangle",components:3,type:"Uint16"}]),Yt([{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"}]),Yt([{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"}]),Yt([{type:"Float32",name:"offsetX"}]),Yt([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]);const Js={"!":"\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 gi=24,fc=Lt,Lu=function(i,e,r,o,c){var h,d,m=8*c-o-1,g=(1<<m)-1,x=g>>1,T=-7,S=r?c-1:0,P=r?-1:1,k=i[e+S];for(S+=P,h=k&(1<<-T)-1,k>>=-T,T+=m;T>0;h=256*h+i[e+S],S+=P,T-=8);for(d=h&(1<<-T)-1,h>>=-T,T+=o;T>0;d=256*d+i[e+S],S+=P,T-=8);if(h===0)h=1-x;else{if(h===g)return d?NaN:1/0*(k?-1:1);d+=Math.pow(2,o),h-=x}return(k?-1:1)*d*Math.pow(2,h-o)},Ru=function(i,e,r,o,c,h){var d,m,g,x=8*h-c-1,T=(1<<x)-1,S=T>>1,P=c===23?Math.pow(2,-24)-Math.pow(2,-77):0,k=o?0:h-1,L=o?1:-1,Z=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=T):(d=Math.floor(Math.log(e)/Math.LN2),e*(g=Math.pow(2,-d))<1&&(d--,g*=2),(e+=d+S>=1?P/g:P*Math.pow(2,1-S))*g>=2&&(d++,g/=2),d+S>=T?(m=0,d=T):d+S>=1?(m=(e*g-1)*Math.pow(2,c),d+=S):(m=e*Math.pow(2,S-1)*Math.pow(2,c),d=0));c>=8;i[r+k]=255&m,k+=L,m/=256,c-=8);for(d=d<<c|m,x+=c;x>0;i[r+k]=255&d,k+=L,d/=256,x-=8);i[r+k-L]|=128*Z};function Lt(i){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(i)?i:new Uint8Array(i||0),this.pos=0,this.type=0,this.length=this.buf.length}Lt.Varint=0,Lt.Fixed64=1,Lt.Bytes=2,Lt.Fixed32=5;var Vn,mc=4294967296,Bu=1/mc,Fu=typeof TextDecoder=="undefined"?null:new TextDecoder("utf8");function hn(i){return i.type===Lt.Bytes?i.readVarint()+i.pos:i.pos+1}function es(i,e,r){return r?4294967296*e+(i>>>0):4294967296*(e>>>0)+(i>>>0)}function Ou(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 Dd(i,e){for(var r=0;r<i.length;r++)e.writeVarint(i[r])}function Ld(i,e){for(var r=0;r<i.length;r++)e.writeSVarint(i[r])}function Rd(i,e){for(var r=0;r<i.length;r++)e.writeFloat(i[r])}function Bd(i,e){for(var r=0;r<i.length;r++)e.writeDouble(i[r])}function Fd(i,e){for(var r=0;r<i.length;r++)e.writeBoolean(i[r])}function Od(i,e){for(var r=0;r<i.length;r++)e.writeFixed32(i[r])}function $d(i,e){for(var r=0;r<i.length;r++)e.writeSFixed32(i[r])}function Ud(i,e){for(var r=0;r<i.length;r++)e.writeFixed64(i[r])}function Vd(i,e){for(var r=0;r<i.length;r++)e.writeSFixed64(i[r])}function ol(i,e){return(i[e]|i[e+1]<<8|i[e+2]<<16)+16777216*i[e+3]}function ts(i,e,r){i[r]=e,i[r+1]=e>>>8,i[r+2]=e>>>16,i[r+3]=e>>>24}function $u(i,e){return(i[e]|i[e+1]<<8|i[e+2]<<16)+(i[e+3]<<24)}function Nd(i,e,r){i===1&&r.readMessage(Gd,e)}function Gd(i,e,r){if(i===3){const{id:o,bitmap:c,width:h,height:d,left:m,top:g,advance:x}=r.readMessage(qd,{});e.push({id:o,bitmap:new qs({width:h+6,height:d+6},c),metrics:{width:h,height:d,left:m,top:g,advance:x}})}}function qd(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 Uu(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}}Lt.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=ol(this.buf,this.pos);return this.pos+=4,i},readSFixed32:function(){var i=$u(this.buf,this.pos);return this.pos+=4,i},readFixed64:function(){var i=ol(this.buf,this.pos)+ol(this.buf,this.pos+4)*mc;return this.pos+=8,i},readSFixed64:function(){var i=ol(this.buf,this.pos)+$u(this.buf,this.pos+4)*mc;return this.pos+=8,i},readFloat:function(){var i=Lu(this.buf,this.pos,!0,23,4);return this.pos+=4,i},readDouble:function(){var i=Lu(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 es(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&&Fu?function(r,o,c){return Fu.decode(r.subarray(o,c))}(this.buf,e,i):function(r,o,c){for(var h="",d=o;d<c;){var m,g,x,T=r[d],S=null,P=T>239?4:T>223?3:T>191?2:1;if(d+P>c)break;P===1?T<128&&(S=T):P===2?(192&(m=r[d+1]))==128&&(S=(31&T)<<6|63&m)<=127&&(S=null):P===3?(g=r[d+2],(192&(m=r[d+1]))==128&&(192&g)==128&&((S=(15&T)<<12|(63&m)<<6|63&g)<=2047||S>=55296&&S<=57343)&&(S=null)):P===4&&(g=r[d+2],x=r[d+3],(192&(m=r[d+1]))==128&&(192&g)==128&&(192&x)==128&&((S=(15&T)<<18|(63&m)<<12|(63&g)<<6|63&x)<=65535||S>=1114112)&&(S=null)),S===null?(S=65533,P=1):S>65535&&(S-=65536,h+=String.fromCharCode(S>>>10&1023|55296),S=56320|1023&S),h+=String.fromCharCode(S),d+=P}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!==Lt.Bytes)return i.push(this.readVarint(e));var r=hn(this);for(i=i||[];this.pos<r;)i.push(this.readVarint(e));return i},readPackedSVarint:function(i){if(this.type!==Lt.Bytes)return i.push(this.readSVarint());var e=hn(this);for(i=i||[];this.pos<e;)i.push(this.readSVarint());return i},readPackedBoolean:function(i){if(this.type!==Lt.Bytes)return i.push(this.readBoolean());var e=hn(this);for(i=i||[];this.pos<e;)i.push(this.readBoolean());return i},readPackedFloat:function(i){if(this.type!==Lt.Bytes)return i.push(this.readFloat());var e=hn(this);for(i=i||[];this.pos<e;)i.push(this.readFloat());return i},readPackedDouble:function(i){if(this.type!==Lt.Bytes)return i.push(this.readDouble());var e=hn(this);for(i=i||[];this.pos<e;)i.push(this.readDouble());return i},readPackedFixed32:function(i){if(this.type!==Lt.Bytes)return i.push(this.readFixed32());var e=hn(this);for(i=i||[];this.pos<e;)i.push(this.readFixed32());return i},readPackedSFixed32:function(i){if(this.type!==Lt.Bytes)return i.push(this.readSFixed32());var e=hn(this);for(i=i||[];this.pos<e;)i.push(this.readSFixed32());return i},readPackedFixed64:function(i){if(this.type!==Lt.Bytes)return i.push(this.readFixed64());var e=hn(this);for(i=i||[];this.pos<e;)i.push(this.readFixed64());return i},readPackedSFixed64:function(i){if(this.type!==Lt.Bytes)return i.push(this.readSFixed64());var e=hn(this);for(i=i||[];this.pos<e;)i.push(this.readSFixed64());return i},skip:function(i){var e=7&i;if(e===Lt.Varint)for(;this.buf[this.pos++]>127;);else if(e===Lt.Bytes)this.pos=this.readVarint()+this.pos;else if(e===Lt.Fixed32)this.pos+=4;else{if(e!==Lt.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),ts(this.buf,i,this.pos),this.pos+=4},writeSFixed32:function(i){this.realloc(4),ts(this.buf,i,this.pos),this.pos+=4},writeFixed64:function(i){this.realloc(8),ts(this.buf,-1&i,this.pos),ts(this.buf,Math.floor(i*Bu),this.pos+4),this.pos+=8},writeSFixed64:function(i){this.realloc(8),ts(this.buf,-1&i,this.pos),ts(this.buf,Math.floor(i*Bu),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&&Ou(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(i){this.realloc(4),Ru(this.buf,i,this.pos,!0,23,4),this.pos+=4},writeDouble:function(i){this.realloc(8),Ru(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&&Ou(r,o,this),this.pos=r-1,this.writeVarint(o),this.pos+=o},writeMessage:function(i,e,r){this.writeTag(i,Lt.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(i,e){e.length&&this.writeMessage(i,Dd,e)},writePackedSVarint:function(i,e){e.length&&this.writeMessage(i,Ld,e)},writePackedBoolean:function(i,e){e.length&&this.writeMessage(i,Fd,e)},writePackedFloat:function(i,e){e.length&&this.writeMessage(i,Rd,e)},writePackedDouble:function(i,e){e.length&&this.writeMessage(i,Bd,e)},writePackedFixed32:function(i,e){e.length&&this.writeMessage(i,Od,e)},writePackedSFixed32:function(i,e){e.length&&this.writeMessage(i,$d,e)},writePackedFixed64:function(i,e){e.length&&this.writeMessage(i,Ud,e)},writePackedSFixed64:function(i,e){e.length&&this.writeMessage(i,Vd,e)},writeBytesField:function(i,e){this.writeTag(i,Lt.Bytes),this.writeBytes(e)},writeFixed32Field:function(i,e){this.writeTag(i,Lt.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(i,e){this.writeTag(i,Lt.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(i,e){this.writeTag(i,Lt.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(i,e){this.writeTag(i,Lt.Fixed64),this.writeSFixed64(e)},writeVarintField:function(i,e){this.writeTag(i,Lt.Varint),this.writeVarint(e)},writeSVarintField:function(i,e){this.writeTag(i,Lt.Varint),this.writeSVarint(e)},writeStringField:function(i,e){this.writeTag(i,Lt.Bytes),this.writeString(e)},writeFloatField:function(i,e){this.writeTag(i,Lt.Fixed32),this.writeFloat(e)},writeDoubleField:function(i,e){this.writeTag(i,Lt.Fixed64),this.writeDouble(e)},writeBooleanField:function(i,e){this.writeVarintField(i,Boolean(e))}};class gc{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 Vu{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}=Uu(h),g=new or({width:d||1,height:m||1});for(const x in e){const T=e[x],S=o[x].paddedRect;or.copy(T.data,g,{x:0,y:0},{x:S.x+1,y:S.y+1},T.data)}for(const x in r){const T=r[x],S=c[x].paddedRect,P=S.x+1,k=S.y+1,L=T.data.width,Z=T.data.height;or.copy(T.data,g,{x:0,y:0},{x:P,y:k},T.data),or.copy(T.data,g,{x:0,y:Z-1},{x:P,y:k-1},{width:L,height:1}),or.copy(T.data,g,{x:0,y:0},{x:P,y:k+Z},{width:L,height:1}),or.copy(T.data,g,{x:L-1,y:0},{x:P-1,y:k},{width:1,height:Z}),or.copy(T.data,g,{x:0,y:0},{x:P+L,y:k},{width:1,height:Z})}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 gc(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})}}Oe("ImagePosition",gc),Oe("ImageAtlas",Vu),a.WritingMode=void 0,(Vn=a.WritingMode||(a.WritingMode={}))[Vn.none=0]="none",Vn[Vn.horizontal=1]="horizontal",Vn[Vn.vertical=2]="vertical",Vn[Vn.horizontalOnly=3]="horizontalOnly";const sl=-17;class Ys{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(e,r){const o=new Ys;return o.scale=e||1,o.fontStack=r,o}static forImage(e){const r=new Ys;return r.imageName=e,r}}class is{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(e,r){const o=new is;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&&Ua(c)&&!Js[e[o+1]]||h&&Ua(h)&&!Js[e[o-1]]||!Js[e[o]]?e[o]:Js[e[o]]}return r}(this.text)}trim(){let e=0;for(let o=0;o<this.text.length&&ll[this.text.charCodeAt(o)];o++)e++;let r=this.text.length;for(let o=this.text.length-1;o>=0&&o>=e&&ll[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 is;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(Ys.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 at("Can't add FormattedSection with an empty image.");const o=this.getNextImageSectionCharCode();o?(this.text+=String.fromCharCode(o),this.sections.push(Ys.forImage(r)),this.sectionIndex.push(this.sections.length-1)):at("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function al(i,e,r,o,c,h,d,m,g,x,T,S,P,k,L,Z){const q=is.fromFeature(i,c);let re;S===a.WritingMode.vertical&&q.verticalizePunctuation();const{processBidirectionalText:ce,processStyledBidirectionalText:ee}=Ji;if(ce&&q.sections.length===1){re=[];const ye=ce(q.toString(),_c(q,x,h,e,o,k,L));for(const Fe of ye){const Ne=new is;Ne.text=Fe,Ne.sections=q.sections;for(let ke=0;ke<Fe.length;ke++)Ne.sectionIndex.push(0);re.push(Ne)}}else if(ee){re=[];const ye=ee(q.text,q.sectionIndex,_c(q,x,h,e,o,k,L));for(const Fe of ye){const Ne=new is;Ne.text=Fe[0],Ne.sectionIndex=Fe[1],Ne.sections=q.sections,re.push(Ne)}}else re=function(ye,Fe){const Ne=[],ke=ye.text;let Ae=0;for(const Ee of Fe)Ne.push(ye.substring(Ae,Ee)),Ae=Ee;return Ae<ke.length&&Ne.push(ye.substring(Ae,ke.length)),Ne}(q,_c(q,x,h,e,o,k,L));const ae=[],xe={positionedLines:ae,text:q.toString(),top:T[1],bottom:T[1],left:T[0],right:T[0],writingMode:S,iconsInText:!1,verticalizable:!1};return function(ye,Fe,Ne,ke,Ae,Ee,De,Pe,we,He,je,pt){let Ot=0,qt=sl,ni=0,ar=0;const yi=Pe==="right"?1:Pe==="left"?0:.5;let Qt=0;for(const ei of Ae){ei.trim();const vi=ei.getMaxScale(),Si=(vi-1)*gi,Li={positionedGlyphs:[],lineOffset:0};ye.positionedLines[Qt]=Li;const qi=Li.positionedGlyphs;let Zi=0;if(!ei.length()){qt+=Ee,++Qt;continue}for(let hi=0;hi<ei.length();hi++){const ft=ei.getSection(hi),er=ei.getSectionIndex(hi),bi=ei.getCharCode(hi);let Ii=0,xr=null,Pr=null,zr=null,dn=gi;const vr=!(we===a.WritingMode.horizontal||!je&&!zs(bi)||je&&(ll[bi]||(ui=bi,ze.Arabic(ui)||ze["Arabic Supplement"](ui)||ze["Arabic Extended-A"](ui)||ze["Arabic Presentation Forms-A"](ui)||ze["Arabic Presentation Forms-B"](ui))));if(ft.imageName){const lr=ke[ft.imageName];if(!lr)continue;zr=ft.imageName,ye.iconsInText=ye.iconsInText||!0,Pr=lr.paddedRect;const ji=lr.displaySize;ft.scale=ft.scale*gi/pt,xr={width:ji[0],height:ji[1],left:1,top:-3,advance:vr?ji[1]:ji[0]},Ii=Si+(gi-ji[1]*ft.scale),dn=xr.advance;const fn=vr?ji[0]*ft.scale-gi*vi:ji[1]*ft.scale-gi*vi;fn>0&&fn>Zi&&(Zi=fn)}else{const lr=Ne[ft.fontStack],ji=lr&&lr[bi];if(ji&&ji.rect)Pr=ji.rect,xr=ji.metrics;else{const fn=Fe[ft.fontStack],ta=fn&&fn[bi];if(!ta)continue;xr=ta.metrics}Ii=(vi-ft.scale)*gi}vr?(ye.verticalizable=!0,qi.push({glyph:bi,imageName:zr,x:Ot,y:qt+Ii,vertical:vr,scale:ft.scale,fontStack:ft.fontStack,sectionIndex:er,metrics:xr,rect:Pr}),Ot+=dn*ft.scale+He):(qi.push({glyph:bi,imageName:zr,x:Ot,y:qt+Ii,vertical:vr,scale:ft.scale,fontStack:ft.fontStack,sectionIndex:er,metrics:xr,rect:Pr}),Ot+=xr.advance*ft.scale+He)}qi.length!==0&&(ni=Math.max(Ot-He,ni),Xd(qi,0,qi.length-1,yi,Zi)),Ot=0;const jt=Ee*vi+Zi;Li.lineOffset=Math.max(Zi,Si),qt+=jt,ar=Math.max(jt,ar),++Qt}var ui;const xi=qt-sl,{horizontalAlign:Ei,verticalAlign:Gi}=yc(De);(function(ei,vi,Si,Li,qi,Zi,jt,hi,ft){const er=(vi-Si)*qi;let bi=0;bi=Zi!==jt?-hi*Li-sl:(-Li*ft+.5)*jt;for(const Ii of ei)for(const xr of Ii.positionedGlyphs)xr.x+=er,xr.y+=bi})(ye.positionedLines,yi,Ei,Gi,ni,ar,Ee,xi,Ae.length),ye.top+=-Gi*xi,ye.bottom=ye.top+xi,ye.left+=-Ei*ni,ye.right=ye.left+ni}(xe,e,r,o,re,d,m,g,S,x,P,Z),!function(ye){for(const Fe of ye)if(Fe.positionedGlyphs.length!==0)return!1;return!0}(ae)&&xe}const ll={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Zd={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 Nu(i,e,r,o,c,h){if(e.imageName){const d=o[e.imageName];return d?d.displaySize[0]*e.scale*gi/h+c:0}{const d=r[e.fontStack],m=d&&d[i];return m?m.metrics.advance*e.scale+c:0}}function Gu(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 jd(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 qu(i,e,r,o,c,h){let d=null,m=Gu(e,r,c,h);for(const g of o){const x=Gu(e-g.x,r,c,h)+g.badness;x<=m&&(d=g,m=x)}return{index:i,x:e,priorBreak:d,badness:m}}function Zu(i){return i?Zu(i.priorBreak).concat(i.index):[]}function _c(i,e,r,o,c,h,d){if(h!=="point")return[];if(!i)return[];const m=[],g=function(P,k,L,Z,q,re){let ce=0;for(let ee=0;ee<P.length();ee++){const ae=P.getSection(ee);ce+=Nu(P.getCharCode(ee),ae,Z,q,k,re)}return ce/Math.max(1,Math.ceil(ce/L))}(i,e,r,o,c,d),x=i.text.indexOf("\u200B")>=0;let T=0;for(let P=0;P<i.length();P++){const k=i.getSection(P),L=i.getCharCode(P);if(ll[L]||(T+=Nu(L,k,o,c,e,d)),P<i.length()-1){const Z=!((S=L)<11904||!(ze["Bopomofo Extended"](S)||ze.Bopomofo(S)||ze["CJK Compatibility Forms"](S)||ze["CJK Compatibility Ideographs"](S)||ze["CJK Compatibility"](S)||ze["CJK Radicals Supplement"](S)||ze["CJK Strokes"](S)||ze["CJK Symbols and Punctuation"](S)||ze["CJK Unified Ideographs Extension A"](S)||ze["CJK Unified Ideographs"](S)||ze["Enclosed CJK Letters and Months"](S)||ze["Halfwidth and Fullwidth Forms"](S)||ze.Hiragana(S)||ze["Ideographic Description Characters"](S)||ze["Kangxi Radicals"](S)||ze["Katakana Phonetic Extensions"](S)||ze.Katakana(S)||ze["Vertical Forms"](S)||ze["Yi Radicals"](S)||ze["Yi Syllables"](S)));(Zd[L]||Z||k.imageName)&&m.push(qu(P+1,T,g,m,jd(L,i.getCharCode(P+1),Z&&x),!1))}}var S;return Zu(qu(i.length(),T,g,m,0,!0))}function yc(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 Xd(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 Wd(i,e,r){const{horizontalAlign:o,verticalAlign:c}=yc(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 ju(i,e,r,o,c,h){const d=i.image;let m;if(d.content){const q=d.content,re=d.pixelRatio||1;m=[q[0]/re,q[1]/re,d.displaySize[0]-q[2]/re,d.displaySize[1]-q[3]/re]}const g=e.left*h,x=e.right*h;let T,S,P,k;r==="width"||r==="both"?(k=c[0]+g-o[3],S=c[0]+x+o[1]):(k=c[0]+(g+x-d.displaySize[0])/2,S=k+d.displaySize[0]);const L=e.top*h,Z=e.bottom*h;return r==="height"||r==="both"?(T=c[1]+L-o[0],P=c[1]+Z+o[2]):(T=c[1]+(L+Z-d.displaySize[1])/2,P=T+d.displaySize[1]),{image:d,top:T,right:S,bottom:P,left:k,collisionPadding:m}}const pn=128;function Xu(i,e){const{expression:r}=e;if(r.kind==="constant")return{kind:"constant",layoutSize:r.evaluate(new Nt(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 Nt(m)),maxSize:r.evaluate(new Nt(g)),interpolationType:c}}}class Nn extends Xe{constructor(e,r,o,c){super(e,r),this.angle=o,c!==void 0&&(this.segment=c)}clone(){return new Nn(this.x,this.y,this.angle,this.segment)}}function Wu(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 T=i[d],S=i[d+1];if(!S)return!1;let P=i[d-1].angleTo(T)-T.angleTo(S);for(P=Math.abs((P+3*Math.PI)%(2*Math.PI)-Math.PI),g.push({distance:m,angleDelta:P}),x+=P;m-g[0].distance>o;)x-=g.shift().angleDelta;if(x>c)return!1;d++,m+=T.dist(S)}return!0}function Hu(i){let e=0;for(let r=0;r<i.length-1;r++)e+=i[r].dist(i[r+1]);return e}function Ku(i,e,r){return i?.6*e*r:0}function Ju(i,e){return Math.max(i?i.right-i.left:0,e?e.right-e.left:0)}function Hd(i,e,r,o,c,h){const d=Ku(r,c,h),m=Ju(r,o)*h;let g=0;const x=Hu(i)/2;for(let T=0;T<i.length-1;T++){const S=i[T],P=i[T+1],k=S.dist(P);if(g+k>x){const L=(x-g)/k,Z=Ut(S.x,P.x,L),q=Ut(S.y,P.y,L),re=new Nn(Z,q,P.angleTo(S),T);return re._round(),!d||Wu(i,re,m,d,e)?re:void 0}g+=k}}function Kd(i,e,r,o,c,h,d,m,g){const x=Ku(o,h,d),T=Ju(o,c),S=T*d,P=i[0].x===0||i[0].x===g||i[0].y===0||i[0].y===g;return e-S<e/4&&(e=S+e/4),Yu(i,P?e/2*m%e:(T/2+2*h)*d*m%e,e,x,r,S,P,!1,g)}function Yu(i,e,r,o,c,h,d,m,g){const x=h/2,T=Hu(i);let S=0,P=e-r,k=[];for(let L=0;L<i.length-1;L++){const Z=i[L],q=i[L+1],re=Z.dist(q),ce=q.angleTo(Z);for(;P+r<S+re;){P+=r;const ee=(P-S)/re,ae=Ut(Z.x,q.x,ee),xe=Ut(Z.y,q.y,ee);if(ae>=0&&ae<g&&xe>=0&&xe<g&&P-x>=0&&P+x<=T){const ye=new Nn(ae,xe,ce,L);ye._round(),o&&!Wu(i,ye,h,o,c)||k.push(ye)}}S+=re}return m||k.length||d||(k=Yu(i,S/2,r,o,c,h,d,!0,g)),k}function Qu(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 T=m[x],S=m[x+1];T.x<e&&S.x<e||(T.x<e?T=new Xe(e,T.y+(e-T.x)/(S.x-T.x)*(S.y-T.y))._round():S.x<e&&(S=new Xe(e,T.y+(e-T.x)/(S.x-T.x)*(S.y-T.y))._round()),T.y<r&&S.y<r||(T.y<r?T=new Xe(T.x+(r-T.y)/(S.y-T.y)*(S.x-T.x),r)._round():S.y<r&&(S=new Xe(T.x+(r-T.y)/(S.y-T.y)*(S.x-T.x),r)._round()),T.x>=o&&S.x>=o||(T.x>=o?T=new Xe(o,T.y+(o-T.x)/(S.x-T.x)*(S.y-T.y))._round():S.x>=o&&(S=new Xe(o,T.y+(o-T.x)/(S.x-T.x)*(S.y-T.y))._round()),T.y>=c&&S.y>=c||(T.y>=c?T=new Xe(T.x+(c-T.y)/(S.y-T.y)*(S.x-T.x),c)._round():S.y>=c&&(S=new Xe(T.x+(c-T.y)/(S.y-T.y)*(S.x-T.x),c)._round()),g&&T.equals(g[g.length-1])||(g=[T],h.push(g)),g.push(S)))))}}return h}function eh(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,T=i.bottom-i.top,S=h.stretchX||[[0,m]],P=h.stretchY||[[0,g]],k=(Ee,De)=>Ee+De[1]-De[0],L=S.reduce(k,0),Z=P.reduce(k,0),q=m-L,re=g-Z;let ce=0,ee=L,ae=0,xe=Z,ye=0,Fe=q,Ne=0,ke=re;if(h.content&&o){const Ee=h.content;ce=cl(S,0,Ee[0]),ae=cl(P,0,Ee[1]),ee=cl(S,Ee[0],Ee[2]),xe=cl(P,Ee[1],Ee[3]),ye=Ee[0]-ce,Ne=Ee[1]-ae,Fe=Ee[2]-Ee[0]-ee,ke=Ee[3]-Ee[1]-xe}const Ae=(Ee,De,Pe,we)=>{const He=ul(Ee.stretch-ce,ee,x,i.left),je=hl(Ee.fixed-ye,Fe,Ee.stretch,L),pt=ul(De.stretch-ae,xe,T,i.top),Ot=hl(De.fixed-Ne,ke,De.stretch,Z),qt=ul(Pe.stretch-ce,ee,x,i.left),ni=hl(Pe.fixed-ye,Fe,Pe.stretch,L),ar=ul(we.stretch-ae,xe,T,i.top),yi=hl(we.fixed-Ne,ke,we.stretch,Z),Qt=new Xe(He,pt),ui=new Xe(qt,pt),xi=new Xe(qt,ar),Ei=new Xe(He,ar),Gi=new Xe(je/d,Ot/d),ei=new Xe(ni/d,yi/d),vi=e*Math.PI/180;if(vi){const qi=Math.sin(vi),Zi=Math.cos(vi),jt=[Zi,-qi,qi,Zi];Qt._matMult(jt),ui._matMult(jt),Ei._matMult(jt),xi._matMult(jt)}const Si=Ee.stretch+Ee.fixed,Li=De.stretch+De.fixed;return{tl:Qt,tr:ui,bl:Ei,br:xi,tex:{x:h.paddedRect.x+1+Si,y:h.paddedRect.y+1+Li,w:Pe.stretch+Pe.fixed-Si,h:we.stretch+we.fixed-Li},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Gi,pixelOffsetBR:ei,minFontScaleX:Fe/d/x,minFontScaleY:ke/d/T,isSDF:r}};if(o&&(h.stretchX||h.stretchY)){const Ee=th(S,q,L),De=th(P,re,Z);for(let Pe=0;Pe<Ee.length-1;Pe++){const we=Ee[Pe],He=Ee[Pe+1];for(let je=0;je<De.length-1;je++)c.push(Ae(we,De[je],He,De[je+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 cl(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 th(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 ul(i,e,r,o){return i/e*r+o}function hl(i,e,r,o){return i-e*r/o}Oe("Anchor",Nn);class pl{constructor(e,r,o,c,h,d,m,g,x,T){if(this.boxStartIndex=e.length,x){let S=d.top,P=d.bottom;const k=d.collisionPadding;k&&(S-=k[1],P+=k[3]);let L=P-S;L>0&&(L=Math.max(10,L),this.circleDiameter=L)}else{let S=d.top*m-g[0],P=d.bottom*m+g[2],k=d.left*m-g[3],L=d.right*m+g[1];const Z=d.collisionPadding;if(Z&&(k-=Z[0]*m,S-=Z[1]*m,L+=Z[2]*m,P+=Z[3]*m),T){const q=new Xe(k,S),re=new Xe(L,S),ce=new Xe(k,P),ee=new Xe(L,P),ae=T*Math.PI/180;q._rotate(ae),re._rotate(ae),ce._rotate(ae),ee._rotate(ae),k=Math.min(q.x,re.x,ce.x,ee.x),L=Math.max(q.x,re.x,ce.x,ee.x),S=Math.min(q.y,re.y,ce.y,ee.y),P=Math.max(q.y,re.y,ce.y,ee.y)}e.emplaceBack(r.x,r.y,k,S,L,P,o,c,h)}this.boxEndIndex=e.length}}class Jd{constructor(e=[],r=Yd){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 Yd(i,e){return i<e?-1:i>e?1:0}function Qd(i,e=1,r=!1){let o=1/0,c=1/0,h=-1/0,d=-1/0;const m=i[0];for(let k=0;k<m.length;k++){const L=m[k];(!k||L.x<o)&&(o=L.x),(!k||L.y<c)&&(c=L.y),(!k||L.x>h)&&(h=L.x),(!k||L.y>d)&&(d=L.y)}const g=Math.min(h-o,d-c);let x=g/2;const T=new Jd([],ef);if(g===0)return new Xe(o,c);for(let k=o;k<h;k+=g)for(let L=c;L<d;L+=g)T.push(new rs(k+x,L+x,x,i));let S=function(k){let L=0,Z=0,q=0;const re=k[0];for(let ce=0,ee=re.length,ae=ee-1;ce<ee;ae=ce++){const xe=re[ce],ye=re[ae],Fe=xe.x*ye.y-ye.x*xe.y;Z+=(xe.x+ye.x)*Fe,q+=(xe.y+ye.y)*Fe,L+=3*Fe}return new rs(Z/L,q/L,0,k)}(i),P=T.length;for(;T.length;){const k=T.pop();(k.d>S.d||!S.d)&&(S=k,r&&console.log("found best %d after %d probes",Math.round(1e4*k.d)/1e4,P)),k.max-S.d<=e||(x=k.h/2,T.push(new rs(k.p.x-x,k.p.y-x,x,i)),T.push(new rs(k.p.x+x,k.p.y-x,x,i)),T.push(new rs(k.p.x-x,k.p.y+x,x,i)),T.push(new rs(k.p.x+x,k.p.y+x,x,i)),P+=4)}return r&&(console.log(`num probes: ${P}`),console.log(`best distance: ${S.d}`)),S.p}function ef(i,e){return e.max-i.max}function rs(i,e,r,o){this.p=new Xe(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 T=0,S=x.length,P=S-1;T<S;P=T++){const k=x[T],L=x[P];k.y>c.y!=L.y>c.y&&c.x<(L.x-k.x)*(c.y-k.y)/(L.y-k.y)+k.x&&(d=!d),m=Math.min(m,cu(c,k,L))}}return(d?1:-1)*Math.sqrt(m)}(this.p,o),this.max=this.d+this.h*Math.SQRT2}const xc=Number.POSITIVE_INFINITY;function ih(i,e){return e[1]!==xc?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 vc(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 tf(i,e,r,o,c,h,d,m,g,x,T){let S=h.textMaxSize.evaluate(e,{});S===void 0&&(S=d);const P=i.layers[0].layout,k=P.get("icon-offset").evaluate(e,{},T),L=nh(r.horizontal),Z=d/24,q=i.tilePixelRatio*Z,re=i.tilePixelRatio*S/24,ce=i.tilePixelRatio*m,ee=i.tilePixelRatio*P.get("symbol-spacing"),ae=P.get("text-padding")*i.tilePixelRatio,xe=function(we,He,je,pt=1){const Ot=we.get("icon-padding").evaluate(He,{},je),qt=Ot&&Ot.values;return[qt[0]*pt,qt[1]*pt,qt[2]*pt,qt[3]*pt]}(P,e,T,i.tilePixelRatio),ye=P.get("text-max-angle")/180*Math.PI,Fe=P.get("text-rotation-alignment")!=="viewport"&&P.get("symbol-placement")!=="point",Ne=P.get("icon-rotation-alignment")==="map"&&P.get("symbol-placement")!=="point",ke=P.get("symbol-placement"),Ae=ee/2,Ee=P.get("icon-text-fit");let De;o&&Ee!=="none"&&(i.allowVerticalPlacement&&r.vertical&&(De=ju(o,r.vertical,Ee,P.get("icon-text-fit-padding"),k,Z)),L&&(o=ju(o,L,Ee,P.get("icon-text-fit-padding"),k,Z)));const Pe=(we,He)=>{He.x<0||He.x>=ri||He.y<0||He.y>=ri||function(je,pt,Ot,qt,ni,ar,yi,Qt,ui,xi,Ei,Gi,ei,vi,Si,Li,qi,Zi,jt,hi,ft,er,bi,Ii,xr){const Pr=je.addToLineVertexArray(pt,Ot);let zr,dn,vr,lr,ji=0,fn=0,ta=0,vh=0,Pc=-1,zc=-1;const mn={};let bh=ci.exports(""),kc=0,Dc=0;if(Qt._unevaluatedLayout.getValue("text-radial-offset")===void 0?[kc,Dc]=Qt.layout.get("text-offset").evaluate(ft,{},Ii).map(Xi=>Xi*gi):(kc=Qt.layout.get("text-radial-offset").evaluate(ft,{},Ii)*gi,Dc=xc),je.allowVerticalPlacement&&qt.vertical){const Xi=Qt.layout.get("text-rotate").evaluate(ft,{},Ii)+90;vr=new pl(ui,pt,xi,Ei,Gi,qt.vertical,ei,vi,Si,Xi),yi&&(lr=new pl(ui,pt,xi,Ei,Gi,yi,qi,Zi,Si,Xi))}if(ni){const Xi=Qt.layout.get("icon-rotate").evaluate(ft,{}),Hr=Qt.layout.get("icon-text-fit")!=="none",ia=eh(ni,Xi,bi,Hr),ra=yi?eh(yi,Xi,bi,Hr):void 0;dn=new pl(ui,pt,xi,Ei,Gi,ni,qi,Zi,!1,Xi),ji=4*ia.length;const Eh=je.iconSizeData;let So=null;Eh.kind==="source"?(So=[pn*Qt.layout.get("icon-size").evaluate(ft,{})],So[0]>Gn&&at(`${je.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)):Eh.kind==="composite"&&(So=[pn*er.compositeIconSizes[0].evaluate(ft,{},Ii),pn*er.compositeIconSizes[1].evaluate(ft,{},Ii)],(So[0]>Gn||So[1]>Gn)&&at(`${je.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),je.addSymbols(je.icon,ia,So,hi,jt,ft,a.WritingMode.none,pt,Pr.lineStartIndex,Pr.lineLength,-1,Ii),Pc=je.icon.placedSymbolArray.length-1,ra&&(fn=4*ra.length,je.addSymbols(je.icon,ra,So,hi,jt,ft,a.WritingMode.vertical,pt,Pr.lineStartIndex,Pr.lineLength,-1,Ii),zc=je.icon.placedSymbolArray.length-1)}const wh=Object.keys(qt.horizontal);for(const Xi of wh){const Hr=qt.horizontal[Xi];if(!zr){bh=ci.exports(Hr.text);const ra=Qt.layout.get("text-rotate").evaluate(ft,{},Ii);zr=new pl(ui,pt,xi,Ei,Gi,Hr,ei,vi,Si,ra)}const ia=Hr.positionedLines.length===1;if(ta+=rh(je,pt,Hr,ar,Qt,Si,ft,Li,Pr,qt.vertical?a.WritingMode.horizontal:a.WritingMode.horizontalOnly,ia?wh:[Xi],mn,Pc,er,Ii),ia)break}qt.vertical&&(vh+=rh(je,pt,qt.vertical,ar,Qt,Si,ft,Li,Pr,a.WritingMode.vertical,["vertical"],mn,zc,er,Ii));const mf=zr?zr.boxStartIndex:je.collisionBoxArray.length,gf=zr?zr.boxEndIndex:je.collisionBoxArray.length,_f=vr?vr.boxStartIndex:je.collisionBoxArray.length,yf=vr?vr.boxEndIndex:je.collisionBoxArray.length,xf=dn?dn.boxStartIndex:je.collisionBoxArray.length,vf=dn?dn.boxEndIndex:je.collisionBoxArray.length,bf=lr?lr.boxStartIndex:je.collisionBoxArray.length,wf=lr?lr.boxEndIndex:je.collisionBoxArray.length;let kr=-1;const _l=(Xi,Hr)=>Xi&&Xi.circleDiameter?Math.max(Xi.circleDiameter,Hr):Hr;kr=_l(zr,kr),kr=_l(vr,kr),kr=_l(dn,kr),kr=_l(lr,kr);const Th=kr>-1?1:0;Th&&(kr*=xr/gi),je.glyphOffsetArray.length>=ns.MAX_GLYPHS&&at("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),ft.sortKey!==void 0&&je.addToSortKeyRanges(je.symbolInstances.length,ft.sortKey),je.symbolInstances.emplaceBack(pt.x,pt.y,mn.right>=0?mn.right:-1,mn.center>=0?mn.center:-1,mn.left>=0?mn.left:-1,mn.vertical||-1,Pc,zc,bh,mf,gf,_f,yf,xf,vf,bf,wf,xi,ta,vh,ji,fn,Th,0,ei,kc,Dc,kr)}(i,He,we,r,o,c,De,i.layers[0],i.collisionBoxArray,e.index,e.sourceLayerIndex,i.index,q,[ae,ae,ae,ae],Fe,g,ce,xe,Ne,k,e,h,x,T,d)};if(ke==="line")for(const we of Qu(e.geometry,0,0,ri,ri)){const He=Kd(we,ee,ye,r.vertical||L,o,24,re,i.overscaling,ri);for(const je of He){const pt=L;pt&&rf(i,pt.text,Ae,je)||Pe(we,je)}}else if(ke==="line-center"){for(const we of e.geometry)if(we.length>1){const He=Hd(we,ye,r.vertical||L,o,24,re);He&&Pe(we,He)}}else if(e.type==="Polygon")for(const we of ac(e.geometry,0)){const He=Qd(we,16);Pe(we[0],new Nn(He.x,He.y,0))}else if(e.type==="LineString")for(const we of e.geometry)Pe(we,new Nn(we[0].x,we[0].y,0));else if(e.type==="Point")for(const we of e.geometry)for(const He of we)Pe([He],new Nn(He.x,He.y,0))}const Gn=32640;function rh(i,e,r,o,c,h,d,m,g,x,T,S,P,k,L){const Z=function(ce,ee,ae,xe,ye,Fe,Ne,ke){const Ae=xe.layout.get("text-rotate").evaluate(Fe,{})*Math.PI/180,Ee=[];for(const De of ee.positionedLines)for(const Pe of De.positionedGlyphs){if(!Pe.rect)continue;const we=Pe.rect||{};let He=4,je=!0,pt=1,Ot=0;const qt=(ye||ke)&&Pe.vertical,ni=Pe.metrics.advance*Pe.scale/2;if(ke&&ee.verticalizable){const jt=(Pe.scale-1)*gi,hi=(gi-Pe.metrics.width*Pe.scale)/2;Ot=De.lineOffset/2-(Pe.imageName?-hi:jt)}if(Pe.imageName){const jt=Ne[Pe.imageName];je=jt.sdf,pt=jt.pixelRatio,He=1/pt}const ar=ye?[Pe.x+ni,Pe.y]:[0,0];let yi=ye?[0,0]:[Pe.x+ni+ae[0],Pe.y+ae[1]-Ot],Qt=[0,0];qt&&(Qt=yi,yi=[0,0]);const ui=(Pe.metrics.left-He)*Pe.scale-ni+yi[0],xi=(-Pe.metrics.top-He)*Pe.scale+yi[1],Ei=ui+we.w*Pe.scale/pt,Gi=xi+we.h*Pe.scale/pt,ei=new Xe(ui,xi),vi=new Xe(Ei,xi),Si=new Xe(ui,Gi),Li=new Xe(Ei,Gi);if(qt){const jt=new Xe(-ni,ni-sl),hi=-Math.PI/2,ft=12-ni,er=new Xe(22-ft,-(Pe.imageName?ft:0)),bi=new Xe(...Qt);ei._rotateAround(hi,jt)._add(er)._add(bi),vi._rotateAround(hi,jt)._add(er)._add(bi),Si._rotateAround(hi,jt)._add(er)._add(bi),Li._rotateAround(hi,jt)._add(er)._add(bi)}if(Ae){const jt=Math.sin(Ae),hi=Math.cos(Ae),ft=[hi,-jt,jt,hi];ei._matMult(ft),vi._matMult(ft),Si._matMult(ft),Li._matMult(ft)}const qi=new Xe(0,0),Zi=new Xe(0,0);Ee.push({tl:ei,tr:vi,bl:Si,br:Li,tex:we,writingMode:ee.writingMode,glyphOffset:ar,sectionIndex:Pe.sectionIndex,isSDF:je,pixelOffsetTL:qi,pixelOffsetBR:Zi,minFontScaleX:0,minFontScaleY:0})}return Ee}(0,r,m,c,h,d,o,i.allowVerticalPlacement),q=i.textSizeData;let re=null;q.kind==="source"?(re=[pn*c.layout.get("text-size").evaluate(d,{})],re[0]>Gn&&at(`${i.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)):q.kind==="composite"&&(re=[pn*k.compositeTextSizes[0].evaluate(d,{},L),pn*k.compositeTextSizes[1].evaluate(d,{},L)],(re[0]>Gn||re[1]>Gn)&&at(`${i.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),i.addSymbols(i.text,Z,re,m,h,d,x,e,g.lineStartIndex,g.lineLength,P,L);for(const ce of T)S[ce]=i.text.placedSymbolArray.length-1;return 4*Z.length}function nh(i){for(const e in i)return i[e];return null}function rf(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 nf=Un.VectorTileFeature.types,of=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function dl(i,e,r,o,c,h,d,m,g,x,T,S,P){const k=m?Math.min(Gn,Math.round(m[0])):0,L=m?Math.min(Gn,Math.round(m[1])):0;i.emplaceBack(e,r,Math.round(32*o),Math.round(32*c),h,d,(k<<1)+(g?1:0),L,16*x,16*T,256*S,256*P)}function bc(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 sf(i){for(const e of i.sections)if(Na(e.text))return!0;return!1}class wc{constructor(e){this.layoutVertexArray=new _r,this.indexArray=new zi,this.programConfigurations=e,this.segments=new dt,this.dynamicLayoutVertexArray=new nr,this.opacityVertexArray=new yr,this.placedSymbolArray=new be}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,Ad.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,r),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,Md.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,of,!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())}}Oe("SymbolBuffers",wc);class Tc{constructor(e,r,o){this.layoutVertexArray=new e,this.layoutAttributes=r,this.indexArray=new o,this.segments=new dt,this.collisionVertexArray=new Yi}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,Pd.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}Oe("CollisionBuffers",Tc);class ns{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=tc([]),this.placementViewportMatrix=tc([]);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=Sc(o,"text-overlap","text-allow-overlap")!=="never"||Sc(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=>a.WritingMode[d])),this.stateDependentLayerIds=this.layers.filter(d=>d.isStateDependent()).map(d=>d.id),this.sourceID=e.sourceID}createArrays(){this.text=new wc(new vo(this.layers,this.zoom,e=>/^text/.test(e))),this.icon=new wc(new vo(this.layers,this.zoom,e=>/^icon/.test(e))),this.glyphOffsetArray=new Ce,this.lineVertexArray=new Be,this.symbolInstances=new Re}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=Js[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 W&&!m.value.value.isEmpty()||m.value.value.toString().length>0)&&(d.value.kind!=="constant"||d.value.value.length>0),T=g.value.kind!=="constant"||!!g.value.value||Object.keys(g.parameters).length>0,S=h.get("symbol-sort-key");if(this.features=[],!x&&!T)return;const P=r.iconDependencies,k=r.glyphDependencies,L=r.availableImages,Z=new Nt(this.zoom);for(const{feature:q,id:re,index:ce,sourceLayerIndex:ee}of e){const ae=c._featureFilter.needGeometry,xe=wo(q,ae);if(!c._featureFilter.filter(Z,xe,o))continue;let ye,Fe;if(ae||(xe.geometry=bo(q)),x){const ke=c.getValueAndResolveTokens("text-field",xe,o,L),Ae=W.factory(ke);sf(Ae)&&(this.hasRTLText=!0),(!this.hasRTLText||_o()==="unavailable"||this.hasRTLText&&Ji.isParsed())&&(ye=kd(Ae,c,xe))}if(T){const ke=c.getValueAndResolveTokens("icon-image",xe,o,L);Fe=ke instanceof J?ke:J.fromString(ke)}if(!ye&&!Fe)continue;const Ne=this.sortFeaturesByKey?S.evaluate(xe,{},o):void 0;if(this.features.push({id:re,text:ye,icon:Fe,index:ce,sourceLayerIndex:ee,geometry:xe.geometry,properties:q.properties,type:nf[q.type],sortKey:Ne}),Fe&&(P[Fe.name]=!0),ye){const ke=d.evaluate(xe,{},o).join(","),Ae=h.get("text-rotation-alignment")!=="viewport"&&h.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(a.WritingMode.vertical)>=0;for(const Ee of ye.sections)if(Ee.image)P[Ee.image.name]=!0;else{const De=jo(ye.toString()),Pe=Ee.fontStack||ke,we=k[Pe]=k[Pe]||{};this.calculateGlyphDependencies(Ee.text,we,Ae,this.allowVerticalPlacement,De)}}}h.get("symbol-placement")==="line"&&(this.features=function(q){const re={},ce={},ee=[];let ae=0;function xe(ke){ee.push(q[ke]),ae++}function ye(ke,Ae,Ee){const De=ce[ke];return delete ce[ke],ce[Ae]=De,ee[De].geometry[0].pop(),ee[De].geometry[0]=ee[De].geometry[0].concat(Ee[0]),De}function Fe(ke,Ae,Ee){const De=re[Ae];return delete re[Ae],re[ke]=De,ee[De].geometry[0].shift(),ee[De].geometry[0]=Ee[0].concat(ee[De].geometry[0]),De}function Ne(ke,Ae,Ee){const De=Ee?Ae[0][Ae[0].length-1]:Ae[0][0];return`${ke}:${De.x}:${De.y}`}for(let ke=0;ke<q.length;ke++){const Ae=q[ke],Ee=Ae.geometry,De=Ae.text?Ae.text.toString():null;if(!De){xe(ke);continue}const Pe=Ne(De,Ee),we=Ne(De,Ee,!0);if(Pe in ce&&we in re&&ce[Pe]!==re[we]){const He=Fe(Pe,we,Ee),je=ye(Pe,we,ee[He].geometry);delete re[Pe],delete ce[we],ce[Ne(De,ee[je].geometry,!0)]=je,ee[He].geometry=null}else Pe in ce?ye(Pe,we,Ee):we in re?Fe(Pe,we,Ee):(xe(ke),re[Pe]=ae-1,ce[we]=ae-1)}return ee.filter(ke=>ke.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((q,re)=>q.sortKey-re.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,T,S,P){const k=e.indexArray,L=e.layoutVertexArray,Z=e.segments.prepareSegment(4*r.length,L,k,this.canOverlap?d.sortKey:void 0),q=this.glyphOffsetArray.length,re=Z.vertexLength,ce=this.allowVerticalPlacement&&m===a.WritingMode.vertical?Math.PI/2:0,ee=d.text&&d.text.sections;for(let ae=0;ae<r.length;ae++){const{tl:xe,tr:ye,bl:Fe,br:Ne,tex:ke,pixelOffsetTL:Ae,pixelOffsetBR:Ee,minFontScaleX:De,minFontScaleY:Pe,glyphOffset:we,isSDF:He,sectionIndex:je}=r[ae],pt=Z.vertexLength,Ot=we[1];dl(L,g.x,g.y,xe.x,Ot+xe.y,ke.x,ke.y,o,He,Ae.x,Ae.y,De,Pe),dl(L,g.x,g.y,ye.x,Ot+ye.y,ke.x+ke.w,ke.y,o,He,Ee.x,Ae.y,De,Pe),dl(L,g.x,g.y,Fe.x,Ot+Fe.y,ke.x,ke.y+ke.h,o,He,Ae.x,Ee.y,De,Pe),dl(L,g.x,g.y,Ne.x,Ot+Ne.y,ke.x+ke.w,ke.y+ke.h,o,He,Ee.x,Ee.y,De,Pe),bc(e.dynamicLayoutVertexArray,g,ce),k.emplaceBack(pt,pt+1,pt+2),k.emplaceBack(pt+1,pt+2,pt+3),Z.vertexLength+=4,Z.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(we[0]),ae!==r.length-1&&je===r[ae+1].sectionIndex||e.programConfigurations.populatePaintArrays(L.length,d,d.index,{},P,ee&&ee[je])}e.placedSymbolArray.emplaceBack(g.x,g.y,q,this.glyphOffsetArray.length-q,re,x,T,g.segment,o?o[0]:0,o?o[1]:0,c[0],c[1],m,0,!1,0,S)}_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,T=h.layoutVertexArray,S=h.collisionVertexArray,P=m.anchorX,k=m.anchorY;this._addCollisionDebugVertex(T,S,d,P,k,new Xe(e,r)),this._addCollisionDebugVertex(T,S,d,P,k,new Xe(o,r)),this._addCollisionDebugVertex(T,S,d,P,k,new Xe(o,c)),this._addCollisionDebugVertex(T,S,d,P,k,new Xe(e,c)),g.vertexLength+=4;const L=h.indexArray;L.emplaceBack(x,x+1),L.emplaceBack(x+1,x+2),L.emplaceBack(x+2,x+3),L.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 Tc(Xr,Du.members,Ar),this.iconCollisionBox=new Tc(Xr,Du.members,Ar);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 T={};for(let S=r;S<o;S++){const P=e.get(S);T.textBox={x1:P.x1,y1:P.y1,x2:P.x2,y2:P.y2,anchorPointX:P.anchorPointX,anchorPointY:P.anchorPointY},T.textFeatureIndex=P.featureIndex;break}for(let S=c;S<h;S++){const P=e.get(S);T.verticalTextBox={x1:P.x1,y1:P.y1,x2:P.x2,y2:P.y2,anchorPointX:P.anchorPointX,anchorPointY:P.anchorPointY},T.verticalTextFeatureIndex=P.featureIndex;break}for(let S=d;S<m;S++){const P=e.get(S);T.iconBox={x1:P.x1,y1:P.y1,x2:P.x2,y2:P.y2,anchorPointX:P.anchorPointX,anchorPointY:P.anchorPointY},T.iconFeatureIndex=P.featureIndex;break}for(let S=g;S<x;S++){const P=e.get(S);T.verticalIconBox={x1:P.x1,y1:P.y1,x2:P.x2,y2:P.y2,anchorPointX:P.anchorPointX,anchorPointY:P.anchorPointY},T.verticalIconFeatureIndex=P.featureIndex;break}return T}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)}}}Oe("SymbolBucket",ns,{omit:["layers","collisionBoxArray","features","compareText"]}),ns.MAX_GLYPHS=65535,ns.addDynamicAttributes=bc;const af=new mi({"symbol-placement":new Ze(_e.layout_symbol["symbol-placement"]),"symbol-spacing":new Ze(_e.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Ze(_e.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Ye(_e.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Ze(_e.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Ze(_e.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Ze(_e.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Ze(_e.layout_symbol["icon-ignore-placement"]),"icon-optional":new Ze(_e.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Ze(_e.layout_symbol["icon-rotation-alignment"]),"icon-size":new Ye(_e.layout_symbol["icon-size"]),"icon-text-fit":new Ze(_e.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Ze(_e.layout_symbol["icon-text-fit-padding"]),"icon-image":new Ye(_e.layout_symbol["icon-image"]),"icon-rotate":new Ye(_e.layout_symbol["icon-rotate"]),"icon-padding":new Ye(_e.layout_symbol["icon-padding"]),"icon-keep-upright":new Ze(_e.layout_symbol["icon-keep-upright"]),"icon-offset":new Ye(_e.layout_symbol["icon-offset"]),"icon-anchor":new Ye(_e.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Ze(_e.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Ze(_e.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Ze(_e.layout_symbol["text-rotation-alignment"]),"text-field":new Ye(_e.layout_symbol["text-field"]),"text-font":new Ye(_e.layout_symbol["text-font"]),"text-size":new Ye(_e.layout_symbol["text-size"]),"text-max-width":new Ye(_e.layout_symbol["text-max-width"]),"text-line-height":new Ze(_e.layout_symbol["text-line-height"]),"text-letter-spacing":new Ye(_e.layout_symbol["text-letter-spacing"]),"text-justify":new Ye(_e.layout_symbol["text-justify"]),"text-radial-offset":new Ye(_e.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Ze(_e.layout_symbol["text-variable-anchor"]),"text-anchor":new Ye(_e.layout_symbol["text-anchor"]),"text-max-angle":new Ze(_e.layout_symbol["text-max-angle"]),"text-writing-mode":new Ze(_e.layout_symbol["text-writing-mode"]),"text-rotate":new Ye(_e.layout_symbol["text-rotate"]),"text-padding":new Ze(_e.layout_symbol["text-padding"]),"text-keep-upright":new Ze(_e.layout_symbol["text-keep-upright"]),"text-transform":new Ye(_e.layout_symbol["text-transform"]),"text-offset":new Ye(_e.layout_symbol["text-offset"]),"text-allow-overlap":new Ze(_e.layout_symbol["text-allow-overlap"]),"text-overlap":new Ze(_e.layout_symbol["text-overlap"]),"text-ignore-placement":new Ze(_e.layout_symbol["text-ignore-placement"]),"text-optional":new Ze(_e.layout_symbol["text-optional"])});var Ec={paint:new mi({"icon-opacity":new Ye(_e.paint_symbol["icon-opacity"]),"icon-color":new Ye(_e.paint_symbol["icon-color"]),"icon-halo-color":new Ye(_e.paint_symbol["icon-halo-color"]),"icon-halo-width":new Ye(_e.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Ye(_e.paint_symbol["icon-halo-blur"]),"icon-translate":new Ze(_e.paint_symbol["icon-translate"]),"icon-translate-anchor":new Ze(_e.paint_symbol["icon-translate-anchor"]),"text-opacity":new Ye(_e.paint_symbol["text-opacity"]),"text-color":new Ye(_e.paint_symbol["text-color"],{runtimeType:fi,getOverride:i=>i.textColor,hasOverride:i=>!!i.textColor}),"text-halo-color":new Ye(_e.paint_symbol["text-halo-color"]),"text-halo-width":new Ye(_e.paint_symbol["text-halo-width"]),"text-halo-blur":new Ye(_e.paint_symbol["text-halo-blur"]),"text-translate":new Ze(_e.paint_symbol["text-translate"]),"text-translate-anchor":new Ze(_e.paint_symbol["text-translate-anchor"])}),layout:af};class oh{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:$r,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}}Oe("FormatSectionOverride",oh,{omit:["defaultValue"]});class fl extends gr{constructor(e){super(e,Ec)}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()||ro(d.value)||!h?h:function(m,g){return g.replace(/{([^{}]+)}/g,(x,T)=>T in m?String(m[T]):"")}(r.properties,h)}createBucket(e){return new ns(e)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const e of Ec.paint.overridableProperties){if(!fl.hasPaintOverride(this.layout,e))continue;const r=this.paint.get(e),o=new oh(r),c=new Uo(o,r.property.specification);let h=null;h=r.value.kind==="constant"||r.value.kind==="source"?new oo("source",c):new Ss("composite",c,r.value.zoomStops),this.paint._values[e]=new mr(r.property,h,r.parameters)}}_handleOverridablePaintPropertyUpdate(e,r,o){return!(!this.layout||r.isDataDriven()||o.isDataDriven())&&fl.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,r){const o=e.get("text-field"),c=Ec.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 W)d(o.value.value.sections);else if(o.value.kind==="source"){const m=x=>{h||(x instanceof qe&&he(x.value)===oi?d(x.value.sections):x instanceof Oo?d(x.sections):x.eachChild(m))},g=o.value;g._styleExpression&&m(g._styleExpression.expression)}return h}}function Sc(i,e,r){let o="never";const c=i.get(e);return c?o=c:i.get(r)&&(o="always"),o}var lf={paint:new mi({"background-color":new Ze(_e.paint_background["background-color"]),"background-pattern":new Fs(_e.paint_background["background-pattern"]),"background-opacity":new Ze(_e.paint_background["background-opacity"])})},cf={paint:new mi({"raster-opacity":new Ze(_e.paint_raster["raster-opacity"]),"raster-hue-rotate":new Ze(_e.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Ze(_e.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Ze(_e.paint_raster["raster-brightness-max"]),"raster-saturation":new Ze(_e.paint_raster["raster-saturation"]),"raster-contrast":new Ze(_e.paint_raster["raster-contrast"]),"raster-resampling":new Ze(_e.paint_raster["raster-resampling"]),"raster-fade-duration":new Ze(_e.paint_raster["raster-fade-duration"])})};class uf extends gr{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 hf={circle:class extends gr{constructor(i){super(i,Vp)}createBucket(i){return new Yl(i)}queryRadius(i){const e=i;return Ns("circle-radius",this,e)+Ns("circle-stroke-width",this,e)+Ja(this.paint.get("circle-translate"))}queryIntersectsFeature(i,e,r,o,c,h,d,m){const g=Ya(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),T=this.paint.get("circle-pitch-alignment")==="map",S=T?g:function(k,L){return k.map(Z=>gu(Z,L))}(g,m),P=T?x*d:x;for(const k of o)for(const L of k){const Z=T?L:gu(L,m);let q=P;const re=Qa([],[L.x,L.y,0,1],m);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?q*=re[3]/h.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(q*=h.cameraToCenterDistance/re[3]),Bp(S,Z,q))return!0}return!1}},heatmap:class extends gr{constructor(i){super(i,Gp),this._updateColorRamp()}createBucket(i){return new _u(i)}_handleSpecialPaintPropertyUpdate(i){i==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=xu({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 gr{constructor(i){super(i,qp)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}},fill:class extends gr{constructor(i){super(i,sd)}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 uc(i)}queryRadius(){return Ja(this.paint.get("fill-translate"))}queryIntersectsFeature(i,e,r,o,c,h,d){return lu(Ya(i,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),h.angle,d),o)}isTileClipped(){return!0}},"fill-extrusion":class extends gr{constructor(i){super(i,vd)}createBucket(i){return new pc(i)}queryRadius(){return Ja(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(i,e,r,o,c,h,d,m){const g=Ya(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),T=this.paint.get("fill-extrusion-base").evaluate(e,r),S=function(k,L,Z,q){const re=[];for(const ce of k){const ee=[ce.x,ce.y,0,1];Qa(ee,ee,L),re.push(new Xe(ee[0]/ee[3],ee[1]/ee[3]))}return re}(g,m),P=function(k,L,Z,q){const re=[],ce=[],ee=q[8]*L,ae=q[9]*L,xe=q[10]*L,ye=q[11]*L,Fe=q[8]*Z,Ne=q[9]*Z,ke=q[10]*Z,Ae=q[11]*Z;for(const Ee of k){const De=[],Pe=[];for(const we of Ee){const He=we.x,je=we.y,pt=q[0]*He+q[4]*je+q[12],Ot=q[1]*He+q[5]*je+q[13],qt=q[2]*He+q[6]*je+q[14],ni=q[3]*He+q[7]*je+q[15],ar=qt+xe,yi=ni+ye,Qt=pt+Fe,ui=Ot+Ne,xi=qt+ke,Ei=ni+Ae,Gi=new Xe((pt+ee)/yi,(Ot+ae)/yi);Gi.z=ar/yi,De.push(Gi);const ei=new Xe(Qt/Ei,ui/Ei);ei.z=xi/Ei,Pe.push(ei)}re.push(De),ce.push(Pe)}return[re,ce]}(o,T,x,m);return function(k,L,Z){let q=1/0;lu(Z,L)&&(q=Au(Z,L[0]));for(let re=0;re<L.length;re++){const ce=L[re],ee=k[re];for(let ae=0;ae<ce.length-1;ae++){const xe=ce[ae],ye=[xe,ce[ae+1],ee[ae+1],ee[ae],xe];au(Z,ye)&&(q=Math.min(q,Au(Z,ye)))}}return q!==1/0&&q}(P[0],P[1],S)}},line:class extends gr{constructor(i){super(i,Pu),this.gradientVersion=0}_handleSpecialPaintPropertyUpdate(i){i==="line-gradient"&&(this.stepInterpolant=this._transitionablePaint._values["line-gradient"].value.expression._styleExpression.expression instanceof Yn,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"]=zu.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,i)}createBucket(i){return new dc(i)}queryRadius(i){const e=i,r=ku(Ns("line-width",this,e),Ns("line-gap-width",this,e)),o=Ns("line-offset",this,e);return r/2+Math.abs(o)+Ja(this.paint.get("line-translate"))}queryIntersectsFeature(i,e,r,o,c,h,d){const m=Ya(i,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),h.angle,d),g=d/2*ku(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(T,S){const P=[];for(let k=0;k<T.length;k++){const L=T[k],Z=[];for(let q=0;q<L.length;q++){const re=L[q-1],ce=L[q],ee=L[q+1],ae=q===0?new Xe(0,0):ce.sub(re)._unit()._perp(),xe=q===L.length-1?new Xe(0,0):ee.sub(ce)._unit()._perp(),ye=ae._add(xe)._unit(),Fe=ye.x*xe.x+ye.y*xe.y;Fe!==0&&ye._mult(1/Fe),Z.push(ye._mult(S)._add(ce))}P.push(Z)}return P}(o,x*d)),function(T,S,P){for(let k=0;k<S.length;k++){const L=S[k];if(T.length>=3){for(let Z=0;Z<L.length;Z++)if(Jo(T,L[Z]))return!0}if(Fp(T,L,P))return!0}return!1}(m,o,g)}isTileClipped(){return!0}},symbol:fl,background:class extends gr{constructor(i){super(i,lf)}},raster:class extends gr{constructor(i){super(i,cf)}}};class pf{constructor(e){this._callback=e,this._triggered=!1,typeof MessageChannel!="undefined"&&(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 sh=63710088e-1;class Wt{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 Wt(Ge(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 sh*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 Eo(new Wt(this.lng-o,this.lat-r),new Wt(this.lng+o,this.lat+r))}static convert(e){if(e instanceof Wt)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new Wt(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e!==null)return new Wt(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 Eo{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 Wt?new Wt(e.lng,e.lat):Wt.convert(e),this}setSouthWest(e){return this._sw=e instanceof Wt?new Wt(e.lng,e.lat):Wt.convert(e),this}extend(e){const r=this._sw,o=this._ne;let c,h;if(e instanceof Wt)c=e,h=e;else{if(!(e instanceof Eo))return Array.isArray(e)?e.length===4||e.every(Array.isArray)?this.extend(Eo.convert(e)):this.extend(Wt.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 Wt(c.lng,c.lat),this._ne=new Wt(h.lng,h.lat)),this}getCenter(){return new Wt((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 Wt(this.getWest(),this.getNorth())}getSouthEast(){return new Wt(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}=Wt.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 Eo?e:e&&new Eo(e)}}const ah=2*Math.PI*sh;function lh(i){return ah*Math.cos(i*Math.PI/180)}function ch(i){return(180+i)/360}function uh(i){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i*Math.PI/360)))/360}function hh(i,e){return i/lh(e)}function Ic(i){return 360/Math.PI*Math.atan(Math.exp((180-360*i)*Math.PI/180))-90}class ml{constructor(e,r,o=0){this.x=+e,this.y=+r,this.z=+o}static fromLngLat(e,r=0){const o=Wt.convert(e);return new ml(ch(o.lng),uh(o.lat),hh(r,o.lat))}toLngLat(){return new Wt(360*this.x-180,Ic(this.y))}toAltitude(){return this.z*lh(Ic(this.y))}meterInMercatorCoordinateUnits(){return 1/ah*(e=Ic(this.y),1/Math.cos(e*Math.PI/180));var e}}function ph(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 Cc{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=Qs(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=ph(256*(h=this.x),256*(d=Math.pow(2,m)-d-1),m),x=ph(256*(h+1),256*(d+1),m),g[0]+","+g[1]+","+x[0]+","+x[1]);var h,d,m,g,x;const T=function(S,P,k){let L,Z="";for(let q=S;q>0;q--)L=1<<q-1,Z+=(P&L?1:0)+(k&L?2:0);return Z}(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,T).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 Xe((e.x*r-this.x)*ri,(e.y*r-this.y)*ri)}toString(){return`${this.z}/${this.x}/${this.y}`}}class dh{constructor(e,r){this.wrap=e,this.canonical=r,this.key=Qs(e,r.z,r.z,r.x,r.y)}}class sr{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 Cc(o,+c,+h),this.key=Qs(r,e,o,c,h)}clone(){return new sr(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 sr(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new sr(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?Qs(this.wrap*+r,e,this.canonical.z,this.canonical.x,this.canonical.y):Qs(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 sr(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 sr(r,this.wrap,r,o,c),new sr(r,this.wrap,r,o+1,c),new sr(r,this.wrap,r,o,c+1),new sr(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 sr(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new sr(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 dh(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(e){return this.canonical.getTilePoint(new ml(e.x-this.wrap,e.y))}}function Qs(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)}Oe("CanonicalTileID",Cc),Oe("OverscaledTileID",sr,{omit:["posMatrix"]});class fh{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 at(`"${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 or({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 T=d;T<m;T++)for(let S=c;S<h;S++)this.data[this._idx(S,T)]=e.data[this._idx(S+g,T+x)]}}Oe("DEMData",fh);class mh{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 gh{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 _h{constructor(e,r){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new go(ri,16,0),this.grid3D=new go(ri,16,0),this.featureIndexArray=new ht,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 T=r[x],S=[1/0,1/0,-1/0,-1/0];for(let P=0;P<T.length;P++){const k=T[P];S[0]=Math.min(S[0],k.x),S[1]=Math.min(S[1],k.y),S[2]=Math.max(S[2],k.x),S[3]=Math.max(S[3],k.y)}S[0]<ri&&S[1]<ri&&S[2]>=0&&S[3]>=0&&g.insert(m,S[0],S[1],S[2],S[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new Un.VectorTile(new fc(this.rawTileData)).layers,this.sourceLayerCoder=new mh(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(e,r,o,c){this.loadVTLayers();const h=e.params||{},d=ri/e.tileSize/e.scale,m=Go(h.filter),g=e.queryGeometry,x=e.queryPadding*d,T=xh(g),S=this.grid.query(T.minX-x,T.minY-x,T.maxX+x,T.maxY+x),P=xh(e.cameraQueryGeometry),k=this.grid3D.query(P.minX-x,P.minY-x,P.maxX+x,P.maxY+x,(q,re,ce,ee)=>function(ae,xe,ye,Fe,Ne){for(const Ae of ae)if(xe<=Ae.x&&ye<=Ae.y&&Fe>=Ae.x&&Ne>=Ae.y)return!0;const ke=[new Xe(xe,ye),new Xe(xe,Ne),new Xe(Fe,Ne),new Xe(Fe,ye)];if(ae.length>2){for(const Ae of ke)if(Jo(ae,Ae))return!0}for(let Ae=0;Ae<ae.length-1;Ae++)if($p(ae[Ae],ae[Ae+1],ke))return!0;return!1}(e.cameraQueryGeometry,q-x,re-x,ce+x,ee+x));for(const q of k)S.push(q);S.sort(df);const L={};let Z;for(let q=0;q<S.length;q++){const re=S[q];if(re===Z)continue;Z=re;const ce=this.featureIndexArray.get(re);let ee=null;this.loadMatchingFeature(L,ce.bucketIndex,ce.sourceLayerIndex,ce.featureIndex,m,h.layers,h.availableImages,r,o,c,(ae,xe,ye)=>(ee||(ee=bo(ae)),xe.queryIntersectsFeature(g,ae,ye,ee,this.z,e.transform,d,e.pixelPosMatrix)))}return L}loadMatchingFeature(e,r,o,c,h,d,m,g,x,T,S){const P=this.bucketLayerIDs[r];if(d&&!function(q,re){for(let ce=0;ce<q.length;ce++)if(re.indexOf(q[ce])>=0)return!0;return!1}(d,P))return;const k=this.sourceLayerCoder.decode(o),L=this.vtLayers[k].feature(c);if(h.needGeometry){const q=wo(L,!0);if(!h.filter(new Nt(this.tileID.overscaledZ),q,this.tileID.canonical))return}else if(!h.filter(new Nt(this.tileID.overscaledZ),L))return;const Z=this.getId(L,k);for(let q=0;q<P.length;q++){const re=P[q];if(d&&d.indexOf(re)<0)continue;const ce=g[re];if(!ce)continue;let ee={};Z&&T&&(ee=T.getState(ce.sourceLayer||"_geojsonTileLayer",Z));const ae=$e({},x[re]);ae.paint=yh(ae.paint,ce.paint,L,ee,m),ae.layout=yh(ae.layout,ce.layout,L,ee,m);const xe=!S||S(L,ce,ee);if(!xe)continue;const ye=new gh(L,this.z,this.x,this.y,Z);ye.layer=ae;let Fe=e[re];Fe===void 0&&(Fe=e[re]=[]),Fe.push({featureIndex:c,feature:ye,intersectionZ:xe})}}lookupSymbolFeatures(e,r,o,c,h,d,m,g){const x={};this.loadVTLayers();const T=Go(h);for(const S of e)this.loadMatchingFeature(x,o,c,S,T,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 yh(i,e,r,o,c){return Ke(i,(h,d)=>{const m=e instanceof xo?e.get(d):null;return m&&m.evaluate?m.evaluate(r,o,c):m})}function xh(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 df(i,e){return e-i}var Ac;Oe("FeatureIndex",_h,{omit:["rawTileData","sourceLayerCoder"]}),a.PerformanceMarkers=void 0,(Ac=a.PerformanceMarkers||(a.PerformanceMarkers={})).create="create",Ac.load="load",Ac.fullLoad="fullLoad";let gl=null,ea=[];const Mc=1e3/30,ff={mark(i){performance.mark(i)},frame(i){const e=i;gl!=null&&ea.push(e-gl),gl=e},clearMetrics(){gl=null,ea=[],performance.clearMeasures("loadTime"),performance.clearMeasures("fullLoadTime");for(const i in a.PerformanceMarkers)performance.clearMarks(a.PerformanceMarkers[i])},getPerformanceMetrics(){performance.measure("loadTime",a.PerformanceMarkers.create,a.PerformanceMarkers.load),performance.measure("fullLoadTime",a.PerformanceMarkers.create,a.PerformanceMarkers.fullLoad);const i=performance.getEntriesByName("loadTime")[0].duration,e=performance.getEntriesByName("fullLoadTime")[0].duration,r=ea.length,o=1/(ea.reduce((h,d)=>h+d,0)/r/1e3),c=ea.filter(h=>h>Mc).reduce((h,d)=>h+(d-Mc)/Mc,0);return{loadTime:i,fullLoadTime:e,fps:o,percentDroppedFrames:c/(r+c)*100}}};a.AJAXError=Fi,a.ARRAY_TYPE=Di,a.Actor=class{constructor(i,e,r){this.target=i,this.parent=e,this.mapId=r,this.callbacks={},this.tasks={},this.taskQueue=[],this.cancelCallbacks={},et(["receive","process"],this),this.invoker=new pf(this.process),this.target.addEventListener("message",this.receive,!1),this.globalScope=Kt()?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=Rt(this.globalScope)?void 0:[];return this.target.postMessage({id:h,type:i,hasCallback:!!r,targetMapId:o,mustQueue:c,sourceMapId:this.mapId,data:on(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 Kt()||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(Nr(e.error)):r(null,Nr(e.data)))}else{let r=!1;const o=Rt(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?on(m):null,data:on(g,o)},o)}:m=>{r=!0};let h=null;const d=Nr(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)}},a.AlphaImage=qs,a.CanonicalTileID=Cc,a.CollisionBoxArray=me,a.CollisionCircleLayoutArray=class extends E{},a.Color=B,a.DEMData=fh,a.DataConstantProperty=Ze,a.DictionaryCoder=mh,a.EXTENT=ri,a.ErrorEvent=wn,a.EvaluationParameters=Nt,a.Event=Tr,a.Evented=Er,a.FeatureIndex=_h,a.FillBucket=uc,a.FillExtrusionBucket=pc,a.GeoJSONFeature=gh,a.ImageAtlas=Vu,a.ImagePosition=gc,a.LineBucket=dc,a.LineStripIndexArray=class extends G{},a.LngLat=Wt,a.LngLatBounds=Eo,a.MercatorCoordinate=ml,a.ONE_EM=gi,a.OverscaledTileID=sr,a.PerformanceUtils=ff,a.PosArray=We,a.Properties=mi,a.QuadTriangleArray=class extends z{},a.RGBAImage=or,a.RasterBoundsArray=class extends l{},a.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}},a.ResourceType=br,a.SegmentVector=dt,a.SymbolBucket=ns,a.Transitionable=Za,a.TriangleIndexArray=zi,a.Uniform1f=cn,a.Uniform1i=class extends ln{constructor(i,e){super(i,e),this.current=0}set(i){this.current!==i&&(this.current=i,this.gl.uniform1i(this.location,i))}},a.Uniform2f=class extends ln{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]))}},a.Uniform3f=class extends ln{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]))}},a.Uniform4f=Ho,a.UniformColor=ru,a.UniformMatrix4f=class extends ln{constructor(i,e){super(i,e),this.current=Lp}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}}},a.UnwrappedTileID=dh,a.ValidationError=Me,a.ZoomHistory=Ms,a.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},a.addDynamicAttributes=bc,a.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)})})},a.bezier=fe,a.bindAll=et,a.cacheEntryPossiblyAdded=function(i){pr++,pr>_n&&(i.getActor().send("enforceCacheSizeLimit",gn),pr=0)},a.clamp=ie,a.clearTileCache=function(i){const e=caches.delete(Ci);i&&e.catch(i).then(()=>i())},a.clipLine=Qu,a.clone=function(i){var e=new Di(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},a.clone$1=lt,a.clone$2=function(i){var e=new Di(3);return e[0]=i[0],e[1]=i[1],e[2]=i[2],e},a.collisionCircleLayout=zd,a.config=wi,a.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},a.create=function(){var i=new Di(16);return Di!=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},a.create$1=hu,a.createExpression=no,a.createFilter=Go,a.createLayout=Yt,a.createStyleLayer=function(i){return i.type==="custom"?new uf(i):new hf[i.type](i)},a.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},a.dot=function(i,e){return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]},a.dot$1=function(i,e){return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]+i[3]*e[3]},a.ease=ue,a.emitValidationErrors=Zo,a.enforceCacheSizeLimit=function(i){yn(),Ai&&Ai.then(e=>{e.keys().then(r=>{for(let o=0;o<r.length-i;o++)e.delete(r[o])})})},a.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],T=i[8],S=i[9],P=i[10],k=i[11],L=i[12],Z=i[13],q=i[14],re=i[15],ce=e[0],ee=e[1],ae=e[2],xe=e[3],ye=e[4],Fe=e[5],Ne=e[6],ke=e[7],Ae=e[8],Ee=e[9],De=e[10],Pe=e[11],we=e[12],He=e[13],je=e[14],pt=e[15];return Math.abs(r-ce)<=ki*Math.max(1,Math.abs(r),Math.abs(ce))&&Math.abs(o-ee)<=ki*Math.max(1,Math.abs(o),Math.abs(ee))&&Math.abs(c-ae)<=ki*Math.max(1,Math.abs(c),Math.abs(ae))&&Math.abs(h-xe)<=ki*Math.max(1,Math.abs(h),Math.abs(xe))&&Math.abs(d-ye)<=ki*Math.max(1,Math.abs(d),Math.abs(ye))&&Math.abs(m-Fe)<=ki*Math.max(1,Math.abs(m),Math.abs(Fe))&&Math.abs(g-Ne)<=ki*Math.max(1,Math.abs(g),Math.abs(Ne))&&Math.abs(x-ke)<=ki*Math.max(1,Math.abs(x),Math.abs(ke))&&Math.abs(T-Ae)<=ki*Math.max(1,Math.abs(T),Math.abs(Ae))&&Math.abs(S-Ee)<=ki*Math.max(1,Math.abs(S),Math.abs(Ee))&&Math.abs(P-De)<=ki*Math.max(1,Math.abs(P),Math.abs(De))&&Math.abs(k-Pe)<=ki*Math.max(1,Math.abs(k),Math.abs(Pe))&&Math.abs(L-we)<=ki*Math.max(1,Math.abs(L),Math.abs(we))&&Math.abs(Z-He)<=ki*Math.max(1,Math.abs(Z),Math.abs(He))&&Math.abs(q-je)<=ki*Math.max(1,Math.abs(q),Math.abs(je))&&Math.abs(re-pt)<=ki*Math.max(1,Math.abs(re),Math.abs(pt))},a.evaluateSizeForFeature=function(i,{uSize:e,uSizeT:r},{lowerSize:o,upperSize:c}){return i.kind==="source"?o/pn:i.kind==="composite"?Ut(o/pn,c/pn,r):e},a.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?ie(Ui.interpolationFactor(c,e,h,d),0,1):0;i.kind==="camera"?o=Ut(i.minSize,i.maxSize,m):r=m}return{uSizeT:r,uSize:o}},a.evaluateVariableOffset=ih,a.evented=Bs,a.exported=di,a.exported$1=Dr,a.extend=$e,a.filterObject=tt,a.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},a.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},a.getAnchorAlignment=yc,a.getAnchorJustification=vc,a.getArrayBuffer=bn,a.getImage=Or,a.getJSON=function(i,e){return vn($e(i,{type:"json"}),e)},a.getOverlapMode=Sc,a.getRTLTextPluginStatus=_o,a.getReferrer=Xn,a.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");Wn(i[o])||(r.crossOrigin="Anonymous"),c.src=i[o],r.appendChild(c)}return{cancel:()=>{}}},a.identity=tc,a.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],T=e[8],S=e[9],P=e[10],k=e[11],L=e[12],Z=e[13],q=e[14],re=e[15],ce=r*m-o*d,ee=r*g-c*d,ae=r*x-h*d,xe=o*g-c*m,ye=o*x-h*m,Fe=c*x-h*g,Ne=T*Z-S*L,ke=T*q-P*L,Ae=T*re-k*L,Ee=S*q-P*Z,De=S*re-k*Z,Pe=P*re-k*q,we=ce*Pe-ee*De+ae*Ee+xe*Ae-ye*ke+Fe*Ne;return we?(i[0]=(m*Pe-g*De+x*Ee)*(we=1/we),i[1]=(c*De-o*Pe-h*Ee)*we,i[2]=(Z*Fe-q*ye+re*xe)*we,i[3]=(P*ye-S*Fe-k*xe)*we,i[4]=(g*Ae-d*Pe-x*ke)*we,i[5]=(r*Pe-c*Ae+h*ke)*we,i[6]=(q*ae-L*Fe-re*ee)*we,i[7]=(T*Fe-P*ae+k*ee)*we,i[8]=(d*De-m*Ae+x*Ne)*we,i[9]=(o*Ae-r*De-h*Ne)*we,i[10]=(L*ye-Z*ae+re*ce)*we,i[11]=(S*ae-T*ye-k*ce)*we,i[12]=(m*ke-d*Ee-g*Ne)*we,i[13]=(r*Ee-o*ke+c*Ne)*we,i[14]=(Z*ee-L*xe-q*ce)*we,i[15]=(T*xe-S*ee+P*ce)*we,i):null},a.isImageBitmap=pi,a.isSafari=Rt,a.isWorker=Kt,a.keysDifference=function(i,e){const r=[];for(const o in i)o in e||r.push(o);return r},a.lazyLoadRTLTextPlugin=function(){Ji.isLoading()||Ji.isLoaded()||_o()!=="deferred"||qa()},a.makeRequest=vn,a.mapObject=Ke,a.mercatorXfromLng=ch,a.mercatorYfromLat=uh,a.mercatorZfromAltitude=hh,a.mul=Np,a.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},a.multiply=pu,a.nextPowerOfTwo=function(i){return i<=1?1:Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))},a.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},a.number=Ut,a.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},a.parseCacheControl=ur,a.parseGlyphPbf=function(i){return new fc(i).readFields(Nd,[])},a.pbf=fc,a.performSymbolLayout=function(i){i.bucket.createArrays(),i.bucket.tilePixelRatio=ri/(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 Nt(i.bucket.zoom+1),i.canonical),layoutTextSize:r["text-size"].possiblyEvaluate(new Nt(i.bucket.zoom+1),i.canonical),textMaxSize:r["text-size"].possiblyEvaluate(new Nt(18))};if(i.bucket.textSizeData.kind==="composite"){const{minZoom:g,maxZoom:x}=i.bucket.textSizeData;o.compositeTextSizes=[r["text-size"].possiblyEvaluate(new Nt(g),i.canonical),r["text-size"].possiblyEvaluate(new Nt(x),i.canonical)]}if(i.bucket.iconSizeData.kind==="composite"){const{minZoom:g,maxZoom:x}=i.bucket.iconSizeData;o.compositeIconSizes=[r["icon-size"].possiblyEvaluate(new Nt(g),i.canonical),r["icon-size"].possiblyEvaluate(new Nt(x),i.canonical)]}const c=e.get("text-line-height")*gi,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(","),T=m.evaluate(g,{},i.canonical),S=o.layoutTextSize.evaluate(g,{},i.canonical),P=o.layoutIconSize.evaluate(g,{},i.canonical),k={horizontal:{},vertical:void 0},L=g.text;let Z,q=[0,0];if(L){const ee=L.toString(),ae=e.get("text-letter-spacing").evaluate(g,{},i.canonical)*gi,xe=Xl(ee)?ae:0,ye=e.get("text-anchor").evaluate(g,{},i.canonical),Fe=e.get("text-variable-anchor");if(!Fe){const De=e.get("text-radial-offset").evaluate(g,{},i.canonical);q=De?ih(ye,[De*gi,xc]):e.get("text-offset").evaluate(g,{},i.canonical).map(Pe=>Pe*gi)}let Ne=h?"center":e.get("text-justify").evaluate(g,{},i.canonical);const ke=e.get("symbol-placement"),Ae=ke==="point"?e.get("text-max-width").evaluate(g,{},i.canonical)*gi:0,Ee=()=>{i.bucket.allowVerticalPlacement&&jo(ee)&&(k.vertical=al(L,i.glyphMap,i.glyphPositions,i.imagePositions,x,Ae,c,ye,"left",xe,q,a.WritingMode.vertical,!0,ke,S,T))};if(!h&&Fe){const De=Ne==="auto"?Fe.map(we=>vc(we)):[Ne];let Pe=!1;for(let we=0;we<De.length;we++){const He=De[we];if(!k.horizontal[He])if(Pe)k.horizontal[He]=k.horizontal[0];else{const je=al(L,i.glyphMap,i.glyphPositions,i.imagePositions,x,Ae,c,"center",He,xe,q,a.WritingMode.horizontal,!1,ke,S,T);je&&(k.horizontal[He]=je,Pe=je.positionedLines.length===1)}}Ee()}else{Ne==="auto"&&(Ne=vc(ye));const De=al(L,i.glyphMap,i.glyphPositions,i.imagePositions,x,Ae,c,ye,Ne,xe,q,a.WritingMode.horizontal,!1,ke,S,T);De&&(k.horizontal[Ne]=De),Ee(),jo(ee)&&h&&d&&(k.vertical=al(L,i.glyphMap,i.glyphPositions,i.imagePositions,x,Ae,c,ye,Ne,xe,q,a.WritingMode.vertical,!1,ke,S,T))}}let re=!1;if(g.icon&&g.icon.name){const ee=i.imageMap[g.icon.name];ee&&(Z=Wd(i.imagePositions[g.icon.name],e.get("icon-offset").evaluate(g,{},i.canonical),e.get("icon-anchor").evaluate(g,{},i.canonical)),re=!!ee.sdf,i.bucket.sdfIcons===void 0?i.bucket.sdfIcons=re:i.bucket.sdfIcons!==re&&at("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(ee.pixelRatio!==i.bucket.pixelRatio||e.get("icon-rotate").constantOr(1)!==0)&&(i.bucket.iconsNeedLinear=!0))}const ce=nh(k.horizontal)||k.vertical;i.bucket.iconsInText=!!ce&&ce.iconsInText,(ce||Z)&&tf(i.bucket,g,k,Z,i.imageMap,o,S,P,q,re,i.canonical)}i.showCollisionBoxes&&i.bucket.generateCollisionDebugBuffers()},a.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},a.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},a.plugin=Ji,a.pointGeometry=Xe,a.polygonIntersectsPolygon=au,a.potpack=Uu,a.refProperties=["type","source","source-layer","minzoom","maxzoom","filter","layout"],a.register=Oe,a.registerForPluginStateChange=function(i){return i({pluginStatus:Pi,pluginURL:Gr}),Bs.on("pluginStateChange",i),i},a.renderColorRamp=xu,a.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],T=e[9],S=e[10],P=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+T*o,i[6]=m*c+S*o,i[7]=g*c+P*o,i[8]=x*c-h*o,i[9]=T*c-d*o,i[10]=S*c-m*o,i[11]=P*c-g*o,i},a.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],T=e[5],S=e[6],P=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+T*o,i[2]=m*c+S*o,i[3]=g*c+P*o,i[4]=x*c-h*o,i[5]=T*c-d*o,i[6]=S*c-m*o,i[7]=P*c-g*o,i},a.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},a.scale$1=function(i,e,r){return i[0]=e[0]*r,i[1]=e[1]*r,i[2]=e[2]*r,i},a.setCacheLimits=function(i,e){gn=i,_n=e},a.setRTLTextPlugin=function(i,e,r=!1){if(Pi===ks||Pi===Ds||Pi===Ls)throw new Error("setRTLTextPlugin cannot be called multiple times.");Gr=di.resolveURL(i),Pi=ks,Rs=e,Bn(),r||qa()},a.spec=_e,a.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)}},a.sqrLen=function(i){var e=i[0],r=i[1];return e*e+r*r},a.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},a.toEvaluationFeature=wo,a.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},a.transformMat4=Qa,a.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},a.translate=function(i,e,r){var o,c,h,d,m,g,x,T,S,P,k,L,Z=r[0],q=r[1],re=r[2];return e===i?(i[12]=e[0]*Z+e[4]*q+e[8]*re+e[12],i[13]=e[1]*Z+e[5]*q+e[9]*re+e[13],i[14]=e[2]*Z+e[6]*q+e[10]*re+e[14],i[15]=e[3]*Z+e[7]*q+e[11]*re+e[15]):(c=e[1],h=e[2],d=e[3],m=e[4],g=e[5],x=e[6],T=e[7],S=e[8],P=e[9],k=e[10],L=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]=T,i[8]=S,i[9]=P,i[10]=k,i[11]=L,i[12]=o*Z+m*q+S*re+e[12],i[13]=c*Z+g*q+P*re+e[13],i[14]=h*Z+x*q+k*re+e[14],i[15]=d*Z+T*q+L*re+e[15]),i},a.triggerPluginCompletionEvent=Ga,a.unicodeBlockLookup=ze,a.uniqueId=function(){return Ue++},a.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},a.validateLight=As,a.validateStyle=mo,a.vectorTile=Un,a.warnOnce=at,a.wrap=Ge}),N(["./shared"],function(a){function Y(O){const w=typeof O;if(w==="number"||w==="boolean"||w==="string"||O==null)return JSON.stringify(O);if(Array.isArray(O)){let B="[";for(const j of O)B+=`${Y(j)},`;return`${B}]`}const C=Object.keys(O).sort();let R="{";for(let B=0;B<C.length;B++)R+=`${JSON.stringify(C[B])}:${Y(O[C[B]])},`;return`${R}}`}function te(O){let w="";for(const C of a.refProperties)w+=`/${Y(O[C])}`;return w}class fe{constructor(w){this.keyCache={},w&&this.replace(w)}replace(w){this._layerConfigs={},this._layers={},this.update(w,[])}update(w,C){for(const B of w){this._layerConfigs[B.id]=B;const j=this._layers[B.id]=a.createStyleLayer(B);j._featureFilter=a.createFilter(j.filter),this.keyCache[B.id]&&delete this.keyCache[B.id]}for(const B of C)delete this.keyCache[B],delete this._layerConfigs[B],delete this._layers[B];this.familiesBySource={};const R=function(B,j){const K={};for(let X=0;X<B.length;X++){const J=j&&j[B[X].id]||te(B[X]);j&&(j[B[X].id]=J);let pe=K[J];pe||(pe=K[J]=[]),pe.push(B[X])}const W=[];for(const X in K)W.push(K[X]);return W}(Object.values(this._layerConfigs),this.keyCache);for(const B of R){const j=B.map(ve=>this._layers[ve.id]),K=j[0];if(K.visibility==="none")continue;const W=K.source||"";let X=this.familiesBySource[W];X||(X=this.familiesBySource[W]={});const J=K.sourceLayer||"_geojsonTileLayer";let pe=X[J];pe||(pe=X[J]=[]),pe.push(j)}}}class ue{constructor(w){const C={},R=[];for(const W in w){const X=w[W],J=C[W]={};for(const pe in X){const ve=X[+pe];if(!ve||ve.bitmap.width===0||ve.bitmap.height===0)continue;const he={x:0,y:0,w:ve.bitmap.width+2,h:ve.bitmap.height+2};R.push(he),J[pe]={rect:he,metrics:ve.metrics}}}const{w:B,h:j}=a.potpack(R),K=new a.AlphaImage({width:B||1,height:j||1});for(const W in w){const X=w[W];for(const J in X){const pe=X[+J];if(!pe||pe.bitmap.width===0||pe.bitmap.height===0)continue;const ve=C[W][J].rect;a.AlphaImage.copy(pe.bitmap,K,{x:0,y:0},{x:ve.x+1,y:ve.y+1},pe.bitmap)}}this.image=K,this.positions=C}}a.register("GlyphAtlas",ue);class ie{constructor(w){this.tileID=new a.OverscaledTileID(w.tileID.overscaledZ,w.tileID.wrap,w.tileID.canonical.z,w.tileID.canonical.x,w.tileID.canonical.y),this.uid=w.uid,this.zoom=w.zoom,this.pixelRatio=w.pixelRatio,this.tileSize=w.tileSize,this.source=w.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=w.showCollisionBoxes,this.collectResourceTiming=!!w.collectResourceTiming,this.returnDependencies=!!w.returnDependencies,this.promoteId=w.promoteId}parse(w,C,R,B,j){this.status="parsing",this.data=w,this.collisionBoxArray=new a.CollisionBoxArray;const K=new a.DictionaryCoder(Object.keys(w.layers).sort()),W=new a.FeatureIndex(this.tileID,this.promoteId);W.bucketLayerIDs=[];const X={},J={featureIndex:W,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:R},pe=C.familiesBySource[this.source];for(const it in pe){const ut=w.layers[it];if(!ut)continue;ut.version===1&&a.warnOnce(`Vector tile source "${this.source}" layer "${it}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const bt=K.encode(it),kt=[];for(let si=0;si<ut.length;si++){const $t=ut.feature(si),_i=W.getId($t,it);kt.push({feature:$t,id:_i,index:si,sourceLayerIndex:bt})}for(const si of pe[it]){const $t=si[0];$t.source!==this.source&&a.warnOnce(`layer.source = ${$t.source} does not equal this.source = ${this.source}`),$t.minzoom&&this.zoom<Math.floor($t.minzoom)||$t.maxzoom&&this.zoom>=$t.maxzoom||$t.visibility!=="none"&&(Ge(si,this.zoom,R),(X[$t.id]=$t.createBucket({index:W.bucketLayerIDs.length,layers:si,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:bt,sourceID:this.source})).populate(kt,J,this.tileID.canonical),W.bucketLayerIDs.push(si.map(_i=>_i.id)))}}let ve,he,Ve,qe;const Le=a.mapObject(J.glyphDependencies,it=>Object.keys(it).map(Number));Object.keys(Le).length?B.send("getGlyphs",{uid:this.uid,stacks:Le},(it,ut)=>{ve||(ve=it,he=ut,vt.call(this))}):he={};const Je=Object.keys(J.iconDependencies);Je.length?B.send("getImages",{icons:Je,source:this.source,tileID:this.tileID,type:"icons"},(it,ut)=>{ve||(ve=it,Ve=ut,vt.call(this))}):Ve={};const Qe=Object.keys(J.patternDependencies);function vt(){if(ve)return j(ve);if(he&&Ve&&qe){const it=new ue(he),ut=new a.ImageAtlas(Ve,qe);for(const bt in X){const kt=X[bt];kt instanceof a.SymbolBucket?(Ge(kt.layers,this.zoom,R),a.performSymbolLayout({bucket:kt,glyphMap:he,glyphPositions:it.positions,imageMap:Ve,imagePositions:ut.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):kt.hasPattern&&(kt instanceof a.LineBucket||kt instanceof a.FillBucket||kt instanceof a.FillExtrusionBucket)&&(Ge(kt.layers,this.zoom,R),kt.addFeatures(J,this.tileID.canonical,ut.patternPositions))}this.status="done",j(null,{buckets:Object.values(X).filter(bt=>!bt.isEmpty()),featureIndex:W,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:it.image,imageAtlas:ut,glyphMap:this.returnDependencies?he:null,iconMap:this.returnDependencies?Ve:null,glyphPositions:this.returnDependencies?it.positions:null})}}Qe.length?B.send("getImages",{icons:Qe,source:this.source,tileID:this.tileID,type:"patterns"},(it,ut)=>{ve||(ve=it,qe=ut,vt.call(this))}):qe={},vt.call(this)}}function Ge(O,w,C){const R=new a.EvaluationParameters(w);for(const B of O)B.recalculate(R,C)}function $e(O,w){const C=a.getArrayBuffer(O.request,(R,B,j,K)=>{R?w(R):B&&w(null,{vectorTile:new a.vectorTile.VectorTile(new a.pbf(B)),rawData:B,cacheControl:j,expires:K})});return()=>{C.cancel(),w()}}class Ue{constructor(w,C,R,B){this.actor=w,this.layerIndex=C,this.availableImages=R,this.loadVectorData=B||$e,this.loading={},this.loaded={}}loadTile(w,C){const R=w.uid;this.loading||(this.loading={});const B=!!(w&&w.request&&w.request.collectResourceTiming)&&new a.RequestPerformance(w.request),j=this.loading[R]=new ie(w);j.abort=this.loadVectorData(w,(K,W)=>{if(delete this.loading[R],K||!W)return j.status="done",this.loaded[R]=j,C(K);const X=W.rawData,J={};W.expires&&(J.expires=W.expires),W.cacheControl&&(J.cacheControl=W.cacheControl);const pe={};if(B){const ve=B.finish();ve&&(pe.resourceTiming=JSON.parse(JSON.stringify(ve)))}j.vectorTile=W.vectorTile,j.parse(W.vectorTile,this.layerIndex,this.availableImages,this.actor,(ve,he)=>{if(ve||!he)return C(ve);C(null,a.extend({rawTileData:X.slice(0)},he,J,pe))}),this.loaded=this.loaded||{},this.loaded[R]=j})}reloadTile(w,C){const R=this.loaded,B=w.uid,j=this;if(R&&R[B]){const K=R[B];K.showCollisionBoxes=w.showCollisionBoxes;const W=(X,J)=>{const pe=K.reloadCallback;pe&&(delete K.reloadCallback,K.parse(K.vectorTile,j.layerIndex,this.availableImages,j.actor,pe)),C(X,J)};K.status==="parsing"?K.reloadCallback=W:K.status==="done"&&(K.vectorTile?K.parse(K.vectorTile,this.layerIndex,this.availableImages,this.actor,W):W())}}abortTile(w,C){const R=this.loading,B=w.uid;R&&R[B]&&R[B].abort&&(R[B].abort(),delete R[B]),C()}removeTile(w,C){const R=this.loaded,B=w.uid;R&&R[B]&&delete R[B],C()}}class et{constructor(){this.loaded={}}loadTile(w,C){const{uid:R,encoding:B,rawImageData:j}=w,K=a.isImageBitmap(j)?this.getImageData(j):j,W=new a.DEMData(R,K,B);this.loaded=this.loaded||{},this.loaded[R]=W,C(null,W)}getImageData(w){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(w.width,w.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d")),this.offscreenCanvas.width=w.width,this.offscreenCanvas.height=w.height,this.offscreenCanvasContext.drawImage(w,0,0,w.width,w.height);const C=this.offscreenCanvasContext.getImageData(-1,-1,w.width+2,w.height+2);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),new a.RGBAImage({width:C.width,height:C.height},C.data)}removeTile(w){const C=this.loaded,R=w.uid;C&&C[R]&&delete C[R]}}var Ke=function O(w,C){var R,B=w&&w.type;if(B==="FeatureCollection")for(R=0;R<w.features.length;R++)O(w.features[R],C);else if(B==="GeometryCollection")for(R=0;R<w.geometries.length;R++)O(w.geometries[R],C);else if(B==="Feature")O(w.geometry,C);else if(B==="Polygon")tt(w.coordinates,C);else if(B==="MultiPolygon")for(R=0;R<w.coordinates.length;R++)tt(w.coordinates[R],C);return w};function tt(O,w){if(O.length!==0){lt(O[0],w);for(var C=1;C<O.length;C++)lt(O[C],!w)}}function lt(O,w){for(var C=0,R=0,B=0,j=O.length,K=j-1;B<j;K=B++){var W=(O[B][0]-O[K][0])*(O[K][1]+O[B][1]),X=C+W;R+=Math.abs(C)>=Math.abs(W)?C-X+W:W-X+C,C=X}C+R>=0!=!!w&&O.reverse()}const It=a.vectorTile.VectorTileFeature.prototype.toGeoJSON;class at{constructor(w){this._feature=w,this.extent=a.EXTENT,this.type=w.type,this.properties=w.tags,"id"in w&&!isNaN(w.id)&&(this.id=parseInt(w.id,10))}loadGeometry(){if(this._feature.type===1){const w=[];for(const C of this._feature.geometry)w.push([new a.pointGeometry(C[0],C[1])]);return w}{const w=[];for(const C of this._feature.geometry){const R=[];for(const B of C)R.push(new a.pointGeometry(B[0],B[1]));w.push(R)}return w}}toGeoJSON(w,C,R){return It.call(this,w,C,R)}}class gt{constructor(w){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=a.EXTENT,this.length=w.length,this._features=w}feature(w){return new at(this._features[w])}}var ti={exports:{}},Kt=a.pointGeometry,ur=a.vectorTile.VectorTileFeature,Wi=hr;function hr(O,w){this.options=w||{},this.features=O,this.length=O.length}function Hi(O,w){this.id=typeof O.id=="number"?O.id:void 0,this.type=O.type,this.rawGeometry=O.type===1?[O.geometry]:O.geometry,this.properties=O.tags,this.extent=w||4096}hr.prototype.feature=function(O){return new Hi(this.features[O],this.options.extent)},Hi.prototype.loadGeometry=function(){var O=this.rawGeometry;this.geometry=[];for(var w=0;w<O.length;w++){for(var C=O[w],R=[],B=0;B<C.length;B++)R.push(new Kt(C[B][0],C[B][1]));this.geometry.push(R)}return this.geometry},Hi.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var O=this.geometry,w=1/0,C=-1/0,R=1/0,B=-1/0,j=0;j<O.length;j++)for(var K=O[j],W=0;W<K.length;W++){var X=K[W];w=Math.min(w,X.x),C=Math.max(C,X.x),R=Math.min(R,X.y),B=Math.max(B,X.y)}return[w,R,C,B]},Hi.prototype.toGeoJSON=ur.prototype.toGeoJSON;var Rt=a.pbf,pi=Wi;function di(O){var w=new Rt;return function(C,R){for(var B in C.layers)R.writeMessage(3,Xe,C.layers[B])}(O,w),w.finish()}function Xe(O,w){var C;w.writeVarintField(15,O.version||1),w.writeStringField(1,O.name||""),w.writeVarintField(5,O.extent||4096);var R={keys:[],values:[],keycache:{},valuecache:{}};for(C=0;C<O.length;C++)R.feature=O.feature(C),w.writeMessage(2,Bi,R);var B=R.keys;for(C=0;C<B.length;C++)w.writeStringField(3,B[C]);var j=R.values;for(C=0;C<j.length;C++)w.writeMessage(4,gn,j[C])}function Bi(O,w){var C=O.feature;C.id!==void 0&&w.writeVarintField(1,C.id),w.writeMessage(2,wi,O),w.writeVarintField(3,C.type),w.writeMessage(4,Kr,C)}function wi(O,w){var C=O.feature,R=O.keys,B=O.values,j=O.keycache,K=O.valuecache;for(var W in C.properties){var X=C.properties[W],J=j[W];if(X!==null){J===void 0&&(R.push(W),j[W]=J=R.length-1),w.writeVarint(J);var pe=typeof X;pe!=="string"&&pe!=="boolean"&&pe!=="number"&&(X=JSON.stringify(X));var ve=pe+":"+X,he=K[ve];he===void 0&&(B.push(X),K[ve]=he=B.length-1),w.writeVarint(he)}}}function Ci(O,w){return(w<<3)+(7&O)}function Ai(O){return O<<1^O>>31}function Kr(O,w){for(var C=O.loadGeometry(),R=O.type,B=0,j=0,K=C.length,W=0;W<K;W++){var X=C[W],J=1;R===1&&(J=X.length),w.writeVarint(Ci(1,J));for(var pe=R===3?X.length-1:X.length,ve=0;ve<pe;ve++){ve===1&&R!==1&&w.writeVarint(Ci(2,pe-1));var he=X[ve].x-B,Ve=X[ve].y-j;w.writeVarint(Ai(he)),w.writeVarint(Ai(Ve)),B+=he,j+=Ve}R===3&&w.writeVarint(Ci(7,1))}}function gn(O,w){var C=typeof O;C==="string"?w.writeStringField(1,O):C==="boolean"?w.writeBooleanField(7,O):C==="number"&&(O%1!=0?w.writeDoubleField(3,O):O<0?w.writeSVarintField(6,O):w.writeVarintField(5,O))}function _n(O,w,C,R,B,j){if(B-R<=C)return;const K=R+B>>1;yn(O,w,K,R,B,j%2),_n(O,w,C,R,K-1,j+1),_n(O,w,C,K+1,B,j+1)}function yn(O,w,C,R,B,j){for(;B>R;){if(B-R>600){const J=B-R+1,pe=C-R+1,ve=Math.log(J),he=.5*Math.exp(2*ve/3),Ve=.5*Math.sqrt(ve*he*(J-he)/J)*(pe-J/2<0?-1:1);yn(O,w,C,Math.max(R,Math.floor(C-pe*he/J+Ve)),Math.min(B,Math.floor(C+(J-pe)*he/J+Ve)),j)}const K=w[2*C+j];let W=R,X=B;for(pr(O,w,R,C),w[2*B+j]>K&&pr(O,w,R,B);W<X;){for(pr(O,w,W,X),W++,X--;w[2*W+j]<K;)W++;for(;w[2*X+j]>K;)X--}w[2*R+j]===K?pr(O,w,R,X):(X++,pr(O,w,X,B)),X<=C&&(R=X+1),C<=X&&(B=X-1)}}function pr(O,w,C,R){Dr(O,C,R),Dr(w,2*C,2*R),Dr(w,2*C+1,2*R+1)}function Dr(O,w,C){const R=O[w];O[w]=O[C],O[C]=R}function Lr(O,w,C,R){const B=O-C,j=w-R;return B*B+j*j}ti.exports=di,ti.exports.fromVectorTileJs=di,ti.exports.fromGeojsonVt=function(O,w){w=w||{};var C={};for(var R in O)C[R]=new pi(O[R].features,w),C[R].name=R,C[R].version=w.version,C[R].extent=w.extent;return di({layers:C})},ti.exports.GeoJSONWrapper=pi;const Rr=O=>O[0],Mi=O=>O[1];class xn{constructor(w,C=Rr,R=Mi,B=64,j=Float64Array){this.nodeSize=B,this.points=w;const K=w.length<65536?Uint16Array:Uint32Array,W=this.ids=new K(w.length),X=this.coords=new j(2*w.length);for(let J=0;J<w.length;J++)W[J]=J,X[2*J]=C(w[J]),X[2*J+1]=R(w[J]);_n(W,X,B,0,W.length-1,0)}range(w,C,R,B){return function(j,K,W,X,J,pe,ve){const he=[0,j.length-1,0],Ve=[];let qe,Le;for(;he.length;){const Je=he.pop(),Qe=he.pop(),vt=he.pop();if(Qe-vt<=ve){for(let bt=vt;bt<=Qe;bt++)qe=K[2*bt],Le=K[2*bt+1],qe>=W&&qe<=J&&Le>=X&&Le<=pe&&Ve.push(j[bt]);continue}const it=Math.floor((vt+Qe)/2);qe=K[2*it],Le=K[2*it+1],qe>=W&&qe<=J&&Le>=X&&Le<=pe&&Ve.push(j[it]);const ut=(Je+1)%2;(Je===0?W<=qe:X<=Le)&&(he.push(vt),he.push(it-1),he.push(ut)),(Je===0?J>=qe:pe>=Le)&&(he.push(it+1),he.push(Qe),he.push(ut))}return Ve}(this.ids,this.coords,w,C,R,B,this.nodeSize)}within(w,C,R){return function(B,j,K,W,X,J){const pe=[0,B.length-1,0],ve=[],he=X*X;for(;pe.length;){const Ve=pe.pop(),qe=pe.pop(),Le=pe.pop();if(qe-Le<=J){for(let ut=Le;ut<=qe;ut++)Lr(j[2*ut],j[2*ut+1],K,W)<=he&&ve.push(B[ut]);continue}const Je=Math.floor((Le+qe)/2),Qe=j[2*Je],vt=j[2*Je+1];Lr(Qe,vt,K,W)<=he&&ve.push(B[Je]);const it=(Ve+1)%2;(Ve===0?K-X<=Qe:W-X<=vt)&&(pe.push(Le),pe.push(Je-1),pe.push(it)),(Ve===0?K+X>=Qe:W+X>=vt)&&(pe.push(Je+1),pe.push(qe),pe.push(it))}return ve}(this.ids,this.coords,w,C,R,this.nodeSize)}}const jn={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:O=>O},br=Math.fround||(Fi=new Float32Array(1),O=>(Fi[0]=+O,Fi[0]));var Fi;class Xn{constructor(w){this.options=Or(Object.create(jn),w),this.trees=new Array(this.options.maxZoom+1)}load(w){const{log:C,minZoom:R,maxZoom:B,nodeSize:j}=this.options;C&&console.time("total time");const K=`prepare ${w.length} points`;C&&console.time(K),this.points=w;let W=[];for(let X=0;X<w.length;X++)w[X].geometry&&W.push(vn(w[X],X));this.trees[B+1]=new xn(W,Hn,wr,j,Float32Array),C&&console.timeEnd(K);for(let X=B;X>=R;X--){const J=+Date.now();W=this._cluster(W,X),this.trees[X]=new xn(W,Hn,wr,j,Float32Array),C&&console.log("z%d: %d clusters in %dms",X,W.length,+Date.now()-J)}return C&&console.timeEnd("total time"),this}getClusters(w,C){let R=((w[0]+180)%360+360)%360-180;const B=Math.max(-90,Math.min(90,w[1]));let j=w[2]===180?180:((w[2]+180)%360+360)%360-180;const K=Math.max(-90,Math.min(90,w[3]));if(w[2]-w[0]>=360)R=-180,j=180;else if(R>j){const pe=this.getClusters([R,B,180,K],C),ve=this.getClusters([-180,B,j,K],C);return pe.concat(ve)}const W=this.trees[this._limitZoom(C)],X=W.range(yt(R),dr(K),yt(j),dr(B)),J=[];for(const pe of X){const ve=W.points[pe];J.push(ve.numPoints?bn(ve):this.points[ve.index])}return J}getChildren(w){const C=this._getOriginId(w),R=this._getOriginZoom(w),B="No cluster with the specified id.",j=this.trees[R];if(!j)throw new Error(B);const K=j.points[C];if(!K)throw new Error(B);const W=this.options.radius/(this.options.extent*Math.pow(2,R-1)),X=j.within(K.x,K.y,W),J=[];for(const pe of X){const ve=j.points[pe];ve.parentId===w&&J.push(ve.numPoints?bn(ve):this.points[ve.index])}if(J.length===0)throw new Error(B);return J}getLeaves(w,C,R){const B=[];return this._appendLeaves(B,w,C=C||10,R=R||0,0),B}getTile(w,C,R){const B=this.trees[this._limitZoom(w)],j=Math.pow(2,w),{extent:K,radius:W}=this.options,X=W/K,J=(R-X)/j,pe=(R+1+X)/j,ve={features:[]};return this._addTileFeatures(B.range((C-X)/j,J,(C+1+X)/j,pe),B.points,C,R,j,ve),C===0&&this._addTileFeatures(B.range(1-X/j,J,1,pe),B.points,j,R,j,ve),C===j-1&&this._addTileFeatures(B.range(0,J,X/j,pe),B.points,-1,R,j,ve),ve.features.length?ve:null}getClusterExpansionZoom(w){let C=this._getOriginZoom(w)-1;for(;C<=this.options.maxZoom;){const R=this.getChildren(w);if(C++,R.length!==1)break;w=R[0].properties.cluster_id}return C}_appendLeaves(w,C,R,B,j){const K=this.getChildren(C);for(const W of K){const X=W.properties;if(X&&X.cluster?j+X.point_count<=B?j+=X.point_count:j=this._appendLeaves(w,X.cluster_id,R,B,j):j<B?j++:w.push(W),w.length===R)break}return j}_addTileFeatures(w,C,R,B,j,K){for(const W of w){const X=C[W],J=X.numPoints;let pe,ve,he;if(J)pe=Wn(X),ve=X.x,he=X.y;else{const Le=this.points[X.index];pe=Le.properties,ve=yt(Le.geometry.coordinates[0]),he=dr(Le.geometry.coordinates[1])}const Ve={type:1,geometry:[[Math.round(this.options.extent*(ve*j-R)),Math.round(this.options.extent*(he*j-B))]],tags:pe};let qe;J?qe=X.id:this.options.generateId?qe=X.index:this.points[X.index].id&&(qe=this.points[X.index].id),qe!==void 0&&(Ve.id=qe),K.features.push(Ve)}}_limitZoom(w){return Math.max(this.options.minZoom,Math.min(Math.floor(+w),this.options.maxZoom+1))}_cluster(w,C){const R=[],{radius:B,extent:j,reduce:K,minPoints:W}=this.options,X=B/(j*Math.pow(2,C));for(let J=0;J<w.length;J++){const pe=w[J];if(pe.zoom<=C)continue;pe.zoom=C;const ve=this.trees[C+1],he=ve.within(pe.x,pe.y,X),Ve=pe.numPoints||1;let qe=Ve;for(const Le of he){const Je=ve.points[Le];Je.zoom>C&&(qe+=Je.numPoints||1)}if(qe>Ve&&qe>=W){let Le=pe.x*Ve,Je=pe.y*Ve,Qe=K&&Ve>1?this._map(pe,!0):null;const vt=(J<<5)+(C+1)+this.points.length;for(const it of he){const ut=ve.points[it];if(ut.zoom<=C)continue;ut.zoom=C;const bt=ut.numPoints||1;Le+=ut.x*bt,Je+=ut.y*bt,ut.parentId=vt,K&&(Qe||(Qe=this._map(pe,!0)),K(Qe,this._map(ut)))}pe.parentId=vt,R.push(Br(Le/qe,Je/qe,vt,qe,Qe))}else if(R.push(pe),qe>1)for(const Le of he){const Je=ve.points[Le];Je.zoom<=C||(Je.zoom=C,R.push(Je))}}return R}_getOriginId(w){return w-this.points.length>>5}_getOriginZoom(w){return(w-this.points.length)%32}_map(w,C){if(w.numPoints)return C?Or({},w.properties):w.properties;const R=this.points[w.index].properties,B=this.options.map(R);return C&&B===R?Or({},B):B}}function Br(O,w,C,R,B){return{x:br(O),y:br(w),zoom:1/0,id:C,parentId:-1,numPoints:R,properties:B}}function vn(O,w){const[C,R]=O.geometry.coordinates;return{x:br(yt(C)),y:br(dr(R)),zoom:1/0,index:w,parentId:-1}}function bn(O){return{type:"Feature",id:O.id,properties:Wn(O),geometry:{type:"Point",coordinates:[(w=O.x,360*(w-.5)),Fr(O.y)]}};var w}function Wn(O){const w=O.numPoints,C=w>=1e4?`${Math.round(w/1e3)}k`:w>=1e3?Math.round(w/100)/10+"k":w;return Or(Or({},O.properties),{cluster:!0,cluster_id:O.id,point_count:w,point_count_abbreviated:C})}function yt(O){return O/360+.5}function dr(O){const w=Math.sin(O*Math.PI/180),C=.5-.25*Math.log((1+w)/(1-w))/Math.PI;return C<0?0:C>1?1:C}function Fr(O){const w=(180-360*O)*Math.PI/180;return 360*Math.atan(Math.exp(w))/Math.PI-90}function Or(O,w){for(const C in w)O[C]=w[C];return O}function Hn(O){return O.x}function wr(O){return O.y}function Tr(O,w,C,R){for(var B,j=R,K=C-w>>1,W=C-w,X=O[w],J=O[w+1],pe=O[C],ve=O[C+1],he=w+3;he<C;he+=3){var Ve=wn(O[he],O[he+1],X,J,pe,ve);if(Ve>j)B=he,j=Ve;else if(Ve===j){var qe=Math.abs(he-K);qe<W&&(B=he,W=qe)}}j>R&&(B-w>3&&Tr(O,w,B,R),O[B+2]=j,C-B>3&&Tr(O,B,C,R))}function wn(O,w,C,R,B,j){var K=B-C,W=j-R;if(K!==0||W!==0){var X=((O-C)*K+(w-R)*W)/(K*K+W*W);X>1?(C=B,R=j):X>0&&(C+=K*X,R+=W*X)}return(K=O-C)*K+(W=w-R)*W}function Er(O,w,C,R){var B={id:O===void 0?null:O,type:w,geometry:C,tags:R,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(j){var K=j.geometry,W=j.type;if(W==="Point"||W==="MultiPoint"||W==="LineString")_e(j,K);else if(W==="Polygon"||W==="MultiLineString")for(var X=0;X<K.length;X++)_e(j,K[X]);else if(W==="MultiPolygon")for(X=0;X<K.length;X++)for(var J=0;J<K[X].length;J++)_e(j,K[X][J])}(B),B}function _e(O,w){for(var C=0;C<w.length;C+=3)O.minX=Math.min(O.minX,w[C]),O.minY=Math.min(O.minY,w[C+1]),O.maxX=Math.max(O.maxX,w[C]),O.maxY=Math.max(O.maxY,w[C+1])}function Me(O,w,C,R){if(w.geometry){var B=w.geometry.coordinates,j=w.geometry.type,K=Math.pow(C.tolerance/((1<<C.maxZoom)*C.extent),2),W=[],X=w.id;if(C.promoteId?X=w.properties[C.promoteId]:C.generateId&&(X=R||0),j==="Point")Jr(B,W);else if(j==="MultiPoint")for(var J=0;J<B.length;J++)Jr(B[J],W);else if(j==="LineString")ir(B,W,K,!1);else if(j==="MultiLineString"){if(C.lineMetrics){for(J=0;J<B.length;J++)ir(B[J],W=[],K,!1),O.push(Er(X,"LineString",W,w.properties));return}xt(B,W,K,!1)}else if(j==="Polygon")xt(B,W,K,!0);else{if(j!=="MultiPolygon"){if(j==="GeometryCollection"){for(J=0;J<w.geometry.geometries.length;J++)Me(O,{id:X,geometry:w.geometry.geometries[J],properties:w.properties},C,R);return}throw new Error("Input data is not a valid GeoJSON object.")}for(J=0;J<B.length;J++){var pe=[];xt(B[J],pe,K,!0),W.push(pe)}}O.push(Er(X,j,W,w.properties))}}function Jr(O,w){w.push(Ki(O[0])),w.push(Oi(O[1])),w.push(0)}function ir(O,w,C,R){for(var B,j,K=0,W=0;W<O.length;W++){var X=Ki(O[W][0]),J=Oi(O[W][1]);w.push(X),w.push(J),w.push(0),W>0&&(K+=R?(B*J-X*j)/2:Math.sqrt(Math.pow(X-B,2)+Math.pow(J-j,2))),B=X,j=J}var pe=w.length-3;w[2]=1,Tr(w,0,pe,C),w[pe+2]=1,w.size=Math.abs(K),w.start=0,w.end=w.size}function xt(O,w,C,R){for(var B=0;B<O.length;B++){var j=[];ir(O[B],j,C,R),w.push(j)}}function Ki(O){return O/360+.5}function Oi(O){var w=Math.sin(O*Math.PI/180),C=.5-.25*Math.log((1+w)/(1-w))/Math.PI;return C<0?0:C>1?1:C}function $i(O,w,C,R,B,j,K,W){if(R/=w,j>=(C/=w)&&K<R)return O;if(K<C||j>=R)return null;for(var X=[],J=0;J<O.length;J++){var pe=O[J],ve=pe.geometry,he=pe.type,Ve=B===0?pe.minX:pe.minY,qe=B===0?pe.maxX:pe.maxY;if(Ve>=C&&qe<R)X.push(pe);else if(!(qe<C||Ve>=R)){var Le=[];if(he==="Point"||he==="MultiPoint")$r(ve,Le,C,R,B);else if(he==="LineString")Ie(ve,Le,C,R,B,!1,W.lineMetrics);else if(he==="MultiLineString")ot(ve,Le,C,R,B,!1);else if(he==="Polygon")ot(ve,Le,C,R,B,!0);else if(he==="MultiPolygon")for(var Je=0;Je<ve.length;Je++){var Qe=[];ot(ve[Je],Qe,C,R,B,!0),Qe.length&&Le.push(Qe)}if(Le.length){if(W.lineMetrics&&he==="LineString"){for(Je=0;Je<Le.length;Je++)X.push(Er(pe.id,he,Le[Je],pe.tags));continue}he!=="LineString"&&he!=="MultiLineString"||(Le.length===1?(he="LineString",Le=Le[0]):he="MultiLineString"),he!=="Point"&&he!=="MultiPoint"||(he=Le.length===3?"Point":"MultiPoint"),X.push(Er(pe.id,he,Le,pe.tags))}}}return X.length?X:null}function $r(O,w,C,R,B){for(var j=0;j<O.length;j+=3){var K=O[j+B];K>=C&&K<=R&&(w.push(O[j]),w.push(O[j+1]),w.push(O[j+2]))}}function Ie(O,w,C,R,B,j,K){for(var W,X,J=ct(O),pe=B===0?Ur:rt,ve=O.start,he=0;he<O.length-3;he+=3){var Ve=O[he],qe=O[he+1],Le=O[he+2],Je=O[he+3],Qe=O[he+4],vt=B===0?Ve:qe,it=B===0?Je:Qe,ut=!1;K&&(W=Math.sqrt(Math.pow(Ve-Je,2)+Math.pow(qe-Qe,2))),vt<C?it>C&&(X=pe(J,Ve,qe,Je,Qe,C),K&&(J.start=ve+W*X)):vt>R?it<R&&(X=pe(J,Ve,qe,Je,Qe,R),K&&(J.start=ve+W*X)):fi(J,Ve,qe,Le),it<C&&vt>=C&&(X=pe(J,Ve,qe,Je,Qe,C),ut=!0),it>R&&vt<=R&&(X=pe(J,Ve,qe,Je,Qe,R),ut=!0),!j&&ut&&(K&&(J.end=ve+W*X),w.push(J),J=ct(O)),K&&(ve+=W)}var bt=O.length-3;Ve=O[bt],qe=O[bt+1],Le=O[bt+2],(vt=B===0?Ve:qe)>=C&&vt<=R&&fi(J,Ve,qe,Le),bt=J.length-3,j&&bt>=3&&(J[bt]!==J[0]||J[bt+1]!==J[1])&&fi(J,J[0],J[1],J[2]),J.length&&w.push(J)}function ct(O){var w=[];return w.size=O.size,w.start=O.start,w.end=O.end,w}function ot(O,w,C,R,B,j){for(var K=0;K<O.length;K++)Ie(O[K],w,C,R,B,j,!1)}function fi(O,w,C,R){O.push(w),O.push(C),O.push(R)}function Ur(O,w,C,R,B,j){var K=(j-w)/(R-w);return O.push(j),O.push(C+(B-C)*K),O.push(1),K}function rt(O,w,C,R,B,j){var K=(j-C)/(B-C);return O.push(w+(R-w)*K),O.push(j),O.push(1),K}function Sr(O,w){for(var C=[],R=0;R<O.length;R++){var B,j=O[R],K=j.type;if(K==="Point"||K==="MultiPoint"||K==="LineString")B=oi(j.geometry,w);else if(K==="MultiLineString"||K==="Polygon"){B=[];for(var W=0;W<j.geometry.length;W++)B.push(oi(j.geometry[W],w))}else if(K==="MultiPolygon")for(B=[],W=0;W<j.geometry.length;W++){for(var X=[],J=0;J<j.geometry[W].length;J++)X.push(oi(j.geometry[W][J],w));B.push(X)}C.push(Er(j.id,K,B,j.tags))}return C}function oi(O,w){var C=[];C.size=O.size,O.start!==void 0&&(C.start=O.start,C.end=O.end);for(var R=0;R<O.length;R+=3)C.push(O[R]+w,O[R+1],O[R+2]);return C}function Tn(O,w){if(O.transformed)return O;var C,R,B,j=1<<O.z,K=O.x,W=O.y;for(C=0;C<O.features.length;C++){var X=O.features[C],J=X.geometry,pe=X.type;if(X.geometry=[],pe===1)for(R=0;R<J.length;R+=2)X.geometry.push(Jt(J[R],J[R+1],w,j,K,W));else for(R=0;R<J.length;R++){var ve=[];for(B=0;B<J[R].length;B+=2)ve.push(Jt(J[R][B],J[R][B+1],w,j,K,W));X.geometry.push(ve)}}return O.transformed=!0,O}function Jt(O,w,C,R,B,j){return[Math.round(C*(O*R-B)),Math.round(C*(w*R-j))]}function Ti(O,w,C,R,B){for(var j=w===B.maxZoom?0:B.tolerance/((1<<w)*B.extent),K={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:C,y:R,z:w,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0},W=0;W<O.length;W++){K.numFeatures++,Pt(K,O[W],j,B);var X=O[W].minX,J=O[W].minY,pe=O[W].maxX,ve=O[W].maxY;X<K.minX&&(K.minX=X),J<K.minY&&(K.minY=J),pe>K.maxX&&(K.maxX=pe),ve>K.maxY&&(K.maxY=ve)}return K}function Pt(O,w,C,R){var B=w.geometry,j=w.type,K=[];if(j==="Point"||j==="MultiPoint")for(var W=0;W<B.length;W+=3)K.push(B[W]),K.push(B[W+1]),O.numPoints++,O.numSimplified++;else if(j==="LineString")En(K,B,O,C,!1,!1);else if(j==="MultiLineString"||j==="Polygon")for(W=0;W<B.length;W++)En(K,B[W],O,C,j==="Polygon",W===0);else if(j==="MultiPolygon")for(var X=0;X<B.length;X++){var J=B[X];for(W=0;W<J.length;W++)En(K,J[W],O,C,!0,W===0)}if(K.length){var pe=w.tags||null;if(j==="LineString"&&R.lineMetrics){for(var ve in pe={},w.tags)pe[ve]=w.tags[ve];pe.mapbox_clip_start=B.start/B.size,pe.mapbox_clip_end=B.end/B.size}var he={geometry:K,type:j==="Polygon"||j==="MultiPolygon"?3:j==="LineString"||j==="MultiLineString"?2:1,tags:pe};w.id!==null&&(he.id=w.id),O.features.push(he)}}function En(O,w,C,R,B,j){var K=R*R;if(R>0&&w.size<(B?K:R))C.numPoints+=w.length/3;else{for(var W=[],X=0;X<w.length;X+=3)(R===0||w[X+2]>K)&&(C.numSimplified++,W.push(w[X]),W.push(w[X+1])),C.numPoints++;B&&function(J,pe){for(var ve=0,he=0,Ve=J.length,qe=Ve-2;he<Ve;qe=he,he+=2)ve+=(J[he]-J[qe])*(J[he+1]+J[qe+1]);if(ve>0===pe)for(he=0,Ve=J.length;he<Ve/2;he+=2){var Le=J[he],Je=J[he+1];J[he]=J[Ve-2-he],J[he+1]=J[Ve-1-he],J[Ve-2-he]=Le,J[Ve-1-he]=Je}}(W,j),O.push(W)}}function fr(O,w){var C=(w=this.options=function(B,j){for(var K in j)B[K]=j[K];return B}(Object.create(this.options),w)).debug;if(C&&console.time("preprocess data"),w.maxZoom<0||w.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(w.promoteId&&w.generateId)throw new Error("promoteId and generateId cannot be used together.");var R=function(B,j){var K=[];if(B.type==="FeatureCollection")for(var W=0;W<B.features.length;W++)Me(K,B.features[W],j,W);else Me(K,B.type==="Feature"?B:{geometry:B},j);return K}(O,w);this.tiles={},this.tileCoords=[],C&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",w.indexMaxZoom,w.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),R=function(B,j){var K=j.buffer/j.extent,W=B,X=$i(B,1,-1-K,K,0,-1,2,j),J=$i(B,1,1-K,2+K,0,-1,2,j);return(X||J)&&(W=$i(B,1,-K,1+K,0,-1,2,j)||[],X&&(W=Sr(X,1).concat(W)),J&&(W=W.concat(Sr(J,-1)))),W}(R,w),R.length&&this.splitTile(R,0,0,0),C&&(R.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 Yr(O,w,C){return 32*((1<<O)*C+w)+O}function Qr(O,w){const C=O.tileID.canonical;if(!this._geoJSONIndex)return w(null,null);const R=this._geoJSONIndex.getTile(C.z,C.x,C.y);if(!R)return w(null,null);const B=new gt(R.features);let j=ti.exports(B);j.byteOffset===0&&j.byteLength===j.buffer.byteLength||(j=new Uint8Array(j)),w(null,{vectorTile:B,rawData:j.buffer})}fr.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},fr.prototype.splitTile=function(O,w,C,R,B,j,K){for(var W=[O,w,C,R],X=this.options,J=X.debug;W.length;){R=W.pop(),C=W.pop(),w=W.pop(),O=W.pop();var pe=1<<w,ve=Yr(w,C,R),he=this.tiles[ve];if(!he&&(J>1&&console.time("creation"),he=this.tiles[ve]=Ti(O,w,C,R,X),this.tileCoords.push({z:w,x:C,y:R}),J)){J>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",w,C,R,he.numFeatures,he.numPoints,he.numSimplified),console.timeEnd("creation"));var Ve="z"+w;this.stats[Ve]=(this.stats[Ve]||0)+1,this.total++}if(he.source=O,B){if(w===X.maxZoom||w===B)continue;var qe=1<<B-w;if(C!==Math.floor(j/qe)||R!==Math.floor(K/qe))continue}else if(w===X.indexMaxZoom||he.numPoints<=X.indexMaxPoints)continue;if(he.source=null,O.length!==0){J>1&&console.time("clipping");var Le,Je,Qe,vt,it,ut,bt=.5*X.buffer/X.extent,kt=.5-bt,si=.5+bt,$t=1+bt;Le=Je=Qe=vt=null,it=$i(O,pe,C-bt,C+si,0,he.minX,he.maxX,X),ut=$i(O,pe,C+kt,C+$t,0,he.minX,he.maxX,X),O=null,it&&(Le=$i(it,pe,R-bt,R+si,1,he.minY,he.maxY,X),Je=$i(it,pe,R+kt,R+$t,1,he.minY,he.maxY,X),it=null),ut&&(Qe=$i(ut,pe,R-bt,R+si,1,he.minY,he.maxY,X),vt=$i(ut,pe,R+kt,R+$t,1,he.minY,he.maxY,X),ut=null),J>1&&console.timeEnd("clipping"),W.push(Le||[],w+1,2*C,2*R),W.push(Je||[],w+1,2*C,2*R+1),W.push(Qe||[],w+1,2*C+1,2*R),W.push(vt||[],w+1,2*C+1,2*R+1)}}},fr.prototype.getTile=function(O,w,C){var R=this.options,B=R.extent,j=R.debug;if(O<0||O>24)return null;var K=1<<O,W=Yr(O,w=(w%K+K)%K,C);if(this.tiles[W])return Tn(this.tiles[W],B);j>1&&console.log("drilling down to z%d-%d-%d",O,w,C);for(var X,J=O,pe=w,ve=C;!X&&J>0;)J--,pe=Math.floor(pe/2),ve=Math.floor(ve/2),X=this.tiles[Yr(J,pe,ve)];return X&&X.source?(j>1&&console.log("found parent tile z%d-%d-%d",J,pe,ve),j>1&&console.time("drilling down"),this.splitTile(X.source,J,pe,ve,O,w,C),j>1&&console.timeEnd("drilling down"),this.tiles[W]?Tn(this.tiles[W],B):null):null};class Sn extends Ue{constructor(w,C,R,B){super(w,C,R,Qr),B&&(this.loadGeoJSON=B)}loadData(w,C){var R;(R=this._pendingRequest)===null||R===void 0||R.cancel(),this._pendingCallback&&this._pendingCallback(null,{abandoned:!0});const B=!!(w&&w.request&&w.request.collectResourceTiming)&&new a.RequestPerformance(w.request);this._pendingCallback=C,this._pendingRequest=this.loadGeoJSON(w,(j,K)=>{if(delete this._pendingCallback,delete this._pendingRequest,j||!K)return C(j);if(typeof K!="object")return C(new Error(`Input data given to '${w.source}' is not a valid GeoJSON object.`));{Ke(K,!0);try{if(w.filter){const X=a.createExpression(w.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(X.result==="error")throw new Error(X.value.map(pe=>`${pe.key}: ${pe.message}`).join(", "));const J=K.features.filter(pe=>X.value.evaluate({zoom:0},pe));K={type:"FeatureCollection",features:J}}this._geoJSONIndex=w.cluster?new Xn(function({superclusterOptions:X,clusterProperties:J}){if(!J||!X)return X;const pe={},ve={},he={accumulated:null,zoom:0},Ve={properties:null},qe=Object.keys(J);for(const Le of qe){const[Je,Qe]=J[Le],vt=a.createExpression(Qe),it=a.createExpression(typeof Je=="string"?[Je,["accumulated"],["get",Le]]:Je);pe[Le]=vt.value,ve[Le]=it.value}return X.map=Le=>{Ve.properties=Le;const Je={};for(const Qe of qe)Je[Qe]=pe[Qe].evaluate(he,Ve);return Je},X.reduce=(Le,Je)=>{Ve.properties=Je;for(const Qe of qe)he.accumulated=Le[Qe],Le[Qe]=ve[Qe].evaluate(he,Ve)},X}(w)).load(K.features):function(X,J){return new fr(X,J)}(K,w.geojsonVtOptions)}catch(X){return C(X)}this.loaded={};const W={};if(B){const X=B.finish();X&&(W.resourceTiming={},W.resourceTiming[w.source]=JSON.parse(JSON.stringify(X)))}C(null,W)}})}reloadTile(w,C){const R=this.loaded;return R&&R[w.uid]?super.reloadTile(w,C):this.loadTile(w,C)}loadGeoJSON(w,C){if(w.request)return a.getJSON(w.request,C);if(typeof w.data=="string")try{C(null,JSON.parse(w.data))}catch{C(new Error(`Input data given to '${w.source}' is not a valid GeoJSON object.`))}else C(new Error(`Input data given to '${w.source}' is not a valid GeoJSON object.`));return{cancel:()=>{}}}removeSource(w,C){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),C()}getClusterExpansionZoom(w,C){try{C(null,this._geoJSONIndex.getClusterExpansionZoom(w.clusterId))}catch(R){C(R)}}getClusterChildren(w,C){try{C(null,this._geoJSONIndex.getChildren(w.clusterId))}catch(R){C(R)}}getClusterLeaves(w,C){try{C(null,this._geoJSONIndex.getLeaves(w.clusterId,w.limit,w.offset))}catch(R){C(R)}}}class en{constructor(w){this.self=w,this.actor=new a.Actor(w,this),this.layerIndexes={},this.availableImages={},this.workerSourceTypes={vector:Ue,geojson:Sn},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(C,R)=>{if(this.workerSourceTypes[C])throw new Error(`Worker source with name "${C}" already registered.`);this.workerSourceTypes[C]=R},this.self.registerRTLTextPlugin=C=>{if(a.plugin.isParsed())throw new Error("RTL text plugin already registered.");a.plugin.applyArabicShaping=C.applyArabicShaping,a.plugin.processBidirectionalText=C.processBidirectionalText,a.plugin.processStyledBidirectionalText=C.processStyledBidirectionalText}}setReferrer(w,C){this.referrer=C}setImages(w,C,R){this.availableImages[w]=C;for(const B in this.workerSources[w]){const j=this.workerSources[w][B];for(const K in j)j[K].availableImages=C}R()}setLayers(w,C,R){this.getLayerIndex(w).replace(C),R()}updateLayers(w,C,R){this.getLayerIndex(w).update(C.layers,C.removedIds),R()}loadTile(w,C,R){this.getWorkerSource(w,C.type,C.source).loadTile(C,R)}loadDEMTile(w,C,R){this.getDEMWorkerSource(w,C.source).loadTile(C,R)}reloadTile(w,C,R){this.getWorkerSource(w,C.type,C.source).reloadTile(C,R)}abortTile(w,C,R){this.getWorkerSource(w,C.type,C.source).abortTile(C,R)}removeTile(w,C,R){this.getWorkerSource(w,C.type,C.source).removeTile(C,R)}removeDEMTile(w,C){this.getDEMWorkerSource(w,C.source).removeTile(C)}removeSource(w,C,R){if(!this.workerSources[w]||!this.workerSources[w][C.type]||!this.workerSources[w][C.type][C.source])return;const B=this.workerSources[w][C.type][C.source];delete this.workerSources[w][C.type][C.source],B.removeSource!==void 0?B.removeSource(C,R):R()}loadWorkerSource(w,C,R){try{this.self.importScripts(C.url),R()}catch(B){R(B.toString())}}syncRTLPluginState(w,C,R){try{a.plugin.setState(C);const B=a.plugin.getPluginURL();if(a.plugin.isLoaded()&&!a.plugin.isParsed()&&B!=null){this.self.importScripts(B);const j=a.plugin.isParsed();R(j?void 0:new Error(`RTL Text Plugin failed to import scripts from ${B}`),j)}}catch(B){R(B.toString())}}getAvailableImages(w){let C=this.availableImages[w];return C||(C=[]),C}getLayerIndex(w){let C=this.layerIndexes[w];return C||(C=this.layerIndexes[w]=new fe),C}getWorkerSource(w,C,R){if(this.workerSources[w]||(this.workerSources[w]={}),this.workerSources[w][C]||(this.workerSources[w][C]={}),!this.workerSources[w][C][R]){const B={send:(j,K,W)=>{this.actor.send(j,K,W,w)}};this.workerSources[w][C][R]=new this.workerSourceTypes[C](B,this.getLayerIndex(w),this.getAvailableImages(w))}return this.workerSources[w][C][R]}getDEMWorkerSource(w,C){return this.demWorkerSources[w]||(this.demWorkerSources[w]={}),this.demWorkerSources[w][C]||(this.demWorkerSources[w][C]=new et),this.demWorkerSources[w][C]}enforceCacheSizeLimit(w,C){a.enforceCacheSizeLimit(C)}}return a.isWorker()&&(self.worker=new en(self)),en}),N(["./shared"],function(a){var Y=te;function te(l){return!function(t){return typeof window=="undefined"||typeof document=="undefined"?"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}()?(fe[n=t&&t.failIfMajorPerformanceCaveat]===void 0&&(fe[n]=function(s){var u,p=function(f){var _=document.createElement("canvas"),y=Object.create(te.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{return!1}return!(!u||p.isContextLost())&&(p.shaderSource(u,"void main() {}"),p.compileShader(u),p.getShaderParameter(u,p.COMPILE_STATUS)===!0)}(n)),fe[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}(l)}var fe={};function ue(l,t){if(Array.isArray(l)){if(!Array.isArray(t)||l.length!==t.length)return!1;for(let n=0;n<l.length;n++)if(!ue(l[n],t[n]))return!1;return!0}if(typeof l=="object"&&l!==null&&t!==null){if(typeof t!="object"||Object.keys(l).length!==Object.keys(t).length)return!1;for(const n in l)if(!ue(l[n],t[n]))return!1;return!0}return l===t}te.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0};class ie{static testProp(t){if(!ie.docStyle)return t[0];for(let n=0;n<t.length;n++)if(t[n]in ie.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(){ie.docStyle&&ie.selectProp&&(ie.userSelect=ie.docStyle[ie.selectProp],ie.docStyle[ie.selectProp]="none")}static enableDrag(){ie.docStyle&&ie.selectProp&&(ie.docStyle[ie.selectProp]=ie.userSelect)}static setTransform(t,n){t.style[ie.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",ie.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",ie.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",ie.suppressClickInternal,!0)},0)}static mousePos(t,n){const s=t.getBoundingClientRect();return new a.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 a.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)}}ie.docStyle=typeof window!="undefined"&&window.document&&window.document.documentElement.style,ie.selectProp=ie.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),ie.transformProp=ie.testProp(["transform","WebkitTransform"]);class Ge{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($e);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 $e=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;class Ue{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||a.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:E}=s||{x:0,y:0};t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||a.isImageBitmap(t)?y.texSubImage2D(y.TEXTURE_2D,0,v,E,y.RGBA,y.UNSIGNED_BYTE,t):y.texSubImage2D(y.TEXTURE_2D,0,v,E,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 et(l){const{userImage:t}=l;return!!(t&&t.render&&t.render())&&(l.data.replace(new Uint8Array(t.data.buffer)),!0)}class Ke extends a.Evented{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new a.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 a.ErrorEvent(new Error(`Image "${t}" has invalid "stretchX" value`))),s=!1),this._validateStretch(n.stretchY,n.data&&n.data.height)||(this.fire(new a.ErrorEvent(new Error(`Image "${t}" has invalid "stretchY" value`))),s=!1),this._validateContent(n.content,n)||(this.fire(new a.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 a.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)}:a.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 a.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 Ue(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}=a.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,E=v.width,M=v.height;a.RGBAImage.copy(v,u,{x:0,y:0},{x:_,y},{width:E,height:M}),a.RGBAImage.copy(v,u,{x:0,y:M-1},{x:_,y:y-1},{width:E,height:1}),a.RGBAImage.copy(v,u,{x:0,y:0},{x:_,y:y+M},{width:E,height:1}),a.RGBAImage.copy(v,u,{x:E-1,y:0},{x:_-1,y},{width:1,height:M}),a.RGBAImage.copy(v,u,{x:0,y:0},{x:_+E,y},{width:1,height:M})}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||a.warnOnce(`Image with ID: "${n}" was not found`),et(s)&&this.updateImage(n,s)}}}const tt=1e20;function lt(l,t,n,s,u,p,f,_,y){for(let v=t;v<t+s;v++)It(l,n*p+v,p,u,f,_,y);for(let v=n;v<n+u;v++)It(l,v*p+t,1,s,f,_,y)}function It(l,t,n,s,u,p,f){p[0]=0,f[0]=-tt,f[1]=tt,u[0]=l[t];for(let _=1,y=0,v=0;_<s;_++){u[_]=l[t+_*n];const E=_*_;do{const M=p[y];v=(u[_]-u[M]+E-M*M)/(_-M)/2}while(v<=f[y]&&--y>-1);y++,p[y]=_,f[y]=v,f[y+1]=tt}for(let _=0,y=0;_<s;_++){for(;f[y+1]<_;)y++;const v=p[y],E=_-v;l[t+_*n]=u[v]+E*E}}class at{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});a.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 E=_.requests[v];E||(E=_.requests[v]=[],at.loadGlyphRange(u,v,this.url,this.requestManager,(M,z)=>{if(z){for(const V in z)this._doesCharSupportLocalGlyph(+V)||(_.glyphs[+V]=z[+V]);_.ranges[v]=!0}for(const V of E)V(M,z);delete _.requests[v]})),E.push((M,z)=>{M?f(M):z&&f(null,{stack:u,id:p,glyph:z[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&&(a.unicodeBlockLookup["CJK Unified Ideographs"](t)||a.unicodeBlockLookup["Hangul Syllables"](t)||a.unicodeBlockLookup.Hiragana(t)||a.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 at.TinySDF({fontSize:24,buffer:3,radius:8,cutoff:.25,fontFamily:u,fontWeight:_})}const f=p.draw(String.fromCharCode(s));return{id:s,bitmap:new a.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}}}}at.loadGlyphRange=function(l,t,n,s,u){const p=256*t,f=p+255,_=s.transformRequest(n.replace("{fontstack}",l).replace("{range}",`${p}-${f}`),a.ResourceType.Glyphs);a.getArrayBuffer(_,(y,v)=>{if(y)u(y);else if(v){const E={};for(const M of a.parseGlyphPbf(v))E[M.id]=M;u(null,E)}})},at.TinySDF=class{constructor({fontSize:l=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=l+4*t,y=this._createCanvas(_),v=this.ctx=y.getContext("2d",{willReadFrequently:!0});v.font=`${f} ${p} ${l}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(l){const t=document.createElement("canvas");return t.width=t.height=l,t}draw(l){const{width:t,actualBoundingBoxAscent:n,actualBoundingBoxDescent:s,actualBoundingBoxLeft:u,actualBoundingBoxRight:p}=this.ctx.measureText(l),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,E=y+2*this.buffer,M=Math.max(v*E,0),z=new Uint8ClampedArray(M),V={data:z,width:v,height:E,glyphWidth:_,glyphHeight:y,glyphTop:f,glyphLeft:0,glyphAdvance:t};if(_===0||y===0)return V;const{ctx:$,buffer:U,gridInner:H,gridOuter:Q}=this;$.clearRect(U,U,_,y),$.fillText(l,U,U+f);const ne=$.getImageData(U,U,_,y);Q.fill(tt,0,M),H.fill(0,0,M);for(let G=0;G<y;G++)for(let le=0;le<_;le++){const se=ne.data[4*(G*_+le)+3]/255;if(se===0)continue;const me=(G+U)*v+le+U;if(se===1)Q[me]=0,H[me]=tt;else{const ge=.5-se;Q[me]=ge>0?ge*ge:0,H[me]=ge<0?ge*ge:0}}lt(Q,0,0,v,E,v,this.f,this.v,this.z),lt(H,U,U,_,y,v,this.f,this.v,this.z);for(let G=0;G<M;G++){const le=Math.sqrt(Q[G])-Math.sqrt(H[G]);z[G]=Math.round(255-255*(le/this.radius+this.cutoff))}return V}};const gt=new a.Properties({anchor:new a.DataConstantProperty(a.spec.light.anchor),position:new class{constructor(){this.specification=a.spec.light.position}possiblyEvaluate(l,t){return a.sphericalToCartesian(l.expression.evaluate(t))}interpolate(l,t,n){return{x:a.number(l.x,t.x,n),y:a.number(l.y,t.y,n),z:a.number(l.z,t.z,n)}}},color:new a.DataConstantProperty(a.spec.light.color),intensity:new a.DataConstantProperty(a.spec.light.intensity)}),ti="-transition";class Kt extends a.Evented{constructor(t){super(),this._transitionable=new a.Transitionable(gt),this.setLight(t),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(t,n={}){if(!this._validate(a.validateLight,t,n))for(const s in t){const u=t[s];s.endsWith(ti)?this._transitionable.setTransition(s.slice(0,-ti.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)&&a.emitValidationErrors(this,t.call(a.validateStyle,a.extend({value:n,style:{glyphs:!0,sprite:!0},styleSpec:a.spec})))}}class ur{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 E=t[v];p=y*s,y+=E,f=y*s,u.push({left:p,right:f,isDash:_,zeroLength:E===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 E=Math.abs(v-y.left),M=Math.abs(v-y.right),z=Math.min(E,M);let V;const $=p/s*(u+1);if(y.isDash){const U=u-Math.abs($);V=Math.sqrt(z*z+U*U)}else V=u-Math.sqrt(z*z+$*$);this.data[f+v]=Math.max(0,Math.min(255,V+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),E=Math.min(y,v);this.data[u+_]=Math.max(0,Math.min(255,(f.isDash?E:-E)+128))}}addDash(t,n){const s=n?7:0,u=2*s+1;if(this.nextRow+u>this.height)return a.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 Wi{constructor(t,n){this.workerPool=t,this.actors=[],this.currentActor=0,this.id=a.uniqueId();const s=this.workerPool.acquire(this.id);for(let u=0;u<s.length;u++){const p=new Wi.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){a.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 hr(l,t,n){const s=function(u,p){if(u)return n(u);if(p){const f=a.pick(a.extend(p,l),["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 l.url?a.getJSON(t.transformRequest(l.url,a.ResourceType.Source),s):a.exported.frame(()=>s(null,l))}Wi.Actor=a.Actor;class Hi{constructor(t,n,s){this.bounds=a.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(a.mercatorXfromLng(this.bounds.getWest())*n),u=Math.floor(a.mercatorYfromLat(this.bounds.getNorth())*n),p=Math.ceil(a.mercatorXfromLng(this.bounds.getEast())*n),f=Math.ceil(a.mercatorYfromLat(this.bounds.getSouth())*n);return t.x>=s&&t.x<p&&t.y>=u&&t.y<f}}class Rt extends a.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,a.extend(this,a.pick(n,["url","scheme","tileSize","promoteId"])),this._options=a.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 a.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=hr(this._options,this.map._requestManager,(t,n)=>{this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),t?this.fire(new a.ErrorEvent(t)):n&&(a.extend(this,n),n.bounds&&(this.tileBounds=new Hi(n.bounds,this.minzoom,this.maxzoom)),this.fire(new a.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new a.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 a.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,a.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),a.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 pi extends a.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=a.extend({type:"raster"},n),a.extend(this,a.pick(n,["url","scheme","tileSize"]))}load(){this._loaded=!1,this.fire(new a.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=hr(this._options,this.map._requestManager,(t,n)=>{this._tileJSONRequest=null,this._loaded=!0,t?this.fire(new a.ErrorEvent(t)):n&&(a.extend(this,n),n.bounds&&(this.tileBounds=new Hi(n.bounds,this.minzoom,this.maxzoom)),this.fire(new a.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new a.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 a.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=a.getImage(this.map._requestManager.transformRequest(s,a.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 Ue(_,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",a.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 di;class Xe extends pi{constructor(t,n,s,u){super(t,n,s,u),this.type="raster-dem",this.maxzoom=22,this._options=a.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=a.getImage(this.map._requestManager.transformRequest(s,a.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 _=a.isImageBitmap(f)&&(di==null&&(di=typeof OffscreenCanvas!="undefined"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),di)?f:a.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 a.OverscaledTileID(t.overscaledZ,p,n.z,u,n.y).key]={backfilled:!1},y[new a.OverscaledTileID(t.overscaledZ,_,n.z,f,n.y).key]={backfilled:!1},n.y>0&&(y[new a.OverscaledTileID(t.overscaledZ,p,n.z,u,n.y-1).key]={backfilled:!1},y[new a.OverscaledTileID(t.overscaledZ,t.wrap,n.z,n.x,n.y-1).key]={backfilled:!1},y[new a.OverscaledTileID(t.overscaledZ,_,n.z,f,n.y-1).key]={backfilled:!1}),n.y+1<s&&(y[new a.OverscaledTileID(t.overscaledZ,p,n.z,u,n.y+1).key]={backfilled:!1},y[new a.OverscaledTileID(t.overscaledZ,t.wrap,n.z,n.x,n.y+1).key]={backfilled:!1},y[new a.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 Bi extends a.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=a.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=a.EXTENT/this.tileSize;this.workerOptions=a.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:a.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:a.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=a.extend({},this.workerOptions),s=this._data;typeof s=="string"?(n.request=this.map._requestManager.transformRequest(a.exported.resolveURL(s),a.ResourceType.Source),n.request.collectResourceTiming=this._collectResourceTiming):n.data=JSON.stringify(s),this._pendingLoads++,this.fire(new a.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 a.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 a.ErrorEvent(u));const _={dataType:"source",sourceDataType:t};this._collectResourceTiming&&f&&f.length>0&&a.extend(_,{resourceTiming:f}),this.fire(new a.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 a.extend({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var wi=a.createLayout([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class Ci extends a.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 a.Event("dataloading",{dataType:"source"})),this.url=this.options.url,a.getImage(this.map._requestManager.transformRequest(this.url,a.ResourceType.Image),(s,u)=>{this._loaded=!0,s?this.fire(new a.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 a.Event("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(t){this.map=t,this.load()}setCoordinates(t){this.coordinates=t;const n=t.map(a.MercatorCoordinate.fromLngLat);this.tileID=function(u){let p=1/0,f=1/0,_=-1/0,y=-1/0;for(const z of u)p=Math.min(p,z.x),f=Math.min(f,z.y),_=Math.max(_,z.x),y=Math.max(y,z.y);const v=Math.max(_-p,y-f),E=Math.max(0,Math.floor(-Math.log(v)/Math.LN2)),M=Math.pow(2,E);return new a.CanonicalTileID(E,Math.floor((p+_)/2*M),Math.floor((f+y)/2*M))}(n),this.minzoom=this.maxzoom=this.tileID.z;const s=n.map(u=>this.tileID.getTilePoint(u)._round());return this._boundsArray=new a.RasterBoundsArray,this._boundsArray.emplaceBack(s[0].x,s[0].y,0,0),this._boundsArray.emplaceBack(s[1].x,s[1].y,a.EXTENT,0),this._boundsArray.emplaceBack(s[3].x,s[3].y,0,a.EXTENT),this._boundsArray.emplaceBack(s[2].x,s[2].y,a.EXTENT,a.EXTENT),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new a.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,wi.members)),this.boundsSegments||(this.boundsSegments=a.SegmentVector.simpleSegment(0,0,4,2)),this.texture||(this.texture=new Ue(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 Ai extends Ci{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,a.ResourceType.Source).url);a.getVideo(this.urls,(n,s)=>{this._loaded=!0,n?this.fire(new a.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 a.ErrorEvent(new a.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,wi.members)),this.boundsSegments||(this.boundsSegments=a.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 Ue(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 Kr extends Ci{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 a.ErrorEvent(new a.ValidationError(`sources.${t}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new a.ErrorEvent(new a.ValidationError(`sources.${t}`,null,'missing required property "coordinates"'))),n.animate&&typeof n.animate!="boolean"&&this.fire(new a.ErrorEvent(new a.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 a.ErrorEvent(new a.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 a.ErrorEvent(new a.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 a.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,wi.members)),this.boundsSegments||(this.boundsSegments=a.SegmentVector.simpleSegment(0,0,4,2)),this.texture?(t||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new Ue(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 gn={vector:Rt,raster:pi,"raster-dem":Xe,geojson:Bi,video:Ai,image:Ci,canvas:Kr};function _n(l,t){const n=a.create();return a.translate(n,n,[1,1,0]),a.scale(n,n,[.5*l.width,.5*l.height,1]),a.multiply(n,n,l.calculatePosMatrix(t.toUnwrapped()))}function yn(l,t,n,s,u,p){const f=function(M,z,V){if(M)for(const $ of M){const U=z[$];if(U&&U.source===V&&U.type==="fill-extrusion")return!0}else for(const $ in z){const U=z[$];if(U.source===V&&U.type==="fill-extrusion")return!0}return!1}(u&&u.layers,t,l.id),_=p.maxPitchScaleFactor(),y=l.tilesIn(s,_,f);y.sort(pr);const v=[];for(const M of y)v.push({wrappedTileID:M.tileID.wrapped().key,queryResults:M.tile.queryRenderedFeatures(t,n,l._state,M.queryGeometry,M.cameraQueryGeometry,M.scale,u,p,_,_n(l.transform,M.tileID))});const E=function(M){const z={},V={};for(const $ of M){const U=$.queryResults,H=$.wrappedTileID,Q=V[H]=V[H]||{};for(const ne in U){const G=U[ne],le=Q[ne]=Q[ne]||{},se=z[ne]=z[ne]||[];for(const me of G)le[me.featureIndex]||(le[me.featureIndex]=!0,se.push(me))}}return z}(v);for(const M in E)E[M].forEach(z=>{const V=z.feature,$=l.getFeatureState(V.layer["source-layer"],V.id);V.source=V.layer.source,V.layer["source-layer"]&&(V.sourceLayer=V.layer["source-layer"]),V.state=$});return E}function pr(l,t){const n=l.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 Dr{constructor(t,n){this.tileID=t,this.uid=a.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<a.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(E=>E.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 a.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 a.SymbolBucket&&p.hasRTLText){this.hasRTLText=!0,a.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 a.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 Ue(t,this.imageAtlas.image,n.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new Ue(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,E){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:u,cameraQueryGeometry:p,scale:f,tileSize:this.tileSize,pixelPosMatrix:E,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 _=a.createFilter(n&&n.filter),{z:y,x:v,y:E}=this.tileID.canonical,M={z:y,x:v,y:E};for(let z=0;z<f.length;z++){const V=f.feature(z);if(_.needGeometry){const H=a.toEvaluationFeature(V,!0);if(!_.filter(new a.EvaluationParameters(this.tileID.overscaledZ),H,this.tileID.canonical))continue}else if(!_.filter(new a.EvaluationParameters(this.tileID.overscaledZ),V))continue;const $=s.getId(V,p),U=new a.GeoJSONFeature(V,y,v,E,$);U.tile=M,t.push(U)}}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=a.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<a.exported.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(t){this.symbolFadeHoldUntil=a.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 Lr{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 Rr{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]||{},a.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=a.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]={}),a.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]||{},a.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 Mi extends a.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 gn[p.type](u,p,f,_);if(y.id!==u)throw new Error(`Expected Source id to be ${u} instead of ${y.id}`);return a.bindAll(["load","abort","unload","serialize","prepare"],y),y}(t,n,s,this),this._tiles={},this._cache=new Lr(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new Rr}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 a.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(xn).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 a.pointGeometry(p.canonical.x,p.canonical.y)._rotate(this.transform.angle),y=new a.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(xn).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 a.ErrorEvent(u,{tile:t})):this.update(this.transform,this.terrain));t.timeAdded=a.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 a.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 a.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-Mi.maxOverzooming,this._source.minzoom),f=Math.max(u+Mi.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const v={};for(const E of s)if(E.canonical.z>this._source.minzoom){const M=E.scaledTo(E.canonical.z-1);v[M.key]=M;const z=E.scaledTo(Math.max(this._source.minzoom,Math.min(E.canonical.z,5)));v[z.key]=z}s=s.concat(Object.values(v))}const _=this._updateRetainedTiles(s,u);if(jn(this._source.type)){const v={},E={},M=Object.keys(_);for(const z of M){const V=_[z],$=this._tiles[z];if(!$||$.fadeEndTime&&$.fadeEndTime<=a.exported.now())continue;const U=this.findLoadedParent(V,p);U&&(this._addTile(U.tileID),v[U.tileID.key]=U.tileID),E[z]=V}this._retainLoadedChildren(E,u,f,_);for(const z in v)_[z]||(this._coveredTiles[z]=!0,_[z]=v[z]);if(n){const z={},V={};for(const $ of s)this._tiles[$.key].hasData()?z[$.key]=$:V[$.key]=$;for(const $ in V){const U=V[$].children(this._source.maxzoom);this._tiles[U[0].key]&&this._tiles[U[1].key]&&this._tiles[U[2].key]&&this._tiles[U[3].key]&&(z[U[0].key]=_[U[0].key]=U[0],z[U[1].key]=_[U[1].key]=U[1],z[U[2].key]=_[U[2].key]=U[2],z[U[3].key]=_[U[3].key]=U[3],delete V[$])}for(const $ in V){const U=this.findLoadedParent(V[$],this._source.minzoom);if(U){z[U.tileID.key]=_[U.tileID.key]=U.tileID;for(const H in z)z[H].isChildOf(U.tileID)&&delete z[H]}}for(const $ in this._tiles)z[$]||(this._coveredTiles[$]=!0)}}for(const v in _)this._tiles[v].clearFadeHold();const y=a.keysDifference(this._tiles,_);for(const v of y){const E=this._tiles[v];E.hasSymbolBuckets&&!E.holdingForFade()?E.setHoldDuration(this.map._fadeDuration):E.hasSymbolBuckets&&!E.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-Mi.maxOverzooming,this._source.minzoom),f=Math.max(n+Mi.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 M=y.children(this._source.maxzoom)[0],z=this.getTile(M);if(z&&z.hasData()){s[M.key]=M;continue}}else{const M=y.children(this._source.maxzoom);if(s[M[0].key]&&s[M[1].key]&&s[M[2].key]&&s[M[3].key])continue}let E=v.wasRequested();for(let M=y.overscaledZ-1;M>=p;--M){const z=y.scaledTo(M);if(u[z.key]||(u[z.key]=!0,v=this.getTile(z),!v&&E&&(v=this._addTile(z)),v&&(s[z.key]=z,E=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 Dr(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 a.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($=>p.pointCoordinate($,this.terrain)),y=f.map($=>p.pointCoordinate($,this.terrain)),v=this.getIds();let E=1/0,M=1/0,z=-1/0,V=-1/0;for(const $ of y)E=Math.min(E,$.x),M=Math.min(M,$.y),z=Math.max(z,$.x),V=Math.max(V,$.y);for(let $=0;$<v.length;$++){const U=this._tiles[v[$]];if(U.holdingForFade())continue;const H=U.tileID,Q=Math.pow(2,p.zoom-U.tileID.overscaledZ),ne=n*U.queryPadding*a.EXTENT/U.tileSize/Q,G=[H.getTilePoint(new a.MercatorCoordinate(E,M)),H.getTilePoint(new a.MercatorCoordinate(z,V))];if(G[0].x-ne<a.EXTENT&&G[0].y-ne<a.EXTENT&&G[1].x+ne>=0&&G[1].y+ne>=0){const le=_.map(me=>H.getTilePoint(me)),se=y.map(me=>H.getTilePoint(me));u.push({tile:U,tileID:H,queryGeometry:le,cameraQueryGeometry:se,scale:Q})}}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(jn(this._source.type))for(const t in this._tiles){const n=this._tiles[t];if(n.fadeEndTime!==void 0&&n.fadeEndTime>=a.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 xn(l,t){const n=Math.abs(2*l.wrap)-+(l.wrap<0),s=Math.abs(2*t.wrap)-+(t.wrap<0);return l.overscaledZ-t.overscaledZ||s-n||t.canonical.y-l.canonical.y||t.canonical.x-l.canonical.x}function jn(l){return l==="raster"||l==="image"||l==="video"}Mi.maxOverzooming=10,Mi.maxUnderzooming=3;const br="mapboxgl_preloaded_worker_pool";class Fi{constructor(){this.active={}}acquire(t){if(!this.workers)for(this.workers=[];this.workers.length<Fi.workerCount;)this.workers.push(new Worker(sn.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[br]}numActive(){return Object.keys(this.active).length}}const Xn=Math.floor(a.exported.hardwareConcurrency/2);let Br;function vn(){return Br||(Br=new Fi),Br}function bn(l,t){const n={};for(const s in l)s!=="ref"&&(n[s]=l[s]);return a.refProperties.forEach(s=>{s in t&&(n[s]=t[s])}),n}function Wn(l){l=l.slice();const t=Object.create(null);for(let n=0;n<l.length;n++)t[l[n].id]=l[n];for(let n=0;n<l.length;n++)"ref"in l[n]&&(l[n]=bn(l[n],t[l[n].ref]));return l}Fi.workerCount=Math.max(Math.min(Xn,6),1);const yt={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 dr(l,t,n){n.push({command:yt.addSource,args:[l,t[l]]})}function Fr(l,t,n){t.push({command:yt.removeSource,args:[l]}),n[l]=!0}function Or(l,t,n,s){Fr(l,n,s),dr(l,t,n)}function Hn(l,t,n){let s;for(s in l[n])if(Object.prototype.hasOwnProperty.call(l[n],s)&&s!=="data"&&!ue(l[n][s],t[n][s]))return!1;for(s in t[n])if(Object.prototype.hasOwnProperty.call(t[n],s)&&s!=="data"&&!ue(l[n][s],t[n][s]))return!1;return!0}function wr(l,t,n,s,u,p){let f;for(f in t=t||{},l=l||{})Object.prototype.hasOwnProperty.call(l,f)&&(ue(l[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(l,f)&&(ue(l[f],t[f])||n.push({command:p,args:[s,f,t[f],u]}))}function Tr(l){return l.id}function wn(l,t){return l[t.id]=t,l}class Er{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=a.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 _e(l,t){let n=!0;return l==="always"||l!=="never"&&t!=="never"||(n=!1),n}class Me{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 E=this.circles[3*v],M=this.circles[3*v+1],z=this.circles[3*v+2];y.push({key:this.circleKeys[v],x1:E-z,y1:M-z,x2:E+z,y2:M+z})}}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 E=[];return this._forEachCell(f,y,_,v,this._queryCellCircle,E,{hitTest:!0,overlapMode:u,circle:{x:t,y:n,radius:s},seenUids:{box:{},circle:{}}},p),E.length>0}_queryCell(t,n,s,u,p,f,_,y){const{seenUids:v,hitTest:E,overlapMode:M}=_,z=this.boxCells[p];if(z!==null){const $=this.bboxes;for(const U of z)if(!v.box[U]){v.box[U]=!0;const H=4*U,Q=this.boxKeys[U];if(t<=$[H+2]&&n<=$[H+3]&&s>=$[H+0]&&u>=$[H+1]&&(!y||y(Q))&&(!E||!_e(M,Q.overlapMode))&&(f.push({key:Q,x1:$[H],y1:$[H+1],x2:$[H+2],y2:$[H+3]}),E))return!0}}const V=this.circleCells[p];if(V!==null){const $=this.circles;for(const U of V)if(!v.circle[U]){v.circle[U]=!0;const H=3*U,Q=this.circleKeys[U];if(this._circleAndRectCollide($[H],$[H+1],$[H+2],t,n,s,u)&&(!y||y(Q))&&(!E||!_e(M,Q.overlapMode))){const ne=$[H],G=$[H+1],le=$[H+2];if(f.push({key:Q,x1:ne-le,y1:G-le,x2:ne+le,y2:G+le}),E)return!0}}}return!1}_queryCellCircle(t,n,s,u,p,f,_,y){const{circle:v,seenUids:E,overlapMode:M}=_,z=this.boxCells[p];if(z!==null){const $=this.bboxes;for(const U of z)if(!E.box[U]){E.box[U]=!0;const H=4*U,Q=this.boxKeys[U];if(this._circleAndRectCollide(v.x,v.y,v.radius,$[H+0],$[H+1],$[H+2],$[H+3])&&(!y||y(Q))&&!_e(M,Q.overlapMode))return f.push(!0),!0}}const V=this.circleCells[p];if(V!==null){const $=this.circles;for(const U of V)if(!E.circle[U]){E.circle[U]=!0;const H=3*U,Q=this.circleKeys[U];if(this._circlesCollide($[H],$[H+1],$[H+2],v.x,v.y,v.radius)&&(!y||y(Q))&&!_e(M,Q.overlapMode))return f.push(!0),!0}}}_forEachCell(t,n,s,u,p,f,_,y){const v=this._convertToXCellCoord(t),E=this._convertToYCellCoord(n),M=this._convertToXCellCoord(s),z=this._convertToYCellCoord(u);for(let V=v;V<=M;V++)for(let $=E;$<=z;$++)if(p.call(this,t,n,s,u,this.xCellCount*$+V,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 E=(_-p)/2,M=Math.abs(n-(p+E));if(M>E+s)return!1;if(v<=y||M<=E)return!0;const z=v-y,V=M-E;return z*z+V*V<=s*s}}function Jr(l,t,n,s,u){const p=a.create();return t?(a.scale(p,p,[1/u,1/u,1]),n||a.rotateZ(p,p,s.angle)):a.multiply(p,s.labelPlaneMatrix,l),p}function ir(l,t,n,s,u){if(t){const p=a.clone(l);return a.scale(p,p,[u,u,1]),n||a.rotateZ(p,p,-s.angle),p}return s.glCoordMatrix}function xt(l,t,n){let s;n?(s=[l.x,l.y,n(l.x,l.y),1],a.transformMat4(s,s,t)):(s=[l.x,l.y,0,1],Sr(s,s,t));const u=s[3];return{point:new a.pointGeometry(s[0]/u,s[1]/u),signedDistanceFromCamera:u}}function Ki(l,t){return .5+l/t*.5}function Oi(l,t){const n=l[0]/l[3],s=l[1]/l[3];return n>=-t[0]&&n<=t[0]&&s>=-t[1]&&s<=t[1]}function $i(l,t,n,s,u,p,f,_,y,v){const E=s?l.textSizeData:l.iconSizeData,M=a.evaluateSizeForZoom(E,n.transform.zoom),z=[256/n.width*2+1,256/n.height*2+1],V=s?l.text.dynamicLayoutVertexArray:l.icon.dynamicLayoutVertexArray;V.clear();const $=l.lineVertexArray,U=s?l.text.placedSymbolArray:l.icon.placedSymbolArray,H=n.transform.width/n.transform.height;let Q=!1;for(let ne=0;ne<U.length;ne++){const G=U.get(ne);if(G.hidden||G.writingMode===a.WritingMode.vertical&&!Q){rt(G.numGlyphs,V);continue}let le;if(Q=!1,v?(le=[G.anchorX,G.anchorY,v(G.anchorX,G.anchorY),1],a.transformMat4(le,le,t)):(le=[G.anchorX,G.anchorY,0,1],Sr(le,le,t)),!Oi(le,z)){rt(G.numGlyphs,V);continue}const se=Ki(n.transform.cameraToCenterDistance,le[3]),me=a.evaluateSizeForFeature(E,M,G),ge=f?me/se:me*se,be=new a.pointGeometry(G.anchorX,G.anchorY),de=xt(be,u,v).point,Re={},Ce=ct(G,ge,!1,_,t,u,p,l.glyphOffsetArray,$,V,de,be,Re,H,y,v);Q=Ce.useVertical,(Ce.notEnoughRoom||Q||Ce.needsFlipping&&ct(G,ge,!0,_,t,u,p,l.glyphOffsetArray,$,V,de,be,Re,H,y,v).notEnoughRoom)&&rt(G.numGlyphs,V)}s?l.text.dynamicLayoutVertexBuffer.updateData(V):l.icon.dynamicLayoutVertexBuffer.updateData(V)}function $r(l,t,n,s,u,p,f,_,y,v,E,M,z){const V=_.glyphStartIndex+_.numGlyphs,$=_.lineStartIndex,U=_.lineStartIndex+_.lineLength,H=t.getoffsetX(_.glyphStartIndex),Q=t.getoffsetX(V-1),ne=fi(l*H,n,s,u,p,f,_.segment,$,U,y,v,E,M,z);if(!ne)return null;const G=fi(l*Q,n,s,u,p,f,_.segment,$,U,y,v,E,M,z);return G?{first:ne,last:G}:null}function Ie(l,t,n,s){return l===a.WritingMode.horizontal&&Math.abs(n.y-t.y)>Math.abs(n.x-t.x)*s?{useVertical:!0}:(l===a.WritingMode.vertical?t.y<n.y:t.x>n.x)?{needsFlipping:!0}:null}function ct(l,t,n,s,u,p,f,_,y,v,E,M,z,V,$,U){const H=t/24,Q=l.lineOffsetX*H,ne=l.lineOffsetY*H;let G;if(l.numGlyphs>1){const le=l.glyphStartIndex+l.numGlyphs,se=l.lineStartIndex,me=l.lineStartIndex+l.lineLength,ge=$r(H,_,Q,ne,n,E,M,l,y,p,z,$,U);if(!ge)return{notEnoughRoom:!0};const be=xt(ge.first.point,f,U).point,de=xt(ge.last.point,f,U).point;if(s&&!n){const Re=Ie(l.writingMode,be,de,V);if(Re)return Re}G=[ge.first];for(let Re=l.glyphStartIndex+1;Re<le-1;Re++)G.push(fi(H*_.getoffsetX(Re),Q,ne,n,E,M,l.segment,se,me,y,p,z,$,U));G.push(ge.last)}else{if(s&&!n){const se=xt(M,u,U).point,me=l.lineStartIndex+l.segment+1,ge=new a.pointGeometry(y.getx(me),y.gety(me)),be=xt(ge,u,U),de=be.signedDistanceFromCamera>0?be.point:ot(M,ge,se,1,u,U),Re=Ie(l.writingMode,se,de,V);if(Re)return Re}const le=fi(H*_.getoffsetX(l.glyphStartIndex),Q,ne,n,E,M,l.segment,l.lineStartIndex,l.lineStartIndex+l.lineLength,y,p,z,$,U);if(!le)return{notEnoughRoom:!0};G=[le]}for(const le of G)a.addDynamicAttributes(v,le.point,le.angle);return{}}function ot(l,t,n,s,u,p){const f=xt(l.add(l.sub(t)._unit()),u,p).point,_=n.sub(f);return n.add(_._mult(s/_.mag()))}function fi(l,t,n,s,u,p,f,_,y,v,E,M,z,V){const $=s?l-t:l+t;let U=$>0?1:-1,H=0;s&&(U*=-1,H=Math.PI),U<0&&(H+=Math.PI);let Q=U>0?_+f:_+f+1,ne=u,G=u,le=0,se=0;const me=Math.abs($),ge=[];for(;le+se<=me;){if(Q+=U,Q<_||Q>=y)return null;if(G=ne,ge.push(ne),ne=M[Q],ne===void 0){const Be=new a.pointGeometry(v.getx(Q),v.gety(Q)),st=xt(Be,E,V);if(st.signedDistanceFromCamera>0)ne=M[Q]=st.point;else{const ht=Q-U;ne=ot(le===0?p:new a.pointGeometry(v.getx(ht),v.gety(ht)),Be,G,me-le+1,E,V)}}le+=se,se=G.dist(ne)}const be=(me-le)/se,de=ne.sub(G),Re=de.mult(be)._add(G);Re._add(de._unit()._perp()._mult(n*U));const Ce=H+Math.atan2(ne.y-G.y,ne.x-G.x);return ge.push(Re),{point:Re,angle:z?Ce:0,path:ge}}const Ur=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function rt(l,t){for(let n=0;n<l;n++){const s=t.length;t.resize(s+4),t.float32.set(Ur,3*s)}}function Sr(l,t,n){const s=t[0],u=t[1];return l[0]=n[0]*s+n[4]*u+n[12],l[1]=n[1]*s+n[5]*u+n[13],l[3]=n[3]*s+n[7]*u+n[15],l}const oi=100;class Tn{constructor(t,n=new Me(t.width+200,t.height+200,25),s=new Me(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+oi,this.screenBottomBoundary=t.height+oi,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,E=t.y1*y+_.point.y,M=t.x2*y+_.point.x,z=t.y2*y+_.point.y;return!this.isInsideGrid(v,E,M,z)||n!=="always"&&this.grid.hitTest(v,E,M,z,n,p)||_.perspectiveRatio<this.perspectiveRatioCutoff?{box:[],offscreen:!1}:{box:[v,E,M,z],offscreen:this.isOffscreen(v,E,M,z)}}placeCollisionCircles(t,n,s,u,p,f,_,y,v,E,M,z,V,$){const U=[],H=new a.pointGeometry(n.anchorX,n.anchorY),Q=xt(H,f,$),ne=Ki(this.transform.cameraToCenterDistance,Q.signedDistanceFromCamera),G=(E?p/ne:p*ne)/a.ONE_EM,le=xt(H,_,$).point,se=$r(G,u,n.lineOffsetX*G,n.lineOffsetY*G,!1,le,H,n,s,_,{},!1,$);let me=!1,ge=!1,be=!0;if(se){const de=.5*z*ne+V,Re=new a.pointGeometry(-100,-100),Ce=new a.pointGeometry(this.screenRightBoundary,this.screenBottomBoundary),Be=new Er,st=se.first,ht=se.last;let We=[];for(let _t=st.path.length-1;_t>=1;_t--)We.push(st.path[_t]);for(let _t=1;_t<ht.path.length;_t++)We.push(ht.path[_t]);const At=2.5*de;if(y){const _t=We.map(wt=>xt(wt,y,$));We=_t.some(wt=>wt.signedDistanceFromCamera<=0)?[]:_t.map(wt=>wt.point)}let Mt=[];if(We.length>0){const _t=We[0].clone(),wt=We[0].clone();for(let zt=1;zt<We.length;zt++)_t.x=Math.min(_t.x,We[zt].x),_t.y=Math.min(_t.y,We[zt].y),wt.x=Math.max(wt.x,We[zt].x),wt.y=Math.max(wt.y,We[zt].y);Mt=_t.x>=Re.x&&wt.x<=Ce.x&&_t.y>=Re.y&&wt.y<=Ce.y?[We]:wt.x<Re.x||_t.x>Ce.x||wt.y<Re.y||_t.y>Ce.y?[]:a.clipLine([We],Re.x,Re.y,Ce.x,Ce.y)}for(const _t of Mt){Be.reset(_t,.25*de);let wt=0;wt=Be.length<=.5*de?1:Math.ceil(Be.paddedLength/At)+1;for(let zt=0;zt<wt;zt++){const ai=zt/Math.max(wt-1,1),_r=Be.lerp(ai),nr=_r.x+oi,yr=_r.y+oi;U.push(nr,yr,de,0);const Xr=nr-de,Yi=yr-de,zi=nr+de,Ar=yr+de;if(be=be&&this.isOffscreen(Xr,Yi,zi,Ar),ge=ge||this.isInsideGrid(Xr,Yi,zi,Ar),t!=="always"&&this.grid.hitTestCircle(nr,yr,de,t,M)&&(me=!0,!v))return{circles:[],offscreen:!1,collisionDetected:me}}}}return{circles:!v&&me||!ge||ne<this.perspectiveRatioCutoff?[]:U,offscreen:be,collisionDetected:me}}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 E of t){const M=new a.pointGeometry(E.x+oi,E.y+oi);s=Math.min(s,M.x),u=Math.min(u,M.y),p=Math.max(p,M.x),f=Math.max(f,M.y),n.push(M)}const _=this.grid.query(s,u,p,f).concat(this.ignoredGrid.query(s,u,p,f)),y={},v={};for(const E of _){const M=E.key;if(y[M.bucketInstanceId]===void 0&&(y[M.bucketInstanceId]={}),y[M.bucketInstanceId][M.featureIndex])continue;const z=[new a.pointGeometry(E.x1,E.y1),new a.pointGeometry(E.x2,E.y1),new a.pointGeometry(E.x2,E.y2),new a.pointGeometry(E.x1,E.y2)];a.polygonIntersectsPolygon(n,z)&&(y[M.bucketInstanceId][M.featureIndex]=!0,v[M.bucketInstanceId]===void 0&&(v[M.bucketInstanceId]=[]),v[M.bucketInstanceId].push(M.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],a.transformMat4(p,p,t)):(p=[n,s,0,1],Sr(p,p,t)),{point:new a.pointGeometry((p[0]/p[3]+1)/2*this.transform.width+oi,(-p[1]/p[3]+1)/2*this.transform.height+oi),perspectiveRatio:.5+this.transform.cameraToCenterDistance/p[3]*.5}}isOffscreen(t,n,s,u){return s<oi||t>=this.screenRightBoundary||u<oi||n>this.screenBottomBoundary}isInsideGrid(t,n,s,u){return s>=0&&t<this.gridRightBoundary&&u>=0&&n<this.gridBottomBoundary}getViewportMatrix(){const t=a.identity([]);return a.translate(t,t,[-100,-100,0]),t}}function Jt(l,t,n){return t*(a.EXTENT/(l.tileSize*Math.pow(2,n-l.tileID.overscaledZ)))}class Ti{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 Pt{constructor(t,n,s,u,p){this.text=new Ti(t?t.text:null,n,s,p),this.icon=new Ti(t?t.icon:null,n,u,p)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class En{constructor(t,n,s){this.text=t,this.icon=n,this.skipFade=s}}class fr{constructor(){this.invProjMatrix=a.create(),this.viewportMatrix=a.create(),this.circles=[]}}class Yr{constructor(t,n,s,u,p){this.bucketInstanceId=t,this.featureIndex=n,this.sourceLayerIndex=s,this.bucketIndex=u,this.tileID=p}}class Qr{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 Sn(l,t,n,s,u){const{horizontalAlign:p,verticalAlign:f}=a.getAnchorAlignment(l),_=-(p-.5)*t,y=-(f-.5)*n,v=a.evaluateVariableOffset(l,s);return new a.pointGeometry(_+v[0]*u,y+v[1]*u)}function en(l,t,n,s,u,p){const{x1:f,x2:_,y1:y,y2:v,anchorPointX:E,anchorPointY:M}=l,z=new a.pointGeometry(t,n);return s&&z._rotate(u?p:-p),{x1:f+z.x,y1:y+z.y,x2:_+z.x,y2:v+z.y,anchorPointX:E,anchorPointY:M}}class O{constructor(t,n,s,u,p){this.transform=t.clone(),this.terrain=n,this.collisionIndex=new Tn(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=s,this.retainedQueryData={},this.collisionGroups=new Qr(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),E=s.tileSize/a.EXTENT,M=this.transform.calculatePosMatrix(s.tileID.toUnwrapped()),z=y.get("text-pitch-alignment")==="map",V=y.get("text-rotation-alignment")==="map",$=Jt(s,1,this.transform.zoom),U=Jr(M,z,V,this.transform,$);let H=null;if(z){const ne=ir(M,z,V,this.transform,$);H=a.multiply([],this.transform.labelPlaneMatrix,ne)}this.retainedQueryData[p.bucketInstanceId]=new Yr(p.bucketInstanceId,f,p.sourceLayerIndex,p.index,s.tileID);const Q={bucket:p,layout:y,posMatrix:M,textLabelPlaneMatrix:U,labelToScreenMatrix:H,scale:v,textPixelRatio:E,holdingForFade:s.holdingForFade(),collisionBoxArray:_,partiallyEvaluatedTextSize:a.evaluateSizeForZoom(p.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(p.sourceID)};if(u)for(const ne of p.sortKeyRanges){const{sortKey:G,symbolInstanceStart:le,symbolInstanceEnd:se}=ne;t.push({sortKey:G,symbolInstanceStart:le,symbolInstanceEnd:se,parameters:Q})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:p.symbolInstances.length,parameters:Q})}attemptAnchorPlacement(t,n,s,u,p,f,_,y,v,E,M,z,V,$,U,H){const Q=[z.textOffset0,z.textOffset1],ne=Sn(t,s,u,Q,p),G=this.collisionIndex.placeCollisionBox(en(n,ne.x,ne.y,f,_,this.transform.angle),M,y,v,E.predicate,H);if((!U||this.collisionIndex.placeCollisionBox(en(U,ne.x,ne.y,f,_,this.transform.angle),M,y,v,E.predicate,H).box.length!==0)&&G.box.length>0){let le;if(this.prevPlacement&&this.prevPlacement.variableOffsets[z.crossTileID]&&this.prevPlacement.placements[z.crossTileID]&&this.prevPlacement.placements[z.crossTileID].text&&(le=this.prevPlacement.variableOffsets[z.crossTileID].anchor),z.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[z.crossTileID]={textOffset:Q,width:s,height:u,anchor:t,textBoxScale:p,prevAnchor:le},this.markUsedJustification(V,t,z,$),V.allowVerticalPlacement&&(this.markUsedOrientation(V,$,z),this.placedOrientations[z.crossTileID]=$),{shift:ne,placedGlyphBoxes:G}}}placeLayerBucketPart(t,n,s){const{bucket:u,layout:p,posMatrix:f,textLabelPlaneMatrix:_,labelToScreenMatrix:y,textPixelRatio:v,holdingForFade:E,collisionBoxArray:M,partiallyEvaluatedTextSize:z,collisionGroup:V}=t.parameters,$=p.get("text-optional"),U=p.get("icon-optional"),H=a.getOverlapMode(p,"text-overlap","text-allow-overlap"),Q=H==="always",ne=a.getOverlapMode(p,"icon-overlap","icon-allow-overlap"),G=ne==="always",le=p.get("text-rotation-alignment")==="map",se=p.get("text-pitch-alignment")==="map",me=p.get("icon-text-fit")!=="none",ge=p.get("symbol-z-order")==="viewport-y",be=Q&&(G||!u.hasIconData()||U),de=G&&(Q||!u.hasTextData()||$);!u.collisionArrays&&M&&u.deserializeCollisionBoxes(M);const Re=(Ce,Be)=>{if(n[Ce.crossTileID])return;if(E)return void(this.placements[Ce.crossTileID]=new En(!1,!1,!1));let st=!1,ht=!1,We=!0,At=null,Mt={box:null,offscreen:null},_t={box:null,offscreen:null},wt=null,zt=null,ai=null,_r=0,nr=0,yr=0;Be.textFeatureIndex?_r=Be.textFeatureIndex:Ce.useRuntimeCollisionCircles&&(_r=Ce.featureIndex),Be.verticalTextFeatureIndex&&(nr=Be.verticalTextFeatureIndex);const Xr=this.retainedQueryData[u.bucketInstanceId].tileID,Yi=this.terrain?(ii,dt)=>this.terrain.getElevation(Xr,ii,dt):null;for(const ii of["textBox","verticalTextBox","iconBox","verticalIconBox"]){const dt=Be[ii];dt&&(dt.elevation=Yi?Yi(dt.anchorPointX,dt.anchorPointY):0)}const zi=Be.textBox;if(zi){const ii=Ct=>{let li=a.WritingMode.horizontal;if(u.allowVerticalPlacement&&!Ct&&this.prevPlacement){const ci=this.prevPlacement.placedOrientations[Ce.crossTileID];ci&&(this.placedOrientations[Ce.crossTileID]=ci,li=ci,this.markUsedOrientation(u,li,Ce))}return li},dt=(Ct,li)=>{if(u.allowVerticalPlacement&&Ce.numVerticalGlyphVertices>0&&Be.verticalTextBox){for(const ci of u.writingModes)if(ci===a.WritingMode.vertical?(Mt=li(),_t=Mt):Mt=Ct(),Mt&&Mt.box&&Mt.box.length)break}else Mt=Ct()};if(p.get("text-variable-anchor")){let Ct=p.get("text-variable-anchor");if(this.prevPlacement&&this.prevPlacement.variableOffsets[Ce.crossTileID]){const Gt=this.prevPlacement.variableOffsets[Ce.crossTileID];Ct.indexOf(Gt.anchor)>0&&(Ct=Ct.filter(Qi=>Qi!==Gt.anchor),Ct.unshift(Gt.anchor))}const li=(Gt,Qi,an)=>{const $s=Gt.x2-Gt.x1,On=Gt.y2-Gt.y1,Ha=Ce.textBoxScale,Us=me&&ne==="never"?Qi:null;let Wr={box:[],offscreen:!1};const ln=H!=="never"?2*Ct.length:Ct.length;for(let cn=0;cn<ln;++cn){const Ho=this.attemptAnchorPlacement(Ct[cn%Ct.length],Gt,$s,On,Ha,le,se,v,f,V,cn>=Ct.length?H:"never",Ce,u,an,Us,Yi);if(Ho&&(Wr=Ho.placedGlyphBoxes,Wr&&Wr.box&&Wr.box.length)){st=!0,At=Ho.shift;break}}return Wr};dt(()=>li(zi,Be.iconBox,a.WritingMode.horizontal),()=>{const Gt=Be.verticalTextBox;return u.allowVerticalPlacement&&!(Mt&&Mt.box&&Mt.box.length)&&Ce.numVerticalGlyphVertices>0&&Gt?li(Gt,Be.verticalIconBox,a.WritingMode.vertical):{box:null,offscreen:null}}),Mt&&(st=Mt.box,We=Mt.offscreen);const ci=ii(Mt&&Mt.box);if(!st&&this.prevPlacement){const Gt=this.prevPlacement.variableOffsets[Ce.crossTileID];Gt&&(this.variableOffsets[Ce.crossTileID]=Gt,this.markUsedJustification(u,Gt.anchor,Ce,ci))}}else{const Ct=(li,ci)=>{const Gt=this.collisionIndex.placeCollisionBox(li,H,v,f,V.predicate,Yi);return Gt&&Gt.box&&Gt.box.length&&(this.markUsedOrientation(u,ci,Ce),this.placedOrientations[Ce.crossTileID]=ci),Gt};dt(()=>Ct(zi,a.WritingMode.horizontal),()=>{const li=Be.verticalTextBox;return u.allowVerticalPlacement&&Ce.numVerticalGlyphVertices>0&&li?Ct(li,a.WritingMode.vertical):{box:null,offscreen:null}}),ii(Mt&&Mt.box&&Mt.box.length)}}if(wt=Mt,st=wt&&wt.box&&wt.box.length>0,We=wt&&wt.offscreen,Ce.useRuntimeCollisionCircles){const ii=u.text.placedSymbolArray.get(Ce.centerJustifiedTextSymbolIndex),dt=a.evaluateSizeForFeature(u.textSizeData,z,ii),Ct=p.get("text-padding");zt=this.collisionIndex.placeCollisionCircles(H,ii,u.lineVertexArray,u.glyphOffsetArray,dt,f,_,y,s,se,V.predicate,Ce.collisionCircleDiameter,Ct,Yi),zt.circles.length&&zt.collisionDetected&&!s&&a.warnOnce("Collisions detected, but collision boxes are not shown"),st=Q||zt.circles.length>0&&!zt.collisionDetected,We=We&&zt.offscreen}if(Be.iconFeatureIndex&&(yr=Be.iconFeatureIndex),Be.iconBox){const ii=dt=>{const Ct=me&&At?en(dt,At.x,At.y,le,se,this.transform.angle):dt;return this.collisionIndex.placeCollisionBox(Ct,ne,v,f,V.predicate,Yi)};_t&&_t.box&&_t.box.length&&Be.verticalIconBox?(ai=ii(Be.verticalIconBox),ht=ai.box.length>0):(ai=ii(Be.iconBox),ht=ai.box.length>0),We=We&&ai.offscreen}const Ar=$||Ce.numHorizontalGlyphVertices===0&&Ce.numVerticalGlyphVertices===0,Wo=U||Ce.numIconVertices===0;if(Ar||Wo?Wo?Ar||(ht=ht&&st):st=ht&&st:ht=st=ht&&st,st&&wt&&wt.box&&this.collisionIndex.insertCollisionBox(wt.box,H,p.get("text-ignore-placement"),u.bucketInstanceId,_t&&_t.box&&nr?nr:_r,V.ID),ht&&ai&&this.collisionIndex.insertCollisionBox(ai.box,ne,p.get("icon-ignore-placement"),u.bucketInstanceId,yr,V.ID),zt&&(st&&this.collisionIndex.insertCollisionCircles(zt.circles,H,p.get("text-ignore-placement"),u.bucketInstanceId,_r,V.ID),s)){const ii=u.bucketInstanceId;let dt=this.collisionCircleArrays[ii];dt===void 0&&(dt=this.collisionCircleArrays[ii]=new fr);for(let Ct=0;Ct<zt.circles.length;Ct+=4)dt.circles.push(zt.circles[Ct+0]),dt.circles.push(zt.circles[Ct+1]),dt.circles.push(zt.circles[Ct+2]),dt.circles.push(zt.collisionDetected?1:0)}if(Ce.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[Ce.crossTileID]=new En(st||be,ht||de,We||u.justReloaded),n[Ce.crossTileID]=!0};if(ge){if(t.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");const Ce=u.getSortedSymbolIndexes(this.transform.angle);for(let Be=Ce.length-1;Be>=0;--Be){const st=Ce[Be];Re(u.symbolInstances.get(st),u.collisionArrays[st])}}else for(let Ce=t.symbolInstanceStart;Ce<t.symbolInstanceEnd;Ce++)Re(u.symbolInstances.get(Ce),u.collisionArrays[Ce]);if(s&&u.bucketInstanceId in this.collisionCircleArrays){const Ce=this.collisionCircleArrays[u.bucketInstanceId];a.invert(Ce.invProjMatrix,f),Ce.viewportMatrix=this.collisionIndex.getViewportMatrix()}u.justReloaded=!1}markUsedJustification(t,n,s,u){let p;p=u===a.WritingMode.vertical?s.verticalPlacedTextSymbolIndex:{left:s.leftJustifiedTextSymbolIndex,center:s.centerJustifiedTextSymbolIndex,right:s.rightJustifiedTextSymbolIndex}[a.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===a.WritingMode.horizontal||n===a.WritingMode.horizontalOnly?n:0,p=n===a.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],E=p[y];E?(this.opacities[y]=new Pt(E,u,v.text,v.icon),s=s||v.text!==E.text.placed||v.icon!==E.icon.placed):(this.opacities[y]=new Pt(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 E=new Pt(v,u,!1,!1);E.isHidden()||(this.opacities[y]=E,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 Pt(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",E=u.get("text-pitch-alignment")==="map",M=u.get("icon-text-fit")!=="none",z=new Pt(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 V=($,U,H)=>{for(let Q=0;Q<U/4;Q++)$.opacityVertexArray.emplaceBack(H)};for(let $=0;$<t.symbolInstances.length;$++){const U=t.symbolInstances.get($),{numHorizontalGlyphVertices:H,numVerticalGlyphVertices:Q,crossTileID:ne}=U;let G=this.opacities[ne];n[ne]?G=p:G||(G=z,this.opacities[ne]=G),n[ne]=!0;const le=U.numIconVertices>0,se=this.placedOrientations[U.crossTileID],me=se===a.WritingMode.vertical,ge=se===a.WritingMode.horizontal||se===a.WritingMode.horizontalOnly;if(H>0||Q>0){const be=J(G.text);V(t.text,H,me?pe:be),V(t.text,Q,ge?pe:be);const de=G.text.isHidden();[U.rightJustifiedTextSymbolIndex,U.centerJustifiedTextSymbolIndex,U.leftJustifiedTextSymbolIndex].forEach(Be=>{Be>=0&&(t.text.placedSymbolArray.get(Be).hidden=de||me?1:0)}),U.verticalPlacedTextSymbolIndex>=0&&(t.text.placedSymbolArray.get(U.verticalPlacedTextSymbolIndex).hidden=de||ge?1:0);const Re=this.variableOffsets[U.crossTileID];Re&&this.markUsedJustification(t,Re.anchor,U,se);const Ce=this.placedOrientations[U.crossTileID];Ce&&(this.markUsedJustification(t,"left",U,Ce),this.markUsedOrientation(t,Ce,U))}if(le){const be=J(G.icon),de=!(M&&U.verticalPlacedIconSymbolIndex&&me);U.placedIconSymbolIndex>=0&&(V(t.icon,U.numIconVertices,de?be:pe),t.icon.placedSymbolArray.get(U.placedIconSymbolIndex).hidden=G.icon.isHidden()),U.verticalPlacedIconSymbolIndex>=0&&(V(t.icon,U.numVerticalIconVertices,de?pe:be),t.icon.placedSymbolArray.get(U.verticalPlacedIconSymbolIndex).hidden=G.icon.isHidden())}if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const be=t.collisionArrays[$];if(be){let de=new a.pointGeometry(0,0);if(be.textBox||be.verticalTextBox){let Ce=!0;if(y){const Be=this.variableOffsets[ne];Be?(de=Sn(Be.anchor,Be.width,Be.height,Be.textOffset,Be.textBoxScale),v&&de._rotate(E?this.transform.angle:-this.transform.angle)):Ce=!1}be.textBox&&w(t.textCollisionBox.collisionVertexArray,G.text.placed,!Ce||me,de.x,de.y),be.verticalTextBox&&w(t.textCollisionBox.collisionVertexArray,G.text.placed,!Ce||ge,de.x,de.y)}const Re=Boolean(!ge&&be.verticalIconBox);be.iconBox&&w(t.iconCollisionBox.collisionVertexArray,G.icon.placed,Re,M?de.x:0,M?de.y:0),be.verticalIconBox&&w(t.iconCollisionBox.collisionVertexArray,G.icon.placed,!Re,M?de.x:0,M?de.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 $=this.collisionCircleArrays[t.bucketInstanceId];t.placementInvProjMatrix=$.invProjMatrix,t.placementViewportMatrix=$.viewportMatrix,t.collisionCircleArray=$.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 w(l,t,n,s,u){l.emplaceBack(t?1:0,n?1:0,s||0,u||0),l.emplaceBack(t?1:0,n?1:0,s||0,u||0),l.emplaceBack(t?1:0,n?1:0,s||0,u||0),l.emplaceBack(t?1:0,n?1:0,s||0,u||0)}const C=Math.pow(2,25),R=Math.pow(2,24),B=Math.pow(2,17),j=Math.pow(2,16),K=Math.pow(2,9),W=Math.pow(2,8),X=Math.pow(2,1);function J(l){if(l.opacity===0&&!l.placed)return 0;if(l.opacity===1&&l.placed)return 4294967295;const t=l.placed?1:0,n=Math.floor(127*l.opacity);return n*C+t*R+n*B+t*j+n*K+t*W+n*X+t}const pe=0;class ve{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 he{constructor(t,n,s,u,p,f,_,y){this.placement=new O(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=a.exported.now(),p=()=>{const f=a.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 ve(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 Ve=512/a.EXTENT/2;class qe{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=Ve/Math.pow(2,n.canonical.z-this.tileID.canonical.z);return{x:Math.floor((n.canonical.x*a.EXTENT+t.anchorX)*s),y:Math.floor((n.canonical.y*a.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 Le{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Je{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 qe(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 Qe{constructor(){this.layerIndexes={},this.crossTileIDs=new Le,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(t,n,s){let u=this.layerIndexes[t.id];u===void 0&&(u=this.layerIndexes[t.id]=new Je);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 vt=a.createLayout([{name:"a_pos",type:"Int16",components:2}]);class it extends a.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),a.ortho(s.posMatrix,0,a.EXTENT,0,a.EXTENT,0,1),this._tiles[s.key]=new Dr(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),a.ortho(p.posMatrix,0,a.EXTENT,0,a.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=a.EXTENT>>f;a.ortho(p.posMatrix,0,v,0,v,0,1),a.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=a.EXTENT>>f;a.ortho(p.posMatrix,0,a.EXTENT,0,a.EXTENT,0,1),a.translate(p.posMatrix,p.posMatrix,[_*v,y*v,0]),a.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 ut{constructor(t,n,s){this.style=t,this.sourceCache=new it(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=a.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 _=a.transformMat4$1([],[n/u*a.EXTENT,s/u*a.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])],E=f.tile.dem.get(v[0],v[1]),M=f.tile.dem.get(v[0],v[1]+1),z=f.tile.dem.get(v[0]+1,v[1]),V=f.tile.dem.get(v[0]+1,v[1]+1);p=a.number(a.number(E,M,y[0]-v[0]),a.number(z,V,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=a.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 a.RGBAImage({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new Ue(u,p,u.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new Ue(u,new a.RGBAImage({width:1,height:1}),u.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(u.gl.NEAREST,u.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=a.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 Ue(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:a.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=a.fromScaling(new Float64Array(16),[1/(a.EXTENT<<p),1/(a.EXTENT<<p),0]);a.translate(y,y,[f*a.EXTENT,_*a.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 Ue(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 Ue(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 a.RGBAImage({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(n.buffer)),u=new Ue(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 E=this._coordsTextureSize,M=(1<<v.tileID.canonical.z)*E;return new a.MercatorCoordinate((v.tileID.canonical.x*E+f)/M,(v.tileID.canonical.y*E+_)/M,this.getElevation(v.tileID,f,_,E))}getTerrainMesh(){if(this._mesh)return this._mesh;const t=this.style.map.painter.context,n=new a.PosArray,s=new a.TriangleIndexArray,u=this.meshSize,p=a.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,vt.members),segments:a.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 bt=(l,t)=>a.emitValidationErrors(l,t&&t.filter(n=>n.identifier!=="source.canvas")),kt=a.pick(yt,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData"]),si=a.pick(yt,["setCenter","setZoom","setBearing","setPitch"]),$t=function(){const l={},t=a.spec.$version;for(const n in a.spec.$root){const s=a.spec.$root[n];if(s.required){let u=null;u=n==="version"?t:s.type==="array"?[]:{},u!=null&&(l[n]=u)}}return l}();class _i extends a.Evented{constructor(t,n={}){super(),this.map=t,this.dispatcher=new Wi(vn(),this),this.imageManager=new Ke,this.imageManager.setEventedParent(this),this.glyphManager=new at(t._requestManager,n.localIdeographFontFamily),this.lineAtlas=new ur(256,512),this.crossTileSymbolIndex=new Qe,this._layers={},this._serializedLayers={},this._order=[],this.sourceCaches={},this.zoomHistory=new a.ZoomHistory,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("setReferrer",a.getReferrer());const s=this;this._rtlTextPluginCallback=_i.registerForPluginStateChange(u=>{s.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:u.pluginStatus,pluginURL:u.pluginURL},(p,f)=>{if(a.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 a.Event("dataloading",{dataType:"style"}));const s=typeof n.validate!="boolean"||n.validate,u=this.map._requestManager.transformRequest(t,a.ResourceType.Style);this._request=a.getJSON(u,(p,f)=>{this._request=null,p?this.fire(new a.ErrorEvent(p)):f&&this._load(f,s)})}loadJSON(t,n={}){this.fire(new a.Event("dataloading",{dataType:"style"})),this._request=a.exported.frame(()=>{this._request=null,this._load(t,n.validate!==!1)})}loadEmpty(){this.fire(new a.Event("dataloading",{dataType:"style"})),this._load($t,!1)}_load(t,n){if(n&&bt(this,a.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=Wn(this.stylesheet.layers);this._order=s.map(u=>u.id),this._layers={},this._serializedLayers={};for(let u of s)u=a.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 Kt(this.stylesheet.light),this.setTerrain(this.stylesheet.terrain),this.fire(new a.Event("data",{dataType:"style"})),this.fire(new a.Event("style.load"))}_loadSprite(t){this._spriteRequest=function(n,s,u,p){let f,_,y;const v=u>1?"@2x":"";let E=a.getJSON(s.transformRequest(s.normalizeSpriteURL(n,v,".json"),a.ResourceType.SpriteJSON),(V,$)=>{E=null,y||(y=V,f=$,z())}),M=a.getImage(s.transformRequest(s.normalizeSpriteURL(n,v,".png"),a.ResourceType.SpriteImage),(V,$)=>{M=null,y||(y=V,_=$,z())});function z(){if(y)p(y);else if(f&&_){const V=a.exported.getImageData(_),$={};for(const U in f){const{width:H,height:Q,x:ne,y:G,sdf:le,pixelRatio:se,stretchX:me,stretchY:ge,content:be}=f[U],de=new a.RGBAImage({width:H,height:Q});a.RGBAImage.copy(V,de,{x:ne,y:G},{x:0,y:0},{width:H,height:Q}),$[U]={data:de,pixelRatio:se,sdf:le,stretchX:me,stretchY:ge,content:be}}p(null,$)}}return{cancel(){E&&(E.cancel(),E=null),M&&(M.cancel(),M=null)}}}(t,this.map._requestManager,this.map.getPixelRatio(),(n,s)=>{if(this._spriteRequest=null,n)this.fire(new a.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 a.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 a.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 a.Event("data",{sourceDataType:"visibility",dataType:"source",sourceId:u}))}this.light.recalculate(t),this.z=t.zoom,n&&this.fire(new a.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 ut(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 a.Event("terrain",{terrain:t}))}setState(t){if(this._checkLoaded(),bt(this,a.validateStyle(t)))return!1;(t=a.clone$1(t)).layers=Wn(t.layers);const n=function(u,p){if(!u)return[{command:yt.setStyle,args:[p]}];let f=[];try{if(!ue(u.version,p.version))return[{command:yt.setStyle,args:[p]}];ue(u.center,p.center)||f.push({command:yt.setCenter,args:[p.center]}),ue(u.zoom,p.zoom)||f.push({command:yt.setZoom,args:[p.zoom]}),ue(u.bearing,p.bearing)||f.push({command:yt.setBearing,args:[p.bearing]}),ue(u.pitch,p.pitch)||f.push({command:yt.setPitch,args:[p.pitch]}),ue(u.sprite,p.sprite)||f.push({command:yt.setSprite,args:[p.sprite]}),ue(u.glyphs,p.glyphs)||f.push({command:yt.setGlyphs,args:[p.glyphs]}),ue(u.transition,p.transition)||f.push({command:yt.setTransition,args:[p.transition]}),ue(u.light,p.light)||f.push({command:yt.setLight,args:[p.light]});const _={},y=[];(function(E,M,z,V){let $;for($ in M=M||{},E=E||{})Object.prototype.hasOwnProperty.call(E,$)&&(Object.prototype.hasOwnProperty.call(M,$)||Fr($,z,V));for($ in M)Object.prototype.hasOwnProperty.call(M,$)&&(Object.prototype.hasOwnProperty.call(E,$)?ue(E[$],M[$])||(E[$].type==="geojson"&&M[$].type==="geojson"&&Hn(E,M,$)?z.push({command:yt.setGeoJSONSourceData,args:[$,M[$].data]}):Or($,M,z,V)):dr($,M,z))})(u.sources,p.sources,y,_);const v=[];u.layers&&u.layers.forEach(E=>{_[E.source]?f.push({command:yt.removeLayer,args:[E.id]}):v.push(E)}),f=f.concat(y),function(E,M,z){M=M||[];const V=(E=E||[]).map(Tr),$=M.map(Tr),U=E.reduce(wn,{}),H=M.reduce(wn,{}),Q=V.slice(),ne=Object.create(null);let G,le,se,me,ge,be,de;for(G=0,le=0;G<V.length;G++)se=V[G],Object.prototype.hasOwnProperty.call(H,se)?le++:(z.push({command:yt.removeLayer,args:[se]}),Q.splice(Q.indexOf(se,le),1));for(G=0,le=0;G<$.length;G++)se=$[$.length-1-G],Q[Q.length-1-G]!==se&&(Object.prototype.hasOwnProperty.call(U,se)?(z.push({command:yt.removeLayer,args:[se]}),Q.splice(Q.lastIndexOf(se,Q.length-le),1)):le++,be=Q[Q.length-G],z.push({command:yt.addLayer,args:[H[se],be]}),Q.splice(Q.length-G,0,se),ne[se]=!0);for(G=0;G<$.length;G++)if(se=$[G],me=U[se],ge=H[se],!ne[se]&&!ue(me,ge))if(ue(me.source,ge.source)&&ue(me["source-layer"],ge["source-layer"])&&ue(me.type,ge.type)){for(de in wr(me.layout,ge.layout,z,se,null,yt.setLayoutProperty),wr(me.paint,ge.paint,z,se,null,yt.setPaintProperty),ue(me.filter,ge.filter)||z.push({command:yt.setFilter,args:[se,ge.filter]}),ue(me.minzoom,ge.minzoom)&&ue(me.maxzoom,ge.maxzoom)||z.push({command:yt.setLayerZoomRange,args:[se,ge.minzoom,ge.maxzoom]}),me)Object.prototype.hasOwnProperty.call(me,de)&&de!=="layout"&&de!=="paint"&&de!=="filter"&&de!=="metadata"&&de!=="minzoom"&&de!=="maxzoom"&&(de.indexOf("paint.")===0?wr(me[de],ge[de],z,se,de.slice(6),yt.setPaintProperty):ue(me[de],ge[de])||z.push({command:yt.setLayerProperty,args:[se,de,ge[de]]}));for(de in ge)Object.prototype.hasOwnProperty.call(ge,de)&&!Object.prototype.hasOwnProperty.call(me,de)&&de!=="layout"&&de!=="paint"&&de!=="filter"&&de!=="metadata"&&de!=="minzoom"&&de!=="maxzoom"&&(de.indexOf("paint.")===0?wr(me[de],ge[de],z,se,de.slice(6),yt.setPaintProperty):ue(me[de],ge[de])||z.push({command:yt.setLayerProperty,args:[se,de,ge[de]]}))}else z.push({command:yt.removeLayer,args:[se]}),be=Q[Q.lastIndexOf(se)+1],z.push({command:yt.addLayer,args:[ge,be]})}(v,p.layers,f)}catch(_){console.warn("Unable to compute style diff:",_),f=[{command:yt.setStyle,args:[p]}]}return f}(this.serialize(),t).filter(u=>!(u.command in si));if(n.length===0)return!1;const s=n.filter(u=>!(u.command in kt));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 a.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 a.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 a.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(a.validateStyle.source,`sources.${t}`,n,null,s))return;this.map&&this.map._collectResourceTiming&&(n.collectResourceTiming=!0);const u=this.sourceCaches[t]=new Mi(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 a.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 a.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 a.ErrorEvent(new Error(`Layer "${u}" already exists on this map.`)));let p;if(t.type==="custom"){if(bt(this,a.validateCustomStyleLayer(t)))return;p=a.createStyleLayer(t)}else{if(typeof t.source=="object"&&(this.addSource(u,t.source),t=a.clone$1(t),t=a.extend(t,{source:u})),this._validate(a.validateStyle.layer,`layers.${u}`,t,{arrayIndex:-1},s))return;p=a.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 a.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 a.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 a.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 a.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 a.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(!ue(u.filter,n))return n==null?(u.filter=void 0,void this._updateLayer(u)):void(this._validate(a.validateStyle.filter,`layers.${u.id}.filter`,n,null,s)||(u.filter=a.clone$1(n),this._updateLayer(u)))}else this.fire(new a.ErrorEvent(new Error(`Cannot filter non-existing layer "${t}".`)))}getFilter(t){return a.clone$1(this.getLayer(t).filter)}setLayoutProperty(t,n,s,u={}){this._checkLoaded();const p=this.getLayer(t);p?ue(p.getLayoutProperty(n),s)||(p.setLayoutProperty(n,s,u),this._updateLayer(p)):this.fire(new a.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 a.ErrorEvent(new Error(`Cannot get style of non-existing layer "${t}".`)))}setPaintProperty(t,n,s,u={}){this._checkLoaded();const p=this.getLayer(t);p?ue(p.getPaintProperty(n),s)||(p.setPaintProperty(n,s,u)&&this._updateLayer(p),this._changed=!0,this._updatedPaintProps[t]=!0):this.fire(new a.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 a.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 a.ErrorEvent(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):f!=="vector"||u?(t.id===void 0&&this.fire(new a.ErrorEvent(new Error("The feature id parameter must be provided."))),p.setFeatureState(u,t.id,n)):this.fire(new a.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 a.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 a.ErrorEvent(new Error("A feature id is required to remove its specific state property."))):u.removeFeatureState(f,t.id,n):this.fire(new a.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 a.ErrorEvent(new Error("The feature id parameter must be provided."))),u.getFeatureState(s,t.id)):void this.fire(new a.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new a.ErrorEvent(new Error(`The source '${n}' does not exist in the map's style.`)))}getTransition(){return a.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){return a.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:a.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 E of v)u.push(E)}}}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 E of v)p.push(E.feature)}}return p}queryRenderedFeatures(t,n,s){n&&n.filter&&this._validate(a.validateStyle.filter,"queryRenderedFeatures.filter",n.filter,null,n);const u={};if(n&&n.layers){if(!Array.isArray(n.layers))return this.fire(new a.ErrorEvent(new Error("parameters.layers must be an Array."))),[];for(const f of n.layers){const _=this._layers[f];if(!_)return this.fire(new a.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(yn(this.sourceCaches[f],this._layers,this._serializedLayers,t,n,s));return this.placement&&p.push(function(f,_,y,v,E,M,z){const V={},$=M.queryRenderedSymbols(v),U=[];for(const H of Object.keys($).map(Number))U.push(z[H]);U.sort(pr);for(const H of U){const Q=H.featureIndex.lookupSymbolFeatures($[H.bucketInstanceId],_,H.bucketIndex,H.sourceLayerIndex,E.filter,E.layers,E.availableImages,f);for(const ne in Q){const G=V[ne]=V[ne]||[],le=Q[ne];le.sort((se,me)=>{const ge=H.featureSortOrder;if(ge){const be=ge.indexOf(se.featureIndex);return ge.indexOf(me.featureIndex)-be}return me.featureIndex-se.featureIndex});for(const se of le)G.push(se)}}for(const H in V)V[H].forEach(Q=>{const ne=Q.feature,G=y[f[H].source].getFeatureState(ne.layer["source-layer"],ne.id);ne.source=ne.layer.source,ne.layer["source-layer"]&&(ne.sourceLayer=ne.layer["source-layer"]),ne.state=G});return V}(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(a.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 E=f[v],M=E.tileID.canonical.key;y[M]||(y[M]=!0,E.querySourceFeatures(_,p))}return _}(s,n):[]}addSourceType(t,n,s){return _i.getSourceType(t)?s(new Error(`A source type called "${t}" already exists.`)):(_i.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(!ue(t[f],s[f])){u=!0;break}if(!u)return;const p={now:a.exported.now(),transition:a.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)&&bt(this,t.call(a.validateStyle,a.extend({key:n,style:this.serialize(),value:s,styleSpec:a.spec},u)))}_remove(){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),a.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 E=this._layers[v];if(E.type!=="symbol")continue;if(!y[E.source]){const z=this.sourceCaches[E.source];y[E.source]=z.getRenderableIds(!0).map(V=>z.getTileByID(V)).sort((V,$)=>$.tileID.overscaledZ-V.tileID.overscaledZ||(V.tileID.isLessThan($.tileID)?-1:1))}const M=this.crossTileSymbolIndex.addLayer(E,y[E.source],t.center.lng);f=f||M}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((p=p||this._layerOrderChanged||s===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(a.exported.now(),t.zoom))&&(this.pauseablePlacement=new he(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(a.exported.now()),_=!0),f&&this.pauseablePlacement.placement.setStale()),_||f)for(const v of this._order){const E=this._layers[v];E.type==="symbol"&&this.placement.updateLayerOpacities(E,y[E.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(a.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 a.makeRequest(n,s)}}_i.getSourceType=function(l){return gn[l]},_i.setSourceType=function(l,t){gn[l]=t},_i.registerForPluginStateChange=a.registerForPluginStateChange;var In="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 Kn={prelude:Dt(`#ifdef GL_ES
1
+ import{R as Tf,r as Te,$ as Zh,a as jh,b as nt,c as Xh,j as Ae,s as El,_ as Ef,d as Wh,i as Co,u as la,e as Sl,f as qc,g as Zc,h as Sf,k as $t,t as yt,F as Il,l as Xi,m as Lc,n as os,o as jc,p as wl,q as Sh,v as ca,w as cr,x as Hh,y as If,U as Kh,z as Jh,L as Cl,A as tr,S as Cf,B as oa,C as xl,D as Af,T as Mf,E as Pf,G as zf}from"./index.d57859aa.js";var sa=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};const kf=Tf["useId".toString()]||(()=>{});let Df=0;function Yh(w){const[E,A]=Te.exports.useState(kf());return Zh(()=>{w||A(k=>k!=null?k:String(Df++))},[w]),w||(E?`radix-${E}`:"")}function Xc({prop:w,defaultProp:E,onChange:A=()=>{}}){const[k,F]=Lf({defaultProp:E,onChange:A}),N=w!==void 0,oe=N?w:k,a=jh(A),Q=Te.exports.useCallback(te=>{if(N){const ue=typeof te=="function"?te(w):te;ue!==w&&a(ue)}else F(te)},[N,w,F,a]);return[oe,Q]}function Lf({defaultProp:w,onChange:E}){const A=Te.exports.useState(w),[k]=A,F=Te.exports.useRef(k),N=jh(E);return Te.exports.useEffect(()=>{F.current!==k&&(N(k),F.current=k)},[k,F,N]),A}const Qh=nt.createContext({}),Zn=()=>Te.exports.useContext(Qh),Rf=(w,E)=>{switch(E.type){case"CATEGORY":return{...w,activeCategory:E.value};case"SCORE":{const A=El.find(k=>E.value===""?k.value===w.activeCategory:k.scores.includes(E.value)).value;return{activeCategory:A,activeScoreByCategory:{...w.activeScoreByCategory,[A]:E.value}}}}},Bf=({children:w})=>{const[E,A]=Te.exports.useState(!1),k=window.innerWidth<Xh.screenSizes.mobileL?{activeCategory:"commute",activeScoreByCategory:{commute:"pedestrian_friendly",amenities:"",character:"",nature:"",education:""}}:{activeCategory:"commute",activeScoreByCategory:{commute:"",amenities:"",character:"",nature:"",education:""}},[F,N]=Te.exports.useReducer(Rf,k),[oe,a]=Te.exports.useState(),[Q,te]=Te.exports.useState(),{activeCategory:fe}=F,ue=F.activeScoreByCategory[fe],ie=Be=>{N({type:"SCORE",value:Be})},Ge=Be=>{N({type:"CATEGORY",value:Be})},Ne=Te.exports.useMemo(()=>({activeScore:ue,setActiveScore:ie,activeCategory:fe,setActiveCategory:Ge,activePOI:oe,setActivePOI:a,hoveredPOI:Q,setHoveredPOI:te,showMobileList:E,setShowMobileList:A}),[ue,ie,fe,Ge,oe,a,Q,te,E,A]);return Ae(Qh.Provider,{value:Ne,children:w})},Ff=Te.exports.createContext(null);function Of(w){const E=w.clone();return E.pixelsToGLUnits=w.pixelsToGLUnits,E}function Ih(w){return{longitude:w.center.lng,latitude:w.center.lat,zoom:w.zoom,pitch:w.pitch,bearing:w.bearing,padding:w.padding}}function Ch(w,E){const A=E.viewState||E;let k=!1;if("longitude"in A&&"latitude"in A){const F=w.center;w.center=new F.constructor(A.longitude,A.latitude),k=k||F!==w.center}if("zoom"in A){const F=w.zoom;w.zoom=A.zoom,k=k||F!==w.zoom}if("bearing"in A){const F=w.bearing;w.bearing=A.bearing,k=k||F!==w.bearing}if("pitch"in A){const F=w.pitch;w.pitch=A.pitch,k=k||F!==w.pitch}return A.padding&&!w.isPaddingEqual(A.padding)&&(k=!0,w.padding=A.padding),k}const $f=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function Ah(w){if(!w)return null;if(typeof w=="string"||("toJS"in w&&(w=w.toJS()),!w.layers))return w;const E={};for(const k of w.layers)E[k.id]=k;const A=w.layers.map(k=>{const F=E[k.ref];let N=null;if("interactive"in k&&(N={...k},delete N.interactive),F){N=N||{...k},delete N.ref;for(const oe of $f)oe in F&&(N[oe]=F[oe])}return N||k});return{...w,layers:A}}function Uf(w,E){const A=Array.isArray(w)?w[0]:w?w.x:0,k=Array.isArray(w)?w[1]:w?w.y:0,F=Array.isArray(E)?E[0]:E?E.x:0,N=Array.isArray(E)?E[1]:E?E.y:0;return A===F&&k===N}function qn(w,E){if(w===E)return!0;if(!w||!E)return!1;if(Array.isArray(w)){if(!Array.isArray(E)||w.length!==E.length)return!1;for(let A=0;A<w.length;A++)if(!qn(w[A],E[A]))return!1;return!0}else if(Array.isArray(E))return!1;if(typeof w=="object"&&typeof E=="object"){const A=Object.keys(w),k=Object.keys(E);if(A.length!==k.length)return!1;for(const F of A)if(!E.hasOwnProperty(F)||!qn(w[F],E[F]))return!1;return!0}return!1}const Mh={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"},Rc={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"},Ph={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"},Vf=["minZoom","maxZoom","minPitch","maxPitch","maxBounds","projection","renderWorldCopies"],Nf=["scrollZoom","boxZoom","dragRotate","dragPan","keyboard","doubleClickZoom","touchZoomRotate","touchPitch"];class ss{constructor(E,A,k){this._map=null,this._internalUpdate=!1,this._inRender=!1,this._hoveredFeatures=null,this._deferredEvents={move:!1,zoom:!1,pitch:!1,rotate:!1},this._onEvent=F=>{const N=this.props[Ph[F.type]];N&&N(F)},this._onPointerEvent=F=>{(F.type==="mousemove"||F.type==="mouseout")&&this._updateHover(F);const N=this.props[Mh[F.type]];if(N){if(this.props.interactiveLayerIds&&F.type!=="mouseover"&&F.type!=="mouseout"){const oe=this._hoveredFeatures||this._map.queryRenderedFeatures(F.point,{layers:this.props.interactiveLayerIds});F.features=oe}N(F),delete F.features}},this._onCameraEvent=F=>{if(!this._internalUpdate){const N=this.props[Rc[F.type]];N&&N(F)}F.type in this._deferredEvents&&(this._deferredEvents[F.type]=!1)},this._MapClass=E,this.props=A,this._initialize(k)}get map(){return this._map}get transform(){return this._renderTransform}setProps(E){const A=this.props;this.props=E;const k=this._updateSettings(E,A);k&&this._createShadowTransform(this._map);const F=this._updateSize(E),N=this._updateViewState(E,!0);this._updateStyle(E,A),this._updateStyleComponents(E,A),this._updateHandlers(E,A),(k||F||N&&!this._map.isMoving())&&this.redraw()}static reuse(E,A){const k=ss.savedMaps.pop();if(!k)return null;const F=k.map,N=F.getContainer();for(A.className=N.className;N.childNodes.length>0;)A.appendChild(N.childNodes[0]);F._container=A,k.setProps({...E,styleDiffing:!1}),F.resize();const{initialViewState:oe}=E;return oe&&(oe.bounds?F.fitBounds(oe.bounds,{...oe.fitBoundsOptions,duration:0}):k._updateViewState(oe,!1)),F.isStyleLoaded()?F.fire("load"):F.once("styledata",()=>F.fire("load")),k}_initialize(E){const{props:A}=this,k={...A,...A.initialViewState,accessToken:A.mapboxAccessToken||Gf()||null,container:E,style:Ah(A.mapStyle)},F=k.initialViewState||k.viewState||k;if(Object.assign(k,{center:[F.longitude||0,F.latitude||0],zoom:F.zoom||0,pitch:F.pitch||0,bearing:F.bearing||0}),A.gl){const te=HTMLCanvasElement.prototype.getContext;HTMLCanvasElement.prototype.getContext=()=>(HTMLCanvasElement.prototype.getContext=te,A.gl)}const N=new this._MapClass(k);F.padding&&N.setPadding(F.padding),A.cursor&&(N.getCanvas().style.cursor=A.cursor),this._createShadowTransform(N);const oe=N._render;N._render=te=>{this._inRender=!0,oe.call(N,te),this._inRender=!1};const a=N._renderTaskQueue.run;N._renderTaskQueue.run=te=>{a.call(N._renderTaskQueue,te),this._onBeforeRepaint()},N.on("render",()=>this._onAfterRepaint());const Q=N.fire;N.fire=this._fireEvent.bind(this,Q),N.on("resize",()=>{this._renderTransform.resize(N.transform.width,N.transform.height)}),N.on("styledata",()=>this._updateStyleComponents(this.props,{})),N.on("sourcedata",()=>this._updateStyleComponents(this.props,{}));for(const te in Mh)N.on(te,this._onPointerEvent);for(const te in Rc)N.on(te,this._onCameraEvent);for(const te in Ph)N.on(te,this._onEvent);this._map=N}recycle(){ss.savedMaps.push(this)}destroy(){this._map.remove()}redraw(){const E=this._map;!this._inRender&&E.style&&(E._frame&&(E._frame.cancel(),E._frame=null),E._render())}_createShadowTransform(E){const A=Of(E.transform);E.painter.transform=A,this._renderTransform=A}_updateSize(E){const{viewState:A}=E;if(A){const k=this._map;if(A.width!==k.transform.width||A.height!==k.transform.height)return k.resize(),!0}return!1}_updateViewState(E,A){if(this._internalUpdate)return!1;const k=this._map,F=this._renderTransform,{zoom:N,pitch:oe,bearing:a}=F,Q=k.isMoving();Q&&(F.cameraElevationReference="sea");const te=Ch(F,{...Ih(k.transform),...E});if(Q&&(F.cameraElevationReference="ground"),te&&A){const fe=this._deferredEvents;fe.move=!0,fe.zoom||(fe.zoom=N!==F.zoom),fe.rotate||(fe.rotate=a!==F.bearing),fe.pitch||(fe.pitch=oe!==F.pitch)}return Q||Ch(k.transform,E),te}_updateSettings(E,A){const k=this._map;let F=!1;for(const N of Vf)N in E&&!qn(E[N],A[N])&&(F=!0,k[`set${N[0].toUpperCase()}${N.slice(1)}`](E[N]));return F}_updateStyle(E,A){if(E.cursor!==A.cursor&&(this._map.getCanvas().style.cursor=E.cursor),E.mapStyle!==A.mapStyle){const k={diff:E.styleDiffing};return"localIdeographFontFamily"in E&&(k.localIdeographFontFamily=E.localIdeographFontFamily),this._map.setStyle(Ah(E.mapStyle),k),!0}return!1}_updateStyleComponents(E,A){const k=this._map;let F=!1;return k.style.loaded()&&("light"in E&&!qn(E.light,A.light)&&(F=!0,k.setLight(E.light)),"fog"in E&&!qn(E.fog,A.fog)&&(F=!0,k.setFog(E.fog)),"terrain"in E&&!qn(E.terrain,A.terrain)&&(!E.terrain||k.getSource(E.terrain.source))&&(F=!0,k.setTerrain(E.terrain))),F}_updateHandlers(E,A){const k=this._map;let F=!1;for(const N of Nf){const oe=E[N];qn(oe,A[N])||(F=!0,oe?k[N].enable(oe):k[N].disable())}return F}_updateHover(E){var A;const{props:k}=this;if(k.interactiveLayerIds&&(k.onMouseMove||k.onMouseEnter||k.onMouseLeave)){const N=E.type,oe=((A=this._hoveredFeatures)===null||A===void 0?void 0:A.length)>0;let a;if(N==="mousemove")try{a=this._map.queryRenderedFeatures(E.point,{layers:k.interactiveLayerIds})}catch{a=[]}else a=[];const Q=a.length>0;!Q&&oe&&(E.type="mouseleave",this._onPointerEvent(E)),this._hoveredFeatures=a,Q&&!oe&&(E.type="mouseenter",this._onPointerEvent(E)),E.type=N}else this._hoveredFeatures=null}_fireEvent(E,A,k){const F=this._map,N=F.transform,oe=typeof A=="string"?A:A.type;return oe==="move"&&this._updateViewState(this.props,!1),oe in Rc&&(typeof A=="object"&&(A.viewState=Ih(N)),this._map.isMoving())?(F.transform=this._renderTransform,E.call(F,A,k),F.transform=N,F):(E.call(F,A,k),F)}_onBeforeRepaint(){const E=this._map;this._internalUpdate=!0;for(const k in this._deferredEvents)this._deferredEvents[k]&&E.fire(k);this._internalUpdate=!1;const A=this._map.transform;this._map.transform=this._renderTransform,this._onAfterRepaint=()=>{this._map.transform=A}}}ss.savedMaps=[];function Gf(){let w=null;if(typeof location!="undefined"){const E=/access_token=([^&\/]*)/.exec(location.search);w=E&&E[1]}try{w=w||{}.MapboxAccessToken}catch{}try{w=w||{}.REACT_APP_MAPBOX_ACCESS_TOKEN}catch{}return w}const qf=["setMaxBounds","setMinZoom","setMaxZoom","setMinPitch","setMaxPitch","setRenderWorldCopies","setProjection","setStyle","addSource","removeSource","addLayer","removeLayer","setLayerZoomRange","setFilter","setPaintProperty","setLayoutProperty","setLight","setTerrain","setFog","remove"];function Zf(w,E){if(!w)return null;const A=w.map,k={getMap:()=>A,getCenter:()=>w.transform.center,getZoom:()=>w.transform.zoom,getBearing:()=>w.transform.bearing,getPitch:()=>w.transform.pitch,getPadding:()=>w.transform.padding,getBounds:()=>w.transform.getBounds(),project:F=>w.transform.locationPoint(E.LngLat.convert(F)),unproject:F=>w.transform.pointLocation(E.Point.convert(F)),queryTerrainElevation:(F,N)=>{const oe=A.transform;A.transform=w.transform;const a=A.queryTerrainElevation(F,N);return A.transform=oe,a}};for(const F of jf(A))!(F in k)&&!qf.includes(F)&&(k[F]=A[F].bind(A));return k}function jf(w){const E=new Set;let A=w;for(;A;){for(const k of Object.getOwnPropertyNames(A))k[0]!=="_"&&typeof w[k]=="function"&&k!=="fire"&&k!=="setEventedParent"&&E.add(k);A=Object.getPrototypeOf(A)}return Array.from(E)}const Xf=typeof document!="undefined"?Te.exports.useLayoutEffect:Te.exports.useEffect,Wf=["baseApiUrl","maxParallelImageRequests","workerClass","workerCount","workerUrl"];function Hf(w,E){for(const A of Wf)A in E&&(w[A]=E[A]);E.RTLTextPlugin&&w.getRTLTextPluginStatus&&w.getRTLTextPluginStatus()==="unavailable"&&w.setRTLTextPlugin(E.RTLTextPlugin,A=>{A&&console.error(A)},!1)}const Al=Te.exports.createContext(null),Kf={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:w=>console.error(w.error),RTLTextPlugin:"https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.2.3/mapbox-gl-rtl-text.js"},Wc=Te.exports.forwardRef((w,E)=>{const A=Te.exports.useContext(Ff),[k,F]=Te.exports.useState(null),N=Te.exports.useRef(),{current:oe}=Te.exports.useRef({mapLib:null,map:null});Te.exports.useEffect(()=>{const Q=w.mapLib;let te=!0,fe;return Promise.resolve(Q||Ef(()=>import("./index.c629d6a1.js").then(function(ue){return ue.i}),[])).then(ue=>{if(!!te){if(ue.Map||(ue=ue.default),!ue||!ue.Map)throw new Error("Invalid mapLib");if(ue.supported(w))Hf(ue,w),w.reuseMaps&&(fe=ss.reuse(w,N.current)),fe||(fe=new ss(ue.Map,w,N.current)),oe.map=Zf(fe,ue),oe.mapLib=ue,F(fe),A==null||A.onMapMount(oe.map,w.id);else throw new Error("Map is not supported by this browser")}}).catch(ue=>{w.onError({type:"error",target:null,originalEvent:null,error:ue})}),()=>{te=!1,fe&&(A==null||A.onMapUnmount(w.id),w.reuseMaps?fe.recycle():fe.destroy())}},[]),Xf(()=>{k&&k.setProps(w)}),Te.exports.useImperativeHandle(E,()=>oe.map,[k]);const a=Te.exports.useMemo(()=>({position:"relative",width:"100%",height:"100%",...w.style}),[w.style]);return Te.exports.createElement("div",{id:w.id,ref:N,style:a},k&&Te.exports.createElement(Al.Provider,{value:oe},w.children))});Wc.displayName="Map";Wc.defaultProps=Kf;const Jf=/box|flex|grid|column|lineHeight|fontWeight|opacity|order|tabSize|zIndex/;function Ao(w,E){if(!w||!E)return;const A=w.style;for(const k in E){const F=E[k];Number.isFinite(F)&&!Jf.test(k)?A[k]=`${F}px`:A[k]=F}}const Yf={draggable:!1,popup:null,rotation:0,rotationAlignment:"auto",pitchAlignment:"auto"};function ep(w){const{map:E,mapLib:A}=Te.exports.useContext(Al),k=Te.exports.useRef({props:w});k.current.props=w;const F=Te.exports.useMemo(()=>{let N=!1;Te.exports.Children.forEach(w.children,Q=>{Q&&(N=!0)});const oe={...w,element:N?document.createElement("div"):null},a=new A.Marker(oe).setLngLat([w.longitude,w.latitude]);return a.getElement().addEventListener("click",Q=>{var te,fe;(fe=(te=k.current.props).onClick)===null||fe===void 0||fe.call(te,{type:"click",target:a,originalEvent:Q})}),a.on("dragstart",Q=>{var te,fe;const ue=Q;ue.lngLat=F.getLngLat(),(fe=(te=k.current.props).onDragStart)===null||fe===void 0||fe.call(te,ue)}),a.on("drag",Q=>{var te,fe;const ue=Q;ue.lngLat=F.getLngLat(),(fe=(te=k.current.props).onDrag)===null||fe===void 0||fe.call(te,ue)}),a.on("dragend",Q=>{var te,fe;const ue=Q;ue.lngLat=F.getLngLat(),(fe=(te=k.current.props).onDragEnd)===null||fe===void 0||fe.call(te,ue)}),a},[]);return Te.exports.useEffect(()=>(F.addTo(E.getMap()),()=>{F.remove()}),[]),Te.exports.useEffect(()=>{Ao(F.getElement(),w.style)},[w.style]),(F.getLngLat().lng!==w.longitude||F.getLngLat().lat!==w.latitude)&&F.setLngLat([w.longitude,w.latitude]),w.offset&&!Uf(F.getOffset(),w.offset)&&F.setOffset(w.offset),F.isDraggable()!==w.draggable&&F.setDraggable(w.draggable),F.getRotation()!==w.rotation&&F.setRotation(w.rotation),F.getRotationAlignment()!==w.rotationAlignment&&F.setRotationAlignment(w.rotationAlignment),F.getPitchAlignment()!==w.pitchAlignment&&F.setPitchAlignment(w.pitchAlignment),F.getPopup()!==w.popup&&F.setPopup(w.popup),Wh.exports.createPortal(w.children,F.getElement())}ep.defaultProps=Yf;var $c=Te.exports.memo(ep);function zh(w){return new Set(w?w.trim().split(/\s+/):[])}function Qf(w){const{map:E,mapLib:A}=Te.exports.useContext(Al),k=Te.exports.useMemo(()=>document.createElement("div"),[]),F=Te.exports.useRef({props:w});F.current.props=w;const N=Te.exports.useMemo(()=>{const oe={...w},a=new A.Popup(oe).setLngLat([w.longitude,w.latitude]);return a.once("open",Q=>{var te,fe;(fe=(te=F.current.props).onOpen)===null||fe===void 0||fe.call(te,Q)}),a},[]);if(Te.exports.useEffect(()=>{const oe=a=>{var Q,te;(te=(Q=F.current.props).onClose)===null||te===void 0||te.call(Q,a)};return N.on("close",oe),N.setDOMContent(k).addTo(E.getMap()),()=>{N.off("close",oe),N.isOpen()&&N.remove()}},[]),Te.exports.useEffect(()=>{Ao(N.getElement(),w.style)},[w.style]),N.isOpen()&&((N.getLngLat().lng!==w.longitude||N.getLngLat().lat!==w.latitude)&&N.setLngLat([w.longitude,w.latitude]),w.offset&&!qn(N.options.offset,w.offset)&&N.setOffset(w.offset),(N.options.anchor!==w.anchor||N.options.maxWidth!==w.maxWidth)&&(N.options.anchor=w.anchor,N.setMaxWidth(w.maxWidth)),N.options.className!==w.className)){const oe=zh(N.options.className),a=zh(w.className);for(const Q of oe)a.has(Q)||N.removeClassName(Q);for(const Q of a)oe.has(Q)||N.addClassName(Q);N.options.className=w.className}return Wh.exports.createPortal(w.children,k)}Te.exports.memo(Qf);function ua(w,E,A,k){const F=Te.exports.useContext(Al),N=Te.exports.useMemo(()=>w(F),[]);return Te.exports.useEffect(()=>{const oe=k||A||E,a=typeof E=="function"&&typeof A=="function"?E:null,Q=typeof A=="function"?A:typeof E=="function"?E:null,{map:te}=F;return te.hasControl(N)||(te.addControl(N,oe==null?void 0:oe.position),a&&a(F)),()=>{Q&&Q(F),te.hasControl(N)&&te.removeControl(N)}},[]),N}function em(w){const E=ua(({mapLib:A})=>new A.AttributionControl(w),{position:w.position});return Te.exports.useEffect(()=>{Ao(E._container,w.style)},[w.style]),null}Te.exports.memo(em);function tm(w){const E=ua(({mapLib:A})=>new A.FullscreenControl({container:w.containerId&&document.getElementById(w.containerId)}),{position:w.position});return Te.exports.useEffect(()=>{Ao(E._controlContainer,w.style)},[w.style]),null}Te.exports.memo(tm);const tp=Te.exports.forwardRef((w,E)=>{const A=Te.exports.useRef({props:w}),k=ua(({mapLib:F})=>{const N=new F.GeolocateControl(w),oe=N._setupUI;return N._setupUI=a=>{N._container.hasChildNodes()||oe(a)},N.on("geolocate",a=>{var Q,te;(te=(Q=A.current.props).onGeolocate)===null||te===void 0||te.call(Q,a)}),N.on("error",a=>{var Q,te;(te=(Q=A.current.props).onError)===null||te===void 0||te.call(Q,a)}),N.on("outofmaxbounds",a=>{var Q,te;(te=(Q=A.current.props).onOutOfMaxBounds)===null||te===void 0||te.call(Q,a)}),N.on("trackuserlocationstart",a=>{var Q,te;(te=(Q=A.current.props).onTrackUserLocationStart)===null||te===void 0||te.call(Q,a)}),N.on("trackuserlocationend",a=>{var Q,te;(te=(Q=A.current.props).onTrackUserLocationEnd)===null||te===void 0||te.call(Q,a)}),N},{position:w.position});return A.current.props=w,Te.exports.useImperativeHandle(E,()=>({trigger:()=>k.trigger()}),[]),Te.exports.useEffect(()=>{Ao(k._container,w.style)},[w.style]),null});tp.displayName="GeolocateControl";Te.exports.memo(tp);function im(w){const E=ua(({mapLib:A})=>new A.NavigationControl(w),{position:w.position});return Te.exports.useEffect(()=>{Ao(E._container,w.style)},[w.style]),null}var rm=Te.exports.memo(im);const nm={unit:"metric",maxWidth:100};function ip(w){const E=ua(({mapLib:A})=>new A.ScaleControl(w),{position:w.position});return(E.options.unit!==w.unit||E.options.maxWidth!==w.maxWidth)&&(E.options.maxWidth=w.maxWidth,E.setUnit(w.unit)),Te.exports.useEffect(()=>{Ao(E._container,w.style)},[w.style]),null}ip.defaultProps=nm;Te.exports.memo(ip);var rp={exports:{}};(function(w,E){(function(A,k){w.exports=k()})(sa,function(){var A,k,F;function N(a,Q){if(!A)A=Q;else if(!k)k=Q;else{var te="var sharedChunk = {}; ("+A+")(sharedChunk); ("+k+")(sharedChunk);",fe={};A(fe),F=Q(fe),typeof window!="undefined"&&(F.workerUrl=window.URL.createObjectURL(new Blob([te],{type:"text/javascript"})))}}N(["exports"],function(a){var Q=te;function te(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 fe(i,e,r,o){const c=new Q(i,e,r,o);return function(h){return c.solve(h)}}te.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 ue=fe(.25,.1,.25,1);function ie(i,e,r){return Math.min(r,Math.max(e,i))}function Ge(i,e,r){const o=r-e,c=((i-e)%o+o)%o+e;return c===e?r:c}function Ne(i,...e){for(const r of e)for(const o in r)i[o]=r[o];return i}let Be=1;function tt(i,e){i.forEach(r=>{e[r]&&(e[r]=e[r].bind(e))})}function Ye(i,e,r){const o={};for(const c in i)o[c]=e.call(r||this,i[c],c,i);return o}function Qe(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 pt(i){return Array.isArray(i)?i.map(pt):typeof i=="object"&&i?Ye(i,pt):i}const gt={};function at(i){gt[i]||(typeof console!="undefined"&&console.warn(i),gt[i]=!0)}function Et(i,e,r){return(r.y-i.y)*(e.x-i.x)>(e.y-i.y)*(r.x-i.x)}function Ht(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 Jt(){return typeof WorkerGlobalScope!="undefined"&&typeof self!="undefined"&&self instanceof WorkerGlobalScope}function vr(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 Wi,ur,Hi=null;function Rt(i){if(Hi==null){const e=i.navigator?i.navigator.userAgent:null;Hi=!!i.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return Hi}function pi(i){return typeof ImageBitmap!="undefined"&&i instanceof ImageBitmap}const di={now:typeof performance!="undefined"&&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=>(Wi||(Wi=document.createElement("a")),Wi.href=i,Wi.href),hardwareConcurrency:typeof navigator!="undefined"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(ur==null&&(ur=matchMedia("(prefers-reduced-motion: reduce)")),ur.matches)}};var Xe=Ri;function Ri(i,e){this.x=i,this.y=e}Ri.prototype={clone:function(){return new Ri(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}},Ri.convert=function(i){return i instanceof Ri?i:Array.isArray(i)?new Ri(i[0],i[1]):i};const wi={MAX_PARALLEL_IMAGE_REQUESTS:16,REGISTERED_PROTOCOLS:{}},Ci="mapbox-tiles";let Ai,Kr,gn=500,_n=50;function yn(){typeof caches=="undefined"||Ai||(Ai=caches.open(Ci))}let hr=1/0;const Dr={supported:!1,testSupport:function(i){!Mi&&Rr&&(xn?jn(i):Lr=i)}};let Lr,Rr,Mi=!1,xn=!1;function jn(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,Rr),i.isContextLost())return;Dr.supported=!0}catch{}i.deleteTexture(e),Mi=!0}typeof document!="undefined"&&(Rr=document.createElement("img"),Rr.onload=function(){Lr&&jn(Lr),Lr=null,xn=!0},Rr.onerror=function(){Mi=!0,Lr=null},Rr.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const br={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image"};typeof Object.freeze=="function"&&Object.freeze(br);class Bi 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 Xn=Jt()?()=>self.worker&&self.worker.referrer:()=>(window.location.protocol==="blob:"?window.parent:window).location.href;function Br(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:Xn(),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(T=>T.ok?((I,P,D)=>{(i.type==="arrayBuffer"?I.arrayBuffer():i.type==="json"?I.json():I.text()).then(L=>{h||(P&&D&&function(Z,q,re){if(yn(),!Ai)return;const ce={status:q.status,statusText:q.statusText,headers:new Headers};q.headers.forEach((ae,xe)=>ce.headers.set(xe,ae));const ee=vr(q.headers.get("Cache-Control")||"");ee["no-store"]||(ee["max-age"]&&ce.headers.set("Expires",new Date(re+1e3*ee["max-age"]).toUTCString()),new Date(ce.headers.get("Expires")).getTime()-re<42e4||function(ae,xe){if(Kr===void 0)try{new Response(new ReadableStream),Kr=!0}catch{Kr=!1}Kr?xe(ae.body):ae.blob().then(xe)}(q,ae=>{const xe=new Response(ae,ce);yn(),Ai&&Ai.then(ye=>ye.put(function(Oe){const Ve=Oe.indexOf("?");return Ve<0?Oe:Oe.slice(0,Ve)}(Z.url),xe)).catch(ye=>at(ye.message))}))}(o,P,D),c=!0,e(null,L,I.headers.get("Cache-Control"),I.headers.get("Expires")))}).catch(L=>{h||e(new Error(L.message))})})(T,null,x):T.blob().then(I=>e(new Bi(T.status,T.statusText,i.url,I)))).catch(T=>{T.code!==20&&e(new Error(T.message))})})(),{cancel:()=>{h=!0,c||r.abort()}}}const vn=function(i,e){if(/:\/\//.test(i.url)&&!/^https?:|^file:/.test(i.url)){if(Jt()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",i,e);if(!Jt()){const o=i.url.substring(0,i.url.indexOf("://"));return(wi.REGISTERED_PROTOCOLS[o]||Br)(i,e)}}if(!(/^file:/.test(r=i.url)||/^file:/.test(Xn())&&!/^\w+:/.test(r))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return Br(i,e);if(Jt()&&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 Bi(h.status,h.statusText,o.url,d))}},h.send(o.body),{cancel:()=>h.abort()}}(i,e)},bn=function(i,e){return vn(Ne(i,{type:"arrayBuffer"}),e)};function Wn(i){const e=window.document.createElement("a");return e.href=i,e.protocol===window.document.location.protocol&&e.host===window.document.location.host}const xt="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let pr,Fr;pr=[],Fr=0;const Or=function(i,e){if(Dr.supported&&(i.headers||(i.headers={}),i.headers.accept="image/webp,*/*"),Fr>=wi.MAX_PARALLEL_IMAGE_REQUESTS){const h={requestParameters:i,callback:e,cancelled:!1,cancel(){this.cancelled=!0}};return pr.push(h),h}Fr++;let r=!1;const o=()=>{if(!r)for(r=!0,Fr--;pr.length&&Fr<wi.MAX_PARALLEL_IMAGE_REQUESTS;){const h=pr.shift(),{requestParameters:d,callback:m,cancelled:g}=h;g||(h.cancel=Or(d,m).cancel)}},c=bn(i,(h,d,m,g)=>{o(),h?e(h):d&&function(x,T){typeof createImageBitmap=="function"?function(I,P){const D=new Blob([new Uint8Array(I)],{type:"image/png"});createImageBitmap(D).then(L=>{P(null,L)}).catch(L=>{P(new Error(`Could not load image because of ${L.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})}(x,T):function(I,P){const D=new Image;D.onload=()=>{P(null,D),URL.revokeObjectURL(D.src),D.onload=null,window.requestAnimationFrame(()=>{D.src=xt})},D.onerror=()=>P(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 L=new Blob([new Uint8Array(I)],{type:"image/png"});D.src=I.byteLength?URL.createObjectURL(L):xt}(x,T)}(d,(x,T)=>{x!=null?e(x):T!=null&&e(null,T,{cacheControl:m,expires:g})})});return{cancel:()=>{c.cancel(),o()}}};function Hn(i,e,r){r[i]&&r[i].indexOf(e)!==-1||(r[i]=r[i]||[],r[i].push(e))}function wr(i,e,r){if(r&&r[i]){const o=r[i].indexOf(e);o!==-1&&r[i].splice(o,1)}}class Tr{constructor(e,r={}){Ne(this,r),this.type=e}}class wn extends Tr{constructor(e,r={}){super("error",Ne({error:e},r))}}class Er{on(e,r){return this._listeners=this._listeners||{},Hn(e,r,this._listeners),this}off(e,r){return wr(e,r,this._listeners),wr(e,r,this._oneTimeListeners),this}once(e,r){return this._oneTimeListeners=this._oneTimeListeners||{},Hn(e,r,this._oneTimeListeners),this}fire(e,r){typeof e=="string"&&(e=new Tr(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)wr(o,m,this._oneTimeListeners),m.call(this,e);const d=this._eventedParent;d&&(Ne(e,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),d.fire(e))}else e instanceof wn&&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 _e={$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 Me{constructor(e,r,o,c){this.message=(e?`${e}: `:"")+o,c&&(this.identifier=c),r!=null&&r.__line__&&(this.line=r.__line__)}}function Jr(i){const e=i.value;return e?[new Me(i.key,e,"constants have been deprecated as of v8")]:[]}function ir(i,...e){for(const r of e)for(const o in r)i[o]=r[o];return i}function vt(i){return i instanceof Number||i instanceof String||i instanceof Boolean?i.valueOf():i}function Ki(i){if(Array.isArray(i))return i.map(Ki);if(i instanceof Object&&!(i instanceof Number||i instanceof String||i instanceof Boolean)){const e={};for(const r in i)e[r]=Ki(i[r]);return e}return vt(i)}class Fi extends Error{constructor(e,r){super(r),this.message=r,this.key=e}}class Oi{constructor(e,r=[]){this.parent=e,this.bindings={};for(const[o,c]of r)this.bindings[o]=c}concat(e){return new Oi(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 $r={kind:"null"},Se={kind:"number"},lt={kind:"string"},ot={kind:"boolean"},fi={kind:"color"},Ur={kind:"object"},rt={kind:"value"},Sr={kind:"collator"},oi={kind:"formatted"},Tn={kind:"padding"},Yt={kind:"resolvedImage"};function Ti(i,e){return{kind:"array",itemType:i,N:e}}function Pt(i){if(i.kind==="array"){const e=Pt(i.itemType);return typeof i.N=="number"?`array<${e}, ${i.N}>`:i.itemType.kind==="value"?"array":`array<${e}>`}return i.kind}const En=[$r,Se,lt,ot,fi,oi,Ur,Ti(rt),Tn,Yt];function dr(i,e){if(e.kind==="error")return null;if(i.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!dr(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 En)if(!dr(r,e))return null}}return`Expected ${Pt(i)} but found ${Pt(e)} instead.`}function Yr(i,e){return e.some(r=>r.kind===i.kind)}function Qr(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 Sn,en={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 O(i){return(i=Math.round(i))<0?0:i>255?255:i}function b(i){return O(i[i.length-1]==="%"?parseFloat(i)/100*255:parseInt(i))}function C(i){return(e=i[i.length-1]==="%"?parseFloat(i)/100:parseFloat(i))<0?0:e>1?1:e;var e}function R(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{Sn={}.parseCSSColor=function(i){var e,r=i.replace(/ /g,"").toLowerCase();if(r in en)return en[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=C(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=C(d.pop());case"hsl":if(d.length!==3)return null;var g=(parseFloat(d[0])%360+360)%360/360,x=C(d[1]),T=C(d[2]),I=T<=.5?T*(x+1):T+x-T*x,P=2*T-I;return[O(255*R(P,I,g+1/3)),O(255*R(P,I,g)),O(255*R(P,I,g-1/3)),m];default:return null}}return null}}catch{}class B{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 B)return e;if(typeof e!="string")return;const r=Sn(e);return r?new B(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]}}B.black=new B(0,0,0,1),B.white=new B(1,1,1,1),B.transparent=new B(0,0,0,0),B.red=new B(1,0,0,1);class j{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 K{constructor(e,r,o,c,h){this.text=e,this.image=r,this.scale=o,this.fontStack=c,this.textColor=h}}class W{constructor(e){this.sections=e}static fromString(e){return new W([new K(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 W?e:W.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map(e=>e.text).join("")}}class X{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof X)return e;if(typeof e=="number")return new X([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 X(e)}}toString(){return JSON.stringify(this.values)}}class J{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new J({name:e,available:!1}):null}}function pe(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 ve(i){if(i===null||typeof i=="string"||typeof i=="boolean"||typeof i=="number"||i instanceof B||i instanceof j||i instanceof W||i instanceof X||i instanceof J)return!0;if(Array.isArray(i)){for(const e of i)if(!ve(e))return!1;return!0}if(typeof i=="object"){for(const e in i)if(!ve(i[e]))return!1;return!0}return!1}function he(i){if(i===null)return $r;if(typeof i=="string")return lt;if(typeof i=="boolean")return ot;if(typeof i=="number")return Se;if(i instanceof B)return fi;if(i instanceof j)return Sr;if(i instanceof W)return oi;if(i instanceof X)return Tn;if(i instanceof J)return Yt;if(Array.isArray(i)){const e=i.length;let r;for(const o of i){const c=he(o);if(r){if(r===c)continue;r=rt;break}r=c}return Ti(r||rt,e)}return Ur}function Ue(i){const e=typeof i;return i===null?"":e==="string"||e==="number"||e==="boolean"?String(i):i instanceof B||i instanceof W||i instanceof X||i instanceof J?i.toString():JSON.stringify(i)}class qe{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(!ve(e[1]))return r.error("invalid value");const o=e[1];let c=he(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 qe(c,o)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class Le{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}}const Ke={string:lt,number:Se,boolean:ot,object:Ur};class et{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 Ke)||x==="object")return r.error('The item type argument of "array" must be one of string, number, boolean',1);m=Ke[x],c++}else m=rt;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=Ti(m,g)}else{if(!Ke[h])throw new Error(`Types doesn't contain name = ${h}`);o=Ke[h]}const d=[];for(;c<e.length;c++){const m=r.parse(e[c],c,rt);if(!m)return null;d.push(m)}return new et(o,d)}evaluate(e){for(let r=0;r<this.args.length;r++){const o=this.args[r].evaluate(e);if(!dr(this.type,he(o)))return o;if(r===this.args.length-1)throw new Le(`Expected value to be of type ${Pt(this.type)}, but found ${Pt(he(o))} instead.`)}throw new Error}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const bt={"to-boolean":ot,"to-color":fi,"to-number":Se,"to-string":lt};class it{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(!bt[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=bt[o],h=[];for(let d=1;d<e.length;d++){const m=r.parse(e[d],d,rt);if(!m)return null;h.push(m)}return new it(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 B)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.`:pe(r[0],r[1],r[2],r[3]),!o))return new B(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new Le(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=X.parse(r);if(c)return c}throw new Le(`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 Le(`Could not convert ${JSON.stringify(r)} to number.`)}return this.type.kind==="formatted"?W.fromString(Ue(this.args[0].evaluate(e))):this.type.kind==="resolvedImage"?J.fromString(Ue(this.args[0].evaluate(e))):Ue(this.args[0].evaluate(e))}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const ct=["Unknown","Point","LineString","Polygon"];class wt{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"?ct[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]=B.parse(e)),r}}class kt{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=kt.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,T]of m){g=new An(r.registry,r.path,null,r.scope);const I=[];let P=!1;for(let D=1;D<e.length;D++){const L=e[D],Z=Array.isArray(x)?x[D-1]:x.type,q=g.parse(L,1+I.length,Z);if(!q){P=!0;break}I.push(q)}if(!P)if(Array.isArray(x)&&x.length!==I.length)g.error(`Expected ${x.length} arguments, but found ${I.length} instead.`);else{for(let D=0;D<I.length;D++){const L=Array.isArray(x)?x[D]:x.type,Z=I[D];g.concat(D+1).checkSubtype(L,Z.type)}if(g.errors.length===0)return new kt(o,h,T,I)}}if(m.length===1)r.errors.push(...g.errors);else{const x=(m.length?m:d).map(([I])=>{return P=I,Array.isArray(P)?`(${P.map(Pt).join(", ")})`:`(${Pt(P.type)}...)`;var P}).join(" | "),T=[];for(let I=1;I<e.length;I++){const P=r.parse(e[I],1+T.length);if(!P)return null;T.push(Pt(P.type))}r.error(`Expected arguments of type ${x}, but found (${T.join(", ")}) instead.`)}return null}static register(e,r){kt.definitions=r;for(const o in r)e[o]=kt}}class si{constructor(e,r,o){this.type=Sr,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,ot);if(!c)return null;const h=r.parse(o["diacritic-sensitive"]!==void 0&&o["diacritic-sensitive"],1,ot);if(!h)return null;let d=null;return o.locale&&(d=r.parse(o.locale,1,lt),!d)?null:new si(c,h,d)}evaluate(e){return new j(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 Ut=8192;function _i(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 In(i,e){return!(i[0]<=e[0]||i[2]>=e[2]||i[1]<=e[1]||i[3]>=e[3])}function Kn(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*Ut),Math.round(o*c*Ut)]}function Dt(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 as(i,e){let r=!1;for(let d=0,m=e.length;d<m;d++){const g=e[d];for(let x=0,T=g.length;x<T-1;x++){if(Dt(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 ls(i,e){for(let r=0;r<e.length;r++)if(as(i,e[r]))return!0;return!1}function pa(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 da(i,e,r){for(const x of r)for(let T=0;T<x.length-1;++T)if((m=[(d=x[T+1])[0]-(h=x[T])[0],d[1]-h[1]])[0]*(g=[(c=e)[0]-(o=i)[0],c[1]-o[1]])[1]-m[1]*g[0]!=0&&pa(o,c,h,d)&&pa(h,d,o,c))return!0;var o,c,h,d,m,g;return!1}function cs(i,e){for(let r=0;r<i.length;++r)if(!as(i[r],e))return!1;for(let r=0;r<i.length-1;++r)if(da(i[r],i[r+1],e))return!1;return!0}function Pl(i,e){for(let r=0;r<e.length;r++)if(cs(i,e[r]))return!0;return!1}function Mo(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=Kn(i[c][d],r);_i(e,m),h.push(m)}o.push(h)}return o}function us(i,e,r){const o=[];for(let c=0;c<i.length;c++){const h=Mo(i[c],e,r);o.push(h)}return o}function fa(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}_i(e,i)}function ma(i,e,r,o){const c=Math.pow(2,o.z)*Ut,h=[o.x*Ut,o.y*Ut],d=[];for(const m of i)for(const g of m){const x=[g.x+h[0],g.y+h[1]];fa(x,e,r,c),d.push(x)}return d}function ga(i,e,r,o){const c=Math.pow(2,o.z)*Ut,h=[o.x*Ut,o.y*Ut],d=[];for(const g of i){const x=[];for(const T of g){const I=[T.x+h[0],T.y+h[1]];_i(e,I),x.push(I)}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)fa(x,e,r,c)}var m;return d}class tn{constructor(e,r){this.type=ot,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(ve(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 tn(o,o.features[c].geometry)}else if(o.type==="Feature"){const c=o.geometry.type;if(c==="Polygon"||c==="MultiPolygon")return new tn(o,o.geometry)}else if(o.type==="Polygon"||o.type==="MultiPolygon")return new tn(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=Mo(o.coordinates,h,d),g=ma(r.geometry(),c,h,d);if(!In(c,h))return!1;for(const x of g)if(!as(x,m))return!1}if(o.type==="MultiPolygon"){const m=us(o.coordinates,h,d),g=ma(r.geometry(),c,h,d);if(!In(c,h))return!1;for(const x of g)if(!ls(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=Mo(o.coordinates,h,d),g=ga(r.geometry(),c,h,d);if(!In(c,h))return!1;for(const x of g)if(!cs(x,m))return!1}if(o.type==="MultiPolygon"){const m=us(o.coordinates,h,d),g=ga(r.geometry(),c,h,d);if(!In(c,h))return!1;for(const x of g)if(!Pl(x,m))return!1}return!0}(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}function Jn(i){if(i instanceof kt&&(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 tn)return!1;let e=!0;return i.eachChild(r=>{e&&!Jn(r)&&(e=!1)}),e}function Cn(i){if(i instanceof kt&&i.name==="feature-state")return!1;let e=!0;return i.eachChild(r=>{e&&!Cn(r)&&(e=!1)}),e}function Po(i,e){if(i instanceof kt&&e.indexOf(i.name)>=0)return!1;let r=!0;return i.eachChild(o=>{r&&!Po(o,e)&&(r=!1)}),r}class zo{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 zo(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 An{constructor(e,r=[],o,c=new Oi,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 et(h,[c]):d==="coerce"?new it(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 qe)&&d.type.kind!=="resolvedImage"&&hs(d)){const m=new wt;try{d=new qe(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 An(this.registry,c,r||null,h,this.errors)}error(e,...r){const o=`${this.key}${r.map(c=>`[${c}]`).join("")}`;this.errors.push(new Fi(o,e))}checkSubtype(e,r){const o=dr(e,r);return o&&this.error(o),o}}function hs(i){if(i instanceof zo)return hs(i.boundExpression);if(i instanceof kt&&i.name==="error"||i instanceof si||i instanceof tn)return!1;const e=i instanceof it||i instanceof et;let r=!0;return i.eachChild(o=>{r=e?r&&hs(o):r&&o instanceof qe}),!!r&&Jn(i)&&Po(i,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function ko(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 Le("Input is not a number.");d=m-1}return 0}class Yn{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,T=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 I=r.parse(g,T,h);if(!I)return null;h=h||I.type,c.push([m,I])}return new Yn(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[ko(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 Vt(i,e,r){return i*(1-r)+e*r}var Qn=Object.freeze({__proto__:null,number:Vt,color:function(i,e,r){return new B(Vt(i.r,e.r,r),Vt(i.g,e.g,r),Vt(i.b,e.b,r),Vt(i.a,e.a,r))},array:function(i,e,r){return i.map((o,c)=>Vt(o,e[c],r))},padding:function(i,e,r){const o=i.values,c=e.values;return new X([Vt(o[0],c[0],r),Vt(o[1],c[1],r),Vt(o[2],c[2],r),Vt(o[3],c[3],r)])}});const _a=.95047,ya=1.08883,ps=4/29,Do=6/29,xa=3*Do*Do,zl=Math.PI/180,kl=180/Math.PI;function ds(i){return i>.008856451679035631?Math.pow(i,1/3):i/xa+ps}function fs(i){return i>Do?i*i*i:xa*(i-ps)}function ms(i){return 255*(i<=.0031308?12.92*i:1.055*Math.pow(i,1/2.4)-.055)}function gs(i){return(i/=255)<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4)}function St(i){const e=gs(i.r),r=gs(i.g),o=gs(i.b),c=ds((.4124564*e+.3575761*r+.1804375*o)/_a),h=ds((.2126729*e+.7151522*r+.072175*o)/1);return{l:116*h-16,a:500*(c-h),b:200*(h-ds((.0193339*e+.119192*r+.9503041*o)/ya)),alpha:i.a}}function va(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*fs(e),r=_a*fs(r),o=ya*fs(o),new B(ms(3.2404542*r-1.5371385*e-.4985314*o),ms(-.969266*r+1.8760108*e+.041556*o),ms(.0556434*r-.2040259*e+1.0572252*o),i.alpha)}function Dl(i,e,r){const o=e-i;return i+r*(o>180||o<-180?o-360*Math.round(o/360):o)}const eo={forward:St,reverse:va,interpolate:function(i,e,r){return{l:Vt(i.l,e.l,r),a:Vt(i.a,e.a,r),b:Vt(i.b,e.b,r),alpha:Vt(i.alpha,e.alpha,r)}}},to={forward:function(i){const{l:e,a:r,b:o}=St(i),c=Math.atan2(o,r)*kl;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*zl,r=i.c;return va({l:i.l,a:Math.cos(e)*r,b:Math.sin(e)*r,alpha:i.alpha})},interpolate:function(i,e,r){return{h:Dl(i.h,e.h,r),c:Vt(i.c,e.c,r),l:Vt(i.l,e.l,r),alpha:Vt(i.alpha,e.alpha,r)}}};var ba=Object.freeze({__proto__:null,lab:eo,hcl:to});class $i{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=_s(r,e.base,o,c);else if(e.name==="linear")h=_s(r,1,o,c);else if(e.name==="cubic-bezier"){const d=e.controlPoints;h=new Q(d[0],d[1],d[2],d[3]).solve(_s(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(T=>typeof T!="number"||T<0||T>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=fi:r.expectedType&&r.expectedType.kind!=="value"&&(g=r.expectedType);for(let x=0;x<d.length;x+=2){const T=d[x],I=d[x+1],P=x+3,D=x+4;if(typeof T!="number")return r.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',P);if(m.length&&m[m.length-1][0]>=T)return r.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',P);const L=r.parse(I,D,g);if(!L)return null;g=g||L.type,m.push([T,L])}return g.kind==="number"||g.kind==="color"||g.kind==="padding"||g.kind==="array"&&g.itemType.kind==="number"&&typeof g.N=="number"?new $i(g,o,c,h,m):r.error(`Type ${Pt(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=ko(r,c),m=$i.interpolationFactor(this.interpolation,c,r[d],r[d+1]),g=o[d].evaluate(e),x=o[d+1].evaluate(e);return this.operator==="interpolate"?Qn[this.type.kind.toLowerCase()](g,x,m):this.operator==="interpolate-hcl"?to.reverse(to.interpolate(to.forward(g),to.forward(x),m)):eo.reverse(eo.interpolate(eo.forward(g),eo.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 _s(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 Lo{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=>dr(c,m.type));return new Lo(d?rt: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 J&&!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 Ro{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 Ro(o,c):null}outputDefined(){return this.result.outputDefined()}}class ys{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,Ti(r.expectedType||rt));return o&&c?new ys(c.type.itemType,o,c):null}evaluate(e){const r=this.index.evaluate(e),o=this.input.evaluate(e);if(r<0)throw new Le(`Array index out of bounds: ${r} < 0.`);if(r>=o.length)throw new Le(`Array index out of bounds: ${r} > ${o.length-1}.`);if(r!==Math.floor(r))throw new Le(`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 xs{constructor(e,r){this.type=ot,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,rt),c=r.parse(e[2],2,rt);return o&&c?Yr(o.type,[ot,lt,Se,$r,rt])?new xs(o,c):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${Pt(o.type)} instead`):null}evaluate(e){const r=this.needle.evaluate(e),o=this.haystack.evaluate(e);if(!o)return!1;if(!Qr(r,["boolean","string","number","null"]))throw new Le(`Expected first argument to be of type boolean, string, number or null, but found ${Pt(he(r))} instead.`);if(!Qr(o,["string","array"]))throw new Le(`Expected second argument to be of type array or string, but found ${Pt(he(o))} instead.`);return o.indexOf(r)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}}class Bo{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,rt),c=r.parse(e[2],2,rt);if(!o||!c)return null;if(!Yr(o.type,[ot,lt,Se,$r,rt]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${Pt(o.type)} instead`);if(e.length===4){const h=r.parse(e[3],3,Se);return h?new Bo(o,c,h):null}return new Bo(o,c)}evaluate(e){const r=this.needle.evaluate(e),o=this.haystack.evaluate(e);if(!Qr(r,["boolean","string","number","null"]))throw new Le(`Expected first argument to be of type boolean, string, number or null, but found ${Pt(he(r))} instead.`);if(!Qr(o,["string","array"]))throw new Le(`Expected second argument to be of type array or string, but found ${Pt(he(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 vs{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 T=e[x];const I=e[x+1];Array.isArray(T)||(T=[T]);const P=r.concat(x);if(T.length===0)return P.error("Expected at least one branch label.");for(const L of T){if(typeof L!="number"&&typeof L!="string")return P.error("Branch labels must be numbers or strings.");if(typeof L=="number"&&Math.abs(L)>Number.MAX_SAFE_INTEGER)return P.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof L=="number"&&Math.floor(L)!==L)return P.error("Numeric branch labels must be integer values.");if(o){if(P.checkSubtype(o,he(L)))return null}else o=he(L);if(h[String(L)]!==void 0)return P.error("Branch labels must be unique.");h[String(L)]=d.length}const D=r.parse(I,x,c);if(!D)return null;c=c||D.type,d.push(D)}const m=r.parse(e[1],1,rt);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 vs(o,c,m,h,d,g):null}evaluate(e){const r=this.input.evaluate(e);return(he(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 bs{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,ot);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 bs(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 Fo{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,rt),c=r.parse(e[2],2,Se);if(!o||!c)return null;if(!Yr(o.type,[Ti(rt),lt,rt]))return r.error(`Expected first argument to be of type array or string, but found ${Pt(o.type)} instead`);if(e.length===4){const h=r.parse(e[3],3,Se);return h?new Fo(o.type,o,c,h):null}return new Fo(o.type,o,c)}evaluate(e){const r=this.input.evaluate(e),o=this.beginIndex.evaluate(e);if(!Qr(r,["string","array"]))throw new Le(`Expected first argument to be of type array or string, but found ${Pt(he(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 wa(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 Ta(i,e,r,o){return o.compare(e,r)===0}function Mn(i,e,r){const o=i!=="=="&&i!=="!=";return class np{constructor(h,d,m){this.type=ot,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,rt);if(!g)return null;if(!wa(m,g.type))return d.concat(1).error(`"${m}" comparisons are not supported for type '${Pt(g.type)}'.`);let x=d.parse(h[2],2,rt);if(!x)return null;if(!wa(m,x.type))return d.concat(2).error(`"${m}" comparisons are not supported for type '${Pt(x.type)}'.`);if(g.type.kind!==x.type.kind&&g.type.kind!=="value"&&x.type.kind!=="value")return d.error(`Cannot compare types '${Pt(g.type)}' and '${Pt(x.type)}'.`);o&&(g.type.kind==="value"&&x.type.kind!=="value"?g=new et(x.type,[g]):g.type.kind!=="value"&&x.type.kind==="value"&&(x=new et(g.type,[x])));let T=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(T=d.parse(h[3],3,Sr),!T)return null}return new np(g,x,T)}evaluate(h){const d=this.lhs.evaluate(h),m=this.rhs.evaluate(h);if(o&&this.hasUntypedArgument){const g=he(d),x=he(m);if(g.kind!==x.kind||g.kind!=="string"&&g.kind!=="number")throw new Le(`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=he(d),x=he(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 Ll=Mn("==",function(i,e,r){return e===r},Ta),Rl=Mn("!=",function(i,e,r){return e!==r},function(i,e,r,o){return!Ta(0,e,r,o)}),Bl=Mn("<",function(i,e,r){return e<r},function(i,e,r,o){return o.compare(e,r)<0}),Fl=Mn(">",function(i,e,r){return e>r},function(i,e,r,o){return o.compare(e,r)>0}),Ol=Mn("<=",function(i,e,r){return e<=r},function(i,e,r,o){return o.compare(e,r)<=0}),$l=Mn(">=",function(i,e,r){return e>=r},function(i,e,r,o){return o.compare(e,r)>=0});class ws{constructor(e,r,o,c,h){this.type=lt,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,lt),!h))return null;let d=null;if(c.currency&&(d=r.parse(c.currency,1,lt),!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 ws(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 Oo{constructor(e){this.type=oi,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,Ti(lt)),!x))return null;let T=null;if(m["text-color"]&&(T=r.parse(m["text-color"],1,fi),!T))return null;const I=c[c.length-1];I.scale=g,I.font=x,I.textColor=T}else{const g=r.parse(e[d],1,rt);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 Oo(c)}evaluate(e){return new W(this.sections.map(r=>{const o=r.content.evaluate(e);return he(o)===Yt?new K("",o,null,null,null):new K(Ue(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 Ts{constructor(e){this.type=Yt,this.input=e}static parse(e,r){if(e.length!==2)return r.error("Expected two arguments.");const o=r.parse(e[1],1,lt);return o?new Ts(o):r.error("No image name provided.")}evaluate(e){const r=this.input.evaluate(e),o=J.fromString(r);return o&&e.availableImages&&(o.available=e.availableImages.indexOf(r)>-1),o}eachChild(e){e(this.input)}outputDefined(){return!1}}class Es{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 ${Pt(o.type)} instead.`):new Es(o):null}evaluate(e){const r=this.input.evaluate(e);if(typeof r=="string"||Array.isArray(r))return r.length;throw new Le(`Expected value to be of type string or array, but found ${Pt(he(r))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}}const Pn={"==":Ll,"!=":Rl,">":Fl,"<":Bl,">=":$l,"<=":Ol,array:et,at:ys,boolean:et,case:bs,coalesce:Lo,collator:si,format:Oo,image:Ts,in:xs,"index-of":Bo,interpolate:$i,"interpolate-hcl":$i,"interpolate-lab":$i,length:Es,let:Ro,literal:qe,match:vs,number:et,"number-format":ws,object:et,slice:Fo,step:Yn,string:et,"to-boolean":it,"to-color":it,"to-number":it,"to-string":it,var:zo,within:tn};function Ea(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=pe(e,r,o,h);if(d)throw new Le(d);return new B(e/255*h,r/255*h,o/255*h,h)}function Sa(i,e){return i in e}function $o(i,e){const r=e[i];return r===void 0?null:r}function rn(i){return{type:i}}function Ia(i){return{result:"success",value:i}}function zn(i){return{result:"error",value:i}}function Ft(i){return i["property-type"]==="data-driven"||i["property-type"]==="cross-faded-data-driven"}function Ca(i){return!!i.expression&&i.expression.parameters.indexOf("zoom")>-1}function mt(i){return!!i.expression&&i.expression.interpolated}function It(i){return i instanceof Number?"number":i instanceof String?"string":i instanceof Boolean?"boolean":Array.isArray(i)?"array":i===null?"null":typeof i}function Bt(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)}function Nt(i){return i}function io(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||(mt(e)?"exponential":"interval");if(r||e.type==="padding"){const x=r?B.parse:X.parse;(i=ir({},i)).stops&&(i.stops=i.stops.map(T=>[T[0],x(T[1])])),i.default=x(i.default?i.default:e.default)}if(i.colorSpace&&i.colorSpace!=="rgb"&&!ba[i.colorSpace])throw new Error(`Unknown color space: ${i.colorSpace}`);let d,m,g;if(h==="exponential")d=Aa;else if(h==="interval")d=Vl;else if(h==="categorical"){d=Ul,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=Nl}if(o){const x={},T=[];for(let D=0;D<i.stops.length;D++){const L=i.stops[D],Z=L[0].zoom;x[Z]===void 0&&(x[Z]={zoom:Z,type:i.type,property:i.property,default:i.default,stops:[]},T.push(Z)),x[Z].stops.push([L[0].value,L[1]])}const I=[];for(const D of T)I.push([x[D].zoom,io(x[D],e)]);const P={name:"linear"};return{kind:"composite",interpolationType:P,interpolationFactor:$i.interpolationFactor.bind(void 0,P),zoomStops:I.map(D=>D[0]),evaluate:({zoom:D},L)=>Aa({stops:I,base:i.base},e,D).evaluate(D,L)}}if(c){const x=h==="exponential"?{name:"exponential",base:i.base!==void 0?i.base:1}:null;return{kind:"camera",interpolationType:x,interpolationFactor:$i.interpolationFactor.bind(void 0,x),zoomStops:i.stops.map(T=>T[0]),evaluate:({zoom:T})=>d(i,e,T,m,g)}}return{kind:"source",evaluate(x,T){const I=T&&T.properties?T.properties[i.property]:void 0;return I===void 0?kn(i.default,e.default):d(i,e,I,m,g)}}}function kn(i,e,r){return i!==void 0?i:e!==void 0?e:r!==void 0?r:void 0}function Ul(i,e,r,o,c){return kn(typeof r===c?o[r]:void 0,i.default,e.default)}function Vl(i,e,r){if(It(r)!=="number")return kn(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=ko(i.stops.map(h=>h[0]),r);return i.stops[c][1]}function Aa(i,e,r){const o=i.base!==void 0?i.base:1;if(It(r)!=="number")return kn(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=ko(i.stops.map(T=>T[0]),r),d=function(T,I,P,D){const L=D-P,Z=T-P;return L===0?0:I===1?Z/L:(Math.pow(I,Z)-1)/(Math.pow(I,L)-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=Qn[e.type]||Nt;if(i.colorSpace&&i.colorSpace!=="rgb"){const T=ba[i.colorSpace];x=(I,P)=>T.reverse(T.interpolate(T.forward(I),T.forward(P),d))}return typeof m.evaluate=="function"?{evaluate(...T){const I=m.evaluate.apply(void 0,T),P=g.evaluate.apply(void 0,T);if(I!==void 0&&P!==void 0)return x(I,P,d)}}:x(m,g,d)}function Nl(i,e,r){switch(e.type){case"color":r=B.parse(r);break;case"formatted":r=W.fromString(r.toString());break;case"resolvedImage":r=J.fromString(r.toString());break;case"padding":r=X.parse(r);break;default:It(r)===e.type||e.type==="enum"&&e.values[r]||(r=void 0)}return kn(r,i.default,e.default)}kt.register(Pn,{error:[{kind:"error"},[lt],(i,[e])=>{throw new Le(e.evaluate(i))}],typeof:[lt,[rt],(i,[e])=>Pt(he(e.evaluate(i)))],"to-rgba":[Ti(Se,4),[fi],(i,[e])=>e.evaluate(i).toArray()],rgb:[fi,[Se,Se,Se],Ea],rgba:[fi,[Se,Se,Se,Se],Ea],has:{type:ot,overloads:[[[lt],(i,[e])=>Sa(e.evaluate(i),i.properties())],[[lt,Ur],(i,[e,r])=>Sa(e.evaluate(i),r.evaluate(i))]]},get:{type:rt,overloads:[[[lt],(i,[e])=>$o(e.evaluate(i),i.properties())],[[lt,Ur],(i,[e,r])=>$o(e.evaluate(i),r.evaluate(i))]]},"feature-state":[rt,[lt],(i,[e])=>$o(e.evaluate(i),i.featureState||{})],properties:[Ur,[],i=>i.properties()],"geometry-type":[lt,[],i=>i.geometryType()],id:[rt,[],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:[rt,[],i=>i.globals.accumulated===void 0?null:i.globals.accumulated],"+":[Se,rn(Se),(i,e)=>{let r=0;for(const o of e)r+=o.evaluate(i);return r}],"*":[Se,rn(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,rn(Se),(i,e)=>Math.min(...e.map(r=>r.evaluate(i)))],max:[Se,rn(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-==":[ot,[lt,rt],(i,[e,r])=>i.properties()[e.value]===r.value],"filter-id-==":[ot,[rt],(i,[e])=>i.id()===e.value],"filter-type-==":[ot,[lt],(i,[e])=>i.geometryType()===e.value],"filter-<":[ot,[lt,rt],(i,[e,r])=>{const o=i.properties()[e.value],c=r.value;return typeof o==typeof c&&o<c}],"filter-id-<":[ot,[rt],(i,[e])=>{const r=i.id(),o=e.value;return typeof r==typeof o&&r<o}],"filter->":[ot,[lt,rt],(i,[e,r])=>{const o=i.properties()[e.value],c=r.value;return typeof o==typeof c&&o>c}],"filter-id->":[ot,[rt],(i,[e])=>{const r=i.id(),o=e.value;return typeof r==typeof o&&r>o}],"filter-<=":[ot,[lt,rt],(i,[e,r])=>{const o=i.properties()[e.value],c=r.value;return typeof o==typeof c&&o<=c}],"filter-id-<=":[ot,[rt],(i,[e])=>{const r=i.id(),o=e.value;return typeof r==typeof o&&r<=o}],"filter->=":[ot,[lt,rt],(i,[e,r])=>{const o=i.properties()[e.value],c=r.value;return typeof o==typeof c&&o>=c}],"filter-id->=":[ot,[rt],(i,[e])=>{const r=i.id(),o=e.value;return typeof r==typeof o&&r>=o}],"filter-has":[ot,[rt],(i,[e])=>e.value in i.properties()],"filter-has-id":[ot,[],i=>i.id()!==null&&i.id()!==void 0],"filter-type-in":[ot,[Ti(lt)],(i,[e])=>e.value.indexOf(i.geometryType())>=0],"filter-id-in":[ot,[Ti(rt)],(i,[e])=>e.value.indexOf(i.id())>=0],"filter-in-small":[ot,[lt,Ti(rt)],(i,[e,r])=>r.value.indexOf(i.properties()[e.value])>=0],"filter-in-large":[ot,[lt,Ti(rt)],(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:ot,overloads:[[[ot,ot],(i,[e,r])=>e.evaluate(i)&&r.evaluate(i)],[rn(ot),(i,e)=>{for(const r of e)if(!r.evaluate(i))return!1;return!0}]]},any:{type:ot,overloads:[[[ot,ot],(i,[e,r])=>e.evaluate(i)||r.evaluate(i)],[rn(ot),(i,e)=>{for(const r of e)if(r.evaluate(i))return!0;return!1}]]},"!":[ot,[ot],(i,[e])=>!e.evaluate(i)],"is-supported-script":[ot,[lt],(i,[e])=>{const r=i.globals&&i.globals.isSupportedScript;return!r||r(e.evaluate(i))}],upcase:[lt,[lt],(i,[e])=>e.evaluate(i).toUpperCase()],downcase:[lt,[lt],(i,[e])=>e.evaluate(i).toLowerCase()],concat:[lt,rn(rt),(i,e)=>e.map(r=>Ue(r.evaluate(i))).join("")],"resolved-locale":[lt,[Sr],(i,[e])=>e.evaluate(i).resolvedLocale()]});class Uo{constructor(e,r){this.expression=e,this._warningHistory={},this._evaluator=new wt,this._defaultValue=r?function(o){return o.type==="color"&&Bt(o.default)?new B(0,0,0,0):o.type==="color"?B.parse(o.default)||null:o.type==="padding"?X.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 Le(`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!="undefined"&&console.warn(m.message)),this._defaultValue}}}function ro(i){return Array.isArray(i)&&i.length>0&&typeof i[0]=="string"&&i[0]in Pn}function no(i,e){const r=new An(Pn,[],e?function(c){const h={color:fi,string:lt,number:Se,enum:lt,boolean:ot,formatted:oi,padding:Tn,resolvedImage:Yt};return c.type==="array"?Ti(h[c.value]||rt,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?Ia(new Uo(o,e)):zn(r.errors)}class oo{constructor(e,r){this.kind=e,this._styleExpression=r,this.isStateDependent=e!=="constant"&&!Cn(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 Ss{constructor(e,r,o,c){this.kind=e,this.zoomStops=o,this._styleExpression=r,this.isStateDependent=e!=="camera"&&!Cn(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?$i.interpolationFactor(this.interpolationType,e,r,o):0}}function Ma(i,e){const r=no(i,e);if(r.result==="error")return r;const o=r.value.expression,c=Jn(o);if(!c&&!Ft(e))return zn([new Fi("","data expressions not supported")]);const h=Po(o,["zoom"]);if(!h&&!Ca(e))return zn([new Fi("","zoom expressions not supported")]);const d=No(o);return d||h?d instanceof Fi?zn([d]):d instanceof $i&&!mt(e)?zn([new Fi("",'"interpolate" expressions cannot be used with this property')]):Ia(d?new Ss(c?"camera":"composite",r.value,d.labels,d instanceof $i?d.interpolation:void 0):new oo(c?"constant":"source",r.value)):zn([new Fi("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Vo{constructor(e,r){this._parameters=e,this._specification=r,ir(this,io(this._parameters,this._specification))}static deserialize(e){return new Vo(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function No(i){let e=null;if(i instanceof Ro)e=No(i.result);else if(i instanceof Lo){for(const r of i.args)if(e=No(r),e)break}else(i instanceof Yn||i instanceof $i)&&i.input instanceof kt&&i.input.name==="zoom"&&(e=i);return e instanceof Fi||i.eachChild(r=>{const o=No(r);o instanceof Fi?e=o:!e&&o?e=new Fi("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&o&&e!==o&&(e=new Fi("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}function rr(i){const e=i.key,r=i.value,o=i.valueSpec||{},c=i.objectElementValidators||{},h=i.style,d=i.styleSpec;let m=[];const g=It(r);if(g!=="object")return[new Me(e,r,`object expected, ${g} found`)];for(const x in r){const T=x.split(".")[0],I=o[T]||o["*"];let P;if(c[T])P=c[T];else if(o[T])P=Vi;else if(c["*"])P=c["*"];else{if(!o["*"]){m.push(new Me(e,r[x],`unknown property "${x}"`));continue}P=Vi}m=m.concat(P({key:(e&&`${e}.`)+x,value:r[x],valueSpec:I,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 Me(e,r,`missing required property "${x}"`));return m}function Pa(i){const e=i.value,r=i.valueSpec,o=i.style,c=i.styleSpec,h=i.key,d=i.arrayElementValidator||Vi;if(It(e)!=="array")return[new Me(h,e,`array expected, ${It(e)} found`)];if(r.length&&e.length!==r.length)return[new Me(h,e,`array length ${r.length} expected, length ${e.length} found`)];if(r["min-length"]&&e.length<r["min-length"])return[new Me(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),It(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 Is(i){const e=i.key,r=i.value,o=i.valueSpec;let c=It(r);return c==="number"&&r!=r&&(c="NaN"),c!=="number"?[new Me(e,r,`number expected, ${c} found`)]:"minimum"in o&&r<o.minimum?[new Me(e,r,`${r} is less than the minimum value ${o.minimum}`)]:"maximum"in o&&r>o.maximum?[new Me(e,r,`${r} is greater than the maximum value ${o.maximum}`)]:[]}function za(i){const e=i.valueSpec,r=vt(i.value.type);let o,c,h,d={};const m=r!=="categorical"&&i.value.property===void 0,g=!m,x=It(i.value.stops)==="array"&&It(i.value.stops[0])==="array"&&It(i.value.stops[0][0])==="object",T=rr({key:i.key,value:i.value,valueSpec:i.styleSpec.function,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{stops:function(D){if(r==="identity")return[new Me(D.key,D.value,'identity function may not have a "stops" property')];let L=[];const Z=D.value;return L=L.concat(Pa({key:D.key,value:Z,valueSpec:D.valueSpec,style:D.style,styleSpec:D.styleSpec,arrayElementValidator:I})),It(Z)==="array"&&Z.length===0&&L.push(new Me(D.key,Z,"array must have at least one stop")),L},default:function(D){return Vi({key:D.key,value:D.value,valueSpec:e,style:D.style,styleSpec:D.styleSpec})}}});return r==="identity"&&m&&T.push(new Me(i.key,i.value,'missing required property "property"')),r==="identity"||i.value.stops||T.push(new Me(i.key,i.value,'missing required property "stops"')),r==="exponential"&&i.valueSpec.expression&&!mt(i.valueSpec)&&T.push(new Me(i.key,i.value,"exponential functions not supported")),i.styleSpec.$version>=8&&(g&&!Ft(i.valueSpec)?T.push(new Me(i.key,i.value,"property functions not supported")):m&&!Ca(i.valueSpec)&&T.push(new Me(i.key,i.value,"zoom functions not supported"))),r!=="categorical"&&!x||i.value.property!==void 0||T.push(new Me(i.key,i.value,'"property" property is required')),T;function I(D){let L=[];const Z=D.value,q=D.key;if(It(Z)!=="array")return[new Me(q,Z,`array expected, ${It(Z)} found`)];if(Z.length!==2)return[new Me(q,Z,`array length 2 expected, length ${Z.length} found`)];if(x){if(It(Z[0])!=="object")return[new Me(q,Z,`object expected, ${It(Z[0])} found`)];if(Z[0].zoom===void 0)return[new Me(q,Z,"object stop key must have zoom")];if(Z[0].value===void 0)return[new Me(q,Z,"object stop key must have value")];if(h&&h>vt(Z[0].zoom))return[new Me(q,Z[0].zoom,"stop zoom values must appear in ascending order")];vt(Z[0].zoom)!==h&&(h=vt(Z[0].zoom),c=void 0,d={}),L=L.concat(rr({key:`${q}[0]`,value:Z[0],valueSpec:{zoom:{}},style:D.style,styleSpec:D.styleSpec,objectElementValidators:{zoom:Is,value:P}}))}else L=L.concat(P({key:`${q}[0]`,value:Z[0],valueSpec:{},style:D.style,styleSpec:D.styleSpec},Z));return ro(Ki(Z[1]))?L.concat([new Me(`${q}[1]`,Z[1],"expressions are not allowed in function stops.")]):L.concat(Vi({key:`${q}[1]`,value:Z[1],valueSpec:e,style:D.style,styleSpec:D.styleSpec}))}function P(D,L){const Z=It(D.value),q=vt(D.value),re=D.value!==null?D.value:L;if(o){if(Z!==o)return[new Me(D.key,re,`${Z} stop domain type must match previous stop domain type ${o}`)]}else o=Z;if(Z!=="number"&&Z!=="string"&&Z!=="boolean")return[new Me(D.key,re,"stop domain value must be a number, string, or boolean")];if(Z!=="number"&&r!=="categorical"){let ce=`number expected, ${Z} found`;return Ft(e)&&r===void 0&&(ce+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new Me(D.key,re,ce)]}return r!=="categorical"||Z!=="number"||isFinite(q)&&Math.floor(q)===q?r!=="categorical"&&Z==="number"&&c!==void 0&&q<c?[new Me(D.key,re,"stop domain values must appear in ascending order")]:(c=q,r==="categorical"&&q in d?[new Me(D.key,re,"stop domain values must be unique")]:(d[q]=!0,[])):[new Me(D.key,re,`integer expected, found ${q}`)]}}function nn(i){const e=(i.expressionContext==="property"?Ma:no)(Ki(i.value),i.valueSpec);if(e.result==="error")return e.value.map(o=>new Me(`${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 Me(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"&&!Cn(r))return[new Me(i.key,i.value,'"feature-state" data expressions are not supported with layout properties.')];if(i.expressionContext==="filter"&&!Cn(r))return[new Me(i.key,i.value,'"feature-state" data expressions are not supported with filters.')];if(i.expressionContext&&i.expressionContext.indexOf("cluster")===0){if(!Po(r,["zoom","feature-state"]))return[new Me(i.key,i.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(i.expressionContext==="cluster-initial"&&!Jn(r))return[new Me(i.key,i.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function so(i){const e=i.key,r=i.value,o=i.valueSpec,c=[];return Array.isArray(o.values)?o.values.indexOf(vt(r))===-1&&c.push(new Me(e,r,`expected one of [${o.values.join(", ")}], ${JSON.stringify(r)} found`)):Object.keys(o.values).indexOf(vt(r))===-1&&c.push(new Me(e,r,`expected one of [${Object.keys(o.values).join(", ")}], ${JSON.stringify(r)} found`)),c}function Dn(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(!Dn(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}const Gl={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Go(i){if(i==null)return{filter:()=>!0,needGeometry:!1};Dn(i)||(i=ao(i));const e=no(i,Gl);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:Da(i)}}function ka(i,e){return i<e?-1:i>e?1:0}function Da(i){if(!Array.isArray(i))return!1;if(i[0]==="within")return!0;for(let e=1;e<i.length;e++)if(Da(i[e]))return!0;return!1}function ao(i){if(!i)return!0;const e=i[0];return i.length<=1?e!=="any":e==="=="?Cs(i[1],i[2],"=="):e==="!="?Ln(Cs(i[1],i[2],"==")):e==="<"||e===">"||e==="<="||e===">="?Cs(i[1],i[2],e):e==="any"?(r=i.slice(1),["any"].concat(r.map(ao))):e==="all"?["all"].concat(i.slice(1).map(ao)):e==="none"?["all"].concat(i.slice(1).map(ao).map(Ln)):e==="in"?qo(i[1],i.slice(2)):e==="!in"?Ln(qo(i[1],i.slice(2))):e==="has"?lo(i[1]):e==="!has"?Ln(lo(i[1])):e!=="within"||i;var r}function Cs(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 qo(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(ka)]]:["filter-in-small",i,["literal",e]]}}function lo(i){switch(i){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",i]}}function Ln(i){return["!",i]}function co(i){return Dn(Ki(i.value))?nn(ir({},i,{expressionContext:"filter",valueSpec:{value:"boolean"}})):La(i)}function La(i){const e=i.value,r=i.key;if(It(e)!=="array")return[new Me(r,e,`array expected, ${It(e)} found`)];const o=i.styleSpec;let c,h=[];if(e.length<1)return[new Me(r,e,"filter array must have at least 1 element")];switch(h=h.concat(so({key:`${r}[0]`,value:e[0],valueSpec:o.filter_operator,style:i.style,styleSpec:i.styleSpec})),vt(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&vt(e[1])==="$type"&&h.push(new Me(r,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":e.length!==3&&h.push(new Me(r,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(c=It(e[1]),c!=="string"&&h.push(new Me(`${r}[1]`,e[1],`string expected, ${c} found`)));for(let d=2;d<e.length;d++)c=It(e[d]),vt(e[1])==="$type"?h=h.concat(so({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 Me(`${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(La({key:`${r}[${d}]`,value:e[d],style:i.style,styleSpec:i.styleSpec}));break;case"has":case"!has":c=It(e[1]),e.length!==2?h.push(new Me(r,e,`filter array for "${e[0]}" operator must have 2 elements`)):c!=="string"&&h.push(new Me(`${r}[1]`,e[1],`string expected, ${c} found`));break;case"within":c=It(e[1]),e.length!==2?h.push(new Me(r,e,`filter array for "${e[0]}" operator must have 2 elements`)):c!=="object"&&h.push(new Me(`${r}[1]`,e[1],`object expected, ${c} found`))}return h}function uo(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 Vi({key:r,value:h,valueSpec:c.transition,style:o,styleSpec:c});const x=i.valueSpec||m[d];if(!x)return[new Me(r,h,`unknown property "${d}"`)];let T;if(It(h)==="string"&&Ft(x)&&!x.tokens&&(T=/^{([^}]+)}$/.exec(h)))return[new Me(r,h,`"${d}" does not support interpolation syntax
2
+ Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(T[1])} }\`.`)];const I=[];return i.layerType==="symbol"&&(d==="text-field"&&o&&!o.glyphs&&I.push(new Me(r,h,'use of "text-field" requires a style "glyphs" property')),d==="text-font"&&Bt(Ki(h))&&vt(h.type)==="identity"&&I.push(new Me(r,h,'"text-font" does not support identity functions'))),I.concat(Vi({key:i.key,value:h,valueSpec:x,style:o,styleSpec:c,expressionContext:"property",propertyType:e,propertyKey:d}))}function Ra(i){return uo(i,"paint")}function Ba(i){return uo(i,"layout")}function Fa(i){let e=[];const r=i.value,o=i.key,c=i.style,h=i.styleSpec;r.type||r.ref||e.push(new Me(o,r,'either "type" or "ref" is required'));let d=vt(r.type);const m=vt(r.ref);if(r.id){const g=vt(r.id);for(let x=0;x<i.arrayIndex;x++){const T=c.layers[x];vt(T.id)===g&&e.push(new Me(o,r.id,`duplicate layer id "${r.id}", previously used at line ${T.id.__line__}`))}}if("ref"in r){let g;["type","source","source-layer","filter","layout"].forEach(x=>{x in r&&e.push(new Me(o,r[x],`"${x}" is prohibited for ref layers`))}),c.layers.forEach(x=>{vt(x.id)===m&&(g=x)}),g?g.ref?e.push(new Me(o,r.ref,"ref cannot reference another ref layer")):d=vt(g.type):e.push(new Me(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&&vt(g.type);g?x==="vector"&&d==="raster"?e.push(new Me(o,r.source,`layer "${r.id}" requires a raster source`)):x==="raster"&&d!=="raster"?e.push(new Me(o,r.source,`layer "${r.id}" requires a vector source`)):x!=="vector"||r["source-layer"]?x==="raster-dem"&&d!=="hillshade"?e.push(new Me(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 Me(o,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):e.push(new Me(o,r,`layer "${r.id}" must specify a "source-layer"`)):e.push(new Me(o,r.source,`source "${r.source}" not found`))}else e.push(new Me(o,r,'missing required property "source"'));return e=e.concat(rr({key:o,value:r,valueSpec:h.layer,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{"*":()=>[],type:()=>Vi({key:`${o}.type`,value:r.type,valueSpec:h.layer.type,style:i.style,styleSpec:i.styleSpec,object:r,objectKey:"type"}),filter:co,layout:g=>rr({layer:r,key:g.key,value:g.value,style:g.style,styleSpec:g.styleSpec,objectElementValidators:{"*":x=>Ba(ir({layerType:d},x))}}),paint:g=>rr({layer:r,key:g.key,value:g.value,style:g.style,styleSpec:g.styleSpec,objectElementValidators:{"*":x=>Ra(ir({layerType:d},x))}})}})),e}function Rn(i){const e=i.value,r=i.key,o=It(e);return o!=="string"?[new Me(r,e,`string expected, ${o} found`)]:[]}const Oa={promoteId:function({key:i,value:e}){if(It(e)==="string")return Rn({key:i,value:e});{const r=[];for(const o in e)r.push(...Rn({key:`${i}.${o}`,value:e[o]}));return r}}};function ho(i){const e=i.value,r=i.key,o=i.styleSpec,c=i.style;if(!e.type)return[new Me(r,e,'"type" is required')];const h=vt(e.type);let d;switch(h){case"vector":case"raster":case"raster-dem":return d=rr({key:r,value:e,valueSpec:o[`source_${h.replace("-","_")}`],style:i.style,styleSpec:o,objectElementValidators:Oa}),d;case"geojson":if(d=rr({key:r,value:e,valueSpec:o.source_geojson,style:c,styleSpec:o,objectElementValidators:Oa}),e.cluster)for(const m in e.clusterProperties){const[g,x]=e.clusterProperties[m],T=typeof g=="string"?[g,["accumulated"],["get",m]]:g;d.push(...nn({key:`${r}.${m}.map`,value:x,expressionContext:"cluster-map"})),d.push(...nn({key:`${r}.${m}.reduce`,value:T,expressionContext:"cluster-reduce"}))}return d;case"video":return rr({key:r,value:e,valueSpec:o.source_video,style:c,styleSpec:o});case"image":return rr({key:r,value:e,valueSpec:o.source_image,style:c,styleSpec:o});case"canvas":return[new Me(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return so({key:`${r}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:c,styleSpec:o})}}function po(i){const e=i.value,r=i.styleSpec,o=r.light,c=i.style;let h=[];const d=It(e);if(e===void 0)return h;if(d!=="object")return h=h.concat([new Me("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?Vi({key:m,value:e[m],valueSpec:r.transition,style:c,styleSpec:r}):o[m]?Vi({key:m,value:e[m],valueSpec:o[m],style:c,styleSpec:r}):[new Me(m,e[m],`unknown property "${m}"`)])}return h}function Ui(i){const e=i.value,r=i.styleSpec,o=r.terrain,c=i.style;let h=[];const d=It(e);if(e===void 0)return h;if(d!=="object")return h=h.concat([new Me("terrain",e,`object expected, ${d} found`)]),h;for(const m in e)h=h.concat(o[m]?Vi({key:m,value:e[m],valueSpec:o[m],style:c,styleSpec:r}):[new Me(m,e[m],`unknown property "${m}"`)]);return h}const fo={"*":()=>[],array:Pa,boolean:function(i){const e=i.value,r=i.key,o=It(e);return o!=="boolean"?[new Me(r,e,`boolean expected, ${o} found`)]:[]},number:Is,color:function(i){const e=i.key,r=i.value,o=It(r);return o!=="string"?[new Me(e,r,`color expected, ${o} found`)]:Sn(r)===null?[new Me(e,r,`color expected, "${r}" found`)]:[]},constants:Jr,enum:so,filter:co,function:za,layer:Fa,object:rr,source:ho,light:po,terrain:Ui,string:Rn,formatted:function(i){return Rn(i).length===0?[]:nn(i)},resolvedImage:function(i){return Rn(i).length===0?[]:nn(i)},padding:function(i){const e=i.key,r=i.value;if(It(r)==="array"){if(r.length<1||r.length>4)return[new Me(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(Vi({key:`${e}[${h}]`,value:r[h],valueSpec:o}));return c}return Is({key:e,value:r,valueSpec:{}})}};function Vi(i){const e=i.value,r=i.valueSpec,o=i.styleSpec;return r.expression&&Bt(vt(e))?za(i):r.expression&&ro(Ki(e))?nn(i):r.type&&fo[r.type]?fo[r.type](i):rr(ir({},i,{valueSpec:r.type?o[r.type]:r}))}function ql(i){const e=i.value,r=i.key,o=Rn(i);return o.length||(e.indexOf("{fontstack}")===-1&&o.push(new Me(r,e,'"glyphs" url must include a "{fontstack}" token')),e.indexOf("{range}")===-1&&o.push(new Me(r,e,'"glyphs" url must include a "{range}" token'))),o}function Vr(i,e=_e){let r=[];return r=r.concat(Vi({key:"",value:i,valueSpec:e.$root,styleSpec:e,style:i,objectElementValidators:{glyphs:ql,"*":()=>[]}})),i.constants&&(r=r.concat(Jr({key:"constants",value:i.constants,style:i,styleSpec:e}))),$a(r)}function $a(i){return[].concat(i).sort((e,r)=>e.line-r.line)}function Ir(i){return function(...e){return $a(i.apply(this,e))}}Vr.source=Ir(ho),Vr.light=Ir(po),Vr.terrain=Ir(Ui),Vr.layer=Ir(Fa),Vr.filter=Ir(co),Vr.paintProperty=Ir(Ra),Vr.layoutProperty=Ir(Ba);const mo=Vr,As=mo.light,Zl=mo.paintProperty,jl=mo.layoutProperty;function Zo(i,e){let r=!1;if(e&&e.length)for(const o of e)i.fire(new wn(new Error(o.message))),r=!0;return r}class go{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],T=d[3+g+1];c.push(x===T?null:d.subarray(x,T))}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 T=this.keys,I=this.bboxes;for(let P=0;P<x.length;P++){const D=x[P];if(m[D]===void 0){const L=4*D;(g?g(I[L+0],I[L+1],I[L+2],I[L+3]):e<=I[L+2]&&r<=I[L+3]&&o>=I[L+0]&&c>=I[L+1])?(m[D]=!0,d.push(T[D])):m[D]=!1}}}}_forEachCell(e,r,o,c,h,d,m,g){const x=this._convertToCellCoord(e),T=this._convertToCellCoord(r),I=this._convertToCellCoord(o),P=this._convertToCellCoord(c);for(let D=x;D<=I;D++)for(let L=T;L<=P;L++){const Z=this.d*L+D;if((!g||g(this._convertFromCellCoord(D),this._convertFromCellCoord(L),this._convertFromCellCoord(D+1),this._convertFromCellCoord(L+1)))&&h.call(this,e,r,o,c,Z,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 go(e.buffer)}}const Cr={};function $e(i,e,r={}){if(Cr[i])throw new Error(`${i} is already registered.`);Object.defineProperty(e,"_classRegistryKey",{value:i,writeable:!1}),Cr[i]={klass:e,omit:r.omit||[],shallow:r.shallow||[]}}$e("Object",Object),$e("TransferableGridIndex",go),$e("Color",B),$e("Error",Error),$e("AJAXError",Bi),$e("ResolvedImage",J),$e("StylePropertyFunction",Vo),$e("StyleExpression",Uo,{omit:["_evaluator"]}),$e("ZoomDependentExpression",Ss),$e("ZoomConstantExpression",oo),$e("CompoundExpression",kt,{omit:["_evaluate"]});for(const i in Pn)Pn[i]._classRegistryKey||$e(`Expression_${i}`,Pn[i]);function Ua(i){return i&&typeof ArrayBuffer!="undefined"&&(i instanceof ArrayBuffer||i.constructor&&i.constructor.name==="ArrayBuffer")}function on(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(Ua(i)||pi(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(on(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(!Cr[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)||Cr[o].omit.indexOf(h)>=0)continue;const d=i[h];c[h]=Cr[o].shallow.indexOf(h)>=0?d:on(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 Nr(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||Ua(i)||pi(i)||ArrayBuffer.isView(i)||i instanceof ImageData)return i;if(Array.isArray(i))return i.map(Nr);if(typeof i=="object"){const e=i.$name||"Object";if(!Cr[e])throw new Error(`can't deserialize unregistered class ${e}`);const{klass:r}=Cr[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]=Cr[e].shallow.indexOf(c)>=0?h:Nr(h)}return o}throw new Error("can't deserialize object of type "+typeof i)}class Ms{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 jo(i){for(const e of i)if(zs(e.charCodeAt(0)))return!0;return!1}function Xl(i){for(const e of i)if(!Ps(e.charCodeAt(0)))return!1;return!0}function Ps(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 zs(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 Va(i){return!(zs(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 Na(i){return i>=1424&&i<=2303||ze["Arabic Presentation Forms-A"](i)||ze["Arabic Presentation Forms-B"](i)}function Wl(i,e){return!(!e&&Na(i)||i>=2304&&i<=3583||i>=3840&&i<=4255||ze.Khmer(i))}function Ga(i){for(const e of i)if(Na(e.charCodeAt(0)))return!0;return!1}const ks="deferred",Ds="loading",Ls="loaded";let Rs=null,Pi="unavailable",Gr=null;const qa=function(i){i&&typeof i=="string"&&i.indexOf("NetworkError")>-1&&(Pi="error"),Rs&&Rs(i)};function Bn(){Bs.fire(new Tr("pluginStateChange",{pluginStatus:Pi,pluginURL:Gr}))}const Bs=new Er,_o=function(){return Pi},Za=function(){if(Pi!==ks||!Gr)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");Pi=Ds,Bn(),Gr&&bn({url:Gr},i=>{i?qa(i):(Pi=Ls,Bn())})},Ji={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>Pi===Ls||Ji.applyArabicShaping!=null,isLoading:()=>Pi===Ds,setState(i){if(!Jt())throw new Error("Cannot set the state of the rtl-text-plugin when not in the web-worker context");Pi=i.pluginStatus,Gr=i.pluginURL},isParsed(){if(!Jt())throw new Error("rtl-text-plugin is only parsed on the worker-threads");return Ji.applyArabicShaping!=null&&Ji.processBidirectionalText!=null&&Ji.processStyledBidirectionalText!=null},getPluginURL(){if(!Jt())throw new Error("rtl-text-plugin url can only be queried from the worker threads");return Gr}};class Gt{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 Ms,this.transition={})}isSupportedScript(e){return function(r,o){for(const c of r)if(!Wl(c.charCodeAt(0),o))return!1;return!0}(e,Ji.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 yo{constructor(e,r){this.property=e,this.value=r,this.expression=function(o,c){if(Bt(o))return new Vo(o,c);if(ro(o)){const h=Ma(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=B.parse(o):c.type!=="padding"||typeof o!="number"&&!Array.isArray(o)||(h=X.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 Xo{constructor(e){this.property=e,this.value=new yo(e,void 0)}transitioned(e,r){return new Xa(this.property,this.value,r,Ne({},e.transition,this.transition),e.now)}untransitioned(){return new Xa(this.property,this.value,null,{},0)}}class ja{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues)}getValue(e){return pt(this._values[e].value.value)}setValue(e,r){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Xo(this._values[e].property)),this._values[e].value=new yo(this._values[e].property,r===null?void 0:pt(r))}getTransition(e){return pt(this._values[e].transition)}setTransition(e,r){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Xo(this._values[e].property)),this._values[e].transition=pt(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 Wa(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 Wa(this._properties);for(const r of Object.keys(this._values))e._values[r]=this._values[r].untransitioned();return e}}class Xa{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,T=x*g;return 4*(g<.5?T:3*(g-x)+T-.75)}(m))}}return h}}class Wa{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,r,o){const c=new xo(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 Hl{constructor(e){this._properties=e,this._values=Object.create(e.defaultPropertyValues)}getValue(e){return pt(this._values[e].value)}setValue(e,r){this._values[e]=new yo(this._values[e].property,r===null?void 0:pt(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 xo(this._properties);for(const h of Object.keys(this._values))c._values[h]=this._values[h].possiblyEvaluate(e,r,o);return c}}class fr{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 xo{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class Ze{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=Qn[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 fr(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 fr(this,{kind:"constant",value:void 0},e.parameters);const c=Qn[this.specification.type];return c?new fr(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 Fn extends Je{possiblyEvaluate(e,r,o,c){if(e.value===void 0)return new fr(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 fr(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 fr(this,{kind:"constant",value:h},r)}return new fr(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 Fs{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 Gt(Math.floor(r.zoom-1),r)),e.expression.evaluate(new Gt(Math.floor(r.zoom),r)),e.expression.evaluate(new Gt(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 qr{constructor(e){this.specification=e}possiblyEvaluate(e,r,o,c){return!!e.expression.evaluate(r,null,{},o,c)}interpolate(){return!1}}class mi{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 yo(o,void 0),h=this.defaultTransitionablePropertyValues[r]=new Xo(o);this.defaultTransitioningPropertyValues[r]=h.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=c.possiblyEvaluate({})}}}$e("DataDrivenProperty",Je),$e("DataConstantProperty",Ze),$e("CrossFadedDataDrivenProperty",Fn),$e("CrossFadedProperty",Fs),$e("ColorRampProperty",qr);const Zr="-transition";class mr extends Er{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 Hl(r.layout)),r.paint)){this._transitionablePaint=new ja(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 xo(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(jl,`layers.${this.id}.layout.${e}`,e,r,o)||(e!=="visibility"?this._unevaluatedLayout.setValue(e,r):this.visibility=r)}getPaintProperty(e){return e.endsWith(Zr)?this._transitionablePaint.getTransition(e.slice(0,-Zr.length)):this._transitionablePaint.getValue(e)}setPaintProperty(e,r,o={}){if(r!=null&&this._validate(Zl,`layers.${this.id}.paint.${e}`,e,r,o))return!1;if(e.endsWith(Zr))return this._transitionablePaint.setTransition(e.slice(0,-Zr.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),Qe(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)&&Zo(this,e.call(mo,{key:r,layerType:this.type,objectKey:o,value:c,styleSpec:_e,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 fr&&Ft(r.property.specification)&&(r.value.kind==="source"||r.value.kind==="composite")&&r.value.isStateDependent)return!0}return!1}}const Ha={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class jr{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 Xt{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 Qt(i,e=1){let r=0,o=0;return{members:i.map(c=>{const h=Ha[c.type].BYTES_PER_ELEMENT,d=r=Os(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:Os(r,Math.max(o,e)),alignment:e}}function Os(i,e){return Math.ceil(i/e)*e}class sn extends Xt{_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}}sn.prototype.bytesPerElement=4,$e("StructArrayLayout2i4",sn);class l extends Xt{_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}}l.prototype.bytesPerElement=8,$e("StructArrayLayout4i8",l);class t extends Xt{_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,$e("StructArrayLayout2i4i12",t);class n extends Xt{_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,$e("StructArrayLayout2i4ub8",n);class s extends Xt{_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,$e("StructArrayLayout2f8",s);class u extends Xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,o,c,h,d,m,g,x,T){const I=this.length;return this.resize(I+1),this.emplace(I,e,r,o,c,h,d,m,g,x,T)}emplace(e,r,o,c,h,d,m,g,x,T,I){const P=10*e;return this.uint16[P+0]=r,this.uint16[P+1]=o,this.uint16[P+2]=c,this.uint16[P+3]=h,this.uint16[P+4]=d,this.uint16[P+5]=m,this.uint16[P+6]=g,this.uint16[P+7]=x,this.uint16[P+8]=T,this.uint16[P+9]=I,e}}u.prototype.bytesPerElement=20,$e("StructArrayLayout10ui20",u);class p extends Xt{_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,T,I,P){const D=this.length;return this.resize(D+1),this.emplace(D,e,r,o,c,h,d,m,g,x,T,I,P)}emplace(e,r,o,c,h,d,m,g,x,T,I,P,D){const L=12*e;return this.int16[L+0]=r,this.int16[L+1]=o,this.int16[L+2]=c,this.int16[L+3]=h,this.uint16[L+4]=d,this.uint16[L+5]=m,this.uint16[L+6]=g,this.uint16[L+7]=x,this.int16[L+8]=T,this.int16[L+9]=I,this.int16[L+10]=P,this.int16[L+11]=D,e}}p.prototype.bytesPerElement=24,$e("StructArrayLayout4i4ui4i24",p);class f extends Xt{_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,$e("StructArrayLayout3f12",f);class _ extends Xt{_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,$e("StructArrayLayout1ul4",_);class y extends Xt{_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 T=this.length;return this.resize(T+1),this.emplace(T,e,r,o,c,h,d,m,g,x)}emplace(e,r,o,c,h,d,m,g,x,T){const I=10*e,P=5*e;return this.int16[I+0]=r,this.int16[I+1]=o,this.int16[I+2]=c,this.int16[I+3]=h,this.int16[I+4]=d,this.int16[I+5]=m,this.uint32[P+3]=g,this.uint16[I+8]=x,this.uint16[I+9]=T,e}}y.prototype.bytesPerElement=20,$e("StructArrayLayout6i1ul2ui20",y);class v extends Xt{_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,$e("StructArrayLayout2i2i2i12",v);class S extends Xt{_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}}S.prototype.bytesPerElement=16,$e("StructArrayLayout2f1f2i16",S);class M extends Xt{_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}}M.prototype.bytesPerElement=12,$e("StructArrayLayout2ub2f12",M);class z extends Xt{_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}}z.prototype.bytesPerElement=6,$e("StructArrayLayout3ui6",z);class V extends Xt{_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,T,I,P,D,L,Z,q,re){const ce=this.length;return this.resize(ce+1),this.emplace(ce,e,r,o,c,h,d,m,g,x,T,I,P,D,L,Z,q,re)}emplace(e,r,o,c,h,d,m,g,x,T,I,P,D,L,Z,q,re,ce){const ee=24*e,ae=12*e,xe=48*e;return this.int16[ee+0]=r,this.int16[ee+1]=o,this.uint16[ee+2]=c,this.uint16[ee+3]=h,this.uint32[ae+2]=d,this.uint32[ae+3]=m,this.uint32[ae+4]=g,this.uint16[ee+10]=x,this.uint16[ee+11]=T,this.uint16[ee+12]=I,this.float32[ae+7]=P,this.float32[ae+8]=D,this.uint8[xe+36]=L,this.uint8[xe+37]=Z,this.uint8[xe+38]=q,this.uint32[ae+10]=re,this.int16[ee+22]=ce,e}}V.prototype.bytesPerElement=48,$e("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",V);class $ extends Xt{_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,T,I,P,D,L,Z,q,re,ce,ee,ae,xe,ye,Oe,Ve,ke,Ce,Ee,De){const Pe=this.length;return this.resize(Pe+1),this.emplace(Pe,e,r,o,c,h,d,m,g,x,T,I,P,D,L,Z,q,re,ce,ee,ae,xe,ye,Oe,Ve,ke,Ce,Ee,De)}emplace(e,r,o,c,h,d,m,g,x,T,I,P,D,L,Z,q,re,ce,ee,ae,xe,ye,Oe,Ve,ke,Ce,Ee,De,Pe){const we=34*e,He=17*e;return this.int16[we+0]=r,this.int16[we+1]=o,this.int16[we+2]=c,this.int16[we+3]=h,this.int16[we+4]=d,this.int16[we+5]=m,this.int16[we+6]=g,this.int16[we+7]=x,this.uint16[we+8]=T,this.uint16[we+9]=I,this.uint16[we+10]=P,this.uint16[we+11]=D,this.uint16[we+12]=L,this.uint16[we+13]=Z,this.uint16[we+14]=q,this.uint16[we+15]=re,this.uint16[we+16]=ce,this.uint16[we+17]=ee,this.uint16[we+18]=ae,this.uint16[we+19]=xe,this.uint16[we+20]=ye,this.uint16[we+21]=Oe,this.uint16[we+22]=Ve,this.uint32[He+12]=ke,this.float32[He+13]=Ce,this.float32[He+14]=Ee,this.float32[He+15]=De,this.float32[He+16]=Pe,e}}$.prototype.bytesPerElement=68,$e("StructArrayLayout8i15ui1ul4f68",$);class U extends Xt{_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}}U.prototype.bytesPerElement=4,$e("StructArrayLayout1f4",U);class H extends Xt{_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}}H.prototype.bytesPerElement=6,$e("StructArrayLayout3i6",H);class Y extends Xt{_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}}Y.prototype.bytesPerElement=8,$e("StructArrayLayout1ul2ui8",Y);class ne extends Xt{_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}}ne.prototype.bytesPerElement=4,$e("StructArrayLayout2ui4",ne);class G extends Xt{_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}}G.prototype.bytesPerElement=2,$e("StructArrayLayout1ui2",G);class le extends Xt{_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}}le.prototype.bytesPerElement=16,$e("StructArrayLayout4f16",le);class se extends jr{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 Xe(this.anchorPointX,this.anchorPointY)}}se.prototype.size=20;class me extends y{get(e){return new se(this,e)}}$e("CollisionBoxArray",me);class ge extends jr{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]}}ge.prototype.size=48;class be extends V{get(e){return new ge(this,e)}}$e("PlacedSymbolArray",be);class de extends jr{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]}}de.prototype.size=68;class Re extends ${get(e){return new de(this,e)}}$e("SymbolInstanceArray",Re);class Ie extends U{getoffsetX(e){return this.float32[1*e+0]}}$e("GlyphOffsetArray",Ie);class Fe extends H{getx(e){return this.int16[3*e+0]}gety(e){return this.int16[3*e+1]}gettileUnitDistanceFromAnchor(e){return this.int16[3*e+2]}}$e("SymbolLineVertexArray",Fe);class st extends jr{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]}}st.prototype.size=8;class ut extends Y{get(e){return new st(this,e)}}$e("FeatureIndexArray",ut);class We extends sn{}class At extends sn{}class Mt extends sn{}class _t extends t{}class Tt extends n{}class zt extends s{}class ai extends u{}class gr extends p{}class nr extends f{}class _r extends _{}class Xr extends v{}class Yi extends M{}class zi extends z{}class Ar extends ne{}const Wo=Qt([{name:"a_pos",components:2,type:"Int16"}],4),{members:ii}=Wo;class dt{constructor(e=[]){this.segments=e}prepareSegment(e,r,o,c){let h=this.segments[this.segments.length-1];return e>dt.MAX_VERTEX_ARRAY_LENGTH&&at(`Max vertices per segment is ${dt.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),(!h||h.vertexLength+e>dt.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 dt([{vertexOffset:e,primitiveOffset:r,vertexLength:o,primitiveLength:c,vaos:{},sortKey:0}])}}function Ct(i,e){return 256*(i=ie(Math.floor(i),0,255))+ie(Math.floor(e),0,255)}dt.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,$e("SegmentVector",dt);const li=Qt([{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 ci={exports:{}},qt={exports:{}};qt.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 Qi={exports:{}};Qi.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 an=qt.exports,$s=Qi.exports;ci.exports=an,ci.exports.murmur3=an,ci.exports.murmur2=$s;class On{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,r,o,c){this.ids.push(Ka(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=Ka(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 Us(o,c,0,o.length-1),r&&r.push(o.buffer,c.buffer),{ids:o,positions:c}}static deserialize(e){const r=new On;return r.ids=e.ids,r.positions=e.positions,r.indexed=!0,r}}function Ka(i){const e=+i;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:ci.exports(String(i))}function Us(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;Wr(i,h,d),Wr(e,3*h,3*d),Wr(e,3*h+1,3*d+1),Wr(e,3*h+2,3*d+2)}d-r<o-d?(Us(i,e,r,d),r=d+1):(Us(i,e,d+1,o),o=d)}}function Wr(i,e,r){const o=i[e];i[e]=i[r],i[r]=o}$e("FeaturePositionMap",On);class ln{constructor(e,r){this.gl=e.gl,this.location=r}}class cn extends ln{constructor(e,r){super(e,r),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1f(this.location,e))}}class Ho extends ln{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 ru extends ln{constructor(e,r){super(e,r),this.current=B.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 Lp=new Float32Array(16);function Kl(i){return[Ct(255*i.r,255*i.g),Ct(255*i.b,255*i.a)]}class Vs{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 ru(e,r):new cn(e,r)}}class Ko{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 Ho(e,r):new cn(e,r)}}class un{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 Gt(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=Kl(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 Mr{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 Gt(this.zoom),r,{},c,[],h),m=this.expression.evaluate(new Gt(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=Kl(o),d=Kl(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=ie(this.expression.interpolationFactor(o,this.zoom,this.zoom+1),0,1);e.set(c)}getBinding(e,r,o){return new cn(e,r)}}class $n{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],T=c[m];if(g&&x&&T)for(let I=e;I<r;I++)this.zoomInPaintVertexArray.emplace(I,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(I,x.tl[0],x.tl[1],x.br[0],x.br[1],T.tl[0],T.tl[1],T.br[0],T.br[1],x.pixelRatio,T.pixelRatio)}upload(e){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=e.createVertexBuffer(this.zoomInPaintVertexArray,li.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=e.createVertexBuffer(this.zoomOutPaintVertexArray,li.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class nu{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 fr&&Ft(d.property.specification)))continue;const m=Rp(h,e.type),g=d.value,x=d.property.specification.type,T=d.property.useIntegerZoom,I=d.property.specification["property-type"],P=I==="cross-faded"||I==="cross-faded-data-driven";if(g.kind==="constant")this.binders[h]=P?new Ko(g.value,m):new Vs(g.value,m,x),c.push(`/u_${h}`);else if(g.kind==="source"||P){const D=ou(h,x,"source");this.binders[h]=P?new $n(g,x,T,r,D,e.id):new un(g,m,x,D),c.push(`/a_${h}`)}else{const D=ou(h,x,"composite");this.binders[h]=new Mr(g,m,x,T,r,D),c.push(`/z_${h}`)}}this.cacheKey=c.sort().join("")}getMaxValue(e){const r=this.binders[e];return r instanceof un||r instanceof Mr?r.maxValue:0}populatePaintArrays(e,r,o,c,h){for(const d in this.binders){const m=this.binders[d];(m instanceof un||m instanceof Mr||m instanceof $n)&&m.populatePaintArray(e,r,o,c,h)}}setConstantPatternPositions(e,r){for(const o in this.binders){const c=this.binders[o];c instanceof Ko&&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 T=o.feature(x.index);for(const I in this.binders){const P=this.binders[I];if((P instanceof un||P instanceof Mr||P instanceof $n)&&P.expression.isStateDependent===!0){const D=c.paint.get(I);P.expression=D.value,P.updatePaintArray(x.start,x.end,T,e[m],h),d=!0}}}}return d}defines(){const e=[];for(const r in this.binders){const o=this.binders[r];(o instanceof Vs||o instanceof Ko)&&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 un||o instanceof Mr)for(let c=0;c<o.paintVertexAttributes.length;c++)e.push(o.paintVertexAttributes[c].name);else if(o instanceof $n)for(let c=0;c<li.members.length;c++)e.push(li.members[c].name)}return e}getBinderUniforms(){const e=[];for(const r in this.binders){const o=this.binders[r];if(o instanceof Vs||o instanceof Ko||o instanceof Mr)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 Vs||h instanceof Ko||h instanceof Mr){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 $n){const c=e.fromScale===2?o.zoomInPaintVertexBuffer:o.zoomOutPaintVertexBuffer;c&&this._buffers.push(c)}else(o instanceof un||o instanceof Mr)&&o.paintVertexBuffer&&this._buffers.push(o.paintVertexBuffer)}}upload(e){for(const r in this.binders){const o=this.binders[r];(o instanceof un||o instanceof Mr||o instanceof $n)&&o.upload(e)}this.updatePaintBuffers()}destroy(){for(const e in this.binders){const r=this.binders[e];(r instanceof un||r instanceof Mr||r instanceof $n)&&r.destroy()}}}class vo{constructor(e,r,o=()=>!0){this.programConfigurations={};for(const c of e)this.programConfigurations[c.id]=new nu(c,r,o);this.needsUpload=!1,this._featureMap=new On,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 Rp(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 ou(i,e,r){const o={color:{source:s,composite:le},number:{source:U,composite:s}},c=function(h){return{"line-pattern":{source:ai,composite:ai},"fill-pattern":{source:ai,composite:ai},"fill-extrusion-pattern":{source:ai,composite:ai}}[h]}(i);return c&&c[r]||o[e][r]}$e("ConstantBinder",Vs),$e("CrossFadedConstantBinder",Ko),$e("SourceExpressionBinder",un),$e("CrossFadedCompositeBinder",$n),$e("CompositeExpressionBinder",Mr),$e("ProgramConfiguration",nu,{omit:["_buffers"]}),$e("ProgramConfigurationSet",vo);var ri=8192;const Jl=Math.pow(2,14)-1,su=-Jl-1;function bo(i){const e=ri/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=ie(m,su,Jl),d.y=ie(g,su,Jl),(m<d.x||m>d.x+1||g<d.y||g>d.y+1)&&at("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return r}function wo(i,e){return{type:i.type,id:i.id,properties:i.properties,geometry:e?bo(i):[]}}function Ja(i,e,r,o,c){i.emplaceBack(2*e+(o+1)/2,2*r+(c+1)/2)}class Yl{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 At,this.indexArray=new zi,this.segments=new dt,this.programConfigurations=new vo(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:T,sourceLayerIndex:I}of e){const P=this.layers[0]._featureFilter.needGeometry,D=wo(g,P);if(!this.layers[0]._featureFilter.filter(new Gt(this.zoom),D,o))continue;const L=m?d.evaluate(D,{},o):void 0,Z={id:x,properties:g.properties,type:g.type,sourceLayerIndex:I,index:T,geometry:P?D.geometry:bo(g),patterns:{},sortKey:L};h.push(Z)}m&&h.sort((g,x)=>g.sortKey-x.sortKey);for(const g of h){const{geometry:x,index:T,sourceLayerIndex:I}=g,P=e[T].feature;this.addFeature(g,x,T,o),r.featureIndex.insert(P,x,T,I,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,ii),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>=ri||g<0||g>=ri)continue;const x=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),T=x.vertexLength;Ja(this.layoutVertexArray,m,g,-1,-1),Ja(this.layoutVertexArray,m,g,1,-1),Ja(this.layoutVertexArray,m,g,1,1),Ja(this.layoutVertexArray,m,g,-1,1),this.indexArray.emplaceBack(T,T+1,T+2),this.indexArray.emplaceBack(T,T+3,T+2),x.vertexLength+=4,x.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,o,{},c)}}function au(i,e){for(let r=0;r<i.length;r++)if(Jo(e,i[r]))return!0;for(let r=0;r<e.length;r++)if(Jo(i,e[r]))return!0;return!!Ql(i,e)}function Bp(i,e,r){return!!Jo(i,e)||!!ec(e,i,r)}function lu(i,e){if(i.length===1)return uu(e,i[0]);for(let r=0;r<e.length;r++){const o=e[r];for(let c=0;c<o.length;c++)if(Jo(i,o[c]))return!0}for(let r=0;r<i.length;r++)if(uu(e,i[r]))return!0;for(let r=0;r<e.length;r++)if(Ql(i,e[r]))return!0;return!1}function Fp(i,e,r){if(i.length>1){if(Ql(i,e))return!0;for(let o=0;o<e.length;o++)if(ec(e[o],i,r))return!0}for(let o=0;o<i.length;o++)if(ec(i[o],e,r))return!0;return!1}function Ql(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(Op(o,c,e[h],e[h+1]))return!0}return!1}function Op(i,e,r,o){return Et(i,r,o)!==Et(e,r,o)&&Et(i,e,r)!==Et(i,e,o)}function ec(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(cu(i,e[c-1],e[c])<o)return!0;return!1}function cu(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 uu(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 Jo(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 $p(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=Et(i,e,r[0]);return h!==Et(i,e,r[1])||h!==Et(i,e,r[2])||h!==Et(i,e,r[3])}function Ns(i,e,r){const o=e.paint.get(i).value;return o.kind==="constant"?o.value:r.programConfigurations.get(e.id).getMaxValue(i)}function Ya(i){return Math.sqrt(i[0]*i[0]+i[1]*i[1])}function Qa(i,e,r,o,c){if(!e[0]&&!e[1])return i;const h=Xe.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}$e("CircleBucket",Yl,{omit:["layers"]});const Up=new mi({"circle-sort-key":new Je(_e.layout_circle["circle-sort-key"])});var Vp={paint:new mi({"circle-radius":new Je(_e.paint_circle["circle-radius"]),"circle-color":new Je(_e.paint_circle["circle-color"]),"circle-blur":new Je(_e.paint_circle["circle-blur"]),"circle-opacity":new Je(_e.paint_circle["circle-opacity"]),"circle-translate":new Ze(_e.paint_circle["circle-translate"]),"circle-translate-anchor":new Ze(_e.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new Ze(_e.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new Ze(_e.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new Je(_e.paint_circle["circle-stroke-width"]),"circle-stroke-color":new Je(_e.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new Je(_e.paint_circle["circle-stroke-opacity"])}),layout:Up},ki=1e-6,Di=typeof Float32Array!="undefined"?Float32Array:Array;function hu(){var i=new Di(9);return Di!=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 tc(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 pu(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],T=e[7],I=e[8],P=e[9],D=e[10],L=e[11],Z=e[12],q=e[13],re=e[14],ce=e[15],ee=r[0],ae=r[1],xe=r[2],ye=r[3];return i[0]=ee*o+ae*m+xe*I+ye*Z,i[1]=ee*c+ae*g+xe*P+ye*q,i[2]=ee*h+ae*x+xe*D+ye*re,i[3]=ee*d+ae*T+xe*L+ye*ce,i[4]=(ee=r[4])*o+(ae=r[5])*m+(xe=r[6])*I+(ye=r[7])*Z,i[5]=ee*c+ae*g+xe*P+ye*q,i[6]=ee*h+ae*x+xe*D+ye*re,i[7]=ee*d+ae*T+xe*L+ye*ce,i[8]=(ee=r[8])*o+(ae=r[9])*m+(xe=r[10])*I+(ye=r[11])*Z,i[9]=ee*c+ae*g+xe*P+ye*q,i[10]=ee*h+ae*x+xe*D+ye*re,i[11]=ee*d+ae*T+xe*L+ye*ce,i[12]=(ee=r[12])*o+(ae=r[13])*m+(xe=r[14])*I+(ye=r[15])*Z,i[13]=ee*c+ae*g+xe*P+ye*q,i[14]=ee*h+ae*x+xe*D+ye*re,i[15]=ee*d+ae*T+xe*L+ye*ce,i}Math.hypot||(Math.hypot=function(){for(var i=0,e=arguments.length;e--;)i+=arguments[e]*arguments[e];return Math.sqrt(i)});var Gs,Np=pu;function du(){var i=new Di(3);return Di!=Float32Array&&(i[0]=0,i[1]=0,i[2]=0),i}function fu(i,e,r){var o=new Di(3);return o[0]=i,o[1]=e,o[2]=r,o}function el(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 mu(){var i=new Di(4);return Di!=Float32Array&&(i[0]=0,i[1]=0,i[2]=0),i[3]=1,i}function gu(i,e){const r=el([],[i.x,i.y,0,1],e);return new Xe(r[0]/r[3],r[1]/r[3])}du(),Gs=new Di(4),Di!=Float32Array&&(Gs[0]=0,Gs[1]=0,Gs[2]=0,Gs[3]=0),du(),fu(1,0,0),fu(0,1,0),mu(),mu(),hu(),function(){var i;i=new Di(2),Di!=Float32Array&&(i[0]=0,i[1]=0)}();class _u extends Yl{}$e("HeatmapBucket",_u,{omit:["layers"]});var Gp={paint:new mi({"heatmap-radius":new Je(_e.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Je(_e.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Ze(_e.paint_heatmap["heatmap-intensity"]),"heatmap-color":new qr(_e.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Ze(_e.paint_heatmap["heatmap-opacity"])})};function ic(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 yu(i,{width:e,height:r},o){if(e===i.width&&r===i.height)return;const c=ic({},{width:e,height:r},o);rc(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 rc(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,T=((o.y+g)*e.width+o.x)*h;for(let I=0;I<c.width*h;I++)m[T+I]=d[x+I]}return e}class qs{constructor(e,r){ic(this,e,1,r)}resize(e){yu(this,e,1)}clone(){return new qs({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,r,o,c,h){rc(e,r,o,c,h,1)}}class or{constructor(e,r){ic(this,e,4,r)}resize(e){yu(this,e,4)}replace(e,r){r?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new or({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,r,o,c,h){rc(e,r,o,c,h,4)}}function xu(i){const e={},r=i.resolution||256,o=i.clips?i.clips.length:1,c=i.image||new or({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 T=g/(r-1),{start:I,end:P}=i.clips[d];h(m,x,I*(1-T)+P*T)}else for(let d=0,m=0;d<r;d++,m+=4)h(0,m,d/(r-1));return c}$e("AlphaImage",qs),$e("RGBAImage",or);var qp={paint:new mi({"hillshade-illumination-direction":new Ze(_e.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new Ze(_e.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new Ze(_e.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new Ze(_e.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new Ze(_e.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new Ze(_e.paint_hillshade["hillshade-accent-color"])})};const Zp=Qt([{name:"a_pos",components:2,type:"Int16"}],4),{members:jp}=Zp;var tl={exports:{}};function il(i,e,r){r=r||2;var o,c,h,d,m,g,x,T=e&&e.length,I=T?e[0]*r:i.length,P=vu(i,0,I,r,!0),D=[];if(!P||P.next===P.prev)return D;if(T&&(P=function(Z,q,re,ce){var ee,ae,xe,ye=[];for(ee=0,ae=q.length;ee<ae;ee++)(xe=vu(Z,q[ee]*ce,ee<ae-1?q[ee+1]*ce:Z.length,ce,!1))===xe.next&&(xe.steiner=!0),ye.push(ed(xe));for(ye.sort(Jp),ee=0;ee<ye.length;ee++)re=Yp(ye[ee],re);return re}(i,e,P,r)),i.length>80*r){o=h=i[0],c=d=i[1];for(var L=r;L<I;L+=r)(m=i[L])<o&&(o=m),(g=i[L+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 Zs(P,D,r,o,c,x,0),D}function vu(i,e,r,o,c){var h,d;if(c===sc(i,e,r,o)>0)for(h=e;h<r;h+=o)d=Tu(h,i[h],i[h+1],d);else for(h=r-o;h>=e;h-=o)d=Tu(h,i[h],i[h+1],d);return d&&rl(d,d.next)&&(Xs(d),d=d.next),d}function To(i,e){if(!i)return i;e||(e=i);var r,o=i;do if(r=!1,o.steiner||!rl(o,o.next)&&Kt(o.prev,o,o.next)!==0)o=o.next;else{if(Xs(o),(o=e=o.prev)===o.next)break;r=!0}while(r||o!==e);return e}function Zs(i,e,r,o,c,h,d){if(i){!d&&h&&function(T,I,P,D){var L=T;do L.z===0&&(L.z=nc(L.x,L.y,I,P,D)),L.prevZ=L.prev,L.nextZ=L.next,L=L.next;while(L!==T);L.prevZ.nextZ=null,L.prevZ=null,function(Z){var q,re,ce,ee,ae,xe,ye,Oe,Ve=1;do{for(re=Z,Z=null,ae=null,xe=0;re;){for(xe++,ce=re,ye=0,q=0;q<Ve&&(ye++,ce=ce.nextZ);q++);for(Oe=Ve;ye>0||Oe>0&&ce;)ye!==0&&(Oe===0||!ce||re.z<=ce.z)?(ee=re,re=re.nextZ,ye--):(ee=ce,ce=ce.nextZ,Oe--),ae?ae.nextZ=ee:Z=ee,ee.prevZ=ae,ae=ee;re=ce}ae.nextZ=null,Ve*=2}while(xe>1)}(L)}(i,o,c,h);for(var m,g,x=i;i.prev!==i.next;)if(m=i.prev,g=i.next,h?Wp(i,o,c,h):Xp(i))e.push(m.i/r|0),e.push(i.i/r|0),e.push(g.i/r|0),Xs(i),i=g.next,x=g.next;else if((i=g)===x){d?d===1?Zs(i=Hp(To(i),e,r),e,r,o,c,h,2):d===2&&Kp(i,e,r,o,c,h):Zs(To(i),e,r,o,c,h,1);break}}}function Xp(i){var e=i.prev,r=i,o=i.next;if(Kt(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,T=c<h?c<d?c:d:h<d?h:d,I=m<g?m<x?m:x:g<x?g:x,P=c>h?c>d?c:d:h>d?h:d,D=m>g?m>x?m:x:g>x?g:x,L=o.next;L!==e;){if(L.x>=T&&L.x<=P&&L.y>=I&&L.y<=D&&Yo(c,m,h,g,d,x,L.x,L.y)&&Kt(L.prev,L,L.next)>=0)return!1;L=L.next}return!0}function Wp(i,e,r,o){var c=i.prev,h=i,d=i.next;if(Kt(c,h,d)>=0)return!1;for(var m=c.x,g=h.x,x=d.x,T=c.y,I=h.y,P=d.y,D=m<g?m<x?m:x:g<x?g:x,L=T<I?T<P?T:P:I<P?I:P,Z=m>g?m>x?m:x:g>x?g:x,q=T>I?T>P?T:P:I>P?I:P,re=nc(D,L,e,r,o),ce=nc(Z,q,e,r,o),ee=i.prevZ,ae=i.nextZ;ee&&ee.z>=re&&ae&&ae.z<=ce;){if(ee.x>=D&&ee.x<=Z&&ee.y>=L&&ee.y<=q&&ee!==c&&ee!==d&&Yo(m,T,g,I,x,P,ee.x,ee.y)&&Kt(ee.prev,ee,ee.next)>=0||(ee=ee.prevZ,ae.x>=D&&ae.x<=Z&&ae.y>=L&&ae.y<=q&&ae!==c&&ae!==d&&Yo(m,T,g,I,x,P,ae.x,ae.y)&&Kt(ae.prev,ae,ae.next)>=0))return!1;ae=ae.nextZ}for(;ee&&ee.z>=re;){if(ee.x>=D&&ee.x<=Z&&ee.y>=L&&ee.y<=q&&ee!==c&&ee!==d&&Yo(m,T,g,I,x,P,ee.x,ee.y)&&Kt(ee.prev,ee,ee.next)>=0)return!1;ee=ee.prevZ}for(;ae&&ae.z<=ce;){if(ae.x>=D&&ae.x<=Z&&ae.y>=L&&ae.y<=q&&ae!==c&&ae!==d&&Yo(m,T,g,I,x,P,ae.x,ae.y)&&Kt(ae.prev,ae,ae.next)>=0)return!1;ae=ae.nextZ}return!0}function Hp(i,e,r){var o=i;do{var c=o.prev,h=o.next.next;!rl(c,h)&&bu(c,o,o.next,h)&&js(c,h)&&js(h,c)&&(e.push(c.i/r|0),e.push(o.i/r|0),e.push(h.i/r|0),Xs(o),Xs(o.next),o=i=h),o=o.next}while(o!==i);return To(o)}function Kp(i,e,r,o,c,h){var d=i;do{for(var m=d.next.next;m!==d.prev;){if(d.i!==m.i&&td(d,m)){var g=wu(d,m);return d=To(d,d.next),g=To(g,g.next),Zs(d,e,r,o,c,h,0),void Zs(g,e,r,o,c,h,0)}m=m.next}d=d.next}while(d!==i)}function Jp(i,e){return i.x-e.x}function Yp(i,e){var r=function(c,h){var d,m=h,g=c.x,x=c.y,T=-1/0;do{if(x<=m.y&&x>=m.next.y&&m.next.y!==m.y){var I=m.x+(x-m.y)*(m.next.x-m.x)/(m.next.y-m.y);if(I<=g&&I>T&&(T=I,d=m.x<m.next.x?m:m.next,I===g))return d}m=m.next}while(m!==h);if(!d)return null;var P,D=d,L=d.x,Z=d.y,q=1/0;m=d;do g>=m.x&&m.x>=L&&g!==m.x&&Yo(x<Z?g:T,x,L,Z,x<Z?T:g,x,m.x,m.y)&&(P=Math.abs(x-m.y)/(g-m.x),js(m,c)&&(P<q||P===q&&(m.x>d.x||m.x===d.x&&Qp(d,m)))&&(d=m,q=P)),m=m.next;while(m!==D);return d}(i,e);if(!r)return e;var o=wu(r,i);return To(o,o.next),To(r,r.next)}function Qp(i,e){return Kt(i.prev,i,e.prev)<0&&Kt(e.next,i,i.next)<0}function nc(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 ed(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 Yo(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 td(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&&bu(c,c.next,r,o))return!0;c=c.next}while(c!==r);return!1}(i,e)&&(js(i,e)&&js(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)&&(Kt(i.prev,i,e.prev)||Kt(i,e.prev,e))||rl(i,e)&&Kt(i.prev,i,i.next)>0&&Kt(e.prev,e,e.next)>0)}function Kt(i,e,r){return(e.y-i.y)*(r.x-e.x)-(e.x-i.x)*(r.y-e.y)}function rl(i,e){return i.x===e.x&&i.y===e.y}function bu(i,e,r,o){var c=ol(Kt(i,e,r)),h=ol(Kt(i,e,o)),d=ol(Kt(r,o,i)),m=ol(Kt(r,o,e));return c!==h&&d!==m||!(c!==0||!nl(i,r,e))||!(h!==0||!nl(i,o,e))||!(d!==0||!nl(r,i,o))||!(m!==0||!nl(r,e,o))}function nl(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 ol(i){return i>0?1:i<0?-1:0}function js(i,e){return Kt(i.prev,i,i.next)<0?Kt(i,e,i.next)>=0&&Kt(i,i.prev,e)>=0:Kt(i,e,i.prev)<0||Kt(i,i.next,e)<0}function wu(i,e){var r=new oc(i.i,i.x,i.y),o=new oc(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 Tu(i,e,r,o){var c=new oc(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 Xs(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 oc(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 sc(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 id(i,e,r,o,c){Eu(i,e,r||0,o||i.length-1,c||rd)}function Eu(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);Eu(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 T=i[e],I=r,P=o;for(Ws(i,r,e),c(i[o],T)>0&&Ws(i,r,o);I<P;){for(Ws(i,I,P),I++,P--;c(i[I],T)<0;)I++;for(;c(i[P],T)>0;)P--}c(i[r],T)===0?Ws(i,r,P):Ws(i,++P,o),P<=e&&(r=P+1),e<=P&&(o=P-1)}}function Ws(i,e,r){var o=i[e];i[e]=i[r],i[r]=o}function rd(i,e){return i<e?-1:i>e?1:0}function ac(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=Ht(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||(id(o[d],e,1,o[d].length-1,nd),o[d]=o[d].slice(0,e));return o}function nd(i,e){return e.area-i.area}function lc(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 cc(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),T=m.evaluate({zoom:o+1},r,{},c.availableImages);g=g&&g.name?g.name:g,x=x&&x.name?x.name:x,T=T&&T.name?T.name:T,h[g]=!0,h[x]=!0,h[T]=!0,r.patterns[d.id]={min:g,mid:x,max:T}}}return r}tl.exports=il,tl.exports.default=il,il.deviation=function(i,e,r,o){var c=e&&e.length,h=Math.abs(sc(i,0,c?e[0]*r:i.length,r));if(c)for(var d=0,m=e.length;d<m;d++)h-=Math.abs(sc(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,T=o[d+1]*r,I=o[d+2]*r;g+=Math.abs((i[x]-i[I])*(i[T+1]-i[x+1])-(i[x]-i[T])*(i[I+1]-i[x+1]))}return h===0&&g===0?0:Math.abs((g-h)/h)},il.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 uc{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 Mt,this.indexArray=new zi,this.indexArray2=new Ar,this.programConfigurations=new vo(e.layers,e.zoom),this.segments=new dt,this.segments2=new dt,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,o){this.hasPattern=lc("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:T}of e){const I=this.layers[0]._featureFilter.needGeometry,P=wo(m,I);if(!this.layers[0]._featureFilter.filter(new Gt(this.zoom),P,o))continue;const D=h?c.evaluate(P,{},o,r.availableImages):void 0,L={id:g,properties:m.properties,type:m.type,sourceLayerIndex:T,index:x,geometry:I?P.geometry:bo(m),patterns:{},sortKey:D};d.push(L)}h&&d.sort((m,g)=>m.sortKey-g.sortKey);for(const m of d){const{geometry:g,index:x,sourceLayerIndex:T}=m;if(this.hasPattern){const I=cc("fill",this.layers,m,this.zoom,r);this.patternFeatures.push(I)}else this.addFeature(m,g,x,o,{});r.featureIndex.insert(e[x].feature,g,x,T,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,jp),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 ac(r,500)){let m=0;for(const D of d)m+=D.length;const g=this.segments.prepareSegment(m,this.layoutVertexArray,this.indexArray),x=g.vertexLength,T=[],I=[];for(const D of d){if(D.length===0)continue;D!==d[0]&&I.push(T.length/2);const L=this.segments2.prepareSegment(D.length,this.layoutVertexArray,this.indexArray2),Z=L.vertexLength;this.layoutVertexArray.emplaceBack(D[0].x,D[0].y),this.indexArray2.emplaceBack(Z+D.length-1,Z),T.push(D[0].x),T.push(D[0].y);for(let q=1;q<D.length;q++)this.layoutVertexArray.emplaceBack(D[q].x,D[q].y),this.indexArray2.emplaceBack(Z+q-1,Z+q),T.push(D[q].x),T.push(D[q].y);L.vertexLength+=D.length,L.primitiveLength+=D.length}const P=tl.exports(T,I);for(let D=0;D<P.length;D+=3)this.indexArray.emplaceBack(x+P[D],x+P[D+1],x+P[D+2]);g.vertexLength+=m,g.primitiveLength+=P.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,o,h,c)}}$e("FillBucket",uc,{omit:["layers","patternFeatures"]});const od=new mi({"fill-sort-key":new Je(_e.layout_fill["fill-sort-key"])});var sd={paint:new mi({"fill-antialias":new Ze(_e.paint_fill["fill-antialias"]),"fill-opacity":new Je(_e.paint_fill["fill-opacity"]),"fill-color":new Je(_e.paint_fill["fill-color"]),"fill-outline-color":new Je(_e.paint_fill["fill-outline-color"]),"fill-translate":new Ze(_e.paint_fill["fill-translate"]),"fill-translate-anchor":new Ze(_e.paint_fill["fill-translate-anchor"]),"fill-pattern":new Fn(_e.paint_fill["fill-pattern"])}),layout:od};const ad=Qt([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),ld=Qt([{name:"a_centroid",components:2,type:"Int16"}],4),{members:cd}=ad;var Un={},ud=Xe,Su=Qo;function Qo(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(hd,this,e)}function hd(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 pd(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}Qo.types=["Unknown","Point","LineString","Polygon"],Qo.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 ud(h,d));else{if(o!==7)throw new Error("unknown command "+o);e&&e.push(e[0].clone())}}return e&&m.push(e),m},Qo.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 T=i.readVarint();r=7&T,o=T>>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]},Qo.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=Qo.types[this.type];function T(D){for(var L=0;L<D.length;L++){var Z=D[L];D[L]=[360*(Z.x+d)/h-180,360/Math.PI*Math.atan(Math.exp((180-360*(Z.y+m)/h)*Math.PI/180))-90]}}switch(this.type){case 1:var I=[];for(o=0;o<g.length;o++)I[o]=g[o][0];T(g=I);break;case 2:for(o=0;o<g.length;o++)T(g[o]);break;case 3:for(g=function(D){var L=D.length;if(L<=1)return[D];for(var Z,q,re=[],ce=0;ce<L;ce++){var ee=pd(D[ce]);ee!==0&&(q===void 0&&(q=ee<0),q===ee<0?(Z&&re.push(Z),Z=[D[ce]]):Z.push(D[ce]))}return Z&&re.push(Z),re}(g),o=0;o<g.length;o++)for(c=0;c<g[o].length;c++)T(g[o][c])}g.length===1?g=g[0]:x="Multi"+x;var P={type:"Feature",geometry:{type:x,coordinates:g},properties:this.properties};return"id"in this&&(P.id=this.id),P};var dd=Su,Iu=Cu;function Cu(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(fd,this,e),this.length=this._features.length}function fd(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))}Cu.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 dd(this._pbf,e,this.extent,this._keys,this._values)};var md=Iu;function gd(i,e,r){if(i===3){var o=new md(r,r.readVarint()+r.pos);o.length&&(e[o.name]=o)}}Un.VectorTile=function(i,e){this.layers=i.readFields(gd,{},e)},Un.VectorTileFeature=Su,Un.VectorTileLayer=Iu;const _d=Un.VectorTileFeature.types,hc=Math.pow(2,13);function Hs(i,e,r,o,c,h,d,m){i.emplaceBack(e,r,2*Math.floor(o*hc)+d,c*hc*2,h*hc*2,Math.round(m))}class pc{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 _t,this.centroidVertexArray=new We,this.indexArray=new zi,this.programConfigurations=new vo(e.layers,e.zoom),this.segments=new dt,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,o){this.features=[],this.hasPattern=lc("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=wo(c,g);if(!this.layers[0]._featureFilter.filter(new Gt(this.zoom),x,o))continue;const T={id:h,sourceLayerIndex:m,index:d,geometry:g?x.geometry:bo(c),properties:c.properties,type:c.type,patterns:{}};this.hasPattern?this.features.push(cc("fill-extrusion",this.layers,T,this.zoom,r)):this.addFeature(T,T.geometry,d,o,{}),r.featureIndex.insert(c,T.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,cd),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,ld.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 ac(r,500)){let g=0;for(const L of m)g+=L.length;let x=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const L of m){if(L.length===0||xd(L))continue;let Z=0;for(let q=0;q<L.length;q++){const re=L[q];if(q>=1){const ce=L[q-1];if(!yd(re,ce)){x.vertexLength+4>dt.MAX_VERTEX_ARRAY_LENGTH&&(x=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const ee=re.sub(ce)._perp()._unit(),ae=ce.dist(re);Z+ae>32768&&(Z=0),Hs(this.layoutVertexArray,re.x,re.y,ee.x,ee.y,0,0,Z),Hs(this.layoutVertexArray,re.x,re.y,ee.x,ee.y,0,1,Z),d.x+=2*re.x,d.y+=2*re.y,d.vertexCount+=2,Z+=ae,Hs(this.layoutVertexArray,ce.x,ce.y,ee.x,ee.y,0,0,Z),Hs(this.layoutVertexArray,ce.x,ce.y,ee.x,ee.y,0,1,Z),d.x+=2*ce.x,d.y+=2*ce.y,d.vertexCount+=2;const xe=x.vertexLength;this.indexArray.emplaceBack(xe,xe+2,xe+1),this.indexArray.emplaceBack(xe+1,xe+2,xe+3),x.vertexLength+=4,x.primitiveLength+=2}}}}if(x.vertexLength+g>dt.MAX_VERTEX_ARRAY_LENGTH&&(x=this.segments.prepareSegment(g,this.layoutVertexArray,this.indexArray)),_d[e.type]!=="Polygon")continue;const T=[],I=[],P=x.vertexLength;for(const L of m)if(L.length!==0){L!==m[0]&&I.push(T.length/2);for(let Z=0;Z<L.length;Z++){const q=L[Z];Hs(this.layoutVertexArray,q.x,q.y,0,0,1,1,0),d.x+=q.x,d.y+=q.y,d.vertexCount+=1,T.push(q.x),T.push(q.y)}}const D=tl.exports(T,I);for(let L=0;L<D.length;L+=3)this.indexArray.emplaceBack(P+D[L],P+D[L+2],P+D[L+1]);x.primitiveLength+=D.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 yd(i,e){return i.x===e.x&&(i.x<0||i.x>ri)||i.y===e.y&&(i.y<0||i.y>ri)}function xd(i){return i.every(e=>e.x<0)||i.every(e=>e.x>ri)||i.every(e=>e.y<0)||i.every(e=>e.y>ri)}$e("FillExtrusionBucket",pc,{omit:["layers","features"]});var vd={paint:new mi({"fill-extrusion-opacity":new Ze(_e["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Je(_e["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Ze(_e["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Ze(_e["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Fn(_e["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Je(_e["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Je(_e["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Ze(_e["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})};function Ks(i,e){return i.x*e.x+i.y*e.y}function Au(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),T=Ks(m,m),I=Ks(m,g),P=Ks(g,g),D=Ks(x,m),L=Ks(x,g),Z=T*P-I*I,q=(P*D-I*L)/Z,re=(T*L-I*D)/Z,ce=o.z*(1-q-re)+c.z*q+h.z*re;if(isFinite(ce))return ce}return 1/0}{let r=1/0;for(const o of e)r=Math.min(r,o.z);return r}}const bd=Qt([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:wd}=bd,Td=Qt([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:Ed}=Td,Sd=Un.VectorTileFeature.types,Id=Math.cos(Math.PI/180*37.5),Mu=Math.pow(2,14)/.5;class dc{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 Tt,this.layoutVertexArray2=new zt,this.indexArray=new zi,this.programConfigurations=new vo(e.layers,e.zoom),this.segments=new dt,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,o){this.hasPattern=lc("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:T}of e){const I=this.layers[0]._featureFilter.needGeometry,P=wo(m,I);if(!this.layers[0]._featureFilter.filter(new Gt(this.zoom),P,o))continue;const D=h?c.evaluate(P,{},o):void 0,L={id:g,properties:m.properties,type:m.type,sourceLayerIndex:T,index:x,geometry:I?P.geometry:bo(m),patterns:{},sortKey:D};d.push(L)}h&&d.sort((m,g)=>m.sortKey-g.sortKey);for(const m of d){const{geometry:g,index:x,sourceLayerIndex:T}=m;if(this.hasPattern){const I=cc("line",this.layers,m,this.zoom,r);this.patternFeatures.push(I)}else this.addFeature(m,g,x,o,{});r.featureIndex.insert(e[x].feature,g,x,T,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,Ed)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,wd),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"),T=d.get("line-round-limit");this.lineClips=this.lineFeatureClips(e);for(const I of r)this.addLine(I,e,m,g,x,T);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 re=0;re<e.length-1;re++)this.totalDistance+=e[re].dist(e[re+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const m=Sd[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 T=this.overscaling<=16?122880/(512*this.overscaling):0,I=this.segments.prepareSegment(10*g,this.layoutVertexArray,this.indexArray);let P,D,L,Z,q;this.e1=this.e2=-1,m&&(P=e[g-2],q=e[x].sub(P)._unit()._perp());for(let re=x;re<g;re++){if(L=re===g-1?m?e[x+1]:void 0:e[re+1],L&&e[re].equals(L))continue;q&&(Z=q),P&&(D=P),P=e[re],q=L?L.sub(P)._unit()._perp():Z,Z=Z||q;let ce=Z.add(q);ce.x===0&&ce.y===0||ce._unit();const ee=Z.x*q.x+Z.y*q.y,ae=ce.x*q.x+ce.y*q.y,xe=ae!==0?1/ae:1/0,ye=2*Math.sqrt(2-2*ae),Oe=ae<Id&&D&&L,Ve=Z.x*q.y-Z.y*q.x>0;if(Oe&&re>x){const Ee=P.dist(D);if(Ee>2*T){const De=P.sub(P.sub(D)._mult(T/Ee)._round());this.updateDistance(D,De),this.addCurrentVertex(De,Z,0,0,I),D=De}}const ke=D&&L;let Ce=ke?o:m?"butt":c;if(ke&&Ce==="round"&&(xe<d?Ce="miter":xe<=2&&(Ce="fakeround")),Ce==="miter"&&xe>h&&(Ce="bevel"),Ce==="bevel"&&(xe>2&&(Ce="flipbevel"),xe<h&&(Ce="miter")),D&&this.updateDistance(D,P),Ce==="miter")ce._mult(xe),this.addCurrentVertex(P,ce,0,0,I);else if(Ce==="flipbevel"){if(xe>100)ce=q.mult(-1);else{const Ee=xe*Z.add(q).mag()/Z.sub(q).mag();ce._perp()._mult(Ee*(Ve?-1:1))}this.addCurrentVertex(P,ce,0,0,I),this.addCurrentVertex(P,ce.mult(-1),0,0,I)}else if(Ce==="bevel"||Ce==="fakeround"){const Ee=-Math.sqrt(xe*xe-1),De=Ve?Ee:0,Pe=Ve?0:Ee;if(D&&this.addCurrentVertex(P,Z,De,Pe,I),Ce==="fakeround"){const we=Math.round(180*ye/Math.PI/20);for(let He=1;He<we;He++){let je=He/we;if(je!==.5){const Ot=je-.5;je+=je*Ot*(je-1)*((1.0904+ee*(ee*(3.55645-1.43519*ee)-3.2452))*Ot*Ot+(.848013+ee*(.215638*ee-1.06021)))}const ht=q.sub(Z)._mult(je)._add(Z)._unit()._mult(Ve?-1:1);this.addHalfVertex(P,ht.x,ht.y,!1,Ve,0,I)}}L&&this.addCurrentVertex(P,q,-De,-Pe,I)}else if(Ce==="butt")this.addCurrentVertex(P,ce,0,0,I);else if(Ce==="square"){const Ee=D?1:-1;this.addCurrentVertex(P,ce,Ee,Ee,I)}else Ce==="round"&&(D&&(this.addCurrentVertex(P,Z,0,0,I),this.addCurrentVertex(P,Z,1,1,I,!0)),L&&(this.addCurrentVertex(P,q,-1,-1,I,!0),this.addCurrentVertex(P,q,0,0,I)));if(Oe&&re<g-1){const Ee=P.dist(L);if(Ee>2*T){const De=P.add(L.sub(P)._mult(T/Ee)._round());this.updateDistance(P,De),this.addCurrentVertex(De,q,0,0,I),P=De}}}}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>Mu/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*(Mu-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 T=g.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,T),g.primitiveLength++),d?this.e2=T:this.e1=T}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()}}$e("LineBucket",dc,{omit:["layers","patternFeatures"]});const Cd=new mi({"line-cap":new Ze(_e.layout_line["line-cap"]),"line-join":new Je(_e.layout_line["line-join"]),"line-miter-limit":new Ze(_e.layout_line["line-miter-limit"]),"line-round-limit":new Ze(_e.layout_line["line-round-limit"]),"line-sort-key":new Je(_e.layout_line["line-sort-key"])});var Pu={paint:new mi({"line-opacity":new Je(_e.paint_line["line-opacity"]),"line-color":new Je(_e.paint_line["line-color"]),"line-translate":new Ze(_e.paint_line["line-translate"]),"line-translate-anchor":new Ze(_e.paint_line["line-translate-anchor"]),"line-width":new Je(_e.paint_line["line-width"]),"line-gap-width":new Je(_e.paint_line["line-gap-width"]),"line-offset":new Je(_e.paint_line["line-offset"]),"line-blur":new Je(_e.paint_line["line-blur"]),"line-dasharray":new Fs(_e.paint_line["line-dasharray"]),"line-pattern":new Fn(_e.paint_line["line-pattern"]),"line-gradient":new qr(_e.paint_line["line-gradient"])}),layout:Cd};const zu=new class extends Je{possiblyEvaluate(i,e){return e=new Gt(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=Ne({},e,{zoom:Math.floor(e.zoom)}),super.evaluate(i,e,r,o)}}(Pu.paint.properties["line-width"].specification);function ku(i,e){return e>0?e+2*i:i}zu.useIntegerZoom=!0;const Ad=Qt([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Md=Qt([{name:"a_projected_pos",components:3,type:"Float32"}],4);Qt([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const Pd=Qt([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]);Qt([{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 Du=Qt([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),zd=Qt([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function kd(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()),Ji.applyArabicShaping&&(c=Ji.applyArabicShaping(c)),c}(o.text,e,r)}),i}Qt([{name:"triangle",components:3,type:"Uint16"}]),Qt([{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"}]),Qt([{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"}]),Qt([{type:"Float32",name:"offsetX"}]),Qt([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]);const Js={"!":"\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 gi=24,fc=Lt,Lu=function(i,e,r,o,c){var h,d,m=8*c-o-1,g=(1<<m)-1,x=g>>1,T=-7,I=r?c-1:0,P=r?-1:1,D=i[e+I];for(I+=P,h=D&(1<<-T)-1,D>>=-T,T+=m;T>0;h=256*h+i[e+I],I+=P,T-=8);for(d=h&(1<<-T)-1,h>>=-T,T+=o;T>0;d=256*d+i[e+I],I+=P,T-=8);if(h===0)h=1-x;else{if(h===g)return d?NaN:1/0*(D?-1:1);d+=Math.pow(2,o),h-=x}return(D?-1:1)*d*Math.pow(2,h-o)},Ru=function(i,e,r,o,c,h){var d,m,g,x=8*h-c-1,T=(1<<x)-1,I=T>>1,P=c===23?Math.pow(2,-24)-Math.pow(2,-77):0,D=o?0:h-1,L=o?1:-1,Z=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=T):(d=Math.floor(Math.log(e)/Math.LN2),e*(g=Math.pow(2,-d))<1&&(d--,g*=2),(e+=d+I>=1?P/g:P*Math.pow(2,1-I))*g>=2&&(d++,g/=2),d+I>=T?(m=0,d=T):d+I>=1?(m=(e*g-1)*Math.pow(2,c),d+=I):(m=e*Math.pow(2,I-1)*Math.pow(2,c),d=0));c>=8;i[r+D]=255&m,D+=L,m/=256,c-=8);for(d=d<<c|m,x+=c;x>0;i[r+D]=255&d,D+=L,d/=256,x-=8);i[r+D-L]|=128*Z};function Lt(i){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(i)?i:new Uint8Array(i||0),this.pos=0,this.type=0,this.length=this.buf.length}Lt.Varint=0,Lt.Fixed64=1,Lt.Bytes=2,Lt.Fixed32=5;var Vn,mc=4294967296,Bu=1/mc,Fu=typeof TextDecoder=="undefined"?null:new TextDecoder("utf8");function hn(i){return i.type===Lt.Bytes?i.readVarint()+i.pos:i.pos+1}function es(i,e,r){return r?4294967296*e+(i>>>0):4294967296*(e>>>0)+(i>>>0)}function Ou(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 Dd(i,e){for(var r=0;r<i.length;r++)e.writeVarint(i[r])}function Ld(i,e){for(var r=0;r<i.length;r++)e.writeSVarint(i[r])}function Rd(i,e){for(var r=0;r<i.length;r++)e.writeFloat(i[r])}function Bd(i,e){for(var r=0;r<i.length;r++)e.writeDouble(i[r])}function Fd(i,e){for(var r=0;r<i.length;r++)e.writeBoolean(i[r])}function Od(i,e){for(var r=0;r<i.length;r++)e.writeFixed32(i[r])}function $d(i,e){for(var r=0;r<i.length;r++)e.writeSFixed32(i[r])}function Ud(i,e){for(var r=0;r<i.length;r++)e.writeFixed64(i[r])}function Vd(i,e){for(var r=0;r<i.length;r++)e.writeSFixed64(i[r])}function sl(i,e){return(i[e]|i[e+1]<<8|i[e+2]<<16)+16777216*i[e+3]}function ts(i,e,r){i[r]=e,i[r+1]=e>>>8,i[r+2]=e>>>16,i[r+3]=e>>>24}function $u(i,e){return(i[e]|i[e+1]<<8|i[e+2]<<16)+(i[e+3]<<24)}function Nd(i,e,r){i===1&&r.readMessage(Gd,e)}function Gd(i,e,r){if(i===3){const{id:o,bitmap:c,width:h,height:d,left:m,top:g,advance:x}=r.readMessage(qd,{});e.push({id:o,bitmap:new qs({width:h+6,height:d+6},c),metrics:{width:h,height:d,left:m,top:g,advance:x}})}}function qd(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 Uu(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}}Lt.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=sl(this.buf,this.pos);return this.pos+=4,i},readSFixed32:function(){var i=$u(this.buf,this.pos);return this.pos+=4,i},readFixed64:function(){var i=sl(this.buf,this.pos)+sl(this.buf,this.pos+4)*mc;return this.pos+=8,i},readSFixed64:function(){var i=sl(this.buf,this.pos)+$u(this.buf,this.pos+4)*mc;return this.pos+=8,i},readFloat:function(){var i=Lu(this.buf,this.pos,!0,23,4);return this.pos+=4,i},readDouble:function(){var i=Lu(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 es(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&&Fu?function(r,o,c){return Fu.decode(r.subarray(o,c))}(this.buf,e,i):function(r,o,c){for(var h="",d=o;d<c;){var m,g,x,T=r[d],I=null,P=T>239?4:T>223?3:T>191?2:1;if(d+P>c)break;P===1?T<128&&(I=T):P===2?(192&(m=r[d+1]))==128&&(I=(31&T)<<6|63&m)<=127&&(I=null):P===3?(g=r[d+2],(192&(m=r[d+1]))==128&&(192&g)==128&&((I=(15&T)<<12|(63&m)<<6|63&g)<=2047||I>=55296&&I<=57343)&&(I=null)):P===4&&(g=r[d+2],x=r[d+3],(192&(m=r[d+1]))==128&&(192&g)==128&&(192&x)==128&&((I=(15&T)<<18|(63&m)<<12|(63&g)<<6|63&x)<=65535||I>=1114112)&&(I=null)),I===null?(I=65533,P=1):I>65535&&(I-=65536,h+=String.fromCharCode(I>>>10&1023|55296),I=56320|1023&I),h+=String.fromCharCode(I),d+=P}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!==Lt.Bytes)return i.push(this.readVarint(e));var r=hn(this);for(i=i||[];this.pos<r;)i.push(this.readVarint(e));return i},readPackedSVarint:function(i){if(this.type!==Lt.Bytes)return i.push(this.readSVarint());var e=hn(this);for(i=i||[];this.pos<e;)i.push(this.readSVarint());return i},readPackedBoolean:function(i){if(this.type!==Lt.Bytes)return i.push(this.readBoolean());var e=hn(this);for(i=i||[];this.pos<e;)i.push(this.readBoolean());return i},readPackedFloat:function(i){if(this.type!==Lt.Bytes)return i.push(this.readFloat());var e=hn(this);for(i=i||[];this.pos<e;)i.push(this.readFloat());return i},readPackedDouble:function(i){if(this.type!==Lt.Bytes)return i.push(this.readDouble());var e=hn(this);for(i=i||[];this.pos<e;)i.push(this.readDouble());return i},readPackedFixed32:function(i){if(this.type!==Lt.Bytes)return i.push(this.readFixed32());var e=hn(this);for(i=i||[];this.pos<e;)i.push(this.readFixed32());return i},readPackedSFixed32:function(i){if(this.type!==Lt.Bytes)return i.push(this.readSFixed32());var e=hn(this);for(i=i||[];this.pos<e;)i.push(this.readSFixed32());return i},readPackedFixed64:function(i){if(this.type!==Lt.Bytes)return i.push(this.readFixed64());var e=hn(this);for(i=i||[];this.pos<e;)i.push(this.readFixed64());return i},readPackedSFixed64:function(i){if(this.type!==Lt.Bytes)return i.push(this.readSFixed64());var e=hn(this);for(i=i||[];this.pos<e;)i.push(this.readSFixed64());return i},skip:function(i){var e=7&i;if(e===Lt.Varint)for(;this.buf[this.pos++]>127;);else if(e===Lt.Bytes)this.pos=this.readVarint()+this.pos;else if(e===Lt.Fixed32)this.pos+=4;else{if(e!==Lt.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),ts(this.buf,i,this.pos),this.pos+=4},writeSFixed32:function(i){this.realloc(4),ts(this.buf,i,this.pos),this.pos+=4},writeFixed64:function(i){this.realloc(8),ts(this.buf,-1&i,this.pos),ts(this.buf,Math.floor(i*Bu),this.pos+4),this.pos+=8},writeSFixed64:function(i){this.realloc(8),ts(this.buf,-1&i,this.pos),ts(this.buf,Math.floor(i*Bu),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&&Ou(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(i){this.realloc(4),Ru(this.buf,i,this.pos,!0,23,4),this.pos+=4},writeDouble:function(i){this.realloc(8),Ru(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&&Ou(r,o,this),this.pos=r-1,this.writeVarint(o),this.pos+=o},writeMessage:function(i,e,r){this.writeTag(i,Lt.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(i,e){e.length&&this.writeMessage(i,Dd,e)},writePackedSVarint:function(i,e){e.length&&this.writeMessage(i,Ld,e)},writePackedBoolean:function(i,e){e.length&&this.writeMessage(i,Fd,e)},writePackedFloat:function(i,e){e.length&&this.writeMessage(i,Rd,e)},writePackedDouble:function(i,e){e.length&&this.writeMessage(i,Bd,e)},writePackedFixed32:function(i,e){e.length&&this.writeMessage(i,Od,e)},writePackedSFixed32:function(i,e){e.length&&this.writeMessage(i,$d,e)},writePackedFixed64:function(i,e){e.length&&this.writeMessage(i,Ud,e)},writePackedSFixed64:function(i,e){e.length&&this.writeMessage(i,Vd,e)},writeBytesField:function(i,e){this.writeTag(i,Lt.Bytes),this.writeBytes(e)},writeFixed32Field:function(i,e){this.writeTag(i,Lt.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(i,e){this.writeTag(i,Lt.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(i,e){this.writeTag(i,Lt.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(i,e){this.writeTag(i,Lt.Fixed64),this.writeSFixed64(e)},writeVarintField:function(i,e){this.writeTag(i,Lt.Varint),this.writeVarint(e)},writeSVarintField:function(i,e){this.writeTag(i,Lt.Varint),this.writeSVarint(e)},writeStringField:function(i,e){this.writeTag(i,Lt.Bytes),this.writeString(e)},writeFloatField:function(i,e){this.writeTag(i,Lt.Fixed32),this.writeFloat(e)},writeDoubleField:function(i,e){this.writeTag(i,Lt.Fixed64),this.writeDouble(e)},writeBooleanField:function(i,e){this.writeVarintField(i,Boolean(e))}};class gc{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 Vu{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}=Uu(h),g=new or({width:d||1,height:m||1});for(const x in e){const T=e[x],I=o[x].paddedRect;or.copy(T.data,g,{x:0,y:0},{x:I.x+1,y:I.y+1},T.data)}for(const x in r){const T=r[x],I=c[x].paddedRect,P=I.x+1,D=I.y+1,L=T.data.width,Z=T.data.height;or.copy(T.data,g,{x:0,y:0},{x:P,y:D},T.data),or.copy(T.data,g,{x:0,y:Z-1},{x:P,y:D-1},{width:L,height:1}),or.copy(T.data,g,{x:0,y:0},{x:P,y:D+Z},{width:L,height:1}),or.copy(T.data,g,{x:L-1,y:0},{x:P-1,y:D},{width:1,height:Z}),or.copy(T.data,g,{x:0,y:0},{x:P+L,y:D},{width:1,height:Z})}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 gc(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})}}$e("ImagePosition",gc),$e("ImageAtlas",Vu),a.WritingMode=void 0,(Vn=a.WritingMode||(a.WritingMode={}))[Vn.none=0]="none",Vn[Vn.horizontal=1]="horizontal",Vn[Vn.vertical=2]="vertical",Vn[Vn.horizontalOnly=3]="horizontalOnly";const al=-17;class Ys{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(e,r){const o=new Ys;return o.scale=e||1,o.fontStack=r,o}static forImage(e){const r=new Ys;return r.imageName=e,r}}class is{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(e,r){const o=new is;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&&Va(c)&&!Js[e[o+1]]||h&&Va(h)&&!Js[e[o-1]]||!Js[e[o]]?e[o]:Js[e[o]]}return r}(this.text)}trim(){let e=0;for(let o=0;o<this.text.length&&cl[this.text.charCodeAt(o)];o++)e++;let r=this.text.length;for(let o=this.text.length-1;o>=0&&o>=e&&cl[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 is;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(Ys.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 at("Can't add FormattedSection with an empty image.");const o=this.getNextImageSectionCharCode();o?(this.text+=String.fromCharCode(o),this.sections.push(Ys.forImage(r)),this.sectionIndex.push(this.sections.length-1)):at("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function ll(i,e,r,o,c,h,d,m,g,x,T,I,P,D,L,Z){const q=is.fromFeature(i,c);let re;I===a.WritingMode.vertical&&q.verticalizePunctuation();const{processBidirectionalText:ce,processStyledBidirectionalText:ee}=Ji;if(ce&&q.sections.length===1){re=[];const ye=ce(q.toString(),_c(q,x,h,e,o,D,L));for(const Oe of ye){const Ve=new is;Ve.text=Oe,Ve.sections=q.sections;for(let ke=0;ke<Oe.length;ke++)Ve.sectionIndex.push(0);re.push(Ve)}}else if(ee){re=[];const ye=ee(q.text,q.sectionIndex,_c(q,x,h,e,o,D,L));for(const Oe of ye){const Ve=new is;Ve.text=Oe[0],Ve.sectionIndex=Oe[1],Ve.sections=q.sections,re.push(Ve)}}else re=function(ye,Oe){const Ve=[],ke=ye.text;let Ce=0;for(const Ee of Oe)Ve.push(ye.substring(Ce,Ee)),Ce=Ee;return Ce<ke.length&&Ve.push(ye.substring(Ce,ke.length)),Ve}(q,_c(q,x,h,e,o,D,L));const ae=[],xe={positionedLines:ae,text:q.toString(),top:T[1],bottom:T[1],left:T[0],right:T[0],writingMode:I,iconsInText:!1,verticalizable:!1};return function(ye,Oe,Ve,ke,Ce,Ee,De,Pe,we,He,je,ht){let Ot=0,Zt=al,ni=0,ar=0;const yi=Pe==="right"?1:Pe==="left"?0:.5;let ei=0;for(const ti of Ce){ti.trim();const vi=ti.getMaxScale(),Si=(vi-1)*gi,Li={positionedGlyphs:[],lineOffset:0};ye.positionedLines[ei]=Li;const Gi=Li.positionedGlyphs;let qi=0;if(!ti.length()){Zt+=Ee,++ei;continue}for(let hi=0;hi<ti.length();hi++){const ft=ti.getSection(hi),er=ti.getSectionIndex(hi),bi=ti.getCharCode(hi);let Ii=0,yr=null,Pr=null,zr=null,dn=gi;const xr=!(we===a.WritingMode.horizontal||!je&&!zs(bi)||je&&(cl[bi]||(ui=bi,ze.Arabic(ui)||ze["Arabic Supplement"](ui)||ze["Arabic Extended-A"](ui)||ze["Arabic Presentation Forms-A"](ui)||ze["Arabic Presentation Forms-B"](ui))));if(ft.imageName){const lr=ke[ft.imageName];if(!lr)continue;zr=ft.imageName,ye.iconsInText=ye.iconsInText||!0,Pr=lr.paddedRect;const Zi=lr.displaySize;ft.scale=ft.scale*gi/ht,yr={width:Zi[0],height:Zi[1],left:1,top:-3,advance:xr?Zi[1]:Zi[0]},Ii=Si+(gi-Zi[1]*ft.scale),dn=yr.advance;const fn=xr?Zi[0]*ft.scale-gi*vi:Zi[1]*ft.scale-gi*vi;fn>0&&fn>qi&&(qi=fn)}else{const lr=Ve[ft.fontStack],Zi=lr&&lr[bi];if(Zi&&Zi.rect)Pr=Zi.rect,yr=Zi.metrics;else{const fn=Oe[ft.fontStack],ta=fn&&fn[bi];if(!ta)continue;yr=ta.metrics}Ii=(vi-ft.scale)*gi}xr?(ye.verticalizable=!0,Gi.push({glyph:bi,imageName:zr,x:Ot,y:Zt+Ii,vertical:xr,scale:ft.scale,fontStack:ft.fontStack,sectionIndex:er,metrics:yr,rect:Pr}),Ot+=dn*ft.scale+He):(Gi.push({glyph:bi,imageName:zr,x:Ot,y:Zt+Ii,vertical:xr,scale:ft.scale,fontStack:ft.fontStack,sectionIndex:er,metrics:yr,rect:Pr}),Ot+=yr.advance*ft.scale+He)}Gi.length!==0&&(ni=Math.max(Ot-He,ni),Xd(Gi,0,Gi.length-1,yi,qi)),Ot=0;const jt=Ee*vi+qi;Li.lineOffset=Math.max(qi,Si),Zt+=jt,ar=Math.max(jt,ar),++ei}var ui;const xi=Zt-al,{horizontalAlign:Ei,verticalAlign:Ni}=yc(De);(function(ti,vi,Si,Li,Gi,qi,jt,hi,ft){const er=(vi-Si)*Gi;let bi=0;bi=qi!==jt?-hi*Li-al:(-Li*ft+.5)*jt;for(const Ii of ti)for(const yr of Ii.positionedGlyphs)yr.x+=er,yr.y+=bi})(ye.positionedLines,yi,Ei,Ni,ni,ar,Ee,xi,Ce.length),ye.top+=-Ni*xi,ye.bottom=ye.top+xi,ye.left+=-Ei*ni,ye.right=ye.left+ni}(xe,e,r,o,re,d,m,g,I,x,P,Z),!function(ye){for(const Oe of ye)if(Oe.positionedGlyphs.length!==0)return!1;return!0}(ae)&&xe}const cl={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Zd={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 Nu(i,e,r,o,c,h){if(e.imageName){const d=o[e.imageName];return d?d.displaySize[0]*e.scale*gi/h+c:0}{const d=r[e.fontStack],m=d&&d[i];return m?m.metrics.advance*e.scale+c:0}}function Gu(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 jd(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 qu(i,e,r,o,c,h){let d=null,m=Gu(e,r,c,h);for(const g of o){const x=Gu(e-g.x,r,c,h)+g.badness;x<=m&&(d=g,m=x)}return{index:i,x:e,priorBreak:d,badness:m}}function Zu(i){return i?Zu(i.priorBreak).concat(i.index):[]}function _c(i,e,r,o,c,h,d){if(h!=="point")return[];if(!i)return[];const m=[],g=function(P,D,L,Z,q,re){let ce=0;for(let ee=0;ee<P.length();ee++){const ae=P.getSection(ee);ce+=Nu(P.getCharCode(ee),ae,Z,q,D,re)}return ce/Math.max(1,Math.ceil(ce/L))}(i,e,r,o,c,d),x=i.text.indexOf("\u200B")>=0;let T=0;for(let P=0;P<i.length();P++){const D=i.getSection(P),L=i.getCharCode(P);if(cl[L]||(T+=Nu(L,D,o,c,e,d)),P<i.length()-1){const Z=!((I=L)<11904||!(ze["Bopomofo Extended"](I)||ze.Bopomofo(I)||ze["CJK Compatibility Forms"](I)||ze["CJK Compatibility Ideographs"](I)||ze["CJK Compatibility"](I)||ze["CJK Radicals Supplement"](I)||ze["CJK Strokes"](I)||ze["CJK Symbols and Punctuation"](I)||ze["CJK Unified Ideographs Extension A"](I)||ze["CJK Unified Ideographs"](I)||ze["Enclosed CJK Letters and Months"](I)||ze["Halfwidth and Fullwidth Forms"](I)||ze.Hiragana(I)||ze["Ideographic Description Characters"](I)||ze["Kangxi Radicals"](I)||ze["Katakana Phonetic Extensions"](I)||ze.Katakana(I)||ze["Vertical Forms"](I)||ze["Yi Radicals"](I)||ze["Yi Syllables"](I)));(Zd[L]||Z||D.imageName)&&m.push(qu(P+1,T,g,m,jd(L,i.getCharCode(P+1),Z&&x),!1))}}var I;return Zu(qu(i.length(),T,g,m,0,!0))}function yc(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 Xd(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 Wd(i,e,r){const{horizontalAlign:o,verticalAlign:c}=yc(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 ju(i,e,r,o,c,h){const d=i.image;let m;if(d.content){const q=d.content,re=d.pixelRatio||1;m=[q[0]/re,q[1]/re,d.displaySize[0]-q[2]/re,d.displaySize[1]-q[3]/re]}const g=e.left*h,x=e.right*h;let T,I,P,D;r==="width"||r==="both"?(D=c[0]+g-o[3],I=c[0]+x+o[1]):(D=c[0]+(g+x-d.displaySize[0])/2,I=D+d.displaySize[0]);const L=e.top*h,Z=e.bottom*h;return r==="height"||r==="both"?(T=c[1]+L-o[0],P=c[1]+Z+o[2]):(T=c[1]+(L+Z-d.displaySize[1])/2,P=T+d.displaySize[1]),{image:d,top:T,right:I,bottom:P,left:D,collisionPadding:m}}const pn=128;function Xu(i,e){const{expression:r}=e;if(r.kind==="constant")return{kind:"constant",layoutSize:r.evaluate(new Gt(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 Gt(m)),maxSize:r.evaluate(new Gt(g)),interpolationType:c}}}class Nn extends Xe{constructor(e,r,o,c){super(e,r),this.angle=o,c!==void 0&&(this.segment=c)}clone(){return new Nn(this.x,this.y,this.angle,this.segment)}}function Wu(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 T=i[d],I=i[d+1];if(!I)return!1;let P=i[d-1].angleTo(T)-T.angleTo(I);for(P=Math.abs((P+3*Math.PI)%(2*Math.PI)-Math.PI),g.push({distance:m,angleDelta:P}),x+=P;m-g[0].distance>o;)x-=g.shift().angleDelta;if(x>c)return!1;d++,m+=T.dist(I)}return!0}function Hu(i){let e=0;for(let r=0;r<i.length-1;r++)e+=i[r].dist(i[r+1]);return e}function Ku(i,e,r){return i?.6*e*r:0}function Ju(i,e){return Math.max(i?i.right-i.left:0,e?e.right-e.left:0)}function Hd(i,e,r,o,c,h){const d=Ku(r,c,h),m=Ju(r,o)*h;let g=0;const x=Hu(i)/2;for(let T=0;T<i.length-1;T++){const I=i[T],P=i[T+1],D=I.dist(P);if(g+D>x){const L=(x-g)/D,Z=Vt(I.x,P.x,L),q=Vt(I.y,P.y,L),re=new Nn(Z,q,P.angleTo(I),T);return re._round(),!d||Wu(i,re,m,d,e)?re:void 0}g+=D}}function Kd(i,e,r,o,c,h,d,m,g){const x=Ku(o,h,d),T=Ju(o,c),I=T*d,P=i[0].x===0||i[0].x===g||i[0].y===0||i[0].y===g;return e-I<e/4&&(e=I+e/4),Yu(i,P?e/2*m%e:(T/2+2*h)*d*m%e,e,x,r,I,P,!1,g)}function Yu(i,e,r,o,c,h,d,m,g){const x=h/2,T=Hu(i);let I=0,P=e-r,D=[];for(let L=0;L<i.length-1;L++){const Z=i[L],q=i[L+1],re=Z.dist(q),ce=q.angleTo(Z);for(;P+r<I+re;){P+=r;const ee=(P-I)/re,ae=Vt(Z.x,q.x,ee),xe=Vt(Z.y,q.y,ee);if(ae>=0&&ae<g&&xe>=0&&xe<g&&P-x>=0&&P+x<=T){const ye=new Nn(ae,xe,ce,L);ye._round(),o&&!Wu(i,ye,h,o,c)||D.push(ye)}}I+=re}return m||D.length||d||(D=Yu(i,I/2,r,o,c,h,d,!0,g)),D}function Qu(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 T=m[x],I=m[x+1];T.x<e&&I.x<e||(T.x<e?T=new Xe(e,T.y+(e-T.x)/(I.x-T.x)*(I.y-T.y))._round():I.x<e&&(I=new Xe(e,T.y+(e-T.x)/(I.x-T.x)*(I.y-T.y))._round()),T.y<r&&I.y<r||(T.y<r?T=new Xe(T.x+(r-T.y)/(I.y-T.y)*(I.x-T.x),r)._round():I.y<r&&(I=new Xe(T.x+(r-T.y)/(I.y-T.y)*(I.x-T.x),r)._round()),T.x>=o&&I.x>=o||(T.x>=o?T=new Xe(o,T.y+(o-T.x)/(I.x-T.x)*(I.y-T.y))._round():I.x>=o&&(I=new Xe(o,T.y+(o-T.x)/(I.x-T.x)*(I.y-T.y))._round()),T.y>=c&&I.y>=c||(T.y>=c?T=new Xe(T.x+(c-T.y)/(I.y-T.y)*(I.x-T.x),c)._round():I.y>=c&&(I=new Xe(T.x+(c-T.y)/(I.y-T.y)*(I.x-T.x),c)._round()),g&&T.equals(g[g.length-1])||(g=[T],h.push(g)),g.push(I)))))}}return h}function eh(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,T=i.bottom-i.top,I=h.stretchX||[[0,m]],P=h.stretchY||[[0,g]],D=(Ee,De)=>Ee+De[1]-De[0],L=I.reduce(D,0),Z=P.reduce(D,0),q=m-L,re=g-Z;let ce=0,ee=L,ae=0,xe=Z,ye=0,Oe=q,Ve=0,ke=re;if(h.content&&o){const Ee=h.content;ce=ul(I,0,Ee[0]),ae=ul(P,0,Ee[1]),ee=ul(I,Ee[0],Ee[2]),xe=ul(P,Ee[1],Ee[3]),ye=Ee[0]-ce,Ve=Ee[1]-ae,Oe=Ee[2]-Ee[0]-ee,ke=Ee[3]-Ee[1]-xe}const Ce=(Ee,De,Pe,we)=>{const He=hl(Ee.stretch-ce,ee,x,i.left),je=pl(Ee.fixed-ye,Oe,Ee.stretch,L),ht=hl(De.stretch-ae,xe,T,i.top),Ot=pl(De.fixed-Ve,ke,De.stretch,Z),Zt=hl(Pe.stretch-ce,ee,x,i.left),ni=pl(Pe.fixed-ye,Oe,Pe.stretch,L),ar=hl(we.stretch-ae,xe,T,i.top),yi=pl(we.fixed-Ve,ke,we.stretch,Z),ei=new Xe(He,ht),ui=new Xe(Zt,ht),xi=new Xe(Zt,ar),Ei=new Xe(He,ar),Ni=new Xe(je/d,Ot/d),ti=new Xe(ni/d,yi/d),vi=e*Math.PI/180;if(vi){const Gi=Math.sin(vi),qi=Math.cos(vi),jt=[qi,-Gi,Gi,qi];ei._matMult(jt),ui._matMult(jt),Ei._matMult(jt),xi._matMult(jt)}const Si=Ee.stretch+Ee.fixed,Li=De.stretch+De.fixed;return{tl:ei,tr:ui,bl:Ei,br:xi,tex:{x:h.paddedRect.x+1+Si,y:h.paddedRect.y+1+Li,w:Pe.stretch+Pe.fixed-Si,h:we.stretch+we.fixed-Li},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Ni,pixelOffsetBR:ti,minFontScaleX:Oe/d/x,minFontScaleY:ke/d/T,isSDF:r}};if(o&&(h.stretchX||h.stretchY)){const Ee=th(I,q,L),De=th(P,re,Z);for(let Pe=0;Pe<Ee.length-1;Pe++){const we=Ee[Pe],He=Ee[Pe+1];for(let je=0;je<De.length-1;je++)c.push(Ce(we,De[je],He,De[je+1]))}}else c.push(Ce({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:m+1},{fixed:0,stretch:g+1}));return c}function ul(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 th(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 hl(i,e,r,o){return i/e*r+o}function pl(i,e,r,o){return i-e*r/o}$e("Anchor",Nn);class dl{constructor(e,r,o,c,h,d,m,g,x,T){if(this.boxStartIndex=e.length,x){let I=d.top,P=d.bottom;const D=d.collisionPadding;D&&(I-=D[1],P+=D[3]);let L=P-I;L>0&&(L=Math.max(10,L),this.circleDiameter=L)}else{let I=d.top*m-g[0],P=d.bottom*m+g[2],D=d.left*m-g[3],L=d.right*m+g[1];const Z=d.collisionPadding;if(Z&&(D-=Z[0]*m,I-=Z[1]*m,L+=Z[2]*m,P+=Z[3]*m),T){const q=new Xe(D,I),re=new Xe(L,I),ce=new Xe(D,P),ee=new Xe(L,P),ae=T*Math.PI/180;q._rotate(ae),re._rotate(ae),ce._rotate(ae),ee._rotate(ae),D=Math.min(q.x,re.x,ce.x,ee.x),L=Math.max(q.x,re.x,ce.x,ee.x),I=Math.min(q.y,re.y,ce.y,ee.y),P=Math.max(q.y,re.y,ce.y,ee.y)}e.emplaceBack(r.x,r.y,D,I,L,P,o,c,h)}this.boxEndIndex=e.length}}class Jd{constructor(e=[],r=Yd){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 Yd(i,e){return i<e?-1:i>e?1:0}function Qd(i,e=1,r=!1){let o=1/0,c=1/0,h=-1/0,d=-1/0;const m=i[0];for(let D=0;D<m.length;D++){const L=m[D];(!D||L.x<o)&&(o=L.x),(!D||L.y<c)&&(c=L.y),(!D||L.x>h)&&(h=L.x),(!D||L.y>d)&&(d=L.y)}const g=Math.min(h-o,d-c);let x=g/2;const T=new Jd([],ef);if(g===0)return new Xe(o,c);for(let D=o;D<h;D+=g)for(let L=c;L<d;L+=g)T.push(new rs(D+x,L+x,x,i));let I=function(D){let L=0,Z=0,q=0;const re=D[0];for(let ce=0,ee=re.length,ae=ee-1;ce<ee;ae=ce++){const xe=re[ce],ye=re[ae],Oe=xe.x*ye.y-ye.x*xe.y;Z+=(xe.x+ye.x)*Oe,q+=(xe.y+ye.y)*Oe,L+=3*Oe}return new rs(Z/L,q/L,0,D)}(i),P=T.length;for(;T.length;){const D=T.pop();(D.d>I.d||!I.d)&&(I=D,r&&console.log("found best %d after %d probes",Math.round(1e4*D.d)/1e4,P)),D.max-I.d<=e||(x=D.h/2,T.push(new rs(D.p.x-x,D.p.y-x,x,i)),T.push(new rs(D.p.x+x,D.p.y-x,x,i)),T.push(new rs(D.p.x-x,D.p.y+x,x,i)),T.push(new rs(D.p.x+x,D.p.y+x,x,i)),P+=4)}return r&&(console.log(`num probes: ${P}`),console.log(`best distance: ${I.d}`)),I.p}function ef(i,e){return e.max-i.max}function rs(i,e,r,o){this.p=new Xe(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 T=0,I=x.length,P=I-1;T<I;P=T++){const D=x[T],L=x[P];D.y>c.y!=L.y>c.y&&c.x<(L.x-D.x)*(c.y-D.y)/(L.y-D.y)+D.x&&(d=!d),m=Math.min(m,cu(c,D,L))}}return(d?1:-1)*Math.sqrt(m)}(this.p,o),this.max=this.d+this.h*Math.SQRT2}const xc=Number.POSITIVE_INFINITY;function ih(i,e){return e[1]!==xc?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 vc(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 tf(i,e,r,o,c,h,d,m,g,x,T){let I=h.textMaxSize.evaluate(e,{});I===void 0&&(I=d);const P=i.layers[0].layout,D=P.get("icon-offset").evaluate(e,{},T),L=nh(r.horizontal),Z=d/24,q=i.tilePixelRatio*Z,re=i.tilePixelRatio*I/24,ce=i.tilePixelRatio*m,ee=i.tilePixelRatio*P.get("symbol-spacing"),ae=P.get("text-padding")*i.tilePixelRatio,xe=function(we,He,je,ht=1){const Ot=we.get("icon-padding").evaluate(He,{},je),Zt=Ot&&Ot.values;return[Zt[0]*ht,Zt[1]*ht,Zt[2]*ht,Zt[3]*ht]}(P,e,T,i.tilePixelRatio),ye=P.get("text-max-angle")/180*Math.PI,Oe=P.get("text-rotation-alignment")!=="viewport"&&P.get("symbol-placement")!=="point",Ve=P.get("icon-rotation-alignment")==="map"&&P.get("symbol-placement")!=="point",ke=P.get("symbol-placement"),Ce=ee/2,Ee=P.get("icon-text-fit");let De;o&&Ee!=="none"&&(i.allowVerticalPlacement&&r.vertical&&(De=ju(o,r.vertical,Ee,P.get("icon-text-fit-padding"),D,Z)),L&&(o=ju(o,L,Ee,P.get("icon-text-fit-padding"),D,Z)));const Pe=(we,He)=>{He.x<0||He.x>=ri||He.y<0||He.y>=ri||function(je,ht,Ot,Zt,ni,ar,yi,ei,ui,xi,Ei,Ni,ti,vi,Si,Li,Gi,qi,jt,hi,ft,er,bi,Ii,yr){const Pr=je.addToLineVertexArray(ht,Ot);let zr,dn,xr,lr,Zi=0,fn=0,ta=0,vh=0,Pc=-1,zc=-1;const mn={};let bh=ci.exports(""),kc=0,Dc=0;if(ei._unevaluatedLayout.getValue("text-radial-offset")===void 0?[kc,Dc]=ei.layout.get("text-offset").evaluate(ft,{},Ii).map(ji=>ji*gi):(kc=ei.layout.get("text-radial-offset").evaluate(ft,{},Ii)*gi,Dc=xc),je.allowVerticalPlacement&&Zt.vertical){const ji=ei.layout.get("text-rotate").evaluate(ft,{},Ii)+90;xr=new dl(ui,ht,xi,Ei,Ni,Zt.vertical,ti,vi,Si,ji),yi&&(lr=new dl(ui,ht,xi,Ei,Ni,yi,Gi,qi,Si,ji))}if(ni){const ji=ei.layout.get("icon-rotate").evaluate(ft,{}),Hr=ei.layout.get("icon-text-fit")!=="none",ia=eh(ni,ji,bi,Hr),ra=yi?eh(yi,ji,bi,Hr):void 0;dn=new dl(ui,ht,xi,Ei,Ni,ni,Gi,qi,!1,ji),Zi=4*ia.length;const Eh=je.iconSizeData;let So=null;Eh.kind==="source"?(So=[pn*ei.layout.get("icon-size").evaluate(ft,{})],So[0]>Gn&&at(`${je.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)):Eh.kind==="composite"&&(So=[pn*er.compositeIconSizes[0].evaluate(ft,{},Ii),pn*er.compositeIconSizes[1].evaluate(ft,{},Ii)],(So[0]>Gn||So[1]>Gn)&&at(`${je.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),je.addSymbols(je.icon,ia,So,hi,jt,ft,a.WritingMode.none,ht,Pr.lineStartIndex,Pr.lineLength,-1,Ii),Pc=je.icon.placedSymbolArray.length-1,ra&&(fn=4*ra.length,je.addSymbols(je.icon,ra,So,hi,jt,ft,a.WritingMode.vertical,ht,Pr.lineStartIndex,Pr.lineLength,-1,Ii),zc=je.icon.placedSymbolArray.length-1)}const wh=Object.keys(Zt.horizontal);for(const ji of wh){const Hr=Zt.horizontal[ji];if(!zr){bh=ci.exports(Hr.text);const ra=ei.layout.get("text-rotate").evaluate(ft,{},Ii);zr=new dl(ui,ht,xi,Ei,Ni,Hr,ti,vi,Si,ra)}const ia=Hr.positionedLines.length===1;if(ta+=rh(je,ht,Hr,ar,ei,Si,ft,Li,Pr,Zt.vertical?a.WritingMode.horizontal:a.WritingMode.horizontalOnly,ia?wh:[ji],mn,Pc,er,Ii),ia)break}Zt.vertical&&(vh+=rh(je,ht,Zt.vertical,ar,ei,Si,ft,Li,Pr,a.WritingMode.vertical,["vertical"],mn,zc,er,Ii));const mf=zr?zr.boxStartIndex:je.collisionBoxArray.length,gf=zr?zr.boxEndIndex:je.collisionBoxArray.length,_f=xr?xr.boxStartIndex:je.collisionBoxArray.length,yf=xr?xr.boxEndIndex:je.collisionBoxArray.length,xf=dn?dn.boxStartIndex:je.collisionBoxArray.length,vf=dn?dn.boxEndIndex:je.collisionBoxArray.length,bf=lr?lr.boxStartIndex:je.collisionBoxArray.length,wf=lr?lr.boxEndIndex:je.collisionBoxArray.length;let kr=-1;const yl=(ji,Hr)=>ji&&ji.circleDiameter?Math.max(ji.circleDiameter,Hr):Hr;kr=yl(zr,kr),kr=yl(xr,kr),kr=yl(dn,kr),kr=yl(lr,kr);const Th=kr>-1?1:0;Th&&(kr*=yr/gi),je.glyphOffsetArray.length>=ns.MAX_GLYPHS&&at("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),ft.sortKey!==void 0&&je.addToSortKeyRanges(je.symbolInstances.length,ft.sortKey),je.symbolInstances.emplaceBack(ht.x,ht.y,mn.right>=0?mn.right:-1,mn.center>=0?mn.center:-1,mn.left>=0?mn.left:-1,mn.vertical||-1,Pc,zc,bh,mf,gf,_f,yf,xf,vf,bf,wf,xi,ta,vh,Zi,fn,Th,0,ti,kc,Dc,kr)}(i,He,we,r,o,c,De,i.layers[0],i.collisionBoxArray,e.index,e.sourceLayerIndex,i.index,q,[ae,ae,ae,ae],Oe,g,ce,xe,Ve,D,e,h,x,T,d)};if(ke==="line")for(const we of Qu(e.geometry,0,0,ri,ri)){const He=Kd(we,ee,ye,r.vertical||L,o,24,re,i.overscaling,ri);for(const je of He){const ht=L;ht&&rf(i,ht.text,Ce,je)||Pe(we,je)}}else if(ke==="line-center"){for(const we of e.geometry)if(we.length>1){const He=Hd(we,ye,r.vertical||L,o,24,re);He&&Pe(we,He)}}else if(e.type==="Polygon")for(const we of ac(e.geometry,0)){const He=Qd(we,16);Pe(we[0],new Nn(He.x,He.y,0))}else if(e.type==="LineString")for(const we of e.geometry)Pe(we,new Nn(we[0].x,we[0].y,0));else if(e.type==="Point")for(const we of e.geometry)for(const He of we)Pe([He],new Nn(He.x,He.y,0))}const Gn=32640;function rh(i,e,r,o,c,h,d,m,g,x,T,I,P,D,L){const Z=function(ce,ee,ae,xe,ye,Oe,Ve,ke){const Ce=xe.layout.get("text-rotate").evaluate(Oe,{})*Math.PI/180,Ee=[];for(const De of ee.positionedLines)for(const Pe of De.positionedGlyphs){if(!Pe.rect)continue;const we=Pe.rect||{};let He=4,je=!0,ht=1,Ot=0;const Zt=(ye||ke)&&Pe.vertical,ni=Pe.metrics.advance*Pe.scale/2;if(ke&&ee.verticalizable){const jt=(Pe.scale-1)*gi,hi=(gi-Pe.metrics.width*Pe.scale)/2;Ot=De.lineOffset/2-(Pe.imageName?-hi:jt)}if(Pe.imageName){const jt=Ve[Pe.imageName];je=jt.sdf,ht=jt.pixelRatio,He=1/ht}const ar=ye?[Pe.x+ni,Pe.y]:[0,0];let yi=ye?[0,0]:[Pe.x+ni+ae[0],Pe.y+ae[1]-Ot],ei=[0,0];Zt&&(ei=yi,yi=[0,0]);const ui=(Pe.metrics.left-He)*Pe.scale-ni+yi[0],xi=(-Pe.metrics.top-He)*Pe.scale+yi[1],Ei=ui+we.w*Pe.scale/ht,Ni=xi+we.h*Pe.scale/ht,ti=new Xe(ui,xi),vi=new Xe(Ei,xi),Si=new Xe(ui,Ni),Li=new Xe(Ei,Ni);if(Zt){const jt=new Xe(-ni,ni-al),hi=-Math.PI/2,ft=12-ni,er=new Xe(22-ft,-(Pe.imageName?ft:0)),bi=new Xe(...ei);ti._rotateAround(hi,jt)._add(er)._add(bi),vi._rotateAround(hi,jt)._add(er)._add(bi),Si._rotateAround(hi,jt)._add(er)._add(bi),Li._rotateAround(hi,jt)._add(er)._add(bi)}if(Ce){const jt=Math.sin(Ce),hi=Math.cos(Ce),ft=[hi,-jt,jt,hi];ti._matMult(ft),vi._matMult(ft),Si._matMult(ft),Li._matMult(ft)}const Gi=new Xe(0,0),qi=new Xe(0,0);Ee.push({tl:ti,tr:vi,bl:Si,br:Li,tex:we,writingMode:ee.writingMode,glyphOffset:ar,sectionIndex:Pe.sectionIndex,isSDF:je,pixelOffsetTL:Gi,pixelOffsetBR:qi,minFontScaleX:0,minFontScaleY:0})}return Ee}(0,r,m,c,h,d,o,i.allowVerticalPlacement),q=i.textSizeData;let re=null;q.kind==="source"?(re=[pn*c.layout.get("text-size").evaluate(d,{})],re[0]>Gn&&at(`${i.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)):q.kind==="composite"&&(re=[pn*D.compositeTextSizes[0].evaluate(d,{},L),pn*D.compositeTextSizes[1].evaluate(d,{},L)],(re[0]>Gn||re[1]>Gn)&&at(`${i.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),i.addSymbols(i.text,Z,re,m,h,d,x,e,g.lineStartIndex,g.lineLength,P,L);for(const ce of T)I[ce]=i.text.placedSymbolArray.length-1;return 4*Z.length}function nh(i){for(const e in i)return i[e];return null}function rf(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 nf=Un.VectorTileFeature.types,of=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function fl(i,e,r,o,c,h,d,m,g,x,T,I,P){const D=m?Math.min(Gn,Math.round(m[0])):0,L=m?Math.min(Gn,Math.round(m[1])):0;i.emplaceBack(e,r,Math.round(32*o),Math.round(32*c),h,d,(D<<1)+(g?1:0),L,16*x,16*T,256*I,256*P)}function bc(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 sf(i){for(const e of i.sections)if(Ga(e.text))return!0;return!1}class wc{constructor(e){this.layoutVertexArray=new gr,this.indexArray=new zi,this.programConfigurations=e,this.segments=new dt,this.dynamicLayoutVertexArray=new nr,this.opacityVertexArray=new _r,this.placedSymbolArray=new be}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,Ad.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,r),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,Md.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,of,!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())}}$e("SymbolBuffers",wc);class Tc{constructor(e,r,o){this.layoutVertexArray=new e,this.layoutAttributes=r,this.indexArray=new o,this.segments=new dt,this.collisionVertexArray=new Yi}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,Pd.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}$e("CollisionBuffers",Tc);class ns{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=tc([]),this.placementViewportMatrix=tc([]);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=Sc(o,"text-overlap","text-allow-overlap")!=="never"||Sc(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=>a.WritingMode[d])),this.stateDependentLayerIds=this.layers.filter(d=>d.isStateDependent()).map(d=>d.id),this.sourceID=e.sourceID}createArrays(){this.text=new wc(new vo(this.layers,this.zoom,e=>/^text/.test(e))),this.icon=new wc(new vo(this.layers,this.zoom,e=>/^icon/.test(e))),this.glyphOffsetArray=new Ie,this.lineVertexArray=new Fe,this.symbolInstances=new Re}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=Js[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 W&&!m.value.value.isEmpty()||m.value.value.toString().length>0)&&(d.value.kind!=="constant"||d.value.value.length>0),T=g.value.kind!=="constant"||!!g.value.value||Object.keys(g.parameters).length>0,I=h.get("symbol-sort-key");if(this.features=[],!x&&!T)return;const P=r.iconDependencies,D=r.glyphDependencies,L=r.availableImages,Z=new Gt(this.zoom);for(const{feature:q,id:re,index:ce,sourceLayerIndex:ee}of e){const ae=c._featureFilter.needGeometry,xe=wo(q,ae);if(!c._featureFilter.filter(Z,xe,o))continue;let ye,Oe;if(ae||(xe.geometry=bo(q)),x){const ke=c.getValueAndResolveTokens("text-field",xe,o,L),Ce=W.factory(ke);sf(Ce)&&(this.hasRTLText=!0),(!this.hasRTLText||_o()==="unavailable"||this.hasRTLText&&Ji.isParsed())&&(ye=kd(Ce,c,xe))}if(T){const ke=c.getValueAndResolveTokens("icon-image",xe,o,L);Oe=ke instanceof J?ke:J.fromString(ke)}if(!ye&&!Oe)continue;const Ve=this.sortFeaturesByKey?I.evaluate(xe,{},o):void 0;if(this.features.push({id:re,text:ye,icon:Oe,index:ce,sourceLayerIndex:ee,geometry:xe.geometry,properties:q.properties,type:nf[q.type],sortKey:Ve}),Oe&&(P[Oe.name]=!0),ye){const ke=d.evaluate(xe,{},o).join(","),Ce=h.get("text-rotation-alignment")!=="viewport"&&h.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(a.WritingMode.vertical)>=0;for(const Ee of ye.sections)if(Ee.image)P[Ee.image.name]=!0;else{const De=jo(ye.toString()),Pe=Ee.fontStack||ke,we=D[Pe]=D[Pe]||{};this.calculateGlyphDependencies(Ee.text,we,Ce,this.allowVerticalPlacement,De)}}}h.get("symbol-placement")==="line"&&(this.features=function(q){const re={},ce={},ee=[];let ae=0;function xe(ke){ee.push(q[ke]),ae++}function ye(ke,Ce,Ee){const De=ce[ke];return delete ce[ke],ce[Ce]=De,ee[De].geometry[0].pop(),ee[De].geometry[0]=ee[De].geometry[0].concat(Ee[0]),De}function Oe(ke,Ce,Ee){const De=re[Ce];return delete re[Ce],re[ke]=De,ee[De].geometry[0].shift(),ee[De].geometry[0]=Ee[0].concat(ee[De].geometry[0]),De}function Ve(ke,Ce,Ee){const De=Ee?Ce[0][Ce[0].length-1]:Ce[0][0];return`${ke}:${De.x}:${De.y}`}for(let ke=0;ke<q.length;ke++){const Ce=q[ke],Ee=Ce.geometry,De=Ce.text?Ce.text.toString():null;if(!De){xe(ke);continue}const Pe=Ve(De,Ee),we=Ve(De,Ee,!0);if(Pe in ce&&we in re&&ce[Pe]!==re[we]){const He=Oe(Pe,we,Ee),je=ye(Pe,we,ee[He].geometry);delete re[Pe],delete ce[we],ce[Ve(De,ee[je].geometry,!0)]=je,ee[He].geometry=null}else Pe in ce?ye(Pe,we,Ee):we in re?Oe(Pe,we,Ee):(xe(ke),re[Pe]=ae-1,ce[we]=ae-1)}return ee.filter(ke=>ke.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((q,re)=>q.sortKey-re.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,T,I,P){const D=e.indexArray,L=e.layoutVertexArray,Z=e.segments.prepareSegment(4*r.length,L,D,this.canOverlap?d.sortKey:void 0),q=this.glyphOffsetArray.length,re=Z.vertexLength,ce=this.allowVerticalPlacement&&m===a.WritingMode.vertical?Math.PI/2:0,ee=d.text&&d.text.sections;for(let ae=0;ae<r.length;ae++){const{tl:xe,tr:ye,bl:Oe,br:Ve,tex:ke,pixelOffsetTL:Ce,pixelOffsetBR:Ee,minFontScaleX:De,minFontScaleY:Pe,glyphOffset:we,isSDF:He,sectionIndex:je}=r[ae],ht=Z.vertexLength,Ot=we[1];fl(L,g.x,g.y,xe.x,Ot+xe.y,ke.x,ke.y,o,He,Ce.x,Ce.y,De,Pe),fl(L,g.x,g.y,ye.x,Ot+ye.y,ke.x+ke.w,ke.y,o,He,Ee.x,Ce.y,De,Pe),fl(L,g.x,g.y,Oe.x,Ot+Oe.y,ke.x,ke.y+ke.h,o,He,Ce.x,Ee.y,De,Pe),fl(L,g.x,g.y,Ve.x,Ot+Ve.y,ke.x+ke.w,ke.y+ke.h,o,He,Ee.x,Ee.y,De,Pe),bc(e.dynamicLayoutVertexArray,g,ce),D.emplaceBack(ht,ht+1,ht+2),D.emplaceBack(ht+1,ht+2,ht+3),Z.vertexLength+=4,Z.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(we[0]),ae!==r.length-1&&je===r[ae+1].sectionIndex||e.programConfigurations.populatePaintArrays(L.length,d,d.index,{},P,ee&&ee[je])}e.placedSymbolArray.emplaceBack(g.x,g.y,q,this.glyphOffsetArray.length-q,re,x,T,g.segment,o?o[0]:0,o?o[1]:0,c[0],c[1],m,0,!1,0,I)}_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,T=h.layoutVertexArray,I=h.collisionVertexArray,P=m.anchorX,D=m.anchorY;this._addCollisionDebugVertex(T,I,d,P,D,new Xe(e,r)),this._addCollisionDebugVertex(T,I,d,P,D,new Xe(o,r)),this._addCollisionDebugVertex(T,I,d,P,D,new Xe(o,c)),this._addCollisionDebugVertex(T,I,d,P,D,new Xe(e,c)),g.vertexLength+=4;const L=h.indexArray;L.emplaceBack(x,x+1),L.emplaceBack(x+1,x+2),L.emplaceBack(x+2,x+3),L.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 Tc(Xr,Du.members,Ar),this.iconCollisionBox=new Tc(Xr,Du.members,Ar);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 T={};for(let I=r;I<o;I++){const P=e.get(I);T.textBox={x1:P.x1,y1:P.y1,x2:P.x2,y2:P.y2,anchorPointX:P.anchorPointX,anchorPointY:P.anchorPointY},T.textFeatureIndex=P.featureIndex;break}for(let I=c;I<h;I++){const P=e.get(I);T.verticalTextBox={x1:P.x1,y1:P.y1,x2:P.x2,y2:P.y2,anchorPointX:P.anchorPointX,anchorPointY:P.anchorPointY},T.verticalTextFeatureIndex=P.featureIndex;break}for(let I=d;I<m;I++){const P=e.get(I);T.iconBox={x1:P.x1,y1:P.y1,x2:P.x2,y2:P.y2,anchorPointX:P.anchorPointX,anchorPointY:P.anchorPointY},T.iconFeatureIndex=P.featureIndex;break}for(let I=g;I<x;I++){const P=e.get(I);T.verticalIconBox={x1:P.x1,y1:P.y1,x2:P.x2,y2:P.y2,anchorPointX:P.anchorPointX,anchorPointY:P.anchorPointY},T.verticalIconFeatureIndex=P.featureIndex;break}return T}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)}}}$e("SymbolBucket",ns,{omit:["layers","collisionBoxArray","features","compareText"]}),ns.MAX_GLYPHS=65535,ns.addDynamicAttributes=bc;const af=new mi({"symbol-placement":new Ze(_e.layout_symbol["symbol-placement"]),"symbol-spacing":new Ze(_e.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Ze(_e.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Je(_e.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Ze(_e.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Ze(_e.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Ze(_e.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Ze(_e.layout_symbol["icon-ignore-placement"]),"icon-optional":new Ze(_e.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Ze(_e.layout_symbol["icon-rotation-alignment"]),"icon-size":new Je(_e.layout_symbol["icon-size"]),"icon-text-fit":new Ze(_e.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Ze(_e.layout_symbol["icon-text-fit-padding"]),"icon-image":new Je(_e.layout_symbol["icon-image"]),"icon-rotate":new Je(_e.layout_symbol["icon-rotate"]),"icon-padding":new Je(_e.layout_symbol["icon-padding"]),"icon-keep-upright":new Ze(_e.layout_symbol["icon-keep-upright"]),"icon-offset":new Je(_e.layout_symbol["icon-offset"]),"icon-anchor":new Je(_e.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Ze(_e.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Ze(_e.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Ze(_e.layout_symbol["text-rotation-alignment"]),"text-field":new Je(_e.layout_symbol["text-field"]),"text-font":new Je(_e.layout_symbol["text-font"]),"text-size":new Je(_e.layout_symbol["text-size"]),"text-max-width":new Je(_e.layout_symbol["text-max-width"]),"text-line-height":new Ze(_e.layout_symbol["text-line-height"]),"text-letter-spacing":new Je(_e.layout_symbol["text-letter-spacing"]),"text-justify":new Je(_e.layout_symbol["text-justify"]),"text-radial-offset":new Je(_e.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Ze(_e.layout_symbol["text-variable-anchor"]),"text-anchor":new Je(_e.layout_symbol["text-anchor"]),"text-max-angle":new Ze(_e.layout_symbol["text-max-angle"]),"text-writing-mode":new Ze(_e.layout_symbol["text-writing-mode"]),"text-rotate":new Je(_e.layout_symbol["text-rotate"]),"text-padding":new Ze(_e.layout_symbol["text-padding"]),"text-keep-upright":new Ze(_e.layout_symbol["text-keep-upright"]),"text-transform":new Je(_e.layout_symbol["text-transform"]),"text-offset":new Je(_e.layout_symbol["text-offset"]),"text-allow-overlap":new Ze(_e.layout_symbol["text-allow-overlap"]),"text-overlap":new Ze(_e.layout_symbol["text-overlap"]),"text-ignore-placement":new Ze(_e.layout_symbol["text-ignore-placement"]),"text-optional":new Ze(_e.layout_symbol["text-optional"])});var Ec={paint:new mi({"icon-opacity":new Je(_e.paint_symbol["icon-opacity"]),"icon-color":new Je(_e.paint_symbol["icon-color"]),"icon-halo-color":new Je(_e.paint_symbol["icon-halo-color"]),"icon-halo-width":new Je(_e.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Je(_e.paint_symbol["icon-halo-blur"]),"icon-translate":new Ze(_e.paint_symbol["icon-translate"]),"icon-translate-anchor":new Ze(_e.paint_symbol["icon-translate-anchor"]),"text-opacity":new Je(_e.paint_symbol["text-opacity"]),"text-color":new Je(_e.paint_symbol["text-color"],{runtimeType:fi,getOverride:i=>i.textColor,hasOverride:i=>!!i.textColor}),"text-halo-color":new Je(_e.paint_symbol["text-halo-color"]),"text-halo-width":new Je(_e.paint_symbol["text-halo-width"]),"text-halo-blur":new Je(_e.paint_symbol["text-halo-blur"]),"text-translate":new Ze(_e.paint_symbol["text-translate"]),"text-translate-anchor":new Ze(_e.paint_symbol["text-translate-anchor"])}),layout:af};class oh{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:$r,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}}$e("FormatSectionOverride",oh,{omit:["defaultValue"]});class ml extends mr{constructor(e){super(e,Ec)}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()||ro(d.value)||!h?h:function(m,g){return g.replace(/{([^{}]+)}/g,(x,T)=>T in m?String(m[T]):"")}(r.properties,h)}createBucket(e){return new ns(e)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const e of Ec.paint.overridableProperties){if(!ml.hasPaintOverride(this.layout,e))continue;const r=this.paint.get(e),o=new oh(r),c=new Uo(o,r.property.specification);let h=null;h=r.value.kind==="constant"||r.value.kind==="source"?new oo("source",c):new Ss("composite",c,r.value.zoomStops),this.paint._values[e]=new fr(r.property,h,r.parameters)}}_handleOverridablePaintPropertyUpdate(e,r,o){return!(!this.layout||r.isDataDriven()||o.isDataDriven())&&ml.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,r){const o=e.get("text-field"),c=Ec.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 W)d(o.value.value.sections);else if(o.value.kind==="source"){const m=x=>{h||(x instanceof qe&&he(x.value)===oi?d(x.value.sections):x instanceof Oo?d(x.sections):x.eachChild(m))},g=o.value;g._styleExpression&&m(g._styleExpression.expression)}return h}}function Sc(i,e,r){let o="never";const c=i.get(e);return c?o=c:i.get(r)&&(o="always"),o}var lf={paint:new mi({"background-color":new Ze(_e.paint_background["background-color"]),"background-pattern":new Fs(_e.paint_background["background-pattern"]),"background-opacity":new Ze(_e.paint_background["background-opacity"])})},cf={paint:new mi({"raster-opacity":new Ze(_e.paint_raster["raster-opacity"]),"raster-hue-rotate":new Ze(_e.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Ze(_e.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Ze(_e.paint_raster["raster-brightness-max"]),"raster-saturation":new Ze(_e.paint_raster["raster-saturation"]),"raster-contrast":new Ze(_e.paint_raster["raster-contrast"]),"raster-resampling":new Ze(_e.paint_raster["raster-resampling"]),"raster-fade-duration":new Ze(_e.paint_raster["raster-fade-duration"])})};class uf extends mr{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 hf={circle:class extends mr{constructor(i){super(i,Vp)}createBucket(i){return new Yl(i)}queryRadius(i){const e=i;return Ns("circle-radius",this,e)+Ns("circle-stroke-width",this,e)+Ya(this.paint.get("circle-translate"))}queryIntersectsFeature(i,e,r,o,c,h,d,m){const g=Qa(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),T=this.paint.get("circle-pitch-alignment")==="map",I=T?g:function(D,L){return D.map(Z=>gu(Z,L))}(g,m),P=T?x*d:x;for(const D of o)for(const L of D){const Z=T?L:gu(L,m);let q=P;const re=el([],[L.x,L.y,0,1],m);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?q*=re[3]/h.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(q*=h.cameraToCenterDistance/re[3]),Bp(I,Z,q))return!0}return!1}},heatmap:class extends mr{constructor(i){super(i,Gp),this._updateColorRamp()}createBucket(i){return new _u(i)}_handleSpecialPaintPropertyUpdate(i){i==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=xu({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 mr{constructor(i){super(i,qp)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}},fill:class extends mr{constructor(i){super(i,sd)}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 uc(i)}queryRadius(){return Ya(this.paint.get("fill-translate"))}queryIntersectsFeature(i,e,r,o,c,h,d){return lu(Qa(i,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),h.angle,d),o)}isTileClipped(){return!0}},"fill-extrusion":class extends mr{constructor(i){super(i,vd)}createBucket(i){return new pc(i)}queryRadius(){return Ya(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(i,e,r,o,c,h,d,m){const g=Qa(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),T=this.paint.get("fill-extrusion-base").evaluate(e,r),I=function(D,L,Z,q){const re=[];for(const ce of D){const ee=[ce.x,ce.y,0,1];el(ee,ee,L),re.push(new Xe(ee[0]/ee[3],ee[1]/ee[3]))}return re}(g,m),P=function(D,L,Z,q){const re=[],ce=[],ee=q[8]*L,ae=q[9]*L,xe=q[10]*L,ye=q[11]*L,Oe=q[8]*Z,Ve=q[9]*Z,ke=q[10]*Z,Ce=q[11]*Z;for(const Ee of D){const De=[],Pe=[];for(const we of Ee){const He=we.x,je=we.y,ht=q[0]*He+q[4]*je+q[12],Ot=q[1]*He+q[5]*je+q[13],Zt=q[2]*He+q[6]*je+q[14],ni=q[3]*He+q[7]*je+q[15],ar=Zt+xe,yi=ni+ye,ei=ht+Oe,ui=Ot+Ve,xi=Zt+ke,Ei=ni+Ce,Ni=new Xe((ht+ee)/yi,(Ot+ae)/yi);Ni.z=ar/yi,De.push(Ni);const ti=new Xe(ei/Ei,ui/Ei);ti.z=xi/Ei,Pe.push(ti)}re.push(De),ce.push(Pe)}return[re,ce]}(o,T,x,m);return function(D,L,Z){let q=1/0;lu(Z,L)&&(q=Au(Z,L[0]));for(let re=0;re<L.length;re++){const ce=L[re],ee=D[re];for(let ae=0;ae<ce.length-1;ae++){const xe=ce[ae],ye=[xe,ce[ae+1],ee[ae+1],ee[ae],xe];au(Z,ye)&&(q=Math.min(q,Au(Z,ye)))}}return q!==1/0&&q}(P[0],P[1],I)}},line:class extends mr{constructor(i){super(i,Pu),this.gradientVersion=0}_handleSpecialPaintPropertyUpdate(i){i==="line-gradient"&&(this.stepInterpolant=this._transitionablePaint._values["line-gradient"].value.expression._styleExpression.expression instanceof Yn,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"]=zu.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,i)}createBucket(i){return new dc(i)}queryRadius(i){const e=i,r=ku(Ns("line-width",this,e),Ns("line-gap-width",this,e)),o=Ns("line-offset",this,e);return r/2+Math.abs(o)+Ya(this.paint.get("line-translate"))}queryIntersectsFeature(i,e,r,o,c,h,d){const m=Qa(i,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),h.angle,d),g=d/2*ku(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(T,I){const P=[];for(let D=0;D<T.length;D++){const L=T[D],Z=[];for(let q=0;q<L.length;q++){const re=L[q-1],ce=L[q],ee=L[q+1],ae=q===0?new Xe(0,0):ce.sub(re)._unit()._perp(),xe=q===L.length-1?new Xe(0,0):ee.sub(ce)._unit()._perp(),ye=ae._add(xe)._unit(),Oe=ye.x*xe.x+ye.y*xe.y;Oe!==0&&ye._mult(1/Oe),Z.push(ye._mult(I)._add(ce))}P.push(Z)}return P}(o,x*d)),function(T,I,P){for(let D=0;D<I.length;D++){const L=I[D];if(T.length>=3){for(let Z=0;Z<L.length;Z++)if(Jo(T,L[Z]))return!0}if(Fp(T,L,P))return!0}return!1}(m,o,g)}isTileClipped(){return!0}},symbol:ml,background:class extends mr{constructor(i){super(i,lf)}},raster:class extends mr{constructor(i){super(i,cf)}}};class pf{constructor(e){this._callback=e,this._triggered=!1,typeof MessageChannel!="undefined"&&(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 sh=63710088e-1;class Wt{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 Wt(Ge(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 sh*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 Eo(new Wt(this.lng-o,this.lat-r),new Wt(this.lng+o,this.lat+r))}static convert(e){if(e instanceof Wt)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new Wt(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e!==null)return new Wt(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 Eo{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 Wt?new Wt(e.lng,e.lat):Wt.convert(e),this}setSouthWest(e){return this._sw=e instanceof Wt?new Wt(e.lng,e.lat):Wt.convert(e),this}extend(e){const r=this._sw,o=this._ne;let c,h;if(e instanceof Wt)c=e,h=e;else{if(!(e instanceof Eo))return Array.isArray(e)?e.length===4||e.every(Array.isArray)?this.extend(Eo.convert(e)):this.extend(Wt.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 Wt(c.lng,c.lat),this._ne=new Wt(h.lng,h.lat)),this}getCenter(){return new Wt((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 Wt(this.getWest(),this.getNorth())}getSouthEast(){return new Wt(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}=Wt.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 Eo?e:e&&new Eo(e)}}const ah=2*Math.PI*sh;function lh(i){return ah*Math.cos(i*Math.PI/180)}function ch(i){return(180+i)/360}function uh(i){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i*Math.PI/360)))/360}function hh(i,e){return i/lh(e)}function Ic(i){return 360/Math.PI*Math.atan(Math.exp((180-360*i)*Math.PI/180))-90}class gl{constructor(e,r,o=0){this.x=+e,this.y=+r,this.z=+o}static fromLngLat(e,r=0){const o=Wt.convert(e);return new gl(ch(o.lng),uh(o.lat),hh(r,o.lat))}toLngLat(){return new Wt(360*this.x-180,Ic(this.y))}toAltitude(){return this.z*lh(Ic(this.y))}meterInMercatorCoordinateUnits(){return 1/ah*(e=Ic(this.y),1/Math.cos(e*Math.PI/180));var e}}function ph(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 Cc{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=Qs(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=ph(256*(h=this.x),256*(d=Math.pow(2,m)-d-1),m),x=ph(256*(h+1),256*(d+1),m),g[0]+","+g[1]+","+x[0]+","+x[1]);var h,d,m,g,x;const T=function(I,P,D){let L,Z="";for(let q=I;q>0;q--)L=1<<q-1,Z+=(P&L?1:0)+(D&L?2:0);return Z}(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,T).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 Xe((e.x*r-this.x)*ri,(e.y*r-this.y)*ri)}toString(){return`${this.z}/${this.x}/${this.y}`}}class dh{constructor(e,r){this.wrap=e,this.canonical=r,this.key=Qs(e,r.z,r.z,r.x,r.y)}}class sr{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 Cc(o,+c,+h),this.key=Qs(r,e,o,c,h)}clone(){return new sr(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 sr(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new sr(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?Qs(this.wrap*+r,e,this.canonical.z,this.canonical.x,this.canonical.y):Qs(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 sr(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 sr(r,this.wrap,r,o,c),new sr(r,this.wrap,r,o+1,c),new sr(r,this.wrap,r,o,c+1),new sr(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 sr(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new sr(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 dh(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(e){return this.canonical.getTilePoint(new gl(e.x-this.wrap,e.y))}}function Qs(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)}$e("CanonicalTileID",Cc),$e("OverscaledTileID",sr,{omit:["posMatrix"]});class fh{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 at(`"${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 or({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 T=d;T<m;T++)for(let I=c;I<h;I++)this.data[this._idx(I,T)]=e.data[this._idx(I+g,T+x)]}}$e("DEMData",fh);class mh{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 gh{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 _h{constructor(e,r){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new go(ri,16,0),this.grid3D=new go(ri,16,0),this.featureIndexArray=new ut,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 T=r[x],I=[1/0,1/0,-1/0,-1/0];for(let P=0;P<T.length;P++){const D=T[P];I[0]=Math.min(I[0],D.x),I[1]=Math.min(I[1],D.y),I[2]=Math.max(I[2],D.x),I[3]=Math.max(I[3],D.y)}I[0]<ri&&I[1]<ri&&I[2]>=0&&I[3]>=0&&g.insert(m,I[0],I[1],I[2],I[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new Un.VectorTile(new fc(this.rawTileData)).layers,this.sourceLayerCoder=new mh(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(e,r,o,c){this.loadVTLayers();const h=e.params||{},d=ri/e.tileSize/e.scale,m=Go(h.filter),g=e.queryGeometry,x=e.queryPadding*d,T=xh(g),I=this.grid.query(T.minX-x,T.minY-x,T.maxX+x,T.maxY+x),P=xh(e.cameraQueryGeometry),D=this.grid3D.query(P.minX-x,P.minY-x,P.maxX+x,P.maxY+x,(q,re,ce,ee)=>function(ae,xe,ye,Oe,Ve){for(const Ce of ae)if(xe<=Ce.x&&ye<=Ce.y&&Oe>=Ce.x&&Ve>=Ce.y)return!0;const ke=[new Xe(xe,ye),new Xe(xe,Ve),new Xe(Oe,Ve),new Xe(Oe,ye)];if(ae.length>2){for(const Ce of ke)if(Jo(ae,Ce))return!0}for(let Ce=0;Ce<ae.length-1;Ce++)if($p(ae[Ce],ae[Ce+1],ke))return!0;return!1}(e.cameraQueryGeometry,q-x,re-x,ce+x,ee+x));for(const q of D)I.push(q);I.sort(df);const L={};let Z;for(let q=0;q<I.length;q++){const re=I[q];if(re===Z)continue;Z=re;const ce=this.featureIndexArray.get(re);let ee=null;this.loadMatchingFeature(L,ce.bucketIndex,ce.sourceLayerIndex,ce.featureIndex,m,h.layers,h.availableImages,r,o,c,(ae,xe,ye)=>(ee||(ee=bo(ae)),xe.queryIntersectsFeature(g,ae,ye,ee,this.z,e.transform,d,e.pixelPosMatrix)))}return L}loadMatchingFeature(e,r,o,c,h,d,m,g,x,T,I){const P=this.bucketLayerIDs[r];if(d&&!function(q,re){for(let ce=0;ce<q.length;ce++)if(re.indexOf(q[ce])>=0)return!0;return!1}(d,P))return;const D=this.sourceLayerCoder.decode(o),L=this.vtLayers[D].feature(c);if(h.needGeometry){const q=wo(L,!0);if(!h.filter(new Gt(this.tileID.overscaledZ),q,this.tileID.canonical))return}else if(!h.filter(new Gt(this.tileID.overscaledZ),L))return;const Z=this.getId(L,D);for(let q=0;q<P.length;q++){const re=P[q];if(d&&d.indexOf(re)<0)continue;const ce=g[re];if(!ce)continue;let ee={};Z&&T&&(ee=T.getState(ce.sourceLayer||"_geojsonTileLayer",Z));const ae=Ne({},x[re]);ae.paint=yh(ae.paint,ce.paint,L,ee,m),ae.layout=yh(ae.layout,ce.layout,L,ee,m);const xe=!I||I(L,ce,ee);if(!xe)continue;const ye=new gh(L,this.z,this.x,this.y,Z);ye.layer=ae;let Oe=e[re];Oe===void 0&&(Oe=e[re]=[]),Oe.push({featureIndex:c,feature:ye,intersectionZ:xe})}}lookupSymbolFeatures(e,r,o,c,h,d,m,g){const x={};this.loadVTLayers();const T=Go(h);for(const I of e)this.loadMatchingFeature(x,o,c,I,T,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 yh(i,e,r,o,c){return Ye(i,(h,d)=>{const m=e instanceof xo?e.get(d):null;return m&&m.evaluate?m.evaluate(r,o,c):m})}function xh(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 df(i,e){return e-i}var Ac;$e("FeatureIndex",_h,{omit:["rawTileData","sourceLayerCoder"]}),a.PerformanceMarkers=void 0,(Ac=a.PerformanceMarkers||(a.PerformanceMarkers={})).create="create",Ac.load="load",Ac.fullLoad="fullLoad";let _l=null,ea=[];const Mc=1e3/30,ff={mark(i){performance.mark(i)},frame(i){const e=i;_l!=null&&ea.push(e-_l),_l=e},clearMetrics(){_l=null,ea=[],performance.clearMeasures("loadTime"),performance.clearMeasures("fullLoadTime");for(const i in a.PerformanceMarkers)performance.clearMarks(a.PerformanceMarkers[i])},getPerformanceMetrics(){performance.measure("loadTime",a.PerformanceMarkers.create,a.PerformanceMarkers.load),performance.measure("fullLoadTime",a.PerformanceMarkers.create,a.PerformanceMarkers.fullLoad);const i=performance.getEntriesByName("loadTime")[0].duration,e=performance.getEntriesByName("fullLoadTime")[0].duration,r=ea.length,o=1/(ea.reduce((h,d)=>h+d,0)/r/1e3),c=ea.filter(h=>h>Mc).reduce((h,d)=>h+(d-Mc)/Mc,0);return{loadTime:i,fullLoadTime:e,fps:o,percentDroppedFrames:c/(r+c)*100}}};a.AJAXError=Bi,a.ARRAY_TYPE=Di,a.Actor=class{constructor(i,e,r){this.target=i,this.parent=e,this.mapId=r,this.callbacks={},this.tasks={},this.taskQueue=[],this.cancelCallbacks={},tt(["receive","process"],this),this.invoker=new pf(this.process),this.target.addEventListener("message",this.receive,!1),this.globalScope=Jt()?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=Rt(this.globalScope)?void 0:[];return this.target.postMessage({id:h,type:i,hasCallback:!!r,targetMapId:o,mustQueue:c,sourceMapId:this.mapId,data:on(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 Jt()||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(Nr(e.error)):r(null,Nr(e.data)))}else{let r=!1;const o=Rt(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?on(m):null,data:on(g,o)},o)}:m=>{r=!0};let h=null;const d=Nr(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)}},a.AlphaImage=qs,a.CanonicalTileID=Cc,a.CollisionBoxArray=me,a.CollisionCircleLayoutArray=class extends S{},a.Color=B,a.DEMData=fh,a.DataConstantProperty=Ze,a.DictionaryCoder=mh,a.EXTENT=ri,a.ErrorEvent=wn,a.EvaluationParameters=Gt,a.Event=Tr,a.Evented=Er,a.FeatureIndex=_h,a.FillBucket=uc,a.FillExtrusionBucket=pc,a.GeoJSONFeature=gh,a.ImageAtlas=Vu,a.ImagePosition=gc,a.LineBucket=dc,a.LineStripIndexArray=class extends G{},a.LngLat=Wt,a.LngLatBounds=Eo,a.MercatorCoordinate=gl,a.ONE_EM=gi,a.OverscaledTileID=sr,a.PerformanceUtils=ff,a.PosArray=We,a.Properties=mi,a.QuadTriangleArray=class extends z{},a.RGBAImage=or,a.RasterBoundsArray=class extends l{},a.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}},a.ResourceType=br,a.SegmentVector=dt,a.SymbolBucket=ns,a.Transitionable=ja,a.TriangleIndexArray=zi,a.Uniform1f=cn,a.Uniform1i=class extends ln{constructor(i,e){super(i,e),this.current=0}set(i){this.current!==i&&(this.current=i,this.gl.uniform1i(this.location,i))}},a.Uniform2f=class extends ln{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]))}},a.Uniform3f=class extends ln{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]))}},a.Uniform4f=Ho,a.UniformColor=ru,a.UniformMatrix4f=class extends ln{constructor(i,e){super(i,e),this.current=Lp}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}}},a.UnwrappedTileID=dh,a.ValidationError=Me,a.ZoomHistory=Ms,a.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},a.addDynamicAttributes=bc,a.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)})})},a.bezier=fe,a.bindAll=tt,a.cacheEntryPossiblyAdded=function(i){hr++,hr>_n&&(i.getActor().send("enforceCacheSizeLimit",gn),hr=0)},a.clamp=ie,a.clearTileCache=function(i){const e=caches.delete(Ci);i&&e.catch(i).then(()=>i())},a.clipLine=Qu,a.clone=function(i){var e=new Di(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},a.clone$1=pt,a.clone$2=function(i){var e=new Di(3);return e[0]=i[0],e[1]=i[1],e[2]=i[2],e},a.collisionCircleLayout=zd,a.config=wi,a.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},a.create=function(){var i=new Di(16);return Di!=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},a.create$1=hu,a.createExpression=no,a.createFilter=Go,a.createLayout=Qt,a.createStyleLayer=function(i){return i.type==="custom"?new uf(i):new hf[i.type](i)},a.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},a.dot=function(i,e){return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]},a.dot$1=function(i,e){return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]+i[3]*e[3]},a.ease=ue,a.emitValidationErrors=Zo,a.enforceCacheSizeLimit=function(i){yn(),Ai&&Ai.then(e=>{e.keys().then(r=>{for(let o=0;o<r.length-i;o++)e.delete(r[o])})})},a.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],T=i[8],I=i[9],P=i[10],D=i[11],L=i[12],Z=i[13],q=i[14],re=i[15],ce=e[0],ee=e[1],ae=e[2],xe=e[3],ye=e[4],Oe=e[5],Ve=e[6],ke=e[7],Ce=e[8],Ee=e[9],De=e[10],Pe=e[11],we=e[12],He=e[13],je=e[14],ht=e[15];return Math.abs(r-ce)<=ki*Math.max(1,Math.abs(r),Math.abs(ce))&&Math.abs(o-ee)<=ki*Math.max(1,Math.abs(o),Math.abs(ee))&&Math.abs(c-ae)<=ki*Math.max(1,Math.abs(c),Math.abs(ae))&&Math.abs(h-xe)<=ki*Math.max(1,Math.abs(h),Math.abs(xe))&&Math.abs(d-ye)<=ki*Math.max(1,Math.abs(d),Math.abs(ye))&&Math.abs(m-Oe)<=ki*Math.max(1,Math.abs(m),Math.abs(Oe))&&Math.abs(g-Ve)<=ki*Math.max(1,Math.abs(g),Math.abs(Ve))&&Math.abs(x-ke)<=ki*Math.max(1,Math.abs(x),Math.abs(ke))&&Math.abs(T-Ce)<=ki*Math.max(1,Math.abs(T),Math.abs(Ce))&&Math.abs(I-Ee)<=ki*Math.max(1,Math.abs(I),Math.abs(Ee))&&Math.abs(P-De)<=ki*Math.max(1,Math.abs(P),Math.abs(De))&&Math.abs(D-Pe)<=ki*Math.max(1,Math.abs(D),Math.abs(Pe))&&Math.abs(L-we)<=ki*Math.max(1,Math.abs(L),Math.abs(we))&&Math.abs(Z-He)<=ki*Math.max(1,Math.abs(Z),Math.abs(He))&&Math.abs(q-je)<=ki*Math.max(1,Math.abs(q),Math.abs(je))&&Math.abs(re-ht)<=ki*Math.max(1,Math.abs(re),Math.abs(ht))},a.evaluateSizeForFeature=function(i,{uSize:e,uSizeT:r},{lowerSize:o,upperSize:c}){return i.kind==="source"?o/pn:i.kind==="composite"?Vt(o/pn,c/pn,r):e},a.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?ie($i.interpolationFactor(c,e,h,d),0,1):0;i.kind==="camera"?o=Vt(i.minSize,i.maxSize,m):r=m}return{uSizeT:r,uSize:o}},a.evaluateVariableOffset=ih,a.evented=Bs,a.exported=di,a.exported$1=Dr,a.extend=Ne,a.filterObject=Qe,a.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},a.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},a.getAnchorAlignment=yc,a.getAnchorJustification=vc,a.getArrayBuffer=bn,a.getImage=Or,a.getJSON=function(i,e){return vn(Ne(i,{type:"json"}),e)},a.getOverlapMode=Sc,a.getRTLTextPluginStatus=_o,a.getReferrer=Xn,a.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");Wn(i[o])||(r.crossOrigin="Anonymous"),c.src=i[o],r.appendChild(c)}return{cancel:()=>{}}},a.identity=tc,a.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],T=e[8],I=e[9],P=e[10],D=e[11],L=e[12],Z=e[13],q=e[14],re=e[15],ce=r*m-o*d,ee=r*g-c*d,ae=r*x-h*d,xe=o*g-c*m,ye=o*x-h*m,Oe=c*x-h*g,Ve=T*Z-I*L,ke=T*q-P*L,Ce=T*re-D*L,Ee=I*q-P*Z,De=I*re-D*Z,Pe=P*re-D*q,we=ce*Pe-ee*De+ae*Ee+xe*Ce-ye*ke+Oe*Ve;return we?(i[0]=(m*Pe-g*De+x*Ee)*(we=1/we),i[1]=(c*De-o*Pe-h*Ee)*we,i[2]=(Z*Oe-q*ye+re*xe)*we,i[3]=(P*ye-I*Oe-D*xe)*we,i[4]=(g*Ce-d*Pe-x*ke)*we,i[5]=(r*Pe-c*Ce+h*ke)*we,i[6]=(q*ae-L*Oe-re*ee)*we,i[7]=(T*Oe-P*ae+D*ee)*we,i[8]=(d*De-m*Ce+x*Ve)*we,i[9]=(o*Ce-r*De-h*Ve)*we,i[10]=(L*ye-Z*ae+re*ce)*we,i[11]=(I*ae-T*ye-D*ce)*we,i[12]=(m*ke-d*Ee-g*Ve)*we,i[13]=(r*Ee-o*ke+c*Ve)*we,i[14]=(Z*ee-L*xe-q*ce)*we,i[15]=(T*xe-I*ee+P*ce)*we,i):null},a.isImageBitmap=pi,a.isSafari=Rt,a.isWorker=Jt,a.keysDifference=function(i,e){const r=[];for(const o in i)o in e||r.push(o);return r},a.lazyLoadRTLTextPlugin=function(){Ji.isLoading()||Ji.isLoaded()||_o()!=="deferred"||Za()},a.makeRequest=vn,a.mapObject=Ye,a.mercatorXfromLng=ch,a.mercatorYfromLat=uh,a.mercatorZfromAltitude=hh,a.mul=Np,a.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},a.multiply=pu,a.nextPowerOfTwo=function(i){return i<=1?1:Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))},a.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},a.number=Vt,a.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},a.parseCacheControl=vr,a.parseGlyphPbf=function(i){return new fc(i).readFields(Nd,[])},a.pbf=fc,a.performSymbolLayout=function(i){i.bucket.createArrays(),i.bucket.tilePixelRatio=ri/(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 Gt(i.bucket.zoom+1),i.canonical),layoutTextSize:r["text-size"].possiblyEvaluate(new Gt(i.bucket.zoom+1),i.canonical),textMaxSize:r["text-size"].possiblyEvaluate(new Gt(18))};if(i.bucket.textSizeData.kind==="composite"){const{minZoom:g,maxZoom:x}=i.bucket.textSizeData;o.compositeTextSizes=[r["text-size"].possiblyEvaluate(new Gt(g),i.canonical),r["text-size"].possiblyEvaluate(new Gt(x),i.canonical)]}if(i.bucket.iconSizeData.kind==="composite"){const{minZoom:g,maxZoom:x}=i.bucket.iconSizeData;o.compositeIconSizes=[r["icon-size"].possiblyEvaluate(new Gt(g),i.canonical),r["icon-size"].possiblyEvaluate(new Gt(x),i.canonical)]}const c=e.get("text-line-height")*gi,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(","),T=m.evaluate(g,{},i.canonical),I=o.layoutTextSize.evaluate(g,{},i.canonical),P=o.layoutIconSize.evaluate(g,{},i.canonical),D={horizontal:{},vertical:void 0},L=g.text;let Z,q=[0,0];if(L){const ee=L.toString(),ae=e.get("text-letter-spacing").evaluate(g,{},i.canonical)*gi,xe=Xl(ee)?ae:0,ye=e.get("text-anchor").evaluate(g,{},i.canonical),Oe=e.get("text-variable-anchor");if(!Oe){const De=e.get("text-radial-offset").evaluate(g,{},i.canonical);q=De?ih(ye,[De*gi,xc]):e.get("text-offset").evaluate(g,{},i.canonical).map(Pe=>Pe*gi)}let Ve=h?"center":e.get("text-justify").evaluate(g,{},i.canonical);const ke=e.get("symbol-placement"),Ce=ke==="point"?e.get("text-max-width").evaluate(g,{},i.canonical)*gi:0,Ee=()=>{i.bucket.allowVerticalPlacement&&jo(ee)&&(D.vertical=ll(L,i.glyphMap,i.glyphPositions,i.imagePositions,x,Ce,c,ye,"left",xe,q,a.WritingMode.vertical,!0,ke,I,T))};if(!h&&Oe){const De=Ve==="auto"?Oe.map(we=>vc(we)):[Ve];let Pe=!1;for(let we=0;we<De.length;we++){const He=De[we];if(!D.horizontal[He])if(Pe)D.horizontal[He]=D.horizontal[0];else{const je=ll(L,i.glyphMap,i.glyphPositions,i.imagePositions,x,Ce,c,"center",He,xe,q,a.WritingMode.horizontal,!1,ke,I,T);je&&(D.horizontal[He]=je,Pe=je.positionedLines.length===1)}}Ee()}else{Ve==="auto"&&(Ve=vc(ye));const De=ll(L,i.glyphMap,i.glyphPositions,i.imagePositions,x,Ce,c,ye,Ve,xe,q,a.WritingMode.horizontal,!1,ke,I,T);De&&(D.horizontal[Ve]=De),Ee(),jo(ee)&&h&&d&&(D.vertical=ll(L,i.glyphMap,i.glyphPositions,i.imagePositions,x,Ce,c,ye,Ve,xe,q,a.WritingMode.vertical,!1,ke,I,T))}}let re=!1;if(g.icon&&g.icon.name){const ee=i.imageMap[g.icon.name];ee&&(Z=Wd(i.imagePositions[g.icon.name],e.get("icon-offset").evaluate(g,{},i.canonical),e.get("icon-anchor").evaluate(g,{},i.canonical)),re=!!ee.sdf,i.bucket.sdfIcons===void 0?i.bucket.sdfIcons=re:i.bucket.sdfIcons!==re&&at("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(ee.pixelRatio!==i.bucket.pixelRatio||e.get("icon-rotate").constantOr(1)!==0)&&(i.bucket.iconsNeedLinear=!0))}const ce=nh(D.horizontal)||D.vertical;i.bucket.iconsInText=!!ce&&ce.iconsInText,(ce||Z)&&tf(i.bucket,g,D,Z,i.imageMap,o,I,P,q,re,i.canonical)}i.showCollisionBoxes&&i.bucket.generateCollisionDebugBuffers()},a.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},a.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},a.plugin=Ji,a.pointGeometry=Xe,a.polygonIntersectsPolygon=au,a.potpack=Uu,a.refProperties=["type","source","source-layer","minzoom","maxzoom","filter","layout"],a.register=$e,a.registerForPluginStateChange=function(i){return i({pluginStatus:Pi,pluginURL:Gr}),Bs.on("pluginStateChange",i),i},a.renderColorRamp=xu,a.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],T=e[9],I=e[10],P=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+T*o,i[6]=m*c+I*o,i[7]=g*c+P*o,i[8]=x*c-h*o,i[9]=T*c-d*o,i[10]=I*c-m*o,i[11]=P*c-g*o,i},a.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],T=e[5],I=e[6],P=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+T*o,i[2]=m*c+I*o,i[3]=g*c+P*o,i[4]=x*c-h*o,i[5]=T*c-d*o,i[6]=I*c-m*o,i[7]=P*c-g*o,i},a.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},a.scale$1=function(i,e,r){return i[0]=e[0]*r,i[1]=e[1]*r,i[2]=e[2]*r,i},a.setCacheLimits=function(i,e){gn=i,_n=e},a.setRTLTextPlugin=function(i,e,r=!1){if(Pi===ks||Pi===Ds||Pi===Ls)throw new Error("setRTLTextPlugin cannot be called multiple times.");Gr=di.resolveURL(i),Pi=ks,Rs=e,Bn(),r||Za()},a.spec=_e,a.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)}},a.sqrLen=function(i){var e=i[0],r=i[1];return e*e+r*r},a.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},a.toEvaluationFeature=wo,a.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},a.transformMat4=el,a.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},a.translate=function(i,e,r){var o,c,h,d,m,g,x,T,I,P,D,L,Z=r[0],q=r[1],re=r[2];return e===i?(i[12]=e[0]*Z+e[4]*q+e[8]*re+e[12],i[13]=e[1]*Z+e[5]*q+e[9]*re+e[13],i[14]=e[2]*Z+e[6]*q+e[10]*re+e[14],i[15]=e[3]*Z+e[7]*q+e[11]*re+e[15]):(c=e[1],h=e[2],d=e[3],m=e[4],g=e[5],x=e[6],T=e[7],I=e[8],P=e[9],D=e[10],L=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]=T,i[8]=I,i[9]=P,i[10]=D,i[11]=L,i[12]=o*Z+m*q+I*re+e[12],i[13]=c*Z+g*q+P*re+e[13],i[14]=h*Z+x*q+D*re+e[14],i[15]=d*Z+T*q+L*re+e[15]),i},a.triggerPluginCompletionEvent=qa,a.unicodeBlockLookup=ze,a.uniqueId=function(){return Be++},a.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},a.validateLight=As,a.validateStyle=mo,a.vectorTile=Un,a.warnOnce=at,a.wrap=Ge}),N(["./shared"],function(a){function Q(O){const b=typeof O;if(b==="number"||b==="boolean"||b==="string"||O==null)return JSON.stringify(O);if(Array.isArray(O)){let B="[";for(const j of O)B+=`${Q(j)},`;return`${B}]`}const C=Object.keys(O).sort();let R="{";for(let B=0;B<C.length;B++)R+=`${JSON.stringify(C[B])}:${Q(O[C[B]])},`;return`${R}}`}function te(O){let b="";for(const C of a.refProperties)b+=`/${Q(O[C])}`;return b}class fe{constructor(b){this.keyCache={},b&&this.replace(b)}replace(b){this._layerConfigs={},this._layers={},this.update(b,[])}update(b,C){for(const B of b){this._layerConfigs[B.id]=B;const j=this._layers[B.id]=a.createStyleLayer(B);j._featureFilter=a.createFilter(j.filter),this.keyCache[B.id]&&delete this.keyCache[B.id]}for(const B of C)delete this.keyCache[B],delete this._layerConfigs[B],delete this._layers[B];this.familiesBySource={};const R=function(B,j){const K={};for(let X=0;X<B.length;X++){const J=j&&j[B[X].id]||te(B[X]);j&&(j[B[X].id]=J);let pe=K[J];pe||(pe=K[J]=[]),pe.push(B[X])}const W=[];for(const X in K)W.push(K[X]);return W}(Object.values(this._layerConfigs),this.keyCache);for(const B of R){const j=B.map(ve=>this._layers[ve.id]),K=j[0];if(K.visibility==="none")continue;const W=K.source||"";let X=this.familiesBySource[W];X||(X=this.familiesBySource[W]={});const J=K.sourceLayer||"_geojsonTileLayer";let pe=X[J];pe||(pe=X[J]=[]),pe.push(j)}}}class ue{constructor(b){const C={},R=[];for(const W in b){const X=b[W],J=C[W]={};for(const pe in X){const ve=X[+pe];if(!ve||ve.bitmap.width===0||ve.bitmap.height===0)continue;const he={x:0,y:0,w:ve.bitmap.width+2,h:ve.bitmap.height+2};R.push(he),J[pe]={rect:he,metrics:ve.metrics}}}const{w:B,h:j}=a.potpack(R),K=new a.AlphaImage({width:B||1,height:j||1});for(const W in b){const X=b[W];for(const J in X){const pe=X[+J];if(!pe||pe.bitmap.width===0||pe.bitmap.height===0)continue;const ve=C[W][J].rect;a.AlphaImage.copy(pe.bitmap,K,{x:0,y:0},{x:ve.x+1,y:ve.y+1},pe.bitmap)}}this.image=K,this.positions=C}}a.register("GlyphAtlas",ue);class ie{constructor(b){this.tileID=new a.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,C,R,B,j){this.status="parsing",this.data=b,this.collisionBoxArray=new a.CollisionBoxArray;const K=new a.DictionaryCoder(Object.keys(b.layers).sort()),W=new a.FeatureIndex(this.tileID,this.promoteId);W.bucketLayerIDs=[];const X={},J={featureIndex:W,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:R},pe=C.familiesBySource[this.source];for(const it in pe){const ct=b.layers[it];if(!ct)continue;ct.version===1&&a.warnOnce(`Vector tile source "${this.source}" layer "${it}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const wt=K.encode(it),kt=[];for(let si=0;si<ct.length;si++){const Ut=ct.feature(si),_i=W.getId(Ut,it);kt.push({feature:Ut,id:_i,index:si,sourceLayerIndex:wt})}for(const si of pe[it]){const Ut=si[0];Ut.source!==this.source&&a.warnOnce(`layer.source = ${Ut.source} does not equal this.source = ${this.source}`),Ut.minzoom&&this.zoom<Math.floor(Ut.minzoom)||Ut.maxzoom&&this.zoom>=Ut.maxzoom||Ut.visibility!=="none"&&(Ge(si,this.zoom,R),(X[Ut.id]=Ut.createBucket({index:W.bucketLayerIDs.length,layers:si,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:wt,sourceID:this.source})).populate(kt,J,this.tileID.canonical),W.bucketLayerIDs.push(si.map(_i=>_i.id)))}}let ve,he,Ue,qe;const Le=a.mapObject(J.glyphDependencies,it=>Object.keys(it).map(Number));Object.keys(Le).length?B.send("getGlyphs",{uid:this.uid,stacks:Le},(it,ct)=>{ve||(ve=it,he=ct,bt.call(this))}):he={};const Ke=Object.keys(J.iconDependencies);Ke.length?B.send("getImages",{icons:Ke,source:this.source,tileID:this.tileID,type:"icons"},(it,ct)=>{ve||(ve=it,Ue=ct,bt.call(this))}):Ue={};const et=Object.keys(J.patternDependencies);function bt(){if(ve)return j(ve);if(he&&Ue&&qe){const it=new ue(he),ct=new a.ImageAtlas(Ue,qe);for(const wt in X){const kt=X[wt];kt instanceof a.SymbolBucket?(Ge(kt.layers,this.zoom,R),a.performSymbolLayout({bucket:kt,glyphMap:he,glyphPositions:it.positions,imageMap:Ue,imagePositions:ct.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):kt.hasPattern&&(kt instanceof a.LineBucket||kt instanceof a.FillBucket||kt instanceof a.FillExtrusionBucket)&&(Ge(kt.layers,this.zoom,R),kt.addFeatures(J,this.tileID.canonical,ct.patternPositions))}this.status="done",j(null,{buckets:Object.values(X).filter(wt=>!wt.isEmpty()),featureIndex:W,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:it.image,imageAtlas:ct,glyphMap:this.returnDependencies?he:null,iconMap:this.returnDependencies?Ue:null,glyphPositions:this.returnDependencies?it.positions:null})}}et.length?B.send("getImages",{icons:et,source:this.source,tileID:this.tileID,type:"patterns"},(it,ct)=>{ve||(ve=it,qe=ct,bt.call(this))}):qe={},bt.call(this)}}function Ge(O,b,C){const R=new a.EvaluationParameters(b);for(const B of O)B.recalculate(R,C)}function Ne(O,b){const C=a.getArrayBuffer(O.request,(R,B,j,K)=>{R?b(R):B&&b(null,{vectorTile:new a.vectorTile.VectorTile(new a.pbf(B)),rawData:B,cacheControl:j,expires:K})});return()=>{C.cancel(),b()}}class Be{constructor(b,C,R,B){this.actor=b,this.layerIndex=C,this.availableImages=R,this.loadVectorData=B||Ne,this.loading={},this.loaded={}}loadTile(b,C){const R=b.uid;this.loading||(this.loading={});const B=!!(b&&b.request&&b.request.collectResourceTiming)&&new a.RequestPerformance(b.request),j=this.loading[R]=new ie(b);j.abort=this.loadVectorData(b,(K,W)=>{if(delete this.loading[R],K||!W)return j.status="done",this.loaded[R]=j,C(K);const X=W.rawData,J={};W.expires&&(J.expires=W.expires),W.cacheControl&&(J.cacheControl=W.cacheControl);const pe={};if(B){const ve=B.finish();ve&&(pe.resourceTiming=JSON.parse(JSON.stringify(ve)))}j.vectorTile=W.vectorTile,j.parse(W.vectorTile,this.layerIndex,this.availableImages,this.actor,(ve,he)=>{if(ve||!he)return C(ve);C(null,a.extend({rawTileData:X.slice(0)},he,J,pe))}),this.loaded=this.loaded||{},this.loaded[R]=j})}reloadTile(b,C){const R=this.loaded,B=b.uid,j=this;if(R&&R[B]){const K=R[B];K.showCollisionBoxes=b.showCollisionBoxes;const W=(X,J)=>{const pe=K.reloadCallback;pe&&(delete K.reloadCallback,K.parse(K.vectorTile,j.layerIndex,this.availableImages,j.actor,pe)),C(X,J)};K.status==="parsing"?K.reloadCallback=W:K.status==="done"&&(K.vectorTile?K.parse(K.vectorTile,this.layerIndex,this.availableImages,this.actor,W):W())}}abortTile(b,C){const R=this.loading,B=b.uid;R&&R[B]&&R[B].abort&&(R[B].abort(),delete R[B]),C()}removeTile(b,C){const R=this.loaded,B=b.uid;R&&R[B]&&delete R[B],C()}}class tt{constructor(){this.loaded={}}loadTile(b,C){const{uid:R,encoding:B,rawImageData:j}=b,K=a.isImageBitmap(j)?this.getImageData(j):j,W=new a.DEMData(R,K,B);this.loaded=this.loaded||{},this.loaded[R]=W,C(null,W)}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 C=this.offscreenCanvasContext.getImageData(-1,-1,b.width+2,b.height+2);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),new a.RGBAImage({width:C.width,height:C.height},C.data)}removeTile(b){const C=this.loaded,R=b.uid;C&&C[R]&&delete C[R]}}var Ye=function O(b,C){var R,B=b&&b.type;if(B==="FeatureCollection")for(R=0;R<b.features.length;R++)O(b.features[R],C);else if(B==="GeometryCollection")for(R=0;R<b.geometries.length;R++)O(b.geometries[R],C);else if(B==="Feature")O(b.geometry,C);else if(B==="Polygon")Qe(b.coordinates,C);else if(B==="MultiPolygon")for(R=0;R<b.coordinates.length;R++)Qe(b.coordinates[R],C);return b};function Qe(O,b){if(O.length!==0){pt(O[0],b);for(var C=1;C<O.length;C++)pt(O[C],!b)}}function pt(O,b){for(var C=0,R=0,B=0,j=O.length,K=j-1;B<j;K=B++){var W=(O[B][0]-O[K][0])*(O[K][1]+O[B][1]),X=C+W;R+=Math.abs(C)>=Math.abs(W)?C-X+W:W-X+C,C=X}C+R>=0!=!!b&&O.reverse()}const gt=a.vectorTile.VectorTileFeature.prototype.toGeoJSON;class at{constructor(b){this._feature=b,this.extent=a.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 C of this._feature.geometry)b.push([new a.pointGeometry(C[0],C[1])]);return b}{const b=[];for(const C of this._feature.geometry){const R=[];for(const B of C)R.push(new a.pointGeometry(B[0],B[1]));b.push(R)}return b}}toGeoJSON(b,C,R){return gt.call(this,b,C,R)}}class Et{constructor(b){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=a.EXTENT,this.length=b.length,this._features=b}feature(b){return new at(this._features[b])}}var Ht={exports:{}},Jt=a.pointGeometry,vr=a.vectorTile.VectorTileFeature,Wi=ur;function ur(O,b){this.options=b||{},this.features=O,this.length=O.length}function Hi(O,b){this.id=typeof O.id=="number"?O.id:void 0,this.type=O.type,this.rawGeometry=O.type===1?[O.geometry]:O.geometry,this.properties=O.tags,this.extent=b||4096}ur.prototype.feature=function(O){return new Hi(this.features[O],this.options.extent)},Hi.prototype.loadGeometry=function(){var O=this.rawGeometry;this.geometry=[];for(var b=0;b<O.length;b++){for(var C=O[b],R=[],B=0;B<C.length;B++)R.push(new Jt(C[B][0],C[B][1]));this.geometry.push(R)}return this.geometry},Hi.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var O=this.geometry,b=1/0,C=-1/0,R=1/0,B=-1/0,j=0;j<O.length;j++)for(var K=O[j],W=0;W<K.length;W++){var X=K[W];b=Math.min(b,X.x),C=Math.max(C,X.x),R=Math.min(R,X.y),B=Math.max(B,X.y)}return[b,R,C,B]},Hi.prototype.toGeoJSON=vr.prototype.toGeoJSON;var Rt=a.pbf,pi=Wi;function di(O){var b=new Rt;return function(C,R){for(var B in C.layers)R.writeMessage(3,Xe,C.layers[B])}(O,b),b.finish()}function Xe(O,b){var C;b.writeVarintField(15,O.version||1),b.writeStringField(1,O.name||""),b.writeVarintField(5,O.extent||4096);var R={keys:[],values:[],keycache:{},valuecache:{}};for(C=0;C<O.length;C++)R.feature=O.feature(C),b.writeMessage(2,Ri,R);var B=R.keys;for(C=0;C<B.length;C++)b.writeStringField(3,B[C]);var j=R.values;for(C=0;C<j.length;C++)b.writeMessage(4,gn,j[C])}function Ri(O,b){var C=O.feature;C.id!==void 0&&b.writeVarintField(1,C.id),b.writeMessage(2,wi,O),b.writeVarintField(3,C.type),b.writeMessage(4,Kr,C)}function wi(O,b){var C=O.feature,R=O.keys,B=O.values,j=O.keycache,K=O.valuecache;for(var W in C.properties){var X=C.properties[W],J=j[W];if(X!==null){J===void 0&&(R.push(W),j[W]=J=R.length-1),b.writeVarint(J);var pe=typeof X;pe!=="string"&&pe!=="boolean"&&pe!=="number"&&(X=JSON.stringify(X));var ve=pe+":"+X,he=K[ve];he===void 0&&(B.push(X),K[ve]=he=B.length-1),b.writeVarint(he)}}}function Ci(O,b){return(b<<3)+(7&O)}function Ai(O){return O<<1^O>>31}function Kr(O,b){for(var C=O.loadGeometry(),R=O.type,B=0,j=0,K=C.length,W=0;W<K;W++){var X=C[W],J=1;R===1&&(J=X.length),b.writeVarint(Ci(1,J));for(var pe=R===3?X.length-1:X.length,ve=0;ve<pe;ve++){ve===1&&R!==1&&b.writeVarint(Ci(2,pe-1));var he=X[ve].x-B,Ue=X[ve].y-j;b.writeVarint(Ai(he)),b.writeVarint(Ai(Ue)),B+=he,j+=Ue}R===3&&b.writeVarint(Ci(7,1))}}function gn(O,b){var C=typeof O;C==="string"?b.writeStringField(1,O):C==="boolean"?b.writeBooleanField(7,O):C==="number"&&(O%1!=0?b.writeDoubleField(3,O):O<0?b.writeSVarintField(6,O):b.writeVarintField(5,O))}function _n(O,b,C,R,B,j){if(B-R<=C)return;const K=R+B>>1;yn(O,b,K,R,B,j%2),_n(O,b,C,R,K-1,j+1),_n(O,b,C,K+1,B,j+1)}function yn(O,b,C,R,B,j){for(;B>R;){if(B-R>600){const J=B-R+1,pe=C-R+1,ve=Math.log(J),he=.5*Math.exp(2*ve/3),Ue=.5*Math.sqrt(ve*he*(J-he)/J)*(pe-J/2<0?-1:1);yn(O,b,C,Math.max(R,Math.floor(C-pe*he/J+Ue)),Math.min(B,Math.floor(C+(J-pe)*he/J+Ue)),j)}const K=b[2*C+j];let W=R,X=B;for(hr(O,b,R,C),b[2*B+j]>K&&hr(O,b,R,B);W<X;){for(hr(O,b,W,X),W++,X--;b[2*W+j]<K;)W++;for(;b[2*X+j]>K;)X--}b[2*R+j]===K?hr(O,b,R,X):(X++,hr(O,b,X,B)),X<=C&&(R=X+1),C<=X&&(B=X-1)}}function hr(O,b,C,R){Dr(O,C,R),Dr(b,2*C,2*R),Dr(b,2*C+1,2*R+1)}function Dr(O,b,C){const R=O[b];O[b]=O[C],O[C]=R}function Lr(O,b,C,R){const B=O-C,j=b-R;return B*B+j*j}Ht.exports=di,Ht.exports.fromVectorTileJs=di,Ht.exports.fromGeojsonVt=function(O,b){b=b||{};var C={};for(var R in O)C[R]=new pi(O[R].features,b),C[R].name=R,C[R].version=b.version,C[R].extent=b.extent;return di({layers:C})},Ht.exports.GeoJSONWrapper=pi;const Rr=O=>O[0],Mi=O=>O[1];class xn{constructor(b,C=Rr,R=Mi,B=64,j=Float64Array){this.nodeSize=B,this.points=b;const K=b.length<65536?Uint16Array:Uint32Array,W=this.ids=new K(b.length),X=this.coords=new j(2*b.length);for(let J=0;J<b.length;J++)W[J]=J,X[2*J]=C(b[J]),X[2*J+1]=R(b[J]);_n(W,X,B,0,W.length-1,0)}range(b,C,R,B){return function(j,K,W,X,J,pe,ve){const he=[0,j.length-1,0],Ue=[];let qe,Le;for(;he.length;){const Ke=he.pop(),et=he.pop(),bt=he.pop();if(et-bt<=ve){for(let wt=bt;wt<=et;wt++)qe=K[2*wt],Le=K[2*wt+1],qe>=W&&qe<=J&&Le>=X&&Le<=pe&&Ue.push(j[wt]);continue}const it=Math.floor((bt+et)/2);qe=K[2*it],Le=K[2*it+1],qe>=W&&qe<=J&&Le>=X&&Le<=pe&&Ue.push(j[it]);const ct=(Ke+1)%2;(Ke===0?W<=qe:X<=Le)&&(he.push(bt),he.push(it-1),he.push(ct)),(Ke===0?J>=qe:pe>=Le)&&(he.push(it+1),he.push(et),he.push(ct))}return Ue}(this.ids,this.coords,b,C,R,B,this.nodeSize)}within(b,C,R){return function(B,j,K,W,X,J){const pe=[0,B.length-1,0],ve=[],he=X*X;for(;pe.length;){const Ue=pe.pop(),qe=pe.pop(),Le=pe.pop();if(qe-Le<=J){for(let ct=Le;ct<=qe;ct++)Lr(j[2*ct],j[2*ct+1],K,W)<=he&&ve.push(B[ct]);continue}const Ke=Math.floor((Le+qe)/2),et=j[2*Ke],bt=j[2*Ke+1];Lr(et,bt,K,W)<=he&&ve.push(B[Ke]);const it=(Ue+1)%2;(Ue===0?K-X<=et:W-X<=bt)&&(pe.push(Le),pe.push(Ke-1),pe.push(it)),(Ue===0?K+X>=et:W+X>=bt)&&(pe.push(Ke+1),pe.push(qe),pe.push(it))}return ve}(this.ids,this.coords,b,C,R,this.nodeSize)}}const jn={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:O=>O},br=Math.fround||(Bi=new Float32Array(1),O=>(Bi[0]=+O,Bi[0]));var Bi;class Xn{constructor(b){this.options=Or(Object.create(jn),b),this.trees=new Array(this.options.maxZoom+1)}load(b){const{log:C,minZoom:R,maxZoom:B,nodeSize:j}=this.options;C&&console.time("total time");const K=`prepare ${b.length} points`;C&&console.time(K),this.points=b;let W=[];for(let X=0;X<b.length;X++)b[X].geometry&&W.push(vn(b[X],X));this.trees[B+1]=new xn(W,Hn,wr,j,Float32Array),C&&console.timeEnd(K);for(let X=B;X>=R;X--){const J=+Date.now();W=this._cluster(W,X),this.trees[X]=new xn(W,Hn,wr,j,Float32Array),C&&console.log("z%d: %d clusters in %dms",X,W.length,+Date.now()-J)}return C&&console.timeEnd("total time"),this}getClusters(b,C){let R=((b[0]+180)%360+360)%360-180;const B=Math.max(-90,Math.min(90,b[1]));let j=b[2]===180?180:((b[2]+180)%360+360)%360-180;const K=Math.max(-90,Math.min(90,b[3]));if(b[2]-b[0]>=360)R=-180,j=180;else if(R>j){const pe=this.getClusters([R,B,180,K],C),ve=this.getClusters([-180,B,j,K],C);return pe.concat(ve)}const W=this.trees[this._limitZoom(C)],X=W.range(xt(R),pr(K),xt(j),pr(B)),J=[];for(const pe of X){const ve=W.points[pe];J.push(ve.numPoints?bn(ve):this.points[ve.index])}return J}getChildren(b){const C=this._getOriginId(b),R=this._getOriginZoom(b),B="No cluster with the specified id.",j=this.trees[R];if(!j)throw new Error(B);const K=j.points[C];if(!K)throw new Error(B);const W=this.options.radius/(this.options.extent*Math.pow(2,R-1)),X=j.within(K.x,K.y,W),J=[];for(const pe of X){const ve=j.points[pe];ve.parentId===b&&J.push(ve.numPoints?bn(ve):this.points[ve.index])}if(J.length===0)throw new Error(B);return J}getLeaves(b,C,R){const B=[];return this._appendLeaves(B,b,C=C||10,R=R||0,0),B}getTile(b,C,R){const B=this.trees[this._limitZoom(b)],j=Math.pow(2,b),{extent:K,radius:W}=this.options,X=W/K,J=(R-X)/j,pe=(R+1+X)/j,ve={features:[]};return this._addTileFeatures(B.range((C-X)/j,J,(C+1+X)/j,pe),B.points,C,R,j,ve),C===0&&this._addTileFeatures(B.range(1-X/j,J,1,pe),B.points,j,R,j,ve),C===j-1&&this._addTileFeatures(B.range(0,J,X/j,pe),B.points,-1,R,j,ve),ve.features.length?ve:null}getClusterExpansionZoom(b){let C=this._getOriginZoom(b)-1;for(;C<=this.options.maxZoom;){const R=this.getChildren(b);if(C++,R.length!==1)break;b=R[0].properties.cluster_id}return C}_appendLeaves(b,C,R,B,j){const K=this.getChildren(C);for(const W of K){const X=W.properties;if(X&&X.cluster?j+X.point_count<=B?j+=X.point_count:j=this._appendLeaves(b,X.cluster_id,R,B,j):j<B?j++:b.push(W),b.length===R)break}return j}_addTileFeatures(b,C,R,B,j,K){for(const W of b){const X=C[W],J=X.numPoints;let pe,ve,he;if(J)pe=Wn(X),ve=X.x,he=X.y;else{const Le=this.points[X.index];pe=Le.properties,ve=xt(Le.geometry.coordinates[0]),he=pr(Le.geometry.coordinates[1])}const Ue={type:1,geometry:[[Math.round(this.options.extent*(ve*j-R)),Math.round(this.options.extent*(he*j-B))]],tags:pe};let qe;J?qe=X.id:this.options.generateId?qe=X.index:this.points[X.index].id&&(qe=this.points[X.index].id),qe!==void 0&&(Ue.id=qe),K.features.push(Ue)}}_limitZoom(b){return Math.max(this.options.minZoom,Math.min(Math.floor(+b),this.options.maxZoom+1))}_cluster(b,C){const R=[],{radius:B,extent:j,reduce:K,minPoints:W}=this.options,X=B/(j*Math.pow(2,C));for(let J=0;J<b.length;J++){const pe=b[J];if(pe.zoom<=C)continue;pe.zoom=C;const ve=this.trees[C+1],he=ve.within(pe.x,pe.y,X),Ue=pe.numPoints||1;let qe=Ue;for(const Le of he){const Ke=ve.points[Le];Ke.zoom>C&&(qe+=Ke.numPoints||1)}if(qe>Ue&&qe>=W){let Le=pe.x*Ue,Ke=pe.y*Ue,et=K&&Ue>1?this._map(pe,!0):null;const bt=(J<<5)+(C+1)+this.points.length;for(const it of he){const ct=ve.points[it];if(ct.zoom<=C)continue;ct.zoom=C;const wt=ct.numPoints||1;Le+=ct.x*wt,Ke+=ct.y*wt,ct.parentId=bt,K&&(et||(et=this._map(pe,!0)),K(et,this._map(ct)))}pe.parentId=bt,R.push(Br(Le/qe,Ke/qe,bt,qe,et))}else if(R.push(pe),qe>1)for(const Le of he){const Ke=ve.points[Le];Ke.zoom<=C||(Ke.zoom=C,R.push(Ke))}}return R}_getOriginId(b){return b-this.points.length>>5}_getOriginZoom(b){return(b-this.points.length)%32}_map(b,C){if(b.numPoints)return C?Or({},b.properties):b.properties;const R=this.points[b.index].properties,B=this.options.map(R);return C&&B===R?Or({},B):B}}function Br(O,b,C,R,B){return{x:br(O),y:br(b),zoom:1/0,id:C,parentId:-1,numPoints:R,properties:B}}function vn(O,b){const[C,R]=O.geometry.coordinates;return{x:br(xt(C)),y:br(pr(R)),zoom:1/0,index:b,parentId:-1}}function bn(O){return{type:"Feature",id:O.id,properties:Wn(O),geometry:{type:"Point",coordinates:[(b=O.x,360*(b-.5)),Fr(O.y)]}};var b}function Wn(O){const b=O.numPoints,C=b>=1e4?`${Math.round(b/1e3)}k`:b>=1e3?Math.round(b/100)/10+"k":b;return Or(Or({},O.properties),{cluster:!0,cluster_id:O.id,point_count:b,point_count_abbreviated:C})}function xt(O){return O/360+.5}function pr(O){const b=Math.sin(O*Math.PI/180),C=.5-.25*Math.log((1+b)/(1-b))/Math.PI;return C<0?0:C>1?1:C}function Fr(O){const b=(180-360*O)*Math.PI/180;return 360*Math.atan(Math.exp(b))/Math.PI-90}function Or(O,b){for(const C in b)O[C]=b[C];return O}function Hn(O){return O.x}function wr(O){return O.y}function Tr(O,b,C,R){for(var B,j=R,K=C-b>>1,W=C-b,X=O[b],J=O[b+1],pe=O[C],ve=O[C+1],he=b+3;he<C;he+=3){var Ue=wn(O[he],O[he+1],X,J,pe,ve);if(Ue>j)B=he,j=Ue;else if(Ue===j){var qe=Math.abs(he-K);qe<W&&(B=he,W=qe)}}j>R&&(B-b>3&&Tr(O,b,B,R),O[B+2]=j,C-B>3&&Tr(O,B,C,R))}function wn(O,b,C,R,B,j){var K=B-C,W=j-R;if(K!==0||W!==0){var X=((O-C)*K+(b-R)*W)/(K*K+W*W);X>1?(C=B,R=j):X>0&&(C+=K*X,R+=W*X)}return(K=O-C)*K+(W=b-R)*W}function Er(O,b,C,R){var B={id:O===void 0?null:O,type:b,geometry:C,tags:R,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(j){var K=j.geometry,W=j.type;if(W==="Point"||W==="MultiPoint"||W==="LineString")_e(j,K);else if(W==="Polygon"||W==="MultiLineString")for(var X=0;X<K.length;X++)_e(j,K[X]);else if(W==="MultiPolygon")for(X=0;X<K.length;X++)for(var J=0;J<K[X].length;J++)_e(j,K[X][J])}(B),B}function _e(O,b){for(var C=0;C<b.length;C+=3)O.minX=Math.min(O.minX,b[C]),O.minY=Math.min(O.minY,b[C+1]),O.maxX=Math.max(O.maxX,b[C]),O.maxY=Math.max(O.maxY,b[C+1])}function Me(O,b,C,R){if(b.geometry){var B=b.geometry.coordinates,j=b.geometry.type,K=Math.pow(C.tolerance/((1<<C.maxZoom)*C.extent),2),W=[],X=b.id;if(C.promoteId?X=b.properties[C.promoteId]:C.generateId&&(X=R||0),j==="Point")Jr(B,W);else if(j==="MultiPoint")for(var J=0;J<B.length;J++)Jr(B[J],W);else if(j==="LineString")ir(B,W,K,!1);else if(j==="MultiLineString"){if(C.lineMetrics){for(J=0;J<B.length;J++)ir(B[J],W=[],K,!1),O.push(Er(X,"LineString",W,b.properties));return}vt(B,W,K,!1)}else if(j==="Polygon")vt(B,W,K,!0);else{if(j!=="MultiPolygon"){if(j==="GeometryCollection"){for(J=0;J<b.geometry.geometries.length;J++)Me(O,{id:X,geometry:b.geometry.geometries[J],properties:b.properties},C,R);return}throw new Error("Input data is not a valid GeoJSON object.")}for(J=0;J<B.length;J++){var pe=[];vt(B[J],pe,K,!0),W.push(pe)}}O.push(Er(X,j,W,b.properties))}}function Jr(O,b){b.push(Ki(O[0])),b.push(Fi(O[1])),b.push(0)}function ir(O,b,C,R){for(var B,j,K=0,W=0;W<O.length;W++){var X=Ki(O[W][0]),J=Fi(O[W][1]);b.push(X),b.push(J),b.push(0),W>0&&(K+=R?(B*J-X*j)/2:Math.sqrt(Math.pow(X-B,2)+Math.pow(J-j,2))),B=X,j=J}var pe=b.length-3;b[2]=1,Tr(b,0,pe,C),b[pe+2]=1,b.size=Math.abs(K),b.start=0,b.end=b.size}function vt(O,b,C,R){for(var B=0;B<O.length;B++){var j=[];ir(O[B],j,C,R),b.push(j)}}function Ki(O){return O/360+.5}function Fi(O){var b=Math.sin(O*Math.PI/180),C=.5-.25*Math.log((1+b)/(1-b))/Math.PI;return C<0?0:C>1?1:C}function Oi(O,b,C,R,B,j,K,W){if(R/=b,j>=(C/=b)&&K<R)return O;if(K<C||j>=R)return null;for(var X=[],J=0;J<O.length;J++){var pe=O[J],ve=pe.geometry,he=pe.type,Ue=B===0?pe.minX:pe.minY,qe=B===0?pe.maxX:pe.maxY;if(Ue>=C&&qe<R)X.push(pe);else if(!(qe<C||Ue>=R)){var Le=[];if(he==="Point"||he==="MultiPoint")$r(ve,Le,C,R,B);else if(he==="LineString")Se(ve,Le,C,R,B,!1,W.lineMetrics);else if(he==="MultiLineString")ot(ve,Le,C,R,B,!1);else if(he==="Polygon")ot(ve,Le,C,R,B,!0);else if(he==="MultiPolygon")for(var Ke=0;Ke<ve.length;Ke++){var et=[];ot(ve[Ke],et,C,R,B,!0),et.length&&Le.push(et)}if(Le.length){if(W.lineMetrics&&he==="LineString"){for(Ke=0;Ke<Le.length;Ke++)X.push(Er(pe.id,he,Le[Ke],pe.tags));continue}he!=="LineString"&&he!=="MultiLineString"||(Le.length===1?(he="LineString",Le=Le[0]):he="MultiLineString"),he!=="Point"&&he!=="MultiPoint"||(he=Le.length===3?"Point":"MultiPoint"),X.push(Er(pe.id,he,Le,pe.tags))}}}return X.length?X:null}function $r(O,b,C,R,B){for(var j=0;j<O.length;j+=3){var K=O[j+B];K>=C&&K<=R&&(b.push(O[j]),b.push(O[j+1]),b.push(O[j+2]))}}function Se(O,b,C,R,B,j,K){for(var W,X,J=lt(O),pe=B===0?Ur:rt,ve=O.start,he=0;he<O.length-3;he+=3){var Ue=O[he],qe=O[he+1],Le=O[he+2],Ke=O[he+3],et=O[he+4],bt=B===0?Ue:qe,it=B===0?Ke:et,ct=!1;K&&(W=Math.sqrt(Math.pow(Ue-Ke,2)+Math.pow(qe-et,2))),bt<C?it>C&&(X=pe(J,Ue,qe,Ke,et,C),K&&(J.start=ve+W*X)):bt>R?it<R&&(X=pe(J,Ue,qe,Ke,et,R),K&&(J.start=ve+W*X)):fi(J,Ue,qe,Le),it<C&&bt>=C&&(X=pe(J,Ue,qe,Ke,et,C),ct=!0),it>R&&bt<=R&&(X=pe(J,Ue,qe,Ke,et,R),ct=!0),!j&&ct&&(K&&(J.end=ve+W*X),b.push(J),J=lt(O)),K&&(ve+=W)}var wt=O.length-3;Ue=O[wt],qe=O[wt+1],Le=O[wt+2],(bt=B===0?Ue:qe)>=C&&bt<=R&&fi(J,Ue,qe,Le),wt=J.length-3,j&&wt>=3&&(J[wt]!==J[0]||J[wt+1]!==J[1])&&fi(J,J[0],J[1],J[2]),J.length&&b.push(J)}function lt(O){var b=[];return b.size=O.size,b.start=O.start,b.end=O.end,b}function ot(O,b,C,R,B,j){for(var K=0;K<O.length;K++)Se(O[K],b,C,R,B,j,!1)}function fi(O,b,C,R){O.push(b),O.push(C),O.push(R)}function Ur(O,b,C,R,B,j){var K=(j-b)/(R-b);return O.push(j),O.push(C+(B-C)*K),O.push(1),K}function rt(O,b,C,R,B,j){var K=(j-C)/(B-C);return O.push(b+(R-b)*K),O.push(j),O.push(1),K}function Sr(O,b){for(var C=[],R=0;R<O.length;R++){var B,j=O[R],K=j.type;if(K==="Point"||K==="MultiPoint"||K==="LineString")B=oi(j.geometry,b);else if(K==="MultiLineString"||K==="Polygon"){B=[];for(var W=0;W<j.geometry.length;W++)B.push(oi(j.geometry[W],b))}else if(K==="MultiPolygon")for(B=[],W=0;W<j.geometry.length;W++){for(var X=[],J=0;J<j.geometry[W].length;J++)X.push(oi(j.geometry[W][J],b));B.push(X)}C.push(Er(j.id,K,B,j.tags))}return C}function oi(O,b){var C=[];C.size=O.size,O.start!==void 0&&(C.start=O.start,C.end=O.end);for(var R=0;R<O.length;R+=3)C.push(O[R]+b,O[R+1],O[R+2]);return C}function Tn(O,b){if(O.transformed)return O;var C,R,B,j=1<<O.z,K=O.x,W=O.y;for(C=0;C<O.features.length;C++){var X=O.features[C],J=X.geometry,pe=X.type;if(X.geometry=[],pe===1)for(R=0;R<J.length;R+=2)X.geometry.push(Yt(J[R],J[R+1],b,j,K,W));else for(R=0;R<J.length;R++){var ve=[];for(B=0;B<J[R].length;B+=2)ve.push(Yt(J[R][B],J[R][B+1],b,j,K,W));X.geometry.push(ve)}}return O.transformed=!0,O}function Yt(O,b,C,R,B,j){return[Math.round(C*(O*R-B)),Math.round(C*(b*R-j))]}function Ti(O,b,C,R,B){for(var j=b===B.maxZoom?0:B.tolerance/((1<<b)*B.extent),K={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:C,y:R,z:b,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0},W=0;W<O.length;W++){K.numFeatures++,Pt(K,O[W],j,B);var X=O[W].minX,J=O[W].minY,pe=O[W].maxX,ve=O[W].maxY;X<K.minX&&(K.minX=X),J<K.minY&&(K.minY=J),pe>K.maxX&&(K.maxX=pe),ve>K.maxY&&(K.maxY=ve)}return K}function Pt(O,b,C,R){var B=b.geometry,j=b.type,K=[];if(j==="Point"||j==="MultiPoint")for(var W=0;W<B.length;W+=3)K.push(B[W]),K.push(B[W+1]),O.numPoints++,O.numSimplified++;else if(j==="LineString")En(K,B,O,C,!1,!1);else if(j==="MultiLineString"||j==="Polygon")for(W=0;W<B.length;W++)En(K,B[W],O,C,j==="Polygon",W===0);else if(j==="MultiPolygon")for(var X=0;X<B.length;X++){var J=B[X];for(W=0;W<J.length;W++)En(K,J[W],O,C,!0,W===0)}if(K.length){var pe=b.tags||null;if(j==="LineString"&&R.lineMetrics){for(var ve in pe={},b.tags)pe[ve]=b.tags[ve];pe.mapbox_clip_start=B.start/B.size,pe.mapbox_clip_end=B.end/B.size}var he={geometry:K,type:j==="Polygon"||j==="MultiPolygon"?3:j==="LineString"||j==="MultiLineString"?2:1,tags:pe};b.id!==null&&(he.id=b.id),O.features.push(he)}}function En(O,b,C,R,B,j){var K=R*R;if(R>0&&b.size<(B?K:R))C.numPoints+=b.length/3;else{for(var W=[],X=0;X<b.length;X+=3)(R===0||b[X+2]>K)&&(C.numSimplified++,W.push(b[X]),W.push(b[X+1])),C.numPoints++;B&&function(J,pe){for(var ve=0,he=0,Ue=J.length,qe=Ue-2;he<Ue;qe=he,he+=2)ve+=(J[he]-J[qe])*(J[he+1]+J[qe+1]);if(ve>0===pe)for(he=0,Ue=J.length;he<Ue/2;he+=2){var Le=J[he],Ke=J[he+1];J[he]=J[Ue-2-he],J[he+1]=J[Ue-1-he],J[Ue-2-he]=Le,J[Ue-1-he]=Ke}}(W,j),O.push(W)}}function dr(O,b){var C=(b=this.options=function(B,j){for(var K in j)B[K]=j[K];return B}(Object.create(this.options),b)).debug;if(C&&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 R=function(B,j){var K=[];if(B.type==="FeatureCollection")for(var W=0;W<B.features.length;W++)Me(K,B.features[W],j,W);else Me(K,B.type==="Feature"?B:{geometry:B},j);return K}(O,b);this.tiles={},this.tileCoords=[],C&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",b.indexMaxZoom,b.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),R=function(B,j){var K=j.buffer/j.extent,W=B,X=Oi(B,1,-1-K,K,0,-1,2,j),J=Oi(B,1,1-K,2+K,0,-1,2,j);return(X||J)&&(W=Oi(B,1,-K,1+K,0,-1,2,j)||[],X&&(W=Sr(X,1).concat(W)),J&&(W=W.concat(Sr(J,-1)))),W}(R,b),R.length&&this.splitTile(R,0,0,0),C&&(R.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 Yr(O,b,C){return 32*((1<<O)*C+b)+O}function Qr(O,b){const C=O.tileID.canonical;if(!this._geoJSONIndex)return b(null,null);const R=this._geoJSONIndex.getTile(C.z,C.x,C.y);if(!R)return b(null,null);const B=new Et(R.features);let j=Ht.exports(B);j.byteOffset===0&&j.byteLength===j.buffer.byteLength||(j=new Uint8Array(j)),b(null,{vectorTile:B,rawData:j.buffer})}dr.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},dr.prototype.splitTile=function(O,b,C,R,B,j,K){for(var W=[O,b,C,R],X=this.options,J=X.debug;W.length;){R=W.pop(),C=W.pop(),b=W.pop(),O=W.pop();var pe=1<<b,ve=Yr(b,C,R),he=this.tiles[ve];if(!he&&(J>1&&console.time("creation"),he=this.tiles[ve]=Ti(O,b,C,R,X),this.tileCoords.push({z:b,x:C,y:R}),J)){J>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",b,C,R,he.numFeatures,he.numPoints,he.numSimplified),console.timeEnd("creation"));var Ue="z"+b;this.stats[Ue]=(this.stats[Ue]||0)+1,this.total++}if(he.source=O,B){if(b===X.maxZoom||b===B)continue;var qe=1<<B-b;if(C!==Math.floor(j/qe)||R!==Math.floor(K/qe))continue}else if(b===X.indexMaxZoom||he.numPoints<=X.indexMaxPoints)continue;if(he.source=null,O.length!==0){J>1&&console.time("clipping");var Le,Ke,et,bt,it,ct,wt=.5*X.buffer/X.extent,kt=.5-wt,si=.5+wt,Ut=1+wt;Le=Ke=et=bt=null,it=Oi(O,pe,C-wt,C+si,0,he.minX,he.maxX,X),ct=Oi(O,pe,C+kt,C+Ut,0,he.minX,he.maxX,X),O=null,it&&(Le=Oi(it,pe,R-wt,R+si,1,he.minY,he.maxY,X),Ke=Oi(it,pe,R+kt,R+Ut,1,he.minY,he.maxY,X),it=null),ct&&(et=Oi(ct,pe,R-wt,R+si,1,he.minY,he.maxY,X),bt=Oi(ct,pe,R+kt,R+Ut,1,he.minY,he.maxY,X),ct=null),J>1&&console.timeEnd("clipping"),W.push(Le||[],b+1,2*C,2*R),W.push(Ke||[],b+1,2*C,2*R+1),W.push(et||[],b+1,2*C+1,2*R),W.push(bt||[],b+1,2*C+1,2*R+1)}}},dr.prototype.getTile=function(O,b,C){var R=this.options,B=R.extent,j=R.debug;if(O<0||O>24)return null;var K=1<<O,W=Yr(O,b=(b%K+K)%K,C);if(this.tiles[W])return Tn(this.tiles[W],B);j>1&&console.log("drilling down to z%d-%d-%d",O,b,C);for(var X,J=O,pe=b,ve=C;!X&&J>0;)J--,pe=Math.floor(pe/2),ve=Math.floor(ve/2),X=this.tiles[Yr(J,pe,ve)];return X&&X.source?(j>1&&console.log("found parent tile z%d-%d-%d",J,pe,ve),j>1&&console.time("drilling down"),this.splitTile(X.source,J,pe,ve,O,b,C),j>1&&console.timeEnd("drilling down"),this.tiles[W]?Tn(this.tiles[W],B):null):null};class Sn extends Be{constructor(b,C,R,B){super(b,C,R,Qr),B&&(this.loadGeoJSON=B)}loadData(b,C){var R;(R=this._pendingRequest)===null||R===void 0||R.cancel(),this._pendingCallback&&this._pendingCallback(null,{abandoned:!0});const B=!!(b&&b.request&&b.request.collectResourceTiming)&&new a.RequestPerformance(b.request);this._pendingCallback=C,this._pendingRequest=this.loadGeoJSON(b,(j,K)=>{if(delete this._pendingCallback,delete this._pendingRequest,j||!K)return C(j);if(typeof K!="object")return C(new Error(`Input data given to '${b.source}' is not a valid GeoJSON object.`));{Ye(K,!0);try{if(b.filter){const X=a.createExpression(b.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(X.result==="error")throw new Error(X.value.map(pe=>`${pe.key}: ${pe.message}`).join(", "));const J=K.features.filter(pe=>X.value.evaluate({zoom:0},pe));K={type:"FeatureCollection",features:J}}this._geoJSONIndex=b.cluster?new Xn(function({superclusterOptions:X,clusterProperties:J}){if(!J||!X)return X;const pe={},ve={},he={accumulated:null,zoom:0},Ue={properties:null},qe=Object.keys(J);for(const Le of qe){const[Ke,et]=J[Le],bt=a.createExpression(et),it=a.createExpression(typeof Ke=="string"?[Ke,["accumulated"],["get",Le]]:Ke);pe[Le]=bt.value,ve[Le]=it.value}return X.map=Le=>{Ue.properties=Le;const Ke={};for(const et of qe)Ke[et]=pe[et].evaluate(he,Ue);return Ke},X.reduce=(Le,Ke)=>{Ue.properties=Ke;for(const et of qe)he.accumulated=Le[et],Le[et]=ve[et].evaluate(he,Ue)},X}(b)).load(K.features):function(X,J){return new dr(X,J)}(K,b.geojsonVtOptions)}catch(X){return C(X)}this.loaded={};const W={};if(B){const X=B.finish();X&&(W.resourceTiming={},W.resourceTiming[b.source]=JSON.parse(JSON.stringify(X)))}C(null,W)}})}reloadTile(b,C){const R=this.loaded;return R&&R[b.uid]?super.reloadTile(b,C):this.loadTile(b,C)}loadGeoJSON(b,C){if(b.request)return a.getJSON(b.request,C);if(typeof b.data=="string")try{C(null,JSON.parse(b.data))}catch{C(new Error(`Input data given to '${b.source}' is not a valid GeoJSON object.`))}else C(new Error(`Input data given to '${b.source}' is not a valid GeoJSON object.`));return{cancel:()=>{}}}removeSource(b,C){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),C()}getClusterExpansionZoom(b,C){try{C(null,this._geoJSONIndex.getClusterExpansionZoom(b.clusterId))}catch(R){C(R)}}getClusterChildren(b,C){try{C(null,this._geoJSONIndex.getChildren(b.clusterId))}catch(R){C(R)}}getClusterLeaves(b,C){try{C(null,this._geoJSONIndex.getLeaves(b.clusterId,b.limit,b.offset))}catch(R){C(R)}}}class en{constructor(b){this.self=b,this.actor=new a.Actor(b,this),this.layerIndexes={},this.availableImages={},this.workerSourceTypes={vector:Be,geojson:Sn},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(C,R)=>{if(this.workerSourceTypes[C])throw new Error(`Worker source with name "${C}" already registered.`);this.workerSourceTypes[C]=R},this.self.registerRTLTextPlugin=C=>{if(a.plugin.isParsed())throw new Error("RTL text plugin already registered.");a.plugin.applyArabicShaping=C.applyArabicShaping,a.plugin.processBidirectionalText=C.processBidirectionalText,a.plugin.processStyledBidirectionalText=C.processStyledBidirectionalText}}setReferrer(b,C){this.referrer=C}setImages(b,C,R){this.availableImages[b]=C;for(const B in this.workerSources[b]){const j=this.workerSources[b][B];for(const K in j)j[K].availableImages=C}R()}setLayers(b,C,R){this.getLayerIndex(b).replace(C),R()}updateLayers(b,C,R){this.getLayerIndex(b).update(C.layers,C.removedIds),R()}loadTile(b,C,R){this.getWorkerSource(b,C.type,C.source).loadTile(C,R)}loadDEMTile(b,C,R){this.getDEMWorkerSource(b,C.source).loadTile(C,R)}reloadTile(b,C,R){this.getWorkerSource(b,C.type,C.source).reloadTile(C,R)}abortTile(b,C,R){this.getWorkerSource(b,C.type,C.source).abortTile(C,R)}removeTile(b,C,R){this.getWorkerSource(b,C.type,C.source).removeTile(C,R)}removeDEMTile(b,C){this.getDEMWorkerSource(b,C.source).removeTile(C)}removeSource(b,C,R){if(!this.workerSources[b]||!this.workerSources[b][C.type]||!this.workerSources[b][C.type][C.source])return;const B=this.workerSources[b][C.type][C.source];delete this.workerSources[b][C.type][C.source],B.removeSource!==void 0?B.removeSource(C,R):R()}loadWorkerSource(b,C,R){try{this.self.importScripts(C.url),R()}catch(B){R(B.toString())}}syncRTLPluginState(b,C,R){try{a.plugin.setState(C);const B=a.plugin.getPluginURL();if(a.plugin.isLoaded()&&!a.plugin.isParsed()&&B!=null){this.self.importScripts(B);const j=a.plugin.isParsed();R(j?void 0:new Error(`RTL Text Plugin failed to import scripts from ${B}`),j)}}catch(B){R(B.toString())}}getAvailableImages(b){let C=this.availableImages[b];return C||(C=[]),C}getLayerIndex(b){let C=this.layerIndexes[b];return C||(C=this.layerIndexes[b]=new fe),C}getWorkerSource(b,C,R){if(this.workerSources[b]||(this.workerSources[b]={}),this.workerSources[b][C]||(this.workerSources[b][C]={}),!this.workerSources[b][C][R]){const B={send:(j,K,W)=>{this.actor.send(j,K,W,b)}};this.workerSources[b][C][R]=new this.workerSourceTypes[C](B,this.getLayerIndex(b),this.getAvailableImages(b))}return this.workerSources[b][C][R]}getDEMWorkerSource(b,C){return this.demWorkerSources[b]||(this.demWorkerSources[b]={}),this.demWorkerSources[b][C]||(this.demWorkerSources[b][C]=new tt),this.demWorkerSources[b][C]}enforceCacheSizeLimit(b,C){a.enforceCacheSizeLimit(C)}}return a.isWorker()&&(self.worker=new en(self)),en}),N(["./shared"],function(a){var Q=te;function te(l){return!function(t){return typeof window=="undefined"||typeof document=="undefined"?"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}()?(fe[n=t&&t.failIfMajorPerformanceCaveat]===void 0&&(fe[n]=function(s){var u,p=function(f){var _=document.createElement("canvas"),y=Object.create(te.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{return!1}return!(!u||p.isContextLost())&&(p.shaderSource(u,"void main() {}"),p.compileShader(u),p.getShaderParameter(u,p.COMPILE_STATUS)===!0)}(n)),fe[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}(l)}var fe={};function ue(l,t){if(Array.isArray(l)){if(!Array.isArray(t)||l.length!==t.length)return!1;for(let n=0;n<l.length;n++)if(!ue(l[n],t[n]))return!1;return!0}if(typeof l=="object"&&l!==null&&t!==null){if(typeof t!="object"||Object.keys(l).length!==Object.keys(t).length)return!1;for(const n in l)if(!ue(l[n],t[n]))return!1;return!0}return l===t}te.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0};class ie{static testProp(t){if(!ie.docStyle)return t[0];for(let n=0;n<t.length;n++)if(t[n]in ie.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(){ie.docStyle&&ie.selectProp&&(ie.userSelect=ie.docStyle[ie.selectProp],ie.docStyle[ie.selectProp]="none")}static enableDrag(){ie.docStyle&&ie.selectProp&&(ie.docStyle[ie.selectProp]=ie.userSelect)}static setTransform(t,n){t.style[ie.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",ie.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",ie.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",ie.suppressClickInternal,!0)},0)}static mousePos(t,n){const s=t.getBoundingClientRect();return new a.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 a.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)}}ie.docStyle=typeof window!="undefined"&&window.document&&window.document.documentElement.style,ie.selectProp=ie.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),ie.transformProp=ie.testProp(["transform","WebkitTransform"]);class Ge{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(Ne);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 Ne=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;class Be{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||a.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:S}=s||{x:0,y:0};t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||a.isImageBitmap(t)?y.texSubImage2D(y.TEXTURE_2D,0,v,S,y.RGBA,y.UNSIGNED_BYTE,t):y.texSubImage2D(y.TEXTURE_2D,0,v,S,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 tt(l){const{userImage:t}=l;return!!(t&&t.render&&t.render())&&(l.data.replace(new Uint8Array(t.data.buffer)),!0)}class Ye extends a.Evented{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new a.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 a.ErrorEvent(new Error(`Image "${t}" has invalid "stretchX" value`))),s=!1),this._validateStretch(n.stretchY,n.data&&n.data.height)||(this.fire(new a.ErrorEvent(new Error(`Image "${t}" has invalid "stretchY" value`))),s=!1),this._validateContent(n.content,n)||(this.fire(new a.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 a.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)}:a.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 a.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 Be(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}=a.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,S=v.width,M=v.height;a.RGBAImage.copy(v,u,{x:0,y:0},{x:_,y},{width:S,height:M}),a.RGBAImage.copy(v,u,{x:0,y:M-1},{x:_,y:y-1},{width:S,height:1}),a.RGBAImage.copy(v,u,{x:0,y:0},{x:_,y:y+M},{width:S,height:1}),a.RGBAImage.copy(v,u,{x:S-1,y:0},{x:_-1,y},{width:1,height:M}),a.RGBAImage.copy(v,u,{x:0,y:0},{x:_+S,y},{width:1,height:M})}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||a.warnOnce(`Image with ID: "${n}" was not found`),tt(s)&&this.updateImage(n,s)}}}const Qe=1e20;function pt(l,t,n,s,u,p,f,_,y){for(let v=t;v<t+s;v++)gt(l,n*p+v,p,u,f,_,y);for(let v=n;v<n+u;v++)gt(l,v*p+t,1,s,f,_,y)}function gt(l,t,n,s,u,p,f){p[0]=0,f[0]=-Qe,f[1]=Qe,u[0]=l[t];for(let _=1,y=0,v=0;_<s;_++){u[_]=l[t+_*n];const S=_*_;do{const M=p[y];v=(u[_]-u[M]+S-M*M)/(_-M)/2}while(v<=f[y]&&--y>-1);y++,p[y]=_,f[y]=v,f[y+1]=Qe}for(let _=0,y=0;_<s;_++){for(;f[y+1]<_;)y++;const v=p[y],S=_-v;l[t+_*n]=u[v]+S*S}}class at{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});a.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 S=_.requests[v];S||(S=_.requests[v]=[],at.loadGlyphRange(u,v,this.url,this.requestManager,(M,z)=>{if(z){for(const V in z)this._doesCharSupportLocalGlyph(+V)||(_.glyphs[+V]=z[+V]);_.ranges[v]=!0}for(const V of S)V(M,z);delete _.requests[v]})),S.push((M,z)=>{M?f(M):z&&f(null,{stack:u,id:p,glyph:z[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&&(a.unicodeBlockLookup["CJK Unified Ideographs"](t)||a.unicodeBlockLookup["Hangul Syllables"](t)||a.unicodeBlockLookup.Hiragana(t)||a.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 at.TinySDF({fontSize:24,buffer:3,radius:8,cutoff:.25,fontFamily:u,fontWeight:_})}const f=p.draw(String.fromCharCode(s));return{id:s,bitmap:new a.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}}}}at.loadGlyphRange=function(l,t,n,s,u){const p=256*t,f=p+255,_=s.transformRequest(n.replace("{fontstack}",l).replace("{range}",`${p}-${f}`),a.ResourceType.Glyphs);a.getArrayBuffer(_,(y,v)=>{if(y)u(y);else if(v){const S={};for(const M of a.parseGlyphPbf(v))S[M.id]=M;u(null,S)}})},at.TinySDF=class{constructor({fontSize:l=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=l+4*t,y=this._createCanvas(_),v=this.ctx=y.getContext("2d",{willReadFrequently:!0});v.font=`${f} ${p} ${l}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(l){const t=document.createElement("canvas");return t.width=t.height=l,t}draw(l){const{width:t,actualBoundingBoxAscent:n,actualBoundingBoxDescent:s,actualBoundingBoxLeft:u,actualBoundingBoxRight:p}=this.ctx.measureText(l),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,S=y+2*this.buffer,M=Math.max(v*S,0),z=new Uint8ClampedArray(M),V={data:z,width:v,height:S,glyphWidth:_,glyphHeight:y,glyphTop:f,glyphLeft:0,glyphAdvance:t};if(_===0||y===0)return V;const{ctx:$,buffer:U,gridInner:H,gridOuter:Y}=this;$.clearRect(U,U,_,y),$.fillText(l,U,U+f);const ne=$.getImageData(U,U,_,y);Y.fill(Qe,0,M),H.fill(0,0,M);for(let G=0;G<y;G++)for(let le=0;le<_;le++){const se=ne.data[4*(G*_+le)+3]/255;if(se===0)continue;const me=(G+U)*v+le+U;if(se===1)Y[me]=0,H[me]=Qe;else{const ge=.5-se;Y[me]=ge>0?ge*ge:0,H[me]=ge<0?ge*ge:0}}pt(Y,0,0,v,S,v,this.f,this.v,this.z),pt(H,U,U,_,y,v,this.f,this.v,this.z);for(let G=0;G<M;G++){const le=Math.sqrt(Y[G])-Math.sqrt(H[G]);z[G]=Math.round(255-255*(le/this.radius+this.cutoff))}return V}};const Et=new a.Properties({anchor:new a.DataConstantProperty(a.spec.light.anchor),position:new class{constructor(){this.specification=a.spec.light.position}possiblyEvaluate(l,t){return a.sphericalToCartesian(l.expression.evaluate(t))}interpolate(l,t,n){return{x:a.number(l.x,t.x,n),y:a.number(l.y,t.y,n),z:a.number(l.z,t.z,n)}}},color:new a.DataConstantProperty(a.spec.light.color),intensity:new a.DataConstantProperty(a.spec.light.intensity)}),Ht="-transition";class Jt extends a.Evented{constructor(t){super(),this._transitionable=new a.Transitionable(Et),this.setLight(t),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(t,n={}){if(!this._validate(a.validateLight,t,n))for(const s in t){const u=t[s];s.endsWith(Ht)?this._transitionable.setTransition(s.slice(0,-Ht.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)&&a.emitValidationErrors(this,t.call(a.validateStyle,a.extend({value:n,style:{glyphs:!0,sprite:!0},styleSpec:a.spec})))}}class vr{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 S=t[v];p=y*s,y+=S,f=y*s,u.push({left:p,right:f,isDash:_,zeroLength:S===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 S=Math.abs(v-y.left),M=Math.abs(v-y.right),z=Math.min(S,M);let V;const $=p/s*(u+1);if(y.isDash){const U=u-Math.abs($);V=Math.sqrt(z*z+U*U)}else V=u-Math.sqrt(z*z+$*$);this.data[f+v]=Math.max(0,Math.min(255,V+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),S=Math.min(y,v);this.data[u+_]=Math.max(0,Math.min(255,(f.isDash?S:-S)+128))}}addDash(t,n){const s=n?7:0,u=2*s+1;if(this.nextRow+u>this.height)return a.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 Wi{constructor(t,n){this.workerPool=t,this.actors=[],this.currentActor=0,this.id=a.uniqueId();const s=this.workerPool.acquire(this.id);for(let u=0;u<s.length;u++){const p=new Wi.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){a.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 ur(l,t,n){const s=function(u,p){if(u)return n(u);if(p){const f=a.pick(a.extend(p,l),["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 l.url?a.getJSON(t.transformRequest(l.url,a.ResourceType.Source),s):a.exported.frame(()=>s(null,l))}Wi.Actor=a.Actor;class Hi{constructor(t,n,s){this.bounds=a.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(a.mercatorXfromLng(this.bounds.getWest())*n),u=Math.floor(a.mercatorYfromLat(this.bounds.getNorth())*n),p=Math.ceil(a.mercatorXfromLng(this.bounds.getEast())*n),f=Math.ceil(a.mercatorYfromLat(this.bounds.getSouth())*n);return t.x>=s&&t.x<p&&t.y>=u&&t.y<f}}class Rt extends a.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,a.extend(this,a.pick(n,["url","scheme","tileSize","promoteId"])),this._options=a.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 a.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=ur(this._options,this.map._requestManager,(t,n)=>{this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),t?this.fire(new a.ErrorEvent(t)):n&&(a.extend(this,n),n.bounds&&(this.tileBounds=new Hi(n.bounds,this.minzoom,this.maxzoom)),this.fire(new a.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new a.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 a.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,a.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),a.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 pi extends a.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=a.extend({type:"raster"},n),a.extend(this,a.pick(n,["url","scheme","tileSize"]))}load(){this._loaded=!1,this.fire(new a.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=ur(this._options,this.map._requestManager,(t,n)=>{this._tileJSONRequest=null,this._loaded=!0,t?this.fire(new a.ErrorEvent(t)):n&&(a.extend(this,n),n.bounds&&(this.tileBounds=new Hi(n.bounds,this.minzoom,this.maxzoom)),this.fire(new a.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new a.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 a.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=a.getImage(this.map._requestManager.transformRequest(s,a.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 Be(_,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",a.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 di;class Xe extends pi{constructor(t,n,s,u){super(t,n,s,u),this.type="raster-dem",this.maxzoom=22,this._options=a.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=a.getImage(this.map._requestManager.transformRequest(s,a.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 _=a.isImageBitmap(f)&&(di==null&&(di=typeof OffscreenCanvas!="undefined"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),di)?f:a.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 a.OverscaledTileID(t.overscaledZ,p,n.z,u,n.y).key]={backfilled:!1},y[new a.OverscaledTileID(t.overscaledZ,_,n.z,f,n.y).key]={backfilled:!1},n.y>0&&(y[new a.OverscaledTileID(t.overscaledZ,p,n.z,u,n.y-1).key]={backfilled:!1},y[new a.OverscaledTileID(t.overscaledZ,t.wrap,n.z,n.x,n.y-1).key]={backfilled:!1},y[new a.OverscaledTileID(t.overscaledZ,_,n.z,f,n.y-1).key]={backfilled:!1}),n.y+1<s&&(y[new a.OverscaledTileID(t.overscaledZ,p,n.z,u,n.y+1).key]={backfilled:!1},y[new a.OverscaledTileID(t.overscaledZ,t.wrap,n.z,n.x,n.y+1).key]={backfilled:!1},y[new a.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 Ri extends a.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=a.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=a.EXTENT/this.tileSize;this.workerOptions=a.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:a.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:a.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=a.extend({},this.workerOptions),s=this._data;typeof s=="string"?(n.request=this.map._requestManager.transformRequest(a.exported.resolveURL(s),a.ResourceType.Source),n.request.collectResourceTiming=this._collectResourceTiming):n.data=JSON.stringify(s),this._pendingLoads++,this.fire(new a.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 a.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 a.ErrorEvent(u));const _={dataType:"source",sourceDataType:t};this._collectResourceTiming&&f&&f.length>0&&a.extend(_,{resourceTiming:f}),this.fire(new a.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 a.extend({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var wi=a.createLayout([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class Ci extends a.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 a.Event("dataloading",{dataType:"source"})),this.url=this.options.url,a.getImage(this.map._requestManager.transformRequest(this.url,a.ResourceType.Image),(s,u)=>{this._loaded=!0,s?this.fire(new a.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 a.Event("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(t){this.map=t,this.load()}setCoordinates(t){this.coordinates=t;const n=t.map(a.MercatorCoordinate.fromLngLat);this.tileID=function(u){let p=1/0,f=1/0,_=-1/0,y=-1/0;for(const z of u)p=Math.min(p,z.x),f=Math.min(f,z.y),_=Math.max(_,z.x),y=Math.max(y,z.y);const v=Math.max(_-p,y-f),S=Math.max(0,Math.floor(-Math.log(v)/Math.LN2)),M=Math.pow(2,S);return new a.CanonicalTileID(S,Math.floor((p+_)/2*M),Math.floor((f+y)/2*M))}(n),this.minzoom=this.maxzoom=this.tileID.z;const s=n.map(u=>this.tileID.getTilePoint(u)._round());return this._boundsArray=new a.RasterBoundsArray,this._boundsArray.emplaceBack(s[0].x,s[0].y,0,0),this._boundsArray.emplaceBack(s[1].x,s[1].y,a.EXTENT,0),this._boundsArray.emplaceBack(s[3].x,s[3].y,0,a.EXTENT),this._boundsArray.emplaceBack(s[2].x,s[2].y,a.EXTENT,a.EXTENT),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new a.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,wi.members)),this.boundsSegments||(this.boundsSegments=a.SegmentVector.simpleSegment(0,0,4,2)),this.texture||(this.texture=new Be(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 Ai extends Ci{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,a.ResourceType.Source).url);a.getVideo(this.urls,(n,s)=>{this._loaded=!0,n?this.fire(new a.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 a.ErrorEvent(new a.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,wi.members)),this.boundsSegments||(this.boundsSegments=a.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 Be(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 Kr extends Ci{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 a.ErrorEvent(new a.ValidationError(`sources.${t}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new a.ErrorEvent(new a.ValidationError(`sources.${t}`,null,'missing required property "coordinates"'))),n.animate&&typeof n.animate!="boolean"&&this.fire(new a.ErrorEvent(new a.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 a.ErrorEvent(new a.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 a.ErrorEvent(new a.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 a.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,wi.members)),this.boundsSegments||(this.boundsSegments=a.SegmentVector.simpleSegment(0,0,4,2)),this.texture?(t||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new Be(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 gn={vector:Rt,raster:pi,"raster-dem":Xe,geojson:Ri,video:Ai,image:Ci,canvas:Kr};function _n(l,t){const n=a.create();return a.translate(n,n,[1,1,0]),a.scale(n,n,[.5*l.width,.5*l.height,1]),a.multiply(n,n,l.calculatePosMatrix(t.toUnwrapped()))}function yn(l,t,n,s,u,p){const f=function(M,z,V){if(M)for(const $ of M){const U=z[$];if(U&&U.source===V&&U.type==="fill-extrusion")return!0}else for(const $ in z){const U=z[$];if(U.source===V&&U.type==="fill-extrusion")return!0}return!1}(u&&u.layers,t,l.id),_=p.maxPitchScaleFactor(),y=l.tilesIn(s,_,f);y.sort(hr);const v=[];for(const M of y)v.push({wrappedTileID:M.tileID.wrapped().key,queryResults:M.tile.queryRenderedFeatures(t,n,l._state,M.queryGeometry,M.cameraQueryGeometry,M.scale,u,p,_,_n(l.transform,M.tileID))});const S=function(M){const z={},V={};for(const $ of M){const U=$.queryResults,H=$.wrappedTileID,Y=V[H]=V[H]||{};for(const ne in U){const G=U[ne],le=Y[ne]=Y[ne]||{},se=z[ne]=z[ne]||[];for(const me of G)le[me.featureIndex]||(le[me.featureIndex]=!0,se.push(me))}}return z}(v);for(const M in S)S[M].forEach(z=>{const V=z.feature,$=l.getFeatureState(V.layer["source-layer"],V.id);V.source=V.layer.source,V.layer["source-layer"]&&(V.sourceLayer=V.layer["source-layer"]),V.state=$});return S}function hr(l,t){const n=l.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 Dr{constructor(t,n){this.tileID=t,this.uid=a.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<a.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(S=>S.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 a.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 a.SymbolBucket&&p.hasRTLText){this.hasRTLText=!0,a.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 a.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 Be(t,this.imageAtlas.image,n.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new Be(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,S){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:u,cameraQueryGeometry:p,scale:f,tileSize:this.tileSize,pixelPosMatrix:S,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 _=a.createFilter(n&&n.filter),{z:y,x:v,y:S}=this.tileID.canonical,M={z:y,x:v,y:S};for(let z=0;z<f.length;z++){const V=f.feature(z);if(_.needGeometry){const H=a.toEvaluationFeature(V,!0);if(!_.filter(new a.EvaluationParameters(this.tileID.overscaledZ),H,this.tileID.canonical))continue}else if(!_.filter(new a.EvaluationParameters(this.tileID.overscaledZ),V))continue;const $=s.getId(V,p),U=new a.GeoJSONFeature(V,y,v,S,$);U.tile=M,t.push(U)}}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=a.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<a.exported.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(t){this.symbolFadeHoldUntil=a.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 Lr{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 Rr{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]||{},a.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=a.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]={}),a.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]||{},a.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 Mi extends a.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 gn[p.type](u,p,f,_);if(y.id!==u)throw new Error(`Expected Source id to be ${u} instead of ${y.id}`);return a.bindAll(["load","abort","unload","serialize","prepare"],y),y}(t,n,s,this),this._tiles={},this._cache=new Lr(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new Rr}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 a.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(xn).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 a.pointGeometry(p.canonical.x,p.canonical.y)._rotate(this.transform.angle),y=new a.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(xn).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 a.ErrorEvent(u,{tile:t})):this.update(this.transform,this.terrain));t.timeAdded=a.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 a.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 a.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-Mi.maxOverzooming,this._source.minzoom),f=Math.max(u+Mi.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const v={};for(const S of s)if(S.canonical.z>this._source.minzoom){const M=S.scaledTo(S.canonical.z-1);v[M.key]=M;const z=S.scaledTo(Math.max(this._source.minzoom,Math.min(S.canonical.z,5)));v[z.key]=z}s=s.concat(Object.values(v))}const _=this._updateRetainedTiles(s,u);if(jn(this._source.type)){const v={},S={},M=Object.keys(_);for(const z of M){const V=_[z],$=this._tiles[z];if(!$||$.fadeEndTime&&$.fadeEndTime<=a.exported.now())continue;const U=this.findLoadedParent(V,p);U&&(this._addTile(U.tileID),v[U.tileID.key]=U.tileID),S[z]=V}this._retainLoadedChildren(S,u,f,_);for(const z in v)_[z]||(this._coveredTiles[z]=!0,_[z]=v[z]);if(n){const z={},V={};for(const $ of s)this._tiles[$.key].hasData()?z[$.key]=$:V[$.key]=$;for(const $ in V){const U=V[$].children(this._source.maxzoom);this._tiles[U[0].key]&&this._tiles[U[1].key]&&this._tiles[U[2].key]&&this._tiles[U[3].key]&&(z[U[0].key]=_[U[0].key]=U[0],z[U[1].key]=_[U[1].key]=U[1],z[U[2].key]=_[U[2].key]=U[2],z[U[3].key]=_[U[3].key]=U[3],delete V[$])}for(const $ in V){const U=this.findLoadedParent(V[$],this._source.minzoom);if(U){z[U.tileID.key]=_[U.tileID.key]=U.tileID;for(const H in z)z[H].isChildOf(U.tileID)&&delete z[H]}}for(const $ in this._tiles)z[$]||(this._coveredTiles[$]=!0)}}for(const v in _)this._tiles[v].clearFadeHold();const y=a.keysDifference(this._tiles,_);for(const v of y){const S=this._tiles[v];S.hasSymbolBuckets&&!S.holdingForFade()?S.setHoldDuration(this.map._fadeDuration):S.hasSymbolBuckets&&!S.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-Mi.maxOverzooming,this._source.minzoom),f=Math.max(n+Mi.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 M=y.children(this._source.maxzoom)[0],z=this.getTile(M);if(z&&z.hasData()){s[M.key]=M;continue}}else{const M=y.children(this._source.maxzoom);if(s[M[0].key]&&s[M[1].key]&&s[M[2].key]&&s[M[3].key])continue}let S=v.wasRequested();for(let M=y.overscaledZ-1;M>=p;--M){const z=y.scaledTo(M);if(u[z.key]||(u[z.key]=!0,v=this.getTile(z),!v&&S&&(v=this._addTile(z)),v&&(s[z.key]=z,S=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 Dr(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 a.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($=>p.pointCoordinate($,this.terrain)),y=f.map($=>p.pointCoordinate($,this.terrain)),v=this.getIds();let S=1/0,M=1/0,z=-1/0,V=-1/0;for(const $ of y)S=Math.min(S,$.x),M=Math.min(M,$.y),z=Math.max(z,$.x),V=Math.max(V,$.y);for(let $=0;$<v.length;$++){const U=this._tiles[v[$]];if(U.holdingForFade())continue;const H=U.tileID,Y=Math.pow(2,p.zoom-U.tileID.overscaledZ),ne=n*U.queryPadding*a.EXTENT/U.tileSize/Y,G=[H.getTilePoint(new a.MercatorCoordinate(S,M)),H.getTilePoint(new a.MercatorCoordinate(z,V))];if(G[0].x-ne<a.EXTENT&&G[0].y-ne<a.EXTENT&&G[1].x+ne>=0&&G[1].y+ne>=0){const le=_.map(me=>H.getTilePoint(me)),se=y.map(me=>H.getTilePoint(me));u.push({tile:U,tileID:H,queryGeometry:le,cameraQueryGeometry:se,scale:Y})}}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(jn(this._source.type))for(const t in this._tiles){const n=this._tiles[t];if(n.fadeEndTime!==void 0&&n.fadeEndTime>=a.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 xn(l,t){const n=Math.abs(2*l.wrap)-+(l.wrap<0),s=Math.abs(2*t.wrap)-+(t.wrap<0);return l.overscaledZ-t.overscaledZ||s-n||t.canonical.y-l.canonical.y||t.canonical.x-l.canonical.x}function jn(l){return l==="raster"||l==="image"||l==="video"}Mi.maxOverzooming=10,Mi.maxUnderzooming=3;const br="mapboxgl_preloaded_worker_pool";class Bi{constructor(){this.active={}}acquire(t){if(!this.workers)for(this.workers=[];this.workers.length<Bi.workerCount;)this.workers.push(new Worker(sn.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[br]}numActive(){return Object.keys(this.active).length}}const Xn=Math.floor(a.exported.hardwareConcurrency/2);let Br;function vn(){return Br||(Br=new Bi),Br}function bn(l,t){const n={};for(const s in l)s!=="ref"&&(n[s]=l[s]);return a.refProperties.forEach(s=>{s in t&&(n[s]=t[s])}),n}function Wn(l){l=l.slice();const t=Object.create(null);for(let n=0;n<l.length;n++)t[l[n].id]=l[n];for(let n=0;n<l.length;n++)"ref"in l[n]&&(l[n]=bn(l[n],t[l[n].ref]));return l}Bi.workerCount=Math.max(Math.min(Xn,6),1);const xt={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 pr(l,t,n){n.push({command:xt.addSource,args:[l,t[l]]})}function Fr(l,t,n){t.push({command:xt.removeSource,args:[l]}),n[l]=!0}function Or(l,t,n,s){Fr(l,n,s),pr(l,t,n)}function Hn(l,t,n){let s;for(s in l[n])if(Object.prototype.hasOwnProperty.call(l[n],s)&&s!=="data"&&!ue(l[n][s],t[n][s]))return!1;for(s in t[n])if(Object.prototype.hasOwnProperty.call(t[n],s)&&s!=="data"&&!ue(l[n][s],t[n][s]))return!1;return!0}function wr(l,t,n,s,u,p){let f;for(f in t=t||{},l=l||{})Object.prototype.hasOwnProperty.call(l,f)&&(ue(l[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(l,f)&&(ue(l[f],t[f])||n.push({command:p,args:[s,f,t[f],u]}))}function Tr(l){return l.id}function wn(l,t){return l[t.id]=t,l}class Er{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=a.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 _e(l,t){let n=!0;return l==="always"||l!=="never"&&t!=="never"||(n=!1),n}class Me{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 S=this.circles[3*v],M=this.circles[3*v+1],z=this.circles[3*v+2];y.push({key:this.circleKeys[v],x1:S-z,y1:M-z,x2:S+z,y2:M+z})}}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 S=[];return this._forEachCell(f,y,_,v,this._queryCellCircle,S,{hitTest:!0,overlapMode:u,circle:{x:t,y:n,radius:s},seenUids:{box:{},circle:{}}},p),S.length>0}_queryCell(t,n,s,u,p,f,_,y){const{seenUids:v,hitTest:S,overlapMode:M}=_,z=this.boxCells[p];if(z!==null){const $=this.bboxes;for(const U of z)if(!v.box[U]){v.box[U]=!0;const H=4*U,Y=this.boxKeys[U];if(t<=$[H+2]&&n<=$[H+3]&&s>=$[H+0]&&u>=$[H+1]&&(!y||y(Y))&&(!S||!_e(M,Y.overlapMode))&&(f.push({key:Y,x1:$[H],y1:$[H+1],x2:$[H+2],y2:$[H+3]}),S))return!0}}const V=this.circleCells[p];if(V!==null){const $=this.circles;for(const U of V)if(!v.circle[U]){v.circle[U]=!0;const H=3*U,Y=this.circleKeys[U];if(this._circleAndRectCollide($[H],$[H+1],$[H+2],t,n,s,u)&&(!y||y(Y))&&(!S||!_e(M,Y.overlapMode))){const ne=$[H],G=$[H+1],le=$[H+2];if(f.push({key:Y,x1:ne-le,y1:G-le,x2:ne+le,y2:G+le}),S)return!0}}}return!1}_queryCellCircle(t,n,s,u,p,f,_,y){const{circle:v,seenUids:S,overlapMode:M}=_,z=this.boxCells[p];if(z!==null){const $=this.bboxes;for(const U of z)if(!S.box[U]){S.box[U]=!0;const H=4*U,Y=this.boxKeys[U];if(this._circleAndRectCollide(v.x,v.y,v.radius,$[H+0],$[H+1],$[H+2],$[H+3])&&(!y||y(Y))&&!_e(M,Y.overlapMode))return f.push(!0),!0}}const V=this.circleCells[p];if(V!==null){const $=this.circles;for(const U of V)if(!S.circle[U]){S.circle[U]=!0;const H=3*U,Y=this.circleKeys[U];if(this._circlesCollide($[H],$[H+1],$[H+2],v.x,v.y,v.radius)&&(!y||y(Y))&&!_e(M,Y.overlapMode))return f.push(!0),!0}}}_forEachCell(t,n,s,u,p,f,_,y){const v=this._convertToXCellCoord(t),S=this._convertToYCellCoord(n),M=this._convertToXCellCoord(s),z=this._convertToYCellCoord(u);for(let V=v;V<=M;V++)for(let $=S;$<=z;$++)if(p.call(this,t,n,s,u,this.xCellCount*$+V,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 S=(_-p)/2,M=Math.abs(n-(p+S));if(M>S+s)return!1;if(v<=y||M<=S)return!0;const z=v-y,V=M-S;return z*z+V*V<=s*s}}function Jr(l,t,n,s,u){const p=a.create();return t?(a.scale(p,p,[1/u,1/u,1]),n||a.rotateZ(p,p,s.angle)):a.multiply(p,s.labelPlaneMatrix,l),p}function ir(l,t,n,s,u){if(t){const p=a.clone(l);return a.scale(p,p,[u,u,1]),n||a.rotateZ(p,p,-s.angle),p}return s.glCoordMatrix}function vt(l,t,n){let s;n?(s=[l.x,l.y,n(l.x,l.y),1],a.transformMat4(s,s,t)):(s=[l.x,l.y,0,1],Sr(s,s,t));const u=s[3];return{point:new a.pointGeometry(s[0]/u,s[1]/u),signedDistanceFromCamera:u}}function Ki(l,t){return .5+l/t*.5}function Fi(l,t){const n=l[0]/l[3],s=l[1]/l[3];return n>=-t[0]&&n<=t[0]&&s>=-t[1]&&s<=t[1]}function Oi(l,t,n,s,u,p,f,_,y,v){const S=s?l.textSizeData:l.iconSizeData,M=a.evaluateSizeForZoom(S,n.transform.zoom),z=[256/n.width*2+1,256/n.height*2+1],V=s?l.text.dynamicLayoutVertexArray:l.icon.dynamicLayoutVertexArray;V.clear();const $=l.lineVertexArray,U=s?l.text.placedSymbolArray:l.icon.placedSymbolArray,H=n.transform.width/n.transform.height;let Y=!1;for(let ne=0;ne<U.length;ne++){const G=U.get(ne);if(G.hidden||G.writingMode===a.WritingMode.vertical&&!Y){rt(G.numGlyphs,V);continue}let le;if(Y=!1,v?(le=[G.anchorX,G.anchorY,v(G.anchorX,G.anchorY),1],a.transformMat4(le,le,t)):(le=[G.anchorX,G.anchorY,0,1],Sr(le,le,t)),!Fi(le,z)){rt(G.numGlyphs,V);continue}const se=Ki(n.transform.cameraToCenterDistance,le[3]),me=a.evaluateSizeForFeature(S,M,G),ge=f?me/se:me*se,be=new a.pointGeometry(G.anchorX,G.anchorY),de=vt(be,u,v).point,Re={},Ie=lt(G,ge,!1,_,t,u,p,l.glyphOffsetArray,$,V,de,be,Re,H,y,v);Y=Ie.useVertical,(Ie.notEnoughRoom||Y||Ie.needsFlipping&&lt(G,ge,!0,_,t,u,p,l.glyphOffsetArray,$,V,de,be,Re,H,y,v).notEnoughRoom)&&rt(G.numGlyphs,V)}s?l.text.dynamicLayoutVertexBuffer.updateData(V):l.icon.dynamicLayoutVertexBuffer.updateData(V)}function $r(l,t,n,s,u,p,f,_,y,v,S,M,z){const V=_.glyphStartIndex+_.numGlyphs,$=_.lineStartIndex,U=_.lineStartIndex+_.lineLength,H=t.getoffsetX(_.glyphStartIndex),Y=t.getoffsetX(V-1),ne=fi(l*H,n,s,u,p,f,_.segment,$,U,y,v,S,M,z);if(!ne)return null;const G=fi(l*Y,n,s,u,p,f,_.segment,$,U,y,v,S,M,z);return G?{first:ne,last:G}:null}function Se(l,t,n,s){return l===a.WritingMode.horizontal&&Math.abs(n.y-t.y)>Math.abs(n.x-t.x)*s?{useVertical:!0}:(l===a.WritingMode.vertical?t.y<n.y:t.x>n.x)?{needsFlipping:!0}:null}function lt(l,t,n,s,u,p,f,_,y,v,S,M,z,V,$,U){const H=t/24,Y=l.lineOffsetX*H,ne=l.lineOffsetY*H;let G;if(l.numGlyphs>1){const le=l.glyphStartIndex+l.numGlyphs,se=l.lineStartIndex,me=l.lineStartIndex+l.lineLength,ge=$r(H,_,Y,ne,n,S,M,l,y,p,z,$,U);if(!ge)return{notEnoughRoom:!0};const be=vt(ge.first.point,f,U).point,de=vt(ge.last.point,f,U).point;if(s&&!n){const Re=Se(l.writingMode,be,de,V);if(Re)return Re}G=[ge.first];for(let Re=l.glyphStartIndex+1;Re<le-1;Re++)G.push(fi(H*_.getoffsetX(Re),Y,ne,n,S,M,l.segment,se,me,y,p,z,$,U));G.push(ge.last)}else{if(s&&!n){const se=vt(M,u,U).point,me=l.lineStartIndex+l.segment+1,ge=new a.pointGeometry(y.getx(me),y.gety(me)),be=vt(ge,u,U),de=be.signedDistanceFromCamera>0?be.point:ot(M,ge,se,1,u,U),Re=Se(l.writingMode,se,de,V);if(Re)return Re}const le=fi(H*_.getoffsetX(l.glyphStartIndex),Y,ne,n,S,M,l.segment,l.lineStartIndex,l.lineStartIndex+l.lineLength,y,p,z,$,U);if(!le)return{notEnoughRoom:!0};G=[le]}for(const le of G)a.addDynamicAttributes(v,le.point,le.angle);return{}}function ot(l,t,n,s,u,p){const f=vt(l.add(l.sub(t)._unit()),u,p).point,_=n.sub(f);return n.add(_._mult(s/_.mag()))}function fi(l,t,n,s,u,p,f,_,y,v,S,M,z,V){const $=s?l-t:l+t;let U=$>0?1:-1,H=0;s&&(U*=-1,H=Math.PI),U<0&&(H+=Math.PI);let Y=U>0?_+f:_+f+1,ne=u,G=u,le=0,se=0;const me=Math.abs($),ge=[];for(;le+se<=me;){if(Y+=U,Y<_||Y>=y)return null;if(G=ne,ge.push(ne),ne=M[Y],ne===void 0){const Fe=new a.pointGeometry(v.getx(Y),v.gety(Y)),st=vt(Fe,S,V);if(st.signedDistanceFromCamera>0)ne=M[Y]=st.point;else{const ut=Y-U;ne=ot(le===0?p:new a.pointGeometry(v.getx(ut),v.gety(ut)),Fe,G,me-le+1,S,V)}}le+=se,se=G.dist(ne)}const be=(me-le)/se,de=ne.sub(G),Re=de.mult(be)._add(G);Re._add(de._unit()._perp()._mult(n*U));const Ie=H+Math.atan2(ne.y-G.y,ne.x-G.x);return ge.push(Re),{point:Re,angle:z?Ie:0,path:ge}}const Ur=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function rt(l,t){for(let n=0;n<l;n++){const s=t.length;t.resize(s+4),t.float32.set(Ur,3*s)}}function Sr(l,t,n){const s=t[0],u=t[1];return l[0]=n[0]*s+n[4]*u+n[12],l[1]=n[1]*s+n[5]*u+n[13],l[3]=n[3]*s+n[7]*u+n[15],l}const oi=100;class Tn{constructor(t,n=new Me(t.width+200,t.height+200,25),s=new Me(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+oi,this.screenBottomBoundary=t.height+oi,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,S=t.y1*y+_.point.y,M=t.x2*y+_.point.x,z=t.y2*y+_.point.y;return!this.isInsideGrid(v,S,M,z)||n!=="always"&&this.grid.hitTest(v,S,M,z,n,p)||_.perspectiveRatio<this.perspectiveRatioCutoff?{box:[],offscreen:!1}:{box:[v,S,M,z],offscreen:this.isOffscreen(v,S,M,z)}}placeCollisionCircles(t,n,s,u,p,f,_,y,v,S,M,z,V,$){const U=[],H=new a.pointGeometry(n.anchorX,n.anchorY),Y=vt(H,f,$),ne=Ki(this.transform.cameraToCenterDistance,Y.signedDistanceFromCamera),G=(S?p/ne:p*ne)/a.ONE_EM,le=vt(H,_,$).point,se=$r(G,u,n.lineOffsetX*G,n.lineOffsetY*G,!1,le,H,n,s,_,{},!1,$);let me=!1,ge=!1,be=!0;if(se){const de=.5*z*ne+V,Re=new a.pointGeometry(-100,-100),Ie=new a.pointGeometry(this.screenRightBoundary,this.screenBottomBoundary),Fe=new Er,st=se.first,ut=se.last;let We=[];for(let _t=st.path.length-1;_t>=1;_t--)We.push(st.path[_t]);for(let _t=1;_t<ut.path.length;_t++)We.push(ut.path[_t]);const At=2.5*de;if(y){const _t=We.map(Tt=>vt(Tt,y,$));We=_t.some(Tt=>Tt.signedDistanceFromCamera<=0)?[]:_t.map(Tt=>Tt.point)}let Mt=[];if(We.length>0){const _t=We[0].clone(),Tt=We[0].clone();for(let zt=1;zt<We.length;zt++)_t.x=Math.min(_t.x,We[zt].x),_t.y=Math.min(_t.y,We[zt].y),Tt.x=Math.max(Tt.x,We[zt].x),Tt.y=Math.max(Tt.y,We[zt].y);Mt=_t.x>=Re.x&&Tt.x<=Ie.x&&_t.y>=Re.y&&Tt.y<=Ie.y?[We]:Tt.x<Re.x||_t.x>Ie.x||Tt.y<Re.y||_t.y>Ie.y?[]:a.clipLine([We],Re.x,Re.y,Ie.x,Ie.y)}for(const _t of Mt){Fe.reset(_t,.25*de);let Tt=0;Tt=Fe.length<=.5*de?1:Math.ceil(Fe.paddedLength/At)+1;for(let zt=0;zt<Tt;zt++){const ai=zt/Math.max(Tt-1,1),gr=Fe.lerp(ai),nr=gr.x+oi,_r=gr.y+oi;U.push(nr,_r,de,0);const Xr=nr-de,Yi=_r-de,zi=nr+de,Ar=_r+de;if(be=be&&this.isOffscreen(Xr,Yi,zi,Ar),ge=ge||this.isInsideGrid(Xr,Yi,zi,Ar),t!=="always"&&this.grid.hitTestCircle(nr,_r,de,t,M)&&(me=!0,!v))return{circles:[],offscreen:!1,collisionDetected:me}}}}return{circles:!v&&me||!ge||ne<this.perspectiveRatioCutoff?[]:U,offscreen:be,collisionDetected:me}}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 S of t){const M=new a.pointGeometry(S.x+oi,S.y+oi);s=Math.min(s,M.x),u=Math.min(u,M.y),p=Math.max(p,M.x),f=Math.max(f,M.y),n.push(M)}const _=this.grid.query(s,u,p,f).concat(this.ignoredGrid.query(s,u,p,f)),y={},v={};for(const S of _){const M=S.key;if(y[M.bucketInstanceId]===void 0&&(y[M.bucketInstanceId]={}),y[M.bucketInstanceId][M.featureIndex])continue;const z=[new a.pointGeometry(S.x1,S.y1),new a.pointGeometry(S.x2,S.y1),new a.pointGeometry(S.x2,S.y2),new a.pointGeometry(S.x1,S.y2)];a.polygonIntersectsPolygon(n,z)&&(y[M.bucketInstanceId][M.featureIndex]=!0,v[M.bucketInstanceId]===void 0&&(v[M.bucketInstanceId]=[]),v[M.bucketInstanceId].push(M.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],a.transformMat4(p,p,t)):(p=[n,s,0,1],Sr(p,p,t)),{point:new a.pointGeometry((p[0]/p[3]+1)/2*this.transform.width+oi,(-p[1]/p[3]+1)/2*this.transform.height+oi),perspectiveRatio:.5+this.transform.cameraToCenterDistance/p[3]*.5}}isOffscreen(t,n,s,u){return s<oi||t>=this.screenRightBoundary||u<oi||n>this.screenBottomBoundary}isInsideGrid(t,n,s,u){return s>=0&&t<this.gridRightBoundary&&u>=0&&n<this.gridBottomBoundary}getViewportMatrix(){const t=a.identity([]);return a.translate(t,t,[-100,-100,0]),t}}function Yt(l,t,n){return t*(a.EXTENT/(l.tileSize*Math.pow(2,n-l.tileID.overscaledZ)))}class Ti{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 Pt{constructor(t,n,s,u,p){this.text=new Ti(t?t.text:null,n,s,p),this.icon=new Ti(t?t.icon:null,n,u,p)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class En{constructor(t,n,s){this.text=t,this.icon=n,this.skipFade=s}}class dr{constructor(){this.invProjMatrix=a.create(),this.viewportMatrix=a.create(),this.circles=[]}}class Yr{constructor(t,n,s,u,p){this.bucketInstanceId=t,this.featureIndex=n,this.sourceLayerIndex=s,this.bucketIndex=u,this.tileID=p}}class Qr{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 Sn(l,t,n,s,u){const{horizontalAlign:p,verticalAlign:f}=a.getAnchorAlignment(l),_=-(p-.5)*t,y=-(f-.5)*n,v=a.evaluateVariableOffset(l,s);return new a.pointGeometry(_+v[0]*u,y+v[1]*u)}function en(l,t,n,s,u,p){const{x1:f,x2:_,y1:y,y2:v,anchorPointX:S,anchorPointY:M}=l,z=new a.pointGeometry(t,n);return s&&z._rotate(u?p:-p),{x1:f+z.x,y1:y+z.y,x2:_+z.x,y2:v+z.y,anchorPointX:S,anchorPointY:M}}class O{constructor(t,n,s,u,p){this.transform=t.clone(),this.terrain=n,this.collisionIndex=new Tn(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=s,this.retainedQueryData={},this.collisionGroups=new Qr(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),S=s.tileSize/a.EXTENT,M=this.transform.calculatePosMatrix(s.tileID.toUnwrapped()),z=y.get("text-pitch-alignment")==="map",V=y.get("text-rotation-alignment")==="map",$=Yt(s,1,this.transform.zoom),U=Jr(M,z,V,this.transform,$);let H=null;if(z){const ne=ir(M,z,V,this.transform,$);H=a.multiply([],this.transform.labelPlaneMatrix,ne)}this.retainedQueryData[p.bucketInstanceId]=new Yr(p.bucketInstanceId,f,p.sourceLayerIndex,p.index,s.tileID);const Y={bucket:p,layout:y,posMatrix:M,textLabelPlaneMatrix:U,labelToScreenMatrix:H,scale:v,textPixelRatio:S,holdingForFade:s.holdingForFade(),collisionBoxArray:_,partiallyEvaluatedTextSize:a.evaluateSizeForZoom(p.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(p.sourceID)};if(u)for(const ne of p.sortKeyRanges){const{sortKey:G,symbolInstanceStart:le,symbolInstanceEnd:se}=ne;t.push({sortKey:G,symbolInstanceStart:le,symbolInstanceEnd:se,parameters:Y})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:p.symbolInstances.length,parameters:Y})}attemptAnchorPlacement(t,n,s,u,p,f,_,y,v,S,M,z,V,$,U,H){const Y=[z.textOffset0,z.textOffset1],ne=Sn(t,s,u,Y,p),G=this.collisionIndex.placeCollisionBox(en(n,ne.x,ne.y,f,_,this.transform.angle),M,y,v,S.predicate,H);if((!U||this.collisionIndex.placeCollisionBox(en(U,ne.x,ne.y,f,_,this.transform.angle),M,y,v,S.predicate,H).box.length!==0)&&G.box.length>0){let le;if(this.prevPlacement&&this.prevPlacement.variableOffsets[z.crossTileID]&&this.prevPlacement.placements[z.crossTileID]&&this.prevPlacement.placements[z.crossTileID].text&&(le=this.prevPlacement.variableOffsets[z.crossTileID].anchor),z.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[z.crossTileID]={textOffset:Y,width:s,height:u,anchor:t,textBoxScale:p,prevAnchor:le},this.markUsedJustification(V,t,z,$),V.allowVerticalPlacement&&(this.markUsedOrientation(V,$,z),this.placedOrientations[z.crossTileID]=$),{shift:ne,placedGlyphBoxes:G}}}placeLayerBucketPart(t,n,s){const{bucket:u,layout:p,posMatrix:f,textLabelPlaneMatrix:_,labelToScreenMatrix:y,textPixelRatio:v,holdingForFade:S,collisionBoxArray:M,partiallyEvaluatedTextSize:z,collisionGroup:V}=t.parameters,$=p.get("text-optional"),U=p.get("icon-optional"),H=a.getOverlapMode(p,"text-overlap","text-allow-overlap"),Y=H==="always",ne=a.getOverlapMode(p,"icon-overlap","icon-allow-overlap"),G=ne==="always",le=p.get("text-rotation-alignment")==="map",se=p.get("text-pitch-alignment")==="map",me=p.get("icon-text-fit")!=="none",ge=p.get("symbol-z-order")==="viewport-y",be=Y&&(G||!u.hasIconData()||U),de=G&&(Y||!u.hasTextData()||$);!u.collisionArrays&&M&&u.deserializeCollisionBoxes(M);const Re=(Ie,Fe)=>{if(n[Ie.crossTileID])return;if(S)return void(this.placements[Ie.crossTileID]=new En(!1,!1,!1));let st=!1,ut=!1,We=!0,At=null,Mt={box:null,offscreen:null},_t={box:null,offscreen:null},Tt=null,zt=null,ai=null,gr=0,nr=0,_r=0;Fe.textFeatureIndex?gr=Fe.textFeatureIndex:Ie.useRuntimeCollisionCircles&&(gr=Ie.featureIndex),Fe.verticalTextFeatureIndex&&(nr=Fe.verticalTextFeatureIndex);const Xr=this.retainedQueryData[u.bucketInstanceId].tileID,Yi=this.terrain?(ii,dt)=>this.terrain.getElevation(Xr,ii,dt):null;for(const ii of["textBox","verticalTextBox","iconBox","verticalIconBox"]){const dt=Fe[ii];dt&&(dt.elevation=Yi?Yi(dt.anchorPointX,dt.anchorPointY):0)}const zi=Fe.textBox;if(zi){const ii=Ct=>{let li=a.WritingMode.horizontal;if(u.allowVerticalPlacement&&!Ct&&this.prevPlacement){const ci=this.prevPlacement.placedOrientations[Ie.crossTileID];ci&&(this.placedOrientations[Ie.crossTileID]=ci,li=ci,this.markUsedOrientation(u,li,Ie))}return li},dt=(Ct,li)=>{if(u.allowVerticalPlacement&&Ie.numVerticalGlyphVertices>0&&Fe.verticalTextBox){for(const ci of u.writingModes)if(ci===a.WritingMode.vertical?(Mt=li(),_t=Mt):Mt=Ct(),Mt&&Mt.box&&Mt.box.length)break}else Mt=Ct()};if(p.get("text-variable-anchor")){let Ct=p.get("text-variable-anchor");if(this.prevPlacement&&this.prevPlacement.variableOffsets[Ie.crossTileID]){const qt=this.prevPlacement.variableOffsets[Ie.crossTileID];Ct.indexOf(qt.anchor)>0&&(Ct=Ct.filter(Qi=>Qi!==qt.anchor),Ct.unshift(qt.anchor))}const li=(qt,Qi,an)=>{const $s=qt.x2-qt.x1,On=qt.y2-qt.y1,Ka=Ie.textBoxScale,Us=me&&ne==="never"?Qi:null;let Wr={box:[],offscreen:!1};const ln=H!=="never"?2*Ct.length:Ct.length;for(let cn=0;cn<ln;++cn){const Ho=this.attemptAnchorPlacement(Ct[cn%Ct.length],qt,$s,On,Ka,le,se,v,f,V,cn>=Ct.length?H:"never",Ie,u,an,Us,Yi);if(Ho&&(Wr=Ho.placedGlyphBoxes,Wr&&Wr.box&&Wr.box.length)){st=!0,At=Ho.shift;break}}return Wr};dt(()=>li(zi,Fe.iconBox,a.WritingMode.horizontal),()=>{const qt=Fe.verticalTextBox;return u.allowVerticalPlacement&&!(Mt&&Mt.box&&Mt.box.length)&&Ie.numVerticalGlyphVertices>0&&qt?li(qt,Fe.verticalIconBox,a.WritingMode.vertical):{box:null,offscreen:null}}),Mt&&(st=Mt.box,We=Mt.offscreen);const ci=ii(Mt&&Mt.box);if(!st&&this.prevPlacement){const qt=this.prevPlacement.variableOffsets[Ie.crossTileID];qt&&(this.variableOffsets[Ie.crossTileID]=qt,this.markUsedJustification(u,qt.anchor,Ie,ci))}}else{const Ct=(li,ci)=>{const qt=this.collisionIndex.placeCollisionBox(li,H,v,f,V.predicate,Yi);return qt&&qt.box&&qt.box.length&&(this.markUsedOrientation(u,ci,Ie),this.placedOrientations[Ie.crossTileID]=ci),qt};dt(()=>Ct(zi,a.WritingMode.horizontal),()=>{const li=Fe.verticalTextBox;return u.allowVerticalPlacement&&Ie.numVerticalGlyphVertices>0&&li?Ct(li,a.WritingMode.vertical):{box:null,offscreen:null}}),ii(Mt&&Mt.box&&Mt.box.length)}}if(Tt=Mt,st=Tt&&Tt.box&&Tt.box.length>0,We=Tt&&Tt.offscreen,Ie.useRuntimeCollisionCircles){const ii=u.text.placedSymbolArray.get(Ie.centerJustifiedTextSymbolIndex),dt=a.evaluateSizeForFeature(u.textSizeData,z,ii),Ct=p.get("text-padding");zt=this.collisionIndex.placeCollisionCircles(H,ii,u.lineVertexArray,u.glyphOffsetArray,dt,f,_,y,s,se,V.predicate,Ie.collisionCircleDiameter,Ct,Yi),zt.circles.length&&zt.collisionDetected&&!s&&a.warnOnce("Collisions detected, but collision boxes are not shown"),st=Y||zt.circles.length>0&&!zt.collisionDetected,We=We&&zt.offscreen}if(Fe.iconFeatureIndex&&(_r=Fe.iconFeatureIndex),Fe.iconBox){const ii=dt=>{const Ct=me&&At?en(dt,At.x,At.y,le,se,this.transform.angle):dt;return this.collisionIndex.placeCollisionBox(Ct,ne,v,f,V.predicate,Yi)};_t&&_t.box&&_t.box.length&&Fe.verticalIconBox?(ai=ii(Fe.verticalIconBox),ut=ai.box.length>0):(ai=ii(Fe.iconBox),ut=ai.box.length>0),We=We&&ai.offscreen}const Ar=$||Ie.numHorizontalGlyphVertices===0&&Ie.numVerticalGlyphVertices===0,Wo=U||Ie.numIconVertices===0;if(Ar||Wo?Wo?Ar||(ut=ut&&st):st=ut&&st:ut=st=ut&&st,st&&Tt&&Tt.box&&this.collisionIndex.insertCollisionBox(Tt.box,H,p.get("text-ignore-placement"),u.bucketInstanceId,_t&&_t.box&&nr?nr:gr,V.ID),ut&&ai&&this.collisionIndex.insertCollisionBox(ai.box,ne,p.get("icon-ignore-placement"),u.bucketInstanceId,_r,V.ID),zt&&(st&&this.collisionIndex.insertCollisionCircles(zt.circles,H,p.get("text-ignore-placement"),u.bucketInstanceId,gr,V.ID),s)){const ii=u.bucketInstanceId;let dt=this.collisionCircleArrays[ii];dt===void 0&&(dt=this.collisionCircleArrays[ii]=new dr);for(let Ct=0;Ct<zt.circles.length;Ct+=4)dt.circles.push(zt.circles[Ct+0]),dt.circles.push(zt.circles[Ct+1]),dt.circles.push(zt.circles[Ct+2]),dt.circles.push(zt.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 En(st||be,ut||de,We||u.justReloaded),n[Ie.crossTileID]=!0};if(ge){if(t.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");const Ie=u.getSortedSymbolIndexes(this.transform.angle);for(let Fe=Ie.length-1;Fe>=0;--Fe){const st=Ie[Fe];Re(u.symbolInstances.get(st),u.collisionArrays[st])}}else for(let Ie=t.symbolInstanceStart;Ie<t.symbolInstanceEnd;Ie++)Re(u.symbolInstances.get(Ie),u.collisionArrays[Ie]);if(s&&u.bucketInstanceId in this.collisionCircleArrays){const Ie=this.collisionCircleArrays[u.bucketInstanceId];a.invert(Ie.invProjMatrix,f),Ie.viewportMatrix=this.collisionIndex.getViewportMatrix()}u.justReloaded=!1}markUsedJustification(t,n,s,u){let p;p=u===a.WritingMode.vertical?s.verticalPlacedTextSymbolIndex:{left:s.leftJustifiedTextSymbolIndex,center:s.centerJustifiedTextSymbolIndex,right:s.rightJustifiedTextSymbolIndex}[a.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===a.WritingMode.horizontal||n===a.WritingMode.horizontalOnly?n:0,p=n===a.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],S=p[y];S?(this.opacities[y]=new Pt(S,u,v.text,v.icon),s=s||v.text!==S.text.placed||v.icon!==S.icon.placed):(this.opacities[y]=new Pt(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 S=new Pt(v,u,!1,!1);S.isHidden()||(this.opacities[y]=S,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 Pt(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",S=u.get("text-pitch-alignment")==="map",M=u.get("icon-text-fit")!=="none",z=new Pt(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 V=($,U,H)=>{for(let Y=0;Y<U/4;Y++)$.opacityVertexArray.emplaceBack(H)};for(let $=0;$<t.symbolInstances.length;$++){const U=t.symbolInstances.get($),{numHorizontalGlyphVertices:H,numVerticalGlyphVertices:Y,crossTileID:ne}=U;let G=this.opacities[ne];n[ne]?G=p:G||(G=z,this.opacities[ne]=G),n[ne]=!0;const le=U.numIconVertices>0,se=this.placedOrientations[U.crossTileID],me=se===a.WritingMode.vertical,ge=se===a.WritingMode.horizontal||se===a.WritingMode.horizontalOnly;if(H>0||Y>0){const be=J(G.text);V(t.text,H,me?pe:be),V(t.text,Y,ge?pe:be);const de=G.text.isHidden();[U.rightJustifiedTextSymbolIndex,U.centerJustifiedTextSymbolIndex,U.leftJustifiedTextSymbolIndex].forEach(Fe=>{Fe>=0&&(t.text.placedSymbolArray.get(Fe).hidden=de||me?1:0)}),U.verticalPlacedTextSymbolIndex>=0&&(t.text.placedSymbolArray.get(U.verticalPlacedTextSymbolIndex).hidden=de||ge?1:0);const Re=this.variableOffsets[U.crossTileID];Re&&this.markUsedJustification(t,Re.anchor,U,se);const Ie=this.placedOrientations[U.crossTileID];Ie&&(this.markUsedJustification(t,"left",U,Ie),this.markUsedOrientation(t,Ie,U))}if(le){const be=J(G.icon),de=!(M&&U.verticalPlacedIconSymbolIndex&&me);U.placedIconSymbolIndex>=0&&(V(t.icon,U.numIconVertices,de?be:pe),t.icon.placedSymbolArray.get(U.placedIconSymbolIndex).hidden=G.icon.isHidden()),U.verticalPlacedIconSymbolIndex>=0&&(V(t.icon,U.numVerticalIconVertices,de?pe:be),t.icon.placedSymbolArray.get(U.verticalPlacedIconSymbolIndex).hidden=G.icon.isHidden())}if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const be=t.collisionArrays[$];if(be){let de=new a.pointGeometry(0,0);if(be.textBox||be.verticalTextBox){let Ie=!0;if(y){const Fe=this.variableOffsets[ne];Fe?(de=Sn(Fe.anchor,Fe.width,Fe.height,Fe.textOffset,Fe.textBoxScale),v&&de._rotate(S?this.transform.angle:-this.transform.angle)):Ie=!1}be.textBox&&b(t.textCollisionBox.collisionVertexArray,G.text.placed,!Ie||me,de.x,de.y),be.verticalTextBox&&b(t.textCollisionBox.collisionVertexArray,G.text.placed,!Ie||ge,de.x,de.y)}const Re=Boolean(!ge&&be.verticalIconBox);be.iconBox&&b(t.iconCollisionBox.collisionVertexArray,G.icon.placed,Re,M?de.x:0,M?de.y:0),be.verticalIconBox&&b(t.iconCollisionBox.collisionVertexArray,G.icon.placed,!Re,M?de.x:0,M?de.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 $=this.collisionCircleArrays[t.bucketInstanceId];t.placementInvProjMatrix=$.invProjMatrix,t.placementViewportMatrix=$.viewportMatrix,t.collisionCircleArray=$.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(l,t,n,s,u){l.emplaceBack(t?1:0,n?1:0,s||0,u||0),l.emplaceBack(t?1:0,n?1:0,s||0,u||0),l.emplaceBack(t?1:0,n?1:0,s||0,u||0),l.emplaceBack(t?1:0,n?1:0,s||0,u||0)}const C=Math.pow(2,25),R=Math.pow(2,24),B=Math.pow(2,17),j=Math.pow(2,16),K=Math.pow(2,9),W=Math.pow(2,8),X=Math.pow(2,1);function J(l){if(l.opacity===0&&!l.placed)return 0;if(l.opacity===1&&l.placed)return 4294967295;const t=l.placed?1:0,n=Math.floor(127*l.opacity);return n*C+t*R+n*B+t*j+n*K+t*W+n*X+t}const pe=0;class ve{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 he{constructor(t,n,s,u,p,f,_,y){this.placement=new O(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=a.exported.now(),p=()=>{const f=a.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 ve(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 Ue=512/a.EXTENT/2;class qe{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=Ue/Math.pow(2,n.canonical.z-this.tileID.canonical.z);return{x:Math.floor((n.canonical.x*a.EXTENT+t.anchorX)*s),y:Math.floor((n.canonical.y*a.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 Le{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Ke{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 qe(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 et{constructor(){this.layerIndexes={},this.crossTileIDs=new Le,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(t,n,s){let u=this.layerIndexes[t.id];u===void 0&&(u=this.layerIndexes[t.id]=new Ke);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 bt=a.createLayout([{name:"a_pos",type:"Int16",components:2}]);class it extends a.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),a.ortho(s.posMatrix,0,a.EXTENT,0,a.EXTENT,0,1),this._tiles[s.key]=new Dr(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),a.ortho(p.posMatrix,0,a.EXTENT,0,a.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=a.EXTENT>>f;a.ortho(p.posMatrix,0,v,0,v,0,1),a.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=a.EXTENT>>f;a.ortho(p.posMatrix,0,a.EXTENT,0,a.EXTENT,0,1),a.translate(p.posMatrix,p.posMatrix,[_*v,y*v,0]),a.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 ct{constructor(t,n,s){this.style=t,this.sourceCache=new it(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=a.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 _=a.transformMat4$1([],[n/u*a.EXTENT,s/u*a.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])],S=f.tile.dem.get(v[0],v[1]),M=f.tile.dem.get(v[0],v[1]+1),z=f.tile.dem.get(v[0]+1,v[1]),V=f.tile.dem.get(v[0]+1,v[1]+1);p=a.number(a.number(S,M,y[0]-v[0]),a.number(z,V,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=a.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 a.RGBAImage({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new Be(u,p,u.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new Be(u,new a.RGBAImage({width:1,height:1}),u.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(u.gl.NEAREST,u.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=a.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 Be(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:a.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=a.fromScaling(new Float64Array(16),[1/(a.EXTENT<<p),1/(a.EXTENT<<p),0]);a.translate(y,y,[f*a.EXTENT,_*a.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 Be(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 Be(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 a.RGBAImage({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(n.buffer)),u=new Be(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 S=this._coordsTextureSize,M=(1<<v.tileID.canonical.z)*S;return new a.MercatorCoordinate((v.tileID.canonical.x*S+f)/M,(v.tileID.canonical.y*S+_)/M,this.getElevation(v.tileID,f,_,S))}getTerrainMesh(){if(this._mesh)return this._mesh;const t=this.style.map.painter.context,n=new a.PosArray,s=new a.TriangleIndexArray,u=this.meshSize,p=a.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,bt.members),segments:a.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 wt=(l,t)=>a.emitValidationErrors(l,t&&t.filter(n=>n.identifier!=="source.canvas")),kt=a.pick(xt,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData"]),si=a.pick(xt,["setCenter","setZoom","setBearing","setPitch"]),Ut=function(){const l={},t=a.spec.$version;for(const n in a.spec.$root){const s=a.spec.$root[n];if(s.required){let u=null;u=n==="version"?t:s.type==="array"?[]:{},u!=null&&(l[n]=u)}}return l}();class _i extends a.Evented{constructor(t,n={}){super(),this.map=t,this.dispatcher=new Wi(vn(),this),this.imageManager=new Ye,this.imageManager.setEventedParent(this),this.glyphManager=new at(t._requestManager,n.localIdeographFontFamily),this.lineAtlas=new vr(256,512),this.crossTileSymbolIndex=new et,this._layers={},this._serializedLayers={},this._order=[],this.sourceCaches={},this.zoomHistory=new a.ZoomHistory,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("setReferrer",a.getReferrer());const s=this;this._rtlTextPluginCallback=_i.registerForPluginStateChange(u=>{s.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:u.pluginStatus,pluginURL:u.pluginURL},(p,f)=>{if(a.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 a.Event("dataloading",{dataType:"style"}));const s=typeof n.validate!="boolean"||n.validate,u=this.map._requestManager.transformRequest(t,a.ResourceType.Style);this._request=a.getJSON(u,(p,f)=>{this._request=null,p?this.fire(new a.ErrorEvent(p)):f&&this._load(f,s)})}loadJSON(t,n={}){this.fire(new a.Event("dataloading",{dataType:"style"})),this._request=a.exported.frame(()=>{this._request=null,this._load(t,n.validate!==!1)})}loadEmpty(){this.fire(new a.Event("dataloading",{dataType:"style"})),this._load(Ut,!1)}_load(t,n){if(n&&wt(this,a.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=Wn(this.stylesheet.layers);this._order=s.map(u=>u.id),this._layers={},this._serializedLayers={};for(let u of s)u=a.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 Jt(this.stylesheet.light),this.setTerrain(this.stylesheet.terrain),this.fire(new a.Event("data",{dataType:"style"})),this.fire(new a.Event("style.load"))}_loadSprite(t){this._spriteRequest=function(n,s,u,p){let f,_,y;const v=u>1?"@2x":"";let S=a.getJSON(s.transformRequest(s.normalizeSpriteURL(n,v,".json"),a.ResourceType.SpriteJSON),(V,$)=>{S=null,y||(y=V,f=$,z())}),M=a.getImage(s.transformRequest(s.normalizeSpriteURL(n,v,".png"),a.ResourceType.SpriteImage),(V,$)=>{M=null,y||(y=V,_=$,z())});function z(){if(y)p(y);else if(f&&_){const V=a.exported.getImageData(_),$={};for(const U in f){const{width:H,height:Y,x:ne,y:G,sdf:le,pixelRatio:se,stretchX:me,stretchY:ge,content:be}=f[U],de=new a.RGBAImage({width:H,height:Y});a.RGBAImage.copy(V,de,{x:ne,y:G},{x:0,y:0},{width:H,height:Y}),$[U]={data:de,pixelRatio:se,sdf:le,stretchX:me,stretchY:ge,content:be}}p(null,$)}}return{cancel(){S&&(S.cancel(),S=null),M&&(M.cancel(),M=null)}}}(t,this.map._requestManager,this.map.getPixelRatio(),(n,s)=>{if(this._spriteRequest=null,n)this.fire(new a.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 a.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 a.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 a.Event("data",{sourceDataType:"visibility",dataType:"source",sourceId:u}))}this.light.recalculate(t),this.z=t.zoom,n&&this.fire(new a.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 ct(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 a.Event("terrain",{terrain:t}))}setState(t){if(this._checkLoaded(),wt(this,a.validateStyle(t)))return!1;(t=a.clone$1(t)).layers=Wn(t.layers);const n=function(u,p){if(!u)return[{command:xt.setStyle,args:[p]}];let f=[];try{if(!ue(u.version,p.version))return[{command:xt.setStyle,args:[p]}];ue(u.center,p.center)||f.push({command:xt.setCenter,args:[p.center]}),ue(u.zoom,p.zoom)||f.push({command:xt.setZoom,args:[p.zoom]}),ue(u.bearing,p.bearing)||f.push({command:xt.setBearing,args:[p.bearing]}),ue(u.pitch,p.pitch)||f.push({command:xt.setPitch,args:[p.pitch]}),ue(u.sprite,p.sprite)||f.push({command:xt.setSprite,args:[p.sprite]}),ue(u.glyphs,p.glyphs)||f.push({command:xt.setGlyphs,args:[p.glyphs]}),ue(u.transition,p.transition)||f.push({command:xt.setTransition,args:[p.transition]}),ue(u.light,p.light)||f.push({command:xt.setLight,args:[p.light]});const _={},y=[];(function(S,M,z,V){let $;for($ in M=M||{},S=S||{})Object.prototype.hasOwnProperty.call(S,$)&&(Object.prototype.hasOwnProperty.call(M,$)||Fr($,z,V));for($ in M)Object.prototype.hasOwnProperty.call(M,$)&&(Object.prototype.hasOwnProperty.call(S,$)?ue(S[$],M[$])||(S[$].type==="geojson"&&M[$].type==="geojson"&&Hn(S,M,$)?z.push({command:xt.setGeoJSONSourceData,args:[$,M[$].data]}):Or($,M,z,V)):pr($,M,z))})(u.sources,p.sources,y,_);const v=[];u.layers&&u.layers.forEach(S=>{_[S.source]?f.push({command:xt.removeLayer,args:[S.id]}):v.push(S)}),f=f.concat(y),function(S,M,z){M=M||[];const V=(S=S||[]).map(Tr),$=M.map(Tr),U=S.reduce(wn,{}),H=M.reduce(wn,{}),Y=V.slice(),ne=Object.create(null);let G,le,se,me,ge,be,de;for(G=0,le=0;G<V.length;G++)se=V[G],Object.prototype.hasOwnProperty.call(H,se)?le++:(z.push({command:xt.removeLayer,args:[se]}),Y.splice(Y.indexOf(se,le),1));for(G=0,le=0;G<$.length;G++)se=$[$.length-1-G],Y[Y.length-1-G]!==se&&(Object.prototype.hasOwnProperty.call(U,se)?(z.push({command:xt.removeLayer,args:[se]}),Y.splice(Y.lastIndexOf(se,Y.length-le),1)):le++,be=Y[Y.length-G],z.push({command:xt.addLayer,args:[H[se],be]}),Y.splice(Y.length-G,0,se),ne[se]=!0);for(G=0;G<$.length;G++)if(se=$[G],me=U[se],ge=H[se],!ne[se]&&!ue(me,ge))if(ue(me.source,ge.source)&&ue(me["source-layer"],ge["source-layer"])&&ue(me.type,ge.type)){for(de in wr(me.layout,ge.layout,z,se,null,xt.setLayoutProperty),wr(me.paint,ge.paint,z,se,null,xt.setPaintProperty),ue(me.filter,ge.filter)||z.push({command:xt.setFilter,args:[se,ge.filter]}),ue(me.minzoom,ge.minzoom)&&ue(me.maxzoom,ge.maxzoom)||z.push({command:xt.setLayerZoomRange,args:[se,ge.minzoom,ge.maxzoom]}),me)Object.prototype.hasOwnProperty.call(me,de)&&de!=="layout"&&de!=="paint"&&de!=="filter"&&de!=="metadata"&&de!=="minzoom"&&de!=="maxzoom"&&(de.indexOf("paint.")===0?wr(me[de],ge[de],z,se,de.slice(6),xt.setPaintProperty):ue(me[de],ge[de])||z.push({command:xt.setLayerProperty,args:[se,de,ge[de]]}));for(de in ge)Object.prototype.hasOwnProperty.call(ge,de)&&!Object.prototype.hasOwnProperty.call(me,de)&&de!=="layout"&&de!=="paint"&&de!=="filter"&&de!=="metadata"&&de!=="minzoom"&&de!=="maxzoom"&&(de.indexOf("paint.")===0?wr(me[de],ge[de],z,se,de.slice(6),xt.setPaintProperty):ue(me[de],ge[de])||z.push({command:xt.setLayerProperty,args:[se,de,ge[de]]}))}else z.push({command:xt.removeLayer,args:[se]}),be=Y[Y.lastIndexOf(se)+1],z.push({command:xt.addLayer,args:[ge,be]})}(v,p.layers,f)}catch(_){console.warn("Unable to compute style diff:",_),f=[{command:xt.setStyle,args:[p]}]}return f}(this.serialize(),t).filter(u=>!(u.command in si));if(n.length===0)return!1;const s=n.filter(u=>!(u.command in kt));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 a.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 a.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 a.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(a.validateStyle.source,`sources.${t}`,n,null,s))return;this.map&&this.map._collectResourceTiming&&(n.collectResourceTiming=!0);const u=this.sourceCaches[t]=new Mi(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 a.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 a.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 a.ErrorEvent(new Error(`Layer "${u}" already exists on this map.`)));let p;if(t.type==="custom"){if(wt(this,a.validateCustomStyleLayer(t)))return;p=a.createStyleLayer(t)}else{if(typeof t.source=="object"&&(this.addSource(u,t.source),t=a.clone$1(t),t=a.extend(t,{source:u})),this._validate(a.validateStyle.layer,`layers.${u}`,t,{arrayIndex:-1},s))return;p=a.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 a.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 a.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 a.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 a.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 a.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(!ue(u.filter,n))return n==null?(u.filter=void 0,void this._updateLayer(u)):void(this._validate(a.validateStyle.filter,`layers.${u.id}.filter`,n,null,s)||(u.filter=a.clone$1(n),this._updateLayer(u)))}else this.fire(new a.ErrorEvent(new Error(`Cannot filter non-existing layer "${t}".`)))}getFilter(t){return a.clone$1(this.getLayer(t).filter)}setLayoutProperty(t,n,s,u={}){this._checkLoaded();const p=this.getLayer(t);p?ue(p.getLayoutProperty(n),s)||(p.setLayoutProperty(n,s,u),this._updateLayer(p)):this.fire(new a.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 a.ErrorEvent(new Error(`Cannot get style of non-existing layer "${t}".`)))}setPaintProperty(t,n,s,u={}){this._checkLoaded();const p=this.getLayer(t);p?ue(p.getPaintProperty(n),s)||(p.setPaintProperty(n,s,u)&&this._updateLayer(p),this._changed=!0,this._updatedPaintProps[t]=!0):this.fire(new a.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 a.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 a.ErrorEvent(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):f!=="vector"||u?(t.id===void 0&&this.fire(new a.ErrorEvent(new Error("The feature id parameter must be provided."))),p.setFeatureState(u,t.id,n)):this.fire(new a.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 a.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 a.ErrorEvent(new Error("A feature id is required to remove its specific state property."))):u.removeFeatureState(f,t.id,n):this.fire(new a.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 a.ErrorEvent(new Error("The feature id parameter must be provided."))),u.getFeatureState(s,t.id)):void this.fire(new a.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new a.ErrorEvent(new Error(`The source '${n}' does not exist in the map's style.`)))}getTransition(){return a.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){return a.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:a.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 S of v)u.push(S)}}}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 S of v)p.push(S.feature)}}return p}queryRenderedFeatures(t,n,s){n&&n.filter&&this._validate(a.validateStyle.filter,"queryRenderedFeatures.filter",n.filter,null,n);const u={};if(n&&n.layers){if(!Array.isArray(n.layers))return this.fire(new a.ErrorEvent(new Error("parameters.layers must be an Array."))),[];for(const f of n.layers){const _=this._layers[f];if(!_)return this.fire(new a.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(yn(this.sourceCaches[f],this._layers,this._serializedLayers,t,n,s));return this.placement&&p.push(function(f,_,y,v,S,M,z){const V={},$=M.queryRenderedSymbols(v),U=[];for(const H of Object.keys($).map(Number))U.push(z[H]);U.sort(hr);for(const H of U){const Y=H.featureIndex.lookupSymbolFeatures($[H.bucketInstanceId],_,H.bucketIndex,H.sourceLayerIndex,S.filter,S.layers,S.availableImages,f);for(const ne in Y){const G=V[ne]=V[ne]||[],le=Y[ne];le.sort((se,me)=>{const ge=H.featureSortOrder;if(ge){const be=ge.indexOf(se.featureIndex);return ge.indexOf(me.featureIndex)-be}return me.featureIndex-se.featureIndex});for(const se of le)G.push(se)}}for(const H in V)V[H].forEach(Y=>{const ne=Y.feature,G=y[f[H].source].getFeatureState(ne.layer["source-layer"],ne.id);ne.source=ne.layer.source,ne.layer["source-layer"]&&(ne.sourceLayer=ne.layer["source-layer"]),ne.state=G});return V}(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(a.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 S=f[v],M=S.tileID.canonical.key;y[M]||(y[M]=!0,S.querySourceFeatures(_,p))}return _}(s,n):[]}addSourceType(t,n,s){return _i.getSourceType(t)?s(new Error(`A source type called "${t}" already exists.`)):(_i.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(!ue(t[f],s[f])){u=!0;break}if(!u)return;const p={now:a.exported.now(),transition:a.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)&&wt(this,t.call(a.validateStyle,a.extend({key:n,style:this.serialize(),value:s,styleSpec:a.spec},u)))}_remove(){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),a.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 S=this._layers[v];if(S.type!=="symbol")continue;if(!y[S.source]){const z=this.sourceCaches[S.source];y[S.source]=z.getRenderableIds(!0).map(V=>z.getTileByID(V)).sort((V,$)=>$.tileID.overscaledZ-V.tileID.overscaledZ||(V.tileID.isLessThan($.tileID)?-1:1))}const M=this.crossTileSymbolIndex.addLayer(S,y[S.source],t.center.lng);f=f||M}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((p=p||this._layerOrderChanged||s===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(a.exported.now(),t.zoom))&&(this.pauseablePlacement=new he(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(a.exported.now()),_=!0),f&&this.pauseablePlacement.placement.setStale()),_||f)for(const v of this._order){const S=this._layers[v];S.type==="symbol"&&this.placement.updateLayerOpacities(S,y[S.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(a.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 a.makeRequest(n,s)}}_i.getSourceType=function(l){return gn[l]},_i.setSourceType=function(l,t){gn[l]=t},_i.registerForPluginStateChange=a.registerForPluginStateChange;var In="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 Kn={prelude:Dt(`#ifdef GL_ES
3
3
  precision mediump float;
4
4
  #else
5
5
  #if !defined(lowp)
@@ -522,222 +522,230 @@ 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:Dt("uniform sampler2D u_texture;varying vec2 v_texture_pos;void main() {gl_FragColor=texture2D(u_texture,v_texture_pos);}",In),terrainDepth:Dt("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);}",In),terrainCoords:Dt("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);}",In)};function Dt(l,t){const n=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,s=t.match(/attribute ([\w]+) ([\w]+)/g),u=l.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),p=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),f=p?p.concat(u):u,_={};return{fragmentSource:l=l.replace(n,(y,v,E,M,z)=>(_[z]=!0,v==="define"?`
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:Dt("uniform sampler2D u_texture;varying vec2 v_texture_pos;void main() {gl_FragColor=texture2D(u_texture,v_texture_pos);}",In),terrainDepth:Dt("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);}",In),terrainCoords:Dt("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);}",In)};function Dt(l,t){const n=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,s=t.match(/attribute ([\w]+) ([\w]+)/g),u=l.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),p=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),f=p?p.concat(u):u,_={};return{fragmentSource:l=l.replace(n,(y,v,S,M,z)=>(_[z]=!0,v==="define"?`
526
526
  #ifndef HAS_UNIFORM_u_${z}
527
- varying ${E} ${M} ${z};
527
+ varying ${S} ${M} ${z};
528
528
  #else
529
- uniform ${E} ${M} u_${z};
529
+ uniform ${S} ${M} u_${z};
530
530
  #endif
531
531
  `:`
532
532
  #ifdef HAS_UNIFORM_u_${z}
533
- ${E} ${M} ${z} = u_${z};
533
+ ${S} ${M} ${z} = u_${z};
534
534
  #endif
535
- `)),vertexSource:t=t.replace(n,(y,v,E,M,z)=>{const V=M==="float"?"vec2":"vec4",$=z.match(/color/)?"color":V;return _[z]?v==="define"?`
535
+ `)),vertexSource:t=t.replace(n,(y,v,S,M,z)=>{const V=M==="float"?"vec2":"vec4",$=z.match(/color/)?"color":V;return _[z]?v==="define"?`
536
536
  #ifndef HAS_UNIFORM_u_${z}
537
537
  uniform lowp float u_${z}_t;
538
- attribute ${E} ${V} a_${z};
539
- varying ${E} ${M} ${z};
538
+ attribute ${S} ${V} a_${z};
539
+ varying ${S} ${M} ${z};
540
540
  #else
541
- uniform ${E} ${M} u_${z};
541
+ uniform ${S} ${M} u_${z};
542
542
  #endif
543
543
  `:$==="vec4"?`
544
544
  #ifndef HAS_UNIFORM_u_${z}
545
545
  ${z} = a_${z};
546
546
  #else
547
- ${E} ${M} ${z} = u_${z};
547
+ ${S} ${M} ${z} = u_${z};
548
548
  #endif
549
549
  `:`
550
550
  #ifndef HAS_UNIFORM_u_${z}
551
551
  ${z} = unpack_mix_${$}(a_${z}, u_${z}_t);
552
552
  #else
553
- ${E} ${M} ${z} = u_${z};
553
+ ${S} ${M} ${z} = u_${z};
554
554
  #endif
555
555
  `:v==="define"?`
556
556
  #ifndef HAS_UNIFORM_u_${z}
557
557
  uniform lowp float u_${z}_t;
558
- attribute ${E} ${V} a_${z};
558
+ attribute ${S} ${V} a_${z};
559
559
  #else
560
- uniform ${E} ${M} u_${z};
560
+ uniform ${S} ${M} u_${z};
561
561
  #endif
562
562
  `:$==="vec4"?`
563
563
  #ifndef HAS_UNIFORM_u_${z}
564
- ${E} ${M} ${z} = a_${z};
564
+ ${S} ${M} ${z} = a_${z};
565
565
  #else
566
- ${E} ${M} ${z} = u_${z};
566
+ ${S} ${M} ${z} = u_${z};
567
567
  #endif
568
568
  `:`
569
569
  #ifndef HAS_UNIFORM_u_${z}
570
- ${E} ${M} ${z} = unpack_mix_${$}(a_${z}, u_${z}_t);
570
+ ${S} ${M} ${z} = unpack_mix_${$}(a_${z}, u_${z}_t);
571
571
  #else
572
- ${E} ${M} ${z} = u_${z};
572
+ ${S} ${M} ${z} = u_${z};
573
573
  #endif
574
- `}),staticAttributes:s,staticUniforms:f}}class as{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 E=this.boundPaintVertexBuffers.length!==u.length;for(let M=0;!E&&M<u.length;M++)this.boundPaintVertexBuffers[M]!==u[M]&&(E=!0);t.extVertexArrayObject&&this.vao&&this.boundProgram===n&&this.boundLayoutVertexBuffer===s&&!E&&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 E=t.numAttributes,M=this.context,z=M.gl;if(M.extVertexArrayObject)this.vao&&this.destroy(),this.vao=M.extVertexArrayObject.createVertexArrayOES(),M.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=M.currentNumAttributes||0;for(let V=E;V<v;V++)z.disableVertexAttribArray(V)}n.enableAttributes(z,t);for(const V of s)V.enableAttributes(z,t);f&&f.enableAttributes(z,t),_&&_.enableAttributes(z,t),y&&y.enableAttributes(z,t),n.bind(),n.setVertexAttribPointers(z,t,p);for(const V of s)V.bind(),V.setVertexAttribPointers(z,t,p);f&&(f.bind(),f.setVertexAttribPointers(z,t,p)),u&&u.bind(),_&&(_.bind(),_.setVertexAttribPointers(z,t,p)),y&&(y.bind(),y.setVertexAttribPointers(z,t,p)),M.currentNumAttributes=E}destroy(){this.vao&&(this.context.extVertexArrayObject.deleteVertexArrayOES(this.vao),this.vao=null)}}function ls(l){const t=[];for(let n=0;n<l.length;n++){if(l[n]===null)continue;const s=l[n].split(" ");t.push(s.pop())}return t}class ha{constructor(t,n,s,u,p,f,_){const y=t.gl;this.program=y.createProgram();const v=ls(s.staticAttributes),E=u?u.getBinderAttributes():[],M=v.concat(E),z=Kn.prelude.staticUniforms?ls(Kn.prelude.staticUniforms):[],V=s.staticUniforms?ls(s.staticUniforms):[],$=u?u.getBinderUniforms():[],U=z.concat(V).concat($),H=[];for(const ge of U)H.indexOf(ge)<0&&H.push(ge);const Q=u?u.defines():[];f&&Q.push("#define OVERDRAW_INSPECTOR;"),_&&Q.push("#define TERRAIN3D;");const ne=Q.concat(Kn.prelude.fragmentSource,s.fragmentSource).join(`
575
- `),G=Q.concat(Kn.prelude.vertexSource,s.vertexSource).join(`
576
- `),le=y.createShader(y.FRAGMENT_SHADER);if(y.isContextLost())return void(this.failedToCreate=!0);y.shaderSource(le,ne),y.compileShader(le),y.attachShader(this.program,le);const se=y.createShader(y.VERTEX_SHADER);if(y.isContextLost())return void(this.failedToCreate=!0);y.shaderSource(se,G),y.compileShader(se),y.attachShader(this.program,se),this.attributes={};const me={};this.numAttributes=M.length;for(let ge=0;ge<this.numAttributes;ge++)M[ge]&&(y.bindAttribLocation(this.program,ge,M[ge]),this.attributes[M[ge]]=ge);y.linkProgram(this.program),y.deleteShader(se),y.deleteShader(le);for(let ge=0;ge<H.length;ge++){const be=H[ge];if(be&&!me[be]){const de=y.getUniformLocation(this.program,be);de&&(me[be]=de)}}this.fixedUniforms=p(t,me),this.terrainUniforms=((ge,be)=>({u_depth:new a.Uniform1i(ge,be.u_depth),u_terrain:new a.Uniform1i(ge,be.u_terrain),u_terrain_dim:new a.Uniform1f(ge,be.u_terrain_dim),u_terrain_matrix:new a.UniformMatrix4f(ge,be.u_terrain_matrix),u_terrain_unpack:new a.Uniform4f(ge,be.u_terrain_unpack),u_terrain_offset:new a.Uniform1f(ge,be.u_terrain_offset),u_terrain_exaggeration:new a.Uniform1f(ge,be.u_terrain_exaggeration)}))(t,me),this.binderUniforms=u?u.getUniforms(t,me):[]}draw(t,n,s,u,p,f,_,y,v,E,M,z,V,$,U,H,Q,ne){const G=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(G.TEXTURE2),G.bindTexture(G.TEXTURE_2D,y.depthTexture),t.activeTexture.set(G.TEXTURE3),G.bindTexture(G.TEXTURE_2D,y.texture);for(const se in this.terrainUniforms)this.terrainUniforms[se].set(y[se])}for(const se in this.fixedUniforms)this.fixedUniforms[se].set(_[se]);U&&U.setUniforms(t,this.binderUniforms,V,{zoom:$});let le=0;switch(n){case G.LINES:le=2;break;case G.TRIANGLES:le=3;break;case G.LINE_STRIP:le=1}for(const se of z.get()){const me=se.vaos||(se.vaos={});(me[v]||(me[v]=new as)).bind(t,this,E,U?U.getPaintVertexBuffers():[],M,se.vertexOffset,H,Q,ne),G.drawElements(n,se.primitiveLength*le,G.UNSIGNED_SHORT,se.primitiveOffset*le*2)}}}function pa(l,t,n){const s=1/Jt(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,l.fromScale,l.toScale],u_fade:l.t,u_pixel_coord_upper:[f>>16,_>>16],u_pixel_coord_lower:[65535&f,65535&_]}}const cs=(l,t,n,s)=>{const u=t.style.light,p=u.properties.get("position"),f=[p.x,p.y,p.z],_=a.create$1();u.properties.get("anchor")==="viewport"&&a.fromRotation(_,-t.transform.angle),a.transformMat3(f,f,_);const y=u.properties.get("color");return{u_matrix:l,u_lightpos:f,u_lightintensity:u.properties.get("intensity"),u_lightcolor:[y.r,y.g,y.b],u_vertical_gradient:+n,u_opacity:s}},Pl=(l,t,n,s,u,p,f)=>a.extend(cs(l,t,n,s),pa(p,t,f),{u_height_factor:-Math.pow(2,u.overscaledZ)/f.tileSize/8}),Mo=l=>({u_matrix:l}),us=(l,t,n,s)=>a.extend(Mo(l),pa(n,t,s)),da=(l,t)=>({u_matrix:l,u_world:t}),fa=(l,t,n,s,u)=>a.extend(us(l,t,n,s),{u_world:u}),ma=(l,t,n,s)=>{const u=l.transform;let p,f;if(s.paint.get("circle-pitch-alignment")==="map"){const _=Jt(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:l.translatePosMatrix(t.posMatrix,n,s.paint.get("circle-translate"),s.paint.get("circle-translate-anchor")),u_pitch_with_map:+p,u_device_pixel_ratio:l.pixelRatio,u_extrude_scale:f}},tn=(l,t,n)=>{const s=Jt(n,1,t.zoom),u=Math.pow(2,t.zoom-n.tileID.overscaledZ),p=n.tileID.overscaleFactor();return{u_matrix:l,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}},Jn=(l,t,n=1)=>({u_matrix:l,u_color:t,u_overlay:0,u_overlay_scale:n}),Cn=l=>({u_matrix:l}),Po=(l,t,n,s)=>({u_matrix:l,u_extrude_scale:Jt(t,1,n),u_intensity:s});function zo(l,t){const n=Math.pow(2,t.canonical.z),s=t.canonical.y;return[new a.MercatorCoordinate(0,s/n).toLngLat().lat,new a.MercatorCoordinate(0,(s+1)/n).toLngLat().lat]}const An=(l,t,n,s)=>{const u=l.transform;return{u_matrix:Qn(l,t,n,s),u_ratio:1/Jt(t,1,u.zoom),u_device_pixel_ratio:l.pixelRatio,u_units_to_pixels:[1/u.pixelsToGLUnits[0],1/u.pixelsToGLUnits[1]]}},hs=(l,t,n,s,u)=>a.extend(An(l,t,n,u),{u_image:0,u_image_height:s}),ko=(l,t,n,s,u)=>{const p=l.transform,f=Ut(t,p);return{u_matrix:Qn(l,t,n,u),u_texsize:t.imageAtlasTexture.size,u_ratio:1/Jt(t,1,p.zoom),u_device_pixel_ratio:l.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]]}},Yn=(l,t,n,s,u,p)=>{const f=l.lineAtlas,_=Ut(t,l.transform),y=n.layout.get("line-cap")==="round",v=f.getDash(s.from,y),E=f.getDash(s.to,y),M=v.width*u.fromScale,z=E.width*u.toScale;return a.extend(An(l,t,n,p),{u_patternscale_a:[_/M,-v.height/2],u_patternscale_b:[_/z,-E.height/2],u_sdfgamma:f.width/(256*Math.min(M,z)*l.pixelRatio)/2,u_image:0,u_tex_y_a:v.y,u_tex_y_b:E.y,u_mix:u.t})};function Ut(l,t){return 1/Jt(l,1,t.tileZoom)}function Qn(l,t,n,s){return l.translatePosMatrix(s?s.posMatrix:t.tileID.posMatrix,t,n.paint.get("line-translate"),n.paint.get("line-translate-anchor"))}const ga=(l,t,n,s,u)=>{return{u_matrix:l,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:_a(u.paint.get("raster-hue-rotate"))};var p,f};function _a(l){l*=Math.PI/180;const t=Math.sin(l),n=Math.cos(l);return[(2*n+1)/3,(-Math.sqrt(3)*t-n+1)/3,(Math.sqrt(3)*t-n+1)/3]}const ps=(l,t,n,s,u,p,f,_,y,v)=>{const E=u.transform;return{u_is_size_zoom_constant:+(l==="constant"||l==="source"),u_is_size_feature_constant:+(l==="constant"||l==="camera"),u_size_t:t?t.uSizeT:0,u_size:t?t.uSize:0,u_camera_to_center_distance:E.cameraToCenterDistance,u_pitch:E.pitch/360*2*Math.PI,u_rotate_symbol:+n,u_aspect_ratio:E.width/E.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}},Do=(l,t,n,s,u,p,f,_,y,v,E)=>{const M=u.transform;return a.extend(ps(l,t,n,s,u,p,f,_,y,v),{u_gamma_scale:s?Math.cos(M._pitch)*M.cameraToCenterDistance:1,u_device_pixel_ratio:u.pixelRatio,u_is_halo:+E})},ya=(l,t,n,s,u,p,f,_,y,v)=>a.extend(Do(l,t,n,s,u,p,f,_,!0,y,!0),{u_texsize_icon:v,u_texture_icon:1}),zl=(l,t,n)=>({u_matrix:l,u_opacity:t,u_color:n}),kl=(l,t,n,s,u,p)=>a.extend(function(f,_,y,v){const E=y.imageManager.getPattern(f.from.toString()),M=y.imageManager.getPattern(f.to.toString()),{width:z,height:V}=y.imageManager.getPixelSize(),$=Math.pow(2,v.tileID.overscaledZ),U=v.tileSize*Math.pow(2,y.transform.tileZoom)/$,H=U*(v.tileID.canonical.x+v.tileID.wrap*$),Q=U*v.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:E.tl,u_pattern_br_a:E.br,u_pattern_tl_b:M.tl,u_pattern_br_b:M.br,u_texsize:[z,V],u_mix:_.t,u_pattern_size_a:E.displaySize,u_pattern_size_b:M.displaySize,u_scale_a:_.fromScale,u_scale_b:_.toScale,u_tile_units_to_pixels:1/Jt(v,1,y.transform.tileZoom),u_pixel_coord_upper:[H>>16,Q>>16],u_pixel_coord_lower:[65535&H,65535&Q]}}(s,p,n,u),{u_matrix:l,u_opacity:t}),ds={fillExtrusion:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_lightpos:new a.Uniform3f(l,t.u_lightpos),u_lightintensity:new a.Uniform1f(l,t.u_lightintensity),u_lightcolor:new a.Uniform3f(l,t.u_lightcolor),u_vertical_gradient:new a.Uniform1f(l,t.u_vertical_gradient),u_opacity:new a.Uniform1f(l,t.u_opacity)}),fillExtrusionPattern:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_lightpos:new a.Uniform3f(l,t.u_lightpos),u_lightintensity:new a.Uniform1f(l,t.u_lightintensity),u_lightcolor:new a.Uniform3f(l,t.u_lightcolor),u_vertical_gradient:new a.Uniform1f(l,t.u_vertical_gradient),u_height_factor:new a.Uniform1f(l,t.u_height_factor),u_image:new a.Uniform1i(l,t.u_image),u_texsize:new a.Uniform2f(l,t.u_texsize),u_pixel_coord_upper:new a.Uniform2f(l,t.u_pixel_coord_upper),u_pixel_coord_lower:new a.Uniform2f(l,t.u_pixel_coord_lower),u_scale:new a.Uniform3f(l,t.u_scale),u_fade:new a.Uniform1f(l,t.u_fade),u_opacity:new a.Uniform1f(l,t.u_opacity)}),fill:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix)}),fillPattern:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_image:new a.Uniform1i(l,t.u_image),u_texsize:new a.Uniform2f(l,t.u_texsize),u_pixel_coord_upper:new a.Uniform2f(l,t.u_pixel_coord_upper),u_pixel_coord_lower:new a.Uniform2f(l,t.u_pixel_coord_lower),u_scale:new a.Uniform3f(l,t.u_scale),u_fade:new a.Uniform1f(l,t.u_fade)}),fillOutline:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_world:new a.Uniform2f(l,t.u_world)}),fillOutlinePattern:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_world:new a.Uniform2f(l,t.u_world),u_image:new a.Uniform1i(l,t.u_image),u_texsize:new a.Uniform2f(l,t.u_texsize),u_pixel_coord_upper:new a.Uniform2f(l,t.u_pixel_coord_upper),u_pixel_coord_lower:new a.Uniform2f(l,t.u_pixel_coord_lower),u_scale:new a.Uniform3f(l,t.u_scale),u_fade:new a.Uniform1f(l,t.u_fade)}),circle:(l,t)=>({u_camera_to_center_distance:new a.Uniform1f(l,t.u_camera_to_center_distance),u_scale_with_map:new a.Uniform1i(l,t.u_scale_with_map),u_pitch_with_map:new a.Uniform1i(l,t.u_pitch_with_map),u_extrude_scale:new a.Uniform2f(l,t.u_extrude_scale),u_device_pixel_ratio:new a.Uniform1f(l,t.u_device_pixel_ratio),u_matrix:new a.UniformMatrix4f(l,t.u_matrix)}),collisionBox:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_camera_to_center_distance:new a.Uniform1f(l,t.u_camera_to_center_distance),u_pixels_to_tile_units:new a.Uniform1f(l,t.u_pixels_to_tile_units),u_extrude_scale:new a.Uniform2f(l,t.u_extrude_scale),u_overscale_factor:new a.Uniform1f(l,t.u_overscale_factor)}),collisionCircle:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_inv_matrix:new a.UniformMatrix4f(l,t.u_inv_matrix),u_camera_to_center_distance:new a.Uniform1f(l,t.u_camera_to_center_distance),u_viewport_size:new a.Uniform2f(l,t.u_viewport_size)}),debug:(l,t)=>({u_color:new a.UniformColor(l,t.u_color),u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_overlay:new a.Uniform1i(l,t.u_overlay),u_overlay_scale:new a.Uniform1f(l,t.u_overlay_scale)}),clippingMask:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix)}),heatmap:(l,t)=>({u_extrude_scale:new a.Uniform1f(l,t.u_extrude_scale),u_intensity:new a.Uniform1f(l,t.u_intensity),u_matrix:new a.UniformMatrix4f(l,t.u_matrix)}),heatmapTexture:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_world:new a.Uniform2f(l,t.u_world),u_image:new a.Uniform1i(l,t.u_image),u_color_ramp:new a.Uniform1i(l,t.u_color_ramp),u_opacity:new a.Uniform1f(l,t.u_opacity)}),hillshade:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_image:new a.Uniform1i(l,t.u_image),u_latrange:new a.Uniform2f(l,t.u_latrange),u_light:new a.Uniform2f(l,t.u_light),u_shadow:new a.UniformColor(l,t.u_shadow),u_highlight:new a.UniformColor(l,t.u_highlight),u_accent:new a.UniformColor(l,t.u_accent)}),hillshadePrepare:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_image:new a.Uniform1i(l,t.u_image),u_dimension:new a.Uniform2f(l,t.u_dimension),u_zoom:new a.Uniform1f(l,t.u_zoom),u_unpack:new a.Uniform4f(l,t.u_unpack)}),line:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_ratio:new a.Uniform1f(l,t.u_ratio),u_device_pixel_ratio:new a.Uniform1f(l,t.u_device_pixel_ratio),u_units_to_pixels:new a.Uniform2f(l,t.u_units_to_pixels)}),lineGradient:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_ratio:new a.Uniform1f(l,t.u_ratio),u_device_pixel_ratio:new a.Uniform1f(l,t.u_device_pixel_ratio),u_units_to_pixels:new a.Uniform2f(l,t.u_units_to_pixels),u_image:new a.Uniform1i(l,t.u_image),u_image_height:new a.Uniform1f(l,t.u_image_height)}),linePattern:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_texsize:new a.Uniform2f(l,t.u_texsize),u_ratio:new a.Uniform1f(l,t.u_ratio),u_device_pixel_ratio:new a.Uniform1f(l,t.u_device_pixel_ratio),u_image:new a.Uniform1i(l,t.u_image),u_units_to_pixels:new a.Uniform2f(l,t.u_units_to_pixels),u_scale:new a.Uniform3f(l,t.u_scale),u_fade:new a.Uniform1f(l,t.u_fade)}),lineSDF:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_ratio:new a.Uniform1f(l,t.u_ratio),u_device_pixel_ratio:new a.Uniform1f(l,t.u_device_pixel_ratio),u_units_to_pixels:new a.Uniform2f(l,t.u_units_to_pixels),u_patternscale_a:new a.Uniform2f(l,t.u_patternscale_a),u_patternscale_b:new a.Uniform2f(l,t.u_patternscale_b),u_sdfgamma:new a.Uniform1f(l,t.u_sdfgamma),u_image:new a.Uniform1i(l,t.u_image),u_tex_y_a:new a.Uniform1f(l,t.u_tex_y_a),u_tex_y_b:new a.Uniform1f(l,t.u_tex_y_b),u_mix:new a.Uniform1f(l,t.u_mix)}),raster:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_tl_parent:new a.Uniform2f(l,t.u_tl_parent),u_scale_parent:new a.Uniform1f(l,t.u_scale_parent),u_buffer_scale:new a.Uniform1f(l,t.u_buffer_scale),u_fade_t:new a.Uniform1f(l,t.u_fade_t),u_opacity:new a.Uniform1f(l,t.u_opacity),u_image0:new a.Uniform1i(l,t.u_image0),u_image1:new a.Uniform1i(l,t.u_image1),u_brightness_low:new a.Uniform1f(l,t.u_brightness_low),u_brightness_high:new a.Uniform1f(l,t.u_brightness_high),u_saturation_factor:new a.Uniform1f(l,t.u_saturation_factor),u_contrast_factor:new a.Uniform1f(l,t.u_contrast_factor),u_spin_weights:new a.Uniform3f(l,t.u_spin_weights)}),symbolIcon:(l,t)=>({u_is_size_zoom_constant:new a.Uniform1i(l,t.u_is_size_zoom_constant),u_is_size_feature_constant:new a.Uniform1i(l,t.u_is_size_feature_constant),u_size_t:new a.Uniform1f(l,t.u_size_t),u_size:new a.Uniform1f(l,t.u_size),u_camera_to_center_distance:new a.Uniform1f(l,t.u_camera_to_center_distance),u_pitch:new a.Uniform1f(l,t.u_pitch),u_rotate_symbol:new a.Uniform1i(l,t.u_rotate_symbol),u_aspect_ratio:new a.Uniform1f(l,t.u_aspect_ratio),u_fade_change:new a.Uniform1f(l,t.u_fade_change),u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_label_plane_matrix:new a.UniformMatrix4f(l,t.u_label_plane_matrix),u_coord_matrix:new a.UniformMatrix4f(l,t.u_coord_matrix),u_is_text:new a.Uniform1i(l,t.u_is_text),u_pitch_with_map:new a.Uniform1i(l,t.u_pitch_with_map),u_texsize:new a.Uniform2f(l,t.u_texsize),u_texture:new a.Uniform1i(l,t.u_texture)}),symbolSDF:(l,t)=>({u_is_size_zoom_constant:new a.Uniform1i(l,t.u_is_size_zoom_constant),u_is_size_feature_constant:new a.Uniform1i(l,t.u_is_size_feature_constant),u_size_t:new a.Uniform1f(l,t.u_size_t),u_size:new a.Uniform1f(l,t.u_size),u_camera_to_center_distance:new a.Uniform1f(l,t.u_camera_to_center_distance),u_pitch:new a.Uniform1f(l,t.u_pitch),u_rotate_symbol:new a.Uniform1i(l,t.u_rotate_symbol),u_aspect_ratio:new a.Uniform1f(l,t.u_aspect_ratio),u_fade_change:new a.Uniform1f(l,t.u_fade_change),u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_label_plane_matrix:new a.UniformMatrix4f(l,t.u_label_plane_matrix),u_coord_matrix:new a.UniformMatrix4f(l,t.u_coord_matrix),u_is_text:new a.Uniform1i(l,t.u_is_text),u_pitch_with_map:new a.Uniform1i(l,t.u_pitch_with_map),u_texsize:new a.Uniform2f(l,t.u_texsize),u_texture:new a.Uniform1i(l,t.u_texture),u_gamma_scale:new a.Uniform1f(l,t.u_gamma_scale),u_device_pixel_ratio:new a.Uniform1f(l,t.u_device_pixel_ratio),u_is_halo:new a.Uniform1i(l,t.u_is_halo)}),symbolTextAndIcon:(l,t)=>({u_is_size_zoom_constant:new a.Uniform1i(l,t.u_is_size_zoom_constant),u_is_size_feature_constant:new a.Uniform1i(l,t.u_is_size_feature_constant),u_size_t:new a.Uniform1f(l,t.u_size_t),u_size:new a.Uniform1f(l,t.u_size),u_camera_to_center_distance:new a.Uniform1f(l,t.u_camera_to_center_distance),u_pitch:new a.Uniform1f(l,t.u_pitch),u_rotate_symbol:new a.Uniform1i(l,t.u_rotate_symbol),u_aspect_ratio:new a.Uniform1f(l,t.u_aspect_ratio),u_fade_change:new a.Uniform1f(l,t.u_fade_change),u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_label_plane_matrix:new a.UniformMatrix4f(l,t.u_label_plane_matrix),u_coord_matrix:new a.UniformMatrix4f(l,t.u_coord_matrix),u_is_text:new a.Uniform1i(l,t.u_is_text),u_pitch_with_map:new a.Uniform1i(l,t.u_pitch_with_map),u_texsize:new a.Uniform2f(l,t.u_texsize),u_texsize_icon:new a.Uniform2f(l,t.u_texsize_icon),u_texture:new a.Uniform1i(l,t.u_texture),u_texture_icon:new a.Uniform1i(l,t.u_texture_icon),u_gamma_scale:new a.Uniform1f(l,t.u_gamma_scale),u_device_pixel_ratio:new a.Uniform1f(l,t.u_device_pixel_ratio),u_is_halo:new a.Uniform1i(l,t.u_is_halo)}),background:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_opacity:new a.Uniform1f(l,t.u_opacity),u_color:new a.UniformColor(l,t.u_color)}),backgroundPattern:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_opacity:new a.Uniform1f(l,t.u_opacity),u_image:new a.Uniform1i(l,t.u_image),u_pattern_tl_a:new a.Uniform2f(l,t.u_pattern_tl_a),u_pattern_br_a:new a.Uniform2f(l,t.u_pattern_br_a),u_pattern_tl_b:new a.Uniform2f(l,t.u_pattern_tl_b),u_pattern_br_b:new a.Uniform2f(l,t.u_pattern_br_b),u_texsize:new a.Uniform2f(l,t.u_texsize),u_mix:new a.Uniform1f(l,t.u_mix),u_pattern_size_a:new a.Uniform2f(l,t.u_pattern_size_a),u_pattern_size_b:new a.Uniform2f(l,t.u_pattern_size_b),u_scale_a:new a.Uniform1f(l,t.u_scale_a),u_scale_b:new a.Uniform1f(l,t.u_scale_b),u_pixel_coord_upper:new a.Uniform2f(l,t.u_pixel_coord_upper),u_pixel_coord_lower:new a.Uniform2f(l,t.u_pixel_coord_lower),u_tile_units_to_pixels:new a.Uniform1f(l,t.u_tile_units_to_pixels)}),terrain:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_texture:new a.Uniform1i(l,t.u_texture)}),terrainDepth:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix)}),terrainCoords:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_texture:new a.Uniform1i(l,t.u_texture),u_terrain_coords_id:new a.Uniform1f(l,t.u_terrain_coords_id)})};class fs{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 ms={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class gs{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[ms[p.type]],!1,this.itemSize,p.offset+this.itemSize*(s||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class Et{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 xa extends Et{getDefault(){return a.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 Dl extends Et{getDefault(){return 1}set(t){(t!==this.current||this.dirty)&&(this.gl.clearDepth(t),this.current=t,this.dirty=!1)}}class eo extends Et{getDefault(){return 0}set(t){(t!==this.current||this.dirty)&&(this.gl.clearStencil(t),this.current=t,this.dirty=!1)}}class to extends Et{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 va extends Et{getDefault(){return!0}set(t){(t!==this.current||this.dirty)&&(this.gl.depthMask(t),this.current=t,this.dirty=!1)}}class Ui extends Et{getDefault(){return 255}set(t){(t!==this.current||this.dirty)&&(this.gl.stencilMask(t),this.current=t,this.dirty=!1)}}class _s extends Et{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 Lo extends Et{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 Ro extends Et{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 ys extends Et{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 xs extends Et{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 Bo extends Et{getDefault(){return this.gl.LESS}set(t){(t!==this.current||this.dirty)&&(this.gl.depthFunc(t),this.current=t,this.dirty=!1)}}class vs extends Et{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 bs extends Et{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 Fo extends Et{getDefault(){return a.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 ba extends Et{getDefault(){return this.gl.FUNC_ADD}set(t){(t!==this.current||this.dirty)&&(this.gl.blendEquation(t),this.current=t,this.dirty=!1)}}class wa extends Et{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 Mn extends Et{getDefault(){return this.gl.BACK}set(t){(t!==this.current||this.dirty)&&(this.gl.cullFace(t),this.current=t,this.dirty=!1)}}class Ll extends Et{getDefault(){return this.gl.CCW}set(t){(t!==this.current||this.dirty)&&(this.gl.frontFace(t),this.current=t,this.dirty=!1)}}class Rl extends Et{getDefault(){return null}set(t){(t!==this.current||this.dirty)&&(this.gl.useProgram(t),this.current=t,this.dirty=!1)}}class Bl extends Et{getDefault(){return this.gl.TEXTURE0}set(t){(t!==this.current||this.dirty)&&(this.gl.activeTexture(t),this.current=t,this.dirty=!1)}}class Fl extends Et{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 Ol extends Et{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 $l extends Et{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 ws extends Et{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 Oo extends Et{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 Ts extends Et{getDefault(){return null}set(t){const n=this.gl;n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class Es extends Et{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 Pn extends Et{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 Ta extends Et{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 Ea extends Et{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 $o extends Et{constructor(t,n){super(t),this.context=t,this.parent=n}getDefault(){return null}}class rn extends $o{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 Sa extends $o{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 zn{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 rn(t,f),u&&(this.depthAttachment=new Sa(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 Ft{constructor(t,n,s){this.blendFunction=t,this.blendColor=n,this.mask=s}}Ft.Replace=[1,0],Ft.disabled=new Ft(Ft.Replace,a.Color.transparent,[!1,!1,!1,!1]),Ft.unblended=new Ft(Ft.Replace,a.Color.transparent,[!0,!0,!0,!0]),Ft.alphaBlended=new Ft([1,771],a.Color.transparent,[!0,!0,!0,!0]);class Ia{constructor(t){this.gl=t,this.extVertexArrayObject=this.gl.getExtension("OES_vertex_array_object"),this.clearColor=new xa(this),this.clearDepth=new Dl(this),this.clearStencil=new eo(this),this.colorMask=new to(this),this.depthMask=new va(this),this.stencilMask=new Ui(this),this.stencilFunc=new _s(this),this.stencilOp=new Lo(this),this.stencilTest=new Ro(this),this.depthRange=new ys(this),this.depthTest=new xs(this),this.depthFunc=new Bo(this),this.blend=new vs(this),this.blendFunc=new bs(this),this.blendColor=new Fo(this),this.blendEquation=new ba(this),this.cullFace=new wa(this),this.cullFaceSide=new Mn(this),this.frontFace=new Ll(this),this.program=new Rl(this),this.activeTexture=new Bl(this),this.viewport=new Fl(this),this.bindFramebuffer=new Ol(this),this.bindRenderbuffer=new $l(this),this.bindTexture=new ws(this),this.bindVertexBuffer=new Oo(this),this.bindElementBuffer=new Ts(this),this.bindVertexArrayOES=this.extVertexArrayObject&&new Es(this),this.pixelStoreUnpack=new Pn(this),this.pixelStoreUnpackPremultiplyAlpha=new Ta(this),this.pixelStoreUnpackFlipY=new Ea(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 fs(this,t,n)}createVertexBuffer(t,n,s){return new gs(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 zn(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){ue(t.blendFunction,Ft.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 mt{constructor(t,n,s){this.func=t,this.mask=n,this.range=s}}mt.ReadOnly=!1,mt.ReadWrite=!0,mt.disabled=new mt(519,mt.ReadOnly,[0,1]);const St=7680;class Bt{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}}Bt.disabled=new Bt({func:519,mask:0},0,0,St,St,St);class Vt{constructor(t,n,s){this.enable=t,this.mode=n,this.frontFace=s}}let io;function kn(l,t,n,s,u,p,f){const _=l.context,y=_.gl,v=l.useProgram("collisionBox"),E=[];let M=0,z=0;for(let G=0;G<s.length;G++){const le=s[G],se=t.getTile(le),me=se.getBucket(n);if(!me)continue;let ge=le.posMatrix;u[0]===0&&u[1]===0||(ge=l.translatePosMatrix(le.posMatrix,se,u,p));const be=f?me.textCollisionBox:me.iconCollisionBox,de=me.collisionCircleArray;if(de.length>0){const Re=a.create(),Ce=ge;a.mul(Re,me.placementInvProjMatrix,l.transform.glCoordMatrix),a.mul(Re,Re,me.placementViewportMatrix),E.push({circleArray:de,circleOffset:z,transform:Ce,invTransform:Re,coord:le}),M+=de.length/4,z=M}be&&v.draw(_,y.LINES,mt.disabled,Bt.disabled,l.colorModeForRenderPass(),Vt.disabled,tn(ge,l.transform,se),l.style.terrain&&l.style.terrain.getTerrainData(le),n.id,be.layoutVertexBuffer,be.indexBuffer,be.segments,null,l.transform.zoom,null,null,be.collisionVertexBuffer)}if(!f||!E.length)return;const V=l.useProgram("collisionCircle"),$=new a.CollisionCircleLayoutArray;$.resize(4*M),$._trim();let U=0;for(const G of E)for(let le=0;le<G.circleArray.length/4;le++){const se=4*le,me=G.circleArray[se+0],ge=G.circleArray[se+1],be=G.circleArray[se+2],de=G.circleArray[se+3];$.emplace(U++,me,ge,be,de,0),$.emplace(U++,me,ge,be,de,1),$.emplace(U++,me,ge,be,de,2),$.emplace(U++,me,ge,be,de,3)}(!io||io.length<2*M)&&(io=function(G){const le=2*G,se=new a.QuadTriangleArray;se.resize(le),se._trim();for(let me=0;me<le;me++){const ge=6*me;se.uint16[ge+0]=4*me+0,se.uint16[ge+1]=4*me+1,se.uint16[ge+2]=4*me+2,se.uint16[ge+3]=4*me+2,se.uint16[ge+4]=4*me+3,se.uint16[ge+5]=4*me+0}return se}(M));const H=_.createIndexBuffer(io,!0),Q=_.createVertexBuffer($,a.collisionCircleLayout.members,!0);for(const G of E){const le={u_matrix:G.transform,u_inv_matrix:G.invTransform,u_camera_to_center_distance:(ne=l.transform).cameraToCenterDistance,u_viewport_size:[ne.width,ne.height]};V.draw(_,y.TRIANGLES,mt.disabled,Bt.disabled,l.colorModeForRenderPass(),Vt.disabled,le,l.style.terrain&&l.style.terrain.getTerrainData(G.coord),n.id,Q,H,a.SegmentVector.simpleSegment(0,2*G.circleOffset,G.circleArray.length,G.circleArray.length/2),null,l.transform.zoom,null,null,null)}var ne;Q.destroy(),H.destroy()}Vt.disabled=new Vt(!1,1029,2305),Vt.backCCW=new Vt(!0,1029,2305);const Ul=a.identity(new Float32Array(16));function Vl(l,t,n,s,u,p){const{horizontalAlign:f,verticalAlign:_}=a.getAnchorAlignment(l),y=-(f-.5)*t,v=-(_-.5)*n,E=a.evaluateVariableOffset(l,s);return new a.pointGeometry((y/u+E[0])*p,(v/u+E[1])*p)}function Ca(l,t,n,s,u,p,f,_,y,v,E){const M=l.text.placedSymbolArray,z=l.text.dynamicLayoutVertexArray,V=l.icon.dynamicLayoutVertexArray,$={};z.clear();for(let U=0;U<M.length;U++){const H=M.get(U),Q=l.allowVerticalPlacement&&!H.placedOrientation,ne=H.hidden||!H.crossTileID||Q?null:s[H.crossTileID];if(ne){const G=new a.pointGeometry(H.anchorX,H.anchorY),le=xt(G,n?f:p,E),se=Ki(u.cameraToCenterDistance,le.signedDistanceFromCamera);let me=a.evaluateSizeForFeature(l.textSizeData,y,H)*se/a.ONE_EM;n&&(me*=l.tilePixelRatio/_);const{width:ge,height:be,anchor:de,textOffset:Re,textBoxScale:Ce}=ne,Be=Vl(de,ge,be,Re,Ce,me),st=n?xt(G.add(Be),p,E).point:le.point.add(t?Be.rotate(-u.angle):Be),ht=l.allowVerticalPlacement&&H.placedOrientation===a.WritingMode.vertical?Math.PI/2:0;for(let We=0;We<H.numGlyphs;We++)a.addDynamicAttributes(z,st,ht);v&&H.associatedIconIndex>=0&&($[H.associatedIconIndex]={shiftedAnchor:st,angle:ht})}else rt(H.numGlyphs,z)}if(v){V.clear();const U=l.icon.placedSymbolArray;for(let H=0;H<U.length;H++){const Q=U.get(H);if(Q.hidden)rt(Q.numGlyphs,V);else{const ne=$[H];if(ne)for(let G=0;G<Q.numGlyphs;G++)a.addDynamicAttributes(V,ne.shiftedAnchor,ne.angle);else rt(Q.numGlyphs,V)}}l.icon.dynamicLayoutVertexBuffer.updateData(V)}l.text.dynamicLayoutVertexBuffer.updateData(z)}function Nl(l,t,n){return n.iconsInText&&t?"symbolTextAndIcon":l?"symbolSDF":"symbolIcon"}function Uo(l,t,n,s,u,p,f,_,y,v,E,M){const z=l.context,V=z.gl,$=l.transform,U=_==="map",H=y==="map",Q=_!=="viewport"&&n.layout.get("symbol-placement")!=="point",ne=U&&!H&&!Q,G=!n.layout.get("symbol-sort-key").isConstant();let le=!1;const se=l.depthModeForSublayer(0,mt.ReadOnly),me=n.layout.get("text-variable-anchor"),ge=[];for(const be of s){const de=t.getTile(be),Re=de.getBucket(n);if(!Re)continue;const Ce=u?Re.text:Re.icon;if(!Ce||!Ce.segments.get().length)continue;const Be=Ce.programConfigurations.get(n.id),st=u||Re.sdfIcons,ht=u?Re.textSizeData:Re.iconSizeData,We=H||$.pitch!==0,At=l.useProgram(Nl(st,u,Re),Be),Mt=a.evaluateSizeForZoom(ht,$.zoom),_t=l.style.terrain&&l.style.terrain.getTerrainData(be);let wt,zt,ai,_r,nr=[0,0],yr=null;if(u){if(zt=de.glyphAtlasTexture,ai=V.LINEAR,wt=de.glyphAtlasTexture.size,Re.iconsInText){nr=de.imageAtlasTexture.size,yr=de.imageAtlasTexture;const Qi=ht.kind==="composite"||ht.kind==="camera";_r=We||l.options.rotating||l.options.zooming||Qi?V.LINEAR:V.NEAREST}}else{const Qi=n.layout.get("icon-size").constantOr(0)!==1||Re.iconsNeedLinear;zt=de.imageAtlasTexture,ai=st||l.options.rotating||l.options.zooming||Qi||We?V.LINEAR:V.NEAREST,wt=de.imageAtlasTexture.size}const Xr=Jt(de,1,l.transform.zoom),Yi=Jr(be.posMatrix,H,U,l.transform,Xr),zi=ir(be.posMatrix,H,U,l.transform,Xr),Ar=me&&Re.hasTextData(),Wo=n.layout.get("icon-text-fit")!=="none"&&Ar&&Re.hasIconData();if(Q){const Qi=l.style.terrain?($s,On)=>l.style.terrain.getElevation(be,$s,On):null,an=n.layout.get("text-rotation-alignment")==="map";$i(Re,be.posMatrix,l,u,Yi,zi,H,v,an,Qi)}const ii=l.translatePosMatrix(be.posMatrix,de,p,f),dt=Q||u&&me||Wo?Ul:Yi,Ct=l.translatePosMatrix(zi,de,p,f,!0),li=st&&n.paint.get(u?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let ci;ci=st?Re.iconsInText?ya(ht.kind,Mt,ne,H,l,ii,dt,Ct,wt,nr):Do(ht.kind,Mt,ne,H,l,ii,dt,Ct,u,wt,!0):ps(ht.kind,Mt,ne,H,l,ii,dt,Ct,u,wt);const Gt={program:At,buffers:Ce,uniformValues:ci,atlasTexture:zt,atlasTextureIcon:yr,atlasInterpolation:ai,atlasInterpolationIcon:_r,isSDF:st,hasHalo:li};if(G&&Re.canOverlap){le=!0;const Qi=Ce.segments.get();for(const an of Qi)ge.push({segments:new a.SegmentVector([an]),sortKey:an.sortKey,state:Gt,terrainData:_t})}else ge.push({segments:Ce.segments,sortKey:0,state:Gt,terrainData:_t})}le&&ge.sort((be,de)=>be.sortKey-de.sortKey);for(const be of ge){const de=be.state;if(z.activeTexture.set(V.TEXTURE0),de.atlasTexture.bind(de.atlasInterpolation,V.CLAMP_TO_EDGE),de.atlasTextureIcon&&(z.activeTexture.set(V.TEXTURE1),de.atlasTextureIcon&&de.atlasTextureIcon.bind(de.atlasInterpolationIcon,V.CLAMP_TO_EDGE)),de.isSDF){const Re=de.uniformValues;de.hasHalo&&(Re.u_is_halo=1,ro(de.buffers,be.segments,n,l,de.program,se,E,M,Re,be.terrainData)),Re.u_is_halo=0}ro(de.buffers,be.segments,n,l,de.program,se,E,M,de.uniformValues,be.terrainData)}}function ro(l,t,n,s,u,p,f,_,y,v){const E=s.context;u.draw(E,E.gl.TRIANGLES,p,f,_,Vt.disabled,y,v,n.id,l.layoutVertexBuffer,l.indexBuffer,t,n.paint,s.transform.zoom,l.programConfigurations.get(n.id),l.dynamicLayoutVertexBuffer,l.opacityVertexBuffer)}function no(l,t,n,s,u,p,f){const _=l.context.gl,y=n.paint.get("fill-pattern"),v=y&&y.constantOr(1),E=n.getCrossfadeParameters();let M,z,V,$,U;f?(z=v&&!n.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",M=_.LINES):(z=v?"fillPattern":"fill",M=_.TRIANGLES);for(const H of s){const Q=t.getTile(H);if(v&&!Q.patternsLoaded())continue;const ne=Q.getBucket(n);if(!ne)continue;const G=ne.programConfigurations.get(n.id),le=l.useProgram(z,G),se=l.style.terrain&&l.style.terrain.getTerrainData(H);v&&(l.context.activeTexture.set(_.TEXTURE0),Q.imageAtlasTexture.bind(_.LINEAR,_.CLAMP_TO_EDGE),G.updatePaintBuffers(E));const me=y.constantOr(null);if(me&&Q.imageAtlas){const de=Q.imageAtlas,Re=de.patternPositions[me.to.toString()],Ce=de.patternPositions[me.from.toString()];Re&&Ce&&G.setConstantPatternPositions(Re,Ce)}const ge=se?H:null,be=l.translatePosMatrix(ge?ge.posMatrix:H.posMatrix,Q,n.paint.get("fill-translate"),n.paint.get("fill-translate-anchor"));if(f){$=ne.indexBuffer2,U=ne.segments2;const de=[_.drawingBufferWidth,_.drawingBufferHeight];V=z==="fillOutlinePattern"&&v?fa(be,l,E,Q,de):da(be,de)}else $=ne.indexBuffer,U=ne.segments,V=v?us(be,l,E,Q):Mo(be);le.draw(l.context,M,u,l.stencilModeForClipping(H),p,Vt.disabled,V,se,n.id,ne.layoutVertexBuffer,$,U,n.paint,l.transform.zoom,G)}}function oo(l,t,n,s,u,p,f){const _=l.context,y=_.gl,v=n.paint.get("fill-extrusion-pattern"),E=v.constantOr(1),M=n.getCrossfadeParameters(),z=n.paint.get("fill-extrusion-opacity");for(const V of s){const $=t.getTile(V),U=$.getBucket(n);if(!U)continue;const H=l.style.terrain&&l.style.terrain.getTerrainData(V),Q=U.programConfigurations.get(n.id),ne=l.useProgram(E?"fillExtrusionPattern":"fillExtrusion",Q);E&&(l.context.activeTexture.set(y.TEXTURE0),$.imageAtlasTexture.bind(y.LINEAR,y.CLAMP_TO_EDGE),Q.updatePaintBuffers(M));const G=v.constantOr(null);if(G&&$.imageAtlas){const ge=$.imageAtlas,be=ge.patternPositions[G.to.toString()],de=ge.patternPositions[G.from.toString()];be&&de&&Q.setConstantPatternPositions(be,de)}const le=l.translatePosMatrix(V.posMatrix,$,n.paint.get("fill-extrusion-translate"),n.paint.get("fill-extrusion-translate-anchor")),se=n.paint.get("fill-extrusion-vertical-gradient"),me=E?Pl(le,l,se,z,V,M,$):cs(le,l,se,z);ne.draw(_,_.gl.TRIANGLES,u,p,f,Vt.backCCW,me,H,n.id,U.layoutVertexBuffer,U.indexBuffer,U.segments,n.paint,l.transform.zoom,Q,l.style.terrain&&U.centroidVertexBuffer)}}function Ss(l,t,n,s,u,p,f){const _=l.context,y=_.gl,v=n.fbo;if(!v)return;const E=l.useProgram("hillshade"),M=l.style.terrain&&l.style.terrain.getTerrainData(t);_.activeTexture.set(y.TEXTURE0),y.bindTexture(y.TEXTURE_2D,v.colorAttachment.get()),E.draw(_,y.TRIANGLES,u,p,f,Vt.disabled,((z,V,$,U)=>{const H=$.paint.get("hillshade-shadow-color"),Q=$.paint.get("hillshade-highlight-color"),ne=$.paint.get("hillshade-accent-color");let G=$.paint.get("hillshade-illumination-direction")*(Math.PI/180);$.paint.get("hillshade-illumination-anchor")==="viewport"&&(G-=z.transform.angle);const le=!z.options.moving;return{u_matrix:U?U.posMatrix:z.transform.calculatePosMatrix(V.tileID.toUnwrapped(),le),u_image:0,u_latrange:zo(0,V.tileID),u_light:[$.paint.get("hillshade-exaggeration"),G],u_shadow:H,u_highlight:Q,u_accent:ne}})(l,n,s,M?t:null),M,s.id,l.rasterBoundsBuffer,l.quadTriangleIndexBuffer,l.rasterBoundsSegments)}function Aa(l,t,n,s,u,p){const f=l.context,_=f.gl,y=t.dem;if(y&&y.data){const v=y.dim,E=y.stride,M=y.getPixels();if(f.activeTexture.set(_.TEXTURE1),f.pixelStoreUnpackPremultiplyAlpha.set(!1),t.demTexture=t.demTexture||l.getTileTexture(E),t.demTexture){const V=t.demTexture;V.update(M,{premultiply:!1}),V.bind(_.NEAREST,_.CLAMP_TO_EDGE)}else t.demTexture=new Ue(f,M,_.RGBA,{premultiply:!1}),t.demTexture.bind(_.NEAREST,_.CLAMP_TO_EDGE);f.activeTexture.set(_.TEXTURE0);let z=t.fbo;if(!z){const V=new Ue(f,{width:v,height:v,data:null},_.RGBA);V.bind(_.LINEAR,_.CLAMP_TO_EDGE),z=t.fbo=f.createFramebuffer(v,v,!0),z.colorAttachment.set(V.texture)}f.bindFramebuffer.set(z.framebuffer),f.viewport.set([0,0,v,v]),l.useProgram("hillshadePrepare").draw(f,_.TRIANGLES,s,u,p,Vt.disabled,((V,$)=>{const U=$.stride,H=a.create();return a.ortho(H,0,a.EXTENT,-a.EXTENT,0,0,1),a.translate(H,H,[0,-a.EXTENT,0]),{u_matrix:H,u_image:1,u_dimension:[U,U],u_zoom:V.overscaledZ,u_unpack:$.getUnpackVector()}})(t.tileID,y),null,n.id,l.rasterBoundsBuffer,l.quadTriangleIndexBuffer,l.rasterBoundsSegments),t.needsHillshadePrepare=!1}}function Vo(l,t,n,s,u,p){const f=s.paint.get("raster-fade-duration");if(!p&&f>0){const _=a.exported.now(),y=(_-l.timeAdded)/f,v=t?(_-t.timeAdded)/f:-1,E=n.getSource(),M=u.coveringZoomLevel({tileSize:E.tileSize,roundZoom:E.roundZoom}),z=!t||Math.abs(t.tileID.overscaledZ-M)>Math.abs(l.tileID.overscaledZ-M),V=z&&l.refreshedUponExpiration?1:a.clamp(z?y:1-v,0,1);return l.refreshedUponExpiration&&y>=1&&(l.refreshedUponExpiration=!1),t?{opacity:1,mix:1-V}:{opacity:V,mix:0}}return{opacity:1,mix:0}}const No=new a.Color(1,0,0,1),rr=new a.Color(0,1,0,1),Ma=new a.Color(0,0,1,1),Is=new a.Color(1,0,1,1),Pa=new a.Color(0,1,1,1);function nn(l,t,n,s){Dn(l,0,t+n/2,l.transform.width,n,s)}function so(l,t,n,s){Dn(l,t-n/2,0,n,l.transform.height,s)}function Dn(l,t,n,s,u,p){const f=l.context,_=f.gl;_.enable(_.SCISSOR_TEST),_.scissor(t*l.pixelRatio,n*l.pixelRatio,s*l.pixelRatio,u*l.pixelRatio),f.clear({color:p}),_.disable(_.SCISSOR_TEST)}function Gl(l,t,n){const s=l.context,u=s.gl,p=n.posMatrix,f=l.useProgram("debug"),_=mt.disabled,y=Bt.disabled,v=l.colorModeForRenderPass(),E="$debug",M=l.style.terrain&&l.style.terrain.getTerrainData(n);s.activeTexture.set(u.TEXTURE0),l.emptyTexture.bind(u.LINEAR,u.CLAMP_TO_EDGE);const z=t.getTileByID(n.key).latestRawTileData,V=Math.floor((z&&z.byteLength||0)/1024),$=t.getTile(n).tileSize,U=512/Math.min($,512)*(n.overscaledZ/l.transform.zoom)*.5;let H=n.canonical.toString();n.overscaledZ!==n.canonical.z&&(H+=` => ${n.overscaledZ}`),function(Q,ne){Q.initDebugOverlayCanvas();const G=Q.debugOverlayCanvas,le=Q.context.gl,se=Q.debugOverlayCanvas.getContext("2d");se.clearRect(0,0,G.width,G.height),se.shadowColor="white",se.shadowBlur=2,se.lineWidth=1.5,se.strokeStyle="white",se.textBaseline="top",se.font="bold 36px Open Sans, sans-serif",se.fillText(ne,5,5),se.strokeText(ne,5,5),Q.debugOverlayTexture.update(G),Q.debugOverlayTexture.bind(le.LINEAR,le.CLAMP_TO_EDGE)}(l,`${H} ${V}kB`),f.draw(s,u.TRIANGLES,_,y,Ft.alphaBlended,Vt.disabled,Jn(p,a.Color.transparent,U),null,E,l.debugBuffer,l.quadTriangleIndexBuffer,l.debugSegments),f.draw(s,u.LINE_STRIP,_,y,v,Vt.disabled,Jn(p,a.Color.red),M,E,l.debugBuffer,l.tileBorderIndexBuffer,l.debugSegments)}function Go(l,t,n){const s=l.context,u=s.gl,p=l.colorModeForRenderPass(),f=new mt(u.LEQUAL,mt.ReadWrite,l.depthRangeFor3D),_=l.useProgram("terrain"),y=t.getTerrainMesh(),v=t.getTerrainData(n.tileID);s.bindFramebuffer.set(null),s.viewport.set([0,0,l.width,l.height]),s.activeTexture.set(u.TEXTURE0),u.bindTexture(u.TEXTURE_2D,t.getRTTFramebuffer().colorAttachment.get());const E=l.transform.calculatePosMatrix(n.tileID.toUnwrapped());_.draw(s,u.TRIANGLES,f,Bt.disabled,p,Vt.backCCW,{u_matrix:E,u_texture:0},v,"terrain",y.vertexBuffer,y.indexBuffer,y.segments)}function za(l,t,n,s){const u=l.context,p=n.tileSize*t.qualityFactor;n.textures[s]||(n.textures[s]=l.getTileTexture(p)||new Ue(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 ka{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(za(s,s.style.terrain,v,_),this._rerender[v.tileID.key]){s.context.clear({color:a.Color.transparent});for(let E=0;E<y.length;E++){const M=s.style._layers[y[E]],z=M.source?this._coordsDescendingInv[M.source][v.tileID.key]:[v.tileID];s._renderTileClippingMasks(M,z),s.renderLayer(s,s.style.sourceCaches[M.source],M,z),M.source&&(v.textureCoords[M.source]=this._coordsDescendingInvStr[M.source][v.tileID.key])}}Go(s,s.style.terrain,v)}if(n==="hillshade"){this._stacks.push([u[p]]);for(const v of this._renderableTiles){const E=this._coordsDescendingInv[t.source][v.tileID.key];za(s,s.style.terrain,v,this._stacks.length-1),s.context.clear({color:a.Color.transparent}),s._renderTileClippingMasks(t,E),s.renderLayer(s,s.style.sourceCaches[t.source],t,E),Go(s,s.style.terrain,v)}return!0}return this._renderToTexture[n]}return!1}}const ao={symbol:function(l,t,n,s,u){if(l.renderPass!=="translucent")return;const p=Bt.disabled,f=l.colorModeForRenderPass();n.layout.get("text-variable-anchor")&&function(_,y,v,E,M,z,V){const $=y.transform,U=M==="map",H=z==="map";for(const Q of _){const ne=E.getTile(Q),G=ne.getBucket(v);if(!G||!G.text||!G.text.segments.get().length)continue;const le=a.evaluateSizeForZoom(G.textSizeData,$.zoom),se=Jt(ne,1,y.transform.zoom),me=Jr(Q.posMatrix,H,U,y.transform,se),ge=v.layout.get("icon-text-fit")!=="none"&&G.hasIconData();if(le){const be=Math.pow(2,$.zoom-ne.tileID.overscaledZ);Ca(G,U,H,V,$,me,Q.posMatrix,be,le,ge,y.style.terrain?(de,Re)=>y.style.terrain.getElevation(Q,de,Re):null)}}}(s,l,n,t,n.layout.get("text-rotation-alignment"),n.layout.get("text-pitch-alignment"),u),n.paint.get("icon-opacity").constantOr(1)!==0&&Uo(l,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&&Uo(l,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&&(kn(l,t,n,s,n.paint.get("text-translate"),n.paint.get("text-translate-anchor"),!0),kn(l,t,n,s,n.paint.get("icon-translate"),n.paint.get("icon-translate-anchor"),!1))},circle:function(l,t,n,s){if(l.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=l.context,v=y.gl,E=l.depthModeForSublayer(0,mt.ReadOnly),M=Bt.disabled,z=l.colorModeForRenderPass(),V=[];for(let $=0;$<s.length;$++){const U=s[$],H=t.getTile(U),Q=H.getBucket(n);if(!Q)continue;const ne=Q.programConfigurations.get(n.id),G=l.useProgram("circle",ne),le=Q.layoutVertexBuffer,se=Q.indexBuffer,me=l.style.terrain&&l.style.terrain.getTerrainData(U),ge={programConfiguration:ne,program:G,layoutVertexBuffer:le,indexBuffer:se,uniformValues:ma(l,U,H,n),terrainData:me};if(_){const be=Q.segments.get();for(const de of be)V.push({segments:new a.SegmentVector([de]),sortKey:de.sortKey,state:ge})}else V.push({segments:Q.segments,sortKey:0,state:ge})}_&&V.sort(($,U)=>$.sortKey-U.sortKey);for(const $ of V){const{programConfiguration:U,program:H,layoutVertexBuffer:Q,indexBuffer:ne,uniformValues:G,terrainData:le}=$.state;H.draw(y,v.TRIANGLES,E,M,z,Vt.disabled,G,le,n.id,Q,ne,$.segments,n.paint,l.transform.zoom,U)}},heatmap:function(l,t,n,s){if(n.paint.get("heatmap-opacity")!==0)if(l.renderPass==="offscreen"){const u=l.context,p=u.gl,f=Bt.disabled,_=new Ft([p.ONE,p.ONE],a.Color.transparent,[!0,!0,!0,!0]);(function(y,v,E){const M=y.gl;y.activeTexture.set(M.TEXTURE1),y.viewport.set([0,0,v.width/4,v.height/4]);let z=E.heatmapFbo;if(z)M.bindTexture(M.TEXTURE_2D,z.colorAttachment.get()),y.bindFramebuffer.set(z.framebuffer);else{const V=M.createTexture();M.bindTexture(M.TEXTURE_2D,V),M.texParameteri(M.TEXTURE_2D,M.TEXTURE_WRAP_S,M.CLAMP_TO_EDGE),M.texParameteri(M.TEXTURE_2D,M.TEXTURE_WRAP_T,M.CLAMP_TO_EDGE),M.texParameteri(M.TEXTURE_2D,M.TEXTURE_MIN_FILTER,M.LINEAR),M.texParameteri(M.TEXTURE_2D,M.TEXTURE_MAG_FILTER,M.LINEAR),z=E.heatmapFbo=y.createFramebuffer(v.width/4,v.height/4,!1),function($,U,H,Q){const ne=$.gl;ne.texImage2D(ne.TEXTURE_2D,0,ne.RGBA,U.width/4,U.height/4,0,ne.RGBA,$.extRenderToTextureHalfFloat?$.extTextureHalfFloat.HALF_FLOAT_OES:ne.UNSIGNED_BYTE,null),Q.colorAttachment.set(H)}(y,v,V,z)}})(u,l,n),u.clear({color:a.Color.transparent});for(let y=0;y<s.length;y++){const v=s[y];if(t.hasRenderableParent(v))continue;const E=t.getTile(v),M=E.getBucket(n);if(!M)continue;const z=M.programConfigurations.get(n.id),V=l.useProgram("heatmap",z),{zoom:$}=l.transform;V.draw(u,p.TRIANGLES,mt.disabled,f,_,Vt.disabled,Po(v.posMatrix,E,$,n.paint.get("heatmap-intensity")),null,n.id,M.layoutVertexBuffer,M.indexBuffer,M.segments,n.paint,l.transform.zoom,z)}u.viewport.set([0,0,l.width,l.height])}else l.renderPass==="translucent"&&(l.context.setColorMode(l.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 Ue(f,p.colorRamp,_.RGBA)),v.bind(_.LINEAR,_.CLAMP_TO_EDGE),u.useProgram("heatmapTexture").draw(f,_.TRIANGLES,mt.disabled,Bt.disabled,u.colorModeForRenderPass(),Vt.disabled,((E,M,z,V)=>{const $=a.create();a.ortho($,0,E.width,E.height,0,0,1);const U=E.context.gl;return{u_matrix:$,u_world:[U.drawingBufferWidth,U.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:M.paint.get("heatmap-opacity")}})(u,p),null,p.id,u.viewportBuffer,u.quadTriangleIndexBuffer,u.viewportSegments,p.paint,u.transform.zoom)}(l,n))},line:function(l,t,n,s){if(l.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=l.depthModeForSublayer(0,mt.ReadOnly),_=l.colorModeForRenderPass(),y=n.paint.get("line-dasharray"),v=n.paint.get("line-pattern"),E=v.constantOr(1),M=n.paint.get("line-gradient"),z=n.getCrossfadeParameters(),V=E?"linePattern":y?"lineSDF":M?"lineGradient":"line",$=l.context,U=$.gl;let H=!0;for(const Q of s){const ne=t.getTile(Q);if(E&&!ne.patternsLoaded())continue;const G=ne.getBucket(n);if(!G)continue;const le=G.programConfigurations.get(n.id),se=l.context.program.get(),me=l.useProgram(V,le),ge=H||me.program!==se,be=l.style.terrain&&l.style.terrain.getTerrainData(Q),de=v.constantOr(null);if(de&&ne.imageAtlas){const Be=ne.imageAtlas,st=Be.patternPositions[de.to.toString()],ht=Be.patternPositions[de.from.toString()];st&&ht&&le.setConstantPatternPositions(st,ht)}const Re=be?Q:null,Ce=E?ko(l,ne,n,z,Re):y?Yn(l,ne,n,y,z,Re):M?hs(l,ne,n,G.lineClipsArray.length,Re):An(l,ne,n,Re);if(E)$.activeTexture.set(U.TEXTURE0),ne.imageAtlasTexture.bind(U.LINEAR,U.CLAMP_TO_EDGE),le.updatePaintBuffers(z);else if(y&&(ge||l.lineAtlas.dirty))$.activeTexture.set(U.TEXTURE0),l.lineAtlas.bind($);else if(M){const Be=G.gradients[n.id];let st=Be.texture;if(n.gradientVersion!==Be.version){let ht=256;if(n.stepInterpolant){const We=t.getSource().maxzoom,At=Q.canonical.z===We?Math.ceil(1<<l.transform.maxZoom-Q.canonical.z):1;ht=a.clamp(a.nextPowerOfTwo(G.maxLineLength/a.EXTENT*1024*At),256,$.maxTextureSize)}Be.gradient=a.renderColorRamp({expression:n.gradientExpression(),evaluationKey:"lineProgress",resolution:ht,image:Be.gradient||void 0,clips:G.lineClipsArray}),Be.texture?Be.texture.update(Be.gradient):Be.texture=new Ue($,Be.gradient,U.RGBA),Be.version=n.gradientVersion,st=Be.texture}$.activeTexture.set(U.TEXTURE0),st.bind(n.stepInterpolant?U.NEAREST:U.LINEAR,U.CLAMP_TO_EDGE)}me.draw($,U.TRIANGLES,f,l.stencilModeForClipping(Q),_,Vt.disabled,Ce,be,n.id,G.layoutVertexBuffer,G.indexBuffer,G.segments,n.paint,l.transform.zoom,le,G.layoutVertexBuffer2),H=!1}},fill:function(l,t,n,s){const u=n.paint.get("fill-color"),p=n.paint.get("fill-opacity");if(p.constantOr(1)===0)return;const f=l.colorModeForRenderPass(),_=n.paint.get("fill-pattern"),y=l.opaquePassEnabledForLayer()&&!_.constantOr(1)&&u.constantOr(a.Color.transparent).a===1&&p.constantOr(0)===1?"opaque":"translucent";if(l.renderPass===y){const v=l.depthModeForSublayer(1,l.renderPass==="opaque"?mt.ReadWrite:mt.ReadOnly);no(l,t,n,s,v,f,!1)}if(l.renderPass==="translucent"&&n.paint.get("fill-antialias")){const v=l.depthModeForSublayer(n.getPaintProperty("fill-outline-color")?2:0,mt.ReadOnly);no(l,t,n,s,v,f,!0)}},"fill-extrusion":function(l,t,n,s){const u=n.paint.get("fill-extrusion-opacity");if(u!==0&&l.renderPass==="translucent"){const p=new mt(l.context.gl.LEQUAL,mt.ReadWrite,l.depthRangeFor3D);if(u!==1||n.paint.get("fill-extrusion-pattern").constantOr(1))oo(l,t,n,s,p,Bt.disabled,Ft.disabled),oo(l,t,n,s,p,l.stencilModeFor3D(),l.colorModeForRenderPass());else{const f=l.colorModeForRenderPass();oo(l,t,n,s,p,Bt.disabled,f)}}},hillshade:function(l,t,n,s){if(l.renderPass!=="offscreen"&&l.renderPass!=="translucent")return;const u=l.context,p=l.depthModeForSublayer(0,mt.ReadOnly),f=l.colorModeForRenderPass(),[_,y]=l.renderPass==="translucent"?l.stencilConfigForOverlap(s):[{},s];for(const v of y){const E=t.getTile(v);E.needsHillshadePrepare!==void 0&&E.needsHillshadePrepare&&l.renderPass==="offscreen"?Aa(l,E,n,p,Bt.disabled,f):l.renderPass==="translucent"&&Ss(l,v,E,n,p,_[v.overscaledZ],f)}u.viewport.set([0,0,l.width,l.height])},raster:function(l,t,n,s){if(l.renderPass!=="translucent"||n.paint.get("raster-opacity")===0||!s.length)return;const u=l.context,p=u.gl,f=t.getSource(),_=l.useProgram("raster"),y=l.colorModeForRenderPass(),[v,E]=f instanceof Ci?[{},s]:l.stencilConfigForOverlap(s),M=E[E.length-1].overscaledZ,z=!l.options.moving;for(const V of E){const $=l.depthModeForSublayer(V.overscaledZ-M,n.paint.get("raster-opacity")===1?mt.ReadWrite:mt.ReadOnly,p.LESS),U=t.getTile(V);U.registerFadeDuration(n.paint.get("raster-fade-duration"));const H=t.findLoadedParent(V,0),Q=Vo(U,H,t,n,l.transform,l.style.terrain);let ne,G;const le=n.paint.get("raster-resampling")==="nearest"?p.NEAREST:p.LINEAR;u.activeTexture.set(p.TEXTURE0),U.texture.bind(le,p.CLAMP_TO_EDGE,p.LINEAR_MIPMAP_NEAREST),u.activeTexture.set(p.TEXTURE1),H?(H.texture.bind(le,p.CLAMP_TO_EDGE,p.LINEAR_MIPMAP_NEAREST),ne=Math.pow(2,H.tileID.overscaledZ-U.tileID.overscaledZ),G=[U.tileID.canonical.x*ne%1,U.tileID.canonical.y*ne%1]):U.texture.bind(le,p.CLAMP_TO_EDGE,p.LINEAR_MIPMAP_NEAREST);const se=l.style.terrain&&l.style.terrain.getTerrainData(V),me=se?V:null,ge=me?me.posMatrix:l.transform.calculatePosMatrix(V.toUnwrapped(),z),be=ga(ge,G||[0,0],ne||1,Q,n);f instanceof Ci?_.draw(u,p.TRIANGLES,$,Bt.disabled,y,Vt.disabled,be,se,n.id,f.boundsBuffer,l.quadTriangleIndexBuffer,f.boundsSegments):_.draw(u,p.TRIANGLES,$,v[V.overscaledZ],y,Vt.disabled,be,se,n.id,l.rasterBoundsBuffer,l.quadTriangleIndexBuffer,l.rasterBoundsSegments)}},background:function(l,t,n,s){const u=n.paint.get("background-color"),p=n.paint.get("background-opacity");if(p===0)return;const f=l.context,_=f.gl,y=l.transform,v=y.tileSize,E=n.paint.get("background-pattern");if(l.isPatternMissing(E))return;const M=!E&&u.a===1&&p===1&&l.opaquePassEnabledForLayer()?"opaque":"translucent";if(l.renderPass!==M)return;const z=Bt.disabled,V=l.depthModeForSublayer(0,M==="opaque"?mt.ReadWrite:mt.ReadOnly),$=l.colorModeForRenderPass(),U=l.useProgram(E?"backgroundPattern":"background"),H=s||y.coveringTiles({tileSize:v,terrain:l.style.terrain});E&&(f.activeTexture.set(_.TEXTURE0),l.imageManager.bind(l.context));const Q=n.getCrossfadeParameters();for(const ne of H){const G=s?ne.posMatrix:l.transform.calculatePosMatrix(ne.toUnwrapped()),le=E?kl(G,p,l,E,{tileID:ne,tileSize:v},Q):zl(G,p,u),se=l.style.terrain&&l.style.terrain.getTerrainData(ne);U.draw(f,_.TRIANGLES,V,z,$,Vt.disabled,le,se,n.id,l.tileExtentBuffer,l.quadTriangleIndexBuffer,l.tileExtentSegments)}},debug:function(l,t,n){for(let s=0;s<n.length;s++)Gl(l,t,n[s])},custom:function(l,t,n){const s=l.context,u=n.implementation;if(l.renderPass==="offscreen"){const p=u.prerender;p&&(l.setCustomLayerDefaults(),s.setColorMode(l.colorModeForRenderPass()),p.call(u,s.gl,l.transform.customLayerMatrix()),s.setDirty(),l.setBaseState())}else if(l.renderPass==="translucent"){l.setCustomLayerDefaults(),s.setColorMode(l.colorModeForRenderPass()),s.setStencilMode(Bt.disabled);const p=u.renderingMode==="3d"?new mt(l.context.gl.LEQUAL,mt.ReadWrite,l.depthRangeFor3D):l.depthModeForSublayer(0,mt.ReadOnly);s.setDepthMode(p),u.render(s.gl,l.transform.customLayerMatrix()),s.setDirty(),l.setBaseState(),s.bindFramebuffer.set(null)}}};class Cs{constructor(t,n){this.context=new Ia(t),this.transform=n,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:a.create(),renderTime:0},this.setup(),this.numSublayers=Mi.maxUnderzooming+Mi.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Qe,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 a.PosArray;n.emplaceBack(0,0),n.emplaceBack(a.EXTENT,0),n.emplaceBack(0,a.EXTENT),n.emplaceBack(a.EXTENT,a.EXTENT),this.tileExtentBuffer=t.createVertexBuffer(n,vt.members),this.tileExtentSegments=a.SegmentVector.simpleSegment(0,0,4,2);const s=new a.PosArray;s.emplaceBack(0,0),s.emplaceBack(a.EXTENT,0),s.emplaceBack(0,a.EXTENT),s.emplaceBack(a.EXTENT,a.EXTENT),this.debugBuffer=t.createVertexBuffer(s,vt.members),this.debugSegments=a.SegmentVector.simpleSegment(0,0,4,5);const u=new a.RasterBoundsArray;u.emplaceBack(0,0,0,0),u.emplaceBack(a.EXTENT,0,a.EXTENT,0),u.emplaceBack(0,a.EXTENT,0,a.EXTENT),u.emplaceBack(a.EXTENT,a.EXTENT,a.EXTENT,a.EXTENT),this.rasterBoundsBuffer=t.createVertexBuffer(u,wi.members),this.rasterBoundsSegments=a.SegmentVector.simpleSegment(0,0,4,2);const p=new a.PosArray;p.emplaceBack(0,0),p.emplaceBack(1,0),p.emplaceBack(0,1),p.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(p,vt.members),this.viewportSegments=a.SegmentVector.simpleSegment(0,0,4,2);const f=new a.LineStripIndexArray;f.emplaceBack(0),f.emplaceBack(1),f.emplaceBack(3),f.emplaceBack(2),f.emplaceBack(0),this.tileBorderIndexBuffer=t.createIndexBuffer(f);const _=new a.TriangleIndexArray;_.emplaceBack(0,1,2),_.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(_),this.emptyTexture=new Ue(t,{width:1,height:1,data:new Uint8Array([0,0,0,0])},t.gl.RGBA);const y=this.context.gl;this.stencilClearMode=new Bt({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=a.create();a.ortho(s,0,this.width,this.height,0,0,1),a.scale(s,s,[n.drawingBufferWidth,n.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(t,n.TRIANGLES,mt.disabled,this.stencilClearMode,Ft.disabled,Vt.disabled,Cn(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(Ft.disabled),s.setDepthMode(mt.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,mt.disabled,new Bt({func:u.ALWAYS,mask:0},_,255,u.KEEP,u.KEEP,u.REPLACE),Ft.disabled,Vt.disabled,Cn(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 Bt({func:n.NOTEQUAL,mask:255},t,255,n.KEEP,n.KEEP,n.REPLACE)}stencilModeForClipping(t){const n=this.context.gl;return new Bt({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 Bt({func:n.GEQUAL,mask:255},_+this.nextStencilID,255,n.KEEP,n.KEEP,n.REPLACE);return this.nextStencilID+=p,[f,s]}return[{[u]:Bt.disabled},s]}colorModeForRenderPass(){const t=this.context.gl;return this._showOverdrawInspector?new Ft([t.CONSTANT_COLOR,t.ONE],new a.Color(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?Ft.unblended:Ft.alphaBlended}depthModeForSublayer(t,n,s){if(!this.opaquePassEnabledForLayer())return mt.disabled;const u=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new mt(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(a.exported.now()),this.imageManager.beginFrame();const s=this.style._order,u=this.style.sourceCaches,p=this.style.terrain&&new ka(this);for(const v in u){const E=u[v];E.used&&E.prepare(this.context)}const f={},_={},y={};for(const v in u){const E=u[v];f[v]=E.getVisibleCoordinates(),_[v]=f[v].slice().reverse(),y[v]=E.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||!a.equals(this.terrainFacilitator.matrix,this.transform.projMatrix)||v.length)&&(a.copy(this.terrainFacilitator.matrix,this.transform.projMatrix),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(E,M){const z=E.context,V=z.gl,$=Ft.unblended,U=new mt(V.LEQUAL,mt.ReadWrite,[0,1]),H=M.getTerrainMesh(),Q=M.sourceCache.getRenderableTiles(),ne=E.useProgram("terrainDepth");z.bindFramebuffer.set(M.getFramebuffer("depth").framebuffer),z.viewport.set([0,0,E.width/devicePixelRatio,E.height/devicePixelRatio]),z.clear({color:a.Color.transparent,depth:1});for(const G of Q){const le=M.getTerrainData(G.tileID),se=E.transform.calculatePosMatrix(G.tileID.toUnwrapped());ne.draw(z,V.TRIANGLES,U,Bt.disabled,$,Vt.backCCW,{u_matrix:se},le,"terrain",H.vertexBuffer,H.indexBuffer,H.segments)}z.bindFramebuffer.set(null),z.viewport.set([0,0,E.width,E.height])}(this,this.style.terrain),function(E,M){const z=E.context,V=z.gl,$=Ft.unblended,U=new mt(V.LEQUAL,mt.ReadWrite,[0,1]),H=M.getTerrainMesh(),Q=M.getCoordsTexture(),ne=M.sourceCache.getRenderableTiles(),G=E.useProgram("terrainCoords");z.bindFramebuffer.set(M.getFramebuffer("coords").framebuffer),z.viewport.set([0,0,E.width/devicePixelRatio,E.height/devicePixelRatio]),z.clear({color:a.Color.transparent,depth:1}),M.coordsIndex=[];for(const le of ne){const se=M.getTerrainData(le.tileID);z.activeTexture.set(V.TEXTURE0),V.bindTexture(V.TEXTURE_2D,Q.texture);const me=E.transform.calculatePosMatrix(le.tileID.toUnwrapped());G.draw(z,V.TRIANGLES,U,Bt.disabled,$,Vt.backCCW,{u_matrix:me,u_terrain_coords_id:(255-M.coordsIndex.length)/255,u_texture:0},se,"terrain",H.vertexBuffer,H.indexBuffer,H.segments),M.coordsIndex.push(le.tileID.key)}z.bindFramebuffer.set(null),z.viewport.set([0,0,E.width,E.height])}(this,this.style.terrain))}this.renderPass="offscreen";for(const v of s){const E=this.style._layers[v];if(!E.hasOffscreenPass()||E.isHidden(this.transform.zoom))continue;const M=_[E.source];(E.type==="custom"||M.length)&&this.renderLayer(this,u[E.source],E,M)}if(this.context.bindFramebuffer.set(null),this.context.clear({color:n.showOverdrawInspector?a.Color.black:a.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]],E=u[v.source],M=f[v.source];this._renderTileClippingMasks(v,M),this.renderLayer(this,E,v,M)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<s.length;this.currentLayer++){const v=this.style._layers[s[this.currentLayer]],E=u[v.source];if(p&&p.renderLayer(v))continue;const M=(v.type==="symbol"?y:_)[v.source];this._renderTileClippingMasks(v,f[v.source]),this.renderLayer(this,E,v,M)}if(this.options.showTileBoundaries){let v,E;Object.values(this.style._layers).forEach(M=>{M.source&&!M.isHidden(this.transform.zoom)&&(M.source!==(E&&E.id)&&(E=this.style.sourceCaches[M.source]),(!v||v.getSource().maxzoom<E.getSource().maxzoom)&&(v=E))}),v&&ao.debug(this,v,v.getVisibleCoordinates())}this.options.showPadding&&function(v){const E=v.transform.padding;nn(v,v.transform.height-(E.top||0),3,No),nn(v,E.bottom||0,3,rr),so(v,E.left||0,3,Ma),so(v,v.transform.width-(E.right||0),3,Is);const M=v.transform.centerPoint;(function(z,V,$,U){Dn(z,V-1,$-10,2,20,U),Dn(z,V-10,$-1,20,2,U)})(v,M.x,v.transform.height-M.y,Pa)}(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),ao[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),E=Math.cos(f);s=[s[0]*E-s[1]*v,s[0]*v+s[1]*E]}const _=[p?s[0]:Jt(n,s[0],this.transform.zoom),p?s[1]:Jt(n,s[1],this.transform.zoom),0],y=new Float32Array(16);return a.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 ha(this.context,t,Kn[t],n,ds[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 Ue(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}}class qo{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/(_=a.transformMat4([],_,t))[3]/n*u;return a.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=a.sub([],p[_[0]],p[_[1]]),v=a.sub([],p[_[2]],p[_[1]]),E=a.normalize([],a.cross([],y,v)),M=-a.dot(E,p[_[1]]);return E.concat(M)});return new qo(p,f)}}class lo{constructor(t,n){this.min=t,this.max=n,this.center=a.scale$1([],a.add([],this.min,this.max),.5)}quadrant(t){const n=[t%2==0,t<2],s=a.clone$2(this.min),u=a.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 lo(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;_++)a.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 Ln{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=a.number(t.top,n.top,s)),n.bottom!=null&&t.bottom!=null&&(this.bottom=a.number(t.bottom,n.bottom,s)),n.left!=null&&t.left!=null&&(this.left=a.number(t.left,n.left,s)),n.right!=null&&t.right!=null&&(this.right=a.number(t.right,n.right,s)),this}getCenter(t,n){const s=a.clamp((this.left+t-this.right)/2,0,t),u=a.clamp((this.top+n-this.bottom)/2,0,n);return new a.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 Ln(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}class co{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 a.LngLat(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new Ln,this._posMatrixCache={},this._alignedPosMatrixCache={}}clone(){const t=new co(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 a.pointGeometry(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(t){const n=-a.wrap(t,-180,180)*Math.PI/180;var s;this.angle!==n&&(this._unmodified=!1,this.angle=n,this._calcMatrices(),this.rotationMatrix=(s=new a.ARRAY_TYPE(4),a.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],E=p[3],M=Math.sin(f),z=Math.cos(f);u[0]=_*z+v*M,u[1]=y*z+E*M,u[2]=_*-M+v*z,u[3]=y*-M+E*z}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(t){const n=a.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 a.UnwrappedTileID(0,t)];if(this._renderWorldCopies){const s=this.pointCoordinate(new a.pointGeometry(0,0)),u=this.pointCoordinate(new a.pointGeometry(this.width,0)),p=this.pointCoordinate(new a.pointGeometry(this.width,this.height)),f=this.pointCoordinate(new a.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 E=_-v;E<=y+v;E++)E!==0&&n.push(new a.UnwrappedTileID(E,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()),_=a.MercatorCoordinate.fromLngLat(this.center),y=Math.pow(2,u),v=[y*f.x,y*f.y,0],E=[y*_.x,y*_.y,0],M=qo.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,u);let z=t.minzoom||0;!t.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(z=u);const V=t.terrain?2/Math.min(this.tileSize,t.tileSize)*this.tileSize:3,$=G=>({aabb:new lo([G*y,0,0],[(G+1)*y,y,0]),zoom:0,x:0,y:0,wrap:G,fullyVisible:!1}),U=[],H=[],Q=u,ne=t.reparseOverscaled?p:u;if(this._renderWorldCopies)for(let G=1;G<=3;G++)U.push($(-G)),U.push($(G));for(U.push($(0));U.length>0;){const G=U.pop(),le=G.x,se=G.y;let me=G.fullyVisible;if(!me){const Be=G.aabb.intersects(M);if(Be===0)continue;me=Be===2}const ge=t.terrain?v:E,be=G.aabb.distanceX(ge),de=G.aabb.distanceY(ge),Re=Math.max(Math.abs(be),Math.abs(de)),Ce=V+(1<<Q-G.zoom)-2;if(G.zoom===Q||Re>Ce&&G.zoom>=z){const Be=Q-G.zoom,st=v[0]-.5-(le<<Be),ht=v[1]-.5-(se<<Be);H.push({tileID:new a.OverscaledTileID(G.zoom===Q?ne:G.zoom,G.wrap,G.zoom,le,se),distanceSq:a.sqrLen([E[0]-.5-le,E[1]-.5-se]),tileDistanceToCamera:Math.sqrt(st*st+ht*ht)})}else for(let Be=0;Be<4;Be++){const st=(le<<1)+Be%2,ht=(se<<1)+(Be>>1),We=G.zoom+1;let At=G.aabb.quadrant(Be);if(t.terrain){const Mt=new a.OverscaledTileID(We,G.wrap,We,st,ht),_t=t.terrain.getMinMaxElevation(Mt),wt=(n=_t.minElevation)!==null&&n!==void 0?n:this.elevation,zt=(s=_t.maxElevation)!==null&&s!==void 0?s:this.elevation;At=new lo([At.min[0],At.min[1],wt],[At.max[0],At.max[1],zt])}U.push({aabb:At,zoom:We,x:st,y:ht,wrap:G.wrap,fullyVisible:me})}}return H.sort((G,le)=>G.distanceSq-le.distanceSq).map(G=>G.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=a.clamp(t.lat,-this.maxValidLatitude,this.maxValidLatitude);return new a.pointGeometry(a.mercatorXfromLng(t.lng)*this.worldSize,a.mercatorYfromLat(n)*this.worldSize)}unproject(t){return new a.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=a.MercatorCoordinate.fromLngLat(t),u=(1<<this.tileZoom)*a.EXTENT,p=s.x*u,f=s.y*u,_=Math.floor(p/a.EXTENT),y=Math.floor(f/a.EXTENT),v=new a.OverscaledTileID(this.tileZoom,0,this.tileZoom,_,y);return n.getElevation(v,p%a.EXTENT,f%a.EXTENT,a.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=a.MercatorCoordinate.fromLngLat(u.lngLat,u.altitude),f=a.MercatorCoordinate.fromLngLat(n,s),_=p.x-f.x,y=p.y-f.y,v=p.z-f.z,E=Math.sqrt(_*_+y*y+v*v),M=this.scaleZoom(this.cameraToCenterDistance/E/this.tileSize);this._elevation=s,this._center=n,this.zoom=M}setLocationAtPoint(t,n){const s=this.pointCoordinate(n),u=this.pointCoordinate(this.centerPoint),p=this.locationCoordinate(t),f=new a.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 a.MercatorCoordinate.fromLngLat(t)}coordinateLocation(t){return t&&t.toLngLat()}pointCoordinate(t,n){if(n){const z=n.pointCoordinate(t);if(z!=null)return z}const s=[t.x,t.y,0,1],u=[t.x,t.y,1,1];a.transformMat4(s,s,this.pixelMatrixInverse),a.transformMat4(u,u,this.pixelMatrixInverse);const p=s[3],f=u[3],_=s[1]/p,y=u[1]/f,v=s[2]/p,E=u[2]/f,M=v===E?0:(0-v)/(E-v);return new a.MercatorCoordinate(a.number(s[0]/p,u[0]/f,M)/this.worldSize,a.number(_,y,M)/this.worldSize)}coordinatePoint(t,n=0,s=this.pixelMatrix){const u=[t.x*this.worldSize,t.y*this.worldSize,n,1];return a.transformMat4(u,u,s),new a.pointGeometry(u[0]/u[3],u[1]/u[3])}getBounds(){const t=Math.max(0,this.height/2-this.getHorizon());return new a.LngLatBounds().extend(this.pointLocation(new a.pointGeometry(0,t))).extend(this.pointLocation(new a.pointGeometry(this.width,t))).extend(this.pointLocation(new a.pointGeometry(this.width,this.height))).extend(this.pointLocation(new a.pointGeometry(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new a.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=a.identity(new Float64Array(16));return a.translate(y,y,[_*f,p.y*f,0]),a.scale(y,y,[f/a.EXTENT,f/a.EXTENT,1]),a.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,E=this._unmodified;if(this.latRange){const V=this.latRange;p=a.mercatorYfromLat(V[1])*this.worldSize,f=a.mercatorYfromLat(V[0])*this.worldSize,t=f-p<v.y?v.y/(f-p):0}if(this.lngRange){const V=this.lngRange;_=a.wrap(a.mercatorXfromLng(V[0])*this.worldSize,0,this.worldSize),y=a.wrap(a.mercatorXfromLng(V[1])*this.worldSize,0,this.worldSize),y<_&&(y+=this.worldSize),n=y-_<v.x?v.x/(y-_):0}const M=this.point,z=Math.max(n||0,t||0);if(z)return this.center=this.unproject(new a.pointGeometry(n?(y+_)/2:M.x,t?(f+p)/2:M.y)),this.zoom+=this.scaleZoom(z),this._unmodified=E,void(this._constraining=!1);if(this.latRange){const V=M.y,$=v.y/2;V-$<p&&(u=p+$),V+$>f&&(u=f-$)}if(this.lngRange){const V=(_+y)/2,$=a.wrap(M.x,V-this.worldSize/2,V+this.worldSize/2),U=v.x/2;$-U<_&&(s=_+U),$+U>y&&(s=y-U)}s===void 0&&u===void 0||(this.center=this.unproject(new a.pointGeometry(s!==void 0?s:M.x,u!==void 0?u:M.y)).wrap()),this._unmodified=E,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=a.mercatorZfromAltitude(1,this.center.lat)*this.worldSize;let u=a.identity(new Float64Array(16));a.scale(u,u,[this.width/2,-this.height/2,1]),a.translate(u,u,[1,-1,0]),this.labelPlaneMatrix=u,u=a.identity(new Float64Array(16)),a.scale(u,u,[1,-1,1]),a.translate(u,u,[-1,-1,0]),a.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(a.clamp(Math.PI-p-f,.01,Math.PI-.01)),y=this.getHorizon(),v=2*Math.atan(y/this.cameraToCenterDistance)*(.5+t.y/(2*y)),E=Math.sin(v)*this.cameraToSeaLevelDistance/Math.sin(a.clamp(Math.PI-p-v,.01,Math.PI-.01)),M=Math.cos(Math.PI/2-this._pitch)*_+this.cameraToSeaLevelDistance,z=Math.cos(Math.PI/2-this._pitch)*E+this.cameraToSeaLevelDistance,V=1.01*Math.min(M,z),$=this.height/50;u=new Float64Array(16),a.perspective(u,this._fov,this.width/this.height,$,V),u[8]=2*-t.x/this.width,u[9]=2*t.y/this.height,a.scale(u,u,[1,-1,1]),a.translate(u,u,[0,0,-this.cameraToCenterDistance]),a.rotateX(u,u,this._pitch),a.rotateZ(u,u,this.angle),a.translate(u,u,[-n,-s,0]),this.mercatorMatrix=a.scale([],u,[this.worldSize,this.worldSize,this.worldSize]),a.scale(u,u,[1,1,this._pixelPerMeter]),this.pixelMatrix=a.multiply(new Float64Array(16),this.labelPlaneMatrix,u),a.translate(u,u,[0,0,-this.elevation]),this.projMatrix=u,this.invProjMatrix=a.invert([],u),this.pixelMatrix3D=a.multiply(new Float64Array(16),this.labelPlaneMatrix,u);const U=this.width%2/2,H=this.height%2/2,Q=Math.cos(this.angle),ne=Math.sin(this.angle),G=n-Math.round(n)+Q*U+ne*H,le=s-Math.round(s)+Q*H+ne*U,se=new Float64Array(u);if(a.translate(se,se,[G>.5?G-1:G,le>.5?le-1:le,0]),this.alignedProjMatrix=se,u=a.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 a.pointGeometry(0,0)),n=[t.x*this.worldSize,t.y*this.worldSize,0,1];return a.transformMat4(n,n,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const t=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new a.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 a.pointGeometry(s,u),new a.pointGeometry(p,u),new a.pointGeometry(p,f),new a.pointGeometry(s,f),new a.pointGeometry(s,u)]}}}class Da{constructor(t){this._hashName=t&&encodeURIComponent(t),a.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 E="";if(E+=t?`/${f}/${_}/${s}`:`${s}/${_}/${f}`,(y||v)&&(E+="/"+Math.round(10*y)/10),v&&(E+=`/${Math.round(v)}`),this._hashName){const M=this._hashName;let z=!1;const V=window.location.hash.slice(1).split("&").map($=>{const U=$.split("=")[0];return U===M?(z=!0,`${U}=${E}`):$}).filter($=>$);return z||V.push(`${M}=${E}`),`#${V.join("&")}`}return`#${E}`}_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{}}}const uo={linearity:.3,easing:a.bezier(0,0,.3,1)},La=a.extend({deceleration:2500,maxSpeed:1400},uo),Ra=a.extend({deceleration:20,maxSpeed:1400},uo),Ba=a.extend({deceleration:1e3,maxSpeed:360},uo),Rn=a.extend({deceleration:1e3,maxSpeed:90},uo);class Fa{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:a.exported.now(),settings:t})}_drainInertiaBuffer(){const t=this._inertiaBuffer,n=a.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 a.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=po(n.pan.mag(),s,a.extend({},La,t||{}));u.offset=n.pan.mult(p.amount/n.pan.mag()),u.center=this._map.transform.center,ho(u,p)}if(n.zoom){const p=po(n.zoom,s,Ra);u.zoom=this._map.transform.zoom+p.amount,ho(u,p)}if(n.bearing){const p=po(n.bearing,s,Ba);u.bearing=this._map.transform.bearing+a.clamp(p.amount,-179,179),ho(u,p)}if(n.pitch){const p=po(n.pitch,s,Rn);u.pitch=this._map.transform.pitch+p.amount,ho(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(),a.extend(u,{noMoveStart:!0})}}function ho(l,t){(!l.duration||l.duration<t.duration)&&(l.duration=t.duration,l.easing=t.easing)}function po(l,t,n){const{maxSpeed:s,linearity:u,deceleration:p}=n,f=a.clamp(l*u/(t/1e3),-s,s),_=Math.abs(f)/(p*u);return{easing:n.easing,duration:1e3*_,amount:f*(_/2)}}class Vi extends a.Event{constructor(t,n,s,u={}){const p=ie.mousePos(n.getCanvasContainer(),s),f=n.unproject(p);super(t,a.extend({point:p,lngLat:f,originalEvent:s},u)),this._defaultPrevented=!1,this.target=n}preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}}class fo extends a.Event{constructor(t,n,s){const u=t==="touchend"?s.changedTouches:s.touches,p=ie.touchPos(n.getCanvasContainer(),u),f=p.map(y=>n.unproject(y)),_=p.reduce((y,v,E,M)=>y.add(v.div(M.length)),new a.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 Ni extends a.Event{constructor(t,n,s){super(t,{originalEvent:s}),this._defaultPrevented=!1}preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}}class ql{constructor(t,n){this._map=t,this._clickTolerance=n.clickTolerance}reset(){delete this._mousedownPos}wheel(t){return this._firePreventable(new Ni(t.type,this._map,t))}mousedown(t,n){return this._mousedownPos=n,this._firePreventable(new Vi(t.type,this._map,t))}mouseup(t){this._map.fire(new Vi(t.type,this._map,t))}click(t,n){this._mousedownPos&&this._mousedownPos.dist(n)>=this._clickTolerance||this._map.fire(new Vi(t.type,this._map,t))}dblclick(t){return this._firePreventable(new Vi(t.type,this._map,t))}mouseover(t){this._map.fire(new Vi(t.type,this._map,t))}mouseout(t){this._map.fire(new Vi(t.type,this._map,t))}touchstart(t){return this._firePreventable(new fo(t.type,this._map,t))}touchmove(t){this._map.fire(new fo(t.type,this._map,t))}touchend(t){this._map.fire(new fo(t.type,this._map,t))}touchcancel(t){this._map.fire(new fo(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Vr{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(t){this._map.fire(new Vi(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Vi("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._ignoreContextMenu||this._map.fire(new Vi(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Oa{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&&(ie.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=ie.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);ie.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(),ie.suppressClick(),s.x!==u.x||s.y!==u.y)return this._map.fire(new a.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&&(ie.remove(this._box),this._box=null),ie.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(t,n){return this._map.fire(new a.Event(t,{originalEvent:n}))}}function Ir(l,t){if(l.length!==t.length)throw new Error(`The number of touches and points are not equal - touches ${l.length}, points ${t.length}`);const n={};for(let s=0;s<l.length;s++)n[l[s].identifier]=t[s];return n}class mo{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 a.pointGeometry(0,0);for(const f of u)p._add(f);return p.div(u.length)}(n),this.touches=Ir(s,n)))}touchmove(t,n,s){if(this.aborted||!this.centroid)return;const u=Ir(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 As{constructor(t){this.singleTap=new mo(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 Zl{constructor(){this._zoomIn=new As({numTouches:1,numTaps:2}),this._zoomOut=new As({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 jl={0:1,2:2};class Zo{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=ie.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=jl[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&&ie.mouseButton(t)===this._eventButton&&(this._moved&&ie.suppressClick(),this.reset())}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class go extends Zo{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 Cr extends Zo{_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 Oe extends Zo{_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 $a{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 a.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=Ir(s,n),p=new a.pointGeometry(0,0),f=new a.pointGeometry(0,0);let _=0;for(const v in u){const E=u[v],M=this._touches[v];M&&(p._add(E),f._add(E.sub(M)),_++,u[v]=E)}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 on{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=Nr(s,n,u),_=Nr(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=Nr(s,n,u),_=Nr(s,n,p);f&&_||(this._active&&ie.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 Nr(l,t,n){for(let s=0;s<l.length;s++)if(l[s].identifier===n)return t[s]}function Ms(l,t){return Math.log(l/t)/Math.LN2}class ze extends on{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(Ms(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:Ms(this._distance,s),pinchAround:n}}}function jo(l,t){return 180*l.angleWith(t)/Math.PI}class Xl extends on{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:jo(this._vector,s),pinchAround:n}}_isBelowThreshold(t){this._minDiameter=Math.min(this._minDiameter,t.mag());const n=25/(Math.PI*this._minDiameter)*360,s=jo(t,this._startVector);return Math.abs(s)<n}}function Ps(l){return Math.abs(l.y)>Math.abs(l.x)}class zs extends on{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,Ps(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 Ps(t)&&Ps(n)&&f}}const Ua={panStep:100,bearingStep:15,pitchStep:10};class Va{constructor(){const t=Ua;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:Wl,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 Wl(l){return l*(2-l)}const Na=4.000244140625;class ks{constructor(t,n){this._map=t,this._el=t.getCanvasContainer(),this._handler=n,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222,a.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=a.exported.now(),u=s-(this._lastWheelEventTime||0);this._lastWheelEventTime=s,n!==0&&n%Na==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=ie.mousePos(this._el,t);this._around=a.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)>Na?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((a.exported.now()-this._lastWheelEventTime)/200,1),y=u(_);p=a.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=a.ease;if(this._prevEase){const s=this._prevEase,u=(a.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=a.bezier(f,_,.25,1)}return this._prevEase={start:a.exported.now(),duration:t,easing:n},n}reset(){this._active=!1}}class Ds{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 Ls{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 Rs{constructor(){this._tap=new As({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 Pi{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 Gr{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 Ga{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 Bn=l=>l.zoom||l.drag||l.pitch||l.rotate;class Bs extends a.Event{}function _o(l){return l.panDelta&&l.panDelta.mag()||l.zoomDelta||l.bearingDelta||l.pitchDelta}class qa{constructor(t,n){this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Fa(t),this._bearingSnap=n.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(n),a.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)ie.addEventListener(u,p,u===document?this.handleWindowEvent:this.handleEvent,f)}destroy(){for(const[t,n,s]of this._listeners)ie.removeEventListener(t,n,t===document?this.handleWindowEvent:this.handleEvent,s)}_addDefaultHandlers(t){const n=this._map,s=n.getCanvasContainer();this._add("mapEvent",new ql(n,t));const u=n.boxZoom=new Oa(n,t);this._add("boxZoom",u);const p=new Zl,f=new Ls;n.doubleClickZoom=new Ds(f,p),this._add("tapZoom",p),this._add("clickZoom",f);const _=new Rs;this._add("tapDragZoom",_);const y=n.touchPitch=new zs(n);this._add("touchPitch",y);const v=new Cr(t),E=new Oe(t);n.dragRotate=new Gr(t,v,E),this._add("mouseRotate",v,["mousePitch"]),this._add("mousePitch",E,["mouseRotate"]);const M=new go(t),z=new $a(t,n);n.dragPan=new Pi(s,M,z),this._add("mousePan",M),this._add("touchPan",z,["touchZoom","touchRotate"]);const V=new Xl,$=new ze;n.touchZoomRotate=new Ga(s,$,V,_),this._add("touchRotate",V,["touchPan","touchZoom"]),this._add("touchZoom",$,["touchPan","touchRotate"]);const U=n.scrollZoom=new ks(n,this);this._add("scrollZoom",U,["mousePan"]);const H=n.keyboard=new Va;this._add("keyboard",H),this._add("blockableMapEvent",new Vr(n));for(const Q of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])t.interactive&&t[Q]&&n[Q].enable(t[Q])}_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(Bn(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?ie.touchPos(this._el,y):ie.mousePos(this._el,t);for(const{handlerName:z,handler:V,allowed:$}of this._handlers){if(!V.isEnabled())continue;let U;this._blockedByActive(f,$,z)?V.reset():V[n||t.type]&&(U=V[n||t.type](t,v,y),this.mergeHandlerResult(u,p,U,z,s),U&&U.needsRenderFrame&&this._triggerRenderFrame()),(U||V.isActive())&&(f[z]=V)}const E={};for(const z in this._previousActiveHandlers)f[z]||(E[z]=s);this._previousActiveHandlers=f,(Object.keys(E).length||_o(u))&&(this._changes.push([u,p,E]),this._triggerRenderFrame()),(Object.keys(f).length||_o(u))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:M}=u;M&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],M(this._map))}mergeHandlerResult(t,n,s,u,p){if(!s)return;a.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 a.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),a.extend(n,p),a.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(!(_o(t)||f&&this._drag))return this._fireEvents(n,s,!0);let{panDelta:_,zoomDelta:y,bearingDelta:v,pitchDelta:E,around:M,pinchAround:z}=t;z!==void 0&&(M=z),u._stop(!0),M=M||u.transform.centerPoint;const V=p.pointLocation(_?M.sub(_):M);v&&(p.bearing+=v),E&&(p.pitch+=E),y&&(p.zoom+=y),f?n.drag&&!this._drag?(this._drag={center:p.centerPoint,lngLat:p.pointLocation(M),point:M,handlerName:n.drag.handlerName},u.fire(new a.Event("freezeElevation",{freeze:!0}))):this._drag&&s[this._drag.handlerName]?(u.fire(new a.Event("freezeElevation",{freeze:!1})),this._drag=null):n.drag&&this._drag&&(p.center=p.pointLocation(p.centerPoint.sub(_))):p.setLocationAtPoint(V,M),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(n,s,!0)}_fireEvents(t,n,s){const u=Bn(this._eventsInProgress),p=Bn(t),f={};for(const E in t){const{originalEvent:M}=t[E];this._eventsInProgress[E]||(f[`${E}start`]=M),this._eventsInProgress[E]=t[E]}!u&&p&&this._fireEvent("movestart",p.originalEvent);for(const E in f)this._fireEvent(E,f[E]);p&&this._fireEvent("move",p.originalEvent);for(const E in t){const{originalEvent:M}=t[E];this._fireEvent(E,M)}const _={};let y;for(const E in this._eventsInProgress){const{handlerName:M,originalEvent:z}=this._eventsInProgress[E];this._handlersById[M].isActive()||(delete this._eventsInProgress[E],y=n[M]||z,_[`${E}end`]=y)}for(const E in _)this._fireEvent(E,_[E]);const v=Bn(this._eventsInProgress);if(s&&(u||p)&&!v){this._updatingCamera=!0;const E=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),M=z=>z!==0&&-this._bearingSnap<z&&z<this._bearingSnap;E?(M(E.bearing||this._map.getBearing())&&(E.bearing=0),this._map.easeTo(E,{originalEvent:y})):(this._map.fire(new a.Event("moveend",{originalEvent:y})),M(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(t,n){this._map.fire(new a.Event(t,n?{originalEvent:n}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(t=>{delete this._frameId,this.handleEvent(new Bs("renderFrame",{timeStamp:t})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}const Ji={extend:(l,...t)=>a.extend(l,...t),run(l){l()},logToElement(l,t=!1,n="log"){const s=window.document.getElementById(n);s&&(t&&(s.innerHTML=""),s.innerHTML+=`<br>${l}`)}};class Nt extends a.Evented{constructor(t,n){super(),this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=n.bearingSnap,a.bindAll(["_renderFrameCallback"],this)}getCenter(){return new a.LngLat(this.transform.center.lng,this.transform.center.lat)}setCenter(t,n){return this.jumpTo({center:t},n)}panBy(t,n,s){return t=a.pointGeometry.convert(t).mult(-1),this.panTo(this.transform.center,a.extend({offset:t},n),s)}panTo(t,n,s){return this.easeTo(a.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(a.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(a.extend({bearing:t},n),s)}resetNorth(t,n){return this.rotateTo(0,a.extend({duration:1e3},t),n),this}resetNorthPitch(t,n){return this.easeTo(a.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=a.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=a.extend({padding:p,offset:[0,0],maxZoom:this.transform.maxZoom},u)).padding=="number"){const se=u.padding;u.padding={top:se,bottom:se,right:se,left:se}}u.padding=a.extend(p,u.padding);const f=this.transform,_=f.padding,y=f.project(a.LngLat.convert(t)),v=f.project(a.LngLat.convert(n)),E=y.rotate(-s*Math.PI/180),M=v.rotate(-s*Math.PI/180),z=new a.pointGeometry(Math.max(E.x,M.x),Math.max(E.y,M.y)),V=new a.pointGeometry(Math.min(E.x,M.x),Math.min(E.y,M.y)),$=z.sub(V),U=(f.width-(_.left+_.right+u.padding.left+u.padding.right))/$.x,H=(f.height-(_.top+_.bottom+u.padding.top+u.padding.bottom))/$.y;if(H<0||U<0)return void a.warnOnce("Map cannot fit within canvas with the given bounds, padding, and/or offset.");const Q=Math.min(f.scaleZoom(f.scale*Math.min(U,H)),u.maxZoom),ne=a.pointGeometry.convert(u.offset),G=new a.pointGeometry((u.padding.left-u.padding.right)/2,(u.padding.top-u.padding.bottom)/2).rotate(s*Math.PI/180),le=ne.add(G).mult(f.scale/f.zoomScale(Q));return{center:f.unproject(y.add(v).div(2).sub(le)),zoom:Q,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(a.pointGeometry.convert(t)),this.transform.pointLocation(a.pointGeometry.convert(n)),s,u),u,p)}_fitInternal(t,n,s){return t?(delete(n=a.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=a.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 a.Event("movestart",n)).fire(new a.Event("move",n)),u&&this.fire(new a.Event("zoomstart",n)).fire(new a.Event("zoom",n)).fire(new a.Event("zoomend",n)),p&&this.fire(new a.Event("rotatestart",n)).fire(new a.Event("rotate",n)).fire(new a.Event("rotateend",n)),f&&this.fire(new a.Event("pitchstart",n)).fire(new a.Event("pitch",n)).fire(new a.Event("pitchend",n)),this.fire(new a.Event("moveend",n))}calculateCameraOptionsFromTo(t,n,s,u=0){const p=a.MercatorCoordinate.fromLngLat(t,n),f=a.MercatorCoordinate.fromLngLat(s,u),_=f.x-p.x,y=f.y-p.y,v=f.z-p.z,E=Math.hypot(_,y,v);if(E===0)throw new Error("Can't calculate camera options with same From and To");const M=Math.hypot(_,y),z=this.transform.scaleZoom(this.transform.cameraToCenterDistance/E/this.transform.tileSize),V=180*Math.atan2(_,-y)/Math.PI;let $=180*Math.acos(M/E)/Math.PI;return $=v<0?90-$:90+$,{center:f.toLngLat(),zoom:z,pitch:$,bearing:V}}easeTo(t,n){this._stop(!1,t.easeId),((t=a.extend({offset:[0,0],duration:500,easing:a.ease},t)).animate===!1||!t.essential&&a.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,E="pitch"in t?+t.pitch:f,M="padding"in t?t.padding:s.padding,z=a.pointGeometry.convert(t.offset);let V=s.centerPoint.add(z);const $=s.pointLocation(V),U=a.LngLat.convert(t.center||$);this._normalizeCenter(U);const H=s.project($),Q=s.project(U).sub(H),ne=s.zoomScale(y-u);let G,le;t.around&&(G=a.LngLat.convert(t.around),le=s.locationPoint(G));const se={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||E!==f,this._padding=!s.isPaddingEqual(M),this._easeId=t.easeId,this._prepareEase(n,t.noMoveStart,se),this._ease(me=>{if(this._zooming&&(s.zoom=a.number(u,y,me)),this._rotating&&(s.bearing=a.number(p,v,me)),this._pitching&&(s.pitch=a.number(f,E,me)),this._padding&&(s.interpolatePadding(_,M,me),V=s.centerPoint.add(z)),G)s.setLocationAtPoint(G,le);else{const ge=s.zoomScale(s.zoom-u),be=y>u?Math.min(2,ne):Math.max(.5,ne),de=Math.pow(be,1-me),Re=s.unproject(H.add(Q.mult(me*de)).mult(ge));s.setLocationAtPoint(s.renderWorldCopies?Re.wrap():Re,V)}this._fireMoveEvents(n)},me=>{this._afterEase(n,me)},t),this}_prepareEase(t,n,s={}){this._moving=!0,this.fire(new a.Event("freezeElevation",{freeze:!0})),n||s.moving||this.fire(new a.Event("movestart",t)),this._zooming&&!s.zooming&&this.fire(new a.Event("zoomstart",t)),this._rotating&&!s.rotating&&this.fire(new a.Event("rotatestart",t)),this._pitching&&!s.pitching&&this.fire(new a.Event("pitchstart",t))}_fireMoveEvents(t){this.fire(new a.Event("move",t)),this._zooming&&this.fire(new a.Event("zoom",t)),this._rotating&&this.fire(new a.Event("rotate",t)),this._pitching&&this.fire(new a.Event("pitch",t))}_afterEase(t,n){if(this._easeId&&n&&this._easeId===n)return;delete this._easeId,this.fire(new a.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 a.Event("zoomend",t)),u&&this.fire(new a.Event("rotateend",t)),p&&this.fire(new a.Event("pitchend",t)),this.fire(new a.Event("moveend",t))}flyTo(t,n){if(!t.essential&&a.exported.prefersReducedMotion){const We=a.pick(t,["center","zoom","bearing","pitch","around"]);return this.jumpTo(We,n)}this.stop(),t=a.extend({offset:[0,0],speed:1.2,curve:1.42,easing:a.ease},t);const s=this.transform,u=this.getZoom(),p=this.getBearing(),f=this.getPitch(),_=this.getPadding(),y="zoom"in t?a.clamp(+t.zoom,s.minZoom,s.maxZoom):u,v="bearing"in t?this._normalizeBearing(t.bearing,p):p,E="pitch"in t?+t.pitch:f,M="padding"in t?t.padding:s.padding,z=s.zoomScale(y-u),V=a.pointGeometry.convert(t.offset);let $=s.centerPoint.add(V);const U=s.pointLocation($),H=a.LngLat.convert(t.center||U);this._normalizeCenter(H);const Q=s.project(U),ne=s.project(H).sub(Q);let G=t.curve;const le=Math.max(s.width,s.height),se=le/z,me=ne.mag();if("minZoom"in t){const We=a.clamp(Math.min(t.minZoom,u,y),s.minZoom,s.maxZoom),At=le/s.zoomScale(We-u);G=Math.sqrt(At/me*2)}const ge=G*G;function be(We){const At=(se*se-le*le+(We?-1:1)*ge*ge*me*me)/(2*(We?se:le)*ge*me);return Math.log(Math.sqrt(At*At+1)-At)}function de(We){return(Math.exp(We)-Math.exp(-We))/2}function Re(We){return(Math.exp(We)+Math.exp(-We))/2}const Ce=be(0);let Be=function(We){return Re(Ce)/Re(Ce+G*We)},st=function(We){return le*((Re(Ce)*(de(At=Ce+G*We)/Re(At))-de(Ce))/ge)/me;var At},ht=(be(1)-Ce)/G;if(Math.abs(me)<1e-6||!isFinite(ht)){if(Math.abs(le-se)<1e-6)return this.easeTo(t,n);const We=se<le?-1:1;ht=Math.abs(Math.log(se/le))/G,st=function(){return 0},Be=function(At){return Math.exp(We*G*At)}}return t.duration="duration"in t?+t.duration:1e3*ht/("screenSpeed"in t?+t.screenSpeed/G:+t.speed),t.maxDuration&&t.duration>t.maxDuration&&(t.duration=0),this._zooming=!0,this._rotating=p!==v,this._pitching=E!==f,this._padding=!s.isPaddingEqual(M),this._prepareEase(n,!1),this._ease(We=>{const At=We*ht,Mt=1/Be(At);s.zoom=We===1?y:u+s.scaleZoom(Mt),this._rotating&&(s.bearing=a.number(p,v,We)),this._pitching&&(s.pitch=a.number(f,E,We)),this._padding&&(s.interpolatePadding(_,M,We),$=s.centerPoint.add(V));const _t=We===1?H:s.unproject(Q.add(ne.mult(st(At))).mult(Mt));s.setLocationAtPoint(s.renderWorldCopies?_t.wrap():_t,$),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=a.exported.now(),this._easeOptions=s,this._onEaseFrame=t,this._onEaseEnd=n,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){const t=Math.min((a.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=a.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 yo{constructor(t={}){this.options=t,a.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=ie.create("details","maplibregl-ctrl maplibregl-ctrl-attrib mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=ie.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=ie.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(){ie.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 Xo{constructor(t={}){this.options=t,a.bindAll(["_updateCompact"],this)}getDefaultPosition(){return"bottom-left"}onAdd(t){this._map=t,this._compact=this.options&&this.options.compact,this._container=ie.create("div","maplibregl-ctrl mapboxgl-ctrl");const n=ie.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(){ie.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 Za{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 ja={"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"},Xa={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},Hl={showCompass:!0,showZoom:!0,visualizePitch:!1};class mr{constructor(t,n,s=!1){this._clickTolerance=10,this.element=n,this.mouseRotate=new Cr({clickTolerance:t.dragRotate._mouseRotate._clickTolerance}),this.map=t,s&&(this.mousePitch=new Oe({clickTolerance:t.dragRotate._mousePitch._clickTolerance})),a.bindAll(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),ie.addEventListener(n,"mousedown",this.mousedown),ie.addEventListener(n,"touchstart",this.touchstart,{passive:!1}),ie.addEventListener(n,"touchmove",this.touchmove),ie.addEventListener(n,"touchend",this.touchend),ie.addEventListener(n,"touchcancel",this.reset)}down(t,n){this.mouseRotate.mousedown(t,n),this.mousePitch&&this.mousePitch.mousedown(t,n),ie.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;ie.removeEventListener(t,"mousedown",this.mousedown),ie.removeEventListener(t,"touchstart",this.touchstart,{passive:!1}),ie.removeEventListener(t,"touchmove",this.touchmove),ie.removeEventListener(t,"touchend",this.touchend),ie.removeEventListener(t,"touchcancel",this.reset),this.offTemp()}offTemp(){ie.enableDrag(),ie.removeEventListener(window,"mousemove",this.mousemove),ie.removeEventListener(window,"mouseup",this.mouseup)}mousedown(t){this.down(a.extend({},t,{ctrlKey:!0,preventDefault:()=>t.preventDefault()}),ie.mousePos(this.element,t)),ie.addEventListener(window,"mousemove",this.mousemove),ie.addEventListener(window,"mouseup",this.mouseup)}mousemove(t){this.move(t,ie.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=ie.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=ie.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 xo(l,t,n){if(l=new a.LngLat(l.lng,l.lat),t){const s=new a.LngLat(l.lng-360,l.lat),u=new a.LngLat(l.lng+360,l.lat),p=n.locationPoint(l).distSqr(t);n.locationPoint(s).distSqr(t)<p?l=s:n.locationPoint(u).distSqr(t)<p&&(l=u)}for(;Math.abs(l.lng-n.center.lng)>180;){const s=n.locationPoint(l);if(s.x>=0&&s.y>=0&&s.x<=n.width&&s.y<=n.height)break;l.lng>n.center.lng?l.lng-=360:l.lng+=360}return l}const Ze={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 Ye(l,t,n){const s=l.classList;for(const u in Ze)s.remove(`maplibregl-${n}-anchor-${u}`,`mapboxgl-${n}-anchor-${u}`);s.add(`maplibregl-${n}-anchor-${t}`,`mapboxgl-${n}-anchor-${t}`)}class Fn extends a.Evented{constructor(t,n){if(super(),(t instanceof HTMLElement||n)&&(t=a.extend({element:t},n)),a.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=a.pointGeometry.convert(t&&t.offset||[0,0]);else{this._defaultMarker=!0,this._element=ie.create("div"),this._element.setAttribute("aria-label","Map marker");const s=ie.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=ie.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 _=ie.createNS("http://www.w3.org/2000/svg","g");_.setAttributeNS(null,"fill-rule","nonzero");const y=ie.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 ne of v){const G=ie.createNS("http://www.w3.org/2000/svg","ellipse");G.setAttributeNS(null,"opacity","0.04"),G.setAttributeNS(null,"cx","10.5"),G.setAttributeNS(null,"cy","5.80029008"),G.setAttributeNS(null,"rx",ne.rx),G.setAttributeNS(null,"ry",ne.ry),y.appendChild(G)}const E=ie.createNS("http://www.w3.org/2000/svg","g");E.setAttributeNS(null,"fill",this._color);const M=ie.createNS("http://www.w3.org/2000/svg","path");M.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"),E.appendChild(M);const z=ie.createNS("http://www.w3.org/2000/svg","g");z.setAttributeNS(null,"opacity","0.25"),z.setAttributeNS(null,"fill","#000000");const V=ie.createNS("http://www.w3.org/2000/svg","path");V.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"),z.appendChild(V);const $=ie.createNS("http://www.w3.org/2000/svg","g");$.setAttributeNS(null,"transform","translate(6.0, 7.0)"),$.setAttributeNS(null,"fill","#FFFFFF");const U=ie.createNS("http://www.w3.org/2000/svg","g");U.setAttributeNS(null,"transform","translate(8.0, 8.0)");const H=ie.createNS("http://www.w3.org/2000/svg","circle");H.setAttributeNS(null,"fill","#000000"),H.setAttributeNS(null,"opacity","0.25"),H.setAttributeNS(null,"cx","5.5"),H.setAttributeNS(null,"cy","5.5"),H.setAttributeNS(null,"r","5.4999962");const Q=ie.createNS("http://www.w3.org/2000/svg","circle");Q.setAttributeNS(null,"fill","#FFFFFF"),Q.setAttributeNS(null,"cx","5.5"),Q.setAttributeNS(null,"cy","5.5"),Q.setAttributeNS(null,"r","5.4999962"),U.appendChild(H),U.appendChild(Q),_.appendChild(y),_.appendChild(E),_.appendChild(z),_.appendChild($),_.appendChild(U),s.appendChild(_),s.setAttributeNS(null,"height",u*this._scale+"px"),s.setAttributeNS(null,"width",p*this._scale+"px"),this._element.appendChild(s),this._offset=a.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()}),Ye(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),ie.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=a.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=xo(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()),ie.setTransform(this._element,`${Ze[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=a.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 a.Event("dragstart"))),this.fire(new a.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 a.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 Fs={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let qr,mi=0,Zr=!1;const gr={maxWidth:100,unit:"metric"};function Wa(l,t,n){const s=n&&n.maxWidth||100,u=l._container.clientHeight/2,p=l.unproject([0,u]),f=l.unproject([s,u]),_=p.distanceTo(f);if(n&&n.unit==="imperial"){const y=3.2808*_;y>5280?jr(t,s,y/5280,l._getUIString("ScaleControl.Miles")):jr(t,s,y,l._getUIString("ScaleControl.Feet"))}else n&&n.unit==="nautical"?jr(t,s,_/1852,l._getUIString("ScaleControl.NauticalMiles")):_>=1e3?jr(t,s,_/1e3,l._getUIString("ScaleControl.Kilometers")):jr(t,s,_,l._getUIString("ScaleControl.Meters"))}function jr(l,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);l.style.width=t*(u/n)+"px",l.innerHTML=`${u}&nbsp;${s}`}const Xt={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},Yt=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Os(l){if(l){if(typeof l=="number"){const t=Math.round(Math.sqrt(.5*Math.pow(l,2)));return{center:new a.pointGeometry(0,0),top:new a.pointGeometry(0,l),"top-left":new a.pointGeometry(t,t),"top-right":new a.pointGeometry(-t,t),bottom:new a.pointGeometry(0,-l),"bottom-left":new a.pointGeometry(t,-t),"bottom-right":new a.pointGeometry(-t,-t),left:new a.pointGeometry(l,0),right:new a.pointGeometry(-l,0)}}if(l instanceof a.pointGeometry||Array.isArray(l)){const t=a.pointGeometry.convert(l);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:a.pointGeometry.convert(l.center||[0,0]),top:a.pointGeometry.convert(l.top||[0,0]),"top-left":a.pointGeometry.convert(l["top-left"]||[0,0]),"top-right":a.pointGeometry.convert(l["top-right"]||[0,0]),bottom:a.pointGeometry.convert(l.bottom||[0,0]),"bottom-left":a.pointGeometry.convert(l["bottom-left"]||[0,0]),"bottom-right":a.pointGeometry.convert(l["bottom-right"]||[0,0]),left:a.pointGeometry.convert(l.left||[0,0]),right:a.pointGeometry.convert(l.right||[0,0])}}return Os(new a.pointGeometry(0,0))}const sn={supported:Y,setRTLTextPlugin:a.setRTLTextPlugin,getRTLTextPluginStatus:a.getRTLTextPluginStatus,Map:class extends Nt{constructor(l){var t;if(a.PerformanceUtils.mark(a.PerformanceMarkers.create),(l=a.extend({},Xa,l)).minZoom!=null&&l.maxZoom!=null&&l.minZoom>l.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(l.minPitch!=null&&l.maxPitch!=null&&l.minPitch>l.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(l.minPitch!=null&&l.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(l.maxPitch!=null&&l.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new co(l.minZoom,l.maxZoom,l.minPitch,l.maxPitch,l.renderWorldCopies),{bearingSnap:l.bearingSnap}),this._interactive=l.interactive,this._cooperativeGestures=l.cooperativeGestures,this._maxTileCacheSize=l.maxTileCacheSize,this._failIfMajorPerformanceCaveat=l.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=l.preserveDrawingBuffer,this._antialias=l.antialias,this._trackResize=l.trackResize,this._bearingSnap=l.bearingSnap,this._refreshExpiredTiles=l.refreshExpiredTiles,this._fadeDuration=l.fadeDuration,this._crossSourceCollisions=l.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=l.collectResourceTiming,this._renderTaskQueue=new Za,this._controls=[],this._mapId=a.uniqueId(),this._locale=a.extend({},ja,l.locale),this._clickTolerance=l.clickTolerance,this._pixelRatio=(t=l.pixelRatio)!==null&&t!==void 0?t:devicePixelRatio,this._requestManager=new Ge(l.transformRequest),typeof l.container=="string"){if(this._container=document.getElementById(l.container),!this._container)throw new Error(`Container '${l.container}' not found.`)}else{if(!(l.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=l.container}if(l.maxBounds&&this.setMaxBounds(l.maxBounds),a.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!="undefined"&&(addEventListener("online",this._onWindowOnline,!1),addEventListener("resize",this._onWindowResize,!1),addEventListener("orientationchange",this._onWindowResize,!1)),this.handlers=new qa(this,l),this._cooperativeGestures&&this._setupCooperativeGestures(),this._hash=l.hash&&new Da(typeof l.hash=="string"&&l.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:l.center,zoom:l.zoom,bearing:l.bearing,pitch:l.pitch}),l.bounds&&(this.resize(),this.fitBounds(l.bounds,a.extend({},l.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=l.localIdeographFontFamily,l.style&&this.setStyle(l.style,{localIdeographFontFamily:l.localIdeographFontFamily}),l.attributionControl&&this.addControl(new yo({customAttribution:l.customAttribution})),l.maplibreLogo&&this.addControl(new Xo,l.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 a.Event(`${n.dataType}data`,n))}),this.on("dataloading",n=>{this.fire(new a.Event(`${n.dataType}dataloading`,n))}),this.on("dataabort",n=>{this.fire(new a.Event("sourcedataabort",n))})}_getMapId(){return this._mapId}addControl(l,t){if(t===void 0&&(t=l.getDefaultPosition?l.getDefaultPosition():"top-right"),!l||!l.onAdd)return this.fire(new a.ErrorEvent(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const n=l.onAdd(this);this._controls.push(l);const s=this._controlPositions[t];return t.indexOf("bottom")!==-1?s.insertBefore(n,s.firstChild):s.appendChild(n),this}removeControl(l){if(!l||!l.onRemove)return this.fire(new a.ErrorEvent(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const t=this._controls.indexOf(l);return t>-1&&this._controls.splice(t,1),l.onRemove(this),this}hasControl(l){return this._controls.indexOf(l)>-1}calculateCameraOptionsFromTo(l,t,n,s){return s==null&&this.style.terrain&&(s=this.transform.getElevation(n,this.style.terrain)),super.calculateCameraOptionsFromTo(l,t,n,s)}resize(l){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 a.Event("movestart",l)).fire(new a.Event("move",l))),this.fire(new a.Event("resize",l)),u&&this.fire(new a.Event("moveend",l)),this}getPixelRatio(){return this._pixelRatio}setPixelRatio(l){const[t,n]=this._containerDimensions();this._pixelRatio=l,this._resizeCanvas(t,n,l),this.painter.resize(t,n,l)}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(l){return this.transform.setMaxBounds(a.LngLatBounds.convert(l)),this._update()}setMinZoom(l){if((l=l==null?-2:l)>=-2&&l<=this.transform.maxZoom)return this.transform.minZoom=l,this._update(),this.getZoom()<l&&this.setZoom(l),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(l){if((l=l==null?22:l)>=this.transform.minZoom)return this.transform.maxZoom=l,this._update(),this.getZoom()>l&&this.setZoom(l),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(l){if((l=l==null?0:l)<0)throw new Error("minPitch must be greater than or equal to 0");if(l>=0&&l<=this.transform.maxPitch)return this.transform.minPitch=l,this._update(),this.getPitch()<l&&this.setPitch(l),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(l){if((l=l==null?60:l)>85)throw new Error("maxPitch must be less than or equal to 85");if(l>=this.transform.minPitch)return this.transform.maxPitch=l,this._update(),this.getPitch()>l&&this.setPitch(l),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(l){return this.transform.renderWorldCopies=l,this._update()}project(l){return this.transform.locationPoint(a.LngLat.convert(l),this.style&&this.style.terrain)}unproject(l){return this.transform.pointLocation(a.pointGeometry.convert(l),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(l,t,n){if(l==="mouseenter"||l==="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 Vi(l,this,p.originalEvent,{features:f}))):s=!1},mouseout:()=>{s=!1}}}}if(l==="mouseleave"||l==="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 Vi(l,this,f.originalEvent)))},mouseout:f=>{s&&(s=!1,n.call(this,new Vi(l,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:{[l]:s}}}}on(l,t,n){if(n===void 0)return super.on(l,t);const s=this._createDelegatedListener(l,t,n);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[l]=this._delegatedListeners[l]||[],this._delegatedListeners[l].push(s);for(const u in s.delegates)this.on(u,s.delegates[u]);return this}once(l,t,n){if(n===void 0)return super.once(l,t);const s=this._createDelegatedListener(l,t,n);for(const u in s.delegates)this.once(u,s.delegates[u]);return this}off(l,t,n){return n===void 0?super.off(l,t):(this._delegatedListeners&&this._delegatedListeners[l]&&(s=>{const u=this._delegatedListeners[l];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(l,t){if(!this.style)return[];let n;if(t!==void 0||l===void 0||l instanceof a.pointGeometry||Array.isArray(l)||(t=l,l=void 0),t=t||{},(l=l||[[0,0],[this.transform.width,this.transform.height]])instanceof a.pointGeometry||typeof l[0]=="number")n=[a.pointGeometry.convert(l)];else{const s=a.pointGeometry.convert(l[0]),u=a.pointGeometry.convert(l[1]);n=[s,new a.pointGeometry(u.x,s.y),u,new a.pointGeometry(s.x,u.y),s]}return this.style.queryRenderedFeatures(n,t,this.transform)}querySourceFeatures(l,t){return this.style.querySourceFeatures(l,t)}setStyle(l,t){return(t=a.extend({},{localIdeographFontFamily:this._localIdeographFontFamily},t)).diff!==!1&&t.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&l?(this._diffStyle(l,t),this):(this._localIdeographFontFamily=t.localIdeographFontFamily,this._updateStyle(l,t))}setTransformRequest(l){return this._requestManager.setTransformRequest(l),this}_getUIString(l){const t=this._locale[l];if(t==null)throw new Error(`Missing UI string '${l}'`);return t}_updateStyle(l,t){return this.style&&(this.style.setEventedParent(null),this.style._remove()),l?(this.style=new _i(this,t||{}),this.style.setEventedParent(this,{style:this.style}),typeof l=="string"?this.style.loadURL(l):this.style.loadJSON(l),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new _i(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(l,t){if(typeof l=="string"){const n=this._requestManager.transformRequest(l,a.ResourceType.Style);a.getJSON(n,(s,u)=>{s?this.fire(new a.ErrorEvent(s)):u&&this._updateDiff(u,t)})}else typeof l=="object"&&this._updateDiff(l,t)}_updateDiff(l,t){try{this.style.setState(l)&&this._update(!0)}catch(n){a.warnOnce(`Unable to perform style diff: ${n.message||n.error||n}. Rebuilding the style from scratch.`),this._updateStyle(l,t)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():a.warnOnce("There is no style added to the map.")}addSource(l,t){return this._lazyInitEmptyStyle(),this.style.addSource(l,t),this._update(!0)}isSourceLoaded(l){const t=this.style&&this.style.sourceCaches[l];if(t!==void 0)return t.loaded();this.fire(new a.ErrorEvent(new Error(`There is no source with ID '${l}'`)))}setTerrain(l){return this.style.setTerrain(l),this}getTerrain(){return this.style.terrain&&this.style.terrain.options}areTilesLoaded(){const l=this.style&&this.style.sourceCaches;for(const t in l){const n=l[t]._tiles;for(const s in n){const u=n[s];if(u.state!=="loaded"&&u.state!=="errored")return!1}}return!0}addSourceType(l,t,n){return this._lazyInitEmptyStyle(),this.style.addSourceType(l,t,n)}removeSource(l){return this.style.removeSource(l),this._update(!0)}getSource(l){return this.style.getSource(l)}addImage(l,t,{pixelRatio:n=1,sdf:s=!1,stretchX:u,stretchY:p,content:f}={}){if(this._lazyInitEmptyStyle(),t instanceof HTMLImageElement||a.isImageBitmap(t)){const{width:_,height:y,data:v}=a.exported.getImageData(t);this.style.addImage(l,{data:new a.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 a.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,E=t;this.style.addImage(l,{data:new a.RGBAImage({width:_,height:y},new Uint8Array(v)),pixelRatio:n,stretchX:u,stretchY:p,content:f,sdf:s,version:0,userImage:E}),E.onAdd&&E.onAdd(this,l)}}}updateImage(l,t){const n=this.style.getImage(l);if(!n)return this.fire(new a.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||a.isImageBitmap(t)?a.exported.getImageData(t):t,{width:u,height:p,data:f}=s;if(u===void 0||p===void 0)return this.fire(new a.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 a.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||a.isImageBitmap(t));n.data.replace(f,_),this.style.updateImage(l,n)}hasImage(l){return l?!!this.style.getImage(l):(this.fire(new a.ErrorEvent(new Error("Missing required image id"))),!1)}removeImage(l){this.style.removeImage(l)}loadImage(l,t){a.getImage(this._requestManager.transformRequest(l,a.ResourceType.Image),t)}listImages(){return this.style.listImages()}addLayer(l,t){return this._lazyInitEmptyStyle(),this.style.addLayer(l,t),this._update(!0)}moveLayer(l,t){return this.style.moveLayer(l,t),this._update(!0)}removeLayer(l){return this.style.removeLayer(l),this._update(!0)}getLayer(l){return this.style.getLayer(l)}setLayerZoomRange(l,t,n){return this.style.setLayerZoomRange(l,t,n),this._update(!0)}setFilter(l,t,n={}){return this.style.setFilter(l,t,n),this._update(!0)}getFilter(l){return this.style.getFilter(l)}setPaintProperty(l,t,n,s={}){return this.style.setPaintProperty(l,t,n,s),this._update(!0)}getPaintProperty(l,t){return this.style.getPaintProperty(l,t)}setLayoutProperty(l,t,n,s={}){return this.style.setLayoutProperty(l,t,n,s),this._update(!0)}getLayoutProperty(l,t){return this.style.getLayoutProperty(l,t)}setLight(l,t={}){return this._lazyInitEmptyStyle(),this.style.setLight(l,t),this._update(!0)}getLight(){return this.style.getLight()}setFeatureState(l,t){return this.style.setFeatureState(l,t),this._update()}removeFeatureState(l,t){return this.style.removeFeatureState(l,t),this._update()}getFeatureState(l){return this.style.getFeatureState(l)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let l=0,t=0;return this._container&&(l=this._container.clientWidth||400,t=this._container.clientHeight||300),[l,t]}_setupContainer(){const l=this._container;l.classList.add("maplibregl-map","mapboxgl-map");const t=this._canvasContainer=ie.create("div","maplibregl-canvas-container mapboxgl-canvas-container",l);this._interactive&&t.classList.add("maplibregl-interactive","mapboxgl-interactive"),this._canvas=ie.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=ie.create("div","maplibregl-control-container mapboxgl-control-container",l),u=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(p=>{u[p]=ie.create("div",`maplibregl-ctrl-${p} mapboxgl-ctrl-${p}`,s)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_setupCooperativeGestures(){const l=this._container;this._metaPress=!1,this._cooperativeGesturesScreen=ie.create("div","maplibregl-cooperative-gesture-screen",l);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=`
574
+ `}),staticAttributes:s,staticUniforms:f}}class as{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 S=this.boundPaintVertexBuffers.length!==u.length;for(let M=0;!S&&M<u.length;M++)this.boundPaintVertexBuffers[M]!==u[M]&&(S=!0);t.extVertexArrayObject&&this.vao&&this.boundProgram===n&&this.boundLayoutVertexBuffer===s&&!S&&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 S=t.numAttributes,M=this.context,z=M.gl;if(M.extVertexArrayObject)this.vao&&this.destroy(),this.vao=M.extVertexArrayObject.createVertexArrayOES(),M.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=M.currentNumAttributes||0;for(let V=S;V<v;V++)z.disableVertexAttribArray(V)}n.enableAttributes(z,t);for(const V of s)V.enableAttributes(z,t);f&&f.enableAttributes(z,t),_&&_.enableAttributes(z,t),y&&y.enableAttributes(z,t),n.bind(),n.setVertexAttribPointers(z,t,p);for(const V of s)V.bind(),V.setVertexAttribPointers(z,t,p);f&&(f.bind(),f.setVertexAttribPointers(z,t,p)),u&&u.bind(),_&&(_.bind(),_.setVertexAttribPointers(z,t,p)),y&&(y.bind(),y.setVertexAttribPointers(z,t,p)),M.currentNumAttributes=S}destroy(){this.vao&&(this.context.extVertexArrayObject.deleteVertexArrayOES(this.vao),this.vao=null)}}function ls(l){const t=[];for(let n=0;n<l.length;n++){if(l[n]===null)continue;const s=l[n].split(" ");t.push(s.pop())}return t}class pa{constructor(t,n,s,u,p,f,_){const y=t.gl;this.program=y.createProgram();const v=ls(s.staticAttributes),S=u?u.getBinderAttributes():[],M=v.concat(S),z=Kn.prelude.staticUniforms?ls(Kn.prelude.staticUniforms):[],V=s.staticUniforms?ls(s.staticUniforms):[],$=u?u.getBinderUniforms():[],U=z.concat(V).concat($),H=[];for(const ge of U)H.indexOf(ge)<0&&H.push(ge);const Y=u?u.defines():[];f&&Y.push("#define OVERDRAW_INSPECTOR;"),_&&Y.push("#define TERRAIN3D;");const ne=Y.concat(Kn.prelude.fragmentSource,s.fragmentSource).join(`
575
+ `),G=Y.concat(Kn.prelude.vertexSource,s.vertexSource).join(`
576
+ `),le=y.createShader(y.FRAGMENT_SHADER);if(y.isContextLost())return void(this.failedToCreate=!0);y.shaderSource(le,ne),y.compileShader(le),y.attachShader(this.program,le);const se=y.createShader(y.VERTEX_SHADER);if(y.isContextLost())return void(this.failedToCreate=!0);y.shaderSource(se,G),y.compileShader(se),y.attachShader(this.program,se),this.attributes={};const me={};this.numAttributes=M.length;for(let ge=0;ge<this.numAttributes;ge++)M[ge]&&(y.bindAttribLocation(this.program,ge,M[ge]),this.attributes[M[ge]]=ge);y.linkProgram(this.program),y.deleteShader(se),y.deleteShader(le);for(let ge=0;ge<H.length;ge++){const be=H[ge];if(be&&!me[be]){const de=y.getUniformLocation(this.program,be);de&&(me[be]=de)}}this.fixedUniforms=p(t,me),this.terrainUniforms=((ge,be)=>({u_depth:new a.Uniform1i(ge,be.u_depth),u_terrain:new a.Uniform1i(ge,be.u_terrain),u_terrain_dim:new a.Uniform1f(ge,be.u_terrain_dim),u_terrain_matrix:new a.UniformMatrix4f(ge,be.u_terrain_matrix),u_terrain_unpack:new a.Uniform4f(ge,be.u_terrain_unpack),u_terrain_offset:new a.Uniform1f(ge,be.u_terrain_offset),u_terrain_exaggeration:new a.Uniform1f(ge,be.u_terrain_exaggeration)}))(t,me),this.binderUniforms=u?u.getUniforms(t,me):[]}draw(t,n,s,u,p,f,_,y,v,S,M,z,V,$,U,H,Y,ne){const G=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(G.TEXTURE2),G.bindTexture(G.TEXTURE_2D,y.depthTexture),t.activeTexture.set(G.TEXTURE3),G.bindTexture(G.TEXTURE_2D,y.texture);for(const se in this.terrainUniforms)this.terrainUniforms[se].set(y[se])}for(const se in this.fixedUniforms)this.fixedUniforms[se].set(_[se]);U&&U.setUniforms(t,this.binderUniforms,V,{zoom:$});let le=0;switch(n){case G.LINES:le=2;break;case G.TRIANGLES:le=3;break;case G.LINE_STRIP:le=1}for(const se of z.get()){const me=se.vaos||(se.vaos={});(me[v]||(me[v]=new as)).bind(t,this,S,U?U.getPaintVertexBuffers():[],M,se.vertexOffset,H,Y,ne),G.drawElements(n,se.primitiveLength*le,G.UNSIGNED_SHORT,se.primitiveOffset*le*2)}}}function da(l,t,n){const s=1/Yt(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,l.fromScale,l.toScale],u_fade:l.t,u_pixel_coord_upper:[f>>16,_>>16],u_pixel_coord_lower:[65535&f,65535&_]}}const cs=(l,t,n,s)=>{const u=t.style.light,p=u.properties.get("position"),f=[p.x,p.y,p.z],_=a.create$1();u.properties.get("anchor")==="viewport"&&a.fromRotation(_,-t.transform.angle),a.transformMat3(f,f,_);const y=u.properties.get("color");return{u_matrix:l,u_lightpos:f,u_lightintensity:u.properties.get("intensity"),u_lightcolor:[y.r,y.g,y.b],u_vertical_gradient:+n,u_opacity:s}},Pl=(l,t,n,s,u,p,f)=>a.extend(cs(l,t,n,s),da(p,t,f),{u_height_factor:-Math.pow(2,u.overscaledZ)/f.tileSize/8}),Mo=l=>({u_matrix:l}),us=(l,t,n,s)=>a.extend(Mo(l),da(n,t,s)),fa=(l,t)=>({u_matrix:l,u_world:t}),ma=(l,t,n,s,u)=>a.extend(us(l,t,n,s),{u_world:u}),ga=(l,t,n,s)=>{const u=l.transform;let p,f;if(s.paint.get("circle-pitch-alignment")==="map"){const _=Yt(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:l.translatePosMatrix(t.posMatrix,n,s.paint.get("circle-translate"),s.paint.get("circle-translate-anchor")),u_pitch_with_map:+p,u_device_pixel_ratio:l.pixelRatio,u_extrude_scale:f}},tn=(l,t,n)=>{const s=Yt(n,1,t.zoom),u=Math.pow(2,t.zoom-n.tileID.overscaledZ),p=n.tileID.overscaleFactor();return{u_matrix:l,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}},Jn=(l,t,n=1)=>({u_matrix:l,u_color:t,u_overlay:0,u_overlay_scale:n}),Cn=l=>({u_matrix:l}),Po=(l,t,n,s)=>({u_matrix:l,u_extrude_scale:Yt(t,1,n),u_intensity:s});function zo(l,t){const n=Math.pow(2,t.canonical.z),s=t.canonical.y;return[new a.MercatorCoordinate(0,s/n).toLngLat().lat,new a.MercatorCoordinate(0,(s+1)/n).toLngLat().lat]}const An=(l,t,n,s)=>{const u=l.transform;return{u_matrix:Qn(l,t,n,s),u_ratio:1/Yt(t,1,u.zoom),u_device_pixel_ratio:l.pixelRatio,u_units_to_pixels:[1/u.pixelsToGLUnits[0],1/u.pixelsToGLUnits[1]]}},hs=(l,t,n,s,u)=>a.extend(An(l,t,n,u),{u_image:0,u_image_height:s}),ko=(l,t,n,s,u)=>{const p=l.transform,f=Vt(t,p);return{u_matrix:Qn(l,t,n,u),u_texsize:t.imageAtlasTexture.size,u_ratio:1/Yt(t,1,p.zoom),u_device_pixel_ratio:l.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]]}},Yn=(l,t,n,s,u,p)=>{const f=l.lineAtlas,_=Vt(t,l.transform),y=n.layout.get("line-cap")==="round",v=f.getDash(s.from,y),S=f.getDash(s.to,y),M=v.width*u.fromScale,z=S.width*u.toScale;return a.extend(An(l,t,n,p),{u_patternscale_a:[_/M,-v.height/2],u_patternscale_b:[_/z,-S.height/2],u_sdfgamma:f.width/(256*Math.min(M,z)*l.pixelRatio)/2,u_image:0,u_tex_y_a:v.y,u_tex_y_b:S.y,u_mix:u.t})};function Vt(l,t){return 1/Yt(l,1,t.tileZoom)}function Qn(l,t,n,s){return l.translatePosMatrix(s?s.posMatrix:t.tileID.posMatrix,t,n.paint.get("line-translate"),n.paint.get("line-translate-anchor"))}const _a=(l,t,n,s,u)=>{return{u_matrix:l,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:ya(u.paint.get("raster-hue-rotate"))};var p,f};function ya(l){l*=Math.PI/180;const t=Math.sin(l),n=Math.cos(l);return[(2*n+1)/3,(-Math.sqrt(3)*t-n+1)/3,(Math.sqrt(3)*t-n+1)/3]}const ps=(l,t,n,s,u,p,f,_,y,v)=>{const S=u.transform;return{u_is_size_zoom_constant:+(l==="constant"||l==="source"),u_is_size_feature_constant:+(l==="constant"||l==="camera"),u_size_t:t?t.uSizeT:0,u_size:t?t.uSize:0,u_camera_to_center_distance:S.cameraToCenterDistance,u_pitch:S.pitch/360*2*Math.PI,u_rotate_symbol:+n,u_aspect_ratio:S.width/S.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}},Do=(l,t,n,s,u,p,f,_,y,v,S)=>{const M=u.transform;return a.extend(ps(l,t,n,s,u,p,f,_,y,v),{u_gamma_scale:s?Math.cos(M._pitch)*M.cameraToCenterDistance:1,u_device_pixel_ratio:u.pixelRatio,u_is_halo:+S})},xa=(l,t,n,s,u,p,f,_,y,v)=>a.extend(Do(l,t,n,s,u,p,f,_,!0,y,!0),{u_texsize_icon:v,u_texture_icon:1}),zl=(l,t,n)=>({u_matrix:l,u_opacity:t,u_color:n}),kl=(l,t,n,s,u,p)=>a.extend(function(f,_,y,v){const S=y.imageManager.getPattern(f.from.toString()),M=y.imageManager.getPattern(f.to.toString()),{width:z,height:V}=y.imageManager.getPixelSize(),$=Math.pow(2,v.tileID.overscaledZ),U=v.tileSize*Math.pow(2,y.transform.tileZoom)/$,H=U*(v.tileID.canonical.x+v.tileID.wrap*$),Y=U*v.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:S.tl,u_pattern_br_a:S.br,u_pattern_tl_b:M.tl,u_pattern_br_b:M.br,u_texsize:[z,V],u_mix:_.t,u_pattern_size_a:S.displaySize,u_pattern_size_b:M.displaySize,u_scale_a:_.fromScale,u_scale_b:_.toScale,u_tile_units_to_pixels:1/Yt(v,1,y.transform.tileZoom),u_pixel_coord_upper:[H>>16,Y>>16],u_pixel_coord_lower:[65535&H,65535&Y]}}(s,p,n,u),{u_matrix:l,u_opacity:t}),ds={fillExtrusion:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_lightpos:new a.Uniform3f(l,t.u_lightpos),u_lightintensity:new a.Uniform1f(l,t.u_lightintensity),u_lightcolor:new a.Uniform3f(l,t.u_lightcolor),u_vertical_gradient:new a.Uniform1f(l,t.u_vertical_gradient),u_opacity:new a.Uniform1f(l,t.u_opacity)}),fillExtrusionPattern:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_lightpos:new a.Uniform3f(l,t.u_lightpos),u_lightintensity:new a.Uniform1f(l,t.u_lightintensity),u_lightcolor:new a.Uniform3f(l,t.u_lightcolor),u_vertical_gradient:new a.Uniform1f(l,t.u_vertical_gradient),u_height_factor:new a.Uniform1f(l,t.u_height_factor),u_image:new a.Uniform1i(l,t.u_image),u_texsize:new a.Uniform2f(l,t.u_texsize),u_pixel_coord_upper:new a.Uniform2f(l,t.u_pixel_coord_upper),u_pixel_coord_lower:new a.Uniform2f(l,t.u_pixel_coord_lower),u_scale:new a.Uniform3f(l,t.u_scale),u_fade:new a.Uniform1f(l,t.u_fade),u_opacity:new a.Uniform1f(l,t.u_opacity)}),fill:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix)}),fillPattern:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_image:new a.Uniform1i(l,t.u_image),u_texsize:new a.Uniform2f(l,t.u_texsize),u_pixel_coord_upper:new a.Uniform2f(l,t.u_pixel_coord_upper),u_pixel_coord_lower:new a.Uniform2f(l,t.u_pixel_coord_lower),u_scale:new a.Uniform3f(l,t.u_scale),u_fade:new a.Uniform1f(l,t.u_fade)}),fillOutline:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_world:new a.Uniform2f(l,t.u_world)}),fillOutlinePattern:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_world:new a.Uniform2f(l,t.u_world),u_image:new a.Uniform1i(l,t.u_image),u_texsize:new a.Uniform2f(l,t.u_texsize),u_pixel_coord_upper:new a.Uniform2f(l,t.u_pixel_coord_upper),u_pixel_coord_lower:new a.Uniform2f(l,t.u_pixel_coord_lower),u_scale:new a.Uniform3f(l,t.u_scale),u_fade:new a.Uniform1f(l,t.u_fade)}),circle:(l,t)=>({u_camera_to_center_distance:new a.Uniform1f(l,t.u_camera_to_center_distance),u_scale_with_map:new a.Uniform1i(l,t.u_scale_with_map),u_pitch_with_map:new a.Uniform1i(l,t.u_pitch_with_map),u_extrude_scale:new a.Uniform2f(l,t.u_extrude_scale),u_device_pixel_ratio:new a.Uniform1f(l,t.u_device_pixel_ratio),u_matrix:new a.UniformMatrix4f(l,t.u_matrix)}),collisionBox:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_camera_to_center_distance:new a.Uniform1f(l,t.u_camera_to_center_distance),u_pixels_to_tile_units:new a.Uniform1f(l,t.u_pixels_to_tile_units),u_extrude_scale:new a.Uniform2f(l,t.u_extrude_scale),u_overscale_factor:new a.Uniform1f(l,t.u_overscale_factor)}),collisionCircle:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_inv_matrix:new a.UniformMatrix4f(l,t.u_inv_matrix),u_camera_to_center_distance:new a.Uniform1f(l,t.u_camera_to_center_distance),u_viewport_size:new a.Uniform2f(l,t.u_viewport_size)}),debug:(l,t)=>({u_color:new a.UniformColor(l,t.u_color),u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_overlay:new a.Uniform1i(l,t.u_overlay),u_overlay_scale:new a.Uniform1f(l,t.u_overlay_scale)}),clippingMask:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix)}),heatmap:(l,t)=>({u_extrude_scale:new a.Uniform1f(l,t.u_extrude_scale),u_intensity:new a.Uniform1f(l,t.u_intensity),u_matrix:new a.UniformMatrix4f(l,t.u_matrix)}),heatmapTexture:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_world:new a.Uniform2f(l,t.u_world),u_image:new a.Uniform1i(l,t.u_image),u_color_ramp:new a.Uniform1i(l,t.u_color_ramp),u_opacity:new a.Uniform1f(l,t.u_opacity)}),hillshade:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_image:new a.Uniform1i(l,t.u_image),u_latrange:new a.Uniform2f(l,t.u_latrange),u_light:new a.Uniform2f(l,t.u_light),u_shadow:new a.UniformColor(l,t.u_shadow),u_highlight:new a.UniformColor(l,t.u_highlight),u_accent:new a.UniformColor(l,t.u_accent)}),hillshadePrepare:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_image:new a.Uniform1i(l,t.u_image),u_dimension:new a.Uniform2f(l,t.u_dimension),u_zoom:new a.Uniform1f(l,t.u_zoom),u_unpack:new a.Uniform4f(l,t.u_unpack)}),line:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_ratio:new a.Uniform1f(l,t.u_ratio),u_device_pixel_ratio:new a.Uniform1f(l,t.u_device_pixel_ratio),u_units_to_pixels:new a.Uniform2f(l,t.u_units_to_pixels)}),lineGradient:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_ratio:new a.Uniform1f(l,t.u_ratio),u_device_pixel_ratio:new a.Uniform1f(l,t.u_device_pixel_ratio),u_units_to_pixels:new a.Uniform2f(l,t.u_units_to_pixels),u_image:new a.Uniform1i(l,t.u_image),u_image_height:new a.Uniform1f(l,t.u_image_height)}),linePattern:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_texsize:new a.Uniform2f(l,t.u_texsize),u_ratio:new a.Uniform1f(l,t.u_ratio),u_device_pixel_ratio:new a.Uniform1f(l,t.u_device_pixel_ratio),u_image:new a.Uniform1i(l,t.u_image),u_units_to_pixels:new a.Uniform2f(l,t.u_units_to_pixels),u_scale:new a.Uniform3f(l,t.u_scale),u_fade:new a.Uniform1f(l,t.u_fade)}),lineSDF:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_ratio:new a.Uniform1f(l,t.u_ratio),u_device_pixel_ratio:new a.Uniform1f(l,t.u_device_pixel_ratio),u_units_to_pixels:new a.Uniform2f(l,t.u_units_to_pixels),u_patternscale_a:new a.Uniform2f(l,t.u_patternscale_a),u_patternscale_b:new a.Uniform2f(l,t.u_patternscale_b),u_sdfgamma:new a.Uniform1f(l,t.u_sdfgamma),u_image:new a.Uniform1i(l,t.u_image),u_tex_y_a:new a.Uniform1f(l,t.u_tex_y_a),u_tex_y_b:new a.Uniform1f(l,t.u_tex_y_b),u_mix:new a.Uniform1f(l,t.u_mix)}),raster:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_tl_parent:new a.Uniform2f(l,t.u_tl_parent),u_scale_parent:new a.Uniform1f(l,t.u_scale_parent),u_buffer_scale:new a.Uniform1f(l,t.u_buffer_scale),u_fade_t:new a.Uniform1f(l,t.u_fade_t),u_opacity:new a.Uniform1f(l,t.u_opacity),u_image0:new a.Uniform1i(l,t.u_image0),u_image1:new a.Uniform1i(l,t.u_image1),u_brightness_low:new a.Uniform1f(l,t.u_brightness_low),u_brightness_high:new a.Uniform1f(l,t.u_brightness_high),u_saturation_factor:new a.Uniform1f(l,t.u_saturation_factor),u_contrast_factor:new a.Uniform1f(l,t.u_contrast_factor),u_spin_weights:new a.Uniform3f(l,t.u_spin_weights)}),symbolIcon:(l,t)=>({u_is_size_zoom_constant:new a.Uniform1i(l,t.u_is_size_zoom_constant),u_is_size_feature_constant:new a.Uniform1i(l,t.u_is_size_feature_constant),u_size_t:new a.Uniform1f(l,t.u_size_t),u_size:new a.Uniform1f(l,t.u_size),u_camera_to_center_distance:new a.Uniform1f(l,t.u_camera_to_center_distance),u_pitch:new a.Uniform1f(l,t.u_pitch),u_rotate_symbol:new a.Uniform1i(l,t.u_rotate_symbol),u_aspect_ratio:new a.Uniform1f(l,t.u_aspect_ratio),u_fade_change:new a.Uniform1f(l,t.u_fade_change),u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_label_plane_matrix:new a.UniformMatrix4f(l,t.u_label_plane_matrix),u_coord_matrix:new a.UniformMatrix4f(l,t.u_coord_matrix),u_is_text:new a.Uniform1i(l,t.u_is_text),u_pitch_with_map:new a.Uniform1i(l,t.u_pitch_with_map),u_texsize:new a.Uniform2f(l,t.u_texsize),u_texture:new a.Uniform1i(l,t.u_texture)}),symbolSDF:(l,t)=>({u_is_size_zoom_constant:new a.Uniform1i(l,t.u_is_size_zoom_constant),u_is_size_feature_constant:new a.Uniform1i(l,t.u_is_size_feature_constant),u_size_t:new a.Uniform1f(l,t.u_size_t),u_size:new a.Uniform1f(l,t.u_size),u_camera_to_center_distance:new a.Uniform1f(l,t.u_camera_to_center_distance),u_pitch:new a.Uniform1f(l,t.u_pitch),u_rotate_symbol:new a.Uniform1i(l,t.u_rotate_symbol),u_aspect_ratio:new a.Uniform1f(l,t.u_aspect_ratio),u_fade_change:new a.Uniform1f(l,t.u_fade_change),u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_label_plane_matrix:new a.UniformMatrix4f(l,t.u_label_plane_matrix),u_coord_matrix:new a.UniformMatrix4f(l,t.u_coord_matrix),u_is_text:new a.Uniform1i(l,t.u_is_text),u_pitch_with_map:new a.Uniform1i(l,t.u_pitch_with_map),u_texsize:new a.Uniform2f(l,t.u_texsize),u_texture:new a.Uniform1i(l,t.u_texture),u_gamma_scale:new a.Uniform1f(l,t.u_gamma_scale),u_device_pixel_ratio:new a.Uniform1f(l,t.u_device_pixel_ratio),u_is_halo:new a.Uniform1i(l,t.u_is_halo)}),symbolTextAndIcon:(l,t)=>({u_is_size_zoom_constant:new a.Uniform1i(l,t.u_is_size_zoom_constant),u_is_size_feature_constant:new a.Uniform1i(l,t.u_is_size_feature_constant),u_size_t:new a.Uniform1f(l,t.u_size_t),u_size:new a.Uniform1f(l,t.u_size),u_camera_to_center_distance:new a.Uniform1f(l,t.u_camera_to_center_distance),u_pitch:new a.Uniform1f(l,t.u_pitch),u_rotate_symbol:new a.Uniform1i(l,t.u_rotate_symbol),u_aspect_ratio:new a.Uniform1f(l,t.u_aspect_ratio),u_fade_change:new a.Uniform1f(l,t.u_fade_change),u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_label_plane_matrix:new a.UniformMatrix4f(l,t.u_label_plane_matrix),u_coord_matrix:new a.UniformMatrix4f(l,t.u_coord_matrix),u_is_text:new a.Uniform1i(l,t.u_is_text),u_pitch_with_map:new a.Uniform1i(l,t.u_pitch_with_map),u_texsize:new a.Uniform2f(l,t.u_texsize),u_texsize_icon:new a.Uniform2f(l,t.u_texsize_icon),u_texture:new a.Uniform1i(l,t.u_texture),u_texture_icon:new a.Uniform1i(l,t.u_texture_icon),u_gamma_scale:new a.Uniform1f(l,t.u_gamma_scale),u_device_pixel_ratio:new a.Uniform1f(l,t.u_device_pixel_ratio),u_is_halo:new a.Uniform1i(l,t.u_is_halo)}),background:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_opacity:new a.Uniform1f(l,t.u_opacity),u_color:new a.UniformColor(l,t.u_color)}),backgroundPattern:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_opacity:new a.Uniform1f(l,t.u_opacity),u_image:new a.Uniform1i(l,t.u_image),u_pattern_tl_a:new a.Uniform2f(l,t.u_pattern_tl_a),u_pattern_br_a:new a.Uniform2f(l,t.u_pattern_br_a),u_pattern_tl_b:new a.Uniform2f(l,t.u_pattern_tl_b),u_pattern_br_b:new a.Uniform2f(l,t.u_pattern_br_b),u_texsize:new a.Uniform2f(l,t.u_texsize),u_mix:new a.Uniform1f(l,t.u_mix),u_pattern_size_a:new a.Uniform2f(l,t.u_pattern_size_a),u_pattern_size_b:new a.Uniform2f(l,t.u_pattern_size_b),u_scale_a:new a.Uniform1f(l,t.u_scale_a),u_scale_b:new a.Uniform1f(l,t.u_scale_b),u_pixel_coord_upper:new a.Uniform2f(l,t.u_pixel_coord_upper),u_pixel_coord_lower:new a.Uniform2f(l,t.u_pixel_coord_lower),u_tile_units_to_pixels:new a.Uniform1f(l,t.u_tile_units_to_pixels)}),terrain:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_texture:new a.Uniform1i(l,t.u_texture)}),terrainDepth:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix)}),terrainCoords:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_texture:new a.Uniform1i(l,t.u_texture),u_terrain_coords_id:new a.Uniform1f(l,t.u_terrain_coords_id)})};class fs{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 ms={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class gs{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[ms[p.type]],!1,this.itemSize,p.offset+this.itemSize*(s||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class St{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 va extends St{getDefault(){return a.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 Dl extends St{getDefault(){return 1}set(t){(t!==this.current||this.dirty)&&(this.gl.clearDepth(t),this.current=t,this.dirty=!1)}}class eo extends St{getDefault(){return 0}set(t){(t!==this.current||this.dirty)&&(this.gl.clearStencil(t),this.current=t,this.dirty=!1)}}class to extends St{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 ba extends St{getDefault(){return!0}set(t){(t!==this.current||this.dirty)&&(this.gl.depthMask(t),this.current=t,this.dirty=!1)}}class $i extends St{getDefault(){return 255}set(t){(t!==this.current||this.dirty)&&(this.gl.stencilMask(t),this.current=t,this.dirty=!1)}}class _s extends St{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 Lo extends St{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 Ro extends St{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 ys extends St{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 xs extends St{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 Bo extends St{getDefault(){return this.gl.LESS}set(t){(t!==this.current||this.dirty)&&(this.gl.depthFunc(t),this.current=t,this.dirty=!1)}}class vs extends St{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 bs extends St{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 Fo extends St{getDefault(){return a.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 wa extends St{getDefault(){return this.gl.FUNC_ADD}set(t){(t!==this.current||this.dirty)&&(this.gl.blendEquation(t),this.current=t,this.dirty=!1)}}class Ta extends St{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 Mn extends St{getDefault(){return this.gl.BACK}set(t){(t!==this.current||this.dirty)&&(this.gl.cullFace(t),this.current=t,this.dirty=!1)}}class Ll extends St{getDefault(){return this.gl.CCW}set(t){(t!==this.current||this.dirty)&&(this.gl.frontFace(t),this.current=t,this.dirty=!1)}}class Rl extends St{getDefault(){return null}set(t){(t!==this.current||this.dirty)&&(this.gl.useProgram(t),this.current=t,this.dirty=!1)}}class Bl extends St{getDefault(){return this.gl.TEXTURE0}set(t){(t!==this.current||this.dirty)&&(this.gl.activeTexture(t),this.current=t,this.dirty=!1)}}class Fl extends St{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 Ol extends St{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 $l extends St{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 ws extends St{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 Oo extends St{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 Ts extends St{getDefault(){return null}set(t){const n=this.gl;n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class Es extends St{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 Pn extends St{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 Ea extends St{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 Sa extends St{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 $o extends St{constructor(t,n){super(t),this.context=t,this.parent=n}getDefault(){return null}}class rn extends $o{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 Ia extends $o{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 zn{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 rn(t,f),u&&(this.depthAttachment=new Ia(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 Ft{constructor(t,n,s){this.blendFunction=t,this.blendColor=n,this.mask=s}}Ft.Replace=[1,0],Ft.disabled=new Ft(Ft.Replace,a.Color.transparent,[!1,!1,!1,!1]),Ft.unblended=new Ft(Ft.Replace,a.Color.transparent,[!0,!0,!0,!0]),Ft.alphaBlended=new Ft([1,771],a.Color.transparent,[!0,!0,!0,!0]);class Ca{constructor(t){this.gl=t,this.extVertexArrayObject=this.gl.getExtension("OES_vertex_array_object"),this.clearColor=new va(this),this.clearDepth=new Dl(this),this.clearStencil=new eo(this),this.colorMask=new to(this),this.depthMask=new ba(this),this.stencilMask=new $i(this),this.stencilFunc=new _s(this),this.stencilOp=new Lo(this),this.stencilTest=new Ro(this),this.depthRange=new ys(this),this.depthTest=new xs(this),this.depthFunc=new Bo(this),this.blend=new vs(this),this.blendFunc=new bs(this),this.blendColor=new Fo(this),this.blendEquation=new wa(this),this.cullFace=new Ta(this),this.cullFaceSide=new Mn(this),this.frontFace=new Ll(this),this.program=new Rl(this),this.activeTexture=new Bl(this),this.viewport=new Fl(this),this.bindFramebuffer=new Ol(this),this.bindRenderbuffer=new $l(this),this.bindTexture=new ws(this),this.bindVertexBuffer=new Oo(this),this.bindElementBuffer=new Ts(this),this.bindVertexArrayOES=this.extVertexArrayObject&&new Es(this),this.pixelStoreUnpack=new Pn(this),this.pixelStoreUnpackPremultiplyAlpha=new Ea(this),this.pixelStoreUnpackFlipY=new Sa(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 fs(this,t,n)}createVertexBuffer(t,n,s){return new gs(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 zn(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){ue(t.blendFunction,Ft.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 mt{constructor(t,n,s){this.func=t,this.mask=n,this.range=s}}mt.ReadOnly=!1,mt.ReadWrite=!0,mt.disabled=new mt(519,mt.ReadOnly,[0,1]);const It=7680;class Bt{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}}Bt.disabled=new Bt({func:519,mask:0},0,0,It,It,It);class Nt{constructor(t,n,s){this.enable=t,this.mode=n,this.frontFace=s}}let io;function kn(l,t,n,s,u,p,f){const _=l.context,y=_.gl,v=l.useProgram("collisionBox"),S=[];let M=0,z=0;for(let G=0;G<s.length;G++){const le=s[G],se=t.getTile(le),me=se.getBucket(n);if(!me)continue;let ge=le.posMatrix;u[0]===0&&u[1]===0||(ge=l.translatePosMatrix(le.posMatrix,se,u,p));const be=f?me.textCollisionBox:me.iconCollisionBox,de=me.collisionCircleArray;if(de.length>0){const Re=a.create(),Ie=ge;a.mul(Re,me.placementInvProjMatrix,l.transform.glCoordMatrix),a.mul(Re,Re,me.placementViewportMatrix),S.push({circleArray:de,circleOffset:z,transform:Ie,invTransform:Re,coord:le}),M+=de.length/4,z=M}be&&v.draw(_,y.LINES,mt.disabled,Bt.disabled,l.colorModeForRenderPass(),Nt.disabled,tn(ge,l.transform,se),l.style.terrain&&l.style.terrain.getTerrainData(le),n.id,be.layoutVertexBuffer,be.indexBuffer,be.segments,null,l.transform.zoom,null,null,be.collisionVertexBuffer)}if(!f||!S.length)return;const V=l.useProgram("collisionCircle"),$=new a.CollisionCircleLayoutArray;$.resize(4*M),$._trim();let U=0;for(const G of S)for(let le=0;le<G.circleArray.length/4;le++){const se=4*le,me=G.circleArray[se+0],ge=G.circleArray[se+1],be=G.circleArray[se+2],de=G.circleArray[se+3];$.emplace(U++,me,ge,be,de,0),$.emplace(U++,me,ge,be,de,1),$.emplace(U++,me,ge,be,de,2),$.emplace(U++,me,ge,be,de,3)}(!io||io.length<2*M)&&(io=function(G){const le=2*G,se=new a.QuadTriangleArray;se.resize(le),se._trim();for(let me=0;me<le;me++){const ge=6*me;se.uint16[ge+0]=4*me+0,se.uint16[ge+1]=4*me+1,se.uint16[ge+2]=4*me+2,se.uint16[ge+3]=4*me+2,se.uint16[ge+4]=4*me+3,se.uint16[ge+5]=4*me+0}return se}(M));const H=_.createIndexBuffer(io,!0),Y=_.createVertexBuffer($,a.collisionCircleLayout.members,!0);for(const G of S){const le={u_matrix:G.transform,u_inv_matrix:G.invTransform,u_camera_to_center_distance:(ne=l.transform).cameraToCenterDistance,u_viewport_size:[ne.width,ne.height]};V.draw(_,y.TRIANGLES,mt.disabled,Bt.disabled,l.colorModeForRenderPass(),Nt.disabled,le,l.style.terrain&&l.style.terrain.getTerrainData(G.coord),n.id,Y,H,a.SegmentVector.simpleSegment(0,2*G.circleOffset,G.circleArray.length,G.circleArray.length/2),null,l.transform.zoom,null,null,null)}var ne;Y.destroy(),H.destroy()}Nt.disabled=new Nt(!1,1029,2305),Nt.backCCW=new Nt(!0,1029,2305);const Ul=a.identity(new Float32Array(16));function Vl(l,t,n,s,u,p){const{horizontalAlign:f,verticalAlign:_}=a.getAnchorAlignment(l),y=-(f-.5)*t,v=-(_-.5)*n,S=a.evaluateVariableOffset(l,s);return new a.pointGeometry((y/u+S[0])*p,(v/u+S[1])*p)}function Aa(l,t,n,s,u,p,f,_,y,v,S){const M=l.text.placedSymbolArray,z=l.text.dynamicLayoutVertexArray,V=l.icon.dynamicLayoutVertexArray,$={};z.clear();for(let U=0;U<M.length;U++){const H=M.get(U),Y=l.allowVerticalPlacement&&!H.placedOrientation,ne=H.hidden||!H.crossTileID||Y?null:s[H.crossTileID];if(ne){const G=new a.pointGeometry(H.anchorX,H.anchorY),le=vt(G,n?f:p,S),se=Ki(u.cameraToCenterDistance,le.signedDistanceFromCamera);let me=a.evaluateSizeForFeature(l.textSizeData,y,H)*se/a.ONE_EM;n&&(me*=l.tilePixelRatio/_);const{width:ge,height:be,anchor:de,textOffset:Re,textBoxScale:Ie}=ne,Fe=Vl(de,ge,be,Re,Ie,me),st=n?vt(G.add(Fe),p,S).point:le.point.add(t?Fe.rotate(-u.angle):Fe),ut=l.allowVerticalPlacement&&H.placedOrientation===a.WritingMode.vertical?Math.PI/2:0;for(let We=0;We<H.numGlyphs;We++)a.addDynamicAttributes(z,st,ut);v&&H.associatedIconIndex>=0&&($[H.associatedIconIndex]={shiftedAnchor:st,angle:ut})}else rt(H.numGlyphs,z)}if(v){V.clear();const U=l.icon.placedSymbolArray;for(let H=0;H<U.length;H++){const Y=U.get(H);if(Y.hidden)rt(Y.numGlyphs,V);else{const ne=$[H];if(ne)for(let G=0;G<Y.numGlyphs;G++)a.addDynamicAttributes(V,ne.shiftedAnchor,ne.angle);else rt(Y.numGlyphs,V)}}l.icon.dynamicLayoutVertexBuffer.updateData(V)}l.text.dynamicLayoutVertexBuffer.updateData(z)}function Nl(l,t,n){return n.iconsInText&&t?"symbolTextAndIcon":l?"symbolSDF":"symbolIcon"}function Uo(l,t,n,s,u,p,f,_,y,v,S,M){const z=l.context,V=z.gl,$=l.transform,U=_==="map",H=y==="map",Y=_!=="viewport"&&n.layout.get("symbol-placement")!=="point",ne=U&&!H&&!Y,G=!n.layout.get("symbol-sort-key").isConstant();let le=!1;const se=l.depthModeForSublayer(0,mt.ReadOnly),me=n.layout.get("text-variable-anchor"),ge=[];for(const be of s){const de=t.getTile(be),Re=de.getBucket(n);if(!Re)continue;const Ie=u?Re.text:Re.icon;if(!Ie||!Ie.segments.get().length)continue;const Fe=Ie.programConfigurations.get(n.id),st=u||Re.sdfIcons,ut=u?Re.textSizeData:Re.iconSizeData,We=H||$.pitch!==0,At=l.useProgram(Nl(st,u,Re),Fe),Mt=a.evaluateSizeForZoom(ut,$.zoom),_t=l.style.terrain&&l.style.terrain.getTerrainData(be);let Tt,zt,ai,gr,nr=[0,0],_r=null;if(u){if(zt=de.glyphAtlasTexture,ai=V.LINEAR,Tt=de.glyphAtlasTexture.size,Re.iconsInText){nr=de.imageAtlasTexture.size,_r=de.imageAtlasTexture;const Qi=ut.kind==="composite"||ut.kind==="camera";gr=We||l.options.rotating||l.options.zooming||Qi?V.LINEAR:V.NEAREST}}else{const Qi=n.layout.get("icon-size").constantOr(0)!==1||Re.iconsNeedLinear;zt=de.imageAtlasTexture,ai=st||l.options.rotating||l.options.zooming||Qi||We?V.LINEAR:V.NEAREST,Tt=de.imageAtlasTexture.size}const Xr=Yt(de,1,l.transform.zoom),Yi=Jr(be.posMatrix,H,U,l.transform,Xr),zi=ir(be.posMatrix,H,U,l.transform,Xr),Ar=me&&Re.hasTextData(),Wo=n.layout.get("icon-text-fit")!=="none"&&Ar&&Re.hasIconData();if(Y){const Qi=l.style.terrain?($s,On)=>l.style.terrain.getElevation(be,$s,On):null,an=n.layout.get("text-rotation-alignment")==="map";Oi(Re,be.posMatrix,l,u,Yi,zi,H,v,an,Qi)}const ii=l.translatePosMatrix(be.posMatrix,de,p,f),dt=Y||u&&me||Wo?Ul:Yi,Ct=l.translatePosMatrix(zi,de,p,f,!0),li=st&&n.paint.get(u?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let ci;ci=st?Re.iconsInText?xa(ut.kind,Mt,ne,H,l,ii,dt,Ct,Tt,nr):Do(ut.kind,Mt,ne,H,l,ii,dt,Ct,u,Tt,!0):ps(ut.kind,Mt,ne,H,l,ii,dt,Ct,u,Tt);const qt={program:At,buffers:Ie,uniformValues:ci,atlasTexture:zt,atlasTextureIcon:_r,atlasInterpolation:ai,atlasInterpolationIcon:gr,isSDF:st,hasHalo:li};if(G&&Re.canOverlap){le=!0;const Qi=Ie.segments.get();for(const an of Qi)ge.push({segments:new a.SegmentVector([an]),sortKey:an.sortKey,state:qt,terrainData:_t})}else ge.push({segments:Ie.segments,sortKey:0,state:qt,terrainData:_t})}le&&ge.sort((be,de)=>be.sortKey-de.sortKey);for(const be of ge){const de=be.state;if(z.activeTexture.set(V.TEXTURE0),de.atlasTexture.bind(de.atlasInterpolation,V.CLAMP_TO_EDGE),de.atlasTextureIcon&&(z.activeTexture.set(V.TEXTURE1),de.atlasTextureIcon&&de.atlasTextureIcon.bind(de.atlasInterpolationIcon,V.CLAMP_TO_EDGE)),de.isSDF){const Re=de.uniformValues;de.hasHalo&&(Re.u_is_halo=1,ro(de.buffers,be.segments,n,l,de.program,se,S,M,Re,be.terrainData)),Re.u_is_halo=0}ro(de.buffers,be.segments,n,l,de.program,se,S,M,de.uniformValues,be.terrainData)}}function ro(l,t,n,s,u,p,f,_,y,v){const S=s.context;u.draw(S,S.gl.TRIANGLES,p,f,_,Nt.disabled,y,v,n.id,l.layoutVertexBuffer,l.indexBuffer,t,n.paint,s.transform.zoom,l.programConfigurations.get(n.id),l.dynamicLayoutVertexBuffer,l.opacityVertexBuffer)}function no(l,t,n,s,u,p,f){const _=l.context.gl,y=n.paint.get("fill-pattern"),v=y&&y.constantOr(1),S=n.getCrossfadeParameters();let M,z,V,$,U;f?(z=v&&!n.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",M=_.LINES):(z=v?"fillPattern":"fill",M=_.TRIANGLES);for(const H of s){const Y=t.getTile(H);if(v&&!Y.patternsLoaded())continue;const ne=Y.getBucket(n);if(!ne)continue;const G=ne.programConfigurations.get(n.id),le=l.useProgram(z,G),se=l.style.terrain&&l.style.terrain.getTerrainData(H);v&&(l.context.activeTexture.set(_.TEXTURE0),Y.imageAtlasTexture.bind(_.LINEAR,_.CLAMP_TO_EDGE),G.updatePaintBuffers(S));const me=y.constantOr(null);if(me&&Y.imageAtlas){const de=Y.imageAtlas,Re=de.patternPositions[me.to.toString()],Ie=de.patternPositions[me.from.toString()];Re&&Ie&&G.setConstantPatternPositions(Re,Ie)}const ge=se?H:null,be=l.translatePosMatrix(ge?ge.posMatrix:H.posMatrix,Y,n.paint.get("fill-translate"),n.paint.get("fill-translate-anchor"));if(f){$=ne.indexBuffer2,U=ne.segments2;const de=[_.drawingBufferWidth,_.drawingBufferHeight];V=z==="fillOutlinePattern"&&v?ma(be,l,S,Y,de):fa(be,de)}else $=ne.indexBuffer,U=ne.segments,V=v?us(be,l,S,Y):Mo(be);le.draw(l.context,M,u,l.stencilModeForClipping(H),p,Nt.disabled,V,se,n.id,ne.layoutVertexBuffer,$,U,n.paint,l.transform.zoom,G)}}function oo(l,t,n,s,u,p,f){const _=l.context,y=_.gl,v=n.paint.get("fill-extrusion-pattern"),S=v.constantOr(1),M=n.getCrossfadeParameters(),z=n.paint.get("fill-extrusion-opacity");for(const V of s){const $=t.getTile(V),U=$.getBucket(n);if(!U)continue;const H=l.style.terrain&&l.style.terrain.getTerrainData(V),Y=U.programConfigurations.get(n.id),ne=l.useProgram(S?"fillExtrusionPattern":"fillExtrusion",Y);S&&(l.context.activeTexture.set(y.TEXTURE0),$.imageAtlasTexture.bind(y.LINEAR,y.CLAMP_TO_EDGE),Y.updatePaintBuffers(M));const G=v.constantOr(null);if(G&&$.imageAtlas){const ge=$.imageAtlas,be=ge.patternPositions[G.to.toString()],de=ge.patternPositions[G.from.toString()];be&&de&&Y.setConstantPatternPositions(be,de)}const le=l.translatePosMatrix(V.posMatrix,$,n.paint.get("fill-extrusion-translate"),n.paint.get("fill-extrusion-translate-anchor")),se=n.paint.get("fill-extrusion-vertical-gradient"),me=S?Pl(le,l,se,z,V,M,$):cs(le,l,se,z);ne.draw(_,_.gl.TRIANGLES,u,p,f,Nt.backCCW,me,H,n.id,U.layoutVertexBuffer,U.indexBuffer,U.segments,n.paint,l.transform.zoom,Y,l.style.terrain&&U.centroidVertexBuffer)}}function Ss(l,t,n,s,u,p,f){const _=l.context,y=_.gl,v=n.fbo;if(!v)return;const S=l.useProgram("hillshade"),M=l.style.terrain&&l.style.terrain.getTerrainData(t);_.activeTexture.set(y.TEXTURE0),y.bindTexture(y.TEXTURE_2D,v.colorAttachment.get()),S.draw(_,y.TRIANGLES,u,p,f,Nt.disabled,((z,V,$,U)=>{const H=$.paint.get("hillshade-shadow-color"),Y=$.paint.get("hillshade-highlight-color"),ne=$.paint.get("hillshade-accent-color");let G=$.paint.get("hillshade-illumination-direction")*(Math.PI/180);$.paint.get("hillshade-illumination-anchor")==="viewport"&&(G-=z.transform.angle);const le=!z.options.moving;return{u_matrix:U?U.posMatrix:z.transform.calculatePosMatrix(V.tileID.toUnwrapped(),le),u_image:0,u_latrange:zo(0,V.tileID),u_light:[$.paint.get("hillshade-exaggeration"),G],u_shadow:H,u_highlight:Y,u_accent:ne}})(l,n,s,M?t:null),M,s.id,l.rasterBoundsBuffer,l.quadTriangleIndexBuffer,l.rasterBoundsSegments)}function Ma(l,t,n,s,u,p){const f=l.context,_=f.gl,y=t.dem;if(y&&y.data){const v=y.dim,S=y.stride,M=y.getPixels();if(f.activeTexture.set(_.TEXTURE1),f.pixelStoreUnpackPremultiplyAlpha.set(!1),t.demTexture=t.demTexture||l.getTileTexture(S),t.demTexture){const V=t.demTexture;V.update(M,{premultiply:!1}),V.bind(_.NEAREST,_.CLAMP_TO_EDGE)}else t.demTexture=new Be(f,M,_.RGBA,{premultiply:!1}),t.demTexture.bind(_.NEAREST,_.CLAMP_TO_EDGE);f.activeTexture.set(_.TEXTURE0);let z=t.fbo;if(!z){const V=new Be(f,{width:v,height:v,data:null},_.RGBA);V.bind(_.LINEAR,_.CLAMP_TO_EDGE),z=t.fbo=f.createFramebuffer(v,v,!0),z.colorAttachment.set(V.texture)}f.bindFramebuffer.set(z.framebuffer),f.viewport.set([0,0,v,v]),l.useProgram("hillshadePrepare").draw(f,_.TRIANGLES,s,u,p,Nt.disabled,((V,$)=>{const U=$.stride,H=a.create();return a.ortho(H,0,a.EXTENT,-a.EXTENT,0,0,1),a.translate(H,H,[0,-a.EXTENT,0]),{u_matrix:H,u_image:1,u_dimension:[U,U],u_zoom:V.overscaledZ,u_unpack:$.getUnpackVector()}})(t.tileID,y),null,n.id,l.rasterBoundsBuffer,l.quadTriangleIndexBuffer,l.rasterBoundsSegments),t.needsHillshadePrepare=!1}}function Vo(l,t,n,s,u,p){const f=s.paint.get("raster-fade-duration");if(!p&&f>0){const _=a.exported.now(),y=(_-l.timeAdded)/f,v=t?(_-t.timeAdded)/f:-1,S=n.getSource(),M=u.coveringZoomLevel({tileSize:S.tileSize,roundZoom:S.roundZoom}),z=!t||Math.abs(t.tileID.overscaledZ-M)>Math.abs(l.tileID.overscaledZ-M),V=z&&l.refreshedUponExpiration?1:a.clamp(z?y:1-v,0,1);return l.refreshedUponExpiration&&y>=1&&(l.refreshedUponExpiration=!1),t?{opacity:1,mix:1-V}:{opacity:V,mix:0}}return{opacity:1,mix:0}}const No=new a.Color(1,0,0,1),rr=new a.Color(0,1,0,1),Pa=new a.Color(0,0,1,1),Is=new a.Color(1,0,1,1),za=new a.Color(0,1,1,1);function nn(l,t,n,s){Dn(l,0,t+n/2,l.transform.width,n,s)}function so(l,t,n,s){Dn(l,t-n/2,0,n,l.transform.height,s)}function Dn(l,t,n,s,u,p){const f=l.context,_=f.gl;_.enable(_.SCISSOR_TEST),_.scissor(t*l.pixelRatio,n*l.pixelRatio,s*l.pixelRatio,u*l.pixelRatio),f.clear({color:p}),_.disable(_.SCISSOR_TEST)}function Gl(l,t,n){const s=l.context,u=s.gl,p=n.posMatrix,f=l.useProgram("debug"),_=mt.disabled,y=Bt.disabled,v=l.colorModeForRenderPass(),S="$debug",M=l.style.terrain&&l.style.terrain.getTerrainData(n);s.activeTexture.set(u.TEXTURE0),l.emptyTexture.bind(u.LINEAR,u.CLAMP_TO_EDGE);const z=t.getTileByID(n.key).latestRawTileData,V=Math.floor((z&&z.byteLength||0)/1024),$=t.getTile(n).tileSize,U=512/Math.min($,512)*(n.overscaledZ/l.transform.zoom)*.5;let H=n.canonical.toString();n.overscaledZ!==n.canonical.z&&(H+=` => ${n.overscaledZ}`),function(Y,ne){Y.initDebugOverlayCanvas();const G=Y.debugOverlayCanvas,le=Y.context.gl,se=Y.debugOverlayCanvas.getContext("2d");se.clearRect(0,0,G.width,G.height),se.shadowColor="white",se.shadowBlur=2,se.lineWidth=1.5,se.strokeStyle="white",se.textBaseline="top",se.font="bold 36px Open Sans, sans-serif",se.fillText(ne,5,5),se.strokeText(ne,5,5),Y.debugOverlayTexture.update(G),Y.debugOverlayTexture.bind(le.LINEAR,le.CLAMP_TO_EDGE)}(l,`${H} ${V}kB`),f.draw(s,u.TRIANGLES,_,y,Ft.alphaBlended,Nt.disabled,Jn(p,a.Color.transparent,U),null,S,l.debugBuffer,l.quadTriangleIndexBuffer,l.debugSegments),f.draw(s,u.LINE_STRIP,_,y,v,Nt.disabled,Jn(p,a.Color.red),M,S,l.debugBuffer,l.tileBorderIndexBuffer,l.debugSegments)}function Go(l,t,n){const s=l.context,u=s.gl,p=l.colorModeForRenderPass(),f=new mt(u.LEQUAL,mt.ReadWrite,l.depthRangeFor3D),_=l.useProgram("terrain"),y=t.getTerrainMesh(),v=t.getTerrainData(n.tileID);s.bindFramebuffer.set(null),s.viewport.set([0,0,l.width,l.height]),s.activeTexture.set(u.TEXTURE0),u.bindTexture(u.TEXTURE_2D,t.getRTTFramebuffer().colorAttachment.get());const S=l.transform.calculatePosMatrix(n.tileID.toUnwrapped());_.draw(s,u.TRIANGLES,f,Bt.disabled,p,Nt.backCCW,{u_matrix:S,u_texture:0},v,"terrain",y.vertexBuffer,y.indexBuffer,y.segments)}function ka(l,t,n,s){const u=l.context,p=n.tileSize*t.qualityFactor;n.textures[s]||(n.textures[s]=l.getTileTexture(p)||new Be(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 Da{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(ka(s,s.style.terrain,v,_),this._rerender[v.tileID.key]){s.context.clear({color:a.Color.transparent});for(let S=0;S<y.length;S++){const M=s.style._layers[y[S]],z=M.source?this._coordsDescendingInv[M.source][v.tileID.key]:[v.tileID];s._renderTileClippingMasks(M,z),s.renderLayer(s,s.style.sourceCaches[M.source],M,z),M.source&&(v.textureCoords[M.source]=this._coordsDescendingInvStr[M.source][v.tileID.key])}}Go(s,s.style.terrain,v)}if(n==="hillshade"){this._stacks.push([u[p]]);for(const v of this._renderableTiles){const S=this._coordsDescendingInv[t.source][v.tileID.key];ka(s,s.style.terrain,v,this._stacks.length-1),s.context.clear({color:a.Color.transparent}),s._renderTileClippingMasks(t,S),s.renderLayer(s,s.style.sourceCaches[t.source],t,S),Go(s,s.style.terrain,v)}return!0}return this._renderToTexture[n]}return!1}}const ao={symbol:function(l,t,n,s,u){if(l.renderPass!=="translucent")return;const p=Bt.disabled,f=l.colorModeForRenderPass();n.layout.get("text-variable-anchor")&&function(_,y,v,S,M,z,V){const $=y.transform,U=M==="map",H=z==="map";for(const Y of _){const ne=S.getTile(Y),G=ne.getBucket(v);if(!G||!G.text||!G.text.segments.get().length)continue;const le=a.evaluateSizeForZoom(G.textSizeData,$.zoom),se=Yt(ne,1,y.transform.zoom),me=Jr(Y.posMatrix,H,U,y.transform,se),ge=v.layout.get("icon-text-fit")!=="none"&&G.hasIconData();if(le){const be=Math.pow(2,$.zoom-ne.tileID.overscaledZ);Aa(G,U,H,V,$,me,Y.posMatrix,be,le,ge,y.style.terrain?(de,Re)=>y.style.terrain.getElevation(Y,de,Re):null)}}}(s,l,n,t,n.layout.get("text-rotation-alignment"),n.layout.get("text-pitch-alignment"),u),n.paint.get("icon-opacity").constantOr(1)!==0&&Uo(l,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&&Uo(l,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&&(kn(l,t,n,s,n.paint.get("text-translate"),n.paint.get("text-translate-anchor"),!0),kn(l,t,n,s,n.paint.get("icon-translate"),n.paint.get("icon-translate-anchor"),!1))},circle:function(l,t,n,s){if(l.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=l.context,v=y.gl,S=l.depthModeForSublayer(0,mt.ReadOnly),M=Bt.disabled,z=l.colorModeForRenderPass(),V=[];for(let $=0;$<s.length;$++){const U=s[$],H=t.getTile(U),Y=H.getBucket(n);if(!Y)continue;const ne=Y.programConfigurations.get(n.id),G=l.useProgram("circle",ne),le=Y.layoutVertexBuffer,se=Y.indexBuffer,me=l.style.terrain&&l.style.terrain.getTerrainData(U),ge={programConfiguration:ne,program:G,layoutVertexBuffer:le,indexBuffer:se,uniformValues:ga(l,U,H,n),terrainData:me};if(_){const be=Y.segments.get();for(const de of be)V.push({segments:new a.SegmentVector([de]),sortKey:de.sortKey,state:ge})}else V.push({segments:Y.segments,sortKey:0,state:ge})}_&&V.sort(($,U)=>$.sortKey-U.sortKey);for(const $ of V){const{programConfiguration:U,program:H,layoutVertexBuffer:Y,indexBuffer:ne,uniformValues:G,terrainData:le}=$.state;H.draw(y,v.TRIANGLES,S,M,z,Nt.disabled,G,le,n.id,Y,ne,$.segments,n.paint,l.transform.zoom,U)}},heatmap:function(l,t,n,s){if(n.paint.get("heatmap-opacity")!==0)if(l.renderPass==="offscreen"){const u=l.context,p=u.gl,f=Bt.disabled,_=new Ft([p.ONE,p.ONE],a.Color.transparent,[!0,!0,!0,!0]);(function(y,v,S){const M=y.gl;y.activeTexture.set(M.TEXTURE1),y.viewport.set([0,0,v.width/4,v.height/4]);let z=S.heatmapFbo;if(z)M.bindTexture(M.TEXTURE_2D,z.colorAttachment.get()),y.bindFramebuffer.set(z.framebuffer);else{const V=M.createTexture();M.bindTexture(M.TEXTURE_2D,V),M.texParameteri(M.TEXTURE_2D,M.TEXTURE_WRAP_S,M.CLAMP_TO_EDGE),M.texParameteri(M.TEXTURE_2D,M.TEXTURE_WRAP_T,M.CLAMP_TO_EDGE),M.texParameteri(M.TEXTURE_2D,M.TEXTURE_MIN_FILTER,M.LINEAR),M.texParameteri(M.TEXTURE_2D,M.TEXTURE_MAG_FILTER,M.LINEAR),z=S.heatmapFbo=y.createFramebuffer(v.width/4,v.height/4,!1),function($,U,H,Y){const ne=$.gl;ne.texImage2D(ne.TEXTURE_2D,0,ne.RGBA,U.width/4,U.height/4,0,ne.RGBA,$.extRenderToTextureHalfFloat?$.extTextureHalfFloat.HALF_FLOAT_OES:ne.UNSIGNED_BYTE,null),Y.colorAttachment.set(H)}(y,v,V,z)}})(u,l,n),u.clear({color:a.Color.transparent});for(let y=0;y<s.length;y++){const v=s[y];if(t.hasRenderableParent(v))continue;const S=t.getTile(v),M=S.getBucket(n);if(!M)continue;const z=M.programConfigurations.get(n.id),V=l.useProgram("heatmap",z),{zoom:$}=l.transform;V.draw(u,p.TRIANGLES,mt.disabled,f,_,Nt.disabled,Po(v.posMatrix,S,$,n.paint.get("heatmap-intensity")),null,n.id,M.layoutVertexBuffer,M.indexBuffer,M.segments,n.paint,l.transform.zoom,z)}u.viewport.set([0,0,l.width,l.height])}else l.renderPass==="translucent"&&(l.context.setColorMode(l.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 Be(f,p.colorRamp,_.RGBA)),v.bind(_.LINEAR,_.CLAMP_TO_EDGE),u.useProgram("heatmapTexture").draw(f,_.TRIANGLES,mt.disabled,Bt.disabled,u.colorModeForRenderPass(),Nt.disabled,((S,M,z,V)=>{const $=a.create();a.ortho($,0,S.width,S.height,0,0,1);const U=S.context.gl;return{u_matrix:$,u_world:[U.drawingBufferWidth,U.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:M.paint.get("heatmap-opacity")}})(u,p),null,p.id,u.viewportBuffer,u.quadTriangleIndexBuffer,u.viewportSegments,p.paint,u.transform.zoom)}(l,n))},line:function(l,t,n,s){if(l.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=l.depthModeForSublayer(0,mt.ReadOnly),_=l.colorModeForRenderPass(),y=n.paint.get("line-dasharray"),v=n.paint.get("line-pattern"),S=v.constantOr(1),M=n.paint.get("line-gradient"),z=n.getCrossfadeParameters(),V=S?"linePattern":y?"lineSDF":M?"lineGradient":"line",$=l.context,U=$.gl;let H=!0;for(const Y of s){const ne=t.getTile(Y);if(S&&!ne.patternsLoaded())continue;const G=ne.getBucket(n);if(!G)continue;const le=G.programConfigurations.get(n.id),se=l.context.program.get(),me=l.useProgram(V,le),ge=H||me.program!==se,be=l.style.terrain&&l.style.terrain.getTerrainData(Y),de=v.constantOr(null);if(de&&ne.imageAtlas){const Fe=ne.imageAtlas,st=Fe.patternPositions[de.to.toString()],ut=Fe.patternPositions[de.from.toString()];st&&ut&&le.setConstantPatternPositions(st,ut)}const Re=be?Y:null,Ie=S?ko(l,ne,n,z,Re):y?Yn(l,ne,n,y,z,Re):M?hs(l,ne,n,G.lineClipsArray.length,Re):An(l,ne,n,Re);if(S)$.activeTexture.set(U.TEXTURE0),ne.imageAtlasTexture.bind(U.LINEAR,U.CLAMP_TO_EDGE),le.updatePaintBuffers(z);else if(y&&(ge||l.lineAtlas.dirty))$.activeTexture.set(U.TEXTURE0),l.lineAtlas.bind($);else if(M){const Fe=G.gradients[n.id];let st=Fe.texture;if(n.gradientVersion!==Fe.version){let ut=256;if(n.stepInterpolant){const We=t.getSource().maxzoom,At=Y.canonical.z===We?Math.ceil(1<<l.transform.maxZoom-Y.canonical.z):1;ut=a.clamp(a.nextPowerOfTwo(G.maxLineLength/a.EXTENT*1024*At),256,$.maxTextureSize)}Fe.gradient=a.renderColorRamp({expression:n.gradientExpression(),evaluationKey:"lineProgress",resolution:ut,image:Fe.gradient||void 0,clips:G.lineClipsArray}),Fe.texture?Fe.texture.update(Fe.gradient):Fe.texture=new Be($,Fe.gradient,U.RGBA),Fe.version=n.gradientVersion,st=Fe.texture}$.activeTexture.set(U.TEXTURE0),st.bind(n.stepInterpolant?U.NEAREST:U.LINEAR,U.CLAMP_TO_EDGE)}me.draw($,U.TRIANGLES,f,l.stencilModeForClipping(Y),_,Nt.disabled,Ie,be,n.id,G.layoutVertexBuffer,G.indexBuffer,G.segments,n.paint,l.transform.zoom,le,G.layoutVertexBuffer2),H=!1}},fill:function(l,t,n,s){const u=n.paint.get("fill-color"),p=n.paint.get("fill-opacity");if(p.constantOr(1)===0)return;const f=l.colorModeForRenderPass(),_=n.paint.get("fill-pattern"),y=l.opaquePassEnabledForLayer()&&!_.constantOr(1)&&u.constantOr(a.Color.transparent).a===1&&p.constantOr(0)===1?"opaque":"translucent";if(l.renderPass===y){const v=l.depthModeForSublayer(1,l.renderPass==="opaque"?mt.ReadWrite:mt.ReadOnly);no(l,t,n,s,v,f,!1)}if(l.renderPass==="translucent"&&n.paint.get("fill-antialias")){const v=l.depthModeForSublayer(n.getPaintProperty("fill-outline-color")?2:0,mt.ReadOnly);no(l,t,n,s,v,f,!0)}},"fill-extrusion":function(l,t,n,s){const u=n.paint.get("fill-extrusion-opacity");if(u!==0&&l.renderPass==="translucent"){const p=new mt(l.context.gl.LEQUAL,mt.ReadWrite,l.depthRangeFor3D);if(u!==1||n.paint.get("fill-extrusion-pattern").constantOr(1))oo(l,t,n,s,p,Bt.disabled,Ft.disabled),oo(l,t,n,s,p,l.stencilModeFor3D(),l.colorModeForRenderPass());else{const f=l.colorModeForRenderPass();oo(l,t,n,s,p,Bt.disabled,f)}}},hillshade:function(l,t,n,s){if(l.renderPass!=="offscreen"&&l.renderPass!=="translucent")return;const u=l.context,p=l.depthModeForSublayer(0,mt.ReadOnly),f=l.colorModeForRenderPass(),[_,y]=l.renderPass==="translucent"?l.stencilConfigForOverlap(s):[{},s];for(const v of y){const S=t.getTile(v);S.needsHillshadePrepare!==void 0&&S.needsHillshadePrepare&&l.renderPass==="offscreen"?Ma(l,S,n,p,Bt.disabled,f):l.renderPass==="translucent"&&Ss(l,v,S,n,p,_[v.overscaledZ],f)}u.viewport.set([0,0,l.width,l.height])},raster:function(l,t,n,s){if(l.renderPass!=="translucent"||n.paint.get("raster-opacity")===0||!s.length)return;const u=l.context,p=u.gl,f=t.getSource(),_=l.useProgram("raster"),y=l.colorModeForRenderPass(),[v,S]=f instanceof Ci?[{},s]:l.stencilConfigForOverlap(s),M=S[S.length-1].overscaledZ,z=!l.options.moving;for(const V of S){const $=l.depthModeForSublayer(V.overscaledZ-M,n.paint.get("raster-opacity")===1?mt.ReadWrite:mt.ReadOnly,p.LESS),U=t.getTile(V);U.registerFadeDuration(n.paint.get("raster-fade-duration"));const H=t.findLoadedParent(V,0),Y=Vo(U,H,t,n,l.transform,l.style.terrain);let ne,G;const le=n.paint.get("raster-resampling")==="nearest"?p.NEAREST:p.LINEAR;u.activeTexture.set(p.TEXTURE0),U.texture.bind(le,p.CLAMP_TO_EDGE,p.LINEAR_MIPMAP_NEAREST),u.activeTexture.set(p.TEXTURE1),H?(H.texture.bind(le,p.CLAMP_TO_EDGE,p.LINEAR_MIPMAP_NEAREST),ne=Math.pow(2,H.tileID.overscaledZ-U.tileID.overscaledZ),G=[U.tileID.canonical.x*ne%1,U.tileID.canonical.y*ne%1]):U.texture.bind(le,p.CLAMP_TO_EDGE,p.LINEAR_MIPMAP_NEAREST);const se=l.style.terrain&&l.style.terrain.getTerrainData(V),me=se?V:null,ge=me?me.posMatrix:l.transform.calculatePosMatrix(V.toUnwrapped(),z),be=_a(ge,G||[0,0],ne||1,Y,n);f instanceof Ci?_.draw(u,p.TRIANGLES,$,Bt.disabled,y,Nt.disabled,be,se,n.id,f.boundsBuffer,l.quadTriangleIndexBuffer,f.boundsSegments):_.draw(u,p.TRIANGLES,$,v[V.overscaledZ],y,Nt.disabled,be,se,n.id,l.rasterBoundsBuffer,l.quadTriangleIndexBuffer,l.rasterBoundsSegments)}},background:function(l,t,n,s){const u=n.paint.get("background-color"),p=n.paint.get("background-opacity");if(p===0)return;const f=l.context,_=f.gl,y=l.transform,v=y.tileSize,S=n.paint.get("background-pattern");if(l.isPatternMissing(S))return;const M=!S&&u.a===1&&p===1&&l.opaquePassEnabledForLayer()?"opaque":"translucent";if(l.renderPass!==M)return;const z=Bt.disabled,V=l.depthModeForSublayer(0,M==="opaque"?mt.ReadWrite:mt.ReadOnly),$=l.colorModeForRenderPass(),U=l.useProgram(S?"backgroundPattern":"background"),H=s||y.coveringTiles({tileSize:v,terrain:l.style.terrain});S&&(f.activeTexture.set(_.TEXTURE0),l.imageManager.bind(l.context));const Y=n.getCrossfadeParameters();for(const ne of H){const G=s?ne.posMatrix:l.transform.calculatePosMatrix(ne.toUnwrapped()),le=S?kl(G,p,l,S,{tileID:ne,tileSize:v},Y):zl(G,p,u),se=l.style.terrain&&l.style.terrain.getTerrainData(ne);U.draw(f,_.TRIANGLES,V,z,$,Nt.disabled,le,se,n.id,l.tileExtentBuffer,l.quadTriangleIndexBuffer,l.tileExtentSegments)}},debug:function(l,t,n){for(let s=0;s<n.length;s++)Gl(l,t,n[s])},custom:function(l,t,n){const s=l.context,u=n.implementation;if(l.renderPass==="offscreen"){const p=u.prerender;p&&(l.setCustomLayerDefaults(),s.setColorMode(l.colorModeForRenderPass()),p.call(u,s.gl,l.transform.customLayerMatrix()),s.setDirty(),l.setBaseState())}else if(l.renderPass==="translucent"){l.setCustomLayerDefaults(),s.setColorMode(l.colorModeForRenderPass()),s.setStencilMode(Bt.disabled);const p=u.renderingMode==="3d"?new mt(l.context.gl.LEQUAL,mt.ReadWrite,l.depthRangeFor3D):l.depthModeForSublayer(0,mt.ReadOnly);s.setDepthMode(p),u.render(s.gl,l.transform.customLayerMatrix()),s.setDirty(),l.setBaseState(),s.bindFramebuffer.set(null)}}};class Cs{constructor(t,n){this.context=new Ca(t),this.transform=n,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:a.create(),renderTime:0},this.setup(),this.numSublayers=Mi.maxUnderzooming+Mi.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new et,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 a.PosArray;n.emplaceBack(0,0),n.emplaceBack(a.EXTENT,0),n.emplaceBack(0,a.EXTENT),n.emplaceBack(a.EXTENT,a.EXTENT),this.tileExtentBuffer=t.createVertexBuffer(n,bt.members),this.tileExtentSegments=a.SegmentVector.simpleSegment(0,0,4,2);const s=new a.PosArray;s.emplaceBack(0,0),s.emplaceBack(a.EXTENT,0),s.emplaceBack(0,a.EXTENT),s.emplaceBack(a.EXTENT,a.EXTENT),this.debugBuffer=t.createVertexBuffer(s,bt.members),this.debugSegments=a.SegmentVector.simpleSegment(0,0,4,5);const u=new a.RasterBoundsArray;u.emplaceBack(0,0,0,0),u.emplaceBack(a.EXTENT,0,a.EXTENT,0),u.emplaceBack(0,a.EXTENT,0,a.EXTENT),u.emplaceBack(a.EXTENT,a.EXTENT,a.EXTENT,a.EXTENT),this.rasterBoundsBuffer=t.createVertexBuffer(u,wi.members),this.rasterBoundsSegments=a.SegmentVector.simpleSegment(0,0,4,2);const p=new a.PosArray;p.emplaceBack(0,0),p.emplaceBack(1,0),p.emplaceBack(0,1),p.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(p,bt.members),this.viewportSegments=a.SegmentVector.simpleSegment(0,0,4,2);const f=new a.LineStripIndexArray;f.emplaceBack(0),f.emplaceBack(1),f.emplaceBack(3),f.emplaceBack(2),f.emplaceBack(0),this.tileBorderIndexBuffer=t.createIndexBuffer(f);const _=new a.TriangleIndexArray;_.emplaceBack(0,1,2),_.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(_),this.emptyTexture=new Be(t,{width:1,height:1,data:new Uint8Array([0,0,0,0])},t.gl.RGBA);const y=this.context.gl;this.stencilClearMode=new Bt({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=a.create();a.ortho(s,0,this.width,this.height,0,0,1),a.scale(s,s,[n.drawingBufferWidth,n.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(t,n.TRIANGLES,mt.disabled,this.stencilClearMode,Ft.disabled,Nt.disabled,Cn(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(Ft.disabled),s.setDepthMode(mt.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,mt.disabled,new Bt({func:u.ALWAYS,mask:0},_,255,u.KEEP,u.KEEP,u.REPLACE),Ft.disabled,Nt.disabled,Cn(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 Bt({func:n.NOTEQUAL,mask:255},t,255,n.KEEP,n.KEEP,n.REPLACE)}stencilModeForClipping(t){const n=this.context.gl;return new Bt({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 Bt({func:n.GEQUAL,mask:255},_+this.nextStencilID,255,n.KEEP,n.KEEP,n.REPLACE);return this.nextStencilID+=p,[f,s]}return[{[u]:Bt.disabled},s]}colorModeForRenderPass(){const t=this.context.gl;return this._showOverdrawInspector?new Ft([t.CONSTANT_COLOR,t.ONE],new a.Color(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?Ft.unblended:Ft.alphaBlended}depthModeForSublayer(t,n,s){if(!this.opaquePassEnabledForLayer())return mt.disabled;const u=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new mt(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(a.exported.now()),this.imageManager.beginFrame();const s=this.style._order,u=this.style.sourceCaches,p=this.style.terrain&&new Da(this);for(const v in u){const S=u[v];S.used&&S.prepare(this.context)}const f={},_={},y={};for(const v in u){const S=u[v];f[v]=S.getVisibleCoordinates(),_[v]=f[v].slice().reverse(),y[v]=S.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||!a.equals(this.terrainFacilitator.matrix,this.transform.projMatrix)||v.length)&&(a.copy(this.terrainFacilitator.matrix,this.transform.projMatrix),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(S,M){const z=S.context,V=z.gl,$=Ft.unblended,U=new mt(V.LEQUAL,mt.ReadWrite,[0,1]),H=M.getTerrainMesh(),Y=M.sourceCache.getRenderableTiles(),ne=S.useProgram("terrainDepth");z.bindFramebuffer.set(M.getFramebuffer("depth").framebuffer),z.viewport.set([0,0,S.width/devicePixelRatio,S.height/devicePixelRatio]),z.clear({color:a.Color.transparent,depth:1});for(const G of Y){const le=M.getTerrainData(G.tileID),se=S.transform.calculatePosMatrix(G.tileID.toUnwrapped());ne.draw(z,V.TRIANGLES,U,Bt.disabled,$,Nt.backCCW,{u_matrix:se},le,"terrain",H.vertexBuffer,H.indexBuffer,H.segments)}z.bindFramebuffer.set(null),z.viewport.set([0,0,S.width,S.height])}(this,this.style.terrain),function(S,M){const z=S.context,V=z.gl,$=Ft.unblended,U=new mt(V.LEQUAL,mt.ReadWrite,[0,1]),H=M.getTerrainMesh(),Y=M.getCoordsTexture(),ne=M.sourceCache.getRenderableTiles(),G=S.useProgram("terrainCoords");z.bindFramebuffer.set(M.getFramebuffer("coords").framebuffer),z.viewport.set([0,0,S.width/devicePixelRatio,S.height/devicePixelRatio]),z.clear({color:a.Color.transparent,depth:1}),M.coordsIndex=[];for(const le of ne){const se=M.getTerrainData(le.tileID);z.activeTexture.set(V.TEXTURE0),V.bindTexture(V.TEXTURE_2D,Y.texture);const me=S.transform.calculatePosMatrix(le.tileID.toUnwrapped());G.draw(z,V.TRIANGLES,U,Bt.disabled,$,Nt.backCCW,{u_matrix:me,u_terrain_coords_id:(255-M.coordsIndex.length)/255,u_texture:0},se,"terrain",H.vertexBuffer,H.indexBuffer,H.segments),M.coordsIndex.push(le.tileID.key)}z.bindFramebuffer.set(null),z.viewport.set([0,0,S.width,S.height])}(this,this.style.terrain))}this.renderPass="offscreen";for(const v of s){const S=this.style._layers[v];if(!S.hasOffscreenPass()||S.isHidden(this.transform.zoom))continue;const M=_[S.source];(S.type==="custom"||M.length)&&this.renderLayer(this,u[S.source],S,M)}if(this.context.bindFramebuffer.set(null),this.context.clear({color:n.showOverdrawInspector?a.Color.black:a.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]],S=u[v.source],M=f[v.source];this._renderTileClippingMasks(v,M),this.renderLayer(this,S,v,M)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<s.length;this.currentLayer++){const v=this.style._layers[s[this.currentLayer]],S=u[v.source];if(p&&p.renderLayer(v))continue;const M=(v.type==="symbol"?y:_)[v.source];this._renderTileClippingMasks(v,f[v.source]),this.renderLayer(this,S,v,M)}if(this.options.showTileBoundaries){let v,S;Object.values(this.style._layers).forEach(M=>{M.source&&!M.isHidden(this.transform.zoom)&&(M.source!==(S&&S.id)&&(S=this.style.sourceCaches[M.source]),(!v||v.getSource().maxzoom<S.getSource().maxzoom)&&(v=S))}),v&&ao.debug(this,v,v.getVisibleCoordinates())}this.options.showPadding&&function(v){const S=v.transform.padding;nn(v,v.transform.height-(S.top||0),3,No),nn(v,S.bottom||0,3,rr),so(v,S.left||0,3,Pa),so(v,v.transform.width-(S.right||0),3,Is);const M=v.transform.centerPoint;(function(z,V,$,U){Dn(z,V-1,$-10,2,20,U),Dn(z,V-10,$-1,20,2,U)})(v,M.x,v.transform.height-M.y,za)}(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),ao[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),S=Math.cos(f);s=[s[0]*S-s[1]*v,s[0]*v+s[1]*S]}const _=[p?s[0]:Yt(n,s[0],this.transform.zoom),p?s[1]:Yt(n,s[1],this.transform.zoom),0],y=new Float32Array(16);return a.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 pa(this.context,t,Kn[t],n,ds[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 Be(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}}class qo{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/(_=a.transformMat4([],_,t))[3]/n*u;return a.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=a.sub([],p[_[0]],p[_[1]]),v=a.sub([],p[_[2]],p[_[1]]),S=a.normalize([],a.cross([],y,v)),M=-a.dot(S,p[_[1]]);return S.concat(M)});return new qo(p,f)}}class lo{constructor(t,n){this.min=t,this.max=n,this.center=a.scale$1([],a.add([],this.min,this.max),.5)}quadrant(t){const n=[t%2==0,t<2],s=a.clone$2(this.min),u=a.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 lo(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;_++)a.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 Ln{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=a.number(t.top,n.top,s)),n.bottom!=null&&t.bottom!=null&&(this.bottom=a.number(t.bottom,n.bottom,s)),n.left!=null&&t.left!=null&&(this.left=a.number(t.left,n.left,s)),n.right!=null&&t.right!=null&&(this.right=a.number(t.right,n.right,s)),this}getCenter(t,n){const s=a.clamp((this.left+t-this.right)/2,0,t),u=a.clamp((this.top+n-this.bottom)/2,0,n);return new a.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 Ln(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}class co{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 a.LngLat(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new Ln,this._posMatrixCache={},this._alignedPosMatrixCache={}}clone(){const t=new co(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 a.pointGeometry(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(t){const n=-a.wrap(t,-180,180)*Math.PI/180;var s;this.angle!==n&&(this._unmodified=!1,this.angle=n,this._calcMatrices(),this.rotationMatrix=(s=new a.ARRAY_TYPE(4),a.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],S=p[3],M=Math.sin(f),z=Math.cos(f);u[0]=_*z+v*M,u[1]=y*z+S*M,u[2]=_*-M+v*z,u[3]=y*-M+S*z}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(t){const n=a.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 a.UnwrappedTileID(0,t)];if(this._renderWorldCopies){const s=this.pointCoordinate(new a.pointGeometry(0,0)),u=this.pointCoordinate(new a.pointGeometry(this.width,0)),p=this.pointCoordinate(new a.pointGeometry(this.width,this.height)),f=this.pointCoordinate(new a.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 S=_-v;S<=y+v;S++)S!==0&&n.push(new a.UnwrappedTileID(S,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()),_=a.MercatorCoordinate.fromLngLat(this.center),y=Math.pow(2,u),v=[y*f.x,y*f.y,0],S=[y*_.x,y*_.y,0],M=qo.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,u);let z=t.minzoom||0;!t.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(z=u);const V=t.terrain?2/Math.min(this.tileSize,t.tileSize)*this.tileSize:3,$=G=>({aabb:new lo([G*y,0,0],[(G+1)*y,y,0]),zoom:0,x:0,y:0,wrap:G,fullyVisible:!1}),U=[],H=[],Y=u,ne=t.reparseOverscaled?p:u;if(this._renderWorldCopies)for(let G=1;G<=3;G++)U.push($(-G)),U.push($(G));for(U.push($(0));U.length>0;){const G=U.pop(),le=G.x,se=G.y;let me=G.fullyVisible;if(!me){const Fe=G.aabb.intersects(M);if(Fe===0)continue;me=Fe===2}const ge=t.terrain?v:S,be=G.aabb.distanceX(ge),de=G.aabb.distanceY(ge),Re=Math.max(Math.abs(be),Math.abs(de)),Ie=V+(1<<Y-G.zoom)-2;if(G.zoom===Y||Re>Ie&&G.zoom>=z){const Fe=Y-G.zoom,st=v[0]-.5-(le<<Fe),ut=v[1]-.5-(se<<Fe);H.push({tileID:new a.OverscaledTileID(G.zoom===Y?ne:G.zoom,G.wrap,G.zoom,le,se),distanceSq:a.sqrLen([S[0]-.5-le,S[1]-.5-se]),tileDistanceToCamera:Math.sqrt(st*st+ut*ut)})}else for(let Fe=0;Fe<4;Fe++){const st=(le<<1)+Fe%2,ut=(se<<1)+(Fe>>1),We=G.zoom+1;let At=G.aabb.quadrant(Fe);if(t.terrain){const Mt=new a.OverscaledTileID(We,G.wrap,We,st,ut),_t=t.terrain.getMinMaxElevation(Mt),Tt=(n=_t.minElevation)!==null&&n!==void 0?n:this.elevation,zt=(s=_t.maxElevation)!==null&&s!==void 0?s:this.elevation;At=new lo([At.min[0],At.min[1],Tt],[At.max[0],At.max[1],zt])}U.push({aabb:At,zoom:We,x:st,y:ut,wrap:G.wrap,fullyVisible:me})}}return H.sort((G,le)=>G.distanceSq-le.distanceSq).map(G=>G.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=a.clamp(t.lat,-this.maxValidLatitude,this.maxValidLatitude);return new a.pointGeometry(a.mercatorXfromLng(t.lng)*this.worldSize,a.mercatorYfromLat(n)*this.worldSize)}unproject(t){return new a.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=a.MercatorCoordinate.fromLngLat(t),u=(1<<this.tileZoom)*a.EXTENT,p=s.x*u,f=s.y*u,_=Math.floor(p/a.EXTENT),y=Math.floor(f/a.EXTENT),v=new a.OverscaledTileID(this.tileZoom,0,this.tileZoom,_,y);return n.getElevation(v,p%a.EXTENT,f%a.EXTENT,a.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=a.MercatorCoordinate.fromLngLat(u.lngLat,u.altitude),f=a.MercatorCoordinate.fromLngLat(n,s),_=p.x-f.x,y=p.y-f.y,v=p.z-f.z,S=Math.sqrt(_*_+y*y+v*v),M=this.scaleZoom(this.cameraToCenterDistance/S/this.tileSize);this._elevation=s,this._center=n,this.zoom=M}setLocationAtPoint(t,n){const s=this.pointCoordinate(n),u=this.pointCoordinate(this.centerPoint),p=this.locationCoordinate(t),f=new a.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 a.MercatorCoordinate.fromLngLat(t)}coordinateLocation(t){return t&&t.toLngLat()}pointCoordinate(t,n){if(n){const z=n.pointCoordinate(t);if(z!=null)return z}const s=[t.x,t.y,0,1],u=[t.x,t.y,1,1];a.transformMat4(s,s,this.pixelMatrixInverse),a.transformMat4(u,u,this.pixelMatrixInverse);const p=s[3],f=u[3],_=s[1]/p,y=u[1]/f,v=s[2]/p,S=u[2]/f,M=v===S?0:(0-v)/(S-v);return new a.MercatorCoordinate(a.number(s[0]/p,u[0]/f,M)/this.worldSize,a.number(_,y,M)/this.worldSize)}coordinatePoint(t,n=0,s=this.pixelMatrix){const u=[t.x*this.worldSize,t.y*this.worldSize,n,1];return a.transformMat4(u,u,s),new a.pointGeometry(u[0]/u[3],u[1]/u[3])}getBounds(){const t=Math.max(0,this.height/2-this.getHorizon());return new a.LngLatBounds().extend(this.pointLocation(new a.pointGeometry(0,t))).extend(this.pointLocation(new a.pointGeometry(this.width,t))).extend(this.pointLocation(new a.pointGeometry(this.width,this.height))).extend(this.pointLocation(new a.pointGeometry(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new a.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=a.identity(new Float64Array(16));return a.translate(y,y,[_*f,p.y*f,0]),a.scale(y,y,[f/a.EXTENT,f/a.EXTENT,1]),a.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,S=this._unmodified;if(this.latRange){const V=this.latRange;p=a.mercatorYfromLat(V[1])*this.worldSize,f=a.mercatorYfromLat(V[0])*this.worldSize,t=f-p<v.y?v.y/(f-p):0}if(this.lngRange){const V=this.lngRange;_=a.wrap(a.mercatorXfromLng(V[0])*this.worldSize,0,this.worldSize),y=a.wrap(a.mercatorXfromLng(V[1])*this.worldSize,0,this.worldSize),y<_&&(y+=this.worldSize),n=y-_<v.x?v.x/(y-_):0}const M=this.point,z=Math.max(n||0,t||0);if(z)return this.center=this.unproject(new a.pointGeometry(n?(y+_)/2:M.x,t?(f+p)/2:M.y)),this.zoom+=this.scaleZoom(z),this._unmodified=S,void(this._constraining=!1);if(this.latRange){const V=M.y,$=v.y/2;V-$<p&&(u=p+$),V+$>f&&(u=f-$)}if(this.lngRange){const V=(_+y)/2,$=a.wrap(M.x,V-this.worldSize/2,V+this.worldSize/2),U=v.x/2;$-U<_&&(s=_+U),$+U>y&&(s=y-U)}s===void 0&&u===void 0||(this.center=this.unproject(new a.pointGeometry(s!==void 0?s:M.x,u!==void 0?u:M.y)).wrap()),this._unmodified=S,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=a.mercatorZfromAltitude(1,this.center.lat)*this.worldSize;let u=a.identity(new Float64Array(16));a.scale(u,u,[this.width/2,-this.height/2,1]),a.translate(u,u,[1,-1,0]),this.labelPlaneMatrix=u,u=a.identity(new Float64Array(16)),a.scale(u,u,[1,-1,1]),a.translate(u,u,[-1,-1,0]),a.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(a.clamp(Math.PI-p-f,.01,Math.PI-.01)),y=this.getHorizon(),v=2*Math.atan(y/this.cameraToCenterDistance)*(.5+t.y/(2*y)),S=Math.sin(v)*this.cameraToSeaLevelDistance/Math.sin(a.clamp(Math.PI-p-v,.01,Math.PI-.01)),M=Math.cos(Math.PI/2-this._pitch)*_+this.cameraToSeaLevelDistance,z=Math.cos(Math.PI/2-this._pitch)*S+this.cameraToSeaLevelDistance,V=1.01*Math.min(M,z),$=this.height/50;u=new Float64Array(16),a.perspective(u,this._fov,this.width/this.height,$,V),u[8]=2*-t.x/this.width,u[9]=2*t.y/this.height,a.scale(u,u,[1,-1,1]),a.translate(u,u,[0,0,-this.cameraToCenterDistance]),a.rotateX(u,u,this._pitch),a.rotateZ(u,u,this.angle),a.translate(u,u,[-n,-s,0]),this.mercatorMatrix=a.scale([],u,[this.worldSize,this.worldSize,this.worldSize]),a.scale(u,u,[1,1,this._pixelPerMeter]),this.pixelMatrix=a.multiply(new Float64Array(16),this.labelPlaneMatrix,u),a.translate(u,u,[0,0,-this.elevation]),this.projMatrix=u,this.invProjMatrix=a.invert([],u),this.pixelMatrix3D=a.multiply(new Float64Array(16),this.labelPlaneMatrix,u);const U=this.width%2/2,H=this.height%2/2,Y=Math.cos(this.angle),ne=Math.sin(this.angle),G=n-Math.round(n)+Y*U+ne*H,le=s-Math.round(s)+Y*H+ne*U,se=new Float64Array(u);if(a.translate(se,se,[G>.5?G-1:G,le>.5?le-1:le,0]),this.alignedProjMatrix=se,u=a.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 a.pointGeometry(0,0)),n=[t.x*this.worldSize,t.y*this.worldSize,0,1];return a.transformMat4(n,n,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const t=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new a.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 a.pointGeometry(s,u),new a.pointGeometry(p,u),new a.pointGeometry(p,f),new a.pointGeometry(s,f),new a.pointGeometry(s,u)]}}}class La{constructor(t){this._hashName=t&&encodeURIComponent(t),a.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 S="";if(S+=t?`/${f}/${_}/${s}`:`${s}/${_}/${f}`,(y||v)&&(S+="/"+Math.round(10*y)/10),v&&(S+=`/${Math.round(v)}`),this._hashName){const M=this._hashName;let z=!1;const V=window.location.hash.slice(1).split("&").map($=>{const U=$.split("=")[0];return U===M?(z=!0,`${U}=${S}`):$}).filter($=>$);return z||V.push(`${M}=${S}`),`#${V.join("&")}`}return`#${S}`}_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{}}}const uo={linearity:.3,easing:a.bezier(0,0,.3,1)},Ra=a.extend({deceleration:2500,maxSpeed:1400},uo),Ba=a.extend({deceleration:20,maxSpeed:1400},uo),Fa=a.extend({deceleration:1e3,maxSpeed:360},uo),Rn=a.extend({deceleration:1e3,maxSpeed:90},uo);class Oa{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:a.exported.now(),settings:t})}_drainInertiaBuffer(){const t=this._inertiaBuffer,n=a.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 a.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=po(n.pan.mag(),s,a.extend({},Ra,t||{}));u.offset=n.pan.mult(p.amount/n.pan.mag()),u.center=this._map.transform.center,ho(u,p)}if(n.zoom){const p=po(n.zoom,s,Ba);u.zoom=this._map.transform.zoom+p.amount,ho(u,p)}if(n.bearing){const p=po(n.bearing,s,Fa);u.bearing=this._map.transform.bearing+a.clamp(p.amount,-179,179),ho(u,p)}if(n.pitch){const p=po(n.pitch,s,Rn);u.pitch=this._map.transform.pitch+p.amount,ho(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(),a.extend(u,{noMoveStart:!0})}}function ho(l,t){(!l.duration||l.duration<t.duration)&&(l.duration=t.duration,l.easing=t.easing)}function po(l,t,n){const{maxSpeed:s,linearity:u,deceleration:p}=n,f=a.clamp(l*u/(t/1e3),-s,s),_=Math.abs(f)/(p*u);return{easing:n.easing,duration:1e3*_,amount:f*(_/2)}}class Ui extends a.Event{constructor(t,n,s,u={}){const p=ie.mousePos(n.getCanvasContainer(),s),f=n.unproject(p);super(t,a.extend({point:p,lngLat:f,originalEvent:s},u)),this._defaultPrevented=!1,this.target=n}preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}}class fo extends a.Event{constructor(t,n,s){const u=t==="touchend"?s.changedTouches:s.touches,p=ie.touchPos(n.getCanvasContainer(),u),f=p.map(y=>n.unproject(y)),_=p.reduce((y,v,S,M)=>y.add(v.div(M.length)),new a.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 Vi extends a.Event{constructor(t,n,s){super(t,{originalEvent:s}),this._defaultPrevented=!1}preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}}class ql{constructor(t,n){this._map=t,this._clickTolerance=n.clickTolerance}reset(){delete this._mousedownPos}wheel(t){return this._firePreventable(new Vi(t.type,this._map,t))}mousedown(t,n){return this._mousedownPos=n,this._firePreventable(new Ui(t.type,this._map,t))}mouseup(t){this._map.fire(new Ui(t.type,this._map,t))}click(t,n){this._mousedownPos&&this._mousedownPos.dist(n)>=this._clickTolerance||this._map.fire(new Ui(t.type,this._map,t))}dblclick(t){return this._firePreventable(new Ui(t.type,this._map,t))}mouseover(t){this._map.fire(new Ui(t.type,this._map,t))}mouseout(t){this._map.fire(new Ui(t.type,this._map,t))}touchstart(t){return this._firePreventable(new fo(t.type,this._map,t))}touchmove(t){this._map.fire(new fo(t.type,this._map,t))}touchend(t){this._map.fire(new fo(t.type,this._map,t))}touchcancel(t){this._map.fire(new fo(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Vr{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(t){this._map.fire(new Ui(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Ui("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._ignoreContextMenu||this._map.fire(new Ui(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class $a{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&&(ie.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=ie.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);ie.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(),ie.suppressClick(),s.x!==u.x||s.y!==u.y)return this._map.fire(new a.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&&(ie.remove(this._box),this._box=null),ie.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(t,n){return this._map.fire(new a.Event(t,{originalEvent:n}))}}function Ir(l,t){if(l.length!==t.length)throw new Error(`The number of touches and points are not equal - touches ${l.length}, points ${t.length}`);const n={};for(let s=0;s<l.length;s++)n[l[s].identifier]=t[s];return n}class mo{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 a.pointGeometry(0,0);for(const f of u)p._add(f);return p.div(u.length)}(n),this.touches=Ir(s,n)))}touchmove(t,n,s){if(this.aborted||!this.centroid)return;const u=Ir(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 As{constructor(t){this.singleTap=new mo(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 Zl{constructor(){this._zoomIn=new As({numTouches:1,numTaps:2}),this._zoomOut=new As({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 jl={0:1,2:2};class Zo{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=ie.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=jl[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&&ie.mouseButton(t)===this._eventButton&&(this._moved&&ie.suppressClick(),this.reset())}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class go extends Zo{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 Cr extends Zo{_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 $e extends Zo{_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 Ua{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 a.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=Ir(s,n),p=new a.pointGeometry(0,0),f=new a.pointGeometry(0,0);let _=0;for(const v in u){const S=u[v],M=this._touches[v];M&&(p._add(S),f._add(S.sub(M)),_++,u[v]=S)}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 on{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=Nr(s,n,u),_=Nr(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=Nr(s,n,u),_=Nr(s,n,p);f&&_||(this._active&&ie.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 Nr(l,t,n){for(let s=0;s<l.length;s++)if(l[s].identifier===n)return t[s]}function Ms(l,t){return Math.log(l/t)/Math.LN2}class ze extends on{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(Ms(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:Ms(this._distance,s),pinchAround:n}}}function jo(l,t){return 180*l.angleWith(t)/Math.PI}class Xl extends on{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:jo(this._vector,s),pinchAround:n}}_isBelowThreshold(t){this._minDiameter=Math.min(this._minDiameter,t.mag());const n=25/(Math.PI*this._minDiameter)*360,s=jo(t,this._startVector);return Math.abs(s)<n}}function Ps(l){return Math.abs(l.y)>Math.abs(l.x)}class zs extends on{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,Ps(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 Ps(t)&&Ps(n)&&f}}const Va={panStep:100,bearingStep:15,pitchStep:10};class Na{constructor(){const t=Va;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:Wl,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 Wl(l){return l*(2-l)}const Ga=4.000244140625;class ks{constructor(t,n){this._map=t,this._el=t.getCanvasContainer(),this._handler=n,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222,a.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=a.exported.now(),u=s-(this._lastWheelEventTime||0);this._lastWheelEventTime=s,n!==0&&n%Ga==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=ie.mousePos(this._el,t);this._around=a.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)>Ga?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((a.exported.now()-this._lastWheelEventTime)/200,1),y=u(_);p=a.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=a.ease;if(this._prevEase){const s=this._prevEase,u=(a.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=a.bezier(f,_,.25,1)}return this._prevEase={start:a.exported.now(),duration:t,easing:n},n}reset(){this._active=!1}}class Ds{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 Ls{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 Rs{constructor(){this._tap=new As({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 Pi{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 Gr{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 qa{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 Bn=l=>l.zoom||l.drag||l.pitch||l.rotate;class Bs extends a.Event{}function _o(l){return l.panDelta&&l.panDelta.mag()||l.zoomDelta||l.bearingDelta||l.pitchDelta}class Za{constructor(t,n){this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Oa(t),this._bearingSnap=n.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(n),a.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)ie.addEventListener(u,p,u===document?this.handleWindowEvent:this.handleEvent,f)}destroy(){for(const[t,n,s]of this._listeners)ie.removeEventListener(t,n,t===document?this.handleWindowEvent:this.handleEvent,s)}_addDefaultHandlers(t){const n=this._map,s=n.getCanvasContainer();this._add("mapEvent",new ql(n,t));const u=n.boxZoom=new $a(n,t);this._add("boxZoom",u);const p=new Zl,f=new Ls;n.doubleClickZoom=new Ds(f,p),this._add("tapZoom",p),this._add("clickZoom",f);const _=new Rs;this._add("tapDragZoom",_);const y=n.touchPitch=new zs(n);this._add("touchPitch",y);const v=new Cr(t),S=new $e(t);n.dragRotate=new Gr(t,v,S),this._add("mouseRotate",v,["mousePitch"]),this._add("mousePitch",S,["mouseRotate"]);const M=new go(t),z=new Ua(t,n);n.dragPan=new Pi(s,M,z),this._add("mousePan",M),this._add("touchPan",z,["touchZoom","touchRotate"]);const V=new Xl,$=new ze;n.touchZoomRotate=new qa(s,$,V,_),this._add("touchRotate",V,["touchPan","touchZoom"]),this._add("touchZoom",$,["touchPan","touchRotate"]);const U=n.scrollZoom=new ks(n,this);this._add("scrollZoom",U,["mousePan"]);const H=n.keyboard=new Na;this._add("keyboard",H),this._add("blockableMapEvent",new Vr(n));for(const Y of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])t.interactive&&t[Y]&&n[Y].enable(t[Y])}_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(Bn(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?ie.touchPos(this._el,y):ie.mousePos(this._el,t);for(const{handlerName:z,handler:V,allowed:$}of this._handlers){if(!V.isEnabled())continue;let U;this._blockedByActive(f,$,z)?V.reset():V[n||t.type]&&(U=V[n||t.type](t,v,y),this.mergeHandlerResult(u,p,U,z,s),U&&U.needsRenderFrame&&this._triggerRenderFrame()),(U||V.isActive())&&(f[z]=V)}const S={};for(const z in this._previousActiveHandlers)f[z]||(S[z]=s);this._previousActiveHandlers=f,(Object.keys(S).length||_o(u))&&(this._changes.push([u,p,S]),this._triggerRenderFrame()),(Object.keys(f).length||_o(u))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:M}=u;M&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],M(this._map))}mergeHandlerResult(t,n,s,u,p){if(!s)return;a.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 a.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),a.extend(n,p),a.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(!(_o(t)||f&&this._drag))return this._fireEvents(n,s,!0);let{panDelta:_,zoomDelta:y,bearingDelta:v,pitchDelta:S,around:M,pinchAround:z}=t;z!==void 0&&(M=z),u._stop(!0),M=M||u.transform.centerPoint;const V=p.pointLocation(_?M.sub(_):M);v&&(p.bearing+=v),S&&(p.pitch+=S),y&&(p.zoom+=y),f?n.drag&&!this._drag?(this._drag={center:p.centerPoint,lngLat:p.pointLocation(M),point:M,handlerName:n.drag.handlerName},u.fire(new a.Event("freezeElevation",{freeze:!0}))):this._drag&&s[this._drag.handlerName]?(u.fire(new a.Event("freezeElevation",{freeze:!1})),this._drag=null):n.drag&&this._drag&&(p.center=p.pointLocation(p.centerPoint.sub(_))):p.setLocationAtPoint(V,M),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(n,s,!0)}_fireEvents(t,n,s){const u=Bn(this._eventsInProgress),p=Bn(t),f={};for(const S in t){const{originalEvent:M}=t[S];this._eventsInProgress[S]||(f[`${S}start`]=M),this._eventsInProgress[S]=t[S]}!u&&p&&this._fireEvent("movestart",p.originalEvent);for(const S in f)this._fireEvent(S,f[S]);p&&this._fireEvent("move",p.originalEvent);for(const S in t){const{originalEvent:M}=t[S];this._fireEvent(S,M)}const _={};let y;for(const S in this._eventsInProgress){const{handlerName:M,originalEvent:z}=this._eventsInProgress[S];this._handlersById[M].isActive()||(delete this._eventsInProgress[S],y=n[M]||z,_[`${S}end`]=y)}for(const S in _)this._fireEvent(S,_[S]);const v=Bn(this._eventsInProgress);if(s&&(u||p)&&!v){this._updatingCamera=!0;const S=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),M=z=>z!==0&&-this._bearingSnap<z&&z<this._bearingSnap;S?(M(S.bearing||this._map.getBearing())&&(S.bearing=0),this._map.easeTo(S,{originalEvent:y})):(this._map.fire(new a.Event("moveend",{originalEvent:y})),M(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(t,n){this._map.fire(new a.Event(t,n?{originalEvent:n}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(t=>{delete this._frameId,this.handleEvent(new Bs("renderFrame",{timeStamp:t})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}const Ji={extend:(l,...t)=>a.extend(l,...t),run(l){l()},logToElement(l,t=!1,n="log"){const s=window.document.getElementById(n);s&&(t&&(s.innerHTML=""),s.innerHTML+=`<br>${l}`)}};class Gt extends a.Evented{constructor(t,n){super(),this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=n.bearingSnap,a.bindAll(["_renderFrameCallback"],this)}getCenter(){return new a.LngLat(this.transform.center.lng,this.transform.center.lat)}setCenter(t,n){return this.jumpTo({center:t},n)}panBy(t,n,s){return t=a.pointGeometry.convert(t).mult(-1),this.panTo(this.transform.center,a.extend({offset:t},n),s)}panTo(t,n,s){return this.easeTo(a.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(a.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(a.extend({bearing:t},n),s)}resetNorth(t,n){return this.rotateTo(0,a.extend({duration:1e3},t),n),this}resetNorthPitch(t,n){return this.easeTo(a.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=a.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=a.extend({padding:p,offset:[0,0],maxZoom:this.transform.maxZoom},u)).padding=="number"){const se=u.padding;u.padding={top:se,bottom:se,right:se,left:se}}u.padding=a.extend(p,u.padding);const f=this.transform,_=f.padding,y=f.project(a.LngLat.convert(t)),v=f.project(a.LngLat.convert(n)),S=y.rotate(-s*Math.PI/180),M=v.rotate(-s*Math.PI/180),z=new a.pointGeometry(Math.max(S.x,M.x),Math.max(S.y,M.y)),V=new a.pointGeometry(Math.min(S.x,M.x),Math.min(S.y,M.y)),$=z.sub(V),U=(f.width-(_.left+_.right+u.padding.left+u.padding.right))/$.x,H=(f.height-(_.top+_.bottom+u.padding.top+u.padding.bottom))/$.y;if(H<0||U<0)return void a.warnOnce("Map cannot fit within canvas with the given bounds, padding, and/or offset.");const Y=Math.min(f.scaleZoom(f.scale*Math.min(U,H)),u.maxZoom),ne=a.pointGeometry.convert(u.offset),G=new a.pointGeometry((u.padding.left-u.padding.right)/2,(u.padding.top-u.padding.bottom)/2).rotate(s*Math.PI/180),le=ne.add(G).mult(f.scale/f.zoomScale(Y));return{center:f.unproject(y.add(v).div(2).sub(le)),zoom:Y,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(a.pointGeometry.convert(t)),this.transform.pointLocation(a.pointGeometry.convert(n)),s,u),u,p)}_fitInternal(t,n,s){return t?(delete(n=a.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=a.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 a.Event("movestart",n)).fire(new a.Event("move",n)),u&&this.fire(new a.Event("zoomstart",n)).fire(new a.Event("zoom",n)).fire(new a.Event("zoomend",n)),p&&this.fire(new a.Event("rotatestart",n)).fire(new a.Event("rotate",n)).fire(new a.Event("rotateend",n)),f&&this.fire(new a.Event("pitchstart",n)).fire(new a.Event("pitch",n)).fire(new a.Event("pitchend",n)),this.fire(new a.Event("moveend",n))}calculateCameraOptionsFromTo(t,n,s,u=0){const p=a.MercatorCoordinate.fromLngLat(t,n),f=a.MercatorCoordinate.fromLngLat(s,u),_=f.x-p.x,y=f.y-p.y,v=f.z-p.z,S=Math.hypot(_,y,v);if(S===0)throw new Error("Can't calculate camera options with same From and To");const M=Math.hypot(_,y),z=this.transform.scaleZoom(this.transform.cameraToCenterDistance/S/this.transform.tileSize),V=180*Math.atan2(_,-y)/Math.PI;let $=180*Math.acos(M/S)/Math.PI;return $=v<0?90-$:90+$,{center:f.toLngLat(),zoom:z,pitch:$,bearing:V}}easeTo(t,n){this._stop(!1,t.easeId),((t=a.extend({offset:[0,0],duration:500,easing:a.ease},t)).animate===!1||!t.essential&&a.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,S="pitch"in t?+t.pitch:f,M="padding"in t?t.padding:s.padding,z=a.pointGeometry.convert(t.offset);let V=s.centerPoint.add(z);const $=s.pointLocation(V),U=a.LngLat.convert(t.center||$);this._normalizeCenter(U);const H=s.project($),Y=s.project(U).sub(H),ne=s.zoomScale(y-u);let G,le;t.around&&(G=a.LngLat.convert(t.around),le=s.locationPoint(G));const se={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||S!==f,this._padding=!s.isPaddingEqual(M),this._easeId=t.easeId,this._prepareEase(n,t.noMoveStart,se),this._ease(me=>{if(this._zooming&&(s.zoom=a.number(u,y,me)),this._rotating&&(s.bearing=a.number(p,v,me)),this._pitching&&(s.pitch=a.number(f,S,me)),this._padding&&(s.interpolatePadding(_,M,me),V=s.centerPoint.add(z)),G)s.setLocationAtPoint(G,le);else{const ge=s.zoomScale(s.zoom-u),be=y>u?Math.min(2,ne):Math.max(.5,ne),de=Math.pow(be,1-me),Re=s.unproject(H.add(Y.mult(me*de)).mult(ge));s.setLocationAtPoint(s.renderWorldCopies?Re.wrap():Re,V)}this._fireMoveEvents(n)},me=>{this._afterEase(n,me)},t),this}_prepareEase(t,n,s={}){this._moving=!0,this.fire(new a.Event("freezeElevation",{freeze:!0})),n||s.moving||this.fire(new a.Event("movestart",t)),this._zooming&&!s.zooming&&this.fire(new a.Event("zoomstart",t)),this._rotating&&!s.rotating&&this.fire(new a.Event("rotatestart",t)),this._pitching&&!s.pitching&&this.fire(new a.Event("pitchstart",t))}_fireMoveEvents(t){this.fire(new a.Event("move",t)),this._zooming&&this.fire(new a.Event("zoom",t)),this._rotating&&this.fire(new a.Event("rotate",t)),this._pitching&&this.fire(new a.Event("pitch",t))}_afterEase(t,n){if(this._easeId&&n&&this._easeId===n)return;delete this._easeId,this.fire(new a.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 a.Event("zoomend",t)),u&&this.fire(new a.Event("rotateend",t)),p&&this.fire(new a.Event("pitchend",t)),this.fire(new a.Event("moveend",t))}flyTo(t,n){if(!t.essential&&a.exported.prefersReducedMotion){const We=a.pick(t,["center","zoom","bearing","pitch","around"]);return this.jumpTo(We,n)}this.stop(),t=a.extend({offset:[0,0],speed:1.2,curve:1.42,easing:a.ease},t);const s=this.transform,u=this.getZoom(),p=this.getBearing(),f=this.getPitch(),_=this.getPadding(),y="zoom"in t?a.clamp(+t.zoom,s.minZoom,s.maxZoom):u,v="bearing"in t?this._normalizeBearing(t.bearing,p):p,S="pitch"in t?+t.pitch:f,M="padding"in t?t.padding:s.padding,z=s.zoomScale(y-u),V=a.pointGeometry.convert(t.offset);let $=s.centerPoint.add(V);const U=s.pointLocation($),H=a.LngLat.convert(t.center||U);this._normalizeCenter(H);const Y=s.project(U),ne=s.project(H).sub(Y);let G=t.curve;const le=Math.max(s.width,s.height),se=le/z,me=ne.mag();if("minZoom"in t){const We=a.clamp(Math.min(t.minZoom,u,y),s.minZoom,s.maxZoom),At=le/s.zoomScale(We-u);G=Math.sqrt(At/me*2)}const ge=G*G;function be(We){const At=(se*se-le*le+(We?-1:1)*ge*ge*me*me)/(2*(We?se:le)*ge*me);return Math.log(Math.sqrt(At*At+1)-At)}function de(We){return(Math.exp(We)-Math.exp(-We))/2}function Re(We){return(Math.exp(We)+Math.exp(-We))/2}const Ie=be(0);let Fe=function(We){return Re(Ie)/Re(Ie+G*We)},st=function(We){return le*((Re(Ie)*(de(At=Ie+G*We)/Re(At))-de(Ie))/ge)/me;var At},ut=(be(1)-Ie)/G;if(Math.abs(me)<1e-6||!isFinite(ut)){if(Math.abs(le-se)<1e-6)return this.easeTo(t,n);const We=se<le?-1:1;ut=Math.abs(Math.log(se/le))/G,st=function(){return 0},Fe=function(At){return Math.exp(We*G*At)}}return t.duration="duration"in t?+t.duration:1e3*ut/("screenSpeed"in t?+t.screenSpeed/G:+t.speed),t.maxDuration&&t.duration>t.maxDuration&&(t.duration=0),this._zooming=!0,this._rotating=p!==v,this._pitching=S!==f,this._padding=!s.isPaddingEqual(M),this._prepareEase(n,!1),this._ease(We=>{const At=We*ut,Mt=1/Fe(At);s.zoom=We===1?y:u+s.scaleZoom(Mt),this._rotating&&(s.bearing=a.number(p,v,We)),this._pitching&&(s.pitch=a.number(f,S,We)),this._padding&&(s.interpolatePadding(_,M,We),$=s.centerPoint.add(V));const _t=We===1?H:s.unproject(Y.add(ne.mult(st(At))).mult(Mt));s.setLocationAtPoint(s.renderWorldCopies?_t.wrap():_t,$),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=a.exported.now(),this._easeOptions=s,this._onEaseFrame=t,this._onEaseEnd=n,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){const t=Math.min((a.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=a.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 yo{constructor(t={}){this.options=t,a.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=ie.create("details","maplibregl-ctrl maplibregl-ctrl-attrib mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=ie.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=ie.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(){ie.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 Xo{constructor(t={}){this.options=t,a.bindAll(["_updateCompact"],this)}getDefaultPosition(){return"bottom-left"}onAdd(t){this._map=t,this._compact=this.options&&this.options.compact,this._container=ie.create("div","maplibregl-ctrl mapboxgl-ctrl");const n=ie.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(){ie.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 ja{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 Xa={"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"},Wa={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},Hl={showCompass:!0,showZoom:!0,visualizePitch:!1};class fr{constructor(t,n,s=!1){this._clickTolerance=10,this.element=n,this.mouseRotate=new Cr({clickTolerance:t.dragRotate._mouseRotate._clickTolerance}),this.map=t,s&&(this.mousePitch=new $e({clickTolerance:t.dragRotate._mousePitch._clickTolerance})),a.bindAll(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),ie.addEventListener(n,"mousedown",this.mousedown),ie.addEventListener(n,"touchstart",this.touchstart,{passive:!1}),ie.addEventListener(n,"touchmove",this.touchmove),ie.addEventListener(n,"touchend",this.touchend),ie.addEventListener(n,"touchcancel",this.reset)}down(t,n){this.mouseRotate.mousedown(t,n),this.mousePitch&&this.mousePitch.mousedown(t,n),ie.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;ie.removeEventListener(t,"mousedown",this.mousedown),ie.removeEventListener(t,"touchstart",this.touchstart,{passive:!1}),ie.removeEventListener(t,"touchmove",this.touchmove),ie.removeEventListener(t,"touchend",this.touchend),ie.removeEventListener(t,"touchcancel",this.reset),this.offTemp()}offTemp(){ie.enableDrag(),ie.removeEventListener(window,"mousemove",this.mousemove),ie.removeEventListener(window,"mouseup",this.mouseup)}mousedown(t){this.down(a.extend({},t,{ctrlKey:!0,preventDefault:()=>t.preventDefault()}),ie.mousePos(this.element,t)),ie.addEventListener(window,"mousemove",this.mousemove),ie.addEventListener(window,"mouseup",this.mouseup)}mousemove(t){this.move(t,ie.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=ie.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=ie.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 xo(l,t,n){if(l=new a.LngLat(l.lng,l.lat),t){const s=new a.LngLat(l.lng-360,l.lat),u=new a.LngLat(l.lng+360,l.lat),p=n.locationPoint(l).distSqr(t);n.locationPoint(s).distSqr(t)<p?l=s:n.locationPoint(u).distSqr(t)<p&&(l=u)}for(;Math.abs(l.lng-n.center.lng)>180;){const s=n.locationPoint(l);if(s.x>=0&&s.y>=0&&s.x<=n.width&&s.y<=n.height)break;l.lng>n.center.lng?l.lng-=360:l.lng+=360}return l}const Ze={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(l,t,n){const s=l.classList;for(const u in Ze)s.remove(`maplibregl-${n}-anchor-${u}`,`mapboxgl-${n}-anchor-${u}`);s.add(`maplibregl-${n}-anchor-${t}`,`mapboxgl-${n}-anchor-${t}`)}class Fn extends a.Evented{constructor(t,n){if(super(),(t instanceof HTMLElement||n)&&(t=a.extend({element:t},n)),a.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=a.pointGeometry.convert(t&&t.offset||[0,0]);else{this._defaultMarker=!0,this._element=ie.create("div"),this._element.setAttribute("aria-label","Map marker");const s=ie.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=ie.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 _=ie.createNS("http://www.w3.org/2000/svg","g");_.setAttributeNS(null,"fill-rule","nonzero");const y=ie.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 ne of v){const G=ie.createNS("http://www.w3.org/2000/svg","ellipse");G.setAttributeNS(null,"opacity","0.04"),G.setAttributeNS(null,"cx","10.5"),G.setAttributeNS(null,"cy","5.80029008"),G.setAttributeNS(null,"rx",ne.rx),G.setAttributeNS(null,"ry",ne.ry),y.appendChild(G)}const S=ie.createNS("http://www.w3.org/2000/svg","g");S.setAttributeNS(null,"fill",this._color);const M=ie.createNS("http://www.w3.org/2000/svg","path");M.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"),S.appendChild(M);const z=ie.createNS("http://www.w3.org/2000/svg","g");z.setAttributeNS(null,"opacity","0.25"),z.setAttributeNS(null,"fill","#000000");const V=ie.createNS("http://www.w3.org/2000/svg","path");V.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"),z.appendChild(V);const $=ie.createNS("http://www.w3.org/2000/svg","g");$.setAttributeNS(null,"transform","translate(6.0, 7.0)"),$.setAttributeNS(null,"fill","#FFFFFF");const U=ie.createNS("http://www.w3.org/2000/svg","g");U.setAttributeNS(null,"transform","translate(8.0, 8.0)");const H=ie.createNS("http://www.w3.org/2000/svg","circle");H.setAttributeNS(null,"fill","#000000"),H.setAttributeNS(null,"opacity","0.25"),H.setAttributeNS(null,"cx","5.5"),H.setAttributeNS(null,"cy","5.5"),H.setAttributeNS(null,"r","5.4999962");const Y=ie.createNS("http://www.w3.org/2000/svg","circle");Y.setAttributeNS(null,"fill","#FFFFFF"),Y.setAttributeNS(null,"cx","5.5"),Y.setAttributeNS(null,"cy","5.5"),Y.setAttributeNS(null,"r","5.4999962"),U.appendChild(H),U.appendChild(Y),_.appendChild(y),_.appendChild(S),_.appendChild(z),_.appendChild($),_.appendChild(U),s.appendChild(_),s.setAttributeNS(null,"height",u*this._scale+"px"),s.setAttributeNS(null,"width",p*this._scale+"px"),this._element.appendChild(s),this._offset=a.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),ie.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=a.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=xo(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()),ie.setTransform(this._element,`${Ze[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=a.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 a.Event("dragstart"))),this.fire(new a.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 a.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 Fs={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let qr,mi=0,Zr=!1;const mr={maxWidth:100,unit:"metric"};function Ha(l,t,n){const s=n&&n.maxWidth||100,u=l._container.clientHeight/2,p=l.unproject([0,u]),f=l.unproject([s,u]),_=p.distanceTo(f);if(n&&n.unit==="imperial"){const y=3.2808*_;y>5280?jr(t,s,y/5280,l._getUIString("ScaleControl.Miles")):jr(t,s,y,l._getUIString("ScaleControl.Feet"))}else n&&n.unit==="nautical"?jr(t,s,_/1852,l._getUIString("ScaleControl.NauticalMiles")):_>=1e3?jr(t,s,_/1e3,l._getUIString("ScaleControl.Kilometers")):jr(t,s,_,l._getUIString("ScaleControl.Meters"))}function jr(l,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);l.style.width=t*(u/n)+"px",l.innerHTML=`${u}&nbsp;${s}`}const Xt={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},Qt=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Os(l){if(l){if(typeof l=="number"){const t=Math.round(Math.sqrt(.5*Math.pow(l,2)));return{center:new a.pointGeometry(0,0),top:new a.pointGeometry(0,l),"top-left":new a.pointGeometry(t,t),"top-right":new a.pointGeometry(-t,t),bottom:new a.pointGeometry(0,-l),"bottom-left":new a.pointGeometry(t,-t),"bottom-right":new a.pointGeometry(-t,-t),left:new a.pointGeometry(l,0),right:new a.pointGeometry(-l,0)}}if(l instanceof a.pointGeometry||Array.isArray(l)){const t=a.pointGeometry.convert(l);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:a.pointGeometry.convert(l.center||[0,0]),top:a.pointGeometry.convert(l.top||[0,0]),"top-left":a.pointGeometry.convert(l["top-left"]||[0,0]),"top-right":a.pointGeometry.convert(l["top-right"]||[0,0]),bottom:a.pointGeometry.convert(l.bottom||[0,0]),"bottom-left":a.pointGeometry.convert(l["bottom-left"]||[0,0]),"bottom-right":a.pointGeometry.convert(l["bottom-right"]||[0,0]),left:a.pointGeometry.convert(l.left||[0,0]),right:a.pointGeometry.convert(l.right||[0,0])}}return Os(new a.pointGeometry(0,0))}const sn={supported:Q,setRTLTextPlugin:a.setRTLTextPlugin,getRTLTextPluginStatus:a.getRTLTextPluginStatus,Map:class extends Gt{constructor(l){var t;if(a.PerformanceUtils.mark(a.PerformanceMarkers.create),(l=a.extend({},Wa,l)).minZoom!=null&&l.maxZoom!=null&&l.minZoom>l.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(l.minPitch!=null&&l.maxPitch!=null&&l.minPitch>l.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(l.minPitch!=null&&l.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(l.maxPitch!=null&&l.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new co(l.minZoom,l.maxZoom,l.minPitch,l.maxPitch,l.renderWorldCopies),{bearingSnap:l.bearingSnap}),this._interactive=l.interactive,this._cooperativeGestures=l.cooperativeGestures,this._maxTileCacheSize=l.maxTileCacheSize,this._failIfMajorPerformanceCaveat=l.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=l.preserveDrawingBuffer,this._antialias=l.antialias,this._trackResize=l.trackResize,this._bearingSnap=l.bearingSnap,this._refreshExpiredTiles=l.refreshExpiredTiles,this._fadeDuration=l.fadeDuration,this._crossSourceCollisions=l.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=l.collectResourceTiming,this._renderTaskQueue=new ja,this._controls=[],this._mapId=a.uniqueId(),this._locale=a.extend({},Xa,l.locale),this._clickTolerance=l.clickTolerance,this._pixelRatio=(t=l.pixelRatio)!==null&&t!==void 0?t:devicePixelRatio,this._requestManager=new Ge(l.transformRequest),typeof l.container=="string"){if(this._container=document.getElementById(l.container),!this._container)throw new Error(`Container '${l.container}' not found.`)}else{if(!(l.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=l.container}if(l.maxBounds&&this.setMaxBounds(l.maxBounds),a.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!="undefined"&&(addEventListener("online",this._onWindowOnline,!1),addEventListener("resize",this._onWindowResize,!1),addEventListener("orientationchange",this._onWindowResize,!1)),this.handlers=new Za(this,l),this._cooperativeGestures&&this._setupCooperativeGestures(),this._hash=l.hash&&new La(typeof l.hash=="string"&&l.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:l.center,zoom:l.zoom,bearing:l.bearing,pitch:l.pitch}),l.bounds&&(this.resize(),this.fitBounds(l.bounds,a.extend({},l.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=l.localIdeographFontFamily,l.style&&this.setStyle(l.style,{localIdeographFontFamily:l.localIdeographFontFamily}),l.attributionControl&&this.addControl(new yo({customAttribution:l.customAttribution})),l.maplibreLogo&&this.addControl(new Xo,l.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 a.Event(`${n.dataType}data`,n))}),this.on("dataloading",n=>{this.fire(new a.Event(`${n.dataType}dataloading`,n))}),this.on("dataabort",n=>{this.fire(new a.Event("sourcedataabort",n))})}_getMapId(){return this._mapId}addControl(l,t){if(t===void 0&&(t=l.getDefaultPosition?l.getDefaultPosition():"top-right"),!l||!l.onAdd)return this.fire(new a.ErrorEvent(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const n=l.onAdd(this);this._controls.push(l);const s=this._controlPositions[t];return t.indexOf("bottom")!==-1?s.insertBefore(n,s.firstChild):s.appendChild(n),this}removeControl(l){if(!l||!l.onRemove)return this.fire(new a.ErrorEvent(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const t=this._controls.indexOf(l);return t>-1&&this._controls.splice(t,1),l.onRemove(this),this}hasControl(l){return this._controls.indexOf(l)>-1}calculateCameraOptionsFromTo(l,t,n,s){return s==null&&this.style.terrain&&(s=this.transform.getElevation(n,this.style.terrain)),super.calculateCameraOptionsFromTo(l,t,n,s)}resize(l){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 a.Event("movestart",l)).fire(new a.Event("move",l))),this.fire(new a.Event("resize",l)),u&&this.fire(new a.Event("moveend",l)),this}getPixelRatio(){return this._pixelRatio}setPixelRatio(l){const[t,n]=this._containerDimensions();this._pixelRatio=l,this._resizeCanvas(t,n,l),this.painter.resize(t,n,l)}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(l){return this.transform.setMaxBounds(a.LngLatBounds.convert(l)),this._update()}setMinZoom(l){if((l=l==null?-2:l)>=-2&&l<=this.transform.maxZoom)return this.transform.minZoom=l,this._update(),this.getZoom()<l&&this.setZoom(l),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(l){if((l=l==null?22:l)>=this.transform.minZoom)return this.transform.maxZoom=l,this._update(),this.getZoom()>l&&this.setZoom(l),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(l){if((l=l==null?0:l)<0)throw new Error("minPitch must be greater than or equal to 0");if(l>=0&&l<=this.transform.maxPitch)return this.transform.minPitch=l,this._update(),this.getPitch()<l&&this.setPitch(l),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(l){if((l=l==null?60:l)>85)throw new Error("maxPitch must be less than or equal to 85");if(l>=this.transform.minPitch)return this.transform.maxPitch=l,this._update(),this.getPitch()>l&&this.setPitch(l),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(l){return this.transform.renderWorldCopies=l,this._update()}project(l){return this.transform.locationPoint(a.LngLat.convert(l),this.style&&this.style.terrain)}unproject(l){return this.transform.pointLocation(a.pointGeometry.convert(l),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(l,t,n){if(l==="mouseenter"||l==="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 Ui(l,this,p.originalEvent,{features:f}))):s=!1},mouseout:()=>{s=!1}}}}if(l==="mouseleave"||l==="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 Ui(l,this,f.originalEvent)))},mouseout:f=>{s&&(s=!1,n.call(this,new Ui(l,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:{[l]:s}}}}on(l,t,n){if(n===void 0)return super.on(l,t);const s=this._createDelegatedListener(l,t,n);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[l]=this._delegatedListeners[l]||[],this._delegatedListeners[l].push(s);for(const u in s.delegates)this.on(u,s.delegates[u]);return this}once(l,t,n){if(n===void 0)return super.once(l,t);const s=this._createDelegatedListener(l,t,n);for(const u in s.delegates)this.once(u,s.delegates[u]);return this}off(l,t,n){return n===void 0?super.off(l,t):(this._delegatedListeners&&this._delegatedListeners[l]&&(s=>{const u=this._delegatedListeners[l];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(l,t){if(!this.style)return[];let n;if(t!==void 0||l===void 0||l instanceof a.pointGeometry||Array.isArray(l)||(t=l,l=void 0),t=t||{},(l=l||[[0,0],[this.transform.width,this.transform.height]])instanceof a.pointGeometry||typeof l[0]=="number")n=[a.pointGeometry.convert(l)];else{const s=a.pointGeometry.convert(l[0]),u=a.pointGeometry.convert(l[1]);n=[s,new a.pointGeometry(u.x,s.y),u,new a.pointGeometry(s.x,u.y),s]}return this.style.queryRenderedFeatures(n,t,this.transform)}querySourceFeatures(l,t){return this.style.querySourceFeatures(l,t)}setStyle(l,t){return(t=a.extend({},{localIdeographFontFamily:this._localIdeographFontFamily},t)).diff!==!1&&t.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&l?(this._diffStyle(l,t),this):(this._localIdeographFontFamily=t.localIdeographFontFamily,this._updateStyle(l,t))}setTransformRequest(l){return this._requestManager.setTransformRequest(l),this}_getUIString(l){const t=this._locale[l];if(t==null)throw new Error(`Missing UI string '${l}'`);return t}_updateStyle(l,t){return this.style&&(this.style.setEventedParent(null),this.style._remove()),l?(this.style=new _i(this,t||{}),this.style.setEventedParent(this,{style:this.style}),typeof l=="string"?this.style.loadURL(l):this.style.loadJSON(l),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new _i(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(l,t){if(typeof l=="string"){const n=this._requestManager.transformRequest(l,a.ResourceType.Style);a.getJSON(n,(s,u)=>{s?this.fire(new a.ErrorEvent(s)):u&&this._updateDiff(u,t)})}else typeof l=="object"&&this._updateDiff(l,t)}_updateDiff(l,t){try{this.style.setState(l)&&this._update(!0)}catch(n){a.warnOnce(`Unable to perform style diff: ${n.message||n.error||n}. Rebuilding the style from scratch.`),this._updateStyle(l,t)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():a.warnOnce("There is no style added to the map.")}addSource(l,t){return this._lazyInitEmptyStyle(),this.style.addSource(l,t),this._update(!0)}isSourceLoaded(l){const t=this.style&&this.style.sourceCaches[l];if(t!==void 0)return t.loaded();this.fire(new a.ErrorEvent(new Error(`There is no source with ID '${l}'`)))}setTerrain(l){return this.style.setTerrain(l),this}getTerrain(){return this.style.terrain&&this.style.terrain.options}areTilesLoaded(){const l=this.style&&this.style.sourceCaches;for(const t in l){const n=l[t]._tiles;for(const s in n){const u=n[s];if(u.state!=="loaded"&&u.state!=="errored")return!1}}return!0}addSourceType(l,t,n){return this._lazyInitEmptyStyle(),this.style.addSourceType(l,t,n)}removeSource(l){return this.style.removeSource(l),this._update(!0)}getSource(l){return this.style.getSource(l)}addImage(l,t,{pixelRatio:n=1,sdf:s=!1,stretchX:u,stretchY:p,content:f}={}){if(this._lazyInitEmptyStyle(),t instanceof HTMLImageElement||a.isImageBitmap(t)){const{width:_,height:y,data:v}=a.exported.getImageData(t);this.style.addImage(l,{data:new a.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 a.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,S=t;this.style.addImage(l,{data:new a.RGBAImage({width:_,height:y},new Uint8Array(v)),pixelRatio:n,stretchX:u,stretchY:p,content:f,sdf:s,version:0,userImage:S}),S.onAdd&&S.onAdd(this,l)}}}updateImage(l,t){const n=this.style.getImage(l);if(!n)return this.fire(new a.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||a.isImageBitmap(t)?a.exported.getImageData(t):t,{width:u,height:p,data:f}=s;if(u===void 0||p===void 0)return this.fire(new a.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 a.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||a.isImageBitmap(t));n.data.replace(f,_),this.style.updateImage(l,n)}hasImage(l){return l?!!this.style.getImage(l):(this.fire(new a.ErrorEvent(new Error("Missing required image id"))),!1)}removeImage(l){this.style.removeImage(l)}loadImage(l,t){a.getImage(this._requestManager.transformRequest(l,a.ResourceType.Image),t)}listImages(){return this.style.listImages()}addLayer(l,t){return this._lazyInitEmptyStyle(),this.style.addLayer(l,t),this._update(!0)}moveLayer(l,t){return this.style.moveLayer(l,t),this._update(!0)}removeLayer(l){return this.style.removeLayer(l),this._update(!0)}getLayer(l){return this.style.getLayer(l)}setLayerZoomRange(l,t,n){return this.style.setLayerZoomRange(l,t,n),this._update(!0)}setFilter(l,t,n={}){return this.style.setFilter(l,t,n),this._update(!0)}getFilter(l){return this.style.getFilter(l)}setPaintProperty(l,t,n,s={}){return this.style.setPaintProperty(l,t,n,s),this._update(!0)}getPaintProperty(l,t){return this.style.getPaintProperty(l,t)}setLayoutProperty(l,t,n,s={}){return this.style.setLayoutProperty(l,t,n,s),this._update(!0)}getLayoutProperty(l,t){return this.style.getLayoutProperty(l,t)}setLight(l,t={}){return this._lazyInitEmptyStyle(),this.style.setLight(l,t),this._update(!0)}getLight(){return this.style.getLight()}setFeatureState(l,t){return this.style.setFeatureState(l,t),this._update()}removeFeatureState(l,t){return this.style.removeFeatureState(l,t),this._update()}getFeatureState(l){return this.style.getFeatureState(l)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let l=0,t=0;return this._container&&(l=this._container.clientWidth||400,t=this._container.clientHeight||300),[l,t]}_setupContainer(){const l=this._container;l.classList.add("maplibregl-map","mapboxgl-map");const t=this._canvasContainer=ie.create("div","maplibregl-canvas-container mapboxgl-canvas-container",l);this._interactive&&t.classList.add("maplibregl-interactive","mapboxgl-interactive"),this._canvas=ie.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=ie.create("div","maplibregl-control-container mapboxgl-control-container",l),u=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(p=>{u[p]=ie.create("div",`maplibregl-ctrl-${p} mapboxgl-ctrl-${p}`,s)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_setupCooperativeGestures(){const l=this._container;this._metaPress=!1,this._cooperativeGesturesScreen=ie.create("div","maplibregl-cooperative-gesture-screen",l);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(l,t,n){this._canvas.width=n*l,this._canvas.height=n*t,this._canvas.style.width=`${l}px`,this._canvas.style.height=`${t}px`}_setupPainter(){const l=a.extend({},Y.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),t=this._canvas.getContext("webgl",l)||this._canvas.getContext("experimental-webgl",l);t?(this.painter=new Cs(t,this.transform),a.exported$1.testSupport(t)):this.fire(new a.ErrorEvent(new Error("Failed to initialize WebGL")))}_contextLost(l){l.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new a.Event("webglcontextlost",{originalEvent:l}))}_contextRestored(l){this._setupPainter(),this.resize(),this._update(),this.fire(new a.Event("webglcontextrestored",{originalEvent:l}))}_onMapScroll(l){if(l.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}_onCooperativeGesture(l,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(l){return this.style?(this._styleDirty=this._styleDirty||l,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(l){return this._update(),this._renderTaskQueue.add(l)}_cancelRenderFrame(l){this._renderTaskQueue.remove(l)}_render(l){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=a.exported.now()),this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(l),this._removed)return;let u=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const f=this.transform.zoom,_=a.exported.now();this.style.zoomHistory.update(f,_);const y=new a.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 a.Event("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,a.PerformanceUtils.mark(a.PerformanceMarkers.load),this.fire(new a.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=a.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 a.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 a.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 a.Event("idle")),!this._loaded||this._fullyLoaded||p||(this._fullyLoaded=!0,a.PerformanceUtils.mark(a.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!="undefined"&&(removeEventListener("resize",this._onWindowResize,!1),removeEventListener("orientationchange",this._onWindowResize,!1),removeEventListener("online",this._onWindowOnline,!1));const l=this.painter.context.gl.getExtension("WEBGL_lose_context");l&&l.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),ie.remove(this._canvasContainer),ie.remove(this._controlContainer),this._cooperativeGestures&&ie.remove(this._cooperativeGesturesScreen),this._container.classList.remove("maplibregl-map","mapboxgl-map"),a.PerformanceUtils.clearMetrics(),this._removed=!0,this.fire(new a.Event("remove"))}triggerRepaint(){this.style&&!this._frame&&(this._frame=a.exported.frame(l=>{a.PerformanceUtils.frame(l),this._frame=null,this._render(l)}))}_onWindowOnline(){this._update()}_onWindowResize(l){this._trackResize&&this.resize({originalEvent:l})._update()}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(l){this._showTileBoundaries!==l&&(this._showTileBoundaries=l,this._update())}get showPadding(){return!!this._showPadding}set showPadding(l){this._showPadding!==l&&(this._showPadding=l,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(l){this._showCollisionBoxes!==l&&(this._showCollisionBoxes=l,l?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(l){this._showOverdrawInspector!==l&&(this._showOverdrawInspector=l,this._update())}get repaint(){return!!this._repaint}set repaint(l){this._repaint!==l&&(this._repaint=l,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(l){this._vertices=l,this._update()}_setCacheLimits(l,t){a.setCacheLimits(l,t)}get version(){return"2.4.0"}},NavigationControl:class{constructor(l){this.options=a.extend({},Hl,l),this._container=ie.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",t=>t.preventDefault()),this.options.showZoom&&(a.bindAll(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in mapboxgl-ctrl-zoom-in",t=>this._map.zoomIn({},{originalEvent:t})),ie.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})),ie.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(a.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=ie.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){const l=this._map.getZoom(),t=l===this._map.getMaxZoom(),n=l===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 l=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=l}onAdd(l){return this._map=l,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 mr(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){ie.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(l,t){const n=ie.create("button",l,this._container);return n.type="button",n.addEventListener("click",t),n}_setButtonTitle(l,t){const n=this._map._getUIString(`NavigationControl.${t}`);l.title=n,l.setAttribute("aria-label",n)}},GeolocateControl:class extends a.Evented{constructor(l){super(),this.options=a.extend({},Fs,l),a.bindAll(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker"],this)}onAdd(l){var t;return this._map=l,this._container=ie.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),t=this._setupUI,qr!==void 0?t(qr):window.navigator.permissions!==void 0?window.navigator.permissions.query({name:"geolocation"}).then(n=>{qr=n.state!=="denied",t(qr)}):(qr=!!window.navigator.geolocation,t(qr)),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(),ie.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,mi=0,Zr=!1}_isOutOfMapMaxBounds(l){const t=this._map.getMaxBounds(),n=l.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(l){if(this._map){if(this._isOutOfMapMaxBounds(l))return this._setErrorState(),this.fire(new a.Event("outofmaxbounds",l)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=l,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(l),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(l),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale","mapboxgl-user-location-dot-stale"),this.fire(new a.Event("geolocate",l)),this._finish()}}_updateCamera(l){const t=new a.LngLat(l.coords.longitude,l.coords.latitude),n=l.coords.accuracy,s=this._map.getBearing(),u=a.extend({bearing:s},this.options.fitBoundsOptions);this._map.fitBounds(t.toBounds(n),u,{geolocateSource:!0})}_updateMarker(l){if(l){const t=new a.LngLat(l.coords.longitude,l.coords.latitude);this._accuracyCircleMarker.setLngLat(t).addTo(this._map),this._userLocationDotMarker.setLngLat(t).addTo(this._map),this._accuracy=l.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){const l=this._map._container.clientHeight/2,t=this._map.unproject([0,l]),n=this._map.unproject([1,l]),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(l){if(this._map){if(this.options.trackUserLocation)if(l.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(l.code===3&&Zr)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 a.Event("error",l)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(l){if(this._container.addEventListener("contextmenu",t=>t.preventDefault()),this._geolocateButton=ie.create("button","maplibregl-ctrl-geolocate mapboxgl-ctrl-geolocate",this._container),ie.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",l===!1){a.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=ie.create("div","maplibregl-user-location-dot mapboxgl-user-location-dot"),this._userLocationDotMarker=new Fn(this._dotElement),this._circleElement=ie.create("div","maplibregl-user-location-accuracy-circle mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Fn({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 a.Event("trackuserlocationend")))})}trigger(){if(!this._setup)return a.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 a.Event("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":mi--,Zr=!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 a.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 a.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 l;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),mi++,mi>1?(l={maximumAge:6e5,timeout:0},Zr=!0):(l=this.options.positionOptions,Zr=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,l)}}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:yo,LogoControl:Xo,ScaleControl:class{constructor(l){this.options=a.extend({},gr,l),a.bindAll(["_onMove","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_onMove(){Wa(this._map,this._container,this.options)}onAdd(l){return this._map=l,this._container=ie.create("div","maplibregl-ctrl maplibregl-ctrl-scale mapboxgl-ctrl mapboxgl-ctrl-scale",l.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){ie.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}setUnit(l){this.options.unit=l,Wa(this._map,this._container,this.options)}},FullscreenControl:class{constructor(l){this._fullscreen=!1,l&&l.container&&(l.container instanceof HTMLElement?this._container=l.container:a.warnOnce("Full screen control 'container' must be a DOM element.")),a.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(l){return this._map=l,this._container||(this._container=this._map.getContainer()),this._controlContainer=ie.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",a.warnOnce("This device does not support fullscreen mode.")),this._controlContainer}onRemove(){ie.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 l=this._fullscreenButton=ie.create("button","maplibregl-ctrl-fullscreen mapboxgl-ctrl-fullscreen",this._controlContainer);ie.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",l).setAttribute("aria-hidden","true"),l.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){const l=this._getTitle();this._fullscreenButton.setAttribute("aria-label",l),this._fullscreenButton.title=l}_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(l){this.options=l,a.bindAll(["_toggleTerrain","_updateTerrainIcon"],this)}onAdd(l){return this._map=l,this._container=ie.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._terrainButton=ie.create("button","maplibregl-ctrl-terrain mapboxgl-ctrl-terrain",this._container),ie.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(){ie.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 a.Evented{constructor(l){super(),this.options=a.extend(Object.create(Xt),l),a.bindAll(["_update","_onClose","remove","_onMouseMove","_onMouseUp","_onDrag"],this)}addTo(l){return this._map&&this.remove(),this._map=l,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 a.Event("open")),this}isOpen(){return!!this._map}remove(){return this._content&&ie.remove(this._content),this._container&&(ie.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 a.Event("close")),this}getLngLat(){return this._lngLat}setLngLat(l){return this._lngLat=a.LngLat.convert(l),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(l){return this.setDOMContent(document.createTextNode(l))}setHTML(l){const t=document.createDocumentFragment(),n=document.createElement("body");let s;for(n.innerHTML=l;s=n.firstChild,s;)t.appendChild(s);return this.setDOMContent(t)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(l){return this.options.maxWidth=l,this._update(),this}setDOMContent(l){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=ie.create("div","maplibregl-popup-content mapboxgl-popup-content",this._container);return this._content.appendChild(l),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(l){this._container&&this._container.classList.add(l)}removeClassName(l){this._container&&this._container.classList.remove(l)}setOffset(l){return this.options.offset=l,this._update(),this}toggleClassName(l){if(this._container)return this._container.classList.toggle(l)}_createCloseButton(){this.options.closeButton&&(this._closeButton=ie.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="&#215;",this._closeButton.addEventListener("click",this._onClose))}_onMouseUp(l){this._update(l.point)}_onMouseMove(l){this._update(l.point)}_onDrag(l){this._update(l.point)}_update(l){if(!this._map||!this._lngLat&&!this._trackPointer||!this._content||(this._container||(this._container=ie.create("div","maplibregl-popup mapboxgl-popup",this._map.getContainer()),this._tip=ie.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=xo(this._lngLat,this._pos,this._map.transform)),this._trackPointer&&!l))return;const t=this._pos=this._trackPointer&&l?l:this._map.project(this._lngLat);let n=this.options.anchor;const s=Os(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();ie.setTransform(this._container,`${Ze[n]} translate(${u.x}px,${u.y}px)`),Ye(this._container,n,"popup")}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const l=this._container.querySelector(Yt);l&&l.focus()}_onClose(){this.remove()}},Marker:Fn,Style:_i,LngLat:a.LngLat,LngLatBounds:a.LngLatBounds,Point:a.pointGeometry,MercatorCoordinate:a.MercatorCoordinate,Evented:a.Evented,AJAXError:a.AJAXError,config:a.config,CanvasSource:Kr,GeoJSONSource:Bi,ImageSource:Ci,RasterDEMTileSource:Xe,RasterTileSource:pi,VectorTileSource:Rt,VideoSource:Ai,prewarm:function(){vn().acquire(br)},clearPrewarmedResources:function(){const l=Br;l&&(l.isPreloaded()&&l.numActive()===1?(l.release(br),Br=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 Fi.workerCount},set workerCount(l){Fi.workerCount=l},get maxParallelImageRequests(){return a.config.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(l){a.config.MAX_PARALLEL_IMAGE_REQUESTS=l},clearStorage(l){a.clearTileCache(l)},workerUrl:"",addProtocol(l,t){a.config.REGISTERED_PROTOCOLS[l]=t},removeProtocol(l){delete a.config.REGISTERED_PROTOCOLS[l]}};return Ji.extend(sn,{isSafari:a.isSafari,getPerformanceMetrics:a.PerformanceUtils.getPerformanceMetrics}),sn});var oe=F;return oe})})(rp);var sm=rp.exports;function op(b,I,A){A===void 0&&(A={});var D={type:"Feature"};return(A.id===0||A.id)&&(D.id=A.id),A.bbox&&(D.bbox=A.bbox),D.properties=I||{},D.geometry=b,D}function Dh(b,I,A){if(A===void 0&&(A={}),!b)throw new Error("coordinates is required");if(!Array.isArray(b))throw new Error("coordinates must be an Array");if(b.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Lh(b[0])||!Lh(b[1]))throw new Error("coordinates must contain numbers");var D={type:"Point",coordinates:b};return op(D,I,A)}function am(b,I,A){A===void 0&&(A={});var D={type:"MultiPoint",coordinates:b};return op(D,I,A)}function Lh(b){return!isNaN(b)&&b!==null&&!Array.isArray(b)}function sp(b,I,A){if(b!==null)for(var D,F,N,oe,a,Y,te,fe=0,ue=0,ie,Ge=b.type,$e=Ge==="FeatureCollection",Ue=Ge==="Feature",et=$e?b.features.length:1,Ke=0;Ke<et;Ke++){te=$e?b.features[Ke].geometry:Ue?b.geometry:b,ie=te?te.type==="GeometryCollection":!1,a=ie?te.geometries.length:1;for(var tt=0;tt<a;tt++){var lt=0,It=0;if(oe=ie?te.geometries[tt]:te,oe!==null){Y=oe.coordinates;var at=oe.type;switch(fe=A&&(at==="Polygon"||at==="MultiPolygon")?1:0,at){case null:break;case"Point":if(I(Y,ue,Ke,lt,It)===!1)return!1;ue++,lt++;break;case"LineString":case"MultiPoint":for(D=0;D<Y.length;D++){if(I(Y[D],ue,Ke,lt,It)===!1)return!1;ue++,at==="MultiPoint"&&lt++}at==="LineString"&&lt++;break;case"Polygon":case"MultiLineString":for(D=0;D<Y.length;D++){for(F=0;F<Y[D].length-fe;F++){if(I(Y[D][F],ue,Ke,lt,It)===!1)return!1;ue++}at==="MultiLineString"&&lt++,at==="Polygon"&&It++}at==="Polygon"&&lt++;break;case"MultiPolygon":for(D=0;D<Y.length;D++){for(It=0,F=0;F<Y[D].length;F++){for(N=0;N<Y[D][F].length-fe;N++){if(I(Y[D][F][N],ue,Ke,lt,It)===!1)return!1;ue++}It++}lt++}break;case"GeometryCollection":for(D=0;D<oe.geometries.length;D++)if(sp(oe.geometries[D],I,A)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function Uc(b){var I=[1/0,1/0,-1/0,-1/0];return sp(b,function(A){I[0]>A[0]&&(I[0]=A[0]),I[1]>A[1]&&(I[1]=A[1]),I[2]<A[0]&&(I[2]=A[0]),I[3]<A[1]&&(I[3]=A[1])}),I}Uc.default=Uc;const lm={x:0,y:0,width:0,height:0,top:0,left:0,bottom:0,right:0},cm=()=>{const[b,I]=Te.exports.useState(null),[A,D]=Te.exports.useState(lm),F=Te.exports.useMemo(()=>new window.ResizeObserver(N=>{if(N[0]){const{x:oe,y:a,width:Y,height:te,top:fe,left:ue,bottom:ie,right:Ge}=N[0].contentRect;D({x:oe,y:a,width:Y,height:te,top:fe,left:ue,bottom:ie,right:Ge})}}),[]);return Te.exports.useLayoutEffect(()=>{if(!!b)return F.observe(b),()=>{F.disconnect()}},[b]),[I,A,b]};var um="Expected a function",Rh=0/0,hm="[object Symbol]",pm=/^\s+|\s+$/g,dm=/^[-+]0x[0-9a-f]+$/i,fm=/^0b[01]+$/i,mm=/^0o[0-7]+$/i,gm=parseInt,_m=typeof sa=="object"&&sa&&sa.Object===Object&&sa,ym=typeof self=="object"&&self&&self.Object===Object&&self,xm=_m||ym||Function("return this")(),vm=Object.prototype,bm=vm.toString,wm=Math.max,Tm=Math.min,Bc=function(){return xm.Date.now()};function Em(b,I,A){var D,F,N,oe,a,Y,te=0,fe=!1,ue=!1,ie=!0;if(typeof b!="function")throw new TypeError(um);I=Bh(I)||0,Vc(A)&&(fe=!!A.leading,ue="maxWait"in A,N=ue?wm(Bh(A.maxWait)||0,I):N,ie="trailing"in A?!!A.trailing:ie);function Ge(gt){var ti=D,Kt=F;return D=F=void 0,te=gt,oe=b.apply(Kt,ti),oe}function $e(gt){return te=gt,a=setTimeout(Ke,I),fe?Ge(gt):oe}function Ue(gt){var ti=gt-Y,Kt=gt-te,ur=I-ti;return ue?Tm(ur,N-Kt):ur}function et(gt){var ti=gt-Y,Kt=gt-te;return Y===void 0||ti>=I||ti<0||ue&&Kt>=N}function Ke(){var gt=Bc();if(et(gt))return tt(gt);a=setTimeout(Ke,Ue(gt))}function tt(gt){return a=void 0,ie&&D?Ge(gt):(D=F=void 0,oe)}function lt(){a!==void 0&&clearTimeout(a),te=0,D=Y=F=a=void 0}function It(){return a===void 0?oe:tt(Bc())}function at(){var gt=Bc(),ti=et(gt);if(D=arguments,F=this,Y=gt,ti){if(a===void 0)return $e(Y);if(ue)return a=setTimeout(Ke,I),Ge(Y)}return a===void 0&&(a=setTimeout(Ke,I)),oe}return at.cancel=lt,at.flush=It,at}function Vc(b){var I=typeof b;return!!b&&(I=="object"||I=="function")}function Sm(b){return!!b&&typeof b=="object"}function Im(b){return typeof b=="symbol"||Sm(b)&&bm.call(b)==hm}function Bh(b){if(typeof b=="number")return b;if(Im(b))return Rh;if(Vc(b)){var I=typeof b.valueOf=="function"?b.valueOf():b;b=Vc(I)?I+"":I}if(typeof b!="string")return b===0?b:+b;b=b.replace(pm,"");var A=fm.test(b);return A||mm.test(b)?gm(b.slice(2),A?2:8):dm.test(b)?Rh:+b}var Cm=Em;const Am=()=>{const[b,I]=Te.exports.useState(!1);return Te.exports.useLayoutEffect(()=>{const A=()=>{I(window.innerWidth<Sf.screenSizes.mobileL)};return window.addEventListener("resize",Cm(A,250)),A(),()=>window.removeEventListener("resize",A)},[]),b},ap={all:()=>["pois"],list:b=>[...ap.all(),b]},{scorePois:Mm}=Co.Constants;function lp(){var a;const{client:b}=El(),{sdkState:I}=Sl(),A=qc(I.options,250),{activeScore:D}=Zn(),F=D?Mm[D]:void 0,oe={...Te.exports.useMemo(()=>A!=null&&A.marker?A.marker:{lat:A==null?void 0:A.lat,lng:A==null?void 0:A.lng},[A]),limit:10,radius:2e3,include:F};return Zc(ap.list(oe),async()=>b.getPois(oe),{enabled:!!oe&&!!((a=oe.include)!=null&&a.length)&&!!oe.lat&&!!oe.lng})}const cp={all:()=>["schools"],list:b=>[...cp.all(),b]};function up(){const{client:b}=El(),{sdkState:I}=Sl(),A=qc(I.options,250),F={...Te.exports.useMemo(()=>A!=null&&A.marker?A.marker:{lat:A==null?void 0:A.lat,lng:A==null?void 0:A.lng},[A]),limit:10,radius:2e3};return Zc(cp.list(F),async()=>b.getSchools(F),{enabled:!!F&&!!F.lat&&!!F.lng})}const hp=nt.createContext({}),pp=()=>Te.exports.useContext(hp),Pm=({children:b,mapRef:I,mapPadding:A})=>Se(hp.Provider,{value:{mapRef:I,mapPadding:A},children:b}),dp=nt.memo(({marker:b})=>Se($c,{latitude:b.lat,longitude:b.lng,style:{zIndex:1},children:Se(If.Root,{options:{style:"pin"}})}));dp.displayName="Pin";function Nc(b,I,A,D,F,N){if(F-D<=A)return;const oe=D+F>>1;fp(b,I,oe,D,F,N%2),Nc(b,I,A,D,oe-1,N+1),Nc(b,I,A,oe+1,F,N+1)}function fp(b,I,A,D,F,N){for(;F>D;){if(F-D>600){const te=F-D+1,fe=A-D+1,ue=Math.log(te),ie=.5*Math.exp(2*ue/3),Ge=.5*Math.sqrt(ue*ie*(te-ie)/te)*(fe-te/2<0?-1:1),$e=Math.max(D,Math.floor(A-fe*ie/te+Ge)),Ue=Math.min(F,Math.floor(A+(te-fe)*ie/te+Ge));fp(b,I,A,$e,Ue,N)}const oe=I[2*A+N];let a=D,Y=F;for(na(b,I,D,A),I[2*F+N]>oe&&na(b,I,D,F);a<Y;){for(na(b,I,a,Y),a++,Y--;I[2*a+N]<oe;)a++;for(;I[2*Y+N]>oe;)Y--}I[2*D+N]===oe?na(b,I,D,Y):(Y++,na(b,I,Y,F)),Y<=A&&(D=Y+1),A<=Y&&(F=Y-1)}}function na(b,I,A,D){Fc(b,A,D),Fc(I,2*A,2*D),Fc(I,2*A+1,2*D+1)}function Fc(b,I,A){const D=b[I];b[I]=b[A],b[A]=D}function zm(b,I,A,D,F,N,oe){const a=[0,b.length-1,0],Y=[];let te,fe;for(;a.length;){const ue=a.pop(),ie=a.pop(),Ge=a.pop();if(ie-Ge<=oe){for(let et=Ge;et<=ie;et++)te=I[2*et],fe=I[2*et+1],te>=A&&te<=F&&fe>=D&&fe<=N&&Y.push(b[et]);continue}const $e=Math.floor((Ge+ie)/2);te=I[2*$e],fe=I[2*$e+1],te>=A&&te<=F&&fe>=D&&fe<=N&&Y.push(b[$e]);const Ue=(ue+1)%2;(ue===0?A<=te:D<=fe)&&(a.push(Ge),a.push($e-1),a.push(Ue)),(ue===0?F>=te:N>=fe)&&(a.push($e+1),a.push(ie),a.push(Ue))}return Y}function km(b,I,A,D,F,N){const oe=[0,b.length-1,0],a=[],Y=F*F;for(;oe.length;){const te=oe.pop(),fe=oe.pop(),ue=oe.pop();if(fe-ue<=N){for(let et=ue;et<=fe;et++)Fh(I[2*et],I[2*et+1],A,D)<=Y&&a.push(b[et]);continue}const ie=Math.floor((ue+fe)/2),Ge=I[2*ie],$e=I[2*ie+1];Fh(Ge,$e,A,D)<=Y&&a.push(b[ie]);const Ue=(te+1)%2;(te===0?A-F<=Ge:D-F<=$e)&&(oe.push(ue),oe.push(ie-1),oe.push(Ue)),(te===0?A+F>=Ge:D+F>=$e)&&(oe.push(ie+1),oe.push(fe),oe.push(Ue))}return a}function Fh(b,I,A,D){const F=b-A,N=I-D;return F*F+N*N}const Dm=b=>b[0],Lm=b=>b[1];class Oh{constructor(I,A=Dm,D=Lm,F=64,N=Float64Array){this.nodeSize=F,this.points=I;const oe=I.length<65536?Uint16Array:Uint32Array,a=this.ids=new oe(I.length),Y=this.coords=new N(I.length*2);for(let te=0;te<I.length;te++)a[te]=te,Y[2*te]=A(I[te]),Y[2*te+1]=D(I[te]);Nc(a,Y,F,0,a.length-1,0)}range(I,A,D,F){return zm(this.ids,this.coords,I,A,D,F,this.nodeSize)}within(I,A,D){return km(this.ids,this.coords,I,A,D,this.nodeSize)}}const Rm={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:b=>b},wl=Math.fround||(b=>I=>(b[0]=+I,b[0]))(new Float32Array(1));class Bm{constructor(I){this.options=aa(Object.create(Rm),I),this.trees=new Array(this.options.maxZoom+1)}load(I){const{log:A,minZoom:D,maxZoom:F,nodeSize:N}=this.options;A&&console.time("total time");const oe=`prepare ${I.length} points`;A&&console.time(oe),this.points=I;let a=[];for(let Y=0;Y<I.length;Y++)!I[Y].geometry||a.push(Om(I[Y],Y));this.trees[F+1]=new Oh(a,Uh,Vh,N,Float32Array),A&&console.timeEnd(oe);for(let Y=F;Y>=D;Y--){const te=+Date.now();a=this._cluster(a,Y),this.trees[Y]=new Oh(a,Uh,Vh,N,Float32Array),A&&console.log("z%d: %d clusters in %dms",Y,a.length,+Date.now()-te)}return A&&console.timeEnd("total time"),this}getClusters(I,A){let D=((I[0]+180)%360+360)%360-180;const F=Math.max(-90,Math.min(90,I[1]));let N=I[2]===180?180:((I[2]+180)%360+360)%360-180;const oe=Math.max(-90,Math.min(90,I[3]));if(I[2]-I[0]>=360)D=-180,N=180;else if(D>N){const fe=this.getClusters([D,F,180,oe],A),ue=this.getClusters([-180,F,N,oe],A);return fe.concat(ue)}const a=this.trees[this._limitZoom(A)],Y=a.range(xl(D),vl(oe),xl(N),vl(F)),te=[];for(const fe of Y){const ue=a.points[fe];te.push(ue.numPoints?$h(ue):this.points[ue.index])}return te}getChildren(I){const A=this._getOriginId(I),D=this._getOriginZoom(I),F="No cluster with the specified id.",N=this.trees[D];if(!N)throw new Error(F);const oe=N.points[A];if(!oe)throw new Error(F);const a=this.options.radius/(this.options.extent*Math.pow(2,D-1)),Y=N.within(oe.x,oe.y,a),te=[];for(const fe of Y){const ue=N.points[fe];ue.parentId===I&&te.push(ue.numPoints?$h(ue):this.points[ue.index])}if(te.length===0)throw new Error(F);return te}getLeaves(I,A,D){A=A||10,D=D||0;const F=[];return this._appendLeaves(F,I,A,D,0),F}getTile(I,A,D){const F=this.trees[this._limitZoom(I)],N=Math.pow(2,I),{extent:oe,radius:a}=this.options,Y=a/oe,te=(D-Y)/N,fe=(D+1+Y)/N,ue={features:[]};return this._addTileFeatures(F.range((A-Y)/N,te,(A+1+Y)/N,fe),F.points,A,D,N,ue),A===0&&this._addTileFeatures(F.range(1-Y/N,te,1,fe),F.points,N,D,N,ue),A===N-1&&this._addTileFeatures(F.range(0,te,Y/N,fe),F.points,-1,D,N,ue),ue.features.length?ue:null}getClusterExpansionZoom(I){let A=this._getOriginZoom(I)-1;for(;A<=this.options.maxZoom;){const D=this.getChildren(I);if(A++,D.length!==1)break;I=D[0].properties.cluster_id}return A}_appendLeaves(I,A,D,F,N){const oe=this.getChildren(A);for(const a of oe){const Y=a.properties;if(Y&&Y.cluster?N+Y.point_count<=F?N+=Y.point_count:N=this._appendLeaves(I,Y.cluster_id,D,F,N):N<F?N++:I.push(a),I.length===D)break}return N}_addTileFeatures(I,A,D,F,N,oe){for(const a of I){const Y=A[a],te=Y.numPoints;let fe,ue,ie;if(te)fe=mp(Y),ue=Y.x,ie=Y.y;else{const Ue=this.points[Y.index];fe=Ue.properties,ue=xl(Ue.geometry.coordinates[0]),ie=vl(Ue.geometry.coordinates[1])}const Ge={type:1,geometry:[[Math.round(this.options.extent*(ue*N-D)),Math.round(this.options.extent*(ie*N-F))]],tags:fe};let $e;te?$e=Y.id:this.options.generateId?$e=Y.index:this.points[Y.index].id&&($e=this.points[Y.index].id),$e!==void 0&&(Ge.id=$e),oe.features.push(Ge)}}_limitZoom(I){return Math.max(this.options.minZoom,Math.min(Math.floor(+I),this.options.maxZoom+1))}_cluster(I,A){const D=[],{radius:F,extent:N,reduce:oe,minPoints:a}=this.options,Y=F/(N*Math.pow(2,A));for(let te=0;te<I.length;te++){const fe=I[te];if(fe.zoom<=A)continue;fe.zoom=A;const ue=this.trees[A+1],ie=ue.within(fe.x,fe.y,Y),Ge=fe.numPoints||1;let $e=Ge;for(const Ue of ie){const et=ue.points[Ue];et.zoom>A&&($e+=et.numPoints||1)}if($e>Ge&&$e>=a){let Ue=fe.x*Ge,et=fe.y*Ge,Ke=oe&&Ge>1?this._map(fe,!0):null;const tt=(te<<5)+(A+1)+this.points.length;for(const lt of ie){const It=ue.points[lt];if(It.zoom<=A)continue;It.zoom=A;const at=It.numPoints||1;Ue+=It.x*at,et+=It.y*at,It.parentId=tt,oe&&(Ke||(Ke=this._map(fe,!0)),oe(Ke,this._map(It)))}fe.parentId=tt,D.push(Fm(Ue/$e,et/$e,tt,$e,Ke))}else if(D.push(fe),$e>1)for(const Ue of ie){const et=ue.points[Ue];et.zoom<=A||(et.zoom=A,D.push(et))}}return D}_getOriginId(I){return I-this.points.length>>5}_getOriginZoom(I){return(I-this.points.length)%32}_map(I,A){if(I.numPoints)return A?aa({},I.properties):I.properties;const D=this.points[I.index].properties,F=this.options.map(D);return A&&F===D?aa({},F):F}}function Fm(b,I,A,D,F){return{x:wl(b),y:wl(I),zoom:1/0,id:A,parentId:-1,numPoints:D,properties:F}}function Om(b,I){const[A,D]=b.geometry.coordinates;return{x:wl(xl(A)),y:wl(vl(D)),zoom:1/0,index:I,parentId:-1}}function $h(b){return{type:"Feature",id:b.id,properties:mp(b),geometry:{type:"Point",coordinates:[$m(b.x),Um(b.y)]}}}function mp(b){const I=b.numPoints,A=I>=1e4?`${Math.round(I/1e3)}k`:I>=1e3?`${Math.round(I/100)/10}k`:I;return aa(aa({},b.properties),{cluster:!0,cluster_id:b.id,point_count:I,point_count_abbreviated:A})}function xl(b){return b/360+.5}function vl(b){const I=Math.sin(b*Math.PI/180),A=.5-.25*Math.log((1+I)/(1-I))/Math.PI;return A<0?0:A>1?1:A}function $m(b){return(b-.5)*360}function Um(b){const I=(180-b*360)*Math.PI/180;return 360*Math.atan(Math.exp(I))/Math.PI-90}function aa(b,I){for(const A in I)b[A]=I[A];return b}function Uh(b){return b.x}function Vh(b){return b.y}var Nh=Object.prototype.hasOwnProperty;function Gh(b,I,A){for(A of b.keys())if(Io(A,I))return A}function Io(b,I){var A,D,F;if(b===I)return!0;if(b&&I&&(A=b.constructor)===I.constructor){if(A===Date)return b.getTime()===I.getTime();if(A===RegExp)return b.toString()===I.toString();if(A===Array){if((D=b.length)===I.length)for(;D--&&Io(b[D],I[D]););return D===-1}if(A===Set){if(b.size!==I.size)return!1;for(D of b)if(F=D,F&&typeof F=="object"&&(F=Gh(I,F),!F)||!I.has(F))return!1;return!0}if(A===Map){if(b.size!==I.size)return!1;for(D of b)if(F=D[0],F&&typeof F=="object"&&(F=Gh(I,F),!F)||!Io(D[1],I.get(F)))return!1;return!0}if(A===ArrayBuffer)b=new Uint8Array(b),I=new Uint8Array(I);else if(A===DataView){if((D=b.byteLength)===I.byteLength)for(;D--&&b.getInt8(D)===I.getInt8(D););return D===-1}if(ArrayBuffer.isView(b)){if((D=b.byteLength)===I.byteLength)for(;D--&&b[D]===I[D];);return D===-1}if(!A||typeof b=="object"){D=0;for(A in b)if(Nh.call(b,A)&&++D&&!Nh.call(I,A)||!(A in I)||!Io(b[A],I[A]))return!1;return Object.keys(I).length===D}}return b!==b&&I!==I}function Vm(b){var I=Te.exports.useRef(b),A=Te.exports.useRef(0);return Io(b,I.current)||(I.current=b,A.current+=1),Te.exports.useMemo(function(){return I.current},[A.current])}function Nm(b,I){return Te.exports.useEffect(b,Vm(I))}var Gm=function(I){var A=I.points,D=I.bounds,F=I.zoom,N=I.options,oe=Te.exports.useRef(),a=Te.exports.useRef(),Y=Te.exports.useState([]),te=Y[0],fe=Y[1],ue=Math.round(F);return Nm(function(){(!oe.current||!Io(a.current,A)||!Io(oe.current.options,N))&&(oe.current=new Bm(N),oe.current.load(A)),D&&fe(oe.current.getClusters(D,ue)),a.current=A},[A,D,ue,N]),{clusters:te,supercluster:oe.current}};const qm=Zt.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(l,t,n){this._canvas.width=n*l,this._canvas.height=n*t,this._canvas.style.width=`${l}px`,this._canvas.style.height=`${t}px`}_setupPainter(){const l=a.extend({},Q.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),t=this._canvas.getContext("webgl",l)||this._canvas.getContext("experimental-webgl",l);t?(this.painter=new Cs(t,this.transform),a.exported$1.testSupport(t)):this.fire(new a.ErrorEvent(new Error("Failed to initialize WebGL")))}_contextLost(l){l.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new a.Event("webglcontextlost",{originalEvent:l}))}_contextRestored(l){this._setupPainter(),this.resize(),this._update(),this.fire(new a.Event("webglcontextrestored",{originalEvent:l}))}_onMapScroll(l){if(l.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}_onCooperativeGesture(l,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(l){return this.style?(this._styleDirty=this._styleDirty||l,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(l){return this._update(),this._renderTaskQueue.add(l)}_cancelRenderFrame(l){this._renderTaskQueue.remove(l)}_render(l){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=a.exported.now()),this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(l),this._removed)return;let u=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const f=this.transform.zoom,_=a.exported.now();this.style.zoomHistory.update(f,_);const y=new a.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 a.Event("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,a.PerformanceUtils.mark(a.PerformanceMarkers.load),this.fire(new a.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=a.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 a.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 a.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 a.Event("idle")),!this._loaded||this._fullyLoaded||p||(this._fullyLoaded=!0,a.PerformanceUtils.mark(a.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!="undefined"&&(removeEventListener("resize",this._onWindowResize,!1),removeEventListener("orientationchange",this._onWindowResize,!1),removeEventListener("online",this._onWindowOnline,!1));const l=this.painter.context.gl.getExtension("WEBGL_lose_context");l&&l.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),ie.remove(this._canvasContainer),ie.remove(this._controlContainer),this._cooperativeGestures&&ie.remove(this._cooperativeGesturesScreen),this._container.classList.remove("maplibregl-map","mapboxgl-map"),a.PerformanceUtils.clearMetrics(),this._removed=!0,this.fire(new a.Event("remove"))}triggerRepaint(){this.style&&!this._frame&&(this._frame=a.exported.frame(l=>{a.PerformanceUtils.frame(l),this._frame=null,this._render(l)}))}_onWindowOnline(){this._update()}_onWindowResize(l){this._trackResize&&this.resize({originalEvent:l})._update()}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(l){this._showTileBoundaries!==l&&(this._showTileBoundaries=l,this._update())}get showPadding(){return!!this._showPadding}set showPadding(l){this._showPadding!==l&&(this._showPadding=l,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(l){this._showCollisionBoxes!==l&&(this._showCollisionBoxes=l,l?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(l){this._showOverdrawInspector!==l&&(this._showOverdrawInspector=l,this._update())}get repaint(){return!!this._repaint}set repaint(l){this._repaint!==l&&(this._repaint=l,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(l){this._vertices=l,this._update()}_setCacheLimits(l,t){a.setCacheLimits(l,t)}get version(){return"2.4.0"}},NavigationControl:class{constructor(l){this.options=a.extend({},Hl,l),this._container=ie.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",t=>t.preventDefault()),this.options.showZoom&&(a.bindAll(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in mapboxgl-ctrl-zoom-in",t=>this._map.zoomIn({},{originalEvent:t})),ie.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})),ie.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(a.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=ie.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){const l=this._map.getZoom(),t=l===this._map.getMaxZoom(),n=l===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 l=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=l}onAdd(l){return this._map=l,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 fr(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){ie.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(l,t){const n=ie.create("button",l,this._container);return n.type="button",n.addEventListener("click",t),n}_setButtonTitle(l,t){const n=this._map._getUIString(`NavigationControl.${t}`);l.title=n,l.setAttribute("aria-label",n)}},GeolocateControl:class extends a.Evented{constructor(l){super(),this.options=a.extend({},Fs,l),a.bindAll(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker"],this)}onAdd(l){var t;return this._map=l,this._container=ie.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),t=this._setupUI,qr!==void 0?t(qr):window.navigator.permissions!==void 0?window.navigator.permissions.query({name:"geolocation"}).then(n=>{qr=n.state!=="denied",t(qr)}):(qr=!!window.navigator.geolocation,t(qr)),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(),ie.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,mi=0,Zr=!1}_isOutOfMapMaxBounds(l){const t=this._map.getMaxBounds(),n=l.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(l){if(this._map){if(this._isOutOfMapMaxBounds(l))return this._setErrorState(),this.fire(new a.Event("outofmaxbounds",l)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=l,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(l),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(l),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale","mapboxgl-user-location-dot-stale"),this.fire(new a.Event("geolocate",l)),this._finish()}}_updateCamera(l){const t=new a.LngLat(l.coords.longitude,l.coords.latitude),n=l.coords.accuracy,s=this._map.getBearing(),u=a.extend({bearing:s},this.options.fitBoundsOptions);this._map.fitBounds(t.toBounds(n),u,{geolocateSource:!0})}_updateMarker(l){if(l){const t=new a.LngLat(l.coords.longitude,l.coords.latitude);this._accuracyCircleMarker.setLngLat(t).addTo(this._map),this._userLocationDotMarker.setLngLat(t).addTo(this._map),this._accuracy=l.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){const l=this._map._container.clientHeight/2,t=this._map.unproject([0,l]),n=this._map.unproject([1,l]),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(l){if(this._map){if(this.options.trackUserLocation)if(l.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(l.code===3&&Zr)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 a.Event("error",l)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(l){if(this._container.addEventListener("contextmenu",t=>t.preventDefault()),this._geolocateButton=ie.create("button","maplibregl-ctrl-geolocate mapboxgl-ctrl-geolocate",this._container),ie.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",l===!1){a.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=ie.create("div","maplibregl-user-location-dot mapboxgl-user-location-dot"),this._userLocationDotMarker=new Fn(this._dotElement),this._circleElement=ie.create("div","maplibregl-user-location-accuracy-circle mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Fn({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 a.Event("trackuserlocationend")))})}trigger(){if(!this._setup)return a.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 a.Event("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":mi--,Zr=!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 a.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 a.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 l;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),mi++,mi>1?(l={maximumAge:6e5,timeout:0},Zr=!0):(l=this.options.positionOptions,Zr=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,l)}}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:yo,LogoControl:Xo,ScaleControl:class{constructor(l){this.options=a.extend({},mr,l),a.bindAll(["_onMove","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_onMove(){Ha(this._map,this._container,this.options)}onAdd(l){return this._map=l,this._container=ie.create("div","maplibregl-ctrl maplibregl-ctrl-scale mapboxgl-ctrl mapboxgl-ctrl-scale",l.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){ie.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}setUnit(l){this.options.unit=l,Ha(this._map,this._container,this.options)}},FullscreenControl:class{constructor(l){this._fullscreen=!1,l&&l.container&&(l.container instanceof HTMLElement?this._container=l.container:a.warnOnce("Full screen control 'container' must be a DOM element.")),a.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(l){return this._map=l,this._container||(this._container=this._map.getContainer()),this._controlContainer=ie.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",a.warnOnce("This device does not support fullscreen mode.")),this._controlContainer}onRemove(){ie.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 l=this._fullscreenButton=ie.create("button","maplibregl-ctrl-fullscreen mapboxgl-ctrl-fullscreen",this._controlContainer);ie.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",l).setAttribute("aria-hidden","true"),l.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){const l=this._getTitle();this._fullscreenButton.setAttribute("aria-label",l),this._fullscreenButton.title=l}_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(l){this.options=l,a.bindAll(["_toggleTerrain","_updateTerrainIcon"],this)}onAdd(l){return this._map=l,this._container=ie.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._terrainButton=ie.create("button","maplibregl-ctrl-terrain mapboxgl-ctrl-terrain",this._container),ie.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(){ie.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 a.Evented{constructor(l){super(),this.options=a.extend(Object.create(Xt),l),a.bindAll(["_update","_onClose","remove","_onMouseMove","_onMouseUp","_onDrag"],this)}addTo(l){return this._map&&this.remove(),this._map=l,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 a.Event("open")),this}isOpen(){return!!this._map}remove(){return this._content&&ie.remove(this._content),this._container&&(ie.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 a.Event("close")),this}getLngLat(){return this._lngLat}setLngLat(l){return this._lngLat=a.LngLat.convert(l),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(l){return this.setDOMContent(document.createTextNode(l))}setHTML(l){const t=document.createDocumentFragment(),n=document.createElement("body");let s;for(n.innerHTML=l;s=n.firstChild,s;)t.appendChild(s);return this.setDOMContent(t)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(l){return this.options.maxWidth=l,this._update(),this}setDOMContent(l){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=ie.create("div","maplibregl-popup-content mapboxgl-popup-content",this._container);return this._content.appendChild(l),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(l){this._container&&this._container.classList.add(l)}removeClassName(l){this._container&&this._container.classList.remove(l)}setOffset(l){return this.options.offset=l,this._update(),this}toggleClassName(l){if(this._container)return this._container.classList.toggle(l)}_createCloseButton(){this.options.closeButton&&(this._closeButton=ie.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="&#215;",this._closeButton.addEventListener("click",this._onClose))}_onMouseUp(l){this._update(l.point)}_onMouseMove(l){this._update(l.point)}_onDrag(l){this._update(l.point)}_update(l){if(!this._map||!this._lngLat&&!this._trackPointer||!this._content||(this._container||(this._container=ie.create("div","maplibregl-popup mapboxgl-popup",this._map.getContainer()),this._tip=ie.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=xo(this._lngLat,this._pos,this._map.transform)),this._trackPointer&&!l))return;const t=this._pos=this._trackPointer&&l?l:this._map.project(this._lngLat);let n=this.options.anchor;const s=Os(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();ie.setTransform(this._container,`${Ze[n]} translate(${u.x}px,${u.y}px)`),Je(this._container,n,"popup")}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const l=this._container.querySelector(Qt);l&&l.focus()}_onClose(){this.remove()}},Marker:Fn,Style:_i,LngLat:a.LngLat,LngLatBounds:a.LngLatBounds,Point:a.pointGeometry,MercatorCoordinate:a.MercatorCoordinate,Evented:a.Evented,AJAXError:a.AJAXError,config:a.config,CanvasSource:Kr,GeoJSONSource:Ri,ImageSource:Ci,RasterDEMTileSource:Xe,RasterTileSource:pi,VectorTileSource:Rt,VideoSource:Ai,prewarm:function(){vn().acquire(br)},clearPrewarmedResources:function(){const l=Br;l&&(l.isPreloaded()&&l.numActive()===1?(l.release(br),Br=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 Bi.workerCount},set workerCount(l){Bi.workerCount=l},get maxParallelImageRequests(){return a.config.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(l){a.config.MAX_PARALLEL_IMAGE_REQUESTS=l},clearStorage(l){a.clearTileCache(l)},workerUrl:"",addProtocol(l,t){a.config.REGISTERED_PROTOCOLS[l]=t},removeProtocol(l){delete a.config.REGISTERED_PROTOCOLS[l]}};return Ji.extend(sn,{isSafari:a.isSafari,getPerformanceMetrics:a.PerformanceUtils.getPerformanceMetrics}),sn});var oe=F;return oe})})(rp);var om=rp.exports;function op(w,E,A){A===void 0&&(A={});var k={type:"Feature"};return(A.id===0||A.id)&&(k.id=A.id),A.bbox&&(k.bbox=A.bbox),k.properties=E||{},k.geometry=w,k}function kh(w,E,A){if(A===void 0&&(A={}),!w)throw new Error("coordinates is required");if(!Array.isArray(w))throw new Error("coordinates must be an Array");if(w.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Dh(w[0])||!Dh(w[1]))throw new Error("coordinates must contain numbers");var k={type:"Point",coordinates:w};return op(k,E,A)}function sm(w,E,A){A===void 0&&(A={});var k={type:"MultiPoint",coordinates:w};return op(k,E,A)}function Dh(w){return!isNaN(w)&&w!==null&&!Array.isArray(w)}function sp(w,E,A){if(w!==null)for(var k,F,N,oe,a,Q,te,fe=0,ue=0,ie,Ge=w.type,Ne=Ge==="FeatureCollection",Be=Ge==="Feature",tt=Ne?w.features.length:1,Ye=0;Ye<tt;Ye++){te=Ne?w.features[Ye].geometry:Be?w.geometry:w,ie=te?te.type==="GeometryCollection":!1,a=ie?te.geometries.length:1;for(var Qe=0;Qe<a;Qe++){var pt=0,gt=0;if(oe=ie?te.geometries[Qe]:te,oe!==null){Q=oe.coordinates;var at=oe.type;switch(fe=A&&(at==="Polygon"||at==="MultiPolygon")?1:0,at){case null:break;case"Point":if(E(Q,ue,Ye,pt,gt)===!1)return!1;ue++,pt++;break;case"LineString":case"MultiPoint":for(k=0;k<Q.length;k++){if(E(Q[k],ue,Ye,pt,gt)===!1)return!1;ue++,at==="MultiPoint"&&pt++}at==="LineString"&&pt++;break;case"Polygon":case"MultiLineString":for(k=0;k<Q.length;k++){for(F=0;F<Q[k].length-fe;F++){if(E(Q[k][F],ue,Ye,pt,gt)===!1)return!1;ue++}at==="MultiLineString"&&pt++,at==="Polygon"&&gt++}at==="Polygon"&&pt++;break;case"MultiPolygon":for(k=0;k<Q.length;k++){for(gt=0,F=0;F<Q[k].length;F++){for(N=0;N<Q[k][F].length-fe;N++){if(E(Q[k][F][N],ue,Ye,pt,gt)===!1)return!1;ue++}gt++}pt++}break;case"GeometryCollection":for(k=0;k<oe.geometries.length;k++)if(sp(oe.geometries[k],E,A)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function Uc(w){var E=[1/0,1/0,-1/0,-1/0];return sp(w,function(A){E[0]>A[0]&&(E[0]=A[0]),E[1]>A[1]&&(E[1]=A[1]),E[2]<A[0]&&(E[2]=A[0]),E[3]<A[1]&&(E[3]=A[1])}),E}Uc.default=Uc;const am={x:0,y:0,width:0,height:0,top:0,left:0,bottom:0,right:0},lm=()=>{const[w,E]=Te.exports.useState(null),[A,k]=Te.exports.useState(am),F=Te.exports.useMemo(()=>new window.ResizeObserver(N=>{if(N[0]){const{x:oe,y:a,width:Q,height:te,top:fe,left:ue,bottom:ie,right:Ge}=N[0].contentRect;k({x:oe,y:a,width:Q,height:te,top:fe,left:ue,bottom:ie,right:Ge})}}),[]);return Te.exports.useLayoutEffect(()=>{if(!!w)return F.observe(w),()=>{F.disconnect()}},[w]),[E,A,w]};var cm="Expected a function",Lh=0/0,um="[object Symbol]",hm=/^\s+|\s+$/g,pm=/^[-+]0x[0-9a-f]+$/i,dm=/^0b[01]+$/i,fm=/^0o[0-7]+$/i,mm=parseInt,gm=typeof sa=="object"&&sa&&sa.Object===Object&&sa,_m=typeof self=="object"&&self&&self.Object===Object&&self,ym=gm||_m||Function("return this")(),xm=Object.prototype,vm=xm.toString,bm=Math.max,wm=Math.min,Bc=function(){return ym.Date.now()};function Tm(w,E,A){var k,F,N,oe,a,Q,te=0,fe=!1,ue=!1,ie=!0;if(typeof w!="function")throw new TypeError(cm);E=Rh(E)||0,Vc(A)&&(fe=!!A.leading,ue="maxWait"in A,N=ue?bm(Rh(A.maxWait)||0,E):N,ie="trailing"in A?!!A.trailing:ie);function Ge(Et){var Ht=k,Jt=F;return k=F=void 0,te=Et,oe=w.apply(Jt,Ht),oe}function Ne(Et){return te=Et,a=setTimeout(Ye,E),fe?Ge(Et):oe}function Be(Et){var Ht=Et-Q,Jt=Et-te,vr=E-Ht;return ue?wm(vr,N-Jt):vr}function tt(Et){var Ht=Et-Q,Jt=Et-te;return Q===void 0||Ht>=E||Ht<0||ue&&Jt>=N}function Ye(){var Et=Bc();if(tt(Et))return Qe(Et);a=setTimeout(Ye,Be(Et))}function Qe(Et){return a=void 0,ie&&k?Ge(Et):(k=F=void 0,oe)}function pt(){a!==void 0&&clearTimeout(a),te=0,k=Q=F=a=void 0}function gt(){return a===void 0?oe:Qe(Bc())}function at(){var Et=Bc(),Ht=tt(Et);if(k=arguments,F=this,Q=Et,Ht){if(a===void 0)return Ne(Q);if(ue)return a=setTimeout(Ye,E),Ge(Q)}return a===void 0&&(a=setTimeout(Ye,E)),oe}return at.cancel=pt,at.flush=gt,at}function Vc(w){var E=typeof w;return!!w&&(E=="object"||E=="function")}function Em(w){return!!w&&typeof w=="object"}function Sm(w){return typeof w=="symbol"||Em(w)&&vm.call(w)==um}function Rh(w){if(typeof w=="number")return w;if(Sm(w))return Lh;if(Vc(w)){var E=typeof w.valueOf=="function"?w.valueOf():w;w=Vc(E)?E+"":E}if(typeof w!="string")return w===0?w:+w;w=w.replace(hm,"");var A=dm.test(w);return A||fm.test(w)?mm(w.slice(2),A?2:8):pm.test(w)?Lh:+w}var Im=Tm;const Cm=()=>{const[w,E]=Te.exports.useState(!1);return Te.exports.useLayoutEffect(()=>{const A=()=>{E(window.innerWidth<Xh.screenSizes.mobileL)};return window.addEventListener("resize",Im(A,250)),A(),()=>window.removeEventListener("resize",A)},[]),w},ap={all:()=>["pois"],list:w=>[...ap.all(),w]},{scorePois:Am}=Co.Constants;function lp(){var a;const{client:w}=la(),{sdkState:E}=Sl(),A=qc(E.options,250),{activeScore:k}=Zn(),F=k?Am[k]:void 0,oe={...Te.exports.useMemo(()=>A!=null&&A.marker?A.marker:{lat:A==null?void 0:A.lat,lng:A==null?void 0:A.lng},[A]),limit:10,radius:2e3,include:F};return Zc(ap.list(oe),async()=>w.getPois(oe),{enabled:!!oe&&!!((a=oe.include)!=null&&a.length)&&!!oe.lat&&!!oe.lng})}const cp={all:()=>["schools"],list:w=>[...cp.all(),w]};function up(){const{client:w}=la(),{sdkState:E}=Sl(),A=qc(E.options,250),F={...Te.exports.useMemo(()=>A!=null&&A.marker?A.marker:{lat:A==null?void 0:A.lat,lng:A==null?void 0:A.lng},[A]),limit:10,radius:2e3};return Zc(cp.list(F),async()=>w.getSchools(F),{enabled:!!F&&!!F.lat&&!!F.lng})}const hp=nt.createContext({}),pp=()=>Te.exports.useContext(hp),Mm=({children:w,mapRef:E,mapPadding:A})=>Ae(hp.Provider,{value:{mapRef:E,mapPadding:A},children:w}),dp=nt.memo(({marker:w})=>Ae($c,{latitude:w.lat,longitude:w.lng,style:{zIndex:1},children:Ae(Sf.Root,{options:{style:"pin"}})}));dp.displayName="Pin";function Nc(w,E,A,k,F,N){if(F-k<=A)return;const oe=k+F>>1;fp(w,E,oe,k,F,N%2),Nc(w,E,A,k,oe-1,N+1),Nc(w,E,A,oe+1,F,N+1)}function fp(w,E,A,k,F,N){for(;F>k;){if(F-k>600){const te=F-k+1,fe=A-k+1,ue=Math.log(te),ie=.5*Math.exp(2*ue/3),Ge=.5*Math.sqrt(ue*ie*(te-ie)/te)*(fe-te/2<0?-1:1),Ne=Math.max(k,Math.floor(A-fe*ie/te+Ge)),Be=Math.min(F,Math.floor(A+(te-fe)*ie/te+Ge));fp(w,E,A,Ne,Be,N)}const oe=E[2*A+N];let a=k,Q=F;for(na(w,E,k,A),E[2*F+N]>oe&&na(w,E,k,F);a<Q;){for(na(w,E,a,Q),a++,Q--;E[2*a+N]<oe;)a++;for(;E[2*Q+N]>oe;)Q--}E[2*k+N]===oe?na(w,E,k,Q):(Q++,na(w,E,Q,F)),Q<=A&&(k=Q+1),A<=Q&&(F=Q-1)}}function na(w,E,A,k){Fc(w,A,k),Fc(E,2*A,2*k),Fc(E,2*A+1,2*k+1)}function Fc(w,E,A){const k=w[E];w[E]=w[A],w[A]=k}function Pm(w,E,A,k,F,N,oe){const a=[0,w.length-1,0],Q=[];let te,fe;for(;a.length;){const ue=a.pop(),ie=a.pop(),Ge=a.pop();if(ie-Ge<=oe){for(let tt=Ge;tt<=ie;tt++)te=E[2*tt],fe=E[2*tt+1],te>=A&&te<=F&&fe>=k&&fe<=N&&Q.push(w[tt]);continue}const Ne=Math.floor((Ge+ie)/2);te=E[2*Ne],fe=E[2*Ne+1],te>=A&&te<=F&&fe>=k&&fe<=N&&Q.push(w[Ne]);const Be=(ue+1)%2;(ue===0?A<=te:k<=fe)&&(a.push(Ge),a.push(Ne-1),a.push(Be)),(ue===0?F>=te:N>=fe)&&(a.push(Ne+1),a.push(ie),a.push(Be))}return Q}function zm(w,E,A,k,F,N){const oe=[0,w.length-1,0],a=[],Q=F*F;for(;oe.length;){const te=oe.pop(),fe=oe.pop(),ue=oe.pop();if(fe-ue<=N){for(let tt=ue;tt<=fe;tt++)Bh(E[2*tt],E[2*tt+1],A,k)<=Q&&a.push(w[tt]);continue}const ie=Math.floor((ue+fe)/2),Ge=E[2*ie],Ne=E[2*ie+1];Bh(Ge,Ne,A,k)<=Q&&a.push(w[ie]);const Be=(te+1)%2;(te===0?A-F<=Ge:k-F<=Ne)&&(oe.push(ue),oe.push(ie-1),oe.push(Be)),(te===0?A+F>=Ge:k+F>=Ne)&&(oe.push(ie+1),oe.push(fe),oe.push(Be))}return a}function Bh(w,E,A,k){const F=w-A,N=E-k;return F*F+N*N}const km=w=>w[0],Dm=w=>w[1];class Fh{constructor(E,A=km,k=Dm,F=64,N=Float64Array){this.nodeSize=F,this.points=E;const oe=E.length<65536?Uint16Array:Uint32Array,a=this.ids=new oe(E.length),Q=this.coords=new N(E.length*2);for(let te=0;te<E.length;te++)a[te]=te,Q[2*te]=A(E[te]),Q[2*te+1]=k(E[te]);Nc(a,Q,F,0,a.length-1,0)}range(E,A,k,F){return Pm(this.ids,this.coords,E,A,k,F,this.nodeSize)}within(E,A,k){return zm(this.ids,this.coords,E,A,k,this.nodeSize)}}const Lm={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:w=>w},Tl=Math.fround||(w=>E=>(w[0]=+E,w[0]))(new Float32Array(1));class Rm{constructor(E){this.options=aa(Object.create(Lm),E),this.trees=new Array(this.options.maxZoom+1)}load(E){const{log:A,minZoom:k,maxZoom:F,nodeSize:N}=this.options;A&&console.time("total time");const oe=`prepare ${E.length} points`;A&&console.time(oe),this.points=E;let a=[];for(let Q=0;Q<E.length;Q++)!E[Q].geometry||a.push(Fm(E[Q],Q));this.trees[F+1]=new Fh(a,$h,Uh,N,Float32Array),A&&console.timeEnd(oe);for(let Q=F;Q>=k;Q--){const te=+Date.now();a=this._cluster(a,Q),this.trees[Q]=new Fh(a,$h,Uh,N,Float32Array),A&&console.log("z%d: %d clusters in %dms",Q,a.length,+Date.now()-te)}return A&&console.timeEnd("total time"),this}getClusters(E,A){let k=((E[0]+180)%360+360)%360-180;const F=Math.max(-90,Math.min(90,E[1]));let N=E[2]===180?180:((E[2]+180)%360+360)%360-180;const oe=Math.max(-90,Math.min(90,E[3]));if(E[2]-E[0]>=360)k=-180,N=180;else if(k>N){const fe=this.getClusters([k,F,180,oe],A),ue=this.getClusters([-180,F,N,oe],A);return fe.concat(ue)}const a=this.trees[this._limitZoom(A)],Q=a.range(vl(k),bl(oe),vl(N),bl(F)),te=[];for(const fe of Q){const ue=a.points[fe];te.push(ue.numPoints?Oh(ue):this.points[ue.index])}return te}getChildren(E){const A=this._getOriginId(E),k=this._getOriginZoom(E),F="No cluster with the specified id.",N=this.trees[k];if(!N)throw new Error(F);const oe=N.points[A];if(!oe)throw new Error(F);const a=this.options.radius/(this.options.extent*Math.pow(2,k-1)),Q=N.within(oe.x,oe.y,a),te=[];for(const fe of Q){const ue=N.points[fe];ue.parentId===E&&te.push(ue.numPoints?Oh(ue):this.points[ue.index])}if(te.length===0)throw new Error(F);return te}getLeaves(E,A,k){A=A||10,k=k||0;const F=[];return this._appendLeaves(F,E,A,k,0),F}getTile(E,A,k){const F=this.trees[this._limitZoom(E)],N=Math.pow(2,E),{extent:oe,radius:a}=this.options,Q=a/oe,te=(k-Q)/N,fe=(k+1+Q)/N,ue={features:[]};return this._addTileFeatures(F.range((A-Q)/N,te,(A+1+Q)/N,fe),F.points,A,k,N,ue),A===0&&this._addTileFeatures(F.range(1-Q/N,te,1,fe),F.points,N,k,N,ue),A===N-1&&this._addTileFeatures(F.range(0,te,Q/N,fe),F.points,-1,k,N,ue),ue.features.length?ue:null}getClusterExpansionZoom(E){let A=this._getOriginZoom(E)-1;for(;A<=this.options.maxZoom;){const k=this.getChildren(E);if(A++,k.length!==1)break;E=k[0].properties.cluster_id}return A}_appendLeaves(E,A,k,F,N){const oe=this.getChildren(A);for(const a of oe){const Q=a.properties;if(Q&&Q.cluster?N+Q.point_count<=F?N+=Q.point_count:N=this._appendLeaves(E,Q.cluster_id,k,F,N):N<F?N++:E.push(a),E.length===k)break}return N}_addTileFeatures(E,A,k,F,N,oe){for(const a of E){const Q=A[a],te=Q.numPoints;let fe,ue,ie;if(te)fe=mp(Q),ue=Q.x,ie=Q.y;else{const Be=this.points[Q.index];fe=Be.properties,ue=vl(Be.geometry.coordinates[0]),ie=bl(Be.geometry.coordinates[1])}const Ge={type:1,geometry:[[Math.round(this.options.extent*(ue*N-k)),Math.round(this.options.extent*(ie*N-F))]],tags:fe};let Ne;te?Ne=Q.id:this.options.generateId?Ne=Q.index:this.points[Q.index].id&&(Ne=this.points[Q.index].id),Ne!==void 0&&(Ge.id=Ne),oe.features.push(Ge)}}_limitZoom(E){return Math.max(this.options.minZoom,Math.min(Math.floor(+E),this.options.maxZoom+1))}_cluster(E,A){const k=[],{radius:F,extent:N,reduce:oe,minPoints:a}=this.options,Q=F/(N*Math.pow(2,A));for(let te=0;te<E.length;te++){const fe=E[te];if(fe.zoom<=A)continue;fe.zoom=A;const ue=this.trees[A+1],ie=ue.within(fe.x,fe.y,Q),Ge=fe.numPoints||1;let Ne=Ge;for(const Be of ie){const tt=ue.points[Be];tt.zoom>A&&(Ne+=tt.numPoints||1)}if(Ne>Ge&&Ne>=a){let Be=fe.x*Ge,tt=fe.y*Ge,Ye=oe&&Ge>1?this._map(fe,!0):null;const Qe=(te<<5)+(A+1)+this.points.length;for(const pt of ie){const gt=ue.points[pt];if(gt.zoom<=A)continue;gt.zoom=A;const at=gt.numPoints||1;Be+=gt.x*at,tt+=gt.y*at,gt.parentId=Qe,oe&&(Ye||(Ye=this._map(fe,!0)),oe(Ye,this._map(gt)))}fe.parentId=Qe,k.push(Bm(Be/Ne,tt/Ne,Qe,Ne,Ye))}else if(k.push(fe),Ne>1)for(const Be of ie){const tt=ue.points[Be];tt.zoom<=A||(tt.zoom=A,k.push(tt))}}return k}_getOriginId(E){return E-this.points.length>>5}_getOriginZoom(E){return(E-this.points.length)%32}_map(E,A){if(E.numPoints)return A?aa({},E.properties):E.properties;const k=this.points[E.index].properties,F=this.options.map(k);return A&&F===k?aa({},F):F}}function Bm(w,E,A,k,F){return{x:Tl(w),y:Tl(E),zoom:1/0,id:A,parentId:-1,numPoints:k,properties:F}}function Fm(w,E){const[A,k]=w.geometry.coordinates;return{x:Tl(vl(A)),y:Tl(bl(k)),zoom:1/0,index:E,parentId:-1}}function Oh(w){return{type:"Feature",id:w.id,properties:mp(w),geometry:{type:"Point",coordinates:[Om(w.x),$m(w.y)]}}}function mp(w){const E=w.numPoints,A=E>=1e4?`${Math.round(E/1e3)}k`:E>=1e3?`${Math.round(E/100)/10}k`:E;return aa(aa({},w.properties),{cluster:!0,cluster_id:w.id,point_count:E,point_count_abbreviated:A})}function vl(w){return w/360+.5}function bl(w){const E=Math.sin(w*Math.PI/180),A=.5-.25*Math.log((1+E)/(1-E))/Math.PI;return A<0?0:A>1?1:A}function Om(w){return(w-.5)*360}function $m(w){const E=(180-w*360)*Math.PI/180;return 360*Math.atan(Math.exp(E))/Math.PI-90}function aa(w,E){for(const A in E)w[A]=E[A];return w}function $h(w){return w.x}function Uh(w){return w.y}var Vh=Object.prototype.hasOwnProperty;function Nh(w,E,A){for(A of w.keys())if(Io(A,E))return A}function Io(w,E){var A,k,F;if(w===E)return!0;if(w&&E&&(A=w.constructor)===E.constructor){if(A===Date)return w.getTime()===E.getTime();if(A===RegExp)return w.toString()===E.toString();if(A===Array){if((k=w.length)===E.length)for(;k--&&Io(w[k],E[k]););return k===-1}if(A===Set){if(w.size!==E.size)return!1;for(k of w)if(F=k,F&&typeof F=="object"&&(F=Nh(E,F),!F)||!E.has(F))return!1;return!0}if(A===Map){if(w.size!==E.size)return!1;for(k of w)if(F=k[0],F&&typeof F=="object"&&(F=Nh(E,F),!F)||!Io(k[1],E.get(F)))return!1;return!0}if(A===ArrayBuffer)w=new Uint8Array(w),E=new Uint8Array(E);else if(A===DataView){if((k=w.byteLength)===E.byteLength)for(;k--&&w.getInt8(k)===E.getInt8(k););return k===-1}if(ArrayBuffer.isView(w)){if((k=w.byteLength)===E.byteLength)for(;k--&&w[k]===E[k];);return k===-1}if(!A||typeof w=="object"){k=0;for(A in w)if(Vh.call(w,A)&&++k&&!Vh.call(E,A)||!(A in E)||!Io(w[A],E[A]))return!1;return Object.keys(E).length===k}}return w!==w&&E!==E}function Um(w){var E=Te.exports.useRef(w),A=Te.exports.useRef(0);return Io(w,E.current)||(E.current=w,A.current+=1),Te.exports.useMemo(function(){return E.current},[A.current])}function Vm(w,E){return Te.exports.useEffect(w,Um(E))}var Nm=function(E){var A=E.points,k=E.bounds,F=E.zoom,N=E.options,oe=Te.exports.useRef(),a=Te.exports.useRef(),Q=Te.exports.useState([]),te=Q[0],fe=Q[1],ue=Math.round(F);return Vm(function(){(!oe.current||!Io(a.current,A)||!Io(oe.current.options,N))&&(oe.current=new Rm(N),oe.current.load(A)),k&&fe(oe.current.getClusters(k,ue)),a.current=A},[A,k,ue,N]),{clusters:te,supercluster:oe.current}};const Gm=$t.div`
580
580
  border-radius: 50%;
581
581
  background: linear-gradient(
582
582
  to top,
583
- ${Tt["--ll-color-primary-variant1"]},
584
- ${Tt["--ll-color-primary"]}
583
+ ${yt["--ll-color-primary-variant1"]},
584
+ ${yt["--ll-color-primary"]}
585
585
  );
586
- color: ${Tt["--ll-color-on-primary"]};
587
- height: ${({diameter:b})=>b}px;
588
- width: ${({diameter:b})=>b}px;
586
+ color: ${yt["--ll-color-on-primary"]};
587
+ height: ${({diameter:w})=>w}px;
588
+ width: ${({diameter:w})=>w}px;
589
589
  display: flex;
590
590
  justify-content: center;
591
591
  align-items: center;
592
592
  line-height: 1;
593
- font-family: ${Tt["--ll-font-family"]};
594
- font-size: ${({diameter:b})=>b/2.5}px;
593
+ font-family: ${yt["--ll-font-family"]};
594
+ font-size: ${({diameter:w})=>w/2.5}px;
595
595
  border: 2px solid #fff;
596
- box-shadow: ${Tt["--ll-shadow-small"]};
596
+ box-shadow: ${yt["--ll-shadow-small"]};
597
597
  cursor: default;
598
- `,Zm=({cluster:b,pointsCount:I,onClick:A})=>{const D=b.properties.point_count,F=20+D/I*25;return Se(qm,{diameter:F,onClick:()=>A&&A(b),children:b.properties.point_count})};function jm(b){return b.properties.cluster!==void 0}const gp=nt.memo(({rect:b,zoom:I,mapRef:A,points:D,isMobile:F,activePOI:N,hoveredPOI:oe,isMapMoving:a,setActivePOI:Y})=>{var ie;const te=(ie=A==null?void 0:A.current)==null?void 0:ie.getMap().getBounds().toArray().flat(),{clusters:fe,supercluster:ue}=Gm({points:D,bounds:te,zoom:I,options:{radius:50,maxZoom:18}});return Se(Il,{children:fe.map((Ge,$e)=>{const[Ue,et]=Ge.geometry.coordinates;if(jm(Ge))return Se($c,{latitude:et,longitude:Ue,children:Se(Zm,{cluster:Ge,pointsCount:D.length,onClick:()=>{var gt;const at=Math.min(ue.getClusterExpansionZoom(Ge.id),20);(gt=A.current)==null||gt.flyTo({zoom:at,center:[Ue,et],duration:1e3})}})},`cluster-${Ge.id}`);const{poi:Ke,type:tt}=Ge.properties,lt=N===Ke,It=oe===Ke;return Se($c,{latitude:Ke.lat,longitude:Ke.lng,style:{zIndex:lt?1:0},children:Ri(Lc.Root,{options:{type:tt,poi:Ke,isOpen:a?!1:lt,isHovered:It,side:"top",collisionPadding:F?{top:b.height+32,bottom:os*2,left:os*2,right:os*2}:{left:b.width+32,right:os*2,top:os*2,bottom:os*2}},onChange:at=>{at.type==="open-change"&&at.data&&Y(Ke)},children:[Se(Lc.Marker,{}),Se(Lc.Content,{})]})},`${Ke.name}-${Ke.lat}-${Ke.lng}-${$e}`)})})});gp.displayName="Markers";const _p={all:()=>["scores"],list:b=>[..._p.all(),b]};function Hc(b){const{client:I}=El(),{sdkState:A}=Sl(),D=qc(A.options,250),N={...Te.exports.useMemo(()=>D!=null&&D.marker?D.marker:{lat:D==null?void 0:D.lat,lng:D==null?void 0:D.lng},[D]),geographyLevels:["10","30"],locationScoresRounding:!1,include:b};return Zc(_p.list(N),async()=>I.getScores(N),{enabled:!!N})}const Xm=Zt.div`
599
- padding: ${Tt["--ll-spacing-small"]} ${Tt["--ll-spacing-medium"]};
600
- background-color: ${Tt["--ll-color-surface"]};
598
+ `,qm=({cluster:w,pointsCount:E,onClick:A})=>{const k=w.properties.point_count,F=20+k/E*25;return Ae(Gm,{diameter:F,onClick:()=>A&&A(w),children:w.properties.point_count})};function Zm(w){return w.properties.cluster!==void 0}const gp=nt.memo(({rect:w,zoom:E,mapRef:A,points:k,isMobile:F,activePOI:N,hoveredPOI:oe,isMapMoving:a,setActivePOI:Q})=>{var ie;const te=(ie=A==null?void 0:A.current)==null?void 0:ie.getMap().getBounds().toArray().flat(),{clusters:fe,supercluster:ue}=Nm({points:k,bounds:te,zoom:E,options:{radius:50,maxZoom:18}});return Ae(Il,{children:fe.map((Ge,Ne)=>{const[Be,tt]=Ge.geometry.coordinates;if(Zm(Ge))return Ae($c,{latitude:tt,longitude:Be,children:Ae(qm,{cluster:Ge,pointsCount:k.length,onClick:()=>{var Et;const at=Math.min(ue.getClusterExpansionZoom(Ge.id),20);(Et=A.current)==null||Et.flyTo({zoom:at,center:[Be,tt],duration:1e3})}})},`cluster-${Ge.id}`);const{poi:Ye,type:Qe}=Ge.properties,pt=N===Ye,gt=oe===Ye;return Ae($c,{latitude:Ye.lat,longitude:Ye.lng,style:{zIndex:pt?1:0},children:Xi(Lc.Root,{options:{type:Qe,poi:Ye,isOpen:a?!1:pt,isHovered:gt,side:"top",collisionPadding:F?{top:w.height+32,bottom:os*2,left:os*2,right:os*2}:{left:w.width+32,right:os*2,top:os*2,bottom:os*2}},onChange:at=>{at.type==="open-change"&&(at.data?setTimeout(()=>{Q(Ye)},0):pt&&Q(void 0))},children:[Ae(Lc.Marker,{}),Ae(Lc.Content,{})]})},`${Ye.name}-${Ye.lat}-${Ye.lng}-${Ne}`)})})});gp.displayName="Markers";const _p={all:()=>["scores"],list:w=>[..._p.all(),w]};function Hc(w){const{client:E}=la(),{sdkState:A}=Sl(),k=qc(A.options,250),N={...Te.exports.useMemo(()=>k!=null&&k.marker?k.marker:{lat:k==null?void 0:k.lat,lng:k==null?void 0:k.lng},[k]),geographyLevels:["10","30"],locationScoresRounding:!1,include:w};return Zc(_p.list(N),async()=>E.getScores(N),{enabled:!!N})}const jm=$t.div`
599
+ padding: ${yt["--ll-spacing-small"]} ${yt["--ll-spacing-medium"]};
600
+ background-color: ${yt["--ll-color-surface"]};
601
601
  display: flex;
602
602
  flex-direction: column;
603
603
  overflow: hidden;
604
604
  flex: 1;
605
- `,Wm=Zt.div`
605
+ `,Xm=$t.div`
606
606
  display: grid;
607
607
  grid-template-columns: min-content 1fr;
608
- grid-gap: ${Tt["--ll-spacing-medium"]};
609
- margin-bottom: ${Tt["--ll-spacing-medium"]};
610
- `,Hm=Zt.div`
608
+ grid-gap: ${yt["--ll-spacing-medium"]};
609
+ margin-bottom: ${yt["--ll-spacing-medium"]};
610
+ `,Wm=$t.div`
611
611
  overflow: auto;
612
- `;function Km(b){const I=b+"CollectionProvider",[A,D]=jc(I),[F,N]=A(I,{collectionRef:{current:null},itemMap:new Map}),oe=Ge=>{const{scope:$e,children:Ue}=Ge,et=nt.useRef(null),Ke=nt.useRef(new Map).current;return nt.createElement(F,{scope:$e,itemMap:Ke,collectionRef:et},Ue)},a=b+"CollectionSlot",Y=nt.forwardRef((Ge,$e)=>{const{scope:Ue,children:et}=Ge,Ke=N(a,Ue),tt=bl($e,Ke.collectionRef);return nt.createElement(Sh,{ref:tt},et)}),te=b+"CollectionItemSlot",fe="data-radix-collection-item",ue=nt.forwardRef((Ge,$e)=>{const{scope:Ue,children:et,...Ke}=Ge,tt=nt.useRef(null),lt=bl($e,tt),It=N(te,Ue);return nt.useEffect(()=>(It.itemMap.set(tt,{ref:tt,...Ke}),()=>void It.itemMap.delete(tt))),nt.createElement(Sh,{[fe]:"",ref:lt},et)});function ie(Ge){const $e=N(b+"CollectionConsumer",Ge);return nt.useCallback(()=>{const et=$e.collectionRef.current;if(!et)return[];const Ke=Array.from(et.querySelectorAll(`[${fe}]`));return Array.from($e.itemMap.values()).sort((It,at)=>Ke.indexOf(It.ref.current)-Ke.indexOf(at.ref.current))},[$e.collectionRef,$e.itemMap])}return[{Provider:oe,Slot:Y,ItemSlot:ue},ie,D]}const yp="Collapsible",[Jm,xp]=jc(yp),[Ym,Kc]=Jm(yp),Qm=Te.exports.forwardRef((b,I)=>{const{__scopeCollapsible:A,open:D,defaultOpen:F,disabled:N,onOpenChange:oe,...a}=b,[Y=!1,te]=Xc({prop:D,defaultProp:F,onChange:oe});return Te.exports.createElement(Ym,{scope:A,disabled:N,contentId:Yh(),open:Y,onOpenToggle:Te.exports.useCallback(()=>te(fe=>!fe),[te])},Te.exports.createElement(la.div,cr({"data-state":Jc(Y),"data-disabled":N?"":void 0},a,{ref:I})))}),eg="CollapsibleTrigger",tg=Te.exports.forwardRef((b,I)=>{const{__scopeCollapsible:A,...D}=b,F=Kc(eg,A);return Te.exports.createElement(la.button,cr({type:"button","aria-controls":F.contentId,"aria-expanded":F.open||!1,"data-state":Jc(F.open),"data-disabled":F.disabled?"":void 0,disabled:F.disabled},D,{ref:I,onClick:Hh(b.onClick,F.onOpenToggle)}))}),vp="CollapsibleContent",ig=Te.exports.forwardRef((b,I)=>{const{forceMount:A,...D}=b,F=Kc(vp,b.__scopeCollapsible);return Te.exports.createElement(Cf,{present:A||F.open},({present:N})=>Te.exports.createElement(rg,cr({},D,{ref:I,present:N})))}),rg=Te.exports.forwardRef((b,I)=>{const{__scopeCollapsible:A,present:D,children:F,...N}=b,oe=Kc(vp,A),[a,Y]=Te.exports.useState(D),te=Te.exports.useRef(null),fe=bl(I,te),ue=Te.exports.useRef(0),ie=ue.current,Ge=Te.exports.useRef(0),$e=Ge.current,Ue=oe.open||a,et=Te.exports.useRef(Ue),Ke=Te.exports.useRef();return Te.exports.useEffect(()=>{const tt=requestAnimationFrame(()=>et.current=!1);return()=>cancelAnimationFrame(tt)},[]),jh(()=>{const tt=te.current;if(tt){Ke.current=Ke.current||{transitionDuration:tt.style.transitionDuration,animationDuration:tt.style.animationDuration,animationFillMode:tt.style.animationFillMode},tt.style.transitionDuration="0s",tt.style.animationDuration="0s",tt.style.animationFillMode="none";const lt=tt.getBoundingClientRect();ue.current=lt.height,Ge.current=lt.width,et.current||(tt.style.transitionDuration=Ke.current.transitionDuration,tt.style.animationDuration=Ke.current.animationDuration,tt.style.animationFillMode=Ke.current.animationFillMode),Y(D)}},[oe.open,D]),Te.exports.createElement(la.div,cr({"data-state":Jc(oe.open),"data-disabled":oe.disabled?"":void 0,id:oe.contentId,hidden:!Ue},N,{ref:fe,style:{["--radix-collapsible-content-height"]:ie?`${ie}px`:void 0,["--radix-collapsible-content-width"]:$e?`${$e}px`:void 0,...b.style}}),Ue&&F)});function Jc(b){return b?"open":"closed"}const ng=Qm,og=tg,sg=ig,ua="Accordion",ag=["Home","End","ArrowDown","ArrowUp"],[Yc,lg,cg]=Km(ua),[Ml,i_]=jc(ua,[cg,xp]),Qc=xp(),bp=nt.forwardRef((b,I)=>{const{type:A,...D}=b,F=D,N=D;return nt.createElement(Yc.Provider,{scope:b.__scopeAccordion},A==="multiple"?nt.createElement(dg,cr({},N,{ref:I})):nt.createElement(pg,cr({},F,{ref:I})))});bp.propTypes={type(b){const I=b.value||b.defaultValue;return b.type&&!["single","multiple"].includes(b.type)?new Error("Invalid prop `type` supplied to `Accordion`. Expected one of `single | multiple`."):b.type==="multiple"&&typeof I=="string"?new Error("Invalid prop `type` supplied to `Accordion`. Expected `single` when `defaultValue` or `value` is type `string`."):b.type==="single"&&Array.isArray(I)?new Error("Invalid prop `type` supplied to `Accordion`. Expected `multiple` when `defaultValue` or `value` is type `string[]`."):null}};const[wp,ug]=Ml(ua),[Tp,hg]=Ml(ua,{collapsible:!1}),pg=nt.forwardRef((b,I)=>{const{value:A,defaultValue:D,onValueChange:F=()=>{},collapsible:N=!1,...oe}=b,[a,Y]=Xc({prop:A,defaultProp:D,onChange:F});return nt.createElement(wp,{scope:b.__scopeAccordion,value:a?[a]:[],onItemOpen:Y,onItemClose:nt.useCallback(()=>N&&Y(""),[N,Y])},nt.createElement(Tp,{scope:b.__scopeAccordion,collapsible:N},nt.createElement(Ep,cr({},oe,{ref:I}))))}),dg=nt.forwardRef((b,I)=>{const{value:A,defaultValue:D,onValueChange:F=()=>{},...N}=b,[oe=[],a]=Xc({prop:A,defaultProp:D,onChange:F}),Y=nt.useCallback(fe=>a((ue=[])=>[...ue,fe]),[a]),te=nt.useCallback(fe=>a((ue=[])=>ue.filter(ie=>ie!==fe)),[a]);return nt.createElement(wp,{scope:b.__scopeAccordion,value:oe,onItemOpen:Y,onItemClose:te},nt.createElement(Tp,{scope:b.__scopeAccordion,collapsible:!0},nt.createElement(Ep,cr({},N,{ref:I}))))}),[fg,mg]=Ml(ua),Ep=nt.forwardRef((b,I)=>{const{__scopeAccordion:A,disabled:D,...F}=b,N=nt.useRef(null),oe=bl(N,I),a=lg(A),Y=Hh(b.onKeyDown,te=>{var fe;if(!ag.includes(te.key))return;const ue=te.target,ie=a().filter(Ke=>{var tt;return!((tt=Ke.ref.current)!==null&&tt!==void 0&&tt.disabled)}),Ge=ie.findIndex(Ke=>Ke.ref.current===ue),$e=ie.length;if(Ge===-1)return;te.preventDefault();let Ue=Ge;switch(te.key){case"Home":Ue=0;break;case"End":Ue=$e-1;break;case"ArrowDown":Ue=Ge+1;break;case"ArrowUp":Ue=Ge-1,Ue<0&&(Ue=$e-1);break}const et=Ue%$e;(fe=ie[et].ref.current)===null||fe===void 0||fe.focus()});return nt.createElement(fg,{scope:A,disabled:D},nt.createElement(Yc.Slot,{scope:A},nt.createElement(la.div,cr({},F,{ref:oe,onKeyDown:D?void 0:Y}))))}),Gc="AccordionItem",[gg,eu]=Ml(Gc),_g=nt.forwardRef((b,I)=>{const{__scopeAccordion:A,value:D,...F}=b,N=mg(Gc,A),oe=ug(Gc,A),a=Qc(A),Y=Yh(),te=D&&oe.value.includes(D)||!1,fe=N.disabled||b.disabled;return nt.createElement(gg,{scope:A,open:te,disabled:fe,triggerId:Y},nt.createElement(ng,cr({"data-state":te?"open":"closed"},a,F,{ref:I,disabled:fe,open:te,onOpenChange:ue=>{ue?oe.onItemOpen(D):oe.onItemClose(D)}})))}),yg="AccordionHeader",xg=nt.forwardRef((b,I)=>{const{__scopeAccordion:A,...D}=b,F=eu(yg,A);return nt.createElement(la.h3,cr({"data-state":Tg(F.open),"data-disabled":F.disabled?"":void 0},D,{ref:I}))}),qh="AccordionTrigger",vg=nt.forwardRef((b,I)=>{const{__scopeAccordion:A,...D}=b,F=eu(qh,A),N=hg(qh,A),oe=Qc(A);return nt.createElement(Yc.ItemSlot,{scope:A},nt.createElement(og,cr({"aria-disabled":F.open&&!N.collapsible||void 0,id:F.triggerId},oe,D,{ref:I})))}),bg="AccordionContent",wg=nt.forwardRef((b,I)=>{const{__scopeAccordion:A,...D}=b,F=eu(bg,A),N=Qc(A);return nt.createElement(sg,cr({role:"region","aria-labelledby":F.triggerId},N,D,{ref:I,style:{["--radix-accordion-content-height"]:"var(--radix-collapsible-content-height)",["--radix-accordion-content-width"]:"var(--radix-collapsible-content-width)",...b.style}}))});function Tg(b){return b?"open":"closed"}const Eg=bp,Sg=_g,Ig=xg,Cg=vg,Ag=wg,Mg=Kh({from:{height:0},to:{height:"var(--radix-accordion-content-height)"}}),Pg=Kh({from:{height:"var(--radix-accordion-content-height)"},to:{height:0}}),zg=Zt(Ig)`
612
+
613
+ &:not(:empty) {
614
+ margin-top: ${yt["--ll-spacing-medium"]};
615
+ }
616
+ `;function Hm(w){const E=w+"CollectionProvider",[A,k]=jc(E),[F,N]=A(E,{collectionRef:{current:null},itemMap:new Map}),oe=Ge=>{const{scope:Ne,children:Be}=Ge,tt=nt.useRef(null),Ye=nt.useRef(new Map).current;return nt.createElement(F,{scope:Ne,itemMap:Ye,collectionRef:tt},Be)},a=w+"CollectionSlot",Q=nt.forwardRef((Ge,Ne)=>{const{scope:Be,children:tt}=Ge,Ye=N(a,Be),Qe=wl(Ne,Ye.collectionRef);return nt.createElement(Sh,{ref:Qe},tt)}),te=w+"CollectionItemSlot",fe="data-radix-collection-item",ue=nt.forwardRef((Ge,Ne)=>{const{scope:Be,children:tt,...Ye}=Ge,Qe=nt.useRef(null),pt=wl(Ne,Qe),gt=N(te,Be);return nt.useEffect(()=>(gt.itemMap.set(Qe,{ref:Qe,...Ye}),()=>void gt.itemMap.delete(Qe))),nt.createElement(Sh,{[fe]:"",ref:pt},tt)});function ie(Ge){const Ne=N(w+"CollectionConsumer",Ge);return nt.useCallback(()=>{const tt=Ne.collectionRef.current;if(!tt)return[];const Ye=Array.from(tt.querySelectorAll(`[${fe}]`));return Array.from(Ne.itemMap.values()).sort((gt,at)=>Ye.indexOf(gt.ref.current)-Ye.indexOf(at.ref.current))},[Ne.collectionRef,Ne.itemMap])}return[{Provider:oe,Slot:Q,ItemSlot:ue},ie,k]}const yp="Collapsible",[Km,xp]=jc(yp),[Jm,Kc]=Km(yp),Ym=Te.exports.forwardRef((w,E)=>{const{__scopeCollapsible:A,open:k,defaultOpen:F,disabled:N,onOpenChange:oe,...a}=w,[Q=!1,te]=Xc({prop:k,defaultProp:F,onChange:oe});return Te.exports.createElement(Jm,{scope:A,disabled:N,contentId:Yh(),open:Q,onOpenToggle:Te.exports.useCallback(()=>te(fe=>!fe),[te])},Te.exports.createElement(ca.div,cr({"data-state":Jc(Q),"data-disabled":N?"":void 0},a,{ref:E})))}),Qm="CollapsibleTrigger",eg=Te.exports.forwardRef((w,E)=>{const{__scopeCollapsible:A,...k}=w,F=Kc(Qm,A);return Te.exports.createElement(ca.button,cr({type:"button","aria-controls":F.contentId,"aria-expanded":F.open||!1,"data-state":Jc(F.open),"data-disabled":F.disabled?"":void 0,disabled:F.disabled},k,{ref:E,onClick:Hh(w.onClick,F.onOpenToggle)}))}),vp="CollapsibleContent",tg=Te.exports.forwardRef((w,E)=>{const{forceMount:A,...k}=w,F=Kc(vp,w.__scopeCollapsible);return Te.exports.createElement(If,{present:A||F.open},({present:N})=>Te.exports.createElement(ig,cr({},k,{ref:E,present:N})))}),ig=Te.exports.forwardRef((w,E)=>{const{__scopeCollapsible:A,present:k,children:F,...N}=w,oe=Kc(vp,A),[a,Q]=Te.exports.useState(k),te=Te.exports.useRef(null),fe=wl(E,te),ue=Te.exports.useRef(0),ie=ue.current,Ge=Te.exports.useRef(0),Ne=Ge.current,Be=oe.open||a,tt=Te.exports.useRef(Be),Ye=Te.exports.useRef();return Te.exports.useEffect(()=>{const Qe=requestAnimationFrame(()=>tt.current=!1);return()=>cancelAnimationFrame(Qe)},[]),Zh(()=>{const Qe=te.current;if(Qe){Ye.current=Ye.current||{transitionDuration:Qe.style.transitionDuration,animationDuration:Qe.style.animationDuration,animationFillMode:Qe.style.animationFillMode},Qe.style.transitionDuration="0s",Qe.style.animationDuration="0s",Qe.style.animationFillMode="none";const pt=Qe.getBoundingClientRect();ue.current=pt.height,Ge.current=pt.width,tt.current||(Qe.style.transitionDuration=Ye.current.transitionDuration,Qe.style.animationDuration=Ye.current.animationDuration,Qe.style.animationFillMode=Ye.current.animationFillMode),Q(k)}},[oe.open,k]),Te.exports.createElement(ca.div,cr({"data-state":Jc(oe.open),"data-disabled":oe.disabled?"":void 0,id:oe.contentId,hidden:!Be},N,{ref:fe,style:{["--radix-collapsible-content-height"]:ie?`${ie}px`:void 0,["--radix-collapsible-content-width"]:Ne?`${Ne}px`:void 0,...w.style}}),Be&&F)});function Jc(w){return w?"open":"closed"}const rg=Ym,ng=eg,og=tg,ha="Accordion",sg=["Home","End","ArrowDown","ArrowUp"],[Yc,ag,lg]=Hm(ha),[Ml,t_]=jc(ha,[lg,xp]),Qc=xp(),bp=nt.forwardRef((w,E)=>{const{type:A,...k}=w,F=k,N=k;return nt.createElement(Yc.Provider,{scope:w.__scopeAccordion},A==="multiple"?nt.createElement(pg,cr({},N,{ref:E})):nt.createElement(hg,cr({},F,{ref:E})))});bp.propTypes={type(w){const E=w.value||w.defaultValue;return w.type&&!["single","multiple"].includes(w.type)?new Error("Invalid prop `type` supplied to `Accordion`. Expected one of `single | multiple`."):w.type==="multiple"&&typeof E=="string"?new Error("Invalid prop `type` supplied to `Accordion`. Expected `single` when `defaultValue` or `value` is type `string`."):w.type==="single"&&Array.isArray(E)?new Error("Invalid prop `type` supplied to `Accordion`. Expected `multiple` when `defaultValue` or `value` is type `string[]`."):null}};const[wp,cg]=Ml(ha),[Tp,ug]=Ml(ha,{collapsible:!1}),hg=nt.forwardRef((w,E)=>{const{value:A,defaultValue:k,onValueChange:F=()=>{},collapsible:N=!1,...oe}=w,[a,Q]=Xc({prop:A,defaultProp:k,onChange:F});return nt.createElement(wp,{scope:w.__scopeAccordion,value:a?[a]:[],onItemOpen:Q,onItemClose:nt.useCallback(()=>N&&Q(""),[N,Q])},nt.createElement(Tp,{scope:w.__scopeAccordion,collapsible:N},nt.createElement(Ep,cr({},oe,{ref:E}))))}),pg=nt.forwardRef((w,E)=>{const{value:A,defaultValue:k,onValueChange:F=()=>{},...N}=w,[oe=[],a]=Xc({prop:A,defaultProp:k,onChange:F}),Q=nt.useCallback(fe=>a((ue=[])=>[...ue,fe]),[a]),te=nt.useCallback(fe=>a((ue=[])=>ue.filter(ie=>ie!==fe)),[a]);return nt.createElement(wp,{scope:w.__scopeAccordion,value:oe,onItemOpen:Q,onItemClose:te},nt.createElement(Tp,{scope:w.__scopeAccordion,collapsible:!0},nt.createElement(Ep,cr({},N,{ref:E}))))}),[dg,fg]=Ml(ha),Ep=nt.forwardRef((w,E)=>{const{__scopeAccordion:A,disabled:k,...F}=w,N=nt.useRef(null),oe=wl(N,E),a=ag(A),Q=Hh(w.onKeyDown,te=>{var fe;if(!sg.includes(te.key))return;const ue=te.target,ie=a().filter(Ye=>{var Qe;return!((Qe=Ye.ref.current)!==null&&Qe!==void 0&&Qe.disabled)}),Ge=ie.findIndex(Ye=>Ye.ref.current===ue),Ne=ie.length;if(Ge===-1)return;te.preventDefault();let Be=Ge;switch(te.key){case"Home":Be=0;break;case"End":Be=Ne-1;break;case"ArrowDown":Be=Ge+1;break;case"ArrowUp":Be=Ge-1,Be<0&&(Be=Ne-1);break}const tt=Be%Ne;(fe=ie[tt].ref.current)===null||fe===void 0||fe.focus()});return nt.createElement(dg,{scope:A,disabled:k},nt.createElement(Yc.Slot,{scope:A},nt.createElement(ca.div,cr({},F,{ref:oe,onKeyDown:k?void 0:Q}))))}),Gc="AccordionItem",[mg,eu]=Ml(Gc),gg=nt.forwardRef((w,E)=>{const{__scopeAccordion:A,value:k,...F}=w,N=fg(Gc,A),oe=cg(Gc,A),a=Qc(A),Q=Yh(),te=k&&oe.value.includes(k)||!1,fe=N.disabled||w.disabled;return nt.createElement(mg,{scope:A,open:te,disabled:fe,triggerId:Q},nt.createElement(rg,cr({"data-state":te?"open":"closed"},a,F,{ref:E,disabled:fe,open:te,onOpenChange:ue=>{ue?oe.onItemOpen(k):oe.onItemClose(k)}})))}),_g="AccordionHeader",yg=nt.forwardRef((w,E)=>{const{__scopeAccordion:A,...k}=w,F=eu(_g,A);return nt.createElement(ca.h3,cr({"data-state":wg(F.open),"data-disabled":F.disabled?"":void 0},k,{ref:E}))}),Gh="AccordionTrigger",xg=nt.forwardRef((w,E)=>{const{__scopeAccordion:A,...k}=w,F=eu(Gh,A),N=ug(Gh,A),oe=Qc(A);return nt.createElement(Yc.ItemSlot,{scope:A},nt.createElement(ng,cr({"aria-disabled":F.open&&!N.collapsible||void 0,id:F.triggerId},oe,k,{ref:E})))}),vg="AccordionContent",bg=nt.forwardRef((w,E)=>{const{__scopeAccordion:A,...k}=w,F=eu(vg,A),N=Qc(A);return nt.createElement(og,cr({role:"region","aria-labelledby":F.triggerId},N,k,{ref:E,style:{["--radix-accordion-content-height"]:"var(--radix-collapsible-content-height)",["--radix-accordion-content-width"]:"var(--radix-collapsible-content-width)",...w.style}}))});function wg(w){return w?"open":"closed"}const Tg=bp,Eg=gg,Sg=yg,Ig=xg,Cg=bg,Ag=Kh({from:{height:0},to:{height:"var(--radix-accordion-content-height)"}}),Mg=Kh({from:{height:"var(--radix-accordion-content-height)"},to:{height:0}}),Pg=$t(Sg)`
613
617
  margin: 0;
614
- `,Sp=Zt(Cg)`
618
+ `,Sp=$t(Ig)`
615
619
  background: none;
616
620
  border: none;
617
621
  display: flex;
618
622
  align-items: center;
619
623
  width: 100%;
620
- padding: ${Tt["--ll-spacing-x-small"]} 0;
621
- `,kg=Zt(Ag)`
622
- background-color: ${Tt["--ll-color-surface"]};
624
+ padding: ${yt["--ll-spacing-x-small"]} 0;
625
+ `,zg=$t(Cg)`
626
+ background-color: ${yt["--ll-color-surface"]};
623
627
  position: relative;
624
628
  z-index: 1;
625
629
  overflow: hidden;
626
- margin-left: calc(-1 * ${Tt["--ll-spacing-medium"]});
627
- margin-right: calc(-1 * ${Tt["--ll-spacing-medium"]});
630
+ margin-left: calc(-1 * ${yt["--ll-spacing-medium"]});
631
+ margin-right: calc(-1 * ${yt["--ll-spacing-medium"]});
628
632
 
629
633
  [data-state="open"] & {
630
- animation: ${Mg} 300ms cubic-bezier(0.87, 0, 0.13, 1);
634
+ animation: ${Ag} 300ms cubic-bezier(0.87, 0, 0.13, 1);
631
635
  }
632
636
 
633
637
  [data-state="closed"] & {
634
- animation: ${Pg} 300ms cubic-bezier(0.87, 0, 0.13, 1);
638
+ animation: ${Mg} 300ms cubic-bezier(0.87, 0, 0.13, 1);
635
639
  }
636
- `,Dg=Zt.div`
637
- padding: ${Tt["--ll-spacing-medium"]};
638
- `,Lg=Zt.span`
640
+ `,kg=$t.div`
641
+ padding: ${yt["--ll-spacing-medium"]};
642
+ `,Dg=$t.span`
639
643
  ${Sp}[data-state=open] & {
640
644
  transform: rotate(90deg);
641
645
  } ;
642
- `;Zt.div`
646
+ `;$t.div`
643
647
  display: flex;
644
648
  align-items: flex-start;
645
649
  justify-content: space-between;
646
- `;const tu=Zt.div`
647
- margin: ${Tt["--ll-spacing-small"]} 0;
648
- `,Rg=Zt.div`
649
- margin-top: ${Tt["--ll-spacing-large"]};
650
+ `;const tu=$t.div`
651
+ margin: ${yt["--ll-spacing-small"]} 0;
652
+ `,Lg=$t.div`
653
+ margin-top: ${yt["--ll-spacing-large"]};
650
654
 
651
655
  &:empty {
652
656
  margin: 0;
653
657
  }
654
- `,Ip=nt.memo(({result:b,poi:I})=>{const{activePOI:A,setActivePOI:D,hoveredPOI:F,setHoveredPOI:N}=Zn(),{mapRef:oe,mapPadding:a}=pp();return!b.data||!b.data[I]?null:Se(Co.Content,{options:{value:I},children:Se(Jh.Root,{options:{type:"poi",data:b.data[I],activePOI:A,hoveredPOI:F},onChange:Y=>{var te;if(Y.type==="poi-click"){const fe=Y.data;D(fe);const ue=window.innerWidth-a.left,ie=window.innerWidth/2,Ge=ue/2+a.left-ie;fe&&((te=oe.current)==null||te.flyTo({zoom:18,center:[fe.lng,fe.lat],duration:1e3,offset:[Ge,0]}))}Y.type==="poi-hover"&&N(Y.data)}})},I)});Ip.displayName="POI";const iu=nt.memo(({include:b})=>{const I=lp();return I.isLoading&&b.length?Se(Il,{children:[...Array(10)].map((A,D)=>Se(tu,{children:Se(Cl,{height:"34px",width:"100%"})},D))}):I.data?Ri(Co.Root,{options:{include:b},children:[Se(Co.Tabs,{}),b.map(A=>Se(Ip,{poi:A,result:I},A))]}):null});iu.displayName="POIs";const Cp=({score:b})=>{const{data:I,isLoading:A}=up(),{activePOI:D,setActivePOI:F,hoveredPOI:N,setHoveredPOI:oe}=Zn(),{mapRef:a,mapPadding:Y}=pp();return A?Se(Il,{children:[...Array(10)].map(te=>Se(tu,{children:Se(Cl,{height:"34px",width:"100%"})},te))}):I?Se(Jh.Root,{options:{type:"school",data:I==null?void 0:I[b],activePOI:D,hoveredPOI:N},onChange:te=>{var fe;if(te.type==="poi-click"){const ue=te.data;F(ue);const ie=window.innerWidth-Y.left,Ge=window.innerWidth/2,$e=ie/2+Y.left-Ge;ue&&((fe=a.current)==null||fe.easeTo({zoom:18,center:[ue.lng,ue.lat],duration:1e3,offset:[$e,0]}))}te.type==="poi-hover"&&oe(te.data)}}):null},{scorePois:Zh}=Co.Constants,Bg=()=>{const{activeCategory:b,activeScore:I,showMobileList:A}=Zn(),D=Tl.find(a=>a.value===b),{data:F,isLoading:N}=Hc(D.scores),oe=a=>!A||!Zh[a].length?null:a==="high_schools"||a==="primary_schools"?Se(Cp,{score:a}):Se(iu,{include:Zh[a]});return I&&(F==null?void 0:F.location[I])?N?Se("div",{children:"Loading"}):Se(tr.Root,{options:{score:I,data:F},children:Ri(Xm,{children:[Ri(Wm,{children:[Se(tr.Badge,{}),Se(tr.BarChart,{})]}),Se(tr.Description,{}),Se(Hm,{children:oe(I)})]})}):null},Fg=Zt.div`
658
+ `,Ip=nt.memo(({result:w,poi:E})=>{const{activePOI:A,setActivePOI:k,hoveredPOI:F,setHoveredPOI:N}=Zn(),{mapRef:oe,mapPadding:a}=pp();return!w.data||!w.data[E]?null:Ae(Co.Content,{options:{value:E},children:Ae(Jh.Root,{options:{type:"poi",data:w.data[E],activePOI:A,hoveredPOI:F},onChange:Q=>{var te;if(Q.type==="poi-click"){const fe=Q.data;k(fe);const ue=window.innerWidth-a.left,ie=window.innerWidth/2,Ge=ue/2+a.left-ie;fe&&((te=oe.current)==null||te.flyTo({zoom:18,center:[fe.lng,fe.lat],duration:1e3,offset:[Ge,0]}))}Q.type==="poi-hover"&&N(Q.data)}})},E)});Ip.displayName="POI";const iu=nt.memo(({include:w})=>{const E=lp();return E.isLoading&&w.length?Ae(Il,{children:[...Array(10)].map((A,k)=>Ae(tu,{children:Ae(Cl,{height:"34px",width:"100%"})},k))}):E.data?Xi(Co.Root,{options:{include:w},children:[Ae(Co.Tabs,{}),w.map(A=>Ae(Ip,{poi:A,result:E},A))]}):null});iu.displayName="POIs";const Cp=({score:w})=>{const{data:E,isLoading:A}=up(),{activePOI:k,setActivePOI:F,hoveredPOI:N,setHoveredPOI:oe}=Zn(),{mapRef:a,mapPadding:Q}=pp();return A?Ae(Il,{children:[...Array(10)].map(te=>Ae(tu,{children:Ae(Cl,{height:"34px",width:"100%"})},te))}):E?Ae(Jh.Root,{options:{type:"school",data:E==null?void 0:E[w],activePOI:k,hoveredPOI:N},onChange:te=>{var fe;if(te.type==="poi-click"){const ue=te.data;F(ue);const ie=window.innerWidth-Q.left,Ge=window.innerWidth/2,Ne=ie/2+Q.left-Ge;ue&&((fe=a.current)==null||fe.easeTo({zoom:18,center:[ue.lng,ue.lat],duration:1e3,offset:[Ne,0]}))}te.type==="poi-hover"&&oe(te.data)}}):null},{scorePois:qh}=Co.Constants,Rg=()=>{const{activeCategory:w,activeScore:E,showMobileList:A}=Zn(),k=El.find(a=>a.value===w),{data:F,isLoading:N}=Hc(k.scores),oe=a=>!A||!qh[a].length?null:a==="high_schools"||a==="primary_schools"?Ae(Cp,{score:a}):Ae(iu,{include:qh[a]});return E&&(F==null?void 0:F.location[E])?N?Ae("div",{children:"Loading"}):Ae(tr.Root,{options:{score:E,data:F},children:Xi(jm,{children:[Xi(Xm,{children:[Ae(tr.Badge,{}),Ae(tr.BarChart,{})]}),Ae(tr.Description,{}),Ae(Wm,{children:oe(E)})]})}):null};$t.div`
655
659
  display: flex;
656
660
  flex-direction: column;
657
- `,Og=Zt.div`
661
+ `;const Bg=$t.div`
658
662
  display: flex;
659
- `,$g=Zt.button`
663
+ `,Fg=$t.button`
660
664
  position: relative;
661
665
  display: flex;
662
666
  flex-direction: column;
663
- justify-content: center;
664
667
  align-items: center;
665
668
  background: none;
666
669
  border: none;
667
- width: 108px;
670
+ width: 80px;
668
671
  margin: 0;
669
672
  padding: 0;
670
673
  margin: 0 4px;
671
- `,Ug=Zt.div`
674
+ `,Og=$t.div`
672
675
  position: absolute;
673
676
  top: -6px;
674
677
  right: 4px;
675
- border: 2px solid ${Tt["--ll-color-background"]};
678
+ border: 2px solid ${yt["--ll-color-background"]};
676
679
  border-radius: 6px;
677
- `,Vg=({category:b})=>{const{data:I,isLoading:A}=Hc(b.scores),{activeScore:D,setActiveScore:F,setActiveCategory:N,setShowMobileList:oe}=Zn();return A?Se(Cl,{height:"34px",width:"50px"}):Se(Ih.Root,{options:{scoreCategory:b.value},children:Ri(Fg,{children:[Se(Ih.Title,{options:{variant:"caption2",color:"--ll-color-disabled",weight:"--ll-font-weight-bold"}}),Se(Og,{children:b.scores.map(a=>{const Y=a===D,te=Y?"--ll-color-primary":"--ll-color-disabled";return Se(tr.Root,{options:{score:a,data:I},children:Ri($g,{onClick:()=>{oe(!1),N(b.value),F(a)},children:[Se(tr.Icon,{options:{color:te}}),Se(tr.Title,{options:{variant:"caption1",color:te,noWrap:!0,noMargin:!0,weight:"--ll-font-weight-bold"}}),Se(Ug,{children:Se(tr.Badge,{options:{variant:"small",isPrimary:Y}})})]})},a)})})]})},b.value)},Ng=Zt.div`
680
+ `,$g=$t.div`
681
+ flex: 1;
682
+ display: flex;
683
+ align-items: center;
684
+ `,Ug=({category:w})=>{const{data:E,isLoading:A}=Hc(w.scores),{activeScore:k,setActiveScore:F,setActiveCategory:N,setShowMobileList:oe}=Zn();return A?Ae(Cl,{height:"34px",width:"50px"}):Ae(Bg,{children:w.scores.map(a=>{const Q=a===k,te=Q?"--ll-color-primary":"--ll-color-disabled",fe=["high_schools","primary_schools"].includes(a);return Ae(tr.Root,{options:{score:a,data:E},children:Xi(Fg,{onClick:()=>{oe(!1),N(w.value),F(a)},children:[Ae(tr.Icon,{options:{color:te}}),Ae($g,{children:Ae(tr.Title,{options:{variant:fe?"caption2":"caption1",color:te,noMargin:!0,weight:"--ll-font-weight-bold"}})}),Ae(Og,{children:Ae(tr.Badge,{options:{variant:"small",isPrimary:Q}})})]})},a)})})},Vg=$t.div`
678
685
  position: absolute;
679
686
  top: 0;
680
687
  left: 0;
681
688
  right: 0;
682
- bottom: ${({showMobileList:b})=>b&&0};
689
+ bottom: ${({showMobileList:w})=>w&&0};
683
690
  z-index: 3;
684
691
  box-shadow: rgba(0, 0, 0, 0.15) 0px 3px 8px;
685
692
  background-color: #fff;
686
693
  overflow: hidden;
687
694
  display: flex;
688
695
  flex-direction: column;
689
- background-color: ${Tt["--ll-color-background"]};
690
- border: 1px solid ${Tt["--ll-color-border"]};
691
- `,Gg=Zt.div`
696
+ background-color: ${yt["--ll-color-background"]};
697
+ border: 1px solid ${yt["--ll-color-border"]};
698
+ `,Ng=$t.div`
692
699
  display: flex;
693
700
  overflow-x: scroll;
694
- padding: ${Tt["--ll-spacing-xx-small"]} ${Tt["--ll-spacing-medium"]};
701
+ padding: ${yt["--ll-spacing-small"]} ${yt["--ll-spacing-medium"]}
702
+ ${yt["--ll-spacing-x-small"]} 0;
695
703
  flex-shrink: 0;
696
- `,Ap=nt.forwardRef(({showMobileList:b},I)=>Ri(Ng,{ref:I,showMobileList:b,children:[Se(Gg,{children:Tl.map(A=>Se(Vg,{category:A},A.value))}),Se(Bg,{})]}));Ap.displayName="MobileScores";const qg=b=>Te.exports.createElement("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",...b},Te.exports.createElement("path",{d:"M9.99984 6L8.58984 7.41L13.1698 12L8.58984 16.59L9.99984 18L15.9998 12L9.99984 6Z"})),{scorePois:Zg}=Co.Constants,Mp=nt.memo(({score:b,isLoading:I,data:A})=>I?Se(tu,{children:Se(Cl,{height:"34px",width:"100%"},b)}):Se(Sg,{value:b,children:Ri(tr.Root,{options:{score:b,data:A},children:[Se(zg,{children:Ri(Sp,{children:[Se(Lg,{children:Se(Af,{SVGElement:qg,fill:Tt["--ll-color-on-background-variant1"]})}),Se(oa,{spacing:"--ll-spacing-small"}),Se(tr.Icon,{}),Se(oa,{spacing:"--ll-spacing-small"}),Se(tr.Title,{}),Se(oa,{}),Se(tr.Badge,{})]})}),Se(kg,{children:Ri(Dg,{children:[Se(tr.Description,{}),Se(oa,{vertical:!0,spacing:"--ll-spacing-small"}),Se(tr.BarChart,{}),Se(Rg,{children:b==="high_schools"||b==="primary_schools"?Se(Cp,{score:b}):Se(iu,{include:Zg[b]})})]})})]})},b));Mp.displayName="Score";const jg=Zt.div`
697
- padding: ${Tt["--ll-spacing-small"]} ${Tt["--ll-spacing-medium"]};
698
- `,Xg=Zt.div`
704
+ `,Ap=nt.forwardRef(({showMobileList:w},E)=>Xi(Vg,{ref:E,showMobileList:w,children:[Ae(Ng,{children:El.map(A=>Ae(Ug,{category:A},A.value))}),Ae(Rg,{})]}));Ap.displayName="MobileScores";const Gg=w=>Te.exports.createElement("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",...w},Te.exports.createElement("path",{d:"M9.99984 6L8.58984 7.41L13.1698 12L8.58984 16.59L9.99984 18L15.9998 12L9.99984 6Z"})),{scorePois:qg}=Co.Constants,Mp=nt.memo(({score:w,isLoading:E,data:A})=>E?Ae(tu,{children:Ae(Cl,{height:"34px",width:"100%"},w)}):Ae(Eg,{value:w,children:Xi(tr.Root,{options:{score:w,data:A},children:[Ae(Pg,{children:Xi(Sp,{children:[Ae(Dg,{children:Ae(Cf,{SVGElement:Gg,fill:yt["--ll-color-on-background-variant1"]})}),Ae(oa,{spacing:"--ll-spacing-small"}),Ae(tr.Icon,{}),Ae(oa,{spacing:"--ll-spacing-small"}),Ae(tr.Title,{}),Ae(oa,{}),Ae(tr.Badge,{})]})}),Ae(zg,{children:Xi(kg,{children:[Ae(tr.Description,{}),Ae(oa,{vertical:!0,spacing:"--ll-spacing-small"}),Ae(tr.BarChart,{}),Ae(Lg,{children:w==="high_schools"||w==="primary_schools"?Ae(Cp,{score:w}):Ae(iu,{include:qg[w]})})]})})]})},w));Mp.displayName="Score";const Zg=$t.div`
705
+ padding: ${yt["--ll-spacing-small"]} ${yt["--ll-spacing-medium"]};
706
+ `,jg=$t.div`
699
707
  display: flex;
700
708
  justify-content: space-between;
701
709
  align-items: center;
702
- `,Pp=nt.memo(({locale:b,data:I,isLoading:A,isFetching:D,tabContent:F})=>{const N=Te.exports.useMemo(()=>b==="fr"?"Aucune donn\xE9e disponible pour cet emplacement.":"No data available for this location.",[b]);return Ri(jg,{children:[Ri(Xg,{children:[Se(yl.Title,{options:{variant:"h4",noMargin:!0,weight:"--ll-font-weight-medium"}}),D&&!A&&Se(Mf,{size:"small"})]}),Se(oa,{spacing:"--ll-spacing-small",vertical:!0}),!D&&!Object.keys((I==null?void 0:I.location)||{}).length&&Se(Pf,{color:"--ll-color-on-background-variant1",children:N}),F.scores.map(oe=>Se(Mp,{score:oe,data:I,isLoading:A},oe))]})});Pp.displayName="ScoreCategory";const zp=nt.memo(({tabContent:b})=>{const{client:I}=El(),{data:A,isLoading:D,isFetching:F}=Hc(b.scores),{activeScore:N,setActiveScore:oe}=Zn();return Se(Eg,{value:N,onValueChange:a=>{oe(a)},type:"single",collapsible:!0,children:Se(Pp,{data:A,isLoading:D,isFetching:F,tabContent:b,locale:I.options.locale})})});zp.displayName="ScoreCategoryAccordion";const Wg=Zt.div`
710
+ `,Pp=nt.memo(({locale:w,data:E,isLoading:A,isFetching:k,tabContent:F})=>{const N=Te.exports.useMemo(()=>w==="fr"?"Aucune donn\xE9e disponible pour cet emplacement.":"No data available for this location.",[w]);return Xi(Zg,{children:[Xi(jg,{children:[Ae(xl.Title,{options:{variant:"h4",noMargin:!0,weight:"--ll-font-weight-medium"}}),k&&!A&&Ae(Af,{size:"small"})]}),Ae(oa,{spacing:"--ll-spacing-small",vertical:!0}),!k&&!Object.keys((E==null?void 0:E.location)||{}).length&&Ae(Mf,{color:"--ll-color-on-background-variant1",children:N}),F.scores.map(oe=>Ae(Mp,{score:oe,data:E,isLoading:A},oe))]})});Pp.displayName="ScoreCategory";const zp=nt.memo(({tabContent:w})=>{const{client:E}=la(),{data:A,isLoading:k,isFetching:F}=Hc(w.scores),{activeScore:N,setActiveScore:oe}=Zn();return Ae(Tg,{value:N,onValueChange:a=>{oe(a)},type:"single",collapsible:!0,children:Ae(Pp,{data:A,isLoading:k,isFetching:F,tabContent:w,locale:E.options.locale})})});zp.displayName="ScoreCategoryAccordion";const Xg=$t.div`
703
711
  overflow-y: auto;
704
- `,Hg=Zt.div`
712
+ `,Wg=$t.div`
705
713
  position: absolute;
706
- top: ${Tt["--ll-spacing-medium"]};
707
- left: ${Tt["--ll-spacing-medium"]};
714
+ top: ${yt["--ll-spacing-medium"]};
715
+ left: ${yt["--ll-spacing-medium"]};
708
716
  width: 360px;
709
- max-height: calc(100% - 2 * ${Tt["--ll-spacing-medium"]});
717
+ max-height: calc(100% - 2 * ${yt["--ll-spacing-medium"]});
710
718
  z-index: 1;
711
- border-radius: ${Tt["--ll-border-radius-medium"]};
719
+ border-radius: ${yt["--ll-border-radius-medium"]};
712
720
  box-shadow: rgba(0, 0, 0, 0.15) 0px 3px 8px;
713
721
  background-color: #fff;
714
722
  overflow: hidden;
715
723
  display: flex;
716
724
  flex-direction: column;
717
- background-color: ${Tt["--ll-color-background"]};
718
- border: 1px solid ${Tt["--ll-color-border"]};
719
- `;Zt.div`
725
+ background-color: ${yt["--ll-color-background"]};
726
+ border: 1px solid ${yt["--ll-color-border"]};
727
+ `;$t.div`
720
728
  display: flex;
721
729
  justify-content: center;
722
- padding: ${Tt["--ll-spacing-small"]};
723
- `;const Kg=Zt.div`
724
- padding: ${Tt["--ll-spacing-x-small"]};
725
- border-bottom: 1px solid ${Tt["--ll-color-border"]};
726
- `,Jg=Zt.div`
730
+ padding: ${yt["--ll-spacing-small"]};
731
+ `;const Hg=$t.div`
732
+ padding: ${yt["--ll-spacing-x-small"]};
733
+ border-bottom: 1px solid ${yt["--ll-color-border"]};
734
+ `,Kg=$t.div`
727
735
  display: flex;
728
736
  justify-content: center;
729
- padding: ${Tt["--ll-spacing-small"]};
730
- background-color: ${Tt["--ll-color-background"]};
731
- `,kp=()=>Se(Jg,{children:Se(zf.Root,{})}),Dp=nt.forwardRef((b,I)=>{const{activeCategory:A,setActiveCategory:D,setShowMobileList:F}=Zn();return Se(yl.Root,{options:{currentTab:A},onChange:N=>{D(N.data)},children:Ri(Hg,{ref:I,children:[Se(Kg,{children:Se(yl.Tabs,{})}),Se(Wg,{children:Tl.map(N=>Se(yl.Content,{options:{value:N.value},children:Se(zp,{tabContent:N},N.value)},N.value))}),Se(kp,{})]})})});Dp.displayName="DesktopScores";const Yg=Zt.div`
737
+ padding: ${yt["--ll-spacing-small"]};
738
+ background-color: ${yt["--ll-color-background"]};
739
+ `,kp=()=>Ae(Kg,{children:Ae(Pf.Root,{})}),Dp=nt.forwardRef((w,E)=>{const{activeCategory:A,setActiveCategory:k,setShowMobileList:F}=Zn();return Ae(xl.Root,{options:{currentTab:A},onChange:N=>{k(N.data)},children:Xi(Wg,{ref:E,children:[Ae(Hg,{children:Ae(xl.Tabs,{})}),Ae(Xg,{children:El.map(N=>Ae(xl.Content,{options:{value:N.value},children:Ae(zp,{tabContent:N},N.value)},N.value))}),Ae(kp,{})]})})});Dp.displayName="DesktopScores";const Jg=$t.div`
732
740
  position: relative;
733
741
  display: flex;
734
742
  flex-direction: column;
735
743
  height: 100vh;
736
- `,Qg=Zt.div`
744
+ `,Yg=$t.div`
737
745
  position: absolute;
738
746
  bottom: 86px;
739
747
  left: 50%;
740
748
  transform: translateX(-50%);
741
749
  z-index: 3;
742
- box-shadow: ${Tt["--ll-shadow-medium"]};
743
- `,{scorePois:Oc}=Co.Constants,e_=()=>{var ur,Wi,hr,Hi;const{sdkState:b,setSdkState:I}=Sl(),{activeScore:A,activePOI:D,setActivePOI:F,hoveredPOI:N,showMobileList:oe,setShowMobileList:a}=Zn(),Y=Am(),te=lp(),fe=up(),ue=((Wi=(ur=b==null?void 0:b.globalOptions)==null?void 0:ur.appearance)==null?void 0:Wi.theme)==="night"?"streets-dark":"streets",[ie,Ge]=Te.exports.useState(!1),$e=Te.exports.useMemo(()=>{var Rt;return(A==="high_schools"||A==="primary_schools")&&!fe.isFetching?{[A]:((Rt=fe==null?void 0:fe.data)==null?void 0:Rt[A])||[]}:!(A&&Oc[A]&&Oc[A].length)&&!te.isFetching?{[A]:[]}:te.data},[te.data,fe.data,A]),Ue=Te.exports.useMemo(()=>$e?Object.entries($e).map(([pi,di])=>di.map(Xe=>Dh([Xe.lng,Xe.lat],{poi:Xe,type:pi}))).flat().filter((pi,di,Xe)=>Xe.findIndex(Bi=>["lat","lng","name"].every(wi=>Bi.properties.poi[wi]===pi.properties.poi[wi]))===di):[],[$e]),et=Te.exports.useMemo(()=>{var pi,di,Xe;const Rt=((pi=b==null?void 0:b.options)==null?void 0:pi.marker)&&Dh([(di=b==null?void 0:b.options)==null?void 0:di.marker.lng,(Xe=b==null?void 0:b.options)==null?void 0:Xe.marker.lat]);return[...Ue,...Rt?[Rt]:[]]},[Ue,(hr=b==null?void 0:b.options)==null?void 0:hr.marker]),Ke=Te.exports.useRef(),[tt,lt]=cm(),It=Te.exports.useMemo(()=>({top:25+lt.height,bottom:25,left:25,right:25}),[lt.height]),at=Te.exports.useMemo(()=>({top:50,bottom:50,left:lt.width+32+50,right:50}),[lt.width]),gt=Y?It:at,ti=Rt=>{I({...b,options:{...b.options,lat:Rt.viewState.latitude,lng:Rt.viewState.longitude,zoom:Rt.viewState.zoom,bearing:Rt.viewState.bearing,pitch:Rt.viewState.pitch}})};Te.exports.useEffect(()=>{var wi,Ci;if(!et.length||!((wi=b.options)!=null&&wi.marker))return;const Rt=am(et.map(({geometry:Ai})=>[Ai.coordinates[1],Ai.coordinates[0]])),[pi,di,Xe,Bi]=Uc(Rt);(Ci=Ke==null?void 0:Ke.current)==null||Ci.fitBounds([[di,pi],[Bi,Xe]],{maxZoom:17,padding:gt,duration:1e3})},[et,gt]);const Kt=Te.exports.useMemo(()=>{const{locale:Rt}=b.globalOptions;return oe?Rt==="en"?"Show Map":"Montrer la carte":Rt==="en"?"Show List":"Montrer la liste"},[(Hi=b.globalOptions)==null?void 0:Hi.locale,oe]);return b.options?Se(Pm,{mapRef:Ke,mapPadding:gt,children:Ri(Yg,{children:[Ri(Wc,{ref:Ke,mapLib:sm,latitude:b.options.lat,longitude:b.options.lng,zoom:b.options.zoom,pitch:b.options.pitch,bearing:b.options.bearing,style:{flex:1,width:"100vw"},mapStyle:`https://api.maptiler.com/maps/${ue}/style.json?key=KJ8IWUkGS9G824exx27J`,onMove:ti,cooperativeGestures:b.options.cooperativeGestures,onMoveStart:()=>Ge(!0),onMoveEnd:()=>Ge(!1),children:[Se(nm,{showCompass:!0,style:{marginTop:Y?16+lt.height:16,marginRight:16}}),b.options.marker&&Se(dp,{marker:b.options.marker}),Se(gp,{rect:lt,zoom:b.options.zoom,mapRef:Ke,points:Ue,isMobile:Y,activePOI:D,hoveredPOI:N,isMapMoving:ie,setActivePOI:F}),Y?Se(Ap,{ref:tt,showMobileList:oe}):Se(Dp,{ref:tt})]}),Y&&Ri(Il,{children:[Se(Qg,{children:A&&!!Oc[A].length&&Se(kf,{onClick:()=>a(Rt=>!Rt),size:"small",children:Kt})}),Se(kp,{})]})]})}):Se("div",{children:"No options provided."})},r_=()=>Se(Ff,{children:Se(e_,{})});export{r_ as default};
750
+ box-shadow: ${yt["--ll-shadow-medium"]};
751
+ `,{scorePois:Oc}=Co.Constants,Qg=()=>{var Wi,ur,Hi;const{client:w}=la(),{sdkState:E,setSdkState:A}=Sl(),{activeScore:k,activePOI:F,setActivePOI:N,hoveredPOI:oe,showMobileList:a,setShowMobileList:Q}=Zn(),te=Cm(),fe=lp(),ue=up(),ie=((ur=(Wi=E==null?void 0:E.globalOptions)==null?void 0:Wi.appearance)==null?void 0:ur.theme)==="night"?"basic-v2-dark":"600d69cb-288d-445e-9839-3dfe4d76b31a",[Ge,Ne]=Te.exports.useState(!1),Be=Te.exports.useMemo(()=>{var Rt;return(k==="high_schools"||k==="primary_schools")&&!ue.isFetching?{[k]:((Rt=ue==null?void 0:ue.data)==null?void 0:Rt[k])||[]}:!(k&&Oc[k]&&Oc[k].length)&&!fe.isFetching?{[k]:[]}:fe.data},[fe.data,ue.data,k]),tt=Te.exports.useMemo(()=>Be?Object.entries(Be).map(([pi,di])=>di.map(Xe=>kh([Xe.lng,Xe.lat],{poi:Xe,type:pi}))).flat().filter((pi,di,Xe)=>Xe.findIndex(Ri=>["lat","lng","name"].every(wi=>Ri.properties.poi[wi]===pi.properties.poi[wi]))===di):[],[Be]),Ye=Te.exports.useMemo(()=>{var pi,di,Xe;const Rt=((pi=E==null?void 0:E.options)==null?void 0:pi.marker)&&kh([(di=E==null?void 0:E.options)==null?void 0:di.marker.lng,(Xe=E==null?void 0:E.options)==null?void 0:Xe.marker.lat]);return[...tt,...Rt?[Rt]:[]]},[tt,(Hi=E==null?void 0:E.options)==null?void 0:Hi.marker]),Qe=Te.exports.useRef(),[pt,gt]=lm(),at=Te.exports.useMemo(()=>({top:25+gt.height,bottom:25,left:25,right:25}),[gt.height]),Et=Te.exports.useMemo(()=>({top:50,bottom:50,left:gt.width+32+50,right:50}),[gt.width]),Ht=te?at:Et,Jt=Rt=>{A({...E,options:{...E.options,lat:Rt.viewState.latitude,lng:Rt.viewState.longitude,zoom:Rt.viewState.zoom,bearing:Rt.viewState.bearing,pitch:Rt.viewState.pitch}})};Te.exports.useEffect(()=>{var wi,Ci;if(!Ye.length||!((wi=E.options)!=null&&wi.marker))return;const Rt=sm(Ye.map(({geometry:Ai})=>[Ai.coordinates[1],Ai.coordinates[0]])),[pi,di,Xe,Ri]=Uc(Rt);(Ci=Qe==null?void 0:Qe.current)==null||Ci.fitBounds([[di,pi],[Ri,Xe]],{maxZoom:17,padding:Ht,duration:1e3})},[Ye,Ht]);const vr=Te.exports.useMemo(()=>{const{locale:Rt}=w.options;return a?Rt==="en"?"Show Map":"Montrer la carte":Rt==="en"?"Show List":"Montrer la liste"},[w,a]);return E.options?Ae(Mm,{mapRef:Qe,mapPadding:Ht,children:Xi(Jg,{children:[Xi(Wc,{ref:Qe,mapLib:om,latitude:E.options.lat,longitude:E.options.lng,zoom:E.options.zoom,pitch:E.options.pitch,bearing:E.options.bearing,style:{flex:1,width:"100vw"},mapStyle:`https://api.maptiler.com/maps/${ie}/style.json?key=9jNGatuzs05Q1oNlctEs`,onMove:Jt,cooperativeGestures:E.options.cooperativeGestures,onMoveStart:()=>Ne(!0),onMoveEnd:()=>Ne(!1),children:[Ae(rm,{showCompass:!0,style:{marginTop:te?16+gt.height:16,marginRight:16}}),E.options.marker&&Ae(dp,{marker:E.options.marker}),Ae(gp,{rect:gt,zoom:E.options.zoom,mapRef:Qe,points:tt,isMobile:te,activePOI:F,hoveredPOI:oe,isMapMoving:Ge,setActivePOI:N}),te?Ae(Ap,{ref:pt,showMobileList:a}):Ae(Dp,{ref:pt})]}),te&&Xi(Il,{children:[Ae(Yg,{children:k&&!!Oc[k].length&&Ae(zf,{onClick:()=>Q(Rt=>!Rt),size:"small",children:vr})}),Ae(kp,{})]})]})}):Ae("div",{children:"No options provided."})},i_=()=>Ae(Bf,{children:Ae(Qg,{})});export{i_ as default};