@maptiler/sdk 1.0.4 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +3 -0
- package/demos/maptiler-sdk.umd.js +1 -1
- package/demos/simple.html +1 -0
- package/dist/maptiler-sdk.min.mjs +1 -1
- package/dist/maptiler-sdk.mjs +1 -1
- package/dist/maptiler-sdk.mjs.map +1 -1
- package/dist/maptiler-sdk.umd.js +1 -1
- package/dist/maptiler-sdk.umd.js.map +1 -1
- package/dist/maptiler-sdk.umd.min.js +1 -1
- package/package.json +1 -1
- package/readme.md +22 -22
- package/src/defaults.ts +1 -1
|
@@ -576,4 +576,4 @@ uniform ${S} ${E} u_${M};
|
|
|
576
576
|
`),W=y.createShader(y.FRAGMENT_SHADER);if(y.isContextLost())return void(this.failedToCreate=!0);y.shaderSource(W,q),y.compileShader(W),y.attachShader(this.program,W);const te=y.createShader(y.VERTEX_SHADER);if(y.isContextLost())return void(this.failedToCreate=!0);y.shaderSource(te,U),y.compileShader(te),y.attachShader(this.program,te),this.attributes={};const ae={};this.numAttributes=E.length;for(let he=0;he<this.numAttributes;he++)E[he]&&(y.bindAttribLocation(this.program,he,E[he]),this.attributes[E[he]]=he);y.linkProgram(this.program),y.deleteShader(te),y.deleteShader(W);for(let he=0;he<N.length;he++){const me=N[he];if(me&&!ae[me]){const Te=y.getUniformLocation(this.program,me);Te&&(ae[me]=Te)}}this.fixedUniforms=p(t,ae),this.terrainUniforms=((he,me)=>({u_depth:new c.Uniform1i(he,me.u_depth),u_terrain:new c.Uniform1i(he,me.u_terrain),u_terrain_dim:new c.Uniform1f(he,me.u_terrain_dim),u_terrain_matrix:new c.UniformMatrix4f(he,me.u_terrain_matrix),u_terrain_unpack:new c.Uniform4f(he,me.u_terrain_unpack),u_terrain_exaggeration:new c.Uniform1f(he,me.u_terrain_exaggeration)}))(t,ae),this.binderUniforms=h?h.getUniforms(t,ae):[]}draw(t,n,a,h,p,m,_,y,v,S,E,M,D,B,L,N,X,q){const U=t.gl;if(this.failedToCreate)return;if(t.program.set(this.program),t.setDepthMode(a),t.setStencilMode(h),t.setColorMode(p),t.setCullFace(m),y){t.activeTexture.set(U.TEXTURE2),U.bindTexture(U.TEXTURE_2D,y.depthTexture),t.activeTexture.set(U.TEXTURE3),U.bindTexture(U.TEXTURE_2D,y.texture);for(const te in this.terrainUniforms)this.terrainUniforms[te].set(y[te])}for(const te in this.fixedUniforms)this.fixedUniforms[te].set(_[te]);L&&L.setUniforms(t,this.binderUniforms,D,{zoom:B});let W=0;switch(n){case U.LINES:W=2;break;case U.TRIANGLES:W=3;break;case U.LINE_STRIP:W=1}for(const te of M.get()){const ae=te.vaos||(te.vaos={});(ae[v]||(ae[v]=new ua)).bind(t,this,S,L?L.getPaintVertexBuffers():[],E,te.vertexOffset,N,X,q),U.drawElements(n,te.primitiveLength*W,U.UNSIGNED_SHORT,te.primitiveOffset*W*2)}}}function Po(o,t,n){const a=1/st(n,1,t.transform.tileZoom),h=Math.pow(2,n.tileID.overscaledZ),p=n.tileSize*Math.pow(2,t.transform.tileZoom)/h,m=p*(n.tileID.canonical.x+n.tileID.wrap*h),_=p*n.tileID.canonical.y;return{u_image:0,u_texsize:n.imageAtlasTexture.size,u_scale:[a,o.fromScale,o.toScale],u_fade:o.t,u_pixel_coord_upper:[m>>16,_>>16],u_pixel_coord_lower:[65535&m,65535&_]}}const da=(o,t,n,a)=>{const h=t.style.light,p=h.properties.get("position"),m=[p.x,p.y,p.z],_=c.create$1();h.properties.get("anchor")==="viewport"&&c.fromRotation(_,-t.transform.angle),c.transformMat3(m,m,_);const y=h.properties.get("color");return{u_matrix:o,u_lightpos:m,u_lightintensity:h.properties.get("intensity"),u_lightcolor:[y.r,y.g,y.b],u_vertical_gradient:+n,u_opacity:a}},Xl=(o,t,n,a,h,p,m)=>c.extend(da(o,t,n,a),Po(p,t,m),{u_height_factor:-Math.pow(2,h.overscaledZ)/m.tileSize/8}),Ms=o=>({u_matrix:o}),ma=(o,t,n,a)=>c.extend(Ms(o),Po(n,t,a)),ko=(o,t)=>({u_matrix:o,u_world:t}),zo=(o,t,n,a,h)=>c.extend(ma(o,t,n,a),{u_world:h}),Lo=(o,t,n,a)=>{const h=o.transform;let p,m;if(a.paint.get("circle-pitch-alignment")==="map"){const _=st(n,1,h.zoom);p=!0,m=[_,_]}else p=!1,m=h.pixelsToGLUnits;return{u_camera_to_center_distance:h.cameraToCenterDistance,u_scale_with_map:+(a.paint.get("circle-pitch-scale")==="map"),u_matrix:o.translatePosMatrix(t.posMatrix,n,a.paint.get("circle-translate"),a.paint.get("circle-translate-anchor")),u_pitch_with_map:+p,u_device_pixel_ratio:o.pixelRatio,u_extrude_scale:m}},Hr=(o,t,n)=>{const a=st(n,1,t.zoom),h=Math.pow(2,t.zoom-n.tileID.overscaledZ),p=n.tileID.overscaleFactor();return{u_matrix:o,u_camera_to_center_distance:t.cameraToCenterDistance,u_pixels_to_tile_units:a,u_extrude_scale:[t.pixelsToGLUnits[0]/(a*h),t.pixelsToGLUnits[1]/(a*h)],u_overscale_factor:p}},Xn=(o,t,n=1)=>({u_matrix:o,u_color:t,u_overlay:0,u_overlay_scale:n}),_n=o=>({u_matrix:o}),Ps=(o,t,n,a)=>({u_matrix:o,u_extrude_scale:st(t,1,n),u_intensity:a});function ks(o,t){const n=Math.pow(2,t.canonical.z),a=t.canonical.y;return[new c.MercatorCoordinate(0,a/n).toLngLat().lat,new c.MercatorCoordinate(0,(a+1)/n).toLngLat().lat]}const Wn=(o,t,n,a)=>{const h=o.transform;return{u_matrix:qt(o,t,n,a),u_ratio:1/st(t,1,h.zoom),u_device_pixel_ratio:o.pixelRatio,u_units_to_pixels:[1/h.pixelsToGLUnits[0],1/h.pixelsToGLUnits[1]]}},Do=(o,t,n,a,h)=>c.extend(Wn(o,t,n,h),{u_image:0,u_image_height:a}),fa=(o,t,n,a,h)=>{const p=o.transform,m=yn(t,p);return{u_matrix:qt(o,t,n,h),u_texsize:t.imageAtlasTexture.size,u_ratio:1/st(t,1,p.zoom),u_device_pixel_ratio:o.pixelRatio,u_image:0,u_scale:[m,a.fromScale,a.toScale],u_fade:a.t,u_units_to_pixels:[1/p.pixelsToGLUnits[0],1/p.pixelsToGLUnits[1]]}},zs=(o,t,n,a,h,p)=>{const m=o.lineAtlas,_=yn(t,o.transform),y=n.layout.get("line-cap")==="round",v=m.getDash(a.from,y),S=m.getDash(a.to,y),E=v.width*h.fromScale,M=S.width*h.toScale;return c.extend(Wn(o,t,n,p),{u_patternscale_a:[_/E,-v.height/2],u_patternscale_b:[_/M,-S.height/2],u_sdfgamma:m.width/(256*Math.min(E,M)*o.pixelRatio)/2,u_image:0,u_tex_y_a:v.y,u_tex_y_b:S.y,u_mix:h.t})};function yn(o,t){return 1/st(o,1,t.tileZoom)}function qt(o,t,n,a){return o.translatePosMatrix(a?a.posMatrix:t.tileID.posMatrix,t,n.paint.get("line-translate"),n.paint.get("line-translate-anchor"))}const Ls=(o,t,n,a,h)=>{return{u_matrix:o,u_tl_parent:t,u_scale_parent:n,u_buffer_scale:1,u_fade_t:a.mix,u_opacity:a.opacity*h.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:h.paint.get("raster-brightness-min"),u_brightness_high:h.paint.get("raster-brightness-max"),u_saturation_factor:(m=h.paint.get("raster-saturation"),m>0?1-1/(1.001-m):-m),u_contrast_factor:(p=h.paint.get("raster-contrast"),p>0?1/(1-p):1+p),u_spin_weights:Ro(h.paint.get("raster-hue-rotate"))};var p,m};function Ro(o){o*=Math.PI/180;const t=Math.sin(o),n=Math.cos(o);return[(2*n+1)/3,(-Math.sqrt(3)*t-n+1)/3,(Math.sqrt(3)*t-n+1)/3]}const ga=(o,t,n,a,h,p,m,_,y,v)=>{const S=h.transform;return{u_is_size_zoom_constant:+(o==="constant"||o==="source"),u_is_size_feature_constant:+(o==="constant"||o==="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:h.options.fadeDuration?h.symbolFadeChange:1,u_matrix:p,u_label_plane_matrix:m,u_coord_matrix:_,u_is_text:+y,u_pitch_with_map:+a,u_texsize:v,u_texture:0}},_a=(o,t,n,a,h,p,m,_,y,v,S)=>{const E=h.transform;return c.extend(ga(o,t,n,a,h,p,m,_,y,v),{u_gamma_scale:a?Math.cos(E._pitch)*E.cameraToCenterDistance:1,u_device_pixel_ratio:h.pixelRatio,u_is_halo:+S})},ya=(o,t,n,a,h,p,m,_,y,v)=>c.extend(_a(o,t,n,a,h,p,m,_,!0,y,!0),{u_texsize_icon:v,u_texture_icon:1}),Bo=(o,t,n)=>({u_matrix:o,u_opacity:t,u_color:n}),Wl=(o,t,n,a,h,p)=>c.extend(function(m,_,y,v){const S=y.imageManager.getPattern(m.from.toString()),E=y.imageManager.getPattern(m.to.toString()),{width:M,height:D}=y.imageManager.getPixelSize(),B=Math.pow(2,v.tileID.overscaledZ),L=v.tileSize*Math.pow(2,y.transform.tileZoom)/B,N=L*(v.tileID.canonical.x+v.tileID.wrap*B),X=L*v.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:S.tl,u_pattern_br_a:S.br,u_pattern_tl_b:E.tl,u_pattern_br_b:E.br,u_texsize:[M,D],u_mix:_.t,u_pattern_size_a:S.displaySize,u_pattern_size_b:E.displaySize,u_scale_a:_.fromScale,u_scale_b:_.toScale,u_tile_units_to_pixels:1/st(v,1,y.transform.tileZoom),u_pixel_coord_upper:[N>>16,X>>16],u_pixel_coord_lower:[65535&N,65535&X]}}(a,p,n,h),{u_matrix:o,u_opacity:t}),Hl={fillExtrusion:(o,t)=>({u_matrix:new c.UniformMatrix4f(o,t.u_matrix),u_lightpos:new c.Uniform3f(o,t.u_lightpos),u_lightintensity:new c.Uniform1f(o,t.u_lightintensity),u_lightcolor:new c.Uniform3f(o,t.u_lightcolor),u_vertical_gradient:new c.Uniform1f(o,t.u_vertical_gradient),u_opacity:new c.Uniform1f(o,t.u_opacity)}),fillExtrusionPattern:(o,t)=>({u_matrix:new c.UniformMatrix4f(o,t.u_matrix),u_lightpos:new c.Uniform3f(o,t.u_lightpos),u_lightintensity:new c.Uniform1f(o,t.u_lightintensity),u_lightcolor:new c.Uniform3f(o,t.u_lightcolor),u_vertical_gradient:new c.Uniform1f(o,t.u_vertical_gradient),u_height_factor:new c.Uniform1f(o,t.u_height_factor),u_image:new c.Uniform1i(o,t.u_image),u_texsize:new c.Uniform2f(o,t.u_texsize),u_pixel_coord_upper:new c.Uniform2f(o,t.u_pixel_coord_upper),u_pixel_coord_lower:new c.Uniform2f(o,t.u_pixel_coord_lower),u_scale:new c.Uniform3f(o,t.u_scale),u_fade:new c.Uniform1f(o,t.u_fade),u_opacity:new c.Uniform1f(o,t.u_opacity)}),fill:(o,t)=>({u_matrix:new c.UniformMatrix4f(o,t.u_matrix)}),fillPattern:(o,t)=>({u_matrix:new c.UniformMatrix4f(o,t.u_matrix),u_image:new c.Uniform1i(o,t.u_image),u_texsize:new c.Uniform2f(o,t.u_texsize),u_pixel_coord_upper:new c.Uniform2f(o,t.u_pixel_coord_upper),u_pixel_coord_lower:new c.Uniform2f(o,t.u_pixel_coord_lower),u_scale:new c.Uniform3f(o,t.u_scale),u_fade:new c.Uniform1f(o,t.u_fade)}),fillOutline:(o,t)=>({u_matrix:new c.UniformMatrix4f(o,t.u_matrix),u_world:new c.Uniform2f(o,t.u_world)}),fillOutlinePattern:(o,t)=>({u_matrix:new c.UniformMatrix4f(o,t.u_matrix),u_world:new c.Uniform2f(o,t.u_world),u_image:new c.Uniform1i(o,t.u_image),u_texsize:new c.Uniform2f(o,t.u_texsize),u_pixel_coord_upper:new c.Uniform2f(o,t.u_pixel_coord_upper),u_pixel_coord_lower:new c.Uniform2f(o,t.u_pixel_coord_lower),u_scale:new c.Uniform3f(o,t.u_scale),u_fade:new c.Uniform1f(o,t.u_fade)}),circle:(o,t)=>({u_camera_to_center_distance:new c.Uniform1f(o,t.u_camera_to_center_distance),u_scale_with_map:new c.Uniform1i(o,t.u_scale_with_map),u_pitch_with_map:new c.Uniform1i(o,t.u_pitch_with_map),u_extrude_scale:new c.Uniform2f(o,t.u_extrude_scale),u_device_pixel_ratio:new c.Uniform1f(o,t.u_device_pixel_ratio),u_matrix:new c.UniformMatrix4f(o,t.u_matrix)}),collisionBox:(o,t)=>({u_matrix:new c.UniformMatrix4f(o,t.u_matrix),u_camera_to_center_distance:new c.Uniform1f(o,t.u_camera_to_center_distance),u_pixels_to_tile_units:new c.Uniform1f(o,t.u_pixels_to_tile_units),u_extrude_scale:new c.Uniform2f(o,t.u_extrude_scale),u_overscale_factor:new c.Uniform1f(o,t.u_overscale_factor)}),collisionCircle:(o,t)=>({u_matrix:new c.UniformMatrix4f(o,t.u_matrix),u_inv_matrix:new c.UniformMatrix4f(o,t.u_inv_matrix),u_camera_to_center_distance:new c.Uniform1f(o,t.u_camera_to_center_distance),u_viewport_size:new c.Uniform2f(o,t.u_viewport_size)}),debug:(o,t)=>({u_color:new c.UniformColor(o,t.u_color),u_matrix:new c.UniformMatrix4f(o,t.u_matrix),u_overlay:new c.Uniform1i(o,t.u_overlay),u_overlay_scale:new c.Uniform1f(o,t.u_overlay_scale)}),clippingMask:(o,t)=>({u_matrix:new c.UniformMatrix4f(o,t.u_matrix)}),heatmap:(o,t)=>({u_extrude_scale:new c.Uniform1f(o,t.u_extrude_scale),u_intensity:new c.Uniform1f(o,t.u_intensity),u_matrix:new c.UniformMatrix4f(o,t.u_matrix)}),heatmapTexture:(o,t)=>({u_matrix:new c.UniformMatrix4f(o,t.u_matrix),u_world:new c.Uniform2f(o,t.u_world),u_image:new c.Uniform1i(o,t.u_image),u_color_ramp:new c.Uniform1i(o,t.u_color_ramp),u_opacity:new c.Uniform1f(o,t.u_opacity)}),hillshade:(o,t)=>({u_matrix:new c.UniformMatrix4f(o,t.u_matrix),u_image:new c.Uniform1i(o,t.u_image),u_latrange:new c.Uniform2f(o,t.u_latrange),u_light:new c.Uniform2f(o,t.u_light),u_shadow:new c.UniformColor(o,t.u_shadow),u_highlight:new c.UniformColor(o,t.u_highlight),u_accent:new c.UniformColor(o,t.u_accent)}),hillshadePrepare:(o,t)=>({u_matrix:new c.UniformMatrix4f(o,t.u_matrix),u_image:new c.Uniform1i(o,t.u_image),u_dimension:new c.Uniform2f(o,t.u_dimension),u_zoom:new c.Uniform1f(o,t.u_zoom),u_unpack:new c.Uniform4f(o,t.u_unpack)}),line:(o,t)=>({u_matrix:new c.UniformMatrix4f(o,t.u_matrix),u_ratio:new c.Uniform1f(o,t.u_ratio),u_device_pixel_ratio:new c.Uniform1f(o,t.u_device_pixel_ratio),u_units_to_pixels:new c.Uniform2f(o,t.u_units_to_pixels)}),lineGradient:(o,t)=>({u_matrix:new c.UniformMatrix4f(o,t.u_matrix),u_ratio:new c.Uniform1f(o,t.u_ratio),u_device_pixel_ratio:new c.Uniform1f(o,t.u_device_pixel_ratio),u_units_to_pixels:new c.Uniform2f(o,t.u_units_to_pixels),u_image:new c.Uniform1i(o,t.u_image),u_image_height:new c.Uniform1f(o,t.u_image_height)}),linePattern:(o,t)=>({u_matrix:new c.UniformMatrix4f(o,t.u_matrix),u_texsize:new c.Uniform2f(o,t.u_texsize),u_ratio:new c.Uniform1f(o,t.u_ratio),u_device_pixel_ratio:new c.Uniform1f(o,t.u_device_pixel_ratio),u_image:new c.Uniform1i(o,t.u_image),u_units_to_pixels:new c.Uniform2f(o,t.u_units_to_pixels),u_scale:new c.Uniform3f(o,t.u_scale),u_fade:new c.Uniform1f(o,t.u_fade)}),lineSDF:(o,t)=>({u_matrix:new c.UniformMatrix4f(o,t.u_matrix),u_ratio:new c.Uniform1f(o,t.u_ratio),u_device_pixel_ratio:new c.Uniform1f(o,t.u_device_pixel_ratio),u_units_to_pixels:new c.Uniform2f(o,t.u_units_to_pixels),u_patternscale_a:new c.Uniform2f(o,t.u_patternscale_a),u_patternscale_b:new c.Uniform2f(o,t.u_patternscale_b),u_sdfgamma:new c.Uniform1f(o,t.u_sdfgamma),u_image:new c.Uniform1i(o,t.u_image),u_tex_y_a:new c.Uniform1f(o,t.u_tex_y_a),u_tex_y_b:new c.Uniform1f(o,t.u_tex_y_b),u_mix:new c.Uniform1f(o,t.u_mix)}),raster:(o,t)=>({u_matrix:new c.UniformMatrix4f(o,t.u_matrix),u_tl_parent:new c.Uniform2f(o,t.u_tl_parent),u_scale_parent:new c.Uniform1f(o,t.u_scale_parent),u_buffer_scale:new c.Uniform1f(o,t.u_buffer_scale),u_fade_t:new c.Uniform1f(o,t.u_fade_t),u_opacity:new c.Uniform1f(o,t.u_opacity),u_image0:new c.Uniform1i(o,t.u_image0),u_image1:new c.Uniform1i(o,t.u_image1),u_brightness_low:new c.Uniform1f(o,t.u_brightness_low),u_brightness_high:new c.Uniform1f(o,t.u_brightness_high),u_saturation_factor:new c.Uniform1f(o,t.u_saturation_factor),u_contrast_factor:new c.Uniform1f(o,t.u_contrast_factor),u_spin_weights:new c.Uniform3f(o,t.u_spin_weights)}),symbolIcon:(o,t)=>({u_is_size_zoom_constant:new c.Uniform1i(o,t.u_is_size_zoom_constant),u_is_size_feature_constant:new c.Uniform1i(o,t.u_is_size_feature_constant),u_size_t:new c.Uniform1f(o,t.u_size_t),u_size:new c.Uniform1f(o,t.u_size),u_camera_to_center_distance:new c.Uniform1f(o,t.u_camera_to_center_distance),u_pitch:new c.Uniform1f(o,t.u_pitch),u_rotate_symbol:new c.Uniform1i(o,t.u_rotate_symbol),u_aspect_ratio:new c.Uniform1f(o,t.u_aspect_ratio),u_fade_change:new c.Uniform1f(o,t.u_fade_change),u_matrix:new c.UniformMatrix4f(o,t.u_matrix),u_label_plane_matrix:new c.UniformMatrix4f(o,t.u_label_plane_matrix),u_coord_matrix:new c.UniformMatrix4f(o,t.u_coord_matrix),u_is_text:new c.Uniform1i(o,t.u_is_text),u_pitch_with_map:new c.Uniform1i(o,t.u_pitch_with_map),u_texsize:new c.Uniform2f(o,t.u_texsize),u_texture:new c.Uniform1i(o,t.u_texture)}),symbolSDF:(o,t)=>({u_is_size_zoom_constant:new c.Uniform1i(o,t.u_is_size_zoom_constant),u_is_size_feature_constant:new c.Uniform1i(o,t.u_is_size_feature_constant),u_size_t:new c.Uniform1f(o,t.u_size_t),u_size:new c.Uniform1f(o,t.u_size),u_camera_to_center_distance:new c.Uniform1f(o,t.u_camera_to_center_distance),u_pitch:new c.Uniform1f(o,t.u_pitch),u_rotate_symbol:new c.Uniform1i(o,t.u_rotate_symbol),u_aspect_ratio:new c.Uniform1f(o,t.u_aspect_ratio),u_fade_change:new c.Uniform1f(o,t.u_fade_change),u_matrix:new c.UniformMatrix4f(o,t.u_matrix),u_label_plane_matrix:new c.UniformMatrix4f(o,t.u_label_plane_matrix),u_coord_matrix:new c.UniformMatrix4f(o,t.u_coord_matrix),u_is_text:new c.Uniform1i(o,t.u_is_text),u_pitch_with_map:new c.Uniform1i(o,t.u_pitch_with_map),u_texsize:new c.Uniform2f(o,t.u_texsize),u_texture:new c.Uniform1i(o,t.u_texture),u_gamma_scale:new c.Uniform1f(o,t.u_gamma_scale),u_device_pixel_ratio:new c.Uniform1f(o,t.u_device_pixel_ratio),u_is_halo:new c.Uniform1i(o,t.u_is_halo)}),symbolTextAndIcon:(o,t)=>({u_is_size_zoom_constant:new c.Uniform1i(o,t.u_is_size_zoom_constant),u_is_size_feature_constant:new c.Uniform1i(o,t.u_is_size_feature_constant),u_size_t:new c.Uniform1f(o,t.u_size_t),u_size:new c.Uniform1f(o,t.u_size),u_camera_to_center_distance:new c.Uniform1f(o,t.u_camera_to_center_distance),u_pitch:new c.Uniform1f(o,t.u_pitch),u_rotate_symbol:new c.Uniform1i(o,t.u_rotate_symbol),u_aspect_ratio:new c.Uniform1f(o,t.u_aspect_ratio),u_fade_change:new c.Uniform1f(o,t.u_fade_change),u_matrix:new c.UniformMatrix4f(o,t.u_matrix),u_label_plane_matrix:new c.UniformMatrix4f(o,t.u_label_plane_matrix),u_coord_matrix:new c.UniformMatrix4f(o,t.u_coord_matrix),u_is_text:new c.Uniform1i(o,t.u_is_text),u_pitch_with_map:new c.Uniform1i(o,t.u_pitch_with_map),u_texsize:new c.Uniform2f(o,t.u_texsize),u_texsize_icon:new c.Uniform2f(o,t.u_texsize_icon),u_texture:new c.Uniform1i(o,t.u_texture),u_texture_icon:new c.Uniform1i(o,t.u_texture_icon),u_gamma_scale:new c.Uniform1f(o,t.u_gamma_scale),u_device_pixel_ratio:new c.Uniform1f(o,t.u_device_pixel_ratio),u_is_halo:new c.Uniform1i(o,t.u_is_halo)}),background:(o,t)=>({u_matrix:new c.UniformMatrix4f(o,t.u_matrix),u_opacity:new c.Uniform1f(o,t.u_opacity),u_color:new c.UniformColor(o,t.u_color)}),backgroundPattern:(o,t)=>({u_matrix:new c.UniformMatrix4f(o,t.u_matrix),u_opacity:new c.Uniform1f(o,t.u_opacity),u_image:new c.Uniform1i(o,t.u_image),u_pattern_tl_a:new c.Uniform2f(o,t.u_pattern_tl_a),u_pattern_br_a:new c.Uniform2f(o,t.u_pattern_br_a),u_pattern_tl_b:new c.Uniform2f(o,t.u_pattern_tl_b),u_pattern_br_b:new c.Uniform2f(o,t.u_pattern_br_b),u_texsize:new c.Uniform2f(o,t.u_texsize),u_mix:new c.Uniform1f(o,t.u_mix),u_pattern_size_a:new c.Uniform2f(o,t.u_pattern_size_a),u_pattern_size_b:new c.Uniform2f(o,t.u_pattern_size_b),u_scale_a:new c.Uniform1f(o,t.u_scale_a),u_scale_b:new c.Uniform1f(o,t.u_scale_b),u_pixel_coord_upper:new c.Uniform2f(o,t.u_pixel_coord_upper),u_pixel_coord_lower:new c.Uniform2f(o,t.u_pixel_coord_lower),u_tile_units_to_pixels:new c.Uniform1f(o,t.u_tile_units_to_pixels)}),terrain:(o,t)=>({u_matrix:new c.UniformMatrix4f(o,t.u_matrix),u_texture:new c.Uniform1i(o,t.u_texture),u_ele_delta:new c.Uniform1f(o,t.u_ele_delta)}),terrainDepth:(o,t)=>({u_matrix:new c.UniformMatrix4f(o,t.u_matrix),u_ele_delta:new c.Uniform1f(o,t.u_ele_delta)}),terrainCoords:(o,t)=>({u_matrix:new c.UniformMatrix4f(o,t.u_matrix),u_texture:new c.Uniform1i(o,t.u_texture),u_terrain_coords_id:new c.Uniform1f(o,t.u_terrain_coords_id),u_ele_delta:new c.Uniform1f(o,t.u_ele_delta)})};class xa{constructor(t,n,a){this.context=t;const h=t.gl;this.buffer=h.createBuffer(),this.dynamicDraw=Boolean(a),this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),h.bufferData(h.ELEMENT_ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?h.DYNAMIC_DRAW:h.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 va={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class ba{constructor(t,n,a,h){this.length=n.length,this.attributes=a,this.itemSize=n.bytesPerElement,this.dynamicDraw=h,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 a=0;a<this.attributes.length;a++){const h=n.attributes[this.attributes[a].name];h!==void 0&&t.enableVertexAttribArray(h)}}setVertexAttribPointers(t,n,a){for(let h=0;h<this.attributes.length;h++){const p=this.attributes[h],m=n.attributes[p.name];m!==void 0&&t.vertexAttribPointer(m,p.components,t[va[p.type]],!1,this.itemSize,p.offset+this.itemSize*(a||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class xt{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 Fo extends xt{getDefault(){return c.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 Oo extends xt{getDefault(){return 1}set(t){(t!==this.current||this.dirty)&&(this.gl.clearDepth(t),this.current=t,this.dirty=!1)}}class Kl extends xt{getDefault(){return 0}set(t){(t!==this.current||this.dirty)&&(this.gl.clearStencil(t),this.current=t,this.dirty=!1)}}class Hn extends xt{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 Kn extends xt{getDefault(){return!0}set(t){(t!==this.current||this.dirty)&&(this.gl.depthMask(t),this.current=t,this.dirty=!1)}}class Uo extends xt{getDefault(){return 255}set(t){(t!==this.current||this.dirty)&&(this.gl.stencilMask(t),this.current=t,this.dirty=!1)}}class Vi extends xt{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 wa extends xt{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 Ds extends xt{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 Rs extends xt{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 Ta extends xt{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 Sa extends xt{getDefault(){return this.gl.LESS}set(t){(t!==this.current||this.dirty)&&(this.gl.depthFunc(t),this.current=t,this.dirty=!1)}}class Bs extends xt{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 Ea extends xt{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 Ia extends xt{getDefault(){return c.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 Fs extends xt{getDefault(){return this.gl.FUNC_ADD}set(t){(t!==this.current||this.dirty)&&(this.gl.blendEquation(t),this.current=t,this.dirty=!1)}}class Vo extends xt{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 No extends xt{getDefault(){return this.gl.BACK}set(t){(t!==this.current||this.dirty)&&(this.gl.cullFace(t),this.current=t,this.dirty=!1)}}class xn extends xt{getDefault(){return this.gl.CCW}set(t){(t!==this.current||this.dirty)&&(this.gl.frontFace(t),this.current=t,this.dirty=!1)}}class Jl extends xt{getDefault(){return null}set(t){(t!==this.current||this.dirty)&&(this.gl.useProgram(t),this.current=t,this.dirty=!1)}}class Yl extends xt{getDefault(){return this.gl.TEXTURE0}set(t){(t!==this.current||this.dirty)&&(this.gl.activeTexture(t),this.current=t,this.dirty=!1)}}class Ql extends xt{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 ec extends xt{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 tc extends xt{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 ic extends xt{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 Aa extends xt{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 Os extends xt{getDefault(){return null}set(t){const n=this.gl;n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class Ca extends xt{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 Ma extends xt{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 vn extends xt{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 $o extends xt{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 Pa extends xt{constructor(t,n){super(t),this.context=t,this.parent=n}getDefault(){return null}}class ka extends Pa{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 Kr extends Pa{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 jo{constructor(t,n,a,h){this.context=t,this.width=n,this.height=a;const p=t.gl,m=this.framebuffer=p.createFramebuffer();if(this.colorAttachment=new ka(t,m),h&&(this.depthAttachment=new Kr(t,m)),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 a=this.depthAttachment.get();a&&t.deleteRenderbuffer(a)}t.deleteFramebuffer(this.framebuffer)}}class Ut{constructor(t,n,a){this.blendFunction=t,this.blendColor=n,this.mask=a}}Ut.Replace=[1,0],Ut.disabled=new Ut(Ut.Replace,c.Color.transparent,[!1,!1,!1,!1]),Ut.unblended=new Ut(Ut.Replace,c.Color.transparent,[!0,!0,!0,!0]),Ut.alphaBlended=new Ut([1,771],c.Color.transparent,[!0,!0,!0,!0]);class bn{constructor(t){this.gl=t,this.extVertexArrayObject=this.gl.getExtension("OES_vertex_array_object"),this.clearColor=new Fo(this),this.clearDepth=new Oo(this),this.clearStencil=new Kl(this),this.colorMask=new Hn(this),this.depthMask=new Kn(this),this.stencilMask=new Uo(this),this.stencilFunc=new Vi(this),this.stencilOp=new wa(this),this.stencilTest=new Ds(this),this.depthRange=new Rs(this),this.depthTest=new Ta(this),this.depthFunc=new Sa(this),this.blend=new Bs(this),this.blendFunc=new Ea(this),this.blendColor=new Ia(this),this.blendEquation=new Fs(this),this.cullFace=new Vo(this),this.cullFaceSide=new No(this),this.frontFace=new xn(this),this.program=new Jl(this),this.activeTexture=new Yl(this),this.viewport=new Ql(this),this.bindFramebuffer=new ec(this),this.bindRenderbuffer=new tc(this),this.bindTexture=new ic(this),this.bindVertexBuffer=new Aa(this),this.bindElementBuffer=new Os(this),this.bindVertexArrayOES=this.extVertexArrayObject&&new Ca(this),this.pixelStoreUnpack=new Ma(this),this.pixelStoreUnpackPremultiplyAlpha=new vn(this),this.pixelStoreUnpackFlipY=new $o(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 xa(this,t,n)}createVertexBuffer(t,n,a){return new ba(this,t,n,a)}createRenderbuffer(t,n,a){const h=this.gl,p=h.createRenderbuffer();return this.bindRenderbuffer.set(p),h.renderbufferStorage(h.RENDERBUFFER,t,n,a),this.bindRenderbuffer.set(null),p}createFramebuffer(t,n,a){return new jo(this,t,n,a)}clear({color:t,depth:n}){const a=this.gl;let h=0;t&&(h|=a.COLOR_BUFFER_BIT,this.clearColor.set(t),this.colorMask.set([!0,!0,!0,!0])),n!==void 0&&(h|=a.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(n),this.depthMask.set(!0)),a.clear(h)}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){Me(t.blendFunction,Ut.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 dt{constructor(t,n,a){this.func=t,this.mask=n,this.range=a}}dt.ReadOnly=!1,dt.ReadWrite=!0,dt.disabled=new dt(519,dt.ReadOnly,[0,1]);const Jn=7680;class et{constructor(t,n,a,h,p,m){this.test=t,this.ref=n,this.mask=a,this.fail=h,this.depthFail=p,this.pass=m}}et.disabled=new et({func:519,mask:0},0,0,Jn,Jn,Jn);class kt{constructor(t,n,a){this.enable=t,this.mode=n,this.frontFace=a}}let Us;function za(o,t,n,a,h,p,m){const _=o.context,y=_.gl,v=o.useProgram("collisionBox"),S=[];let E=0,M=0;for(let U=0;U<a.length;U++){const W=a[U],te=t.getTile(W),ae=te.getBucket(n);if(!ae)continue;let he=W.posMatrix;h[0]===0&&h[1]===0||(he=o.translatePosMatrix(W.posMatrix,te,h,p));const me=m?ae.textCollisionBox:ae.iconCollisionBox,Te=ae.collisionCircleArray;if(Te.length>0){const ye=c.create(),Ae=he;c.mul(ye,ae.placementInvProjMatrix,o.transform.glCoordMatrix),c.mul(ye,ye,ae.placementViewportMatrix),S.push({circleArray:Te,circleOffset:M,transform:Ae,invTransform:ye,coord:W}),E+=Te.length/4,M=E}me&&v.draw(_,y.LINES,dt.disabled,et.disabled,o.colorModeForRenderPass(),kt.disabled,Hr(he,o.transform,te),o.style.map.terrain&&o.style.map.terrain.getTerrainData(W),n.id,me.layoutVertexBuffer,me.indexBuffer,me.segments,null,o.transform.zoom,null,null,me.collisionVertexBuffer)}if(!m||!S.length)return;const D=o.useProgram("collisionCircle"),B=new c.CollisionCircleLayoutArray;B.resize(4*E),B._trim();let L=0;for(const U of S)for(let W=0;W<U.circleArray.length/4;W++){const te=4*W,ae=U.circleArray[te+0],he=U.circleArray[te+1],me=U.circleArray[te+2],Te=U.circleArray[te+3];B.emplace(L++,ae,he,me,Te,0),B.emplace(L++,ae,he,me,Te,1),B.emplace(L++,ae,he,me,Te,2),B.emplace(L++,ae,he,me,Te,3)}(!Us||Us.length<2*E)&&(Us=function(U){const W=2*U,te=new c.QuadTriangleArray;te.resize(W),te._trim();for(let ae=0;ae<W;ae++){const he=6*ae;te.uint16[he+0]=4*ae+0,te.uint16[he+1]=4*ae+1,te.uint16[he+2]=4*ae+2,te.uint16[he+3]=4*ae+2,te.uint16[he+4]=4*ae+3,te.uint16[he+5]=4*ae+0}return te}(E));const N=_.createIndexBuffer(Us,!0),X=_.createVertexBuffer(B,c.collisionCircleLayout.members,!0);for(const U of S){const W={u_matrix:U.transform,u_inv_matrix:U.invTransform,u_camera_to_center_distance:(q=o.transform).cameraToCenterDistance,u_viewport_size:[q.width,q.height]};D.draw(_,y.TRIANGLES,dt.disabled,et.disabled,o.colorModeForRenderPass(),kt.disabled,W,o.style.map.terrain&&o.style.map.terrain.getTerrainData(U.coord),n.id,X,N,c.SegmentVector.simpleSegment(0,2*U.circleOffset,U.circleArray.length,U.circleArray.length/2),null,o.transform.zoom,null,null,null)}var q;X.destroy(),N.destroy()}kt.disabled=new kt(!1,1029,2305),kt.backCCW=new kt(!0,1029,2305);const Yn=c.identity(new Float32Array(16));function rc(o,t,n,a,h,p){const{horizontalAlign:m,verticalAlign:_}=c.getAnchorAlignment(o),y=-(m-.5)*t,v=-(_-.5)*n,S=c.evaluateVariableOffset(o,a);return new c.pointGeometry((y/h+S[0])*p,(v/h+S[1])*p)}function nc(o,t,n,a,h,p,m,_,y,v,S){const E=o.text.placedSymbolArray,M=o.text.dynamicLayoutVertexArray,D=o.icon.dynamicLayoutVertexArray,B={};M.clear();for(let L=0;L<E.length;L++){const N=E.get(L),X=N.hidden||!N.crossTileID||o.allowVerticalPlacement&&!N.placedOrientation?null:a[N.crossTileID];if(X){const q=new c.pointGeometry(N.anchorX,N.anchorY),U=Ce(q,n?m:p,S),W=at(h.cameraToCenterDistance,U.signedDistanceFromCamera);let te=c.evaluateSizeForFeature(o.textSizeData,y,N)*W/c.ONE_EM;n&&(te*=o.tilePixelRatio/_);const{width:ae,height:he,anchor:me,textOffset:Te,textBoxScale:ye}=X,Ae=rc(me,ae,he,Te,ye,te),Ge=n?Ce(q.add(Ae),p,S).point:U.point.add(t?Ae.rotate(-h.angle):Ae),rt=o.allowVerticalPlacement&&N.placedOrientation===c.WritingMode.vertical?Math.PI/2:0;for(let nt=0;nt<N.numGlyphs;nt++)c.addDynamicAttributes(M,Ge,rt);v&&N.associatedIconIndex>=0&&(B[N.associatedIconIndex]={shiftedAnchor:Ge,angle:rt})}else Xt(N.numGlyphs,M)}if(v){D.clear();const L=o.icon.placedSymbolArray;for(let N=0;N<L.length;N++){const X=L.get(N);if(X.hidden)Xt(X.numGlyphs,D);else{const q=B[N];if(q)for(let U=0;U<X.numGlyphs;U++)c.addDynamicAttributes(D,q.shiftedAnchor,q.angle);else Xt(X.numGlyphs,D)}}o.icon.dynamicLayoutVertexBuffer.updateData(D)}o.text.dynamicLayoutVertexBuffer.updateData(M)}function Go(o,t,n){return n.iconsInText&&t?"symbolTextAndIcon":o?"symbolSDF":"symbolIcon"}function qo(o,t,n,a,h,p,m,_,y,v,S,E){const M=o.context,D=M.gl,B=o.transform,L=_==="map",N=y==="map",X=_!=="viewport"&&n.layout.get("symbol-placement")!=="point",q=L&&!N&&!X,U=!n.layout.get("symbol-sort-key").isConstant();let W=!1;const te=o.depthModeForSublayer(0,dt.ReadOnly),ae=n.layout.get("text-variable-anchor"),he=[];for(const me of a){const Te=t.getTile(me),ye=Te.getBucket(n);if(!ye)continue;const Ae=h?ye.text:ye.icon;if(!Ae||!Ae.segments.get().length||!Ae.hasVisibleVertices)continue;const Ge=Ae.programConfigurations.get(n.id),rt=h||ye.sdfIcons,nt=h?ye.textSizeData:ye.iconSizeData,We=N||B.pitch!==0,Mt=o.useProgram(Go(rt,h,ye),Ge),Tt=c.evaluateSizeForZoom(nt,B.zoom),mt=o.style.map.terrain&&o.style.map.terrain.getTerrainData(me);let yt,bt,Ei,xr,hr=[0,0],Nt=null;if(h)bt=Te.glyphAtlasTexture,Ei=D.LINEAR,yt=Te.glyphAtlasTexture.size,ye.iconsInText&&(hr=Te.imageAtlasTexture.size,Nt=Te.imageAtlasTexture,xr=We||o.options.rotating||o.options.zooming||nt.kind==="composite"||nt.kind==="camera"?D.LINEAR:D.NEAREST);else{const tr=n.layout.get("icon-size").constantOr(0)!==1||ye.iconsNeedLinear;bt=Te.imageAtlasTexture,Ei=rt||o.options.rotating||o.options.zooming||tr||We?D.LINEAR:D.NEAREST,yt=Te.imageAtlasTexture.size}const jr=st(Te,1,o.transform.zoom),Ii=Ie(me.posMatrix,N,L,o.transform,jr),Ai=Pe(me.posMatrix,N,L,o.transform,jr),Qr=ae&&ye.hasTextData(),kn=n.layout.get("icon-text-fit")!=="none"&&Qr&&ye.hasIconData();if(X){const tr=o.style.map.terrain?(zn,Js)=>o.style.map.terrain.getElevation(me,zn,Js):null,ir=n.layout.get("text-rotation-alignment")==="map";xe(ye,me.posMatrix,o,h,Ii,Ai,N,v,ir,tr)}const Qt=o.translatePosMatrix(me.posMatrix,Te,p,m),$t=X||h&&ae||kn?Yn:Ii,Et=o.translatePosMatrix(Ai,Te,p,m,!0),ci=rt&&n.paint.get(h?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let Li;Li=rt?ye.iconsInText?ya(nt.kind,Tt,q,N,o,Qt,$t,Et,yt,hr):_a(nt.kind,Tt,q,N,o,Qt,$t,Et,h,yt,!0):ga(nt.kind,Tt,q,N,o,Qt,$t,Et,h,yt);const jt={program:Mt,buffers:Ae,uniformValues:Li,atlasTexture:bt,atlasTextureIcon:Nt,atlasInterpolation:Ei,atlasInterpolationIcon:xr,isSDF:rt,hasHalo:ci};if(U&&ye.canOverlap){W=!0;const tr=Ae.segments.get();for(const ir of tr)he.push({segments:new c.SegmentVector([ir]),sortKey:ir.sortKey,state:jt,terrainData:mt})}else he.push({segments:Ae.segments,sortKey:0,state:jt,terrainData:mt})}W&&he.sort((me,Te)=>me.sortKey-Te.sortKey);for(const me of he){const Te=me.state;if(M.activeTexture.set(D.TEXTURE0),Te.atlasTexture.bind(Te.atlasInterpolation,D.CLAMP_TO_EDGE),Te.atlasTextureIcon&&(M.activeTexture.set(D.TEXTURE1),Te.atlasTextureIcon&&Te.atlasTextureIcon.bind(Te.atlasInterpolationIcon,D.CLAMP_TO_EDGE)),Te.isSDF){const ye=Te.uniformValues;Te.hasHalo&&(ye.u_is_halo=1,Vs(Te.buffers,me.segments,n,o,Te.program,te,S,E,ye,me.terrainData)),ye.u_is_halo=0}Vs(Te.buffers,me.segments,n,o,Te.program,te,S,E,Te.uniformValues,me.terrainData)}}function Vs(o,t,n,a,h,p,m,_,y,v){const S=a.context;h.draw(S,S.gl.TRIANGLES,p,m,_,kt.disabled,y,v,n.id,o.layoutVertexBuffer,o.indexBuffer,t,n.paint,a.transform.zoom,o.programConfigurations.get(n.id),o.dynamicLayoutVertexBuffer,o.opacityVertexBuffer)}function Qn(o,t,n,a,h){if(!n||!a||!a.imageAtlas)return;const p=a.imageAtlas.patternPositions;let m=p[n.to.toString()],_=p[n.from.toString()];if(!m||!_){const y=h.getPaintProperty(t);m=p[y],_=p[y]}m&&_&&o.setConstantPatternPositions(m,_)}function es(o,t,n,a,h,p,m){const _=o.context.gl,y="fill-pattern",v=n.paint.get(y),S=v&&v.constantOr(1),E=n.getCrossfadeParameters();let M,D,B,L,N;m?(D=S&&!n.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",M=_.LINES):(D=S?"fillPattern":"fill",M=_.TRIANGLES);const X=v.constantOr(null);for(const q of a){const U=t.getTile(q);if(S&&!U.patternsLoaded())continue;const W=U.getBucket(n);if(!W)continue;const te=W.programConfigurations.get(n.id),ae=o.useProgram(D,te),he=o.style.map.terrain&&o.style.map.terrain.getTerrainData(q);S&&(o.context.activeTexture.set(_.TEXTURE0),U.imageAtlasTexture.bind(_.LINEAR,_.CLAMP_TO_EDGE),te.updatePaintBuffers(E)),Qn(te,y,X,U,n);const me=he?q:null,Te=o.translatePosMatrix(me?me.posMatrix:q.posMatrix,U,n.paint.get("fill-translate"),n.paint.get("fill-translate-anchor"));if(m){L=W.indexBuffer2,N=W.segments2;const ye=[_.drawingBufferWidth,_.drawingBufferHeight];B=D==="fillOutlinePattern"&&S?zo(Te,o,E,U,ye):ko(Te,ye)}else L=W.indexBuffer,N=W.segments,B=S?ma(Te,o,E,U):Ms(Te);ae.draw(o.context,M,h,o.stencilModeForClipping(q),p,kt.disabled,B,he,n.id,W.layoutVertexBuffer,L,N,n.paint,o.transform.zoom,te)}}function ts(o,t,n,a,h,p,m){const _=o.context,y=_.gl,v="fill-extrusion-pattern",S=n.paint.get(v),E=S.constantOr(1),M=n.getCrossfadeParameters(),D=n.paint.get("fill-extrusion-opacity"),B=S.constantOr(null);for(const L of a){const N=t.getTile(L),X=N.getBucket(n);if(!X)continue;const q=o.style.map.terrain&&o.style.map.terrain.getTerrainData(L),U=X.programConfigurations.get(n.id),W=o.useProgram(E?"fillExtrusionPattern":"fillExtrusion",U);E&&(o.context.activeTexture.set(y.TEXTURE0),N.imageAtlasTexture.bind(y.LINEAR,y.CLAMP_TO_EDGE),U.updatePaintBuffers(M)),Qn(U,v,B,N,n);const te=o.translatePosMatrix(L.posMatrix,N,n.paint.get("fill-extrusion-translate"),n.paint.get("fill-extrusion-translate-anchor")),ae=n.paint.get("fill-extrusion-vertical-gradient"),he=E?Xl(te,o,ae,D,L,M,N):da(te,o,ae,D);W.draw(_,_.gl.TRIANGLES,h,p,m,kt.backCCW,he,q,n.id,X.layoutVertexBuffer,X.indexBuffer,X.segments,n.paint,o.transform.zoom,U,o.style.map.terrain&&X.centroidVertexBuffer)}}function La(o,t,n,a,h,p,m){const _=o.context,y=_.gl,v=n.fbo;if(!v)return;const S=o.useProgram("hillshade"),E=o.style.map.terrain&&o.style.map.terrain.getTerrainData(t);_.activeTexture.set(y.TEXTURE0),y.bindTexture(y.TEXTURE_2D,v.colorAttachment.get()),S.draw(_,y.TRIANGLES,h,p,m,kt.disabled,((M,D,B,L)=>{const N=B.paint.get("hillshade-shadow-color"),X=B.paint.get("hillshade-highlight-color"),q=B.paint.get("hillshade-accent-color");let U=B.paint.get("hillshade-illumination-direction")*(Math.PI/180);B.paint.get("hillshade-illumination-anchor")==="viewport"&&(U-=M.transform.angle);const W=!M.options.moving;return{u_matrix:L?L.posMatrix:M.transform.calculatePosMatrix(D.tileID.toUnwrapped(),W),u_image:0,u_latrange:ks(0,D.tileID),u_light:[B.paint.get("hillshade-exaggeration"),U],u_shadow:N,u_highlight:X,u_accent:q}})(o,n,a,E?t:null),E,a.id,o.rasterBoundsBuffer,o.quadTriangleIndexBuffer,o.rasterBoundsSegments)}function Zo(o,t,n,a,h,p){const m=o.context,_=m.gl,y=t.dem;if(y&&y.data){const v=y.dim,S=y.stride,E=y.getPixels();if(m.activeTexture.set(_.TEXTURE1),m.pixelStoreUnpackPremultiplyAlpha.set(!1),t.demTexture=t.demTexture||o.getTileTexture(S),t.demTexture){const D=t.demTexture;D.update(E,{premultiply:!1}),D.bind(_.NEAREST,_.CLAMP_TO_EDGE)}else t.demTexture=new Dt(m,E,_.RGBA,{premultiply:!1}),t.demTexture.bind(_.NEAREST,_.CLAMP_TO_EDGE);m.activeTexture.set(_.TEXTURE0);let M=t.fbo;if(!M){const D=new Dt(m,{width:v,height:v,data:null},_.RGBA);D.bind(_.LINEAR,_.CLAMP_TO_EDGE),M=t.fbo=m.createFramebuffer(v,v,!0),M.colorAttachment.set(D.texture)}m.bindFramebuffer.set(M.framebuffer),m.viewport.set([0,0,v,v]),o.useProgram("hillshadePrepare").draw(m,_.TRIANGLES,a,h,p,kt.disabled,((D,B)=>{const L=B.stride,N=c.create();return c.ortho(N,0,c.EXTENT,-c.EXTENT,0,0,1),c.translate(N,N,[0,-c.EXTENT,0]),{u_matrix:N,u_image:1,u_dimension:[L,L],u_zoom:D.overscaledZ,u_unpack:B.getUnpackVector()}})(t.tileID,y),null,n.id,o.rasterBoundsBuffer,o.quadTriangleIndexBuffer,o.rasterBoundsSegments),t.needsHillshadePrepare=!1}}function Ns(o,t,n,a,h,p){const m=a.paint.get("raster-fade-duration");if(!p&&m>0){const _=c.exported.now(),y=(_-o.timeAdded)/m,v=t?(_-t.timeAdded)/m:-1,S=n.getSource(),E=h.coveringZoomLevel({tileSize:S.tileSize,roundZoom:S.roundZoom}),M=!t||Math.abs(t.tileID.overscaledZ-E)>Math.abs(o.tileID.overscaledZ-E),D=M&&o.refreshedUponExpiration?1:c.clamp(M?y:1-v,0,1);return o.refreshedUponExpiration&&y>=1&&(o.refreshedUponExpiration=!1),t?{opacity:1,mix:1-D}:{opacity:D,mix:0}}return{opacity:1,mix:0}}const $s=new c.Color(1,0,0,1),er=new c.Color(0,1,0,1),Xo=new c.Color(0,0,1,1),Da=new c.Color(1,0,1,1),Wo=new c.Color(0,1,1,1);function Jr(o,t,n,a){wn(o,0,t+n/2,o.transform.width,n,a)}function is(o,t,n,a){wn(o,t-n/2,0,n,o.transform.height,a)}function wn(o,t,n,a,h,p){const m=o.context,_=m.gl;_.enable(_.SCISSOR_TEST),_.scissor(t*o.pixelRatio,n*o.pixelRatio,a*o.pixelRatio,h*o.pixelRatio),m.clear({color:p}),_.disable(_.SCISSOR_TEST)}function sc(o,t,n){const a=o.context,h=a.gl,p=n.posMatrix,m=o.useProgram("debug"),_=dt.disabled,y=et.disabled,v=o.colorModeForRenderPass(),S="$debug",E=o.style.map.terrain&&o.style.map.terrain.getTerrainData(n);a.activeTexture.set(h.TEXTURE0),o.emptyTexture.bind(h.LINEAR,h.CLAMP_TO_EDGE);const M=t.getTileByID(n.key).latestRawTileData,D=Math.floor((M&&M.byteLength||0)/1024),B=t.getTile(n).tileSize,L=512/Math.min(B,512)*(n.overscaledZ/o.transform.zoom)*.5;let N=n.canonical.toString();n.overscaledZ!==n.canonical.z&&(N+=` => ${n.overscaledZ}`),function(X,q){X.initDebugOverlayCanvas();const U=X.debugOverlayCanvas,W=X.context.gl,te=X.debugOverlayCanvas.getContext("2d");te.clearRect(0,0,U.width,U.height),te.shadowColor="white",te.shadowBlur=2,te.lineWidth=1.5,te.strokeStyle="white",te.textBaseline="top",te.font="bold 36px Open Sans, sans-serif",te.fillText(q,5,5),te.strokeText(q,5,5),X.debugOverlayTexture.update(U),X.debugOverlayTexture.bind(W.LINEAR,W.CLAMP_TO_EDGE)}(o,`${N} ${D}kB`),m.draw(a,h.TRIANGLES,_,y,Ut.alphaBlended,kt.disabled,Xn(p,c.Color.transparent,L),null,S,o.debugBuffer,o.quadTriangleIndexBuffer,o.debugSegments),m.draw(a,h.LINE_STRIP,_,y,v,kt.disabled,Xn(p,c.Color.red),E,S,o.debugBuffer,o.tileBorderIndexBuffer,o.debugSegments)}function js(o,t,n){const a=o.context,h=a.gl,p=o.colorModeForRenderPass(),m=new dt(h.LEQUAL,dt.ReadWrite,o.depthRangeFor3D),_=o.useProgram("terrain"),y=t.getTerrainMesh();a.bindFramebuffer.set(null),a.viewport.set([0,0,o.width,o.height]);for(const v of n){const S=o.renderToTexture.getTexture(v),E=t.getTerrainData(v.tileID);a.activeTexture.set(h.TEXTURE0),h.bindTexture(h.TEXTURE_2D,S.texture);const M={u_matrix:o.transform.calculatePosMatrix(v.tileID.toUnwrapped()),u_texture:0,u_ele_delta:t.getMeshFrameDelta(o.transform.zoom)};_.draw(a,h.TRIANGLES,m,et.disabled,p,kt.backCCW,M,E,"terrain",y.vertexBuffer,y.indexBuffer,y.segments)}}const Ho={symbol:function(o,t,n,a,h){if(o.renderPass!=="translucent")return;const p=et.disabled,m=o.colorModeForRenderPass();n.layout.get("text-variable-anchor")&&function(_,y,v,S,E,M,D){const B=y.transform,L=E==="map",N=M==="map";for(const X of _){const q=S.getTile(X),U=q.getBucket(v);if(!U||!U.text||!U.text.segments.get().length)continue;const W=c.evaluateSizeForZoom(U.textSizeData,B.zoom),te=st(q,1,y.transform.zoom),ae=Ie(X.posMatrix,N,L,y.transform,te),he=v.layout.get("icon-text-fit")!=="none"&&U.hasIconData();if(W){const me=Math.pow(2,B.zoom-q.tileID.overscaledZ);nc(U,L,N,D,B,ae,X.posMatrix,me,W,he,y.style.map.terrain?(Te,ye)=>y.style.map.terrain.getElevation(X,Te,ye):null)}}}(a,o,n,t,n.layout.get("text-rotation-alignment"),n.layout.get("text-pitch-alignment"),h),n.paint.get("icon-opacity").constantOr(1)!==0&&qo(o,t,n,a,!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,m),n.paint.get("text-opacity").constantOr(1)!==0&&qo(o,t,n,a,!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,m),t.map.showCollisionBoxes&&(za(o,t,n,a,n.paint.get("text-translate"),n.paint.get("text-translate-anchor"),!0),za(o,t,n,a,n.paint.get("icon-translate"),n.paint.get("icon-translate-anchor"),!1))},circle:function(o,t,n,a){if(o.renderPass!=="translucent")return;const h=n.paint.get("circle-opacity"),p=n.paint.get("circle-stroke-width"),m=n.paint.get("circle-stroke-opacity"),_=!n.layout.get("circle-sort-key").isConstant();if(h.constantOr(1)===0&&(p.constantOr(1)===0||m.constantOr(1)===0))return;const y=o.context,v=y.gl,S=o.depthModeForSublayer(0,dt.ReadOnly),E=et.disabled,M=o.colorModeForRenderPass(),D=[];for(let B=0;B<a.length;B++){const L=a[B],N=t.getTile(L),X=N.getBucket(n);if(!X)continue;const q=X.programConfigurations.get(n.id),U=o.useProgram("circle",q),W=X.layoutVertexBuffer,te=X.indexBuffer,ae=o.style.map.terrain&&o.style.map.terrain.getTerrainData(L),he={programConfiguration:q,program:U,layoutVertexBuffer:W,indexBuffer:te,uniformValues:Lo(o,L,N,n),terrainData:ae};if(_){const me=X.segments.get();for(const Te of me)D.push({segments:new c.SegmentVector([Te]),sortKey:Te.sortKey,state:he})}else D.push({segments:X.segments,sortKey:0,state:he})}_&&D.sort((B,L)=>B.sortKey-L.sortKey);for(const B of D){const{programConfiguration:L,program:N,layoutVertexBuffer:X,indexBuffer:q,uniformValues:U,terrainData:W}=B.state;N.draw(y,v.TRIANGLES,S,E,M,kt.disabled,U,W,n.id,X,q,B.segments,n.paint,o.transform.zoom,L)}},heatmap:function(o,t,n,a){if(n.paint.get("heatmap-opacity")!==0)if(o.renderPass==="offscreen"){const h=o.context,p=h.gl,m=et.disabled,_=new Ut([p.ONE,p.ONE],c.Color.transparent,[!0,!0,!0,!0]);(function(y,v,S){const E=y.gl;y.activeTexture.set(E.TEXTURE1),y.viewport.set([0,0,v.width/4,v.height/4]);let M=S.heatmapFbo;if(M)E.bindTexture(E.TEXTURE_2D,M.colorAttachment.get()),y.bindFramebuffer.set(M.framebuffer);else{const D=E.createTexture();E.bindTexture(E.TEXTURE_2D,D),E.texParameteri(E.TEXTURE_2D,E.TEXTURE_WRAP_S,E.CLAMP_TO_EDGE),E.texParameteri(E.TEXTURE_2D,E.TEXTURE_WRAP_T,E.CLAMP_TO_EDGE),E.texParameteri(E.TEXTURE_2D,E.TEXTURE_MIN_FILTER,E.LINEAR),E.texParameteri(E.TEXTURE_2D,E.TEXTURE_MAG_FILTER,E.LINEAR),M=S.heatmapFbo=y.createFramebuffer(v.width/4,v.height/4,!1),function(B,L,N,X){const q=B.gl;q.texImage2D(q.TEXTURE_2D,0,q.RGBA,L.width/4,L.height/4,0,q.RGBA,B.extRenderToTextureHalfFloat?B.extTextureHalfFloat.HALF_FLOAT_OES:q.UNSIGNED_BYTE,null),X.colorAttachment.set(N)}(y,v,D,M)}})(h,o,n),h.clear({color:c.Color.transparent});for(let y=0;y<a.length;y++){const v=a[y];if(t.hasRenderableParent(v))continue;const S=t.getTile(v),E=S.getBucket(n);if(!E)continue;const M=E.programConfigurations.get(n.id),D=o.useProgram("heatmap",M),{zoom:B}=o.transform;D.draw(h,p.TRIANGLES,dt.disabled,m,_,kt.disabled,Ps(v.posMatrix,S,B,n.paint.get("heatmap-intensity")),null,n.id,E.layoutVertexBuffer,E.indexBuffer,E.segments,n.paint,o.transform.zoom,M)}h.viewport.set([0,0,o.width,o.height])}else o.renderPass==="translucent"&&(o.context.setColorMode(o.colorModeForRenderPass()),function(h,p){const m=h.context,_=m.gl,y=p.heatmapFbo;if(!y)return;m.activeTexture.set(_.TEXTURE0),_.bindTexture(_.TEXTURE_2D,y.colorAttachment.get()),m.activeTexture.set(_.TEXTURE1);let v=p.colorRampTexture;v||(v=p.colorRampTexture=new Dt(m,p.colorRamp,_.RGBA)),v.bind(_.LINEAR,_.CLAMP_TO_EDGE),h.useProgram("heatmapTexture").draw(m,_.TRIANGLES,dt.disabled,et.disabled,h.colorModeForRenderPass(),kt.disabled,((S,E,M,D)=>{const B=c.create();c.ortho(B,0,S.width,S.height,0,0,1);const L=S.context.gl;return{u_matrix:B,u_world:[L.drawingBufferWidth,L.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:E.paint.get("heatmap-opacity")}})(h,p),null,p.id,h.viewportBuffer,h.quadTriangleIndexBuffer,h.viewportSegments,p.paint,h.transform.zoom)}(o,n))},line:function(o,t,n,a){if(o.renderPass!=="translucent")return;const h=n.paint.get("line-opacity"),p=n.paint.get("line-width");if(h.constantOr(1)===0||p.constantOr(1)===0)return;const m=o.depthModeForSublayer(0,dt.ReadOnly),_=o.colorModeForRenderPass(),y=n.paint.get("line-dasharray"),v=n.paint.get("line-pattern"),S=v.constantOr(1),E=n.paint.get("line-gradient"),M=n.getCrossfadeParameters(),D=S?"linePattern":y?"lineSDF":E?"lineGradient":"line",B=o.context,L=B.gl;let N=!0;for(const X of a){const q=t.getTile(X);if(S&&!q.patternsLoaded())continue;const U=q.getBucket(n);if(!U)continue;const W=U.programConfigurations.get(n.id),te=o.context.program.get(),ae=o.useProgram(D,W),he=N||ae.program!==te,me=o.style.map.terrain&&o.style.map.terrain.getTerrainData(X),Te=v.constantOr(null);if(Te&&q.imageAtlas){const Ge=q.imageAtlas,rt=Ge.patternPositions[Te.to.toString()],nt=Ge.patternPositions[Te.from.toString()];rt&&nt&&W.setConstantPatternPositions(rt,nt)}const ye=me?X:null,Ae=S?fa(o,q,n,M,ye):y?zs(o,q,n,y,M,ye):E?Do(o,q,n,U.lineClipsArray.length,ye):Wn(o,q,n,ye);if(S)B.activeTexture.set(L.TEXTURE0),q.imageAtlasTexture.bind(L.LINEAR,L.CLAMP_TO_EDGE),W.updatePaintBuffers(M);else if(y&&(he||o.lineAtlas.dirty))B.activeTexture.set(L.TEXTURE0),o.lineAtlas.bind(B);else if(E){const Ge=U.gradients[n.id];let rt=Ge.texture;if(n.gradientVersion!==Ge.version){let nt=256;if(n.stepInterpolant){const We=t.getSource().maxzoom,Mt=X.canonical.z===We?Math.ceil(1<<o.transform.maxZoom-X.canonical.z):1;nt=c.clamp(c.nextPowerOfTwo(U.maxLineLength/c.EXTENT*1024*Mt),256,B.maxTextureSize)}Ge.gradient=c.renderColorRamp({expression:n.gradientExpression(),evaluationKey:"lineProgress",resolution:nt,image:Ge.gradient||void 0,clips:U.lineClipsArray}),Ge.texture?Ge.texture.update(Ge.gradient):Ge.texture=new Dt(B,Ge.gradient,L.RGBA),Ge.version=n.gradientVersion,rt=Ge.texture}B.activeTexture.set(L.TEXTURE0),rt.bind(n.stepInterpolant?L.NEAREST:L.LINEAR,L.CLAMP_TO_EDGE)}ae.draw(B,L.TRIANGLES,m,o.stencilModeForClipping(X),_,kt.disabled,Ae,me,n.id,U.layoutVertexBuffer,U.indexBuffer,U.segments,n.paint,o.transform.zoom,W,U.layoutVertexBuffer2),N=!1}},fill:function(o,t,n,a){const h=n.paint.get("fill-color"),p=n.paint.get("fill-opacity");if(p.constantOr(1)===0)return;const m=o.colorModeForRenderPass(),_=n.paint.get("fill-pattern"),y=o.opaquePassEnabledForLayer()&&!_.constantOr(1)&&h.constantOr(c.Color.transparent).a===1&&p.constantOr(0)===1?"opaque":"translucent";if(o.renderPass===y){const v=o.depthModeForSublayer(1,o.renderPass==="opaque"?dt.ReadWrite:dt.ReadOnly);es(o,t,n,a,v,m,!1)}if(o.renderPass==="translucent"&&n.paint.get("fill-antialias")){const v=o.depthModeForSublayer(n.getPaintProperty("fill-outline-color")?2:0,dt.ReadOnly);es(o,t,n,a,v,m,!0)}},"fill-extrusion":function(o,t,n,a){const h=n.paint.get("fill-extrusion-opacity");if(h!==0&&o.renderPass==="translucent"){const p=new dt(o.context.gl.LEQUAL,dt.ReadWrite,o.depthRangeFor3D);if(h!==1||n.paint.get("fill-extrusion-pattern").constantOr(1))ts(o,t,n,a,p,et.disabled,Ut.disabled),ts(o,t,n,a,p,o.stencilModeFor3D(),o.colorModeForRenderPass());else{const m=o.colorModeForRenderPass();ts(o,t,n,a,p,et.disabled,m)}}},hillshade:function(o,t,n,a){if(o.renderPass!=="offscreen"&&o.renderPass!=="translucent")return;const h=o.context,p=o.depthModeForSublayer(0,dt.ReadOnly),m=o.colorModeForRenderPass(),[_,y]=o.renderPass==="translucent"?o.stencilConfigForOverlap(a):[{},a];for(const v of y){const S=t.getTile(v);S.needsHillshadePrepare!==void 0&&S.needsHillshadePrepare&&o.renderPass==="offscreen"?Zo(o,S,n,p,et.disabled,m):o.renderPass==="translucent"&&La(o,v,S,n,p,_[v.overscaledZ],m)}h.viewport.set([0,0,o.width,o.height])},raster:function(o,t,n,a){if(o.renderPass!=="translucent"||n.paint.get("raster-opacity")===0||!a.length)return;const h=o.context,p=h.gl,m=t.getSource(),_=o.useProgram("raster"),y=o.colorModeForRenderPass(),[v,S]=m instanceof ki?[{},a]:o.stencilConfigForOverlap(a),E=S[S.length-1].overscaledZ,M=!o.options.moving;for(const D of S){const B=o.depthModeForSublayer(D.overscaledZ-E,n.paint.get("raster-opacity")===1?dt.ReadWrite:dt.ReadOnly,p.LESS),L=t.getTile(D);L.registerFadeDuration(n.paint.get("raster-fade-duration"));const N=t.findLoadedParent(D,0),X=Ns(L,N,t,n,o.transform,o.style.map.terrain);let q,U;const W=n.paint.get("raster-resampling")==="nearest"?p.NEAREST:p.LINEAR;h.activeTexture.set(p.TEXTURE0),L.texture.bind(W,p.CLAMP_TO_EDGE,p.LINEAR_MIPMAP_NEAREST),h.activeTexture.set(p.TEXTURE1),N?(N.texture.bind(W,p.CLAMP_TO_EDGE,p.LINEAR_MIPMAP_NEAREST),q=Math.pow(2,N.tileID.overscaledZ-L.tileID.overscaledZ),U=[L.tileID.canonical.x*q%1,L.tileID.canonical.y*q%1]):L.texture.bind(W,p.CLAMP_TO_EDGE,p.LINEAR_MIPMAP_NEAREST);const te=o.style.map.terrain&&o.style.map.terrain.getTerrainData(D),ae=te?D:null,he=ae?ae.posMatrix:o.transform.calculatePosMatrix(D.toUnwrapped(),M),me=Ls(he,U||[0,0],q||1,X,n);m instanceof ki?_.draw(h,p.TRIANGLES,B,et.disabled,y,kt.disabled,me,te,n.id,m.boundsBuffer,o.quadTriangleIndexBuffer,m.boundsSegments):_.draw(h,p.TRIANGLES,B,v[D.overscaledZ],y,kt.disabled,me,te,n.id,o.rasterBoundsBuffer,o.quadTriangleIndexBuffer,o.rasterBoundsSegments)}},background:function(o,t,n,a){const h=n.paint.get("background-color"),p=n.paint.get("background-opacity");if(p===0)return;const m=o.context,_=m.gl,y=o.transform,v=y.tileSize,S=n.paint.get("background-pattern");if(o.isPatternMissing(S))return;const E=!S&&h.a===1&&p===1&&o.opaquePassEnabledForLayer()?"opaque":"translucent";if(o.renderPass!==E)return;const M=et.disabled,D=o.depthModeForSublayer(0,E==="opaque"?dt.ReadWrite:dt.ReadOnly),B=o.colorModeForRenderPass(),L=o.useProgram(S?"backgroundPattern":"background"),N=a||y.coveringTiles({tileSize:v,terrain:o.style.map.terrain});S&&(m.activeTexture.set(_.TEXTURE0),o.imageManager.bind(o.context));const X=n.getCrossfadeParameters();for(const q of N){const U=a?q.posMatrix:o.transform.calculatePosMatrix(q.toUnwrapped()),W=S?Wl(U,p,o,S,{tileID:q,tileSize:v},X):Bo(U,p,h),te=o.style.map.terrain&&o.style.map.terrain.getTerrainData(q);L.draw(m,_.TRIANGLES,D,M,B,kt.disabled,W,te,n.id,o.tileExtentBuffer,o.quadTriangleIndexBuffer,o.tileExtentSegments)}},debug:function(o,t,n){for(let a=0;a<n.length;a++)sc(o,t,n[a])},custom:function(o,t,n){const a=o.context,h=n.implementation;if(o.renderPass==="offscreen"){const p=h.prerender;p&&(o.setCustomLayerDefaults(),a.setColorMode(o.colorModeForRenderPass()),p.call(h,a.gl,o.transform.customLayerMatrix()),a.setDirty(),o.setBaseState())}else if(o.renderPass==="translucent"){o.setCustomLayerDefaults(),a.setColorMode(o.colorModeForRenderPass()),a.setStencilMode(et.disabled);const p=h.renderingMode==="3d"?new dt(o.context.gl.LEQUAL,dt.ReadWrite,o.depthRangeFor3D):o.depthModeForSublayer(0,dt.ReadOnly);a.setDepthMode(p),h.render(a.gl,o.transform.customLayerMatrix()),a.setDirty(),o.setBaseState(),a.bindFramebuffer.set(null)}}};class Ko{constructor(t,n){this.context=new bn(t),this.transform=n,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:c.create(),renderTime:0},this.setup(),this.numSublayers=di.maxUnderzooming+di.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Ui,this.gpuTimers={}}resize(t,n,a){if(this.width=t*a,this.height=n*a,this.pixelRatio=a,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const h of this.style._order)this.style._layers[h].resize()}setup(){const t=this.context,n=new c.PosArray;n.emplaceBack(0,0),n.emplaceBack(c.EXTENT,0),n.emplaceBack(0,c.EXTENT),n.emplaceBack(c.EXTENT,c.EXTENT),this.tileExtentBuffer=t.createVertexBuffer(n,qn.members),this.tileExtentSegments=c.SegmentVector.simpleSegment(0,0,4,2);const a=new c.PosArray;a.emplaceBack(0,0),a.emplaceBack(c.EXTENT,0),a.emplaceBack(0,c.EXTENT),a.emplaceBack(c.EXTENT,c.EXTENT),this.debugBuffer=t.createVertexBuffer(a,qn.members),this.debugSegments=c.SegmentVector.simpleSegment(0,0,4,5);const h=new c.RasterBoundsArray;h.emplaceBack(0,0,0,0),h.emplaceBack(c.EXTENT,0,c.EXTENT,0),h.emplaceBack(0,c.EXTENT,0,c.EXTENT),h.emplaceBack(c.EXTENT,c.EXTENT,c.EXTENT,c.EXTENT),this.rasterBoundsBuffer=t.createVertexBuffer(h,qr.members),this.rasterBoundsSegments=c.SegmentVector.simpleSegment(0,0,4,2);const p=new c.PosArray;p.emplaceBack(0,0),p.emplaceBack(1,0),p.emplaceBack(0,1),p.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(p,qn.members),this.viewportSegments=c.SegmentVector.simpleSegment(0,0,4,2);const m=new c.LineStripIndexArray;m.emplaceBack(0),m.emplaceBack(1),m.emplaceBack(3),m.emplaceBack(2),m.emplaceBack(0),this.tileBorderIndexBuffer=t.createIndexBuffer(m);const _=new c.TriangleIndexArray;_.emplaceBack(0,1,2),_.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(_),this.emptyTexture=new Dt(t,{width:1,height:1,data:new Uint8Array([0,0,0,0])},t.gl.RGBA);const y=this.context.gl;this.stencilClearMode=new et({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 a=c.create();c.ortho(a,0,this.width,this.height,0,0,1),c.scale(a,a,[n.drawingBufferWidth,n.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(t,n.TRIANGLES,dt.disabled,this.stencilClearMode,Ut.disabled,kt.disabled,_n(a),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 a=this.context,h=a.gl;this.nextStencilID+n.length>256&&this.clearStencil(),a.setColorMode(Ut.disabled),a.setDepthMode(dt.disabled);const p=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const m of n){const _=this._tileClippingMaskIDs[m.key]=this.nextStencilID++,y=this.style.map.terrain&&this.style.map.terrain.getTerrainData(m);p.draw(a,h.TRIANGLES,dt.disabled,new et({func:h.ALWAYS,mask:0},_,255,h.KEEP,h.KEEP,h.REPLACE),Ut.disabled,kt.disabled,_n(m.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 et({func:n.NOTEQUAL,mask:255},t,255,n.KEEP,n.KEEP,n.REPLACE)}stencilModeForClipping(t){const n=this.context.gl;return new et({func:n.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,n.KEEP,n.KEEP,n.REPLACE)}stencilConfigForOverlap(t){const n=this.context.gl,a=t.sort((m,_)=>_.overscaledZ-m.overscaledZ),h=a[a.length-1].overscaledZ,p=a[0].overscaledZ-h+1;if(p>1){this.currentStencilSource=void 0,this.nextStencilID+p>256&&this.clearStencil();const m={};for(let _=0;_<p;_++)m[_+h]=new et({func:n.GEQUAL,mask:255},_+this.nextStencilID,255,n.KEEP,n.KEEP,n.REPLACE);return this.nextStencilID+=p,[m,a]}return[{[h]:et.disabled},a]}colorModeForRenderPass(){const t=this.context.gl;return this._showOverdrawInspector?new Ut([t.CONSTANT_COLOR,t.ONE],new c.Color(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?Ut.unblended:Ut.alphaBlended}depthModeForSublayer(t,n,a){if(!this.opaquePassEnabledForLayer())return dt.disabled;const h=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new dt(a||this.context.gl.LEQUAL,n,[h,h])}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(c.exported.now()),this.imageManager.beginFrame();const a=this.style._order,h=this.style.sourceCaches;for(const y in h){const v=h[y];v.used&&v.prepare(this.context)}const p={},m={},_={};for(const y in h){const v=h[y];p[y]=v.getVisibleCoordinates(),m[y]=p[y].slice().reverse(),_[y]=v.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let y=0;y<a.length;y++)if(this.style._layers[a[y]].is3D()){this.opaquePassCutoff=y;break}if(this.renderToTexture){this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0;const y=this.style.map.terrain.sourceCache.tilesAfterTime(this.terrainFacilitator.renderTime);(this.terrainFacilitator.dirty||!c.equals(this.terrainFacilitator.matrix,this.transform.projMatrix)||y.length)&&(c.copy(this.terrainFacilitator.matrix,this.transform.projMatrix),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(v,S){const E=v.context,M=E.gl,D=Ut.unblended,B=new dt(M.LEQUAL,dt.ReadWrite,[0,1]),L=S.getTerrainMesh(),N=S.sourceCache.getRenderableTiles(),X=v.useProgram("terrainDepth");E.bindFramebuffer.set(S.getFramebuffer("depth").framebuffer),E.viewport.set([0,0,v.width/devicePixelRatio,v.height/devicePixelRatio]),E.clear({color:c.Color.transparent,depth:1});for(const q of N){const U=S.getTerrainData(q.tileID),W={u_matrix:v.transform.calculatePosMatrix(q.tileID.toUnwrapped()),u_ele_delta:S.getMeshFrameDelta(v.transform.zoom)};X.draw(E,M.TRIANGLES,B,et.disabled,D,kt.backCCW,W,U,"terrain",L.vertexBuffer,L.indexBuffer,L.segments)}E.bindFramebuffer.set(null),E.viewport.set([0,0,v.width,v.height])}(this,this.style.map.terrain),function(v,S){const E=v.context,M=E.gl,D=Ut.unblended,B=new dt(M.LEQUAL,dt.ReadWrite,[0,1]),L=S.getTerrainMesh(),N=S.getCoordsTexture(),X=S.sourceCache.getRenderableTiles(),q=v.useProgram("terrainCoords");E.bindFramebuffer.set(S.getFramebuffer("coords").framebuffer),E.viewport.set([0,0,v.width/devicePixelRatio,v.height/devicePixelRatio]),E.clear({color:c.Color.transparent,depth:1}),S.coordsIndex=[];for(const U of X){const W=S.getTerrainData(U.tileID);E.activeTexture.set(M.TEXTURE0),M.bindTexture(M.TEXTURE_2D,N.texture);const te={u_matrix:v.transform.calculatePosMatrix(U.tileID.toUnwrapped()),u_terrain_coords_id:(255-S.coordsIndex.length)/255,u_texture:0,u_ele_delta:S.getMeshFrameDelta(v.transform.zoom)};q.draw(E,M.TRIANGLES,B,et.disabled,D,kt.backCCW,te,W,"terrain",L.vertexBuffer,L.indexBuffer,L.segments),S.coordsIndex.push(U.tileID.key)}E.bindFramebuffer.set(null),E.viewport.set([0,0,v.width,v.height])}(this,this.style.map.terrain))}this.renderPass="offscreen";for(const y of a){const v=this.style._layers[y];if(!v.hasOffscreenPass()||v.isHidden(this.transform.zoom))continue;const S=m[v.source];(v.type==="custom"||S.length)&&this.renderLayer(this,h[v.source],v,S)}if(this.context.bindFramebuffer.set(null),this.context.clear({color:n.showOverdrawInspector?c.Color.black:c.Color.transparent,depth:1}),this.clearStencil(),this._showOverdrawInspector=n.showOverdrawInspector,this.depthRangeFor3D=[0,1-(t._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=a.length-1;this.currentLayer>=0;this.currentLayer--){const y=this.style._layers[a[this.currentLayer]],v=h[y.source],S=p[y.source];this._renderTileClippingMasks(y,S),this.renderLayer(this,v,y,S)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<a.length;this.currentLayer++){const y=this.style._layers[a[this.currentLayer]],v=h[y.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(y))continue;const S=(y.type==="symbol"?_:m)[y.source];this._renderTileClippingMasks(y,p[y.source]),this.renderLayer(this,v,y,S)}if(this.options.showTileBoundaries){const y=function(v,S){let E=null;const M=Object.values(v._layers).flatMap(N=>N.source&&!N.isHidden(S)?[v.sourceCaches[N.source]]:[]),D=M.filter(N=>N.getSource().type==="vector"),B=M.filter(N=>N.getSource().type!=="vector"),L=N=>{(!E||E.getSource().maxzoom<N.getSource().maxzoom)&&(E=N)};return D.forEach(N=>L(N)),E||B.forEach(N=>L(N)),E}(this.style,this.transform.zoom);y&&Ho.debug(this,y,y.getVisibleCoordinates())}this.options.showPadding&&function(y){const v=y.transform.padding;Jr(y,y.transform.height-(v.top||0),3,$s),Jr(y,v.bottom||0,3,er),is(y,v.left||0,3,Xo),is(y,y.transform.width-(v.right||0),3,Da);const S=y.transform.centerPoint;(function(E,M,D,B){wn(E,M-1,D-10,2,20,B),wn(E,M-10,D-1,20,2,B)})(y,S.x,y.transform.height-S.y,Wo)}(this),this.context.setDefault()}renderLayer(t,n,a,h){a.isHidden(this.transform.zoom)||(a.type==="background"||a.type==="custom"||(h||[]).length)&&(this.id=a.id,this.gpuTimingStart(a),Ho[a.type](t,n,a,h,this.style.placement.variableOffsets),this.gpuTimingEnd())}gpuTimingStart(t){if(!this.options.gpuTiming)return;const n=this.context.extTimerQuery;let a=this.gpuTimers[t.id];a||(a=this.gpuTimers[t.id]={calls:0,cpuTime:0,query:n.createQueryEXT()}),a.calls++,n.beginQueryEXT(n.TIME_ELAPSED_EXT,a.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 a in t){const h=t[a],p=this.context.extTimerQuery,m=p.getQueryObjectEXT(h.query,p.QUERY_RESULT_EXT)/1e6;p.deleteQueryEXT(h.query),n[a]=m}return n}translatePosMatrix(t,n,a,h,p){if(!a[0]&&!a[1])return t;const m=p?h==="map"?this.transform.angle:0:h==="viewport"?-this.transform.angle:0;if(m){const v=Math.sin(m),S=Math.cos(m);a=[a[0]*S-a[1]*v,a[0]*v+a[1]*S]}const _=[p?a[0]:st(n,a[0],this.transform.zoom),p?a[1]:st(n,a[1],this.transform.zoom),0],y=new Float32Array(16);return c.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()),a=this.imageManager.getPattern(t.to.toString());return!n||!a}useProgram(t,n){this.cache=this.cache||{};const a=t+(n?n.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[a]||(this.cache[a]=new Mo(this.context,t,Zn[t],n,Hl[t],this._showOverdrawInspector,this.style.map.terrain)),this.cache[a]}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 Dt(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}}class Tn{constructor(t,n){this.points=t,this.planes=n}static fromInvProjectionMatrix(t,n,a){const h=Math.pow(2,a),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/(_=c.transformMat4([],_,t))[3]/n*h;return c.mul$1(_,_,[y,y,1/_[3],y])}),m=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(_=>{const y=c.sub([],p[_[0]],p[_[1]]),v=c.sub([],p[_[2]],p[_[1]]),S=c.normalize([],c.cross([],y,v)),E=-c.dot(S,p[_[1]]);return S.concat(E)});return new Tn(p,m)}}class Sn{constructor(t,n){this.min=t,this.max=n,this.center=c.scale$1([],c.add([],this.min,this.max),.5)}quadrant(t){const n=[t%2==0,t<2],a=c.clone$2(this.min),h=c.clone$2(this.max);for(let p=0;p<n.length;p++)a[p]=n[p]?this.min[p]:this.center[p],h[p]=n[p]?this.center[p]:this.max[p];return h[2]=this.max[2],new Sn(a,h)}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 a=!0;for(let h=0;h<t.planes.length;h++){const p=t.planes[h];let m=0;for(let _=0;_<n.length;_++)c.dot$1(p,n[_])>=0&&m++;if(m===0)return 0;m!==n.length&&(a=!1)}if(a)return 2;for(let h=0;h<3;h++){let p=Number.MAX_VALUE,m=-Number.MAX_VALUE;for(let _=0;_<t.points.length;_++){const y=t.points[_][h]-this.min[h];p=Math.min(p,y),m=Math.max(m,y)}if(m<0||p>this.max[h]-this.min[h])return 0}return 1}}class Gs{constructor(t=0,n=0,a=0,h=0){if(isNaN(t)||t<0||isNaN(n)||n<0||isNaN(a)||a<0||isNaN(h)||h<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=a,this.right=h}interpolate(t,n,a){return n.top!=null&&t.top!=null&&(this.top=c.number(t.top,n.top,a)),n.bottom!=null&&t.bottom!=null&&(this.bottom=c.number(t.bottom,n.bottom,a)),n.left!=null&&t.left!=null&&(this.left=c.number(t.left,n.left,a)),n.right!=null&&t.right!=null&&(this.right=c.number(t.right,n.right,a)),this}getCenter(t,n){const a=c.clamp((this.left+t-this.right)/2,0,t),h=c.clamp((this.top+n-this.bottom)/2,0,n);return new c.pointGeometry(a,h)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new Gs(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}class qs{constructor(t,n,a,h,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=a??0,this._maxPitch=h??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new c.LngLat(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new Gs,this._posMatrixCache={},this._alignedPosMatrixCache={}}clone(){const t=new qs(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 c.pointGeometry(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(t){const n=-c.wrap(t,-180,180)*Math.PI/180;var a;this.angle!==n&&(this._unmodified=!1,this.angle=n,this._calcMatrices(),this.rotationMatrix=(a=new c.ARRAY_TYPE(4),c.ARRAY_TYPE!=Float32Array&&(a[1]=0,a[2]=0),a[0]=1,a[3]=1,a),function(h,p,m){var _=p[0],y=p[1],v=p[2],S=p[3],E=Math.sin(m),M=Math.cos(m);h[0]=_*M+v*E,h[1]=y*M+S*E,h[2]=_*-E+v*M,h[3]=y*-E+S*M}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(t){const n=c.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.tileZoom=Math.max(0,Math.floor(n)),this.scale=this.zoomScale(n),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,a){this._unmodified=!1,this._edgeInsets.interpolate(t,n,a),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 c.UnwrappedTileID(0,t)];if(this._renderWorldCopies){const a=this.pointCoordinate(new c.pointGeometry(0,0)),h=this.pointCoordinate(new c.pointGeometry(this.width,0)),p=this.pointCoordinate(new c.pointGeometry(this.width,this.height)),m=this.pointCoordinate(new c.pointGeometry(0,this.height)),_=Math.floor(Math.min(a.x,h.x,p.x,m.x)),y=Math.floor(Math.max(a.x,h.x,p.x,m.x)),v=1;for(let S=_-v;S<=y+v;S++)S!==0&&n.push(new c.UnwrappedTileID(S,t))}return n}coveringTiles(t){var n,a;let h=this.coveringZoomLevel(t);const p=h;if(t.minzoom!==void 0&&h<t.minzoom)return[];t.maxzoom!==void 0&&h>t.maxzoom&&(h=t.maxzoom);const m=this.pointCoordinate(this.getCameraPoint()),_=c.MercatorCoordinate.fromLngLat(this.center),y=Math.pow(2,h),v=[y*m.x,y*m.y,0],S=[y*_.x,y*_.y,0],E=Tn.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,h);let M=t.minzoom||0;!t.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(M=h);const D=t.terrain?2/Math.min(this.tileSize,t.tileSize)*this.tileSize:3,B=U=>({aabb:new Sn([U*y,0,0],[(U+1)*y,y,0]),zoom:0,x:0,y:0,wrap:U,fullyVisible:!1}),L=[],N=[],X=h,q=t.reparseOverscaled?p:h;if(this._renderWorldCopies)for(let U=1;U<=3;U++)L.push(B(-U)),L.push(B(U));for(L.push(B(0));L.length>0;){const U=L.pop(),W=U.x,te=U.y;let ae=U.fullyVisible;if(!ae){const Ae=U.aabb.intersects(E);if(Ae===0)continue;ae=Ae===2}const he=t.terrain?v:S,me=U.aabb.distanceX(he),Te=U.aabb.distanceY(he),ye=Math.max(Math.abs(me),Math.abs(Te));if(U.zoom===X||ye>D+(1<<X-U.zoom)-2&&U.zoom>=M){const Ae=X-U.zoom,Ge=v[0]-.5-(W<<Ae),rt=v[1]-.5-(te<<Ae);N.push({tileID:new c.OverscaledTileID(U.zoom===X?q:U.zoom,U.wrap,U.zoom,W,te),distanceSq:c.sqrLen([S[0]-.5-W,S[1]-.5-te]),tileDistanceToCamera:Math.sqrt(Ge*Ge+rt*rt)})}else for(let Ae=0;Ae<4;Ae++){const Ge=(W<<1)+Ae%2,rt=(te<<1)+(Ae>>1),nt=U.zoom+1;let We=U.aabb.quadrant(Ae);if(t.terrain){const Mt=new c.OverscaledTileID(nt,U.wrap,nt,Ge,rt),Tt=t.terrain.getMinMaxElevation(Mt),mt=(n=Tt.minElevation)!==null&&n!==void 0?n:this.elevation,yt=(a=Tt.maxElevation)!==null&&a!==void 0?a:this.elevation;We=new Sn([We.min[0],We.min[1],mt],[We.max[0],We.max[1],yt])}L.push({aabb:We,zoom:nt,x:Ge,y:rt,wrap:U.wrap,fullyVisible:ae})}}return N.sort((U,W)=>U.distanceSq-W.distanceSq).map(U=>U.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=c.clamp(t.lat,-this.maxValidLatitude,this.maxValidLatitude);return new c.pointGeometry(c.mercatorXfromLng(t.lng)*this.worldSize,c.mercatorYfromLat(n)*this.worldSize)}unproject(t){return new c.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 a=c.MercatorCoordinate.fromLngLat(t),h=(1<<this.tileZoom)*c.EXTENT,p=a.x*h,m=a.y*h,_=Math.floor(p/c.EXTENT),y=Math.floor(m/c.EXTENT),v=new c.OverscaledTileID(this.tileZoom,0,this.tileZoom,_,y);return n.getElevation(v,p%c.EXTENT,m%c.EXTENT,c.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),a=this.getElevation(n,t);if(!(this.elevation-a))return;const h=this.getCameraPosition(),p=c.MercatorCoordinate.fromLngLat(h.lngLat,h.altitude),m=c.MercatorCoordinate.fromLngLat(n,a),_=p.x-m.x,y=p.y-m.y,v=p.z-m.z,S=Math.sqrt(_*_+y*y+v*v),E=this.scaleZoom(this.cameraToCenterDistance/S/this.tileSize);this._elevation=a,this._center=n,this.zoom=E}setLocationAtPoint(t,n){const a=this.pointCoordinate(n),h=this.pointCoordinate(this.centerPoint),p=this.locationCoordinate(t),m=new c.MercatorCoordinate(p.x-(a.x-h.x),p.y-(a.y-h.y));this.center=this.coordinateLocation(m),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 c.MercatorCoordinate.fromLngLat(t)}coordinateLocation(t){return t&&t.toLngLat()}pointCoordinate(t,n){if(n){const M=n.pointCoordinate(t);if(M!=null)return M}const a=[t.x,t.y,0,1],h=[t.x,t.y,1,1];c.transformMat4(a,a,this.pixelMatrixInverse),c.transformMat4(h,h,this.pixelMatrixInverse);const p=a[3],m=h[3],_=a[1]/p,y=h[1]/m,v=a[2]/p,S=h[2]/m,E=v===S?0:(0-v)/(S-v);return new c.MercatorCoordinate(c.number(a[0]/p,h[0]/m,E)/this.worldSize,c.number(_,y,E)/this.worldSize)}coordinatePoint(t,n=0,a=this.pixelMatrix){const h=[t.x*this.worldSize,t.y*this.worldSize,n,1];return c.transformMat4(h,h,a),new c.pointGeometry(h[0]/h[3],h[1]/h[3])}getBounds(){const t=Math.max(0,this.height/2-this.getHorizon());return new c.LngLatBounds().extend(this.pointLocation(new c.pointGeometry(0,t))).extend(this.pointLocation(new c.pointGeometry(this.width,t))).extend(this.pointLocation(new c.pointGeometry(this.width,this.height))).extend(this.pointLocation(new c.pointGeometry(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new c.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 a=t.key,h=n?this._alignedPosMatrixCache:this._posMatrixCache;if(h[a])return h[a];const p=t.canonical,m=this.worldSize/this.zoomScale(p.z),_=p.x+Math.pow(2,p.z)*t.wrap,y=c.identity(new Float64Array(16));return c.translate(y,y,[_*m,p.y*m,0]),c.scale(y,y,[m/c.EXTENT,m/c.EXTENT,1]),c.multiply(y,n?this.alignedProjMatrix:this.projMatrix,y),h[a]=new Float32Array(y),h[a]}customLayerMatrix(){return this.mercatorMatrix.slice()}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;let t,n,a,h,p=-90,m=90,_=-180,y=180;const v=this.size,S=this._unmodified;if(this.latRange){const D=this.latRange;p=c.mercatorYfromLat(D[1])*this.worldSize,m=c.mercatorYfromLat(D[0])*this.worldSize,t=m-p<v.y?v.y/(m-p):0}if(this.lngRange){const D=this.lngRange;_=c.wrap(c.mercatorXfromLng(D[0])*this.worldSize,0,this.worldSize),y=c.wrap(c.mercatorXfromLng(D[1])*this.worldSize,0,this.worldSize),y<_&&(y+=this.worldSize),n=y-_<v.x?v.x/(y-_):0}const E=this.point,M=Math.max(n||0,t||0);if(M)return this.center=this.unproject(new c.pointGeometry(n?(y+_)/2:E.x,t?(m+p)/2:E.y)),this.zoom+=this.scaleZoom(M),this._unmodified=S,void(this._constraining=!1);if(this.latRange){const D=E.y,B=v.y/2;D-B<p&&(h=p+B),D+B>m&&(h=m-B)}if(this.lngRange){const D=(_+y)/2,B=c.wrap(E.x,D-this.worldSize/2,D+this.worldSize/2),L=v.x/2;B-L<_&&(a=_+L),B+L>y&&(a=y-L)}a===void 0&&h===void 0||(this.center=this.unproject(new c.pointGeometry(a!==void 0?a:E.x,h!==void 0?h:E.y)).wrap()),this._unmodified=S,this._constraining=!1}_calcMatrices(){if(!this.height)return;const t=this.centerOffset,n=this.point.x,a=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=c.mercatorZfromAltitude(1,this.center.lat)*this.worldSize;let h=c.identity(new Float64Array(16));c.scale(h,h,[this.width/2,-this.height/2,1]),c.translate(h,h,[1,-1,0]),this.labelPlaneMatrix=h,h=c.identity(new Float64Array(16)),c.scale(h,h,[1,-1,1]),c.translate(h,h,[-1,-1,0]),c.scale(h,h,[2/this.width,2/this.height,1]),this.glCoordMatrix=h,this.cameraToSeaLevelDistance=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch);const p=this._elevation<0?this.cameraToCenterDistance:this.cameraToSeaLevelDistance,m=Math.PI/2+this._pitch,_=this._fov*(.5+t.y/this.height),y=Math.sin(_)*p/Math.sin(c.clamp(Math.PI-m-_,.01,Math.PI-.01)),v=this.getHorizon(),S=2*Math.atan(v/this.cameraToCenterDistance)*(.5+t.y/(2*v)),E=Math.sin(S)*p/Math.sin(c.clamp(Math.PI-m-S,.01,Math.PI-.01)),M=Math.min(y,E),D=1.01*(Math.cos(Math.PI/2-this._pitch)*M+p),B=this.height/50;h=new Float64Array(16),c.perspective(h,this._fov,this.width/this.height,B,D),h[8]=2*-t.x/this.width,h[9]=2*t.y/this.height,c.scale(h,h,[1,-1,1]),c.translate(h,h,[0,0,-this.cameraToCenterDistance]),c.rotateX(h,h,this._pitch),c.rotateZ(h,h,this.angle),c.translate(h,h,[-n,-a,0]),this.mercatorMatrix=c.scale([],h,[this.worldSize,this.worldSize,this.worldSize]),c.scale(h,h,[1,1,this._pixelPerMeter]),this.pixelMatrix=c.multiply(new Float64Array(16),this.labelPlaneMatrix,h),c.translate(h,h,[0,0,-this.elevation]),this.projMatrix=h,this.invProjMatrix=c.invert([],h),this.pixelMatrix3D=c.multiply(new Float64Array(16),this.labelPlaneMatrix,h);const L=this.width%2/2,N=this.height%2/2,X=Math.cos(this.angle),q=Math.sin(this.angle),U=n-Math.round(n)+X*L+q*N,W=a-Math.round(a)+X*N+q*L,te=new Float64Array(h);if(c.translate(te,te,[U>.5?U-1:U,W>.5?W-1:W,0]),this.alignedProjMatrix=te,h=c.invert(new Float64Array(16),this.pixelMatrix),!h)throw new Error("failed to invert matrix");this.pixelMatrixInverse=h,this._posMatrixCache={},this._alignedPosMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const t=this.pointCoordinate(new c.pointGeometry(0,0)),n=[t.x*this.worldSize,t.y*this.worldSize,0,1];return c.transformMat4(n,n,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const t=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new c.pointGeometry(0,t))}getCameraQueryGeometry(t){const n=this.getCameraPoint();if(t.length===1)return[t[0],n];{let a=n.x,h=n.y,p=n.x,m=n.y;for(const _ of t)a=Math.min(a,_.x),h=Math.min(h,_.y),p=Math.max(p,_.x),m=Math.max(m,_.y);return[new c.pointGeometry(a,h),new c.pointGeometry(p,h),new c.pointGeometry(p,m),new c.pointGeometry(a,m),new c.pointGeometry(a,h)]}}}class Zs{constructor(t){this._hashName=t&&encodeURIComponent(t),c.bindAll(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=function(n,a){let h=!1,p=null;const m=()=>{p=null,h&&(n(),p=setTimeout(m,300),h=!1)};return()=>(h=!0,p||m(),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(),a=Math.round(100*this._map.getZoom())/100,h=Math.ceil((a*Math.LN2+Math.log(512/360/.5))/Math.LN10),p=Math.pow(10,h),m=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?`/${m}/${_}/${a}`:`${a}/${_}/${m}`,(y||v)&&(S+="/"+Math.round(10*y)/10),v&&(S+=`/${Math.round(v)}`),this._hashName){const E=this._hashName;let M=!1;const D=window.location.hash.slice(1).split("&").map(B=>{const L=B.split("=")[0];return L===E?(M=!0,`${L}=${S}`):B}).filter(B=>B);return M||D.push(`${E}=${S}`),`#${D.join("&")}`}return`#${S}`}_getCurrentHash(){const t=window.location.hash.replace("#","");if(this._hashName){let n;return t.split("&").map(a=>a.split("=")).forEach(a=>{a[0]===this._hashName&&(n=a)}),(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 En={linearity:.3,easing:c.bezier(0,0,.3,1)},Jo=c.extend({deceleration:2500,maxSpeed:1400},En),Yo=c.extend({deceleration:20,maxSpeed:1400},En),Qo=c.extend({deceleration:1e3,maxSpeed:360},En),el=c.extend({deceleration:1e3,maxSpeed:90},En);class tl{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:c.exported.now(),settings:t})}_drainInertiaBuffer(){const t=this._inertiaBuffer,n=c.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 c.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 a=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,h={};if(n.pan.mag()){const p=rs(n.pan.mag(),a,c.extend({},Jo,t||{}));h.offset=n.pan.mult(p.amount/n.pan.mag()),h.center=this._map.transform.center,_r(h,p)}if(n.zoom){const p=rs(n.zoom,a,Yo);h.zoom=this._map.transform.zoom+p.amount,_r(h,p)}if(n.bearing){const p=rs(n.bearing,a,Qo);h.bearing=this._map.transform.bearing+c.clamp(p.amount,-179,179),_r(h,p)}if(n.pitch){const p=rs(n.pitch,a,el);h.pitch=this._map.transform.pitch+p.amount,_r(h,p)}if(h.zoom||h.bearing){const p=n.pinchAround===void 0?n.around:n.pinchAround;h.around=p?this._map.unproject(p):this._map.getCenter()}return this.clear(),c.extend(h,{noMoveStart:!0})}}function _r(o,t){(!o.duration||o.duration<t.duration)&&(o.duration=t.duration,o.easing=t.easing)}function rs(o,t,n){const{maxSpeed:a,linearity:h,deceleration:p}=n,m=c.clamp(o*h/(t/1e3),-a,a),_=Math.abs(m)/(p*h);return{easing:n.easing,duration:1e3*_,amount:m*(_/2)}}class Ni extends c.Event{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,a,h={}){const p=K.mousePos(n.getCanvasContainer(),a),m=n.unproject(p);super(t,c.extend({point:p,lngLat:m,originalEvent:a},h)),this._defaultPrevented=!1,this.target=n}}class ns extends c.Event{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,a){const h=t==="touchend"?a.changedTouches:a.touches,p=K.touchPos(n.getCanvasContainer(),h),m=p.map(y=>n.unproject(y)),_=p.reduce((y,v,S,E)=>y.add(v.div(E.length)),new c.pointGeometry(0,0));super(t,{points:p,point:_,lngLats:m,lngLat:n.unproject(_),originalEvent:a}),this._defaultPrevented=!1}}class il extends c.Event{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,a){super(t,{originalEvent:a}),this._defaultPrevented=!1}}class rl{constructor(t,n){this._map=t,this._clickTolerance=n.clickTolerance}reset(){delete this._mousedownPos}wheel(t){return this._firePreventable(new il(t.type,this._map,t))}mousedown(t,n){return this._mousedownPos=n,this._firePreventable(new Ni(t.type,this._map,t))}mouseup(t){this._map.fire(new Ni(t.type,this._map,t))}click(t,n){this._mousedownPos&&this._mousedownPos.dist(n)>=this._clickTolerance||this._map.fire(new Ni(t.type,this._map,t))}dblclick(t){return this._firePreventable(new Ni(t.type,this._map,t))}mouseover(t){this._map.fire(new Ni(t.type,this._map,t))}mouseout(t){this._map.fire(new Ni(t.type,this._map,t))}touchstart(t){return this._firePreventable(new ns(t.type,this._map,t))}touchmove(t){this._map.fire(new ns(t.type,this._map,t))}touchend(t){this._map.fire(new ns(t.type,this._map,t))}touchcancel(t){this._map.fire(new ns(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class nl{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(t){this._map.fire(new Ni(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Ni("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._ignoreContextMenu||this._map.fire(new Ni(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class ss{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&&(K.disableDrag(),this._startPos=this._lastPos=n,this._active=!0)}mousemoveWindow(t,n){if(!this._active)return;const a=n;if(this._lastPos.equals(a)||!this._box&&a.dist(this._startPos)<this._clickTolerance)return;const h=this._startPos;this._lastPos=a,this._box||(this._box=K.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",t));const p=Math.min(h.x,a.x),m=Math.max(h.x,a.x),_=Math.min(h.y,a.y),y=Math.max(h.y,a.y);K.setTransform(this._box,`translate(${p}px,${_}px)`),this._box.style.width=m-p+"px",this._box.style.height=y-_+"px"}mouseupWindow(t,n){if(!this._active||t.button!==0)return;const a=this._startPos,h=n;if(this.reset(),K.suppressClick(),a.x!==h.x||a.y!==h.y)return this._map.fire(new c.Event("boxzoomend",{originalEvent:t})),{cameraAnimation:p=>p.fitScreenCoordinates(a,h,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"),this._box&&(K.remove(this._box),this._box=null),K.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(t,n){return this._map.fire(new c.Event(t,{originalEvent:n}))}}function Xs(o,t){if(o.length!==t.length)throw new Error(`The number of touches and points are not equal - touches ${o.length}, points ${t.length}`);const n={};for(let a=0;a<o.length;a++)n[o[a].identifier]=t[a];return n}class yr{constructor(t){this.reset(),this.numTouches=t.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(t,n,a){(this.centroid||a.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=t.timeStamp),a.length===this.numTouches&&(this.centroid=function(h){const p=new c.pointGeometry(0,0);for(const m of h)p._add(m);return p.div(h.length)}(n),this.touches=Xs(a,n)))}touchmove(t,n,a){if(this.aborted||!this.centroid)return;const h=Xs(a,n);for(const p in this.touches){const m=h[p];(!m||m.dist(this.touches[p])>30)&&(this.aborted=!0)}}touchend(t,n,a){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),a.length===0){const h=!this.aborted&&this.centroid;if(this.reset(),h)return h}}}class or{constructor(t){this.singleTap=new yr(t),this.numTaps=t.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(t,n,a){this.singleTap.touchstart(t,n,a)}touchmove(t,n,a){this.singleTap.touchmove(t,n,a)}touchend(t,n,a){const h=this.singleTap.touchend(t,n,a);if(h){const p=t.timeStamp-this.lastTime<500,m=!this.lastTap||this.lastTap.dist(h)<30;if(p&&m||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=h,this.count===this.numTaps)return this.reset(),h}}}class sl{constructor(){this._zoomIn=new or({numTouches:1,numTaps:2}),this._zoomOut=new or({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(t,n,a){this._zoomIn.touchstart(t,n,a),this._zoomOut.touchstart(t,n,a)}touchmove(t,n,a){this._zoomIn.touchmove(t,n,a),this._zoomOut.touchmove(t,n,a)}touchend(t,n,a){const h=this._zoomIn.touchend(t,n,a),p=this._zoomOut.touchend(t,n,a);return h?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:m=>m.easeTo({duration:300,zoom:m.getZoom()+1,around:m.unproject(h)},{originalEvent:t})}):p?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:m=>m.easeTo({duration:300,zoom:m.getZoom()-1,around:m.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}}class $i{constructor(t){this._enabled=!!t.enable,this._moveStateManager=t.moveStateManager,this._clickTolerance=t.clickTolerance||1,this._moveFunction=t.move,this._activateOnStart=!!t.activateOnStart,t.assignEvents(this),this.reset()}reset(t){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(t)}_move(...t){const n=this._moveFunction(...t);if(n.bearingDelta||n.pitchDelta||n.around||n.panDelta)return this._active=!0,n}dragStart(t,n){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(t)&&(this._moveStateManager.startMove(t),this._lastPoint=n.length?n[0]:n,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(t,n){if(!this.isEnabled())return;const a=this._lastPoint;if(!a)return;if(t.preventDefault(),!this._moveStateManager.isValidMoveEvent(t))return void this.reset(t);const h=n.length?n[0]:n;return!this._moved&&h.dist(a)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=h,this._move(a,h))}dragEnd(t){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(t)&&(this._moved&&K.suppressClick(),this.reset(t))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}}const as={0:1,2:2};class Ra{constructor(t){this._correctEvent=t.checkCorrectEvent}startMove(t){const n=K.mouseButton(t);this._eventButton=n}endMove(t){delete this._eventButton}isValidStartEvent(t){return this._correctEvent(t)}isValidMoveEvent(t){return!function(n,a){const h=as[a];return n.buttons===void 0||(n.buttons&h)!==h}(t,this._eventButton)}isValidEndEvent(t){return K.mouseButton(t)===this._eventButton}}class al{constructor(){this._firstTouch=void 0}_isOneFingerTouch(t){return t.targetTouches.length===1}_isSameTouchEvent(t){return t.targetTouches[0].identifier===this._firstTouch}startMove(t){this._firstTouch=t.targetTouches[0].identifier}endMove(t){delete this._firstTouch}isValidStartEvent(t){return this._isOneFingerTouch(t)}isValidMoveEvent(t){return this._isOneFingerTouch(t)&&this._isSameTouchEvent(t)}isValidEndEvent(t){return this._isOneFingerTouch(t)&&this._isSameTouchEvent(t)}}const Ba=o=>{o.mousedown=o.dragStart,o.mousemoveWindow=o.dragMove,o.mouseup=o.dragEnd,o.contextmenu=function(t){t.preventDefault()}},Fa=({enable:o,clickTolerance:t,bearingDegreesPerPixelMoved:n=.8})=>{const a=new Ra({checkCorrectEvent:h=>K.mouseButton(h)===0&&h.ctrlKey||K.mouseButton(h)===2});return new $i({clickTolerance:t,move:(h,p)=>({bearingDelta:(p.x-h.x)*n}),moveStateManager:a,enable:o,assignEvents:Ba})},In=({enable:o,clickTolerance:t,pitchDegreesPerPixelMoved:n=-.5})=>{const a=new Ra({checkCorrectEvent:h=>K.mouseButton(h)===0&&h.ctrlKey||K.mouseButton(h)===2});return new $i({clickTolerance:t,move:(h,p)=>({pitchDelta:(p.y-h.y)*n}),moveStateManager:a,enable:o,assignEvents:Ba})};class $r{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 c.pointGeometry(0,0),setTimeout(()=>{this._cancelCooperativeMessage=!1},200)}touchstart(t,n,a){return this._calculateTransform(t,n,a)}touchmove(t,n,a){if(this._map._cooperativeGestures&&(this._minTouches===2&&a.length<2&&!this._cancelCooperativeMessage?this._map._onCooperativeGesture(t,!1,a.length):this._cancelCooperativeMessage||(this._cancelCooperativeMessage=!0)),this._active&&!(a.length<this._minTouches))return t.preventDefault(),this._calculateTransform(t,n,a)}touchend(t,n,a){this._calculateTransform(t,n,a),this._active&&a.length<this._minTouches&&this.reset()}touchcancel(){this.reset()}_calculateTransform(t,n,a){a.length>0&&(this._active=!0);const h=Xs(a,n),p=new c.pointGeometry(0,0),m=new c.pointGeometry(0,0);let _=0;for(const v in h){const S=h[v],E=this._touches[v];E&&(p._add(S),m._add(S.sub(E)),_++,h[v]=S)}if(this._touches=h,_<this._minTouches||!m.mag())return;const y=m.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 $e{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}_start(t){}_move(t,n,a){return{}}touchstart(t,n,a){this._firstTwoTouches||a.length<2||(this._firstTwoTouches=[a[0].identifier,a[1].identifier],this._start([n[0],n[1]]))}touchmove(t,n,a){if(!this._firstTwoTouches)return;t.preventDefault();const[h,p]=this._firstTwoTouches,m=os(a,n,h),_=os(a,n,p);if(!m||!_)return;const y=this._aroundCenter?null:m.add(_).div(2);return this._move([m,_],y,t)}touchend(t,n,a){if(!this._firstTwoTouches)return;const[h,p]=this._firstTwoTouches,m=os(a,n,h),_=os(a,n,p);m&&_||(this._active&&K.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 os(o,t,n){for(let a=0;a<o.length;a++)if(o[a].identifier===n)return t[a]}function An(o,t){return Math.log(o/t)/Math.LN2}class ls extends $e{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(t){this._startDistance=this._distance=t[0].dist(t[1])}_move(t,n){const a=this._distance;if(this._distance=t[0].dist(t[1]),this._active||!(Math.abs(An(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:An(this._distance,a),pinchAround:n}}}function Oa(o,t){return 180*o.angleWith(t)/Math.PI}class Oe extends $e{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 a=this._vector;if(this._vector=t[0].sub(t[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:Oa(this._vector,a),pinchAround:n}}_isBelowThreshold(t){this._minDiameter=Math.min(this._minDiameter,t.mag());const n=25/(Math.PI*this._minDiameter)*360,a=Oa(t,this._startVector);return Math.abs(a)<n}}function cs(o){return Math.abs(o.y)>Math.abs(o.x)}class ac extends $e{constructor(t){super(),this._map=t}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(t,n,a){super.touchstart(t,n,a),this._currentTouchCount=a.length}_start(t){this._lastPoints=t,cs(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,n,a){if(this._map._cooperativeGestures&&this._currentTouchCount<3)return;const h=t[0].sub(this._lastPoints[0]),p=t[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(h,p,a.timeStamp),this._valid?(this._lastPoints=t,this._active=!0,{pitchDelta:(h.y+p.y)/2*-.5}):void 0}gestureBeginsVertically(t,n,a){if(this._valid!==void 0)return this._valid;const h=t.mag()>=2,p=n.mag()>=2;if(!h&&!p)return;if(!h||!p)return this._firstMove===void 0&&(this._firstMove=a),a-this._firstMove<100&&void 0;const m=t.y>0==n.y>0;return cs(t)&&cs(n)&&m}}const oc={panStep:100,bearingStep:15,pitchStep:10};class Ua{constructor(){const t=oc;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,a=0,h=0,p=0,m=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?a=-1:(t.preventDefault(),p=-1);break;case 39:t.shiftKey?a=1:(t.preventDefault(),p=1);break;case 38:t.shiftKey?h=1:(t.preventDefault(),m=-1);break;case 40:t.shiftKey?h=-1:(t.preventDefault(),m=1);break;default:return}return this._rotationDisabled&&(a=0,h=0),{cameraAnimation:_=>{const y=_.getZoom();_.easeTo({duration:300,easeId:"keyboardHandler",easing:ol,zoom:n?Math.round(y)+n*(t.shiftKey?2:1):y,bearing:_.getBearing()+a*this._bearingStep,pitch:_.getPitch()+h*this._pitchStep,offset:[-p*this._panStep,-m*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 ol(o){return o*(2-o)}const Va=4.000244140625;class lc{constructor(t,n){this._map=t,this._el=t.getCanvasContainer(),this._handler=n,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222,c.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 a=c.exported.now(),h=a-(this._lastWheelEventTime||0);this._lastWheelEventTime=a,n!==0&&n%Va==0?this._type="wheel":n!==0&&Math.abs(n)<4?this._type="trackpad":h>400?(this._type=null,this._lastValue=n,this._timeout=setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(h*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=K.mousePos(this._el,t);this._around=c.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)>Va?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,a=this._startZoom,h=this._easing;let p,m=!1;if(this._type==="wheel"&&a&&h){const _=Math.min((c.exported.now()-this._lastWheelEventTime)/200,1),y=h(_);p=c.number(a,n,y),_<1?this._frameId||(this._frameId=!0):m=!0}else p=n,m=!0;return this._active=!0,m&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!m,zoomDelta:p-t.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let n=c.ease;if(this._prevEase){const a=this._prevEase,h=(c.exported.now()-a.start)/a.duration,p=a.easing(h+.01)-a.easing(h),m=.27/Math.sqrt(p*p+1e-4)*.01,_=Math.sqrt(.0729-m*m);n=c.bezier(m,_,.25,1)}return this._prevEase={start:c.exported.now(),duration:t,easing:n},n}reset(){this._active=!1}}class cc{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 Na{constructor(){this.reset()}reset(){this._active=!1}dblclick(t,n){return t.preventDefault(),{cameraAnimation:a=>{a.easeTo({duration:300,zoom:a.getZoom()+(t.shiftKey?-1:1),around:a.unproject(n)},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class $a{constructor(){this._tap=new or({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,a){this._swipePoint||(this._tapTime&&t.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?a.length>0&&(this._swipePoint=n[0],this._swipeTouch=a[0].identifier):this._tap.touchstart(t,n,a))}touchmove(t,n,a){if(this._tapTime){if(this._swipePoint){if(a[0].identifier!==this._swipeTouch)return;const h=n[0],p=h.y-this._swipePoint.y;return this._swipePoint=h,t.preventDefault(),this._active=!0,{zoomDelta:p/128}}}else this._tap.touchmove(t,n,a)}touchend(t,n,a){this._tapTime?this._swipePoint&&a.length===0&&this.reset():this._tap.touchend(t,n,a)&&(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 ja{constructor(t,n,a){this._el=t,this._mousePan=n,this._touchPan=a}enable(t){this._inertiaOptions=t||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class Ga{constructor(t,n,a){this._pitchWithRotate=t.pitchWithRotate,this._mouseRotate=n,this._mousePitch=a}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 zi{constructor(t,n,a,h){this._el=t,this._touchZoom=n,this._touchRotate=a,this._tapDragZoom=h,this._rotationDisabled=!1,this._enabled=!0}enable(t){this._touchZoom.enable(t),this._rotationDisabled||this._touchRotate.enable(t),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}const lr=o=>o.zoom||o.drag||o.pitch||o.rotate;class ll extends c.Event{}function hs(o){return o.panDelta&&o.panDelta.mag()||o.zoomDelta||o.bearingDelta||o.pitchDelta}class qa{constructor(t,n){this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new tl(t),this._bearingSnap=n.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(n),c.bindAll(["handleEvent","handleWindowEvent"],this);const a=this._el;this._listeners=[[a,"touchstart",{passive:!0}],[a,"touchmove",{passive:!1}],[a,"touchend",void 0],[a,"touchcancel",void 0],[a,"mousedown",void 0],[a,"mousemove",void 0],[a,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[a,"mouseover",void 0],[a,"mouseout",void 0],[a,"dblclick",void 0],[a,"click",void 0],[a,"keydown",{capture:!1}],[a,"keyup",void 0],[a,"wheel",{passive:!1}],[a,"contextmenu",void 0],[window,"blur",void 0]];for(const[h,p,m]of this._listeners)K.addEventListener(h,p,h===document?this.handleWindowEvent:this.handleEvent,m)}destroy(){for(const[t,n,a]of this._listeners)K.removeEventListener(t,n,t===document?this.handleWindowEvent:this.handleEvent,a)}_addDefaultHandlers(t){const n=this._map,a=n.getCanvasContainer();this._add("mapEvent",new rl(n,t));const h=n.boxZoom=new ss(n,t);this._add("boxZoom",h);const p=new sl,m=new Na;n.doubleClickZoom=new cc(m,p),this._add("tapZoom",p),this._add("clickZoom",m);const _=new $a;this._add("tapDragZoom",_);const y=n.touchPitch=new ac(n);this._add("touchPitch",y);const v=Fa(t),S=In(t);n.dragRotate=new Ga(t,v,S),this._add("mouseRotate",v,["mousePitch"]),this._add("mousePitch",S,["mouseRotate"]);const E=(({enable:X,clickTolerance:q})=>{const U=new Ra({checkCorrectEvent:W=>K.mouseButton(W)===0&&!W.ctrlKey});return new $i({clickTolerance:q,move:(W,te)=>({around:te,panDelta:te.sub(W)}),activateOnStart:!0,moveStateManager:U,enable:X,assignEvents:Ba})})(t),M=new $r(t,n);n.dragPan=new ja(a,E,M),this._add("mousePan",E),this._add("touchPan",M,["touchZoom","touchRotate"]);const D=new Oe,B=new ls;n.touchZoomRotate=new zi(a,B,D,_),this._add("touchRotate",D,["touchPan","touchZoom"]),this._add("touchZoom",B,["touchPan","touchRotate"]);const L=n.scrollZoom=new lc(n,this);this._add("scrollZoom",L,["mousePan"]);const N=n.keyboard=new Ua;this._add("keyboard",N),this._add("blockableMapEvent",new nl(n));for(const X of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])t.interactive&&t[X]&&n[X].enable(t[X])}_add(t,n,a){this._handlers.push({handlerName:t,handler:n,allowed:a}),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(lr(this._eventsInProgress))||this.isZooming()}_blockedByActive(t,n,a){for(const h in t)if(h!==a&&(!n||n.indexOf(h)<0))return!0;return!1}handleWindowEvent(t){this.handleEvent(t,`${t.type}Window`)}_getMapTouches(t){const n=[];for(const a of t)this._el.contains(a.target)&&n.push(a);return n}handleEvent(t,n){if(t.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const a=t.type==="renderFrame"?void 0:t,h={needsRenderFrame:!1},p={},m={},_=t.touches,y=_?this._getMapTouches(_):void 0,v=y?K.touchPos(this._el,y):K.mousePos(this._el,t);for(const{handlerName:M,handler:D,allowed:B}of this._handlers){if(!D.isEnabled())continue;let L;this._blockedByActive(m,B,M)?D.reset():D[n||t.type]&&(L=D[n||t.type](t,v,y),this.mergeHandlerResult(h,p,L,M,a),L&&L.needsRenderFrame&&this._triggerRenderFrame()),(L||D.isActive())&&(m[M]=D)}const S={};for(const M in this._previousActiveHandlers)m[M]||(S[M]=a);this._previousActiveHandlers=m,(Object.keys(S).length||hs(h))&&(this._changes.push([h,p,S]),this._triggerRenderFrame()),(Object.keys(m).length||hs(h))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:E}=h;E&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],E(this._map))}mergeHandlerResult(t,n,a,h,p){if(!a)return;c.extend(t,a);const m={handlerName:h,originalEvent:a.originalEvent||p};a.zoomDelta!==void 0&&(n.zoom=m),a.panDelta!==void 0&&(n.drag=m),a.pitchDelta!==void 0&&(n.pitch=m),a.bearingDelta!==void 0&&(n.rotate=m)}_applyChanges(){const t={},n={},a={};for(const[h,p,m]of this._changes)h.panDelta&&(t.panDelta=(t.panDelta||new c.pointGeometry(0,0))._add(h.panDelta)),h.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+h.zoomDelta),h.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+h.bearingDelta),h.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+h.pitchDelta),h.around!==void 0&&(t.around=h.around),h.pinchAround!==void 0&&(t.pinchAround=h.pinchAround),h.noInertia&&(t.noInertia=h.noInertia),c.extend(n,p),c.extend(a,m);this._updateMapTransform(t,n,a),this._changes=[]}_updateMapTransform(t,n,a){const h=this._map,p=h.transform,m=h.terrain;if(!(hs(t)||m&&this._terrainMovement))return this._fireEvents(n,a,!0);let{panDelta:_,zoomDelta:y,bearingDelta:v,pitchDelta:S,around:E,pinchAround:M}=t;M!==void 0&&(E=M),h._stop(!0),E=E||h.transform.centerPoint;const D=p.pointLocation(_?E.sub(_):E);v&&(p.bearing+=v),S&&(p.pitch+=S),y&&(p.zoom+=y),m?this._terrainMovement||!n.drag&&!n.zoom?n.drag&&this._terrainMovement?p.center=p.pointLocation(p.centerPoint.sub(_)):p.setLocationAtPoint(D,E):(this._terrainMovement=!0,p.freezeElevation=!0,p.setLocationAtPoint(D,E),this._map.once("moveend",()=>{p.freezeElevation=!1,this._terrainMovement=!1,p.recalculateZoom(h.terrain)})):p.setLocationAtPoint(D,E),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(n,a,!0)}_fireEvents(t,n,a){const h=lr(this._eventsInProgress),p=lr(t),m={};for(const S in t){const{originalEvent:E}=t[S];this._eventsInProgress[S]||(m[`${S}start`]=E),this._eventsInProgress[S]=t[S]}!h&&p&&this._fireEvent("movestart",p.originalEvent);for(const S in m)this._fireEvent(S,m[S]);p&&this._fireEvent("move",p.originalEvent);for(const S in t){const{originalEvent:E}=t[S];this._fireEvent(S,E)}const _={};let y;for(const S in this._eventsInProgress){const{handlerName:E,originalEvent:M}=this._eventsInProgress[S];this._handlersById[E].isActive()||(delete this._eventsInProgress[S],y=n[E]||M,_[`${S}end`]=y)}for(const S in _)this._fireEvent(S,_[S]);const v=lr(this._eventsInProgress);if(a&&(h||p)&&!v){this._updatingCamera=!0;const S=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),E=M=>M!==0&&-this._bearingSnap<M&&M<this._bearingSnap;S?(E(S.bearing||this._map.getBearing())&&(S.bearing=0),S.freezeElevation=!0,this._map.easeTo(S,{originalEvent:y})):(this._map.fire(new c.Event("moveend",{originalEvent:y})),E(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(t,n){this._map.fire(new c.Event(t,n?{originalEvent:n}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(t=>{delete this._frameId,this.handleEvent(new ll("renderFrame",{timeStamp:t})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}const Za={extend:(o,...t)=>c.extend(o,...t),run(o){o()},logToElement(o,t=!1,n="log"){const a=window.document.getElementById(n);a&&(t&&(a.innerHTML=""),a.innerHTML+=`<br>${o}`)}};class cl extends c.Evented{constructor(t,n){super(),this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=n.bearingSnap,c.bindAll(["_renderFrameCallback"],this)}getCenter(){return new c.LngLat(this.transform.center.lng,this.transform.center.lat)}setCenter(t,n){return this.jumpTo({center:t},n)}panBy(t,n,a){return t=c.pointGeometry.convert(t).mult(-1),this.panTo(this.transform.center,c.extend({offset:t},n),a)}panTo(t,n,a){return this.easeTo(c.extend({center:t},n),a)}getZoom(){return this.transform.zoom}setZoom(t,n){return this.jumpTo({zoom:t},n),this}zoomTo(t,n,a){return this.easeTo(c.extend({zoom:t},n),a)}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,a){return this.easeTo(c.extend({bearing:t},n),a)}resetNorth(t,n){return this.rotateTo(0,c.extend({duration:1e3},t),n),this}resetNorthPitch(t,n){return this.easeTo(c.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=c.LngLatBounds.convert(t);const a=n&&n.bearing||0;return this._cameraForBoxAndBearing(t.getNorthWest(),t.getSouthEast(),a,n)}_cameraForBoxAndBearing(t,n,a,h){const p={top:0,bottom:0,right:0,left:0};if(typeof(h=c.extend({padding:p,offset:[0,0],maxZoom:this.transform.maxZoom},h)).padding=="number"){const te=h.padding;h.padding={top:te,bottom:te,right:te,left:te}}h.padding=c.extend(p,h.padding);const m=this.transform,_=m.padding,y=m.project(c.LngLat.convert(t)),v=m.project(c.LngLat.convert(n)),S=y.rotate(-a*Math.PI/180),E=v.rotate(-a*Math.PI/180),M=new c.pointGeometry(Math.max(S.x,E.x),Math.max(S.y,E.y)),D=new c.pointGeometry(Math.min(S.x,E.x),Math.min(S.y,E.y)),B=M.sub(D),L=(m.width-(_.left+_.right+h.padding.left+h.padding.right))/B.x,N=(m.height-(_.top+_.bottom+h.padding.top+h.padding.bottom))/B.y;if(N<0||L<0)return void c.warnOnce("Map cannot fit within canvas with the given bounds, padding, and/or offset.");const X=Math.min(m.scaleZoom(m.scale*Math.min(L,N)),h.maxZoom),q=c.pointGeometry.convert(h.offset),U=new c.pointGeometry((h.padding.left-h.padding.right)/2,(h.padding.top-h.padding.bottom)/2).rotate(a*Math.PI/180),W=q.add(U).mult(m.scale/m.zoomScale(X));return{center:m.unproject(y.add(v).div(2).sub(W)),zoom:X,bearing:a}}fitBounds(t,n,a){return this._fitInternal(this.cameraForBounds(t,n),n,a)}fitScreenCoordinates(t,n,a,h,p){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(c.pointGeometry.convert(t)),this.transform.pointLocation(c.pointGeometry.convert(n)),a,h),h,p)}_fitInternal(t,n,a){return t?(delete(n=c.extend(t,n)).padding,n.linear?this.easeTo(n,a):this.flyTo(n,a)):this}jumpTo(t,n){this.stop();const a=this.transform;let h=!1,p=!1,m=!1;return"zoom"in t&&a.zoom!==+t.zoom&&(h=!0,a.zoom=+t.zoom),t.center!==void 0&&(a.center=c.LngLat.convert(t.center)),"bearing"in t&&a.bearing!==+t.bearing&&(p=!0,a.bearing=+t.bearing),"pitch"in t&&a.pitch!==+t.pitch&&(m=!0,a.pitch=+t.pitch),t.padding==null||a.isPaddingEqual(t.padding)||(a.padding=t.padding),this.fire(new c.Event("movestart",n)).fire(new c.Event("move",n)),h&&this.fire(new c.Event("zoomstart",n)).fire(new c.Event("zoom",n)).fire(new c.Event("zoomend",n)),p&&this.fire(new c.Event("rotatestart",n)).fire(new c.Event("rotate",n)).fire(new c.Event("rotateend",n)),m&&this.fire(new c.Event("pitchstart",n)).fire(new c.Event("pitch",n)).fire(new c.Event("pitchend",n)),this.fire(new c.Event("moveend",n))}calculateCameraOptionsFromTo(t,n,a,h=0){const p=c.MercatorCoordinate.fromLngLat(t,n),m=c.MercatorCoordinate.fromLngLat(a,h),_=m.x-p.x,y=m.y-p.y,v=m.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 E=Math.hypot(_,y),M=this.transform.scaleZoom(this.transform.cameraToCenterDistance/S/this.transform.tileSize),D=180*Math.atan2(_,-y)/Math.PI;let B=180*Math.acos(E/S)/Math.PI;return B=v<0?90-B:90+B,{center:m.toLngLat(),zoom:M,pitch:B,bearing:D}}easeTo(t,n){this._stop(!1,t.easeId),((t=c.extend({offset:[0,0],duration:500,easing:c.ease},t)).animate===!1||!t.essential&&c.exported.prefersReducedMotion)&&(t.duration=0);const a=this.transform,h=this.getZoom(),p=this.getBearing(),m=this.getPitch(),_=this.getPadding(),y="zoom"in t?+t.zoom:h,v="bearing"in t?this._normalizeBearing(t.bearing,p):p,S="pitch"in t?+t.pitch:m,E="padding"in t?t.padding:a.padding,M=c.pointGeometry.convert(t.offset);let D=a.centerPoint.add(M);const B=a.pointLocation(D),L=c.LngLat.convert(t.center||B);this._normalizeCenter(L);const N=a.project(B),X=a.project(L).sub(N),q=a.zoomScale(y-h);let U,W;t.around&&(U=c.LngLat.convert(t.around),W=a.locationPoint(U));const te={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||y!==h,this._rotating=this._rotating||p!==v,this._pitching=this._pitching||S!==m,this._padding=!a.isPaddingEqual(E),this._easeId=t.easeId,this._prepareEase(n,t.noMoveStart,te),this.terrain&&this._prepareElevation(L),this._ease(ae=>{if(this._zooming&&(a.zoom=c.number(h,y,ae)),this._rotating&&(a.bearing=c.number(p,v,ae)),this._pitching&&(a.pitch=c.number(m,S,ae)),this._padding&&(a.interpolatePadding(_,E,ae),D=a.centerPoint.add(M)),this.terrain&&!t.freezeElevation&&this._updateElevation(ae),U)a.setLocationAtPoint(U,W);else{const he=a.zoomScale(a.zoom-h),me=y>h?Math.min(2,q):Math.max(.5,q),Te=Math.pow(me,1-ae),ye=a.unproject(N.add(X.mult(ae*Te)).mult(he));a.setLocationAtPoint(a.renderWorldCopies?ye.wrap():ye,D)}this._fireMoveEvents(n)},ae=>{this.terrain&&this._finalizeElevation(),this._afterEase(n,ae)},t),this}_prepareEase(t,n,a={}){this._moving=!0,n||a.moving||this.fire(new c.Event("movestart",t)),this._zooming&&!a.zooming&&this.fire(new c.Event("zoomstart",t)),this._rotating&&!a.rotating&&this.fire(new c.Event("rotatestart",t)),this._pitching&&!a.pitching&&this.fire(new c.Event("pitchstart",t))}_prepareElevation(t){this._elevationCenter=t,this._elevationStart=this.transform.elevation,this._elevationTarget=this.transform.getElevation(t,this.terrain),this.transform.freezeElevation=!0}_updateElevation(t){const n=this.transform.getElevation(this._elevationCenter,this.terrain);if(t<1&&n!==this._elevationTarget){const a=this._elevationTarget-this._elevationStart;this._elevationStart+=t*(a-(n-(a*t+this._elevationStart))/(1-t)),this._elevationTarget=n}this.transform.elevation=c.number(this._elevationStart,this._elevationTarget,t)}_finalizeElevation(){this.transform.freezeElevation=!1,this.transform.recalculateZoom(this.terrain)}_fireMoveEvents(t){this.fire(new c.Event("move",t)),this._zooming&&this.fire(new c.Event("zoom",t)),this._rotating&&this.fire(new c.Event("rotate",t)),this._pitching&&this.fire(new c.Event("pitch",t))}_afterEase(t,n){if(this._easeId&&n&&this._easeId===n)return;delete this._easeId;const a=this._zooming,h=this._rotating,p=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,a&&this.fire(new c.Event("zoomend",t)),h&&this.fire(new c.Event("rotateend",t)),p&&this.fire(new c.Event("pitchend",t)),this.fire(new c.Event("moveend",t))}flyTo(t,n){if(!t.essential&&c.exported.prefersReducedMotion){const We=c.pick(t,["center","zoom","bearing","pitch","around"]);return this.jumpTo(We,n)}this.stop(),t=c.extend({offset:[0,0],speed:1.2,curve:1.42,easing:c.ease},t);const a=this.transform,h=this.getZoom(),p=this.getBearing(),m=this.getPitch(),_=this.getPadding(),y="zoom"in t?c.clamp(+t.zoom,a.minZoom,a.maxZoom):h,v="bearing"in t?this._normalizeBearing(t.bearing,p):p,S="pitch"in t?+t.pitch:m,E="padding"in t?t.padding:a.padding,M=a.zoomScale(y-h),D=c.pointGeometry.convert(t.offset);let B=a.centerPoint.add(D);const L=a.pointLocation(B),N=c.LngLat.convert(t.center||L);this._normalizeCenter(N);const X=a.project(L),q=a.project(N).sub(X);let U=t.curve;const W=Math.max(a.width,a.height),te=W/M,ae=q.mag();if("minZoom"in t){const We=c.clamp(Math.min(t.minZoom,h,y),a.minZoom,a.maxZoom),Mt=W/a.zoomScale(We-h);U=Math.sqrt(Mt/ae*2)}const he=U*U;function me(We){const Mt=(te*te-W*W+(We?-1:1)*he*he*ae*ae)/(2*(We?te:W)*he*ae);return Math.log(Math.sqrt(Mt*Mt+1)-Mt)}function Te(We){return(Math.exp(We)-Math.exp(-We))/2}function ye(We){return(Math.exp(We)+Math.exp(-We))/2}const Ae=me(0);let Ge=function(We){return ye(Ae)/ye(Ae+U*We)},rt=function(We){return W*((ye(Ae)*(Te(Mt=Ae+U*We)/ye(Mt))-Te(Ae))/he)/ae;var Mt},nt=(me(1)-Ae)/U;if(Math.abs(ae)<1e-6||!isFinite(nt)){if(Math.abs(W-te)<1e-6)return this.easeTo(t,n);const We=te<W?-1:1;nt=Math.abs(Math.log(te/W))/U,rt=function(){return 0},Ge=function(Mt){return Math.exp(We*U*Mt)}}return t.duration="duration"in t?+t.duration:1e3*nt/("screenSpeed"in t?+t.screenSpeed/U:+t.speed),t.maxDuration&&t.duration>t.maxDuration&&(t.duration=0),this._zooming=!0,this._rotating=p!==v,this._pitching=S!==m,this._padding=!a.isPaddingEqual(E),this._prepareEase(n,!1),this.terrain&&this._prepareElevation(N),this._ease(We=>{const Mt=We*nt,Tt=1/Ge(Mt);a.zoom=We===1?y:h+a.scaleZoom(Tt),this._rotating&&(a.bearing=c.number(p,v,We)),this._pitching&&(a.pitch=c.number(m,S,We)),this._padding&&(a.interpolatePadding(_,E,We),B=a.centerPoint.add(D)),this.terrain&&!t.freezeElevation&&this._updateElevation(We);const mt=We===1?N:a.unproject(X.add(q.mult(rt(Mt))).mult(Tt));a.setLocationAtPoint(a.renderWorldCopies?mt.wrap():mt,B),this._fireMoveEvents(n)},()=>{this.terrain&&this._finalizeElevation(),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 a=this._onEaseEnd;delete this._onEaseEnd,a.call(this,n)}if(!t){const a=this.handlers;a&&a.stop(!1)}return this}_ease(t,n,a){a.animate===!1||a.duration===0?(t(1),n()):(this._easeStart=c.exported.now(),this._easeOptions=a,this._onEaseFrame=t,this._onEaseEnd=n,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){const t=Math.min((c.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=c.wrap(t,-180,180);const a=Math.abs(t-n);return Math.abs(t-360-n)<a&&(t-=360),Math.abs(t+360-n)<a&&(t+=360),t}_normalizeCenter(t){const n=this.transform;if(!n.renderWorldCopies||n.lngRange)return;const a=t.lng-n.center.lng;t.lng+=a>180?-360:a<-180?360:0}}class ji{constructor(t={}){this.options=t,c.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=K.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=K.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=K.create("div","maplibregl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("terrain",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container}onRemove(){K.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 a=this._map._getUIString(`AttributionControl.${n}`);t.title=a,t.setAttribute("aria-label",a)}_toggleAttribution(){this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))}_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(h=>typeof h!="string"?"":h)):typeof this.options.customAttribution=="string"&&t.push(this.options.customAttribution)),this._map.style.stylesheet){const h=this._map.style.stylesheet;this.styleOwner=h.owner,this.styleId=h.id}const n=this._map.style.sourceCaches;for(const h in n){const p=n[h];if(p.used||p.usedForTerrain){const m=p.getSource();m.attribution&&t.indexOf(m.attribution)<0&&t.push(m.attribution)}}t=t.filter(h=>String(h).trim()),t.sort((h,p)=>h.length-p.length),t=t.filter((h,p)=>{for(let m=p+1;m<t.length;m++)if(t[m].indexOf(h)>=0)return!1;return!0});const a=t.join(" | ");a!==this._attribHTML&&(this._attribHTML=a,t.length?(this._innerContainer.innerHTML=a,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-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","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"))}_updateCompactMinimize(){this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")}}class Vt{constructor(t={}){this.options=t,c.bindAll(["_updateCompact"],this)}getDefaultPosition(){return"bottom-left"}onAdd(t){this._map=t,this._compact=this.options&&this.options.compact,this._container=K.create("div","maplibregl-ctrl");const n=K.create("a","maplibregl-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(){K.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"):n.classList.remove("maplibregl-compact")}}}class Ws{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,a=n?this._queue.concat(n):this._queue;for(const h of a)if(h.id===t)return void(h.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 a of n)if(!a.cancelled&&(a.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"};var hl=c.createLayout([{name:"a_pos3d",type:"Int16",components:3}]);class ul extends c.Evented{constructor(t){super(),this.sourceCache=t,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,t.usedForTerrain=!0,t.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(t,n){this.sourceCache.update(t,n),this._renderableTilesKeys=[];const a={};for(const h of t.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:n}))a[h.key]=!0,this._renderableTilesKeys.push(h.key),this._tiles[h.key]||(h.posMatrix=new Float64Array(16),c.ortho(h.posMatrix,0,c.EXTENT,0,c.EXTENT,0,1),this._tiles[h.key]=new Tr(h,this.tileSize));for(const h in this._tiles)a[h]||delete this._tiles[h]}freeRtt(t){for(const n in this._tiles){const a=this._tiles[n];(!t||a.tileID.equals(t)||a.tileID.isChildOf(t)||t.isChildOf(a.tileID))&&(a.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(t=>this.getTileByID(t))}getTileByID(t){return this._tiles[t]}getTerrainCoords(t){const n={};for(const a of this._renderableTilesKeys){const h=this._tiles[a].tileID;if(h.canonical.equals(t.canonical)){const p=t.clone();p.posMatrix=new Float64Array(16),c.ortho(p.posMatrix,0,c.EXTENT,0,c.EXTENT,0,1),n[a]=p}else if(h.canonical.isChildOf(t.canonical)){const p=t.clone();p.posMatrix=new Float64Array(16);const m=h.canonical.z-t.canonical.z,_=h.canonical.x-(h.canonical.x>>m<<m),y=h.canonical.y-(h.canonical.y>>m<<m),v=c.EXTENT>>m;c.ortho(p.posMatrix,0,v,0,v,0,1),c.translate(p.posMatrix,p.posMatrix,[-_*v,-y*v,0]),n[a]=p}else if(t.canonical.isChildOf(h.canonical)){const p=t.clone();p.posMatrix=new Float64Array(16);const m=t.canonical.z-h.canonical.z,_=t.canonical.x-(t.canonical.x>>m<<m),y=t.canonical.y-(t.canonical.y>>m<<m),v=c.EXTENT>>m;c.ortho(p.posMatrix,0,c.EXTENT,0,c.EXTENT,0,1),c.translate(p.posMatrix,p.posMatrix,[_*v,y*v,0]),c.scale(p.posMatrix,p.posMatrix,[1/2**m,1/2**m,0]),n[a]=p}}return n}getSourceTile(t,n){const a=this.sourceCache._source;let h=t.overscaledZ-this.deltaZoom;if(h>a.maxzoom&&(h=a.maxzoom),h<a.minzoom)return null;this._sourceTileCache[t.key]||(this._sourceTileCache[t.key]=t.scaledTo(h).key);let p=this.sourceCache.getTileByID(this._sourceTileCache[t.key]);if((!p||!p.dem)&&n)for(;h>=a.minzoom&&(!p||!p.dem);)p=this.sourceCache.getTileByID(t.scaledTo(h--).key);return p}tilesAfterTime(t=Date.now()){return Object.values(this._tiles).filter(n=>n.timeAdded>=t)}}class pl{constructor(t,n,a){this.painter=t,this.sourceCache=new ul(n),this.options=a,this.exaggeration=typeof a.exaggeration=="number"?a.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(t,n,a,h=c.EXTENT){if(!(n>=0&&n<h&&a>=0&&a<h))return 0;let p=0;const m=this.getTerrainData(t);if(m.tile&&m.tile.dem){const _=c.transformMat4$1([],[n/h*c.EXTENT,a/h*c.EXTENT],m.u_terrain_matrix),y=[_[0]*m.tile.dem.dim,_[1]*m.tile.dem.dim],v=[Math.floor(y[0]),Math.floor(y[1])],S=m.tile.dem.get(v[0],v[1]),E=m.tile.dem.get(v[0],v[1]+1),M=m.tile.dem.get(v[0]+1,v[1]),D=m.tile.dem.get(v[0]+1,v[1]+1);p=c.number(c.number(S,E,y[0]-v[0]),c.number(M,D,y[0]-v[0]),y[1]-v[1])}return p}getElevation(t,n,a,h=c.EXTENT){return this.getDEMElevation(t,n,a,h)*this.exaggeration}getTerrainData(t){if(!this._emptyDemTexture){const h=this.painter.context,p=new c.RGBAImage({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new Dt(h,p,h.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new Dt(h,new c.RGBAImage({width:1,height:1}),h.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(h.gl.NEAREST,h.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=c.identity([])}const n=this.sourceCache.getSourceTile(t,!0);if(n&&n.dem&&(!n.demTexture||n.needsTerrainPrepare)){const h=this.painter.context;n.demTexture=this.painter.getTileTexture(n.dem.stride),n.demTexture?n.demTexture.update(n.dem.getPixels(),{premultiply:!1}):n.demTexture=new Dt(h,n.dem.getPixels(),h.gl.RGBA,{premultiply:!1}),n.demTexture.bind(h.gl.NEAREST,h.gl.CLAMP_TO_EDGE),n.needsTerrainPrepare=!1}const a=n&&n+n.tileID.key+t.key;if(a&&!this._demMatrixCache[a]){const h=this.sourceCache.sourceCache._source.maxzoom;let p=t.canonical.z-n.tileID.canonical.z;t.overscaledZ>t.canonical.z&&(t.canonical.z>=h?p=t.canonical.z-h:c.warnOnce("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const m=t.canonical.x-(t.canonical.x>>p<<p),_=t.canonical.y-(t.canonical.y>>p<<p),y=c.fromScaling(new Float64Array(16),[1/(c.EXTENT<<p),1/(c.EXTENT<<p),0]);c.translate(y,y,[m*c.EXTENT,_*c.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:a?this._demMatrixCache[t.key].matrix:this._emptyDemMatrix,u_terrain_unpack:n&&n.dem&&n.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(n&&n.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:n}}getFramebuffer(t){const n=this.painter,a=n.width/devicePixelRatio,h=n.height/devicePixelRatio;return!this._fbo||this._fbo.width===a&&this._fbo.height===h||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new Dt(n.context,{width:a,height:h,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 Dt(n.context,{width:a,height:h,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(a,h,!0),this._fbo.depthAttachment.set(n.context.createRenderbuffer(n.context.gl.DEPTH_COMPONENT16,a,h))),this._fbo.colorAttachment.set(t==="coords"?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){const t=this.painter.context;if(this._coordsTexture)return this._coordsTexture;const n=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let p=0,m=0;p<this._coordsTextureSize;p++)for(let _=0;_<this._coordsTextureSize;_++,m+=4)n[m+0]=255&_,n[m+1]=255&p,n[m+2]=_>>8<<4|p>>8,n[m+3]=0;const a=new c.RGBAImage({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(n.buffer)),h=new Dt(t,a,t.gl.RGBA,{premultiply:!1});return h.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),this._coordsTexture=h,h}pointCoordinate(t){const n=new Uint8Array(4),a=this.painter.context,h=a.gl;a.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),h.readPixels(t.x,this.painter.height/devicePixelRatio-t.y-1,1,1,h.RGBA,h.UNSIGNED_BYTE,n),a.bindFramebuffer.set(null);const p=n[0]+(n[2]>>4<<8),m=n[1]+((15&n[2])<<8),_=this.coordsIndex[255-n[3]],y=_&&this.sourceCache.getTileByID(_);if(!y)return null;const v=this._coordsTextureSize,S=(1<<y.tileID.canonical.z)*v;return new c.MercatorCoordinate((y.tileID.canonical.x*v+p)/S,(y.tileID.canonical.y*v+m)/S,this.getElevation(y.tileID,p,m,v))}getTerrainMesh(){if(this._mesh)return this._mesh;const t=this.painter.context,n=new c.Pos3dArray,a=new c.TriangleIndexArray,h=this.meshSize,p=c.EXTENT/h,m=h*h;for(let E=0;E<=h;E++)for(let M=0;M<=h;M++)n.emplaceBack(M*p,E*p,0);for(let E=0;E<m;E+=h+1)for(let M=0;M<h;M++)a.emplaceBack(M+E,h+M+E+1,h+M+E+2),a.emplaceBack(M+E,h+M+E+2,M+E+1);const _=n.length,y=_+2*(h+1);for(const E of[0,1])for(let M=0;M<=h;M++)for(const D of[0,1])n.emplaceBack(M*p,E*c.EXTENT,D);for(let E=0;E<2*h;E+=2)a.emplaceBack(y+E,y+E+1,y+E+3),a.emplaceBack(y+E,y+E+3,y+E+2),a.emplaceBack(_+E,_+E+3,_+E+1),a.emplaceBack(_+E,_+E+2,_+E+3);const v=n.length,S=v+2*(h+1);for(const E of[0,1])for(let M=0;M<=h;M++)for(const D of[0,1])n.emplaceBack(E*c.EXTENT,M*p,D);for(let E=0;E<2*h;E+=2)a.emplaceBack(v+E,v+E+1,v+E+3),a.emplaceBack(v+E,v+E+3,v+E+2),a.emplaceBack(S+E,S+E+3,S+E+1),a.emplaceBack(S+E,S+E+2,S+E+3);return this._mesh={indexBuffer:t.createIndexBuffer(a),vertexBuffer:t.createVertexBuffer(n,hl.members),segments:c.SegmentVector.simpleSegment(0,0,n.length,a.length)},this._mesh}getMeshFrameDelta(t){return 2*Math.PI*c.earthRadius/Math.pow(2,t)/5}getMinMaxElevation(t){const n=this.getTerrainData(t).tile,a={minElevation:null,maxElevation:null};return n&&n.dem&&(a.minElevation=n.dem.min*this.exaggeration,a.maxElevation=n.dem.max*this.exaggeration),a}}class hc{constructor(t,n,a){this._context=t,this._size=n,this._tileSize=a,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(const t of this._objects)t.texture.destroy(),t.fbo.destroy()}_createObject(t){const n=this._context.createFramebuffer(this._tileSize,this._tileSize,!0),a=new Dt(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return a.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),n.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_COMPONENT16,this._tileSize,this._tileSize)),n.colorAttachment.set(a.texture),{id:t,fbo:n,texture:a,stamp:-1,inUse:!1}}getObjectForId(t){return this._objects[t]}useObject(t){t.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter(n=>t.id!==n),this._recentlyUsed.push(t.id)}stampObject(t){t.stamp=++this._stamp}getOrCreateFreeObject(){for(const n of this._recentlyUsed)if(!this._objects[n].inUse)return this._objects[n];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const t=this._createObject(this._objects.length);return this._objects.push(t),t}freeObject(t){t.inUse=!1}freeAllObjects(){for(const t of this._objects)this.freeObject(t)}isFull(){return!(this._objects.length<this._size)&&this._objects.some(t=>!t.inUse)===!1}}const Ti={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class Hs{constructor(t,n){this.painter=t,this.terrain=n,this.pool=new hc(t.context,30,n.sourceCache.tileSize*n.qualityFactor)}destruct(){this.pool.destruct()}getTexture(t){return this.pool.getObjectForId(t.rtt[this._stacks.length-1].id).texture}prepareForRender(t,n){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=t._order.filter(a=>!t._layers[a].isHidden(n)),this._coordsDescendingInv={};for(const a in t.sourceCaches){this._coordsDescendingInv[a]={};const h=t.sourceCaches[a].getVisibleCoordinates();for(const p of h){const m=this.terrain.sourceCache.getTerrainCoords(p);for(const _ in m)this._coordsDescendingInv[a][_]||(this._coordsDescendingInv[a][_]=[]),this._coordsDescendingInv[a][_].push(m[_])}}this._coordsDescendingInvStr={};for(const a of t._order){const h=t._layers[a],p=h.source;if(Ti[h.type]&&!this._coordsDescendingInvStr[p]){this._coordsDescendingInvStr[p]={};for(const m in this._coordsDescendingInv[p])this._coordsDescendingInvStr[p][m]=this._coordsDescendingInv[p][m].map(_=>_.key).sort().join()}}for(const a of this._renderableTiles)for(const h in this._coordsDescendingInvStr){const p=this._coordsDescendingInvStr[h][a.tileID.key];p&&p!==a.rttCoords[h]&&(a.rtt=[])}}renderLayer(t){if(t.isHidden(this.painter.transform.zoom))return!1;const n=t.type,a=this.painter,h=this._renderableLayerIds[this._renderableLayerIds.length-1]===t.id;if(Ti[n]&&(this._prevType&&Ti[this._prevType]||this._stacks.push([]),this._prevType=n,this._stacks[this._stacks.length-1].push(t.id),!h))return!0;if(Ti[this._prevType]||Ti[n]&&h){this._prevType=n;const p=this._stacks.length-1,m=this._stacks[p]||[];for(const _ of this._renderableTiles){if(this.pool.isFull()&&(js(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(_),_.rtt[p]){const v=this.pool.getObjectForId(_.rtt[p].id);if(v.stamp===_.rtt[p].stamp){this.pool.useObject(v);continue}}const y=this.pool.getOrCreateFreeObject();this.pool.useObject(y),this.pool.stampObject(y),_.rtt[p]={id:y.id,stamp:y.stamp},a.context.bindFramebuffer.set(y.fbo.framebuffer),a.context.clear({color:c.Color.transparent});for(let v=0;v<m.length;v++){const S=a.style._layers[m[v]],E=S.source?this._coordsDescendingInv[S.source][_.tileID.key]:[_.tileID];a.context.viewport.set([0,0,y.fbo.width,y.fbo.height]),a._renderTileClippingMasks(S,E),a.renderLayer(a,a.style.sourceCaches[S.source],S,E),S.source&&(_.rttCoords[S.source]=this._coordsDescendingInvStr[S.source][_.tileID.key])}}return js(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects(),Ti[n]}return!1}}const Xe=St,Ye={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},us=o=>{o.touchstart=o.dragStart,o.touchmoveWindow=o.dragMove,o.touchend=o.dragEnd},Wa={showCompass:!0,showZoom:!0,visualizePitch:!1};class Ha{constructor(t,n,a=!1){this._clickTolerance=10;const h=t.dragRotate._mouseRotate.getClickTolerance(),p=t.dragRotate._mousePitch.getClickTolerance();this.element=n,this.mouseRotate=Fa({clickTolerance:h,enable:!0}),this.touchRotate=(({enable:m,clickTolerance:_,bearingDegreesPerPixelMoved:y=.8})=>{const v=new al;return new $i({clickTolerance:_,move:(S,E)=>({bearingDelta:(E.x-S.x)*y}),moveStateManager:v,enable:m,assignEvents:us})})({clickTolerance:h,enable:!0}),this.map=t,a&&(this.mousePitch=In({clickTolerance:p,enable:!0}),this.touchPitch=(({enable:m,clickTolerance:_,pitchDegreesPerPixelMoved:y=-.5})=>{const v=new al;return new $i({clickTolerance:_,move:(S,E)=>({pitchDelta:(E.y-S.y)*y}),moveStateManager:v,enable:m,assignEvents:us})})({clickTolerance:p,enable:!0})),c.bindAll(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),K.addEventListener(n,"mousedown",this.mousedown),K.addEventListener(n,"touchstart",this.touchstart,{passive:!1}),K.addEventListener(n,"touchcancel",this.reset)}startMouse(t,n){this.mouseRotate.dragStart(t,n),this.mousePitch&&this.mousePitch.dragStart(t,n),K.disableDrag()}startTouch(t,n){this.touchRotate.dragStart(t,n),this.touchPitch&&this.touchPitch.dragStart(t,n),K.disableDrag()}moveMouse(t,n){const a=this.map,{bearingDelta:h}=this.mouseRotate.dragMove(t,n)||{};if(h&&a.setBearing(a.getBearing()+h),this.mousePitch){const{pitchDelta:p}=this.mousePitch.dragMove(t,n)||{};p&&a.setPitch(a.getPitch()+p)}}moveTouch(t,n){const a=this.map,{bearingDelta:h}=this.touchRotate.dragMove(t,n)||{};if(h&&a.setBearing(a.getBearing()+h),this.touchPitch){const{pitchDelta:p}=this.touchPitch.dragMove(t,n)||{};p&&a.setPitch(a.getPitch()+p)}}off(){const t=this.element;K.removeEventListener(t,"mousedown",this.mousedown),K.removeEventListener(t,"touchstart",this.touchstart,{passive:!1}),K.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),K.removeEventListener(window,"touchend",this.touchend),K.removeEventListener(t,"touchcancel",this.reset),this.offTemp()}offTemp(){K.enableDrag(),K.removeEventListener(window,"mousemove",this.mousemove),K.removeEventListener(window,"mouseup",this.mouseup),K.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),K.removeEventListener(window,"touchend",this.touchend)}mousedown(t){this.startMouse(c.extend({},t,{ctrlKey:!0,preventDefault:()=>t.preventDefault()}),K.mousePos(this.element,t)),K.addEventListener(window,"mousemove",this.mousemove),K.addEventListener(window,"mouseup",this.mouseup)}mousemove(t){this.moveMouse(t,K.mousePos(this.element,t))}mouseup(t){this.mouseRotate.dragEnd(t),this.mousePitch&&this.mousePitch.dragEnd(t),this.offTemp()}touchstart(t){t.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=K.touchPos(this.element,t.targetTouches)[0],this.startTouch(t,this._startPos),K.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),K.addEventListener(window,"touchend",this.touchend))}touchmove(t){t.targetTouches.length!==1?this.reset():(this._lastPos=K.touchPos(this.element,t.targetTouches)[0],this.moveTouch(t,this._lastPos))}touchend(t){t.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),delete this._startPos,delete this._lastPos,this.offTemp()}reset(){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),this.touchRotate.reset(),this.touchPitch&&this.touchPitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()}}function Si(o,t,n){if(o=new c.LngLat(o.lng,o.lat),t){const a=new c.LngLat(o.lng-360,o.lat),h=new c.LngLat(o.lng+360,o.lat),p=n.locationPoint(o).distSqr(t);n.locationPoint(a).distSqr(t)<p?o=a:n.locationPoint(h).distSqr(t)<p&&(o=h)}for(;Math.abs(o.lng-n.center.lng)>180;){const a=n.locationPoint(o);if(a.x>=0&&a.y>=0&&a.x<=n.width&&a.y<=n.height)break;o.lng>n.center.lng?o.lng-=360:o.lng+=360}return o}const Cn={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 cr(o,t,n){const a=o.classList;for(const h in Cn)a.remove(`maplibregl-${n}-anchor-${h}`);a.add(`maplibregl-${n}-anchor-${t}`)}class Ka extends c.Evented{constructor(t,n){if(super(),(t instanceof HTMLElement||n)&&(t=c.extend({element:t},n)),c.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=c.pointGeometry.convert(t&&t.offset||[0,0]);else{this._defaultMarker=!0,this._element=K.create("div"),this._element.setAttribute("aria-label","Map marker");const a=K.createNS("http://www.w3.org/2000/svg","svg"),h=41,p=27;a.setAttributeNS(null,"display","block"),a.setAttributeNS(null,"height",`${h}px`),a.setAttributeNS(null,"width",`${p}px`),a.setAttributeNS(null,"viewBox",`0 0 ${p} ${h}`);const m=K.createNS("http://www.w3.org/2000/svg","g");m.setAttributeNS(null,"stroke","none"),m.setAttributeNS(null,"stroke-width","1"),m.setAttributeNS(null,"fill","none"),m.setAttributeNS(null,"fill-rule","evenodd");const _=K.createNS("http://www.w3.org/2000/svg","g");_.setAttributeNS(null,"fill-rule","nonzero");const y=K.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 q of v){const U=K.createNS("http://www.w3.org/2000/svg","ellipse");U.setAttributeNS(null,"opacity","0.04"),U.setAttributeNS(null,"cx","10.5"),U.setAttributeNS(null,"cy","5.80029008"),U.setAttributeNS(null,"rx",q.rx),U.setAttributeNS(null,"ry",q.ry),y.appendChild(U)}const S=K.createNS("http://www.w3.org/2000/svg","g");S.setAttributeNS(null,"fill",this._color);const E=K.createNS("http://www.w3.org/2000/svg","path");E.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(E);const M=K.createNS("http://www.w3.org/2000/svg","g");M.setAttributeNS(null,"opacity","0.25"),M.setAttributeNS(null,"fill","#000000");const D=K.createNS("http://www.w3.org/2000/svg","path");D.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"),M.appendChild(D);const B=K.createNS("http://www.w3.org/2000/svg","g");B.setAttributeNS(null,"transform","translate(6.0, 7.0)"),B.setAttributeNS(null,"fill","#FFFFFF");const L=K.createNS("http://www.w3.org/2000/svg","g");L.setAttributeNS(null,"transform","translate(8.0, 8.0)");const N=K.createNS("http://www.w3.org/2000/svg","circle");N.setAttributeNS(null,"fill","#000000"),N.setAttributeNS(null,"opacity","0.25"),N.setAttributeNS(null,"cx","5.5"),N.setAttributeNS(null,"cy","5.5"),N.setAttributeNS(null,"r","5.4999962");const X=K.createNS("http://www.w3.org/2000/svg","circle");X.setAttributeNS(null,"fill","#FFFFFF"),X.setAttributeNS(null,"cx","5.5"),X.setAttributeNS(null,"cy","5.5"),X.setAttributeNS(null,"r","5.4999962"),L.appendChild(N),L.appendChild(X),_.appendChild(y),_.appendChild(S),_.appendChild(M),_.appendChild(B),_.appendChild(L),a.appendChild(_),a.setAttributeNS(null,"height",h*this._scale+"px"),a.setAttributeNS(null,"width",p*this._scale+"px"),this._element.appendChild(a),this._offset=c.pointGeometry.convert(t&&t.offset||[0,-14])}this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",a=>{a.preventDefault()}),this._element.addEventListener("mousedown",a=>{a.preventDefault()}),cr(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),K.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=c.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 h=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":[h,-1*(38.1-13.5+h)],"bottom-right":[-h,-1*(38.1-13.5+h)],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,a=t.charCode||t.keyCode;n!=="Space"&&n!=="Enter"&&a!==32&&a!==13||this.togglePopup()}_onMapClick(t){const n=t.originalEvent.target,a=this._element;this._popup&&(n===a||a.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=Si(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 a="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?a="rotateX(0deg)":this._pitchAlignment==="map"&&(a=`rotateX(${this._map.getPitch()}deg)`),t&&t.type!=="moveend"||(this._pos=this._pos.round()),K.setTransform(this._element,`${Cn[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${a} ${n}`),this._map.terrain&&!this._opacityTimeout&&(this._opacityTimeout=setTimeout(()=>{const h=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=h.distanceTo(this._lngLat)>20*p?"0.2":"1.0",this._opacityTimeout=null},100))}getOffset(){return this._offset}setOffset(t){return this._offset=c.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 c.Event("dragstart"))),this.fire(new c.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 c.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 Ks={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let zt,Wt=0,Mn=!1;const ps={maxWidth:100,unit:"metric"};function ds(o,t,n){const a=n&&n.maxWidth||100,h=o._container.clientHeight/2,p=o.unproject([0,h]),m=o.unproject([a,h]),_=p.distanceTo(m);if(n&&n.unit==="imperial"){const y=3.2808*_;y>5280?Yr(t,a,y/5280,o._getUIString("ScaleControl.Miles")):Yr(t,a,y,o._getUIString("ScaleControl.Feet"))}else n&&n.unit==="nautical"?Yr(t,a,_/1852,o._getUIString("ScaleControl.NauticalMiles")):_>=1e3?Yr(t,a,_/1e3,o._getUIString("ScaleControl.Kilometers")):Yr(t,a,_,o._getUIString("ScaleControl.Meters"))}function Yr(o,t,n,a){const h=function(p){const m=Math.pow(10,`${Math.floor(p)}`.length-1);let _=p/m;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}(_),m*_}(n);o.style.width=t*(h/n)+"px",o.innerHTML=`${h} ${a}`}const Ja={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},Ya=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Pn(o){if(o){if(typeof o=="number"){const t=Math.round(Math.sqrt(.5*Math.pow(o,2)));return{center:new c.pointGeometry(0,0),top:new c.pointGeometry(0,o),"top-left":new c.pointGeometry(t,t),"top-right":new c.pointGeometry(-t,t),bottom:new c.pointGeometry(0,-o),"bottom-left":new c.pointGeometry(t,-t),"bottom-right":new c.pointGeometry(-t,-t),left:new c.pointGeometry(o,0),right:new c.pointGeometry(-o,0)}}if(o instanceof c.pointGeometry||Array.isArray(o)){const t=c.pointGeometry.convert(o);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:c.pointGeometry.convert(o.center||[0,0]),top:c.pointGeometry.convert(o.top||[0,0]),"top-left":c.pointGeometry.convert(o["top-left"]||[0,0]),"top-right":c.pointGeometry.convert(o["top-right"]||[0,0]),bottom:c.pointGeometry.convert(o.bottom||[0,0]),"bottom-left":c.pointGeometry.convert(o["bottom-left"]||[0,0]),"bottom-right":c.pointGeometry.convert(o["bottom-right"]||[0,0]),left:c.pointGeometry.convert(o.left||[0,0]),right:c.pointGeometry.convert(o.right||[0,0])}}return Pn(new c.pointGeometry(0,0))}const Qa=St,ms={supported:ve,setRTLTextPlugin:c.setRTLTextPlugin,getRTLTextPluginStatus:c.getRTLTextPluginStatus,Map:class extends cl{constructor(o){var t;if(c.PerformanceUtils.mark(c.PerformanceMarkers.create),(o=c.extend({},Ye,o)).minZoom!=null&&o.maxZoom!=null&&o.minZoom>o.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(o.minPitch!=null&&o.maxPitch!=null&&o.minPitch>o.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(o.minPitch!=null&&o.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(o.maxPitch!=null&&o.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new qs(o.minZoom,o.maxZoom,o.minPitch,o.maxPitch,o.renderWorldCopies),{bearingSnap:o.bearingSnap}),this._interactive=o.interactive,this._cooperativeGestures=o.cooperativeGestures,this._maxTileCacheSize=o.maxTileCacheSize,this._failIfMajorPerformanceCaveat=o.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=o.preserveDrawingBuffer,this._antialias=o.antialias,this._trackResize=o.trackResize,this._bearingSnap=o.bearingSnap,this._refreshExpiredTiles=o.refreshExpiredTiles,this._fadeDuration=o.fadeDuration,this._crossSourceCollisions=o.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=o.collectResourceTiming,this._renderTaskQueue=new Ws,this._controls=[],this._mapId=c.uniqueId(),this._locale=c.extend({},Xa,o.locale),this._clickTolerance=o.clickTolerance,this._pixelRatio=(t=o.pixelRatio)!==null&&t!==void 0?t:devicePixelRatio,this._requestManager=new Je(o.transformRequest),typeof o.container=="string"){if(this._container=document.getElementById(o.container),!this._container)throw new Error(`Container '${o.container}' not found.`)}else{if(!(o.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=o.container}o.maxBounds&&this.setMaxBounds(o.maxBounds),c.bindAll(["_onWindowOnline","_onWindowResize","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._setupPainter(),this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this.on("terrain",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}),typeof window<"u"&&(addEventListener("online",this._onWindowOnline,!1),addEventListener("resize",this._onWindowResize,!1),addEventListener("orientationchange",this._onWindowResize,!1)),this.handlers=new qa(this,o),this._cooperativeGestures&&this._setupCooperativeGestures(),this._hash=o.hash&&new Zs(typeof o.hash=="string"&&o.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:o.center,zoom:o.zoom,bearing:o.bearing,pitch:o.pitch}),o.bounds&&(this.resize(),this.fitBounds(o.bounds,c.extend({},o.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=o.localIdeographFontFamily,o.style&&this.setStyle(o.style,{localIdeographFontFamily:o.localIdeographFontFamily}),o.attributionControl&&this.addControl(new ji({customAttribution:o.customAttribution})),o.maplibreLogo&&this.addControl(new Vt,o.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 c.Event(`${n.dataType}data`,n))}),this.on("dataloading",n=>{this.fire(new c.Event(`${n.dataType}dataloading`,n))}),this.on("dataabort",n=>{this.fire(new c.Event("sourcedataabort",n))})}_getMapId(){return this._mapId}addControl(o,t){if(t===void 0&&(t=o.getDefaultPosition?o.getDefaultPosition():"top-right"),!o||!o.onAdd)return this.fire(new c.ErrorEvent(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const n=o.onAdd(this);this._controls.push(o);const a=this._controlPositions[t];return t.indexOf("bottom")!==-1?a.insertBefore(n,a.firstChild):a.appendChild(n),this}removeControl(o){if(!o||!o.onRemove)return this.fire(new c.ErrorEvent(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const t=this._controls.indexOf(o);return t>-1&&this._controls.splice(t,1),o.onRemove(this),this}hasControl(o){return this._controls.indexOf(o)>-1}calculateCameraOptionsFromTo(o,t,n,a){return a==null&&this.terrain&&(a=this.transform.getElevation(n,this.terrain)),super.calculateCameraOptionsFromTo(o,t,n,a)}resize(o){const t=this._containerDimensions(),n=t[0],a=t[1];this._resizeCanvas(n,a,this.getPixelRatio()),this.transform.resize(n,a),this.painter.resize(n,a,this.getPixelRatio());const h=!this._moving;return h&&(this.stop(),this.fire(new c.Event("movestart",o)).fire(new c.Event("move",o))),this.fire(new c.Event("resize",o)),h&&this.fire(new c.Event("moveend",o)),this}getPixelRatio(){return this._pixelRatio}setPixelRatio(o){const[t,n]=this._containerDimensions();this._pixelRatio=o,this._resizeCanvas(t,n,o),this.painter.resize(t,n,o)}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(o){return this.transform.setMaxBounds(c.LngLatBounds.convert(o)),this._update()}setMinZoom(o){if((o=o??-2)>=-2&&o<=this.transform.maxZoom)return this.transform.minZoom=o,this._update(),this.getZoom()<o&&this.setZoom(o),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(o){if((o=o??22)>=this.transform.minZoom)return this.transform.maxZoom=o,this._update(),this.getZoom()>o&&this.setZoom(o),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(o){if((o=o??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(o>=0&&o<=this.transform.maxPitch)return this.transform.minPitch=o,this._update(),this.getPitch()<o&&this.setPitch(o),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(o){if((o=o??60)>85)throw new Error("maxPitch must be less than or equal to 85");if(o>=this.transform.minPitch)return this.transform.maxPitch=o,this._update(),this.getPitch()>o&&this.setPitch(o),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(o){return this.transform.renderWorldCopies=o,this._update()}project(o){return this.transform.locationPoint(c.LngLat.convert(o),this.style&&this.terrain)}unproject(o){return this.transform.pointLocation(c.pointGeometry.convert(o),this.terrain)}isMoving(){return this._moving||this.handlers.isMoving()}isZooming(){return this._zooming||this.handlers.isZooming()}isRotating(){return this._rotating||this.handlers.isRotating()}_createDelegatedListener(o,t,n){if(o==="mouseenter"||o==="mouseover"){let a=!1;return{layer:t,listener:n,delegates:{mousemove:p=>{const m=this.getLayer(t)?this.queryRenderedFeatures(p.point,{layers:[t]}):[];m.length?a||(a=!0,n.call(this,new Ni(o,this,p.originalEvent,{features:m}))):a=!1},mouseout:()=>{a=!1}}}}if(o==="mouseleave"||o==="mouseout"){let a=!1;return{layer:t,listener:n,delegates:{mousemove:m=>{(this.getLayer(t)?this.queryRenderedFeatures(m.point,{layers:[t]}):[]).length?a=!0:a&&(a=!1,n.call(this,new Ni(o,this,m.originalEvent)))},mouseout:m=>{a&&(a=!1,n.call(this,new Ni(o,this,m.originalEvent)))}}}}{const a=h=>{const p=this.getLayer(t)?this.queryRenderedFeatures(h.point,{layers:[t]}):[];p.length&&(h.features=p,n.call(this,h),delete h.features)};return{layer:t,listener:n,delegates:{[o]:a}}}}on(o,t,n){if(n===void 0)return super.on(o,t);const a=this._createDelegatedListener(o,t,n);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[o]=this._delegatedListeners[o]||[],this._delegatedListeners[o].push(a);for(const h in a.delegates)this.on(h,a.delegates[h]);return this}once(o,t,n){if(n===void 0)return super.once(o,t);const a=this._createDelegatedListener(o,t,n);for(const h in a.delegates)this.once(h,a.delegates[h]);return this}off(o,t,n){return n===void 0?super.off(o,t):(this._delegatedListeners&&this._delegatedListeners[o]&&(a=>{const h=this._delegatedListeners[o];for(let p=0;p<h.length;p++){const m=h[p];if(m.layer===t&&m.listener===n){for(const _ in m.delegates)this.off(_,m.delegates[_]);return h.splice(p,1),this}}})(),this)}queryRenderedFeatures(o,t){if(!this.style)return[];let n;const a=o instanceof c.pointGeometry||Array.isArray(o),h=a?o:[[0,0],[this.transform.width,this.transform.height]];if(t=t||(a?{}:o)||{},h instanceof c.pointGeometry||typeof h[0]=="number")n=[c.pointGeometry.convert(h)];else{const p=c.pointGeometry.convert(h[0]),m=c.pointGeometry.convert(h[1]);n=[p,new c.pointGeometry(m.x,p.y),m,new c.pointGeometry(p.x,m.y),p]}return this.style.queryRenderedFeatures(n,t,this.transform)}querySourceFeatures(o,t){return this.style.querySourceFeatures(o,t)}setStyle(o,t){return(t=c.extend({},{localIdeographFontFamily:this._localIdeographFontFamily},t)).diff!==!1&&t.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&o?(this._diffStyle(o,t),this):(this._localIdeographFontFamily=t.localIdeographFontFamily,this._updateStyle(o,t))}setTransformRequest(o){return this._requestManager.setTransformRequest(o),this}_getUIString(o){const t=this._locale[o];if(t==null)throw new Error(`Missing UI string '${o}'`);return t}_updateStyle(o,t){if(t.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",()=>this._updateStyle(o,t));const n=this.style&&t.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove()),o?(this.style=new ui(this,t||{}),this.style.setEventedParent(this,{style:this.style}),typeof o=="string"?this.style.loadURL(o,t,n):this.style.loadJSON(o,t,n),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new ui(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(o,t){if(typeof o=="string"){const n=this._requestManager.transformRequest(o,c.ResourceType.Style);c.getJSON(n,(a,h)=>{a?this.fire(new c.ErrorEvent(a)):h&&this._updateDiff(h,t)})}else typeof o=="object"&&this._updateDiff(o,t)}_updateDiff(o,t){try{this.style.setState(o,t)&&this._update(!0)}catch(n){c.warnOnce(`Unable to perform style diff: ${n.message||n.error||n}. Rebuilding the style from scratch.`),this._updateStyle(o,t)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():c.warnOnce("There is no style added to the map.")}addSource(o,t){return this._lazyInitEmptyStyle(),this.style.addSource(o,t),this._update(!0)}isSourceLoaded(o){const t=this.style&&this.style.sourceCaches[o];if(t!==void 0)return t.loaded();this.fire(new c.ErrorEvent(new Error(`There is no source with ID '${o}'`)))}setTerrain(o){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),o){const t=this.style.sourceCaches[o.source];if(!t)throw new Error(`cannot load terrain, because there exists no source with ID: ${o.source}`);this.terrain=new pl(this.painter,t,o),this.painter.renderToTexture=new Hs(this.painter,this.terrain),this.transform.updateElevation(this.terrain),this._terrainDataCallback=n=>{n.dataType==="style"?this.terrain.sourceCache.freeRtt():n.dataType==="source"&&n.tile&&(n.sourceId===o.source&&this.transform.updateElevation(this.terrain),this.terrain.sourceCache.freeRtt(n.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform.updateElevation(this.terrain);return this.fire(new c.Event("terrain",{terrain:o})),this}getTerrain(){return this.terrain&&this.terrain.options}areTilesLoaded(){const o=this.style&&this.style.sourceCaches;for(const t in o){const n=o[t]._tiles;for(const a in n){const h=n[a];if(h.state!=="loaded"&&h.state!=="errored")return!1}}return!0}addSourceType(o,t,n){return this._lazyInitEmptyStyle(),this.style.addSourceType(o,t,n)}removeSource(o){return this.style.removeSource(o),this._update(!0)}getSource(o){return this.style.getSource(o)}addImage(o,t,{pixelRatio:n=1,sdf:a=!1,stretchX:h,stretchY:p,content:m}={}){if(this._lazyInitEmptyStyle(),t instanceof HTMLImageElement||c.isImageBitmap(t)){const{width:_,height:y,data:v}=c.exported.getImageData(t);this.style.addImage(o,{data:new c.RGBAImage({width:_,height:y},v),pixelRatio:n,stretchX:h,stretchY:p,content:m,sdf:a,version:0})}else{if(t.width===void 0||t.height===void 0)return this.fire(new c.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(o,{data:new c.RGBAImage({width:_,height:y},new Uint8Array(v)),pixelRatio:n,stretchX:h,stretchY:p,content:m,sdf:a,version:0,userImage:S}),S.onAdd&&S.onAdd(this,o)}}}updateImage(o,t){const n=this.style.getImage(o);if(!n)return this.fire(new c.ErrorEvent(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const a=t instanceof HTMLImageElement||c.isImageBitmap(t)?c.exported.getImageData(t):t,{width:h,height:p,data:m}=a;if(h===void 0||p===void 0)return this.fire(new c.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(h!==n.data.width||p!==n.data.height)return this.fire(new c.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||c.isImageBitmap(t));n.data.replace(m,_),this.style.updateImage(o,n)}hasImage(o){return o?!!this.style.getImage(o):(this.fire(new c.ErrorEvent(new Error("Missing required image id"))),!1)}removeImage(o){this.style.removeImage(o)}loadImage(o,t){c.getImage(this._requestManager.transformRequest(o,c.ResourceType.Image),t)}listImages(){return this.style.listImages()}addLayer(o,t){return this._lazyInitEmptyStyle(),this.style.addLayer(o,t),this._update(!0)}moveLayer(o,t){return this.style.moveLayer(o,t),this._update(!0)}removeLayer(o){return this.style.removeLayer(o),this._update(!0)}getLayer(o){return this.style.getLayer(o)}setLayerZoomRange(o,t,n){return this.style.setLayerZoomRange(o,t,n),this._update(!0)}setFilter(o,t,n={}){return this.style.setFilter(o,t,n),this._update(!0)}getFilter(o){return this.style.getFilter(o)}setPaintProperty(o,t,n,a={}){return this.style.setPaintProperty(o,t,n,a),this._update(!0)}getPaintProperty(o,t){return this.style.getPaintProperty(o,t)}setLayoutProperty(o,t,n,a={}){return this.style.setLayoutProperty(o,t,n,a),this._update(!0)}getLayoutProperty(o,t){return this.style.getLayoutProperty(o,t)}setGlyphs(o,t={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(o,t),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(o,t,n={}){return this._lazyInitEmptyStyle(),this.style.addSprite(o,t,n,a=>{a||this._update(!0)}),this}removeSprite(o){return this._lazyInitEmptyStyle(),this.style.removeSprite(o),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(o,t={}){return this._lazyInitEmptyStyle(),this.style.setSprite(o,t,n=>{n||this._update(!0)}),this}setLight(o,t={}){return this._lazyInitEmptyStyle(),this.style.setLight(o,t),this._update(!0)}getLight(){return this.style.getLight()}setFeatureState(o,t){return this.style.setFeatureState(o,t),this._update()}removeFeatureState(o,t){return this.style.removeFeatureState(o,t),this._update()}getFeatureState(o){return this.style.getFeatureState(o)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let o=0,t=0;return this._container&&(o=this._container.clientWidth||400,t=this._container.clientHeight||300),[o,t]}_setupContainer(){const o=this._container;o.classList.add("maplibregl-map");const t=this._canvasContainer=K.create("div","maplibregl-canvas-container",o);this._interactive&&t.classList.add("maplibregl-interactive"),this._canvas=K.create("canvas","maplibregl-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 a=this._controlContainer=K.create("div","maplibregl-control-container",o),h=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(p=>{h[p]=K.create("div",`maplibregl-ctrl-${p} `,a)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_setupCooperativeGestures(){const o=this._container;this._metaPress=!1,this._cooperativeGesturesScreen=K.create("div","maplibregl-cooperative-gesture-screen",o);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",a=>{a.key===t&&(this._metaPress=!0)}),document.addEventListener("keyup",a=>{a.key===t&&(this._metaPress=!1)}),this._canvasContainer.addEventListener("wheel",a=>{this._onCooperativeGesture(a,this._metaPress,1)},!1),this._canvasContainer.classList.remove("maplibregl-touch-drag-pan")}_resizeCanvas(o,t,n){this._canvas.width=n*o,this._canvas.height=n*t,this._canvas.style.width=`${o}px`,this._canvas.style.height=`${t}px`}_setupPainter(){const o=c.extend({},ve.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1});let t=null;this._canvas.addEventListener("webglcontextcreationerror",a=>{t={requestedAttributes:o},a&&(t.statusMessage=a.statusMessage,t.type=a.type)},{once:!0});const n=this._canvas.getContext("webgl",o)||this._canvas.getContext("experimental-webgl",o);if(!n){const a="Failed to initialize WebGL";throw t?(t.message=a,new Error(JSON.stringify(t))):new Error(a)}this.painter=new Ko(n,this.transform),c.exported$1.testSupport(n)}_contextLost(o){o.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new c.Event("webglcontextlost",{originalEvent:o}))}_contextRestored(o){this._setupPainter(),this.resize(),this._update(),this.fire(new c.Event("webglcontextrestored",{originalEvent:o}))}_onMapScroll(o){if(o.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}_onCooperativeGesture(o,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(o){return this.style?(this._styleDirty=this._styleDirty||o,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(o){return this._update(),this._renderTaskQueue.add(o)}_cancelRenderFrame(o){this._renderTaskQueue.remove(o)}_render(o){let t,n=0;const a=this.painter.context.extTimerQuery;if(this.listens("gpu-timing-frame")&&(t=a.createQueryEXT(),a.beginQueryEXT(a.TIME_ELAPSED_EXT,t),n=c.exported.now()),this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(o),this._removed)return;let h=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const m=this.transform.zoom,_=c.exported.now();this.style.zoomHistory.update(m,_);const y=new c.EvaluationParameters(m,{now:_,fadeDuration:this._fadeDuration,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),v=y.crossFadingFactor();v===1&&v===this._crossFadingFactor||(h=!0,this._crossFadingFactor=v),this.style.update(y)}if(this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain&&this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.updateElevation(this.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 c.Event("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,c.PerformanceUtils.mark(c.PerformanceMarkers.load),this.fire(new c.Event("load"))),this.style&&(this.style.hasTransitions()||h)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),this.listens("gpu-timing-frame")){const m=c.exported.now()-n;a.endQueryEXT(a.TIME_ELAPSED_EXT,t),setTimeout(()=>{const _=a.getQueryObjectEXT(t,a.QUERY_RESULT_EXT)/1e6;a.deleteQueryEXT(t),this.fire(new c.Event("gpu-timing-frame",{cpuTime:m,gpuTime:_}))},50)}if(this.listens("gpu-timing-layer")){const m=this.painter.collectGpuTimers();setTimeout(()=>{const _=this.painter.queryGpuTimers(m);this.fire(new c.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 c.Event("idle")),!this._loaded||this._fullyLoaded||p||(this._fullyLoaded=!0,c.PerformanceUtils.mark(c.PerformanceMarkers.fullLoad)),this}redraw(){return this.style&&(this._frame&&(this._frame.cancel(),this._frame=null),this._render(0)),this}remove(){this._hash&&this._hash.remove();for(const t of this._controls)t.onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&(removeEventListener("resize",this._onWindowResize,!1),removeEventListener("orientationchange",this._onWindowResize,!1),removeEventListener("online",this._onWindowOnline,!1));const o=this.painter.context.gl.getExtension("WEBGL_lose_context");o&&o.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),K.remove(this._canvasContainer),K.remove(this._controlContainer),this._cooperativeGestures&&K.remove(this._cooperativeGesturesScreen),this._container.classList.remove("maplibregl-map"),c.PerformanceUtils.clearMetrics(),this._removed=!0,this.fire(new c.Event("remove"))}triggerRepaint(){this.style&&!this._frame&&(this._frame=c.exported.frame(o=>{c.PerformanceUtils.frame(o),this._frame=null,this._render(o)}))}_onWindowOnline(){this._update()}_onWindowResize(o){this._trackResize&&this.resize({originalEvent:o})._update()}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(o){this._showTileBoundaries!==o&&(this._showTileBoundaries=o,this._update())}get showPadding(){return!!this._showPadding}set showPadding(o){this._showPadding!==o&&(this._showPadding=o,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(o){this._showCollisionBoxes!==o&&(this._showCollisionBoxes=o,o?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(o){this._showOverdrawInspector!==o&&(this._showOverdrawInspector=o,this._update())}get repaint(){return!!this._repaint}set repaint(o){this._repaint!==o&&(this._repaint=o,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(o){this._vertices=o,this._update()}_setCacheLimits(o,t){c.setCacheLimits(o,t)}get version(){return Xe}getCameraTargetElevation(){return this.transform.elevation}},NavigationControl:class{constructor(o){this.options=c.extend({},Wa,o),this._container=K.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",t=>t.preventDefault()),this.options.showZoom&&(c.bindAll(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",t=>this._map.zoomIn({},{originalEvent:t})),K.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",t=>this._map.zoomOut({},{originalEvent:t})),K.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(c.bindAll(["_rotateCompassArrow"],this),this._compass=this._createButton("maplibregl-ctrl-compass",t=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:t}):this._map.resetNorth({},{originalEvent:t})}),this._compassIcon=K.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){const o=this._map.getZoom(),t=o===this._map.getMaxZoom(),n=o===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 o=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=o}onAdd(o){return this._map=o,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 Ha(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){K.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(o,t){const n=K.create("button",o,this._container);return n.type="button",n.addEventListener("click",t),n}_setButtonTitle(o,t){const n=this._map._getUIString(`NavigationControl.${t}`);o.title=n,o.setAttribute("aria-label",n)}},GeolocateControl:class extends c.Evented{constructor(o){super(),this.options=c.extend({},Ks,o),c.bindAll(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker"],this)}onAdd(o){var t;return this._map=o,this._container=K.create("div","maplibregl-ctrl maplibregl-ctrl-group"),t=this._setupUI,zt!==void 0?t(zt):window.navigator.permissions!==void 0?window.navigator.permissions.query({name:"geolocation"}).then(n=>{zt=n.state!=="denied",t(zt)}):(zt=!!window.navigator.geolocation,t(zt)),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(),K.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,Wt=0,Mn=!1}_isOutOfMapMaxBounds(o){const t=this._map.getMaxBounds(),n=o.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"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_onSuccess(o){if(this._map){if(this._isOutOfMapMaxBounds(o))return this._setErrorState(),this.fire(new c.Event("outofmaxbounds",o)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=o,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(o),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(o),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new c.Event("geolocate",o)),this._finish()}}_updateCamera(o){const t=new c.LngLat(o.coords.longitude,o.coords.latitude),n=o.coords.accuracy,a=this._map.getBearing(),h=c.extend({bearing:a},this.options.fitBoundsOptions);this._map.fitBounds(t.toBounds(n),h,{geolocateSource:!0})}_updateMarker(o){if(o){const t=new c.LngLat(o.coords.longitude,o.coords.latitude);this._accuracyCircleMarker.setLngLat(t).addTo(this._map),this._userLocationDotMarker.setLngLat(t).addTo(this._map),this._accuracy=o.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){const o=this._map._container.clientHeight/2,t=this._map.unproject([0,o]),n=this._map.unproject([1,o]),a=t.distanceTo(n),h=Math.ceil(2*this._accuracy/a);this._circleElement.style.width=`${h}px`,this._circleElement.style.height=`${h}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}_onError(o){if(this._map){if(this.options.trackUserLocation)if(o.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._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(o.code===3&&Mn)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new c.Event("error",o)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(o){if(this._container.addEventListener("contextmenu",t=>t.preventDefault()),this._geolocateButton=K.create("button","maplibregl-ctrl-geolocate",this._container),K.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",o===!1){c.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=K.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new Ka(this._dotElement),this._circleElement=K.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Ka({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"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new c.Event("trackuserlocationend")))})}trigger(){if(!this._setup)return c.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 c.Event("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":Wt--,Mn=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this.fire(new c.Event("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new c.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"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let o;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),Wt++,Wt>1?(o={maximumAge:6e5,timeout:0},Mn=!0):(o=this.options.positionOptions,Mn=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,o)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},AttributionControl:ji,LogoControl:Vt,ScaleControl:class{constructor(o){this.options=c.extend({},ps,o),c.bindAll(["_onMove","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_onMove(){ds(this._map,this._container,this.options)}onAdd(o){return this._map=o,this._container=K.create("div","maplibregl-ctrl maplibregl-ctrl-scale",o.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){K.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}setUnit(o){this.options.unit=o,ds(this._map,this._container,this.options)}},FullscreenControl:class{constructor(o={}){this._onFullscreenChange=()=>{(window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement)===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,o&&o.container&&(o.container instanceof HTMLElement?this._container=o.container:c.warnOnce("Full screen control 'container' must be a DOM element.")),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(o){return this._map=o,this._container||(this._container=this._map.getContainer()),this._controlContainer=K.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){K.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const o=this._fullscreenButton=K.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);K.create("span","maplibregl-ctrl-icon",o).setAttribute("aria-hidden","true"),o.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const o=this._getTitle();this._fullscreenButton.setAttribute("aria-label",o),this._fullscreenButton.title=o}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle()}_exitFullscreen(){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._togglePseudoFullScreen()}_requestFullscreen(){this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}},TerrainControl:class{constructor(o){this.options=o,c.bindAll(["_toggleTerrain","_updateTerrainIcon"],this)}onAdd(o){return this._map=o,this._container=K.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=K.create("button","maplibregl-ctrl-terrain",this._container),K.create("span","maplibregl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){K.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"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.disableTerrain")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.enableTerrain"))}},Popup:class extends c.Evented{constructor(o){super(),this.options=c.extend(Object.create(Ja),o),c.bindAll(["_update","_onClose","remove","_onMouseMove","_onMouseUp","_onDrag"],this)}addTo(o){return this._map&&this.remove(),this._map=o,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"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new c.Event("open")),this}isOpen(){return!!this._map}remove(){return this._content&&K.remove(this._content),this._container&&(K.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 c.Event("close")),this}getLngLat(){return this._lngLat}setLngLat(o){return this._lngLat=c.LngLat.convert(o),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"),this._map._canvasContainer.classList.remove("maplibregl-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"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(o){return this.setDOMContent(document.createTextNode(o))}setHTML(o){const t=document.createDocumentFragment(),n=document.createElement("body");let a;for(n.innerHTML=o;a=n.firstChild,a;)t.appendChild(a);return this.setDOMContent(t)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(o){return this.options.maxWidth=o,this._update(),this}setDOMContent(o){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=K.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(o),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(o){this._container&&this._container.classList.add(o)}removeClassName(o){this._container&&this._container.classList.remove(o)}setOffset(o){return this.options.offset=o,this._update(),this}toggleClassName(o){if(this._container)return this._container.classList.toggle(o)}_createCloseButton(){this.options.closeButton&&(this._closeButton=K.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_onMouseUp(o){this._update(o.point)}_onMouseMove(o){this._update(o.point)}_onDrag(o){this._update(o.point)}_update(o){if(!this._map||!this._lngLat&&!this._trackPointer||!this._content||(this._container||(this._container=K.create("div","maplibregl-popup",this._map.getContainer()),this._tip=K.create("div","maplibregl-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")),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=Si(this._lngLat,this._pos,this._map.transform)),this._trackPointer&&!o))return;const t=this._pos=this._trackPointer&&o?o:this._map.project(this._lngLat);let n=this.options.anchor;const a=Pn(this.options.offset);if(!n){const p=this._container.offsetWidth,m=this._container.offsetHeight;let _;_=t.y+a.bottom.y<m?["top"]:t.y>this._map.transform.height-m?["bottom"]:[],t.x<p/2?_.push("left"):t.x>this._map.transform.width-p/2&&_.push("right"),n=_.length===0?"bottom":_.join("-")}const h=t.add(a[n]).round();K.setTransform(this._container,`${Cn[n]} translate(${h.x}px,${h.y}px)`),cr(this._container,n,"popup")}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const o=this._container.querySelector(Ya);o&&o.focus()}_onClose(){this.remove()}},Marker:Ka,Style:ui,LngLat:c.LngLat,LngLatBounds:c.LngLatBounds,Point:c.pointGeometry,MercatorCoordinate:c.MercatorCoordinate,Evented:c.Evented,AJAXError:c.AJAXError,config:c.config,CanvasSource:Ur,GeoJSONSource:Or,ImageSource:ki,RasterDEMTileSource:sr,RasterTileSource:hn,VectorTileSource:cn,VideoSource:Zr,prewarm:function(){Xr().acquire(Ir)},clearPrewarmedResources:function(){const o=Oi;o&&(o.isPreloaded()&&o.numActive()===1?(o.release(Ir),Oi=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 Qa},get workerCount(){return ar.workerCount},set workerCount(o){ar.workerCount=o},get maxParallelImageRequests(){return c.config.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(o){c.config.MAX_PARALLEL_IMAGE_REQUESTS=o},clearStorage(o){c.clearTileCache(o)},workerUrl:"",addProtocol(o,t){c.config.REGISTERED_PROTOCOLS[o]=t},removeProtocol(o){delete c.config.REGISTERED_PROTOCOLS[o]}};return Za.extend(ms,{isSafari:c.isSafari,getPerformanceMetrics:c.PerformanceUtils.getPerformanceMetrics}),ms});var ne=ie;return ne})})(Qc);var gr=_p(Qc.exports);const eh="3.7.4",yp=eh,xp=typeof atob=="function",vp=typeof btoa=="function",bs=typeof Buffer=="function",th=typeof TextDecoder=="function"?new TextDecoder:void 0,ih=typeof TextEncoder=="function"?new TextEncoder:void 0,bp="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",la=Array.prototype.slice.call(bp),yo=(C=>{let b={};return C.forEach((k,Z)=>b[k]=Z),b})(la),wp=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,vi=String.fromCharCode.bind(String),rh=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):(C,b=k=>k)=>new Uint8Array(Array.prototype.slice.call(C,0).map(b)),nh=C=>C.replace(/=/g,"").replace(/[+\/]/g,b=>b=="+"?"-":"_"),sh=C=>C.replace(/[^A-Za-z0-9\+\/]/g,""),ah=C=>{let b,k,Z,ie,de="";const ne=C.length%3;for(let c=0;c<C.length;){if((k=C.charCodeAt(c++))>255||(Z=C.charCodeAt(c++))>255||(ie=C.charCodeAt(c++))>255)throw new TypeError("invalid character found");b=k<<16|Z<<8|ie,de+=la[b>>18&63]+la[b>>12&63]+la[b>>6&63]+la[b&63]}return ne?de.slice(0,ne-3)+"===".substring(ne):de},Rl=vp?C=>btoa(C):bs?C=>Buffer.from(C,"binary").toString("base64"):ah,Bl=bs?C=>Buffer.from(C).toString("base64"):C=>{let k=[];for(let Z=0,ie=C.length;Z<ie;Z+=4096)k.push(vi.apply(null,C.subarray(Z,Z+4096)));return Rl(k.join(""))},xo=(C,b=!1)=>b?nh(Bl(C)):Bl(C),Tp=C=>{if(C.length<2){var b=C.charCodeAt(0);return b<128?C:b<2048?vi(192|b>>>6)+vi(128|b&63):vi(224|b>>>12&15)+vi(128|b>>>6&63)+vi(128|b&63)}else{var b=65536+(C.charCodeAt(0)-55296)*1024+(C.charCodeAt(1)-56320);return vi(240|b>>>18&7)+vi(128|b>>>12&63)+vi(128|b>>>6&63)+vi(128|b&63)}},Sp=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,oh=C=>C.replace(Sp,Tp),lh=bs?C=>Buffer.from(C,"utf8").toString("base64"):ih?C=>Bl(ih.encode(C)):C=>Rl(oh(C)),ws=(C,b=!1)=>b?nh(lh(C)):lh(C),ch=C=>ws(C,!0),Ep=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,Ip=C=>{switch(C.length){case 4:var b=(7&C.charCodeAt(0))<<18|(63&C.charCodeAt(1))<<12|(63&C.charCodeAt(2))<<6|63&C.charCodeAt(3),k=b-65536;return vi((k>>>10)+55296)+vi((k&1023)+56320);case 3:return vi((15&C.charCodeAt(0))<<12|(63&C.charCodeAt(1))<<6|63&C.charCodeAt(2));default:return vi((31&C.charCodeAt(0))<<6|63&C.charCodeAt(1))}},hh=C=>C.replace(Ep,Ip),uh=C=>{if(C=C.replace(/\s+/g,""),!wp.test(C))throw new TypeError("malformed base64.");C+="==".slice(2-(C.length&3));let b,k="",Z,ie;for(let de=0;de<C.length;)b=yo[C.charAt(de++)]<<18|yo[C.charAt(de++)]<<12|(Z=yo[C.charAt(de++)])<<6|(ie=yo[C.charAt(de++)]),k+=Z===64?vi(b>>16&255):ie===64?vi(b>>16&255,b>>8&255):vi(b>>16&255,b>>8&255,b&255);return k},Fl=xp?C=>atob(sh(C)):bs?C=>Buffer.from(C,"base64").toString("binary"):uh,ph=bs?C=>rh(Buffer.from(C,"base64")):C=>rh(Fl(C),b=>b.charCodeAt(0)),dh=C=>ph(mh(C)),Ap=bs?C=>Buffer.from(C,"base64").toString("utf8"):th?C=>th.decode(ph(C)):C=>hh(Fl(C)),mh=C=>sh(C.replace(/[-_]/g,b=>b=="-"?"+":"/")),Ol=C=>Ap(mh(C)),Cp=C=>{if(typeof C!="string")return!1;const b=C.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(b)||!/[^\s0-9a-zA-Z\-_]/.test(b)},fh=C=>({value:C,enumerable:!1,writable:!0,configurable:!0}),gh=function(){const C=(b,k)=>Object.defineProperty(String.prototype,b,fh(k));C("fromBase64",function(){return Ol(this)}),C("toBase64",function(b){return ws(this,b)}),C("toBase64URI",function(){return ws(this,!0)}),C("toBase64URL",function(){return ws(this,!0)}),C("toUint8Array",function(){return dh(this)})},_h=function(){const C=(b,k)=>Object.defineProperty(Uint8Array.prototype,b,fh(k));C("toBase64",function(b){return xo(this,b)}),C("toBase64URI",function(){return xo(this,!0)}),C("toBase64URL",function(){return xo(this,!0)})},Mp={version:eh,VERSION:yp,atob:Fl,atobPolyfill:uh,btoa:Rl,btoaPolyfill:ah,fromBase64:Ol,toBase64:ws,encode:ws,encodeURI:ch,encodeURL:ch,utob:oh,btou:hh,decode:Ol,isValid:Cp,fromUint8Array:xo,toUint8Array:dh,extendString:gh,extendUint8Array:_h,extendBuiltins:()=>{gh(),_h()}};let vo;const Pp=new Uint8Array(16);function kp(){if(!vo&&(vo=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!vo))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return vo(Pp)}const bi=[];for(let C=0;C<256;++C)bi.push((C+256).toString(16).slice(1));function zp(C,b=0){return(bi[C[b+0]]+bi[C[b+1]]+bi[C[b+2]]+bi[C[b+3]]+"-"+bi[C[b+4]]+bi[C[b+5]]+"-"+bi[C[b+6]]+bi[C[b+7]]+"-"+bi[C[b+8]]+bi[C[b+9]]+"-"+bi[C[b+10]]+bi[C[b+11]]+bi[C[b+12]]+bi[C[b+13]]+bi[C[b+14]]+bi[C[b+15]]).toLowerCase()}var yh={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function Lp(C,b,k){if(yh.randomUUID&&!b&&!C)return yh.randomUUID();C=C||{};const Z=C.random||(C.rng||kp)();if(Z[6]=Z[6]&15|64,Z[8]=Z[8]&63|128,b){k=k||0;for(let ie=0;ie<16;++ie)b[k+ie]=Z[ie];return b}return zp(Z)}var Ul={exports:{}},Ts=typeof Reflect=="object"?Reflect:null,xh=Ts&&typeof Ts.apply=="function"?Ts.apply:function(b,k,Z){return Function.prototype.apply.call(b,k,Z)},bo;Ts&&typeof Ts.ownKeys=="function"?bo=Ts.ownKeys:Object.getOwnPropertySymbols?bo=function(b){return Object.getOwnPropertyNames(b).concat(Object.getOwnPropertySymbols(b))}:bo=function(b){return Object.getOwnPropertyNames(b)};function Dp(C){console&&console.warn&&console.warn(C)}var vh=Number.isNaN||function(b){return b!==b};function Lt(){Lt.init.call(this)}Ul.exports=Lt,Ul.exports.once=Op,Lt.EventEmitter=Lt,Lt.prototype._events=void 0,Lt.prototype._eventsCount=0,Lt.prototype._maxListeners=void 0;var bh=10;function wo(C){if(typeof C!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof C)}Object.defineProperty(Lt,"defaultMaxListeners",{enumerable:!0,get:function(){return bh},set:function(C){if(typeof C!="number"||C<0||vh(C))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+C+".");bh=C}}),Lt.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},Lt.prototype.setMaxListeners=function(b){if(typeof b!="number"||b<0||vh(b))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+b+".");return this._maxListeners=b,this};function wh(C){return C._maxListeners===void 0?Lt.defaultMaxListeners:C._maxListeners}Lt.prototype.getMaxListeners=function(){return wh(this)},Lt.prototype.emit=function(b){for(var k=[],Z=1;Z<arguments.length;Z++)k.push(arguments[Z]);var ie=b==="error",de=this._events;if(de!==void 0)ie=ie&&de.error===void 0;else if(!ie)return!1;if(ie){var ne;if(k.length>0&&(ne=k[0]),ne instanceof Error)throw ne;var c=new Error("Unhandled error."+(ne?" ("+ne.message+")":""));throw c.context=ne,c}var ve=de[b];if(ve===void 0)return!1;if(typeof ve=="function")xh(ve,this,k);else for(var Ke=ve.length,lt=Ah(ve,Ke),Z=0;Z<Ke;++Z)xh(lt[Z],this,k);return!0};function Th(C,b,k,Z){var ie,de,ne;if(wo(k),de=C._events,de===void 0?(de=C._events=Object.create(null),C._eventsCount=0):(de.newListener!==void 0&&(C.emit("newListener",b,k.listener?k.listener:k),de=C._events),ne=de[b]),ne===void 0)ne=de[b]=k,++C._eventsCount;else if(typeof ne=="function"?ne=de[b]=Z?[k,ne]:[ne,k]:Z?ne.unshift(k):ne.push(k),ie=wh(C),ie>0&&ne.length>ie&&!ne.warned){ne.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+ne.length+" "+String(b)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=C,c.type=b,c.count=ne.length,Dp(c)}return C}Lt.prototype.addListener=function(b,k){return Th(this,b,k,!1)},Lt.prototype.on=Lt.prototype.addListener,Lt.prototype.prependListener=function(b,k){return Th(this,b,k,!0)};function Rp(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function Sh(C,b,k){var Z={fired:!1,wrapFn:void 0,target:C,type:b,listener:k},ie=Rp.bind(Z);return ie.listener=k,Z.wrapFn=ie,ie}Lt.prototype.once=function(b,k){return wo(k),this.on(b,Sh(this,b,k)),this},Lt.prototype.prependOnceListener=function(b,k){return wo(k),this.prependListener(b,Sh(this,b,k)),this},Lt.prototype.removeListener=function(b,k){var Z,ie,de,ne,c;if(wo(k),ie=this._events,ie===void 0)return this;if(Z=ie[b],Z===void 0)return this;if(Z===k||Z.listener===k)--this._eventsCount===0?this._events=Object.create(null):(delete ie[b],ie.removeListener&&this.emit("removeListener",b,Z.listener||k));else if(typeof Z!="function"){for(de=-1,ne=Z.length-1;ne>=0;ne--)if(Z[ne]===k||Z[ne].listener===k){c=Z[ne].listener,de=ne;break}if(de<0)return this;de===0?Z.shift():Bp(Z,de),Z.length===1&&(ie[b]=Z[0]),ie.removeListener!==void 0&&this.emit("removeListener",b,c||k)}return this},Lt.prototype.off=Lt.prototype.removeListener,Lt.prototype.removeAllListeners=function(b){var k,Z,ie;if(Z=this._events,Z===void 0)return this;if(Z.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):Z[b]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete Z[b]),this;if(arguments.length===0){var de=Object.keys(Z),ne;for(ie=0;ie<de.length;++ie)ne=de[ie],ne!=="removeListener"&&this.removeAllListeners(ne);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(k=Z[b],typeof k=="function")this.removeListener(b,k);else if(k!==void 0)for(ie=k.length-1;ie>=0;ie--)this.removeListener(b,k[ie]);return this};function Eh(C,b,k){var Z=C._events;if(Z===void 0)return[];var ie=Z[b];return ie===void 0?[]:typeof ie=="function"?k?[ie.listener||ie]:[ie]:k?Fp(ie):Ah(ie,ie.length)}Lt.prototype.listeners=function(b){return Eh(this,b,!0)},Lt.prototype.rawListeners=function(b){return Eh(this,b,!1)},Lt.listenerCount=function(C,b){return typeof C.listenerCount=="function"?C.listenerCount(b):Ih.call(C,b)},Lt.prototype.listenerCount=Ih;function Ih(C){var b=this._events;if(b!==void 0){var k=b[C];if(typeof k=="function")return 1;if(k!==void 0)return k.length}return 0}Lt.prototype.eventNames=function(){return this._eventsCount>0?bo(this._events):[]};function Ah(C,b){for(var k=new Array(b),Z=0;Z<b;++Z)k[Z]=C[Z];return k}function Bp(C,b){for(;b+1<C.length;b++)C[b]=C[b+1];C.pop()}function Fp(C){for(var b=new Array(C.length),k=0;k<b.length;++k)b[k]=C[k].listener||C[k];return b}function Op(C,b){return new Promise(function(k,Z){function ie(ne){C.removeListener(b,de),Z(ne)}function de(){typeof C.removeListener=="function"&&C.removeListener("error",ie),k([].slice.call(arguments))}Ch(C,b,de,{once:!0}),b!=="error"&&Up(C,ie,{once:!0})})}function Up(C,b,k){typeof C.on=="function"&&Ch(C,"error",b,k)}function Ch(C,b,k,Z){if(typeof C.on=="function")Z.once?C.once(b,k):C.on(b,k);else if(typeof C.addEventListener=="function")C.addEventListener(b,function ie(de){Z.once&&C.removeEventListener(b,ie),k(de)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof C)}const zr={AUTO:"auto",LATIN:"latin",NON_LATIN:"nonlatin",LOCAL:"",ALBANIAN:"sq",AMHARIC:"am",ARABIC:"ar",ARMENIAN:"hy",AZERBAIJANI:"az",BASQUE:"eu",BELORUSSIAN:"be",BOSNIAN:"bs",BRETON:"br",BULGARIAN:"bg",CATALAN:"ca",CHINESE:"zh",CORSICAN:"co",CROATIAN:"hr",CZECH:"cs",DANISH:"da",DUTCH:"nl",ENGLISH:"en",ESPERANTO:"eo",ESTONIAN:"et",FINNISH:"fi",FRENCH:"fr",FRISIAN:"fy",GEORGIAN:"ka",GERMAN:"de",GREEK:"el",HEBREW:"he",HINDI:"hi",HUNGARIAN:"hu",ICELANDIC:"is",INDONESIAN:"id",IRISH:"ga",ITALIAN:"it",JAPANESE:"ja",JAPANESE_HIRAGANA:"ja-Hira",JAPANESE_KANA:"ja_kana",JAPANESE_LATIN:"ja_rm",JAPANESE_2018:"ja-Latn",KANNADA:"kn",KAZAKH:"kk",KOREAN:"ko",KOREAN_LATIN:"ko-Latn",KURDISH:"ku",ROMAN_LATIN:"la",LATVIAN:"lv",LITHUANIAN:"lt",LUXEMBOURGISH:"lb",MACEDONIAN:"mk",MALAYALAM:"ml",MALTESE:"mt",NORWEGIAN:"no",OCCITAN:"oc",POLISH:"pl",PORTUGUESE:"pt",ROMANIAN:"ro",ROMANSH:"rm",RUSSIAN:"ru",SCOTTISH_GAELIC:"gd",SERBIAN_CYRILLIC:"sr",SERBIAN_LATIN:"sr-Latn",SLOVAK:"sk",SLOVENE:"sl",SPANISH:"es",SWEDISH:"sv",TAMIL:"ta",TELUGU:"te",THAI:"th",TURKISH:"tr",UKRAINIAN:"uk",WELSH:"cy"},Vp=new Set(Object.values(zr));function Mh(C){return Vp.has(C)}const Np=new Set(Object.values(zr));function Vl(){if(typeof navigator>"u")return Intl.DateTimeFormat().resolvedOptions().locale.split("-")[0];const C=Array.from(new Set(navigator.languages.map(b=>b.split("-")[0]))).filter(b=>Np.has(b));return C.length?C[0]:zr.LATIN}function $p(){return typeof self<"u"?fetch.bind(self):typeof global<"u"&&global.fetch?global.fetch:null}class jp{constructor(){this._apiKey="",this._fetch=$p()}set apiKey(b){this._apiKey=b}get apiKey(){return this._apiKey}set fetch(b){this._fetch=b}get fetch(){return this._fetch}}const Hi=new jp,Ss={AUTO:"auto",ALBANIAN:"sq",ARABIC:"ar",ARMENIAN:"hy",AZERBAIJANI:"az",BELORUSSIAN:"be",BOSNIAN:"bs",BRETON:"br",BULGARIAN:"bg",CATALAN:"ca",CHINESE:"zh",CROATIAN:"hr",CZECH:"cs",DANISH:"da",DUTCH:"nl",ENGLISH:"en",ESPERANTO:"eo",ESTONIAN:"et",FINNISH:"fi",FRENCH:"fr",FRISIAN:"fy",GEORGIAN:"ka",GERMAN:"de",GREEK:"el",HEBREW:"he",HUNGARIAN:"hu",ICELANDIC:"is",IRISH:"ga",ITALIAN:"it",JAPANESE:"ja",KANNADA:"kn",KAZAKH:"kk",KOREAN:"ko",ROMAN_LATIN:"la",LATVIAN:"lv",LITHUANIAN:"lt",LUXEMBOURGISH:"lb",MACEDONIAN:"mk",MALTESE:"mt",NORWEGIAN:"no",POLISH:"pl",PORTUGUESE:"pt",ROMANIAN:"ro",ROMANSH:"rm",RUSSIAN:"ru",SCOTTISH_GAELIC:"gd",SERBIAN_CYRILLIC:"sr",SLOVAK:"sk",SLOVENE:"sl",SPANISH:"es",SWEDISH:"sv",THAI:"th",TURKISH:"tr",UKRAINIAN:"uk",WELSH:"cy"},Gp=new Set(Object.values(Ss));function Ph(){if(typeof navigator>"u")return Intl.DateTimeFormat().resolvedOptions().locale.split("-")[0];const C=Array.from(new Set(navigator.languages.map(b=>b.split("-")[0]))).filter(b=>Gp.has(b));return C.length?C[0]:Ss.ENGLISH}var qp=(C,b,k)=>new Promise((Z,ie)=>{var de=ve=>{try{c(k.next(ve))}catch(Ke){ie(Ke)}},ne=ve=>{try{c(k.throw(ve))}catch(Ke){ie(Ke)}},c=ve=>ve.done?Z(ve.value):Promise.resolve(ve.value).then(de,ne);c((k=k.apply(C,b)).next())});function Es(C){return qp(this,arguments,function*(b,k={}){if(Hi.fetch===null)throw new Error("The fetch function was not found. If on NodeJS < 18 please specify the fetch function with config.fetch");if(new URL(b).searchParams.get("key").trim()==="")throw new Error("The MapTiler Cloud API key is missing. Set it in `config.apiKey` or get one for free at https://maptiler.com");return Hi.fetch(b,k)})}const Lr={maptilerApiURL:"https://api.maptiler.com/",mapStyle:"streets-v2"};Object.freeze(Lr);class On extends Error{constructor(b,k=""){super(`Call to enpoint ${b.url} failed with the status code ${b.status}. ${k}`),this.res=b}}var kh=(C,b,k)=>new Promise((Z,ie)=>{var de=ve=>{try{c(k.next(ve))}catch(Ke){ie(Ke)}},ne=ve=>{try{c(k.throw(ve))}catch(Ke){ie(Ke)}},c=ve=>ve.done?Z(ve.value):Promise.resolve(ve.value).then(de,ne);c((k=k.apply(C,b)).next())});const To={400:"Query too long / Invalid parameters",403:"Key is missing, invalid or restricted"};function Zp(C){return kh(this,arguments,function*(b,k={}){var Z;if(typeof b!="string"||b.trim().length===0)throw new Error("The query must be a non-empty string");const ie=new URL(`geocoding/${encodeURIComponent(b)}.json`,Lr.maptilerApiURL);if(ie.searchParams.set("key",(Z=k.apiKey)!=null?Z:Hi.apiKey),"bbox"in k&&ie.searchParams.set("bbox",k.bbox.join(",")),"proximity"in k&&ie.searchParams.set("proximity",k.proximity.join(",")),"language"in k){const ve=Array.from(new Set((Array.isArray(k.language)?k.language:[k.language]).map(Ke=>Ke===Ss.AUTO?Ph():Ke))).join(",");ie.searchParams.set("language",ve)}const de=ie.toString(),ne=yield Es(de);if(!ne.ok)throw new On(ne,ne.status in To?To[ne.status]:"");return yield ne.json()})}function Xp(C){return kh(this,arguments,function*(b,k={}){var Z;if(!Array.isArray(b)||b.length<2)throw new Error("The position must be an array of form [lng, lat].");const ie=new URL(`geocoding/${b[0]},${b[1]}.json`,Lr.maptilerApiURL);if(ie.searchParams.set("key",(Z=k.apiKey)!=null?Z:Hi.apiKey),"language"in k){const ve=Array.from(new Set((Array.isArray(k.language)?k.language:[k.language]).map(Ke=>Ke===Ss.AUTO?Ph():Ke))).join(",");ie.searchParams.set("language",ve)}const de=ie.toString(),ne=yield Es(de);if(!ne.ok)throw new On(ne,ne.status in To?To[ne.status]:"");return yield ne.json()})}const Wp={forward:Zp,reverse:Xp,language:Ss};var Hp=(C,b,k)=>new Promise((Z,ie)=>{var de=ve=>{try{c(k.next(ve))}catch(Ke){ie(Ke)}},ne=ve=>{try{c(k.throw(ve))}catch(Ke){ie(Ke)}},c=ve=>ve.done?Z(ve.value):Promise.resolve(ve.value).then(de,ne);c((k=k.apply(C,b)).next())});const zh={403:"Key is missing, invalid or restricted"};function Kp(){return Hp(this,arguments,function*(C={}){var b;const k=new URL("geolocation/ip.json",Lr.maptilerApiURL);k.searchParams.set("key",(b=C.apiKey)!=null?b:Hi.apiKey);const Z=k.toString(),ie=yield Es(Z);if(!ie.ok)throw new On(ie,ie.status in zh?zh[ie.status]:"");return yield ie.json()})}const Nl={info:Kp};var Lh=(C,b,k)=>new Promise((Z,ie)=>{var de=ve=>{try{c(k.next(ve))}catch(Ke){ie(Ke)}},ne=ve=>{try{c(k.throw(ve))}catch(Ke){ie(Ke)}},c=ve=>ve.done?Z(ve.value):Promise.resolve(ve.value).then(de,ne);c((k=k.apply(C,b)).next())});const So={403:"Key is missing, invalid or restricted"};function Jp(C){return Lh(this,arguments,function*(b,k={}){var Z;if(typeof b!="string"||b.trim().length===0)throw new Error("The query must be a non-empty string");const ie=new URL(`coordinates/search/${b}.json`,Lr.maptilerApiURL);ie.searchParams.set("key",(Z=k.apiKey)!=null?Z:Hi.apiKey),"limit"in k&&ie.searchParams.set("limit",k.limit.toString()),"transformations"in k&&ie.searchParams.set("transformations",k.transformations.toString()),"exports"in k&&ie.searchParams.set("exports",k.exports.toString());const de=ie.toString(),ne=yield Es(de);if(!ne.ok)throw new On(ne,ne.status in So?So[ne.status]:"");return yield ne.json()})}function Yp(C){return Lh(this,arguments,function*(b,k={}){var Z;const ie=(Array.isArray(b[0])?b:[b]).map(Ke=>`${Ke[0]},${Ke[1]}`).join(";"),de=new URL(`coordinates/transform/${ie}.json`,Lr.maptilerApiURL);de.searchParams.set("key",(Z=k.apiKey)!=null?Z:Hi.apiKey),"sourceCrs"in k&&de.searchParams.set("s_srs",k.sourceCrs.toString()),"targetCrs"in k&&de.searchParams.set("t_srs",k.targetCrs.toString()),"operations"in k&&de.searchParams.set("ops",(Array.isArray(k.operations)?k.operations:[k.operations]).join("|"));const ne=de.toString(),c=yield Es(ne);if(!c.ok)throw new On(c,c.status in So?So[c.status]:"");return yield c.json()})}const Qp={search:Jp,transform:Yp};var ed=(C,b,k)=>new Promise((Z,ie)=>{var de=ve=>{try{c(k.next(ve))}catch(Ke){ie(Ke)}},ne=ve=>{try{c(k.throw(ve))}catch(Ke){ie(Ke)}},c=ve=>ve.done?Z(ve.value):Promise.resolve(ve.value).then(de,ne);c((k=k.apply(C,b)).next())});const Dh={403:"Key is missing, invalid or restricted"};function td(C){return ed(this,arguments,function*(b,k={}){var Z;if(typeof b!="string"||b.trim().length===0)throw new Error("The data ID must be a non-empty string");const ie=new URL(`data/${encodeURIComponent(b)}/features.json`,Lr.maptilerApiURL);ie.searchParams.set("key",(Z=k.apiKey)!=null?Z:Hi.apiKey);const de=ie.toString(),ne=yield Es(de);if(!ne.ok)throw new On(ne,ne.status in Dh?Dh[ne.status]:"");return yield ne.json()})}const id={get:td};function Rh(C){const b=/^maptiler:\/\/(.*)/;let k;const Z=C.trim();let ie;return Z.startsWith("http://")||Z.startsWith("https://")?ie=Z:(k=b.exec(Z))!==null?ie=`https://api.maptiler.com/maps/${k[1]}/style.json`:ie=`https://api.maptiler.com/maps/${Z}/style.json`,ie}class Eo{constructor(b,k,Z,ie,de,ne){this.name=b,this.variantType=k,this.id=Z,this.referenceStyle=ie,this.description=de,this.imageURL=ne}getName(){return this.name}getFullName(){return`${this.referenceStyle.getName()} ${this.name}`}getType(){return this.variantType}getId(){return this.id}getDescription(){return this.description}getReferenceStyle(){return this.referenceStyle}hasVariant(b){return this.referenceStyle.hasVariant(b)}getVariant(b){return this.referenceStyle.getVariant(b)}getVariants(){return this.referenceStyle.getVariants().filter(b=>b!==this)}getImageURL(){return this.imageURL}getExpandedStyleURL(){return Rh(this.getId())}}class Io{constructor(b,k){this.name=b,this.id=k,this.variants={},this.orderedVariants=[]}getName(){return this.name}getId(){return this.id}addVariant(b){this.variants[b.getType()]=b,this.orderedVariants.push(b)}hasVariant(b){return b in this.variants}getVariant(b){return b in this.variants?this.variants[b]:this.orderedVariants[0]}getVariants(){return Object.values(this.variants)}getDefaultVariant(){return this.orderedVariants[0]}}const Ao=[{referenceStyleID:"STREETS",name:"Streets",description:"",variants:[{id:"streets-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"streets-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"streets-v2-light",name:"Light",variantType:"LIGHT",description:"",imageURL:""},{id:"streets-v2-pastel",name:"Pastel",variantType:"PASTEL",description:"",imageURL:""}]},{referenceStyleID:"OUTDOOR",name:"Outdoor",description:"",variants:[{id:"outdoor-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""}]},{referenceStyleID:"WINTER",name:"Winter",description:"",variants:[{id:"winter-v2",name:"Winter",variantType:"DEFAULT",description:"",imageURL:""}]},{referenceStyleID:"SATELLITE",name:"Satellite",description:"",variants:[{id:"satellite",name:"Default",variantType:"DEFAULT",description:"",imageURL:""}]},{referenceStyleID:"HYBRID",name:"Hybrid",description:"",variants:[{id:"hybrid",name:"Default",variantType:"DEFAULT",description:"",imageURL:""}]},{referenceStyleID:"BASIC",name:"Basic",description:"",variants:[{id:"basic-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"basic-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"basic-v2-light",name:"Light",variantType:"LIGHT",description:"",imageURL:""}]},{referenceStyleID:"BRIGHT",name:"Bright",description:"",variants:[{id:"bright-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"bright-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"bright-v2-light",name:"Light",variantType:"LIGHT",description:"",imageURL:""},{id:"bright-v2-pastel",name:"Pastel",variantType:"PASTEL",description:"",imageURL:""}]},{referenceStyleID:"OPENSTREETMAP",name:"OpenStreetMap",description:"",variants:[{id:"openstreetmap",name:"Default",variantType:"DEFAULT",description:"",imageURL:""}]},{referenceStyleID:"TOPO",name:"Topo",description:"",variants:[{id:"topo-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"topo-v2-shiny",name:"Shiny",variantType:"SHINY",description:"",imageURL:""},{id:"topo-v2-pastel",name:"Pastel",variantType:"PASTEL",description:"",imageURL:""},{id:"topo-v2-topographique",name:"Topographique",variantType:"TOPOGRAPHIQUE",description:"",imageURL:""}]},{referenceStyleID:"VOYAGER",name:"Voyager",description:"",variants:[{id:"voyager-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"voyager-v2-darkmatter",name:"Darkmatter",variantType:"DARK",description:"",imageURL:""},{id:"voyager-v2-positron",name:"Positron",variantType:"LIGHT",description:"",imageURL:""},{id:"voyager-v2-vintage",name:"Vintage",variantType:"VINTAGE",description:"",imageURL:""}]},{referenceStyleID:"TONER",name:"Toner",description:"",variants:[{id:"toner-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"toner-v2-background",name:"Background",variantType:"BACKGROUND",description:"",imageURL:""},{id:"toner-v2-lite",name:"Lite",variantType:"LITE",description:"",imageURL:""},{id:"toner-v2-lines",name:"Lines",variantType:"LINES",description:"",imageURL:""}]},{referenceStyleID:"DATAVIZ",name:"Dataviz",description:"",variants:[{id:"dataviz",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"dataviz-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"dataviz-light",name:"Light",variantType:"LIGHT",description:"",imageURL:""}]},{referenceStyleID:"OCEAN",name:"Ocean",description:"",variants:[{id:"ocean",name:"Default",variantType:"DEFAULT",description:"",imageURL:""}]}];function rd(C){return new Proxy(C,{get(b,k,Z){return b.hasVariant(k)?b.getVariant(k):k.toString().toUpperCase()===k?C.getDefaultVariant():Reflect.get(b,k,Z)}})}function nd(){const C={};for(let b=0;b<Ao.length;b+=1){const k=Ao[b],Z=rd(new Io(k.name,k.referenceStyleID));for(let ie=0;ie<k.variants.length;ie+=1){const de=k.variants[ie],ne=new Eo(de.name,de.variantType,de.id,Z,de.description,de.imageURL);Z.addVariant(ne)}C[k.referenceStyleID]=Z}return C}function $l(C){if(!C)return jl[Ao[0].referenceStyleID].getDefaultVariant().getId();if(typeof C=="string"||C instanceof String)return C.trim().toLowerCase();if(C instanceof Eo)return C.getId();if(C instanceof Io)return C.getDefaultVariant().getId()}const jl=nd();function sd(C,b,k){let Z=b[0],ie=b[1],de=k[0]-Z,ne=k[1]-ie;if(de!==0||ne!==0){const c=((C[0]-Z)*de+(C[1]-ie)*ne)/(de*de+ne*ne);c>1?(Z=k[0],ie=k[1]):c>0&&(Z+=de*c,ie+=ne*c)}return de=C[0]-Z,ne=C[1]-ie,de*de+ne*ne}function Gl(C,b,k,Z,ie){let de=Z,ne;for(let c=b+1;c<k;c++){const ve=sd(C[c],C[b],C[k]);ve>de&&(ne=c,de=ve)}de>Z&&(ne-b>1&&Gl(C,b,ne,Z,ie),ie.push(C[ne]),k-ne>1&&Gl(C,ne,k,Z,ie))}function ad(C,b){const k=C.length-1,Z=[C[0]];return Gl(C,0,k,b,Z),Z.push(C[k]),Z}function od(C,b){if(C.length<=2)return C;const k=b!==void 0?b*b:1;return ad(C,k)}function ql(C,b=!0){let k=`${C[0]},${C[1]}`;return C.length===3&&b&&(k+=`,${C[2]}`),k}function Zl(C,b=3e3){let k=C.map(de=>de.join(",")).join("|"),Z=5e-6;const ie=1e-5;for(;k.length>b;)k=od(C,Z).map(ne=>`${ne[0]},${ne[1]}`).join("|"),Z+=ie;return k}function ld(C,b,k={}){var Z,ie,de,ne,c;const ve=$l(k.style),Ke=k.hiDPI?"@2x":"",lt=(Z=k.format)!=null?Z:"png";let St=~~((ie=k.width)!=null?ie:1024),Me=~~((de=k.height)!=null?de:1024);k.hiDPI&&(St=~~(St/2),Me=~~(Me/2));const K=new URL(`maps/${encodeURIComponent(ve)}/static/${C[0]},${C[1]},${b}/${St}x${Me}${Ke}.${lt}`,Lr.maptilerApiURL);if("attribution"in k&&K.searchParams.set("attribution",k.attribution.toString()),"markers"in k){let Je="";const ti="markerIcon"in k;ti&&(Je+=`icon:${k.markerIcon}|`),ti&&"markerAnchor"in k&&(Je+=`anchor:${k.markerAnchor}|`),ti&&k.hiDPI&&(Je+="scale:2|"),Je+=(Array.isArray(k.markers[0])?k.markers:[k.markers]).map(Dt=>ql(Dt,!ti)).join("|"),K.searchParams.set("markers",Je)}if("path"in k){let Je="";Je+=`fill:${(ne=k.pathFillColor)!=null?ne:"none"}|`,"pathStrokeColor"in k&&(Je+=`stroke:${k.pathStrokeColor}|`),"pathWidth"in k&&(Je+=`width:${(k.pathWidth/(k.hiDPI?2:1)).toString()}|`),Je+=Zl(k.path),K.searchParams.set("path",Je)}return K.searchParams.set("key",(c=k.apiKey)!=null?c:Hi.apiKey),K.toString()}function cd(C,b={}){var k,Z,ie,de,ne;const c=$l(b.style),ve=b.hiDPI?"@2x":"",Ke=(k=b.format)!=null?k:"png";let lt=~~((Z=b.width)!=null?Z:1024),St=~~((ie=b.height)!=null?ie:1024);b.hiDPI&&(lt=~~(lt/2),St=~~(St/2));const Me=new URL(`maps/${encodeURIComponent(c)}/static/${C[0]},${C[1]},${C[2]},${C[3]}/${lt}x${St}${ve}.${Ke}`,Lr.maptilerApiURL);if("attribution"in b&&Me.searchParams.set("attribution",b.attribution.toString()),"padding"in b&&Me.searchParams.set("padding",b.padding.toString()),"markers"in b){let K="";const Je="markerIcon"in b;Je&&(K+=`icon:${b.markerIcon}|`),Je&&"markerAnchor"in b&&(K+=`anchor:${b.markerAnchor}|`),Je&&b.hiDPI&&(K+="scale:2|"),K+=(Array.isArray(b.markers[0])?b.markers:[b.markers]).map(Jt=>ql(Jt,!Je)).join("|"),Me.searchParams.set("markers",K)}if("path"in b){let K="";K+=`fill:${(de=b.pathFillColor)!=null?de:"none"}|`,"pathStrokeColor"in b&&(K+=`stroke:${b.pathStrokeColor}|`),"pathWidth"in b&&(K+=`width:${(b.pathWidth/(b.hiDPI?2:1)).toString()}|`),K+=Zl(b.path),Me.searchParams.set("path",K)}return Me.searchParams.set("key",(ne=b.apiKey)!=null?ne:Hi.apiKey),Me.toString()}function hd(C={}){var b,k,Z,ie,de;if(!("markers"in C)&&!("path"in C))throw new Error("Automatic static maps require markers and/or path to be created.");const ne=$l(C.style),c=C.hiDPI?"@2x":"",ve=(b=C.format)!=null?b:"png";let Ke=~~((k=C.width)!=null?k:1024),lt=~~((Z=C.height)!=null?Z:1024);C.hiDPI&&(Ke=~~(Ke/2),lt=~~(lt/2));const St=new URL(`maps/${encodeURIComponent(ne)}/static/auto/${Ke}x${lt}${c}.${ve}`,Lr.maptilerApiURL);if("attribution"in C&&St.searchParams.set("attribution",C.attribution.toString()),"padding"in C&&St.searchParams.set("padding",C.padding.toString()),"markers"in C){let Me="";const K="markerIcon"in C;K&&(Me+=`icon:${C.markerIcon}|`),K&&"markerAnchor"in C&&(Me+=`anchor:${C.markerAnchor}|`),K&&C.hiDPI&&(Me+="scale:2|"),Me+=(Array.isArray(C.markers[0])?C.markers:[C.markers]).map(ti=>ql(ti,!K)).join("|"),St.searchParams.set("markers",Me)}if("path"in C){let Me="";Me+=`fill:${(ie=C.pathFillColor)!=null?ie:"none"}|`,"pathStrokeColor"in C&&(Me+=`stroke:${C.pathStrokeColor}|`),"pathWidth"in C&&(Me+=`width:${(C.pathWidth/(C.hiDPI?2:1)).toString()}|`),Me+=Zl(C.path),St.searchParams.set("path",Me)}return St.searchParams.set("key",(de=C.apiKey)!=null?de:Hi.apiKey),St.toString()}const ud={centered:ld,bounded:cd,automatic:hd};class Bh extends Ul.exports{constructor(){super(),this.primaryLanguage=zr.AUTO,this.secondaryLanguage=null,this.session=!0,this._unit="metric",this._apiKey=""}set unit(b){this._unit=b,this.emit("unit",b)}get unit(){return this._unit}set apiKey(b){this._apiKey=b,Hi.apiKey=b,this.emit("apiKey",b)}get apiKey(){return this._apiKey}set fetch(b){Hi.fetch=b}get fetch(){return Hi.fetch}}const Fi=new Bh,Ki={maptilerLogoURL:"https://api.maptiler.com/resources/logo.svg",maptilerURL:"https://www.maptiler.com/",maptilerApiHost:"api.maptiler.com",rtlPluginURL:"https://cdn.maptiler.com/mapbox-gl-rtl-text/v0.2.3/mapbox-gl-rtl-text.min.js",primaryLanguage:zr.AUTO,secondaryLanguage:zr.LOCAL,terrainSourceURL:"https://api.maptiler.com/tiles/terrain-rgb/tiles.json",terrainSourceId:"maptiler-terrain"};Object.freeze(Ki);class Fh extends gr.LogoControl{constructor(b={}){var k,Z;super(b),this.logoURL="",this.linkURL="",this.logoURL=(k=b.logoURL)!=null?k:Ki.maptilerLogoURL,this.linkURL=(Z=b.linkURL)!=null?Z:Ki.maptilerURL}onAdd(b){this._map=b,this._compact=this.options&&this.options.compact,this._container=window.document.createElement("div"),this._container.className="maplibregl-ctrl";const k=window.document.createElement("a");return k.style.backgroundRepeat="no-repeat",k.style.cursor="pointer",k.style.display="block",k.style.height="23px",k.style.margin="0 0 -4px -4px",k.style.overflow="hidden",k.style.width="88px",k.style.backgroundImage=`url(${this.logoURL})`,k.style.backgroundSize="100px 30px",k.style.width="100px",k.style.height="30px",k.target="_blank",k.rel="noopener nofollow",k.href=this.linkURL,k.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),k.setAttribute("rel","noopener nofollow"),this._container.appendChild(k),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}}function pd(){gr.getRTLTextPluginStatus()==="unavailable"&&gr.setRTLTextPlugin(Ki.rtlPluginURL,null,!0)}function dd(C,b){C.forEach(k=>{!b[k]||(b[k]=b[k].bind(b))})}function Un(C,b,k){const Z=window.document.createElement(C);return b!==void 0&&(Z.className=b),k&&k.appendChild(Z),Z}function md(C){C.parentNode&&C.parentNode.removeChild(C)}function Oh(C){return C?typeof C=="string"||C instanceof String?!C.startsWith("http")&&C.toLowerCase().includes(".json")?C:Rh(C):C instanceof Eo?C.getExpandedStyleURL():C instanceof Io?C.getDefaultVariant().getExpandedStyleURL():C:jl[Ao[0].referenceStyleID].getDefaultVariant().getExpandedStyleURL()}class fd{constructor(){dd(["_toggleTerrain","_updateTerrainIcon"],this)}onAdd(b){return this._map=b,this._container=Un("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=Un("button","maplibregl-ctrl-terrain",this._container),Un("span","maplibregl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){md(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}_toggleTerrain(){this._map.hasTerrain()?this._map.disableTerrain():this._map.enableTerrain(),this._updateTerrainIcon()}_updateTerrainIcon(){this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.hasTerrain()?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.disableTerrain")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.enableTerrain"))}}class gd extends gr.NavigationControl{constructor(){super({showCompass:!0,showZoom:!0,visualizePitch:!0}),this._compass.removeEventListener("click",this._compass.clickFunction),this._compass.addEventListener("click",b=>{this._map.getPitch()===0?this._map.easeTo({pitch:Math.min(this._map.getMaxPitch(),80)}):this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:b}):this._map.resetNorth({},{originalEvent:b})})}_createButton(b,k){const Z=super._createButton(b,k);return Z.clickFunction=k,Z}_rotateCompassArrow(){const b=this.options.visualizePitch?`scale(${Math.min(1.5,1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5))}) rotateX(${Math.min(70,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=b}}var _d=Object.defineProperty,yd=Object.defineProperties,xd=Object.getOwnPropertyDescriptors,Uh=Object.getOwnPropertySymbols,vd=Object.prototype.hasOwnProperty,bd=Object.prototype.propertyIsEnumerable,Vh=(C,b,k)=>b in C?_d(C,b,{enumerable:!0,configurable:!0,writable:!0,value:k}):C[b]=k,wd=(C,b)=>{for(var k in b||(b={}))vd.call(b,k)&&Vh(C,k,b[k]);if(Uh)for(var k of Uh(b))bd.call(b,k)&&Vh(C,k,b[k]);return C},Td=(C,b)=>yd(C,xd(b));const Sd=gr.GeolocateControl,Nh=gr.Marker,$h=gr.LngLat;class Ed extends Sd{constructor(){super(...arguments),this.lastUpdatedCenter=new $h(0,0)}_updateCamera(b){const k=new $h(b.coords.longitude,b.coords.latitude),Z=b.coords.accuracy,ie=this._map.getBearing(),de=Td(wd({bearing:ie},this.options.fitBoundsOptions),{linear:!0}),ne=this._map.getZoom();ne>this.options.fitBoundsOptions.maxZoom&&(de.zoom=ne),this._map.fitBounds(k.toBounds(Z),de,{geolocateSource:!0});let c=!1;const ve=()=>{c=!0};this._map.once("click",ve),this._map.once("dblclick",ve),this._map.once("dragstart",ve),this._map.once("mousedown",ve),this._map.once("touchstart",ve),this._map.once("wheel",ve),this._map.once("moveend",()=>{this._map.off("click",ve),this._map.off("dblclick",ve),this._map.off("dragstart",ve),this._map.off("mousedown",ve),this._map.off("touchstart",ve),this._map.off("wheel",ve),!c&&(this.lastUpdatedCenter=this._map.getCenter())})}_setupUI(b){if(this.lastUpdatedCenter=this._map.getCenter(),this._container.addEventListener("contextmenu",k=>k.preventDefault()),this._geolocateButton=Un("button","maplibregl-ctrl-geolocate",this._container),Un("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",b===!1){const k=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=k,this._geolocateButton.setAttribute("aria-label",k)}else{const k=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=k,this._geolocateButton.setAttribute("aria-label",k)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=Un("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new Nh(this._dotElement),this._circleElement=Un("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Nh({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("move",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("moveend",k=>{const Z=k.originalEvent&&k.originalEvent.type==="resize",ie=this.lastUpdatedCenter.distanceTo(this._map.getCenter());!k.geolocateSource&&this._watchState==="ACTIVE_LOCK"&&!Z&&ie>1&&(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new Event("trackuserlocationend")))})}_updateCircleRadius(){if(this._watchState!=="BACKGROUND"&&this._watchState!=="ACTIVE_LOCK")return;const b=[this._lastKnownPosition.coords.longitude,this._lastKnownPosition.coords.latitude],k=this._map.project(b),Z=this._map.unproject([k.x,k.y]),ie=this._map.unproject([k.x+20,k.y]),de=Z.distanceTo(ie)/20,ne=Math.ceil(2*this._accuracy/de);this._circleElement.style.width=`${ne}px`,this._circleElement.style.height=`${ne}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}}var Id=Object.defineProperty,Ad=Object.defineProperties,Cd=Object.getOwnPropertyDescriptors,jh=Object.getOwnPropertySymbols,Md=Object.prototype.hasOwnProperty,Pd=Object.prototype.propertyIsEnumerable,Gh=(C,b,k)=>b in C?Id(C,b,{enumerable:!0,configurable:!0,writable:!0,value:k}):C[b]=k,qh=(C,b)=>{for(var k in b||(b={}))Md.call(b,k)&&Gh(C,k,b[k]);if(jh)for(var k of jh(b))Pd.call(b,k)&&Gh(C,k,b[k]);return C},Zh=(C,b)=>Ad(C,Cd(b)),ca=(C,b,k)=>new Promise((Z,ie)=>{var de=ve=>{try{c(k.next(ve))}catch(Ke){ie(Ke)}},ne=ve=>{try{c(k.throw(ve))}catch(Ke){ie(Ke)}},c=ve=>ve.done?Z(ve.value):Promise.resolve(ve.value).then(de,ne);c((k=k.apply(C,b)).next())});const kd=Lp(),Xh={POINT:"POINT",COUNTRY:"COUNTRY"};class zd extends gr.Map{constructor(b){var k;const Z=Oh(b.style),ie=location.hash;Fi.apiKey||console.warn("MapTiler Cloud API key is not set. Visit https://maptiler.com and try Cloud for free!"),super(Zh(qh({},b),{style:Z,maplibreLogo:!1,transformRequest:de=>{let ne=null;try{ne=new URL(de)}catch{return{url:de,headers:{}}}return ne.host===Ki.maptilerApiHost&&(ne.searchParams.has("key")||ne.searchParams.append("key",Fi.apiKey),Fi.session&&ne.searchParams.append("mtsid",kd)),{url:ne.href,headers:{}}}})),this.languageShouldUpdate=!1,this.isStyleInitialized=!1,this.isTerrainEnabled=!1,this.terrainExaggeration=1,this.once("styledata",()=>ca(this,null,function*(){if(b.geolocate===!1||b.center||b.hash&&!!ie)return;try{if(b.geolocate===Xh.COUNTRY){yield this.fitToIpBounds();return}}catch(ne){console.warn(ne.message)}let de=null;try{yield this.centerOnIpPoint(b.zoom),de=this.getCameraHash()}catch(ne){console.warn(ne.message)}(yield navigator.permissions.query({name:"geolocation"})).state==="granted"&&navigator.geolocation.getCurrentPosition(ne=>{de===this.getCameraHash()&&this.easeTo({center:[ne.coords.longitude,ne.coords.latitude],zoom:b.zoom||12,duration:2e3})},null,{maximumAge:24*3600*1e3,timeout:5e3,enableHighAccuracy:!1})})),this.on("styledataloading",()=>{this.languageShouldUpdate=!!Fi.primaryLanguage||!!Fi.secondaryLanguage}),this.on("styledata",()=>{Fi.primaryLanguage&&(this.languageShouldUpdate||!this.isStyleInitialized)&&this.setPrimaryLanguage(Fi.primaryLanguage),Fi.secondaryLanguage&&(this.languageShouldUpdate||!this.isStyleInitialized)&&this.setSecondaryLanguage(Fi.secondaryLanguage),this.languageShouldUpdate=!1,this.isStyleInitialized=!0}),this.on("styledata",()=>{this.getTerrain()===null&&this.isTerrainEnabled&&this.enableTerrain(this.terrainExaggeration)}),this.once("load",()=>ca(this,null,function*(){pd()})),this.once("load",()=>ca(this,null,function*(){let de={logo:null};try{const ne=Object.keys(this.style.sourceCaches).map(ve=>this.getSource(ve)).filter(ve=>typeof ve.url=="string"&&ve.url.includes("tiles.json")),c=new URL(ne[0].url);c.searchParams.has("key")||c.searchParams.append("key",Fi.apiKey),de=yield(yield fetch(c.href)).json()}catch{}if("logo"in de&&de.logo){const ne=de.logo;this.addControl(new Fh({logoURL:ne}),b.logoPosition),b.attributionControl===!1&&this.addControl(new gr.AttributionControl(b))}else b.maptilerLogo&&this.addControl(new Fh,b.logoPosition);if(b.scaleControl){const ne=b.scaleControl===!0||b.scaleControl===void 0?"bottom-right":b.scaleControl,c=new gr.ScaleControl({unit:Fi.unit});this.addControl(c,ne),Fi.on("unit",ve=>{c.setUnit(ve)})}if(b.navigationControl!==!1){const ne=b.navigationControl===!0||b.navigationControl===void 0?"top-right":b.navigationControl;this.addControl(new gd,ne)}if(b.geolocateControl!==!1){const ne=b.geolocateControl===!0||b.geolocateControl===void 0?"top-right":b.geolocateControl;this.addControl(new Ed({positionOptions:{enableHighAccuracy:!0,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!0,showAccuracyCircle:!0,showUserLocation:!0}),ne)}if(b.terrainControl){const ne=b.terrainControl===!0||b.terrainControl===void 0?"top-right":b.terrainControl;this.addControl(new fd,ne)}if(b.fullscreenControl){const ne=b.fullscreenControl===!0||b.fullscreenControl===void 0?"top-right":b.fullscreenControl;this.addControl(new gr.FullscreenControl({}),ne)}})),b.terrain&&this.enableTerrain((k=b.terrainExaggeration)!=null?k:this.terrainExaggeration)}setStyle(b,k){return super.setStyle(Oh(b),k)}setLanguage(b=Ki.primaryLanguage){if(b===zr.AUTO)return this.setLanguage(Vl());this.setPrimaryLanguage(b)}setPrimaryLanguage(b=Ki.primaryLanguage){!Mh(b)||this.onStyleReady(()=>{if(b===zr.AUTO)return this.setPrimaryLanguage(Vl());Fi.primaryLanguage=b;const k=this.getStyle().layers,Z=/^\s*{\s*name\s*(:\s*(\S*))?\s*}$/,ie=/^\s*name\s*(:\s*(\S*))?\s*$/,de=/^\s*{\s*name\s*(:\s*(\S*))?\s*}(\s*){\s*name\s*(:\s*(\S*))?\s*}$/,ne=/^(.*)({\s*name\s*(:\s*(\S*))?\s*})(.*)$/,c=b?`name:${b}`:"name",ve=["case",["has",c],["get",c],["get","name:latin"]];for(let Ke=0;Ke<k.length;Ke+=1){const lt=k[Ke],St=lt.layout;if(!St||!St["text-field"])continue;const Me=this.getLayoutProperty(lt.id,"text-field");let K;if(Array.isArray(Me)&&Me.length>=2&&Me[0].trim().toLowerCase()==="concat"){const Je=Me.slice();for(let ti=0;ti<Me.length;ti+=1){const Jt=Me[ti];if((typeof Jt=="string"||Jt instanceof String)&&Z.exec(Jt.toString())){Je[ti]=ve;break}else if(Array.isArray(Jt)&&Jt.length>=2&&Jt[0].trim().toLowerCase()==="get"&&ie.exec(Jt[1].toString())){Je[ti]=ve;break}else if(Array.isArray(Jt)&&Jt.length===4&&Jt[0].trim().toLowerCase()==="case"){Je[ti]=ve;break}}this.setLayoutProperty(lt.id,"text-field",Je)}else if(Array.isArray(Me)&&Me.length>=2&&Me[0].trim().toLowerCase()==="get"&&ie.exec(Me[1].toString())){const Je=ve;this.setLayoutProperty(lt.id,"text-field",Je)}else if((typeof Me=="string"||Me instanceof String)&&Z.exec(Me.toString())){const Je=ve;this.setLayoutProperty(lt.id,"text-field",Je)}else if(Array.isArray(Me)&&Me.length===4&&Me[0].trim().toLowerCase()==="case"){const Je=ve;this.setLayoutProperty(lt.id,"text-field",Je)}else if((typeof Me=="string"||Me instanceof String)&&(K=de.exec(Me.toString()))!==null){const Je=`{${c}}${K[3]}{name${K[4]||""}}`;this.setLayoutProperty(lt.id,"text-field",Je)}else if((typeof Me=="string"||Me instanceof String)&&(K=ne.exec(Me.toString()))!==null){const Je=`${K[1]}{${c}}${K[5]}`;this.setLayoutProperty(lt.id,"text-field",Je)}}})}setSecondaryLanguage(b=Ki.secondaryLanguage){!Mh(b)||this.onStyleReady(()=>{if(b===zr.AUTO)return this.setSecondaryLanguage(Vl());Fi.secondaryLanguage=b;const k=this.getStyle().layers,Z=/^\s*{\s*name\s*(:\s*(\S*))?\s*}$/,ie=/^\s*name\s*(:\s*(\S*))?\s*$/,de=/^\s*{\s*name\s*(:\s*(\S*))?\s*}(\s*){\s*name\s*(:\s*(\S*))?\s*}$/;let ne;for(let c=0;c<k.length;c+=1){const ve=k[c],Ke=ve.layout;if(!Ke||!Ke["text-field"])continue;const lt=this.getLayoutProperty(ve.id,"text-field");let St;if(Array.isArray(lt)&<.length>=2&<[0].trim().toLowerCase()==="concat"){St=lt.slice();let Me=0;for(let K=0;K<lt.length;K+=1){const Je=lt[K];if((typeof Je=="string"||Je instanceof String)&&Z.exec(Je.toString())){if(Me===1){St[K]=`{name:${b}}`;break}Me+=1}else if(Array.isArray(Je)&&Je.length>=2&&Je[0].trim().toLowerCase()==="get"&&ie.exec(Je[1].toString())){if(Me===1){St[K][1]=`name:${b}`;break}Me+=1}else if(Array.isArray(Je)&&Je.length===4&&Je[0].trim().toLowerCase()==="case"){if(Me===1){St[K]=["get",`name:${b}`];break}Me+=1}}this.setLayoutProperty(ve.id,"text-field",St)}else if((typeof lt=="string"||lt instanceof String)&&(ne=de.exec(lt.toString()))!==null){const Me=b?`name:${b}`:"name";St=`{name${ne[1]||""}}${ne[3]}{${Me}}`,this.setLayoutProperty(ve.id,"text-field",St)}}})}getTerrainExaggeration(){return this.terrainExaggeration}hasTerrain(){return this.isTerrainEnabled}enableTerrain(b=this.terrainExaggeration){if(b<0){console.warn("Terrain exaggeration cannot be negative.");return}const k=this.getTerrain(),Z=()=>{this.isTerrainEnabled=!0,this.terrainExaggeration=b,this.addSource(Ki.terrainSourceId,{type:"raster-dem",url:Ki.terrainSourceURL}),this.setTerrain({source:Ki.terrainSourceId,exaggeration:b})};if(k){this.setTerrain(Zh(qh({},k),{exaggeration:b}));return}this.loaded()||this.isTerrainEnabled?Z():this.once("load",()=>{this.getTerrain()&&this.getSource(Ki.terrainSourceId)||Z()})}disableTerrain(){this.isTerrainEnabled=!1,this.setTerrain(null),this.getSource(Ki.terrainSourceId)&&this.removeSource(Ki.terrainSourceId)}setTerrainExaggeration(b){this.enableTerrain(b)}onStyleReady(b){this.isStyleLoaded()?b():this.once("styledata",()=>{b()})}fitToIpBounds(){return ca(this,null,function*(){const b=yield Nl.info();this.fitBounds(b.country_bounds,{duration:0,padding:100})})}centerOnIpPoint(b){return ca(this,null,function*(){const k=yield Nl.info();this.jumpTo({center:[k.longitude,k.latitude],zoom:b||11})})}getCameraHash(){const b=new Float32Array(5),k=this.getCenter();return b[0]=k.lng,b[1]=k.lat,b[2]=this.getZoom(),b[3]=this.getPitch(),b[4]=this.getBearing(),Mp.fromUint8Array(new Uint8Array(b.buffer))}}class ha{constructor(b,k){this.x=b,this.y=k}_matMult(b){const k=b[0]*this.x+b[1]*this.y,Z=b[2]*this.x+b[3]*this.y;return this.x=k,this.y=Z,this}_add(b){return this.x+=b.x,this.y+=b.y,this}_sub(b){return this.x-=b.x,this.y-=b.y,this}_mult(b){return this.x*=b,this.y*=b,this}_div(b){return this.x/=b,this.y/=b,this}_multByPoint(b){return this.x*=b.x,this.y*=b.y,this}_divByPoint(b){return this.x/=b.x,this.y/=b.y,this}_unit(){return this._div(this.mag()),this}_perp(){const b=this.y;return this.y=this.x,this.x=-b,this}_rotate(b){const k=Math.cos(b),Z=Math.sin(b),ie=k*this.x-Z*this.y,de=Z*this.x+k*this.y;return this.x=ie,this.y=de,this}_rotateAround(b,k){const Z=Math.cos(b),ie=Math.sin(b),de=k.x+Z*(this.x-k.x)-ie*(this.y-k.y),ne=k.y+ie*(this.x-k.x)+Z*(this.y-k.y);return this.x=de,this.y=ne,this}_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}clone(){return new ha(this.x,this.y)}add(b){return this.clone()._add(b)}sub(b){return this.clone()._sub(b)}multByPoint(b){return this.clone()._multByPoint(b)}divByPoint(b){return this.clone()._divByPoint(b)}mult(b){return this.clone()._mult(b)}div(b){return this.clone()._div(b)}rotate(b){return this.clone()._rotate(b)}rotateAround(b,k){return this.clone()._rotateAround(b,k)}matMult(b){return this.clone()._matMult(b)}unit(){return this.clone()._unit()}perp(){return this.clone()._perp()}round(){return this.clone()._round()}mag(){return Math.sqrt(this.x*this.x+this.y*this.y)}equals(b){return this.x===b.x&&this.y===b.y}dist(b){return Math.sqrt(this.distSqr(b))}distSqr(b){const k=b.x-this.x,Z=b.y-this.y;return k*k+Z*Z}angle(){return Math.atan2(this.y,this.x)}angleTo(b){return Math.atan2(this.y-b.y,this.x-b.x)}angleWith(b){return this.angleWithSep(b.x,b.y)}angleWithSep(b,k){return Math.atan2(this.x*k-this.y*b,this.x*b+this.y*k)}static convert(b){return b instanceof ha?b:Array.isArray(b)?new ha(b[0],b[1]):b}}const{supported:Ld,setRTLTextPlugin:Dd,getRTLTextPluginStatus:Rd,NavigationControl:Bd,GeolocateControl:Fd,AttributionControl:Od,LogoControl:Ud,ScaleControl:Vd,FullscreenControl:Nd,TerrainControl:$d,Popup:jd,Marker:Gd,Style:qd,LngLat:Zd,LngLatBounds:Xd,MercatorCoordinate:Wd,Evented:Hd,AJAXError:Kd,CanvasSource:Jd,GeoJSONSource:Yd,ImageSource:Qd,RasterDEMTileSource:em,RasterTileSource:tm,VectorTileSource:im,VideoSource:rm,prewarm:nm,clearPrewarmedResources:sm,version:am,workerCount:om,maxParallelImageRequests:lm,clearStorage:cm,workerUrl:hm,addProtocol:um,removeProtocol:pm}=gr;tt.AJAXError=Kd,tt.AttributionControl=Od,tt.CanvasSource=Jd,tt.Evented=Hd,tt.FullscreenControl=Nd,tt.GeoJSONSource=Yd,tt.GeolocateControl=Fd,tt.GeolocationType=Xh,tt.ImageSource=Qd,tt.Language=zr,tt.LanguageGeocoding=Ss,tt.LngLat=Zd,tt.LngLatBounds=Xd,tt.LogoControl=Ud,tt.Map=zd,tt.MapStyle=jl,tt.MapStyleVariant=Eo,tt.Marker=Gd,tt.MercatorCoordinate=Wd,tt.NavigationControl=Bd,tt.Point=ha,tt.Popup=jd,tt.RasterDEMTileSource=em,tt.RasterTileSource=tm,tt.ReferenceMapStyle=Io,tt.ScaleControl=Vd,tt.SdkConfig=Bh,tt.ServiceError=On,tt.Style=qd,tt.TerrainControl=$d,tt.VectorTileSource=im,tt.VideoSource=rm,tt.addProtocol=um,tt.clearPrewarmedResources=sm,tt.clearStorage=cm,tt.config=Fi,tt.coordinates=Qp,tt.data=id,tt.geocoding=Wp,tt.geolocation=Nl,tt.getRTLTextPluginStatus=Rd,tt.maxParallelImageRequests=lm,tt.prewarm=nm,tt.removeProtocol=pm,tt.setRTLTextPlugin=Dd,tt.staticMaps=ud,tt.supported=Ld,tt.version=am,tt.workerCount=om,tt.workerUrl=hm,Object.defineProperty(tt,"__esModule",{value:!0})});
|
|
579
|
+
`,document.addEventListener("keydown",a=>{a.key===t&&(this._metaPress=!0)}),document.addEventListener("keyup",a=>{a.key===t&&(this._metaPress=!1)}),this._canvasContainer.addEventListener("wheel",a=>{this._onCooperativeGesture(a,this._metaPress,1)},!1),this._canvasContainer.classList.remove("maplibregl-touch-drag-pan")}_resizeCanvas(o,t,n){this._canvas.width=n*o,this._canvas.height=n*t,this._canvas.style.width=`${o}px`,this._canvas.style.height=`${t}px`}_setupPainter(){const o=c.extend({},ve.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1});let t=null;this._canvas.addEventListener("webglcontextcreationerror",a=>{t={requestedAttributes:o},a&&(t.statusMessage=a.statusMessage,t.type=a.type)},{once:!0});const n=this._canvas.getContext("webgl",o)||this._canvas.getContext("experimental-webgl",o);if(!n){const a="Failed to initialize WebGL";throw t?(t.message=a,new Error(JSON.stringify(t))):new Error(a)}this.painter=new Ko(n,this.transform),c.exported$1.testSupport(n)}_contextLost(o){o.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new c.Event("webglcontextlost",{originalEvent:o}))}_contextRestored(o){this._setupPainter(),this.resize(),this._update(),this.fire(new c.Event("webglcontextrestored",{originalEvent:o}))}_onMapScroll(o){if(o.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}_onCooperativeGesture(o,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(o){return this.style?(this._styleDirty=this._styleDirty||o,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(o){return this._update(),this._renderTaskQueue.add(o)}_cancelRenderFrame(o){this._renderTaskQueue.remove(o)}_render(o){let t,n=0;const a=this.painter.context.extTimerQuery;if(this.listens("gpu-timing-frame")&&(t=a.createQueryEXT(),a.beginQueryEXT(a.TIME_ELAPSED_EXT,t),n=c.exported.now()),this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(o),this._removed)return;let h=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const m=this.transform.zoom,_=c.exported.now();this.style.zoomHistory.update(m,_);const y=new c.EvaluationParameters(m,{now:_,fadeDuration:this._fadeDuration,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),v=y.crossFadingFactor();v===1&&v===this._crossFadingFactor||(h=!0,this._crossFadingFactor=v),this.style.update(y)}if(this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain&&this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.updateElevation(this.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 c.Event("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,c.PerformanceUtils.mark(c.PerformanceMarkers.load),this.fire(new c.Event("load"))),this.style&&(this.style.hasTransitions()||h)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),this.listens("gpu-timing-frame")){const m=c.exported.now()-n;a.endQueryEXT(a.TIME_ELAPSED_EXT,t),setTimeout(()=>{const _=a.getQueryObjectEXT(t,a.QUERY_RESULT_EXT)/1e6;a.deleteQueryEXT(t),this.fire(new c.Event("gpu-timing-frame",{cpuTime:m,gpuTime:_}))},50)}if(this.listens("gpu-timing-layer")){const m=this.painter.collectGpuTimers();setTimeout(()=>{const _=this.painter.queryGpuTimers(m);this.fire(new c.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 c.Event("idle")),!this._loaded||this._fullyLoaded||p||(this._fullyLoaded=!0,c.PerformanceUtils.mark(c.PerformanceMarkers.fullLoad)),this}redraw(){return this.style&&(this._frame&&(this._frame.cancel(),this._frame=null),this._render(0)),this}remove(){this._hash&&this._hash.remove();for(const t of this._controls)t.onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&(removeEventListener("resize",this._onWindowResize,!1),removeEventListener("orientationchange",this._onWindowResize,!1),removeEventListener("online",this._onWindowOnline,!1));const o=this.painter.context.gl.getExtension("WEBGL_lose_context");o&&o.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),K.remove(this._canvasContainer),K.remove(this._controlContainer),this._cooperativeGestures&&K.remove(this._cooperativeGesturesScreen),this._container.classList.remove("maplibregl-map"),c.PerformanceUtils.clearMetrics(),this._removed=!0,this.fire(new c.Event("remove"))}triggerRepaint(){this.style&&!this._frame&&(this._frame=c.exported.frame(o=>{c.PerformanceUtils.frame(o),this._frame=null,this._render(o)}))}_onWindowOnline(){this._update()}_onWindowResize(o){this._trackResize&&this.resize({originalEvent:o})._update()}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(o){this._showTileBoundaries!==o&&(this._showTileBoundaries=o,this._update())}get showPadding(){return!!this._showPadding}set showPadding(o){this._showPadding!==o&&(this._showPadding=o,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(o){this._showCollisionBoxes!==o&&(this._showCollisionBoxes=o,o?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(o){this._showOverdrawInspector!==o&&(this._showOverdrawInspector=o,this._update())}get repaint(){return!!this._repaint}set repaint(o){this._repaint!==o&&(this._repaint=o,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(o){this._vertices=o,this._update()}_setCacheLimits(o,t){c.setCacheLimits(o,t)}get version(){return Xe}getCameraTargetElevation(){return this.transform.elevation}},NavigationControl:class{constructor(o){this.options=c.extend({},Wa,o),this._container=K.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",t=>t.preventDefault()),this.options.showZoom&&(c.bindAll(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",t=>this._map.zoomIn({},{originalEvent:t})),K.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",t=>this._map.zoomOut({},{originalEvent:t})),K.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(c.bindAll(["_rotateCompassArrow"],this),this._compass=this._createButton("maplibregl-ctrl-compass",t=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:t}):this._map.resetNorth({},{originalEvent:t})}),this._compassIcon=K.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){const o=this._map.getZoom(),t=o===this._map.getMaxZoom(),n=o===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 o=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=o}onAdd(o){return this._map=o,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 Ha(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){K.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(o,t){const n=K.create("button",o,this._container);return n.type="button",n.addEventListener("click",t),n}_setButtonTitle(o,t){const n=this._map._getUIString(`NavigationControl.${t}`);o.title=n,o.setAttribute("aria-label",n)}},GeolocateControl:class extends c.Evented{constructor(o){super(),this.options=c.extend({},Ks,o),c.bindAll(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker"],this)}onAdd(o){var t;return this._map=o,this._container=K.create("div","maplibregl-ctrl maplibregl-ctrl-group"),t=this._setupUI,zt!==void 0?t(zt):window.navigator.permissions!==void 0?window.navigator.permissions.query({name:"geolocation"}).then(n=>{zt=n.state!=="denied",t(zt)}):(zt=!!window.navigator.geolocation,t(zt)),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(),K.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,Wt=0,Mn=!1}_isOutOfMapMaxBounds(o){const t=this._map.getMaxBounds(),n=o.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"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_onSuccess(o){if(this._map){if(this._isOutOfMapMaxBounds(o))return this._setErrorState(),this.fire(new c.Event("outofmaxbounds",o)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=o,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(o),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(o),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new c.Event("geolocate",o)),this._finish()}}_updateCamera(o){const t=new c.LngLat(o.coords.longitude,o.coords.latitude),n=o.coords.accuracy,a=this._map.getBearing(),h=c.extend({bearing:a},this.options.fitBoundsOptions);this._map.fitBounds(t.toBounds(n),h,{geolocateSource:!0})}_updateMarker(o){if(o){const t=new c.LngLat(o.coords.longitude,o.coords.latitude);this._accuracyCircleMarker.setLngLat(t).addTo(this._map),this._userLocationDotMarker.setLngLat(t).addTo(this._map),this._accuracy=o.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){const o=this._map._container.clientHeight/2,t=this._map.unproject([0,o]),n=this._map.unproject([1,o]),a=t.distanceTo(n),h=Math.ceil(2*this._accuracy/a);this._circleElement.style.width=`${h}px`,this._circleElement.style.height=`${h}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}_onError(o){if(this._map){if(this.options.trackUserLocation)if(o.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._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(o.code===3&&Mn)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new c.Event("error",o)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(o){if(this._container.addEventListener("contextmenu",t=>t.preventDefault()),this._geolocateButton=K.create("button","maplibregl-ctrl-geolocate",this._container),K.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",o===!1){c.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=K.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new Ka(this._dotElement),this._circleElement=K.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Ka({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"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new c.Event("trackuserlocationend")))})}trigger(){if(!this._setup)return c.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 c.Event("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":Wt--,Mn=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this.fire(new c.Event("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new c.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"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let o;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),Wt++,Wt>1?(o={maximumAge:6e5,timeout:0},Mn=!0):(o=this.options.positionOptions,Mn=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,o)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},AttributionControl:ji,LogoControl:Vt,ScaleControl:class{constructor(o){this.options=c.extend({},ps,o),c.bindAll(["_onMove","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_onMove(){ds(this._map,this._container,this.options)}onAdd(o){return this._map=o,this._container=K.create("div","maplibregl-ctrl maplibregl-ctrl-scale",o.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){K.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}setUnit(o){this.options.unit=o,ds(this._map,this._container,this.options)}},FullscreenControl:class{constructor(o={}){this._onFullscreenChange=()=>{(window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement)===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,o&&o.container&&(o.container instanceof HTMLElement?this._container=o.container:c.warnOnce("Full screen control 'container' must be a DOM element.")),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(o){return this._map=o,this._container||(this._container=this._map.getContainer()),this._controlContainer=K.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){K.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const o=this._fullscreenButton=K.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);K.create("span","maplibregl-ctrl-icon",o).setAttribute("aria-hidden","true"),o.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const o=this._getTitle();this._fullscreenButton.setAttribute("aria-label",o),this._fullscreenButton.title=o}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle()}_exitFullscreen(){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._togglePseudoFullScreen()}_requestFullscreen(){this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}},TerrainControl:class{constructor(o){this.options=o,c.bindAll(["_toggleTerrain","_updateTerrainIcon"],this)}onAdd(o){return this._map=o,this._container=K.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=K.create("button","maplibregl-ctrl-terrain",this._container),K.create("span","maplibregl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){K.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"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.disableTerrain")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.enableTerrain"))}},Popup:class extends c.Evented{constructor(o){super(),this.options=c.extend(Object.create(Ja),o),c.bindAll(["_update","_onClose","remove","_onMouseMove","_onMouseUp","_onDrag"],this)}addTo(o){return this._map&&this.remove(),this._map=o,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"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new c.Event("open")),this}isOpen(){return!!this._map}remove(){return this._content&&K.remove(this._content),this._container&&(K.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 c.Event("close")),this}getLngLat(){return this._lngLat}setLngLat(o){return this._lngLat=c.LngLat.convert(o),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"),this._map._canvasContainer.classList.remove("maplibregl-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"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(o){return this.setDOMContent(document.createTextNode(o))}setHTML(o){const t=document.createDocumentFragment(),n=document.createElement("body");let a;for(n.innerHTML=o;a=n.firstChild,a;)t.appendChild(a);return this.setDOMContent(t)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(o){return this.options.maxWidth=o,this._update(),this}setDOMContent(o){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=K.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(o),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(o){this._container&&this._container.classList.add(o)}removeClassName(o){this._container&&this._container.classList.remove(o)}setOffset(o){return this.options.offset=o,this._update(),this}toggleClassName(o){if(this._container)return this._container.classList.toggle(o)}_createCloseButton(){this.options.closeButton&&(this._closeButton=K.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_onMouseUp(o){this._update(o.point)}_onMouseMove(o){this._update(o.point)}_onDrag(o){this._update(o.point)}_update(o){if(!this._map||!this._lngLat&&!this._trackPointer||!this._content||(this._container||(this._container=K.create("div","maplibregl-popup",this._map.getContainer()),this._tip=K.create("div","maplibregl-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")),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=Si(this._lngLat,this._pos,this._map.transform)),this._trackPointer&&!o))return;const t=this._pos=this._trackPointer&&o?o:this._map.project(this._lngLat);let n=this.options.anchor;const a=Pn(this.options.offset);if(!n){const p=this._container.offsetWidth,m=this._container.offsetHeight;let _;_=t.y+a.bottom.y<m?["top"]:t.y>this._map.transform.height-m?["bottom"]:[],t.x<p/2?_.push("left"):t.x>this._map.transform.width-p/2&&_.push("right"),n=_.length===0?"bottom":_.join("-")}const h=t.add(a[n]).round();K.setTransform(this._container,`${Cn[n]} translate(${h.x}px,${h.y}px)`),cr(this._container,n,"popup")}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const o=this._container.querySelector(Ya);o&&o.focus()}_onClose(){this.remove()}},Marker:Ka,Style:ui,LngLat:c.LngLat,LngLatBounds:c.LngLatBounds,Point:c.pointGeometry,MercatorCoordinate:c.MercatorCoordinate,Evented:c.Evented,AJAXError:c.AJAXError,config:c.config,CanvasSource:Ur,GeoJSONSource:Or,ImageSource:ki,RasterDEMTileSource:sr,RasterTileSource:hn,VectorTileSource:cn,VideoSource:Zr,prewarm:function(){Xr().acquire(Ir)},clearPrewarmedResources:function(){const o=Oi;o&&(o.isPreloaded()&&o.numActive()===1?(o.release(Ir),Oi=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 Qa},get workerCount(){return ar.workerCount},set workerCount(o){ar.workerCount=o},get maxParallelImageRequests(){return c.config.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(o){c.config.MAX_PARALLEL_IMAGE_REQUESTS=o},clearStorage(o){c.clearTileCache(o)},workerUrl:"",addProtocol(o,t){c.config.REGISTERED_PROTOCOLS[o]=t},removeProtocol(o){delete c.config.REGISTERED_PROTOCOLS[o]}};return Za.extend(ms,{isSafari:c.isSafari,getPerformanceMetrics:c.PerformanceUtils.getPerformanceMetrics}),ms});var ne=ie;return ne})})(Qc);var gr=_p(Qc.exports);const eh="3.7.4",yp=eh,xp=typeof atob=="function",vp=typeof btoa=="function",bs=typeof Buffer=="function",th=typeof TextDecoder=="function"?new TextDecoder:void 0,ih=typeof TextEncoder=="function"?new TextEncoder:void 0,bp="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",la=Array.prototype.slice.call(bp),yo=(C=>{let b={};return C.forEach((k,Z)=>b[k]=Z),b})(la),wp=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,vi=String.fromCharCode.bind(String),rh=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):(C,b=k=>k)=>new Uint8Array(Array.prototype.slice.call(C,0).map(b)),nh=C=>C.replace(/=/g,"").replace(/[+\/]/g,b=>b=="+"?"-":"_"),sh=C=>C.replace(/[^A-Za-z0-9\+\/]/g,""),ah=C=>{let b,k,Z,ie,de="";const ne=C.length%3;for(let c=0;c<C.length;){if((k=C.charCodeAt(c++))>255||(Z=C.charCodeAt(c++))>255||(ie=C.charCodeAt(c++))>255)throw new TypeError("invalid character found");b=k<<16|Z<<8|ie,de+=la[b>>18&63]+la[b>>12&63]+la[b>>6&63]+la[b&63]}return ne?de.slice(0,ne-3)+"===".substring(ne):de},Rl=vp?C=>btoa(C):bs?C=>Buffer.from(C,"binary").toString("base64"):ah,Bl=bs?C=>Buffer.from(C).toString("base64"):C=>{let k=[];for(let Z=0,ie=C.length;Z<ie;Z+=4096)k.push(vi.apply(null,C.subarray(Z,Z+4096)));return Rl(k.join(""))},xo=(C,b=!1)=>b?nh(Bl(C)):Bl(C),Tp=C=>{if(C.length<2){var b=C.charCodeAt(0);return b<128?C:b<2048?vi(192|b>>>6)+vi(128|b&63):vi(224|b>>>12&15)+vi(128|b>>>6&63)+vi(128|b&63)}else{var b=65536+(C.charCodeAt(0)-55296)*1024+(C.charCodeAt(1)-56320);return vi(240|b>>>18&7)+vi(128|b>>>12&63)+vi(128|b>>>6&63)+vi(128|b&63)}},Sp=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,oh=C=>C.replace(Sp,Tp),lh=bs?C=>Buffer.from(C,"utf8").toString("base64"):ih?C=>Bl(ih.encode(C)):C=>Rl(oh(C)),ws=(C,b=!1)=>b?nh(lh(C)):lh(C),ch=C=>ws(C,!0),Ep=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,Ip=C=>{switch(C.length){case 4:var b=(7&C.charCodeAt(0))<<18|(63&C.charCodeAt(1))<<12|(63&C.charCodeAt(2))<<6|63&C.charCodeAt(3),k=b-65536;return vi((k>>>10)+55296)+vi((k&1023)+56320);case 3:return vi((15&C.charCodeAt(0))<<12|(63&C.charCodeAt(1))<<6|63&C.charCodeAt(2));default:return vi((31&C.charCodeAt(0))<<6|63&C.charCodeAt(1))}},hh=C=>C.replace(Ep,Ip),uh=C=>{if(C=C.replace(/\s+/g,""),!wp.test(C))throw new TypeError("malformed base64.");C+="==".slice(2-(C.length&3));let b,k="",Z,ie;for(let de=0;de<C.length;)b=yo[C.charAt(de++)]<<18|yo[C.charAt(de++)]<<12|(Z=yo[C.charAt(de++)])<<6|(ie=yo[C.charAt(de++)]),k+=Z===64?vi(b>>16&255):ie===64?vi(b>>16&255,b>>8&255):vi(b>>16&255,b>>8&255,b&255);return k},Fl=xp?C=>atob(sh(C)):bs?C=>Buffer.from(C,"base64").toString("binary"):uh,ph=bs?C=>rh(Buffer.from(C,"base64")):C=>rh(Fl(C),b=>b.charCodeAt(0)),dh=C=>ph(mh(C)),Ap=bs?C=>Buffer.from(C,"base64").toString("utf8"):th?C=>th.decode(ph(C)):C=>hh(Fl(C)),mh=C=>sh(C.replace(/[-_]/g,b=>b=="-"?"+":"/")),Ol=C=>Ap(mh(C)),Cp=C=>{if(typeof C!="string")return!1;const b=C.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(b)||!/[^\s0-9a-zA-Z\-_]/.test(b)},fh=C=>({value:C,enumerable:!1,writable:!0,configurable:!0}),gh=function(){const C=(b,k)=>Object.defineProperty(String.prototype,b,fh(k));C("fromBase64",function(){return Ol(this)}),C("toBase64",function(b){return ws(this,b)}),C("toBase64URI",function(){return ws(this,!0)}),C("toBase64URL",function(){return ws(this,!0)}),C("toUint8Array",function(){return dh(this)})},_h=function(){const C=(b,k)=>Object.defineProperty(Uint8Array.prototype,b,fh(k));C("toBase64",function(b){return xo(this,b)}),C("toBase64URI",function(){return xo(this,!0)}),C("toBase64URL",function(){return xo(this,!0)})},Mp={version:eh,VERSION:yp,atob:Fl,atobPolyfill:uh,btoa:Rl,btoaPolyfill:ah,fromBase64:Ol,toBase64:ws,encode:ws,encodeURI:ch,encodeURL:ch,utob:oh,btou:hh,decode:Ol,isValid:Cp,fromUint8Array:xo,toUint8Array:dh,extendString:gh,extendUint8Array:_h,extendBuiltins:()=>{gh(),_h()}};let vo;const Pp=new Uint8Array(16);function kp(){if(!vo&&(vo=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!vo))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return vo(Pp)}const bi=[];for(let C=0;C<256;++C)bi.push((C+256).toString(16).slice(1));function zp(C,b=0){return(bi[C[b+0]]+bi[C[b+1]]+bi[C[b+2]]+bi[C[b+3]]+"-"+bi[C[b+4]]+bi[C[b+5]]+"-"+bi[C[b+6]]+bi[C[b+7]]+"-"+bi[C[b+8]]+bi[C[b+9]]+"-"+bi[C[b+10]]+bi[C[b+11]]+bi[C[b+12]]+bi[C[b+13]]+bi[C[b+14]]+bi[C[b+15]]).toLowerCase()}var yh={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function Lp(C,b,k){if(yh.randomUUID&&!b&&!C)return yh.randomUUID();C=C||{};const Z=C.random||(C.rng||kp)();if(Z[6]=Z[6]&15|64,Z[8]=Z[8]&63|128,b){k=k||0;for(let ie=0;ie<16;++ie)b[k+ie]=Z[ie];return b}return zp(Z)}var Ul={exports:{}},Ts=typeof Reflect=="object"?Reflect:null,xh=Ts&&typeof Ts.apply=="function"?Ts.apply:function(b,k,Z){return Function.prototype.apply.call(b,k,Z)},bo;Ts&&typeof Ts.ownKeys=="function"?bo=Ts.ownKeys:Object.getOwnPropertySymbols?bo=function(b){return Object.getOwnPropertyNames(b).concat(Object.getOwnPropertySymbols(b))}:bo=function(b){return Object.getOwnPropertyNames(b)};function Dp(C){console&&console.warn&&console.warn(C)}var vh=Number.isNaN||function(b){return b!==b};function Lt(){Lt.init.call(this)}Ul.exports=Lt,Ul.exports.once=Op,Lt.EventEmitter=Lt,Lt.prototype._events=void 0,Lt.prototype._eventsCount=0,Lt.prototype._maxListeners=void 0;var bh=10;function wo(C){if(typeof C!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof C)}Object.defineProperty(Lt,"defaultMaxListeners",{enumerable:!0,get:function(){return bh},set:function(C){if(typeof C!="number"||C<0||vh(C))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+C+".");bh=C}}),Lt.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},Lt.prototype.setMaxListeners=function(b){if(typeof b!="number"||b<0||vh(b))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+b+".");return this._maxListeners=b,this};function wh(C){return C._maxListeners===void 0?Lt.defaultMaxListeners:C._maxListeners}Lt.prototype.getMaxListeners=function(){return wh(this)},Lt.prototype.emit=function(b){for(var k=[],Z=1;Z<arguments.length;Z++)k.push(arguments[Z]);var ie=b==="error",de=this._events;if(de!==void 0)ie=ie&&de.error===void 0;else if(!ie)return!1;if(ie){var ne;if(k.length>0&&(ne=k[0]),ne instanceof Error)throw ne;var c=new Error("Unhandled error."+(ne?" ("+ne.message+")":""));throw c.context=ne,c}var ve=de[b];if(ve===void 0)return!1;if(typeof ve=="function")xh(ve,this,k);else for(var Ke=ve.length,lt=Ah(ve,Ke),Z=0;Z<Ke;++Z)xh(lt[Z],this,k);return!0};function Th(C,b,k,Z){var ie,de,ne;if(wo(k),de=C._events,de===void 0?(de=C._events=Object.create(null),C._eventsCount=0):(de.newListener!==void 0&&(C.emit("newListener",b,k.listener?k.listener:k),de=C._events),ne=de[b]),ne===void 0)ne=de[b]=k,++C._eventsCount;else if(typeof ne=="function"?ne=de[b]=Z?[k,ne]:[ne,k]:Z?ne.unshift(k):ne.push(k),ie=wh(C),ie>0&&ne.length>ie&&!ne.warned){ne.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+ne.length+" "+String(b)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=C,c.type=b,c.count=ne.length,Dp(c)}return C}Lt.prototype.addListener=function(b,k){return Th(this,b,k,!1)},Lt.prototype.on=Lt.prototype.addListener,Lt.prototype.prependListener=function(b,k){return Th(this,b,k,!0)};function Rp(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function Sh(C,b,k){var Z={fired:!1,wrapFn:void 0,target:C,type:b,listener:k},ie=Rp.bind(Z);return ie.listener=k,Z.wrapFn=ie,ie}Lt.prototype.once=function(b,k){return wo(k),this.on(b,Sh(this,b,k)),this},Lt.prototype.prependOnceListener=function(b,k){return wo(k),this.prependListener(b,Sh(this,b,k)),this},Lt.prototype.removeListener=function(b,k){var Z,ie,de,ne,c;if(wo(k),ie=this._events,ie===void 0)return this;if(Z=ie[b],Z===void 0)return this;if(Z===k||Z.listener===k)--this._eventsCount===0?this._events=Object.create(null):(delete ie[b],ie.removeListener&&this.emit("removeListener",b,Z.listener||k));else if(typeof Z!="function"){for(de=-1,ne=Z.length-1;ne>=0;ne--)if(Z[ne]===k||Z[ne].listener===k){c=Z[ne].listener,de=ne;break}if(de<0)return this;de===0?Z.shift():Bp(Z,de),Z.length===1&&(ie[b]=Z[0]),ie.removeListener!==void 0&&this.emit("removeListener",b,c||k)}return this},Lt.prototype.off=Lt.prototype.removeListener,Lt.prototype.removeAllListeners=function(b){var k,Z,ie;if(Z=this._events,Z===void 0)return this;if(Z.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):Z[b]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete Z[b]),this;if(arguments.length===0){var de=Object.keys(Z),ne;for(ie=0;ie<de.length;++ie)ne=de[ie],ne!=="removeListener"&&this.removeAllListeners(ne);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(k=Z[b],typeof k=="function")this.removeListener(b,k);else if(k!==void 0)for(ie=k.length-1;ie>=0;ie--)this.removeListener(b,k[ie]);return this};function Eh(C,b,k){var Z=C._events;if(Z===void 0)return[];var ie=Z[b];return ie===void 0?[]:typeof ie=="function"?k?[ie.listener||ie]:[ie]:k?Fp(ie):Ah(ie,ie.length)}Lt.prototype.listeners=function(b){return Eh(this,b,!0)},Lt.prototype.rawListeners=function(b){return Eh(this,b,!1)},Lt.listenerCount=function(C,b){return typeof C.listenerCount=="function"?C.listenerCount(b):Ih.call(C,b)},Lt.prototype.listenerCount=Ih;function Ih(C){var b=this._events;if(b!==void 0){var k=b[C];if(typeof k=="function")return 1;if(k!==void 0)return k.length}return 0}Lt.prototype.eventNames=function(){return this._eventsCount>0?bo(this._events):[]};function Ah(C,b){for(var k=new Array(b),Z=0;Z<b;++Z)k[Z]=C[Z];return k}function Bp(C,b){for(;b+1<C.length;b++)C[b]=C[b+1];C.pop()}function Fp(C){for(var b=new Array(C.length),k=0;k<b.length;++k)b[k]=C[k].listener||C[k];return b}function Op(C,b){return new Promise(function(k,Z){function ie(ne){C.removeListener(b,de),Z(ne)}function de(){typeof C.removeListener=="function"&&C.removeListener("error",ie),k([].slice.call(arguments))}Ch(C,b,de,{once:!0}),b!=="error"&&Up(C,ie,{once:!0})})}function Up(C,b,k){typeof C.on=="function"&&Ch(C,"error",b,k)}function Ch(C,b,k,Z){if(typeof C.on=="function")Z.once?C.once(b,k):C.on(b,k);else if(typeof C.addEventListener=="function")C.addEventListener(b,function ie(de){Z.once&&C.removeEventListener(b,ie),k(de)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof C)}const zr={AUTO:"auto",LATIN:"latin",NON_LATIN:"nonlatin",LOCAL:"",ALBANIAN:"sq",AMHARIC:"am",ARABIC:"ar",ARMENIAN:"hy",AZERBAIJANI:"az",BASQUE:"eu",BELORUSSIAN:"be",BOSNIAN:"bs",BRETON:"br",BULGARIAN:"bg",CATALAN:"ca",CHINESE:"zh",CORSICAN:"co",CROATIAN:"hr",CZECH:"cs",DANISH:"da",DUTCH:"nl",ENGLISH:"en",ESPERANTO:"eo",ESTONIAN:"et",FINNISH:"fi",FRENCH:"fr",FRISIAN:"fy",GEORGIAN:"ka",GERMAN:"de",GREEK:"el",HEBREW:"he",HINDI:"hi",HUNGARIAN:"hu",ICELANDIC:"is",INDONESIAN:"id",IRISH:"ga",ITALIAN:"it",JAPANESE:"ja",JAPANESE_HIRAGANA:"ja-Hira",JAPANESE_KANA:"ja_kana",JAPANESE_LATIN:"ja_rm",JAPANESE_2018:"ja-Latn",KANNADA:"kn",KAZAKH:"kk",KOREAN:"ko",KOREAN_LATIN:"ko-Latn",KURDISH:"ku",ROMAN_LATIN:"la",LATVIAN:"lv",LITHUANIAN:"lt",LUXEMBOURGISH:"lb",MACEDONIAN:"mk",MALAYALAM:"ml",MALTESE:"mt",NORWEGIAN:"no",OCCITAN:"oc",POLISH:"pl",PORTUGUESE:"pt",ROMANIAN:"ro",ROMANSH:"rm",RUSSIAN:"ru",SCOTTISH_GAELIC:"gd",SERBIAN_CYRILLIC:"sr",SERBIAN_LATIN:"sr-Latn",SLOVAK:"sk",SLOVENE:"sl",SPANISH:"es",SWEDISH:"sv",TAMIL:"ta",TELUGU:"te",THAI:"th",TURKISH:"tr",UKRAINIAN:"uk",WELSH:"cy"},Vp=new Set(Object.values(zr));function Mh(C){return Vp.has(C)}const Np=new Set(Object.values(zr));function Vl(){if(typeof navigator>"u")return Intl.DateTimeFormat().resolvedOptions().locale.split("-")[0];const C=Array.from(new Set(navigator.languages.map(b=>b.split("-")[0]))).filter(b=>Np.has(b));return C.length?C[0]:zr.LATIN}function $p(){return typeof self<"u"?fetch.bind(self):typeof global<"u"&&global.fetch?global.fetch:null}class jp{constructor(){this._apiKey="",this._fetch=$p()}set apiKey(b){this._apiKey=b}get apiKey(){return this._apiKey}set fetch(b){this._fetch=b}get fetch(){return this._fetch}}const Hi=new jp,Ss={AUTO:"auto",ALBANIAN:"sq",ARABIC:"ar",ARMENIAN:"hy",AZERBAIJANI:"az",BELORUSSIAN:"be",BOSNIAN:"bs",BRETON:"br",BULGARIAN:"bg",CATALAN:"ca",CHINESE:"zh",CROATIAN:"hr",CZECH:"cs",DANISH:"da",DUTCH:"nl",ENGLISH:"en",ESPERANTO:"eo",ESTONIAN:"et",FINNISH:"fi",FRENCH:"fr",FRISIAN:"fy",GEORGIAN:"ka",GERMAN:"de",GREEK:"el",HEBREW:"he",HUNGARIAN:"hu",ICELANDIC:"is",IRISH:"ga",ITALIAN:"it",JAPANESE:"ja",KANNADA:"kn",KAZAKH:"kk",KOREAN:"ko",ROMAN_LATIN:"la",LATVIAN:"lv",LITHUANIAN:"lt",LUXEMBOURGISH:"lb",MACEDONIAN:"mk",MALTESE:"mt",NORWEGIAN:"no",POLISH:"pl",PORTUGUESE:"pt",ROMANIAN:"ro",ROMANSH:"rm",RUSSIAN:"ru",SCOTTISH_GAELIC:"gd",SERBIAN_CYRILLIC:"sr",SLOVAK:"sk",SLOVENE:"sl",SPANISH:"es",SWEDISH:"sv",THAI:"th",TURKISH:"tr",UKRAINIAN:"uk",WELSH:"cy"},Gp=new Set(Object.values(Ss));function Ph(){if(typeof navigator>"u")return Intl.DateTimeFormat().resolvedOptions().locale.split("-")[0];const C=Array.from(new Set(navigator.languages.map(b=>b.split("-")[0]))).filter(b=>Gp.has(b));return C.length?C[0]:Ss.ENGLISH}var qp=(C,b,k)=>new Promise((Z,ie)=>{var de=ve=>{try{c(k.next(ve))}catch(Ke){ie(Ke)}},ne=ve=>{try{c(k.throw(ve))}catch(Ke){ie(Ke)}},c=ve=>ve.done?Z(ve.value):Promise.resolve(ve.value).then(de,ne);c((k=k.apply(C,b)).next())});function Es(C){return qp(this,arguments,function*(b,k={}){if(Hi.fetch===null)throw new Error("The fetch function was not found. If on NodeJS < 18 please specify the fetch function with config.fetch");if(new URL(b).searchParams.get("key").trim()==="")throw new Error("The MapTiler Cloud API key is missing. Set it in `config.apiKey` or get one for free at https://maptiler.com");return Hi.fetch(b,k)})}const Lr={maptilerApiURL:"https://api.maptiler.com/",mapStyle:"streets-v2"};Object.freeze(Lr);class On extends Error{constructor(b,k=""){super(`Call to enpoint ${b.url} failed with the status code ${b.status}. ${k}`),this.res=b}}var kh=(C,b,k)=>new Promise((Z,ie)=>{var de=ve=>{try{c(k.next(ve))}catch(Ke){ie(Ke)}},ne=ve=>{try{c(k.throw(ve))}catch(Ke){ie(Ke)}},c=ve=>ve.done?Z(ve.value):Promise.resolve(ve.value).then(de,ne);c((k=k.apply(C,b)).next())});const To={400:"Query too long / Invalid parameters",403:"Key is missing, invalid or restricted"};function Zp(C){return kh(this,arguments,function*(b,k={}){var Z;if(typeof b!="string"||b.trim().length===0)throw new Error("The query must be a non-empty string");const ie=new URL(`geocoding/${encodeURIComponent(b)}.json`,Lr.maptilerApiURL);if(ie.searchParams.set("key",(Z=k.apiKey)!=null?Z:Hi.apiKey),"bbox"in k&&ie.searchParams.set("bbox",k.bbox.join(",")),"proximity"in k&&ie.searchParams.set("proximity",k.proximity.join(",")),"language"in k){const ve=Array.from(new Set((Array.isArray(k.language)?k.language:[k.language]).map(Ke=>Ke===Ss.AUTO?Ph():Ke))).join(",");ie.searchParams.set("language",ve)}const de=ie.toString(),ne=yield Es(de);if(!ne.ok)throw new On(ne,ne.status in To?To[ne.status]:"");return yield ne.json()})}function Xp(C){return kh(this,arguments,function*(b,k={}){var Z;if(!Array.isArray(b)||b.length<2)throw new Error("The position must be an array of form [lng, lat].");const ie=new URL(`geocoding/${b[0]},${b[1]}.json`,Lr.maptilerApiURL);if(ie.searchParams.set("key",(Z=k.apiKey)!=null?Z:Hi.apiKey),"language"in k){const ve=Array.from(new Set((Array.isArray(k.language)?k.language:[k.language]).map(Ke=>Ke===Ss.AUTO?Ph():Ke))).join(",");ie.searchParams.set("language",ve)}const de=ie.toString(),ne=yield Es(de);if(!ne.ok)throw new On(ne,ne.status in To?To[ne.status]:"");return yield ne.json()})}const Wp={forward:Zp,reverse:Xp,language:Ss};var Hp=(C,b,k)=>new Promise((Z,ie)=>{var de=ve=>{try{c(k.next(ve))}catch(Ke){ie(Ke)}},ne=ve=>{try{c(k.throw(ve))}catch(Ke){ie(Ke)}},c=ve=>ve.done?Z(ve.value):Promise.resolve(ve.value).then(de,ne);c((k=k.apply(C,b)).next())});const zh={403:"Key is missing, invalid or restricted"};function Kp(){return Hp(this,arguments,function*(C={}){var b;const k=new URL("geolocation/ip.json",Lr.maptilerApiURL);k.searchParams.set("key",(b=C.apiKey)!=null?b:Hi.apiKey);const Z=k.toString(),ie=yield Es(Z);if(!ie.ok)throw new On(ie,ie.status in zh?zh[ie.status]:"");return yield ie.json()})}const Nl={info:Kp};var Lh=(C,b,k)=>new Promise((Z,ie)=>{var de=ve=>{try{c(k.next(ve))}catch(Ke){ie(Ke)}},ne=ve=>{try{c(k.throw(ve))}catch(Ke){ie(Ke)}},c=ve=>ve.done?Z(ve.value):Promise.resolve(ve.value).then(de,ne);c((k=k.apply(C,b)).next())});const So={403:"Key is missing, invalid or restricted"};function Jp(C){return Lh(this,arguments,function*(b,k={}){var Z;if(typeof b!="string"||b.trim().length===0)throw new Error("The query must be a non-empty string");const ie=new URL(`coordinates/search/${b}.json`,Lr.maptilerApiURL);ie.searchParams.set("key",(Z=k.apiKey)!=null?Z:Hi.apiKey),"limit"in k&&ie.searchParams.set("limit",k.limit.toString()),"transformations"in k&&ie.searchParams.set("transformations",k.transformations.toString()),"exports"in k&&ie.searchParams.set("exports",k.exports.toString());const de=ie.toString(),ne=yield Es(de);if(!ne.ok)throw new On(ne,ne.status in So?So[ne.status]:"");return yield ne.json()})}function Yp(C){return Lh(this,arguments,function*(b,k={}){var Z;const ie=(Array.isArray(b[0])?b:[b]).map(Ke=>`${Ke[0]},${Ke[1]}`).join(";"),de=new URL(`coordinates/transform/${ie}.json`,Lr.maptilerApiURL);de.searchParams.set("key",(Z=k.apiKey)!=null?Z:Hi.apiKey),"sourceCrs"in k&&de.searchParams.set("s_srs",k.sourceCrs.toString()),"targetCrs"in k&&de.searchParams.set("t_srs",k.targetCrs.toString()),"operations"in k&&de.searchParams.set("ops",(Array.isArray(k.operations)?k.operations:[k.operations]).join("|"));const ne=de.toString(),c=yield Es(ne);if(!c.ok)throw new On(c,c.status in So?So[c.status]:"");return yield c.json()})}const Qp={search:Jp,transform:Yp};var ed=(C,b,k)=>new Promise((Z,ie)=>{var de=ve=>{try{c(k.next(ve))}catch(Ke){ie(Ke)}},ne=ve=>{try{c(k.throw(ve))}catch(Ke){ie(Ke)}},c=ve=>ve.done?Z(ve.value):Promise.resolve(ve.value).then(de,ne);c((k=k.apply(C,b)).next())});const Dh={403:"Key is missing, invalid or restricted"};function td(C){return ed(this,arguments,function*(b,k={}){var Z;if(typeof b!="string"||b.trim().length===0)throw new Error("The data ID must be a non-empty string");const ie=new URL(`data/${encodeURIComponent(b)}/features.json`,Lr.maptilerApiURL);ie.searchParams.set("key",(Z=k.apiKey)!=null?Z:Hi.apiKey);const de=ie.toString(),ne=yield Es(de);if(!ne.ok)throw new On(ne,ne.status in Dh?Dh[ne.status]:"");return yield ne.json()})}const id={get:td};function Rh(C){const b=/^maptiler:\/\/(.*)/;let k;const Z=C.trim();let ie;return Z.startsWith("http://")||Z.startsWith("https://")?ie=Z:(k=b.exec(Z))!==null?ie=`https://api.maptiler.com/maps/${k[1]}/style.json`:ie=`https://api.maptiler.com/maps/${Z}/style.json`,ie}class Eo{constructor(b,k,Z,ie,de,ne){this.name=b,this.variantType=k,this.id=Z,this.referenceStyle=ie,this.description=de,this.imageURL=ne}getName(){return this.name}getFullName(){return`${this.referenceStyle.getName()} ${this.name}`}getType(){return this.variantType}getId(){return this.id}getDescription(){return this.description}getReferenceStyle(){return this.referenceStyle}hasVariant(b){return this.referenceStyle.hasVariant(b)}getVariant(b){return this.referenceStyle.getVariant(b)}getVariants(){return this.referenceStyle.getVariants().filter(b=>b!==this)}getImageURL(){return this.imageURL}getExpandedStyleURL(){return Rh(this.getId())}}class Io{constructor(b,k){this.name=b,this.id=k,this.variants={},this.orderedVariants=[]}getName(){return this.name}getId(){return this.id}addVariant(b){this.variants[b.getType()]=b,this.orderedVariants.push(b)}hasVariant(b){return b in this.variants}getVariant(b){return b in this.variants?this.variants[b]:this.orderedVariants[0]}getVariants(){return Object.values(this.variants)}getDefaultVariant(){return this.orderedVariants[0]}}const Ao=[{referenceStyleID:"STREETS",name:"Streets",description:"",variants:[{id:"streets-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"streets-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"streets-v2-light",name:"Light",variantType:"LIGHT",description:"",imageURL:""},{id:"streets-v2-pastel",name:"Pastel",variantType:"PASTEL",description:"",imageURL:""}]},{referenceStyleID:"OUTDOOR",name:"Outdoor",description:"",variants:[{id:"outdoor-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""}]},{referenceStyleID:"WINTER",name:"Winter",description:"",variants:[{id:"winter-v2",name:"Winter",variantType:"DEFAULT",description:"",imageURL:""}]},{referenceStyleID:"SATELLITE",name:"Satellite",description:"",variants:[{id:"satellite",name:"Default",variantType:"DEFAULT",description:"",imageURL:""}]},{referenceStyleID:"HYBRID",name:"Hybrid",description:"",variants:[{id:"hybrid",name:"Default",variantType:"DEFAULT",description:"",imageURL:""}]},{referenceStyleID:"BASIC",name:"Basic",description:"",variants:[{id:"basic-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"basic-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"basic-v2-light",name:"Light",variantType:"LIGHT",description:"",imageURL:""}]},{referenceStyleID:"BRIGHT",name:"Bright",description:"",variants:[{id:"bright-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"bright-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"bright-v2-light",name:"Light",variantType:"LIGHT",description:"",imageURL:""},{id:"bright-v2-pastel",name:"Pastel",variantType:"PASTEL",description:"",imageURL:""}]},{referenceStyleID:"OPENSTREETMAP",name:"OpenStreetMap",description:"",variants:[{id:"openstreetmap",name:"Default",variantType:"DEFAULT",description:"",imageURL:""}]},{referenceStyleID:"TOPO",name:"Topo",description:"",variants:[{id:"topo-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"topo-v2-shiny",name:"Shiny",variantType:"SHINY",description:"",imageURL:""},{id:"topo-v2-pastel",name:"Pastel",variantType:"PASTEL",description:"",imageURL:""},{id:"topo-v2-topographique",name:"Topographique",variantType:"TOPOGRAPHIQUE",description:"",imageURL:""}]},{referenceStyleID:"VOYAGER",name:"Voyager",description:"",variants:[{id:"voyager-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"voyager-v2-darkmatter",name:"Darkmatter",variantType:"DARK",description:"",imageURL:""},{id:"voyager-v2-positron",name:"Positron",variantType:"LIGHT",description:"",imageURL:""},{id:"voyager-v2-vintage",name:"Vintage",variantType:"VINTAGE",description:"",imageURL:""}]},{referenceStyleID:"TONER",name:"Toner",description:"",variants:[{id:"toner-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"toner-v2-background",name:"Background",variantType:"BACKGROUND",description:"",imageURL:""},{id:"toner-v2-lite",name:"Lite",variantType:"LITE",description:"",imageURL:""},{id:"toner-v2-lines",name:"Lines",variantType:"LINES",description:"",imageURL:""}]},{referenceStyleID:"DATAVIZ",name:"Dataviz",description:"",variants:[{id:"dataviz",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"dataviz-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"dataviz-light",name:"Light",variantType:"LIGHT",description:"",imageURL:""}]},{referenceStyleID:"OCEAN",name:"Ocean",description:"",variants:[{id:"ocean",name:"Default",variantType:"DEFAULT",description:"",imageURL:""}]}];function rd(C){return new Proxy(C,{get(b,k,Z){return b.hasVariant(k)?b.getVariant(k):k.toString().toUpperCase()===k?C.getDefaultVariant():Reflect.get(b,k,Z)}})}function nd(){const C={};for(let b=0;b<Ao.length;b+=1){const k=Ao[b],Z=rd(new Io(k.name,k.referenceStyleID));for(let ie=0;ie<k.variants.length;ie+=1){const de=k.variants[ie],ne=new Eo(de.name,de.variantType,de.id,Z,de.description,de.imageURL);Z.addVariant(ne)}C[k.referenceStyleID]=Z}return C}function $l(C){if(!C)return jl[Ao[0].referenceStyleID].getDefaultVariant().getId();if(typeof C=="string"||C instanceof String)return C.trim().toLowerCase();if(C instanceof Eo)return C.getId();if(C instanceof Io)return C.getDefaultVariant().getId()}const jl=nd();function sd(C,b,k){let Z=b[0],ie=b[1],de=k[0]-Z,ne=k[1]-ie;if(de!==0||ne!==0){const c=((C[0]-Z)*de+(C[1]-ie)*ne)/(de*de+ne*ne);c>1?(Z=k[0],ie=k[1]):c>0&&(Z+=de*c,ie+=ne*c)}return de=C[0]-Z,ne=C[1]-ie,de*de+ne*ne}function Gl(C,b,k,Z,ie){let de=Z,ne;for(let c=b+1;c<k;c++){const ve=sd(C[c],C[b],C[k]);ve>de&&(ne=c,de=ve)}de>Z&&(ne-b>1&&Gl(C,b,ne,Z,ie),ie.push(C[ne]),k-ne>1&&Gl(C,ne,k,Z,ie))}function ad(C,b){const k=C.length-1,Z=[C[0]];return Gl(C,0,k,b,Z),Z.push(C[k]),Z}function od(C,b){if(C.length<=2)return C;const k=b!==void 0?b*b:1;return ad(C,k)}function ql(C,b=!0){let k=`${C[0]},${C[1]}`;return C.length===3&&b&&(k+=`,${C[2]}`),k}function Zl(C,b=3e3){let k=C.map(de=>de.join(",")).join("|"),Z=5e-6;const ie=1e-5;for(;k.length>b;)k=od(C,Z).map(ne=>`${ne[0]},${ne[1]}`).join("|"),Z+=ie;return k}function ld(C,b,k={}){var Z,ie,de,ne,c;const ve=$l(k.style),Ke=k.hiDPI?"@2x":"",lt=(Z=k.format)!=null?Z:"png";let St=~~((ie=k.width)!=null?ie:1024),Me=~~((de=k.height)!=null?de:1024);k.hiDPI&&(St=~~(St/2),Me=~~(Me/2));const K=new URL(`maps/${encodeURIComponent(ve)}/static/${C[0]},${C[1]},${b}/${St}x${Me}${Ke}.${lt}`,Lr.maptilerApiURL);if("attribution"in k&&K.searchParams.set("attribution",k.attribution.toString()),"markers"in k){let Je="";const ti="markerIcon"in k;ti&&(Je+=`icon:${k.markerIcon}|`),ti&&"markerAnchor"in k&&(Je+=`anchor:${k.markerAnchor}|`),ti&&k.hiDPI&&(Je+="scale:2|"),Je+=(Array.isArray(k.markers[0])?k.markers:[k.markers]).map(Dt=>ql(Dt,!ti)).join("|"),K.searchParams.set("markers",Je)}if("path"in k){let Je="";Je+=`fill:${(ne=k.pathFillColor)!=null?ne:"none"}|`,"pathStrokeColor"in k&&(Je+=`stroke:${k.pathStrokeColor}|`),"pathWidth"in k&&(Je+=`width:${(k.pathWidth/(k.hiDPI?2:1)).toString()}|`),Je+=Zl(k.path),K.searchParams.set("path",Je)}return K.searchParams.set("key",(c=k.apiKey)!=null?c:Hi.apiKey),K.toString()}function cd(C,b={}){var k,Z,ie,de,ne;const c=$l(b.style),ve=b.hiDPI?"@2x":"",Ke=(k=b.format)!=null?k:"png";let lt=~~((Z=b.width)!=null?Z:1024),St=~~((ie=b.height)!=null?ie:1024);b.hiDPI&&(lt=~~(lt/2),St=~~(St/2));const Me=new URL(`maps/${encodeURIComponent(c)}/static/${C[0]},${C[1]},${C[2]},${C[3]}/${lt}x${St}${ve}.${Ke}`,Lr.maptilerApiURL);if("attribution"in b&&Me.searchParams.set("attribution",b.attribution.toString()),"padding"in b&&Me.searchParams.set("padding",b.padding.toString()),"markers"in b){let K="";const Je="markerIcon"in b;Je&&(K+=`icon:${b.markerIcon}|`),Je&&"markerAnchor"in b&&(K+=`anchor:${b.markerAnchor}|`),Je&&b.hiDPI&&(K+="scale:2|"),K+=(Array.isArray(b.markers[0])?b.markers:[b.markers]).map(Jt=>ql(Jt,!Je)).join("|"),Me.searchParams.set("markers",K)}if("path"in b){let K="";K+=`fill:${(de=b.pathFillColor)!=null?de:"none"}|`,"pathStrokeColor"in b&&(K+=`stroke:${b.pathStrokeColor}|`),"pathWidth"in b&&(K+=`width:${(b.pathWidth/(b.hiDPI?2:1)).toString()}|`),K+=Zl(b.path),Me.searchParams.set("path",K)}return Me.searchParams.set("key",(ne=b.apiKey)!=null?ne:Hi.apiKey),Me.toString()}function hd(C={}){var b,k,Z,ie,de;if(!("markers"in C)&&!("path"in C))throw new Error("Automatic static maps require markers and/or path to be created.");const ne=$l(C.style),c=C.hiDPI?"@2x":"",ve=(b=C.format)!=null?b:"png";let Ke=~~((k=C.width)!=null?k:1024),lt=~~((Z=C.height)!=null?Z:1024);C.hiDPI&&(Ke=~~(Ke/2),lt=~~(lt/2));const St=new URL(`maps/${encodeURIComponent(ne)}/static/auto/${Ke}x${lt}${c}.${ve}`,Lr.maptilerApiURL);if("attribution"in C&&St.searchParams.set("attribution",C.attribution.toString()),"padding"in C&&St.searchParams.set("padding",C.padding.toString()),"markers"in C){let Me="";const K="markerIcon"in C;K&&(Me+=`icon:${C.markerIcon}|`),K&&"markerAnchor"in C&&(Me+=`anchor:${C.markerAnchor}|`),K&&C.hiDPI&&(Me+="scale:2|"),Me+=(Array.isArray(C.markers[0])?C.markers:[C.markers]).map(ti=>ql(ti,!K)).join("|"),St.searchParams.set("markers",Me)}if("path"in C){let Me="";Me+=`fill:${(ie=C.pathFillColor)!=null?ie:"none"}|`,"pathStrokeColor"in C&&(Me+=`stroke:${C.pathStrokeColor}|`),"pathWidth"in C&&(Me+=`width:${(C.pathWidth/(C.hiDPI?2:1)).toString()}|`),Me+=Zl(C.path),St.searchParams.set("path",Me)}return St.searchParams.set("key",(de=C.apiKey)!=null?de:Hi.apiKey),St.toString()}const ud={centered:ld,bounded:cd,automatic:hd};class Bh extends Ul.exports{constructor(){super(),this.primaryLanguage=zr.AUTO,this.secondaryLanguage=null,this.session=!0,this._unit="metric",this._apiKey=""}set unit(b){this._unit=b,this.emit("unit",b)}get unit(){return this._unit}set apiKey(b){this._apiKey=b,Hi.apiKey=b,this.emit("apiKey",b)}get apiKey(){return this._apiKey}set fetch(b){Hi.fetch=b}get fetch(){return Hi.fetch}}const Fi=new Bh,Ki={maptilerLogoURL:"https://api.maptiler.com/resources/logo.svg",maptilerURL:"https://www.maptiler.com/",maptilerApiHost:"api.maptiler.com",rtlPluginURL:"https://cdn.maptiler.com/mapbox-gl-rtl-text/v0.2.3/mapbox-gl-rtl-text.min.js",primaryLanguage:zr.AUTO,secondaryLanguage:zr.LOCAL,terrainSourceURL:"https://api.maptiler.com/tiles/terrain-rgb-v2/tiles.json",terrainSourceId:"maptiler-terrain"};Object.freeze(Ki);class Fh extends gr.LogoControl{constructor(b={}){var k,Z;super(b),this.logoURL="",this.linkURL="",this.logoURL=(k=b.logoURL)!=null?k:Ki.maptilerLogoURL,this.linkURL=(Z=b.linkURL)!=null?Z:Ki.maptilerURL}onAdd(b){this._map=b,this._compact=this.options&&this.options.compact,this._container=window.document.createElement("div"),this._container.className="maplibregl-ctrl";const k=window.document.createElement("a");return k.style.backgroundRepeat="no-repeat",k.style.cursor="pointer",k.style.display="block",k.style.height="23px",k.style.margin="0 0 -4px -4px",k.style.overflow="hidden",k.style.width="88px",k.style.backgroundImage=`url(${this.logoURL})`,k.style.backgroundSize="100px 30px",k.style.width="100px",k.style.height="30px",k.target="_blank",k.rel="noopener nofollow",k.href=this.linkURL,k.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),k.setAttribute("rel","noopener nofollow"),this._container.appendChild(k),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}}function pd(){gr.getRTLTextPluginStatus()==="unavailable"&&gr.setRTLTextPlugin(Ki.rtlPluginURL,null,!0)}function dd(C,b){C.forEach(k=>{!b[k]||(b[k]=b[k].bind(b))})}function Un(C,b,k){const Z=window.document.createElement(C);return b!==void 0&&(Z.className=b),k&&k.appendChild(Z),Z}function md(C){C.parentNode&&C.parentNode.removeChild(C)}function Oh(C){return C?typeof C=="string"||C instanceof String?!C.startsWith("http")&&C.toLowerCase().includes(".json")?C:Rh(C):C instanceof Eo?C.getExpandedStyleURL():C instanceof Io?C.getDefaultVariant().getExpandedStyleURL():C:jl[Ao[0].referenceStyleID].getDefaultVariant().getExpandedStyleURL()}class fd{constructor(){dd(["_toggleTerrain","_updateTerrainIcon"],this)}onAdd(b){return this._map=b,this._container=Un("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=Un("button","maplibregl-ctrl-terrain",this._container),Un("span","maplibregl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){md(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}_toggleTerrain(){this._map.hasTerrain()?this._map.disableTerrain():this._map.enableTerrain(),this._updateTerrainIcon()}_updateTerrainIcon(){this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.hasTerrain()?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.disableTerrain")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.enableTerrain"))}}class gd extends gr.NavigationControl{constructor(){super({showCompass:!0,showZoom:!0,visualizePitch:!0}),this._compass.removeEventListener("click",this._compass.clickFunction),this._compass.addEventListener("click",b=>{this._map.getPitch()===0?this._map.easeTo({pitch:Math.min(this._map.getMaxPitch(),80)}):this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:b}):this._map.resetNorth({},{originalEvent:b})})}_createButton(b,k){const Z=super._createButton(b,k);return Z.clickFunction=k,Z}_rotateCompassArrow(){const b=this.options.visualizePitch?`scale(${Math.min(1.5,1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5))}) rotateX(${Math.min(70,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=b}}var _d=Object.defineProperty,yd=Object.defineProperties,xd=Object.getOwnPropertyDescriptors,Uh=Object.getOwnPropertySymbols,vd=Object.prototype.hasOwnProperty,bd=Object.prototype.propertyIsEnumerable,Vh=(C,b,k)=>b in C?_d(C,b,{enumerable:!0,configurable:!0,writable:!0,value:k}):C[b]=k,wd=(C,b)=>{for(var k in b||(b={}))vd.call(b,k)&&Vh(C,k,b[k]);if(Uh)for(var k of Uh(b))bd.call(b,k)&&Vh(C,k,b[k]);return C},Td=(C,b)=>yd(C,xd(b));const Sd=gr.GeolocateControl,Nh=gr.Marker,$h=gr.LngLat;class Ed extends Sd{constructor(){super(...arguments),this.lastUpdatedCenter=new $h(0,0)}_updateCamera(b){const k=new $h(b.coords.longitude,b.coords.latitude),Z=b.coords.accuracy,ie=this._map.getBearing(),de=Td(wd({bearing:ie},this.options.fitBoundsOptions),{linear:!0}),ne=this._map.getZoom();ne>this.options.fitBoundsOptions.maxZoom&&(de.zoom=ne),this._map.fitBounds(k.toBounds(Z),de,{geolocateSource:!0});let c=!1;const ve=()=>{c=!0};this._map.once("click",ve),this._map.once("dblclick",ve),this._map.once("dragstart",ve),this._map.once("mousedown",ve),this._map.once("touchstart",ve),this._map.once("wheel",ve),this._map.once("moveend",()=>{this._map.off("click",ve),this._map.off("dblclick",ve),this._map.off("dragstart",ve),this._map.off("mousedown",ve),this._map.off("touchstart",ve),this._map.off("wheel",ve),!c&&(this.lastUpdatedCenter=this._map.getCenter())})}_setupUI(b){if(this.lastUpdatedCenter=this._map.getCenter(),this._container.addEventListener("contextmenu",k=>k.preventDefault()),this._geolocateButton=Un("button","maplibregl-ctrl-geolocate",this._container),Un("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",b===!1){const k=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=k,this._geolocateButton.setAttribute("aria-label",k)}else{const k=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=k,this._geolocateButton.setAttribute("aria-label",k)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=Un("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new Nh(this._dotElement),this._circleElement=Un("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Nh({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("move",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("moveend",k=>{const Z=k.originalEvent&&k.originalEvent.type==="resize",ie=this.lastUpdatedCenter.distanceTo(this._map.getCenter());!k.geolocateSource&&this._watchState==="ACTIVE_LOCK"&&!Z&&ie>1&&(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new Event("trackuserlocationend")))})}_updateCircleRadius(){if(this._watchState!=="BACKGROUND"&&this._watchState!=="ACTIVE_LOCK")return;const b=[this._lastKnownPosition.coords.longitude,this._lastKnownPosition.coords.latitude],k=this._map.project(b),Z=this._map.unproject([k.x,k.y]),ie=this._map.unproject([k.x+20,k.y]),de=Z.distanceTo(ie)/20,ne=Math.ceil(2*this._accuracy/de);this._circleElement.style.width=`${ne}px`,this._circleElement.style.height=`${ne}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}}var Id=Object.defineProperty,Ad=Object.defineProperties,Cd=Object.getOwnPropertyDescriptors,jh=Object.getOwnPropertySymbols,Md=Object.prototype.hasOwnProperty,Pd=Object.prototype.propertyIsEnumerable,Gh=(C,b,k)=>b in C?Id(C,b,{enumerable:!0,configurable:!0,writable:!0,value:k}):C[b]=k,qh=(C,b)=>{for(var k in b||(b={}))Md.call(b,k)&&Gh(C,k,b[k]);if(jh)for(var k of jh(b))Pd.call(b,k)&&Gh(C,k,b[k]);return C},Zh=(C,b)=>Ad(C,Cd(b)),ca=(C,b,k)=>new Promise((Z,ie)=>{var de=ve=>{try{c(k.next(ve))}catch(Ke){ie(Ke)}},ne=ve=>{try{c(k.throw(ve))}catch(Ke){ie(Ke)}},c=ve=>ve.done?Z(ve.value):Promise.resolve(ve.value).then(de,ne);c((k=k.apply(C,b)).next())});const kd=Lp(),Xh={POINT:"POINT",COUNTRY:"COUNTRY"};class zd extends gr.Map{constructor(b){var k;const Z=Oh(b.style),ie=location.hash;Fi.apiKey||console.warn("MapTiler Cloud API key is not set. Visit https://maptiler.com and try Cloud for free!"),super(Zh(qh({},b),{style:Z,maplibreLogo:!1,transformRequest:de=>{let ne=null;try{ne=new URL(de)}catch{return{url:de,headers:{}}}return ne.host===Ki.maptilerApiHost&&(ne.searchParams.has("key")||ne.searchParams.append("key",Fi.apiKey),Fi.session&&ne.searchParams.append("mtsid",kd)),{url:ne.href,headers:{}}}})),this.languageShouldUpdate=!1,this.isStyleInitialized=!1,this.isTerrainEnabled=!1,this.terrainExaggeration=1,this.once("styledata",()=>ca(this,null,function*(){if(b.geolocate===!1||b.center||b.hash&&!!ie)return;try{if(b.geolocate===Xh.COUNTRY){yield this.fitToIpBounds();return}}catch(ne){console.warn(ne.message)}let de=null;try{yield this.centerOnIpPoint(b.zoom),de=this.getCameraHash()}catch(ne){console.warn(ne.message)}(yield navigator.permissions.query({name:"geolocation"})).state==="granted"&&navigator.geolocation.getCurrentPosition(ne=>{de===this.getCameraHash()&&this.easeTo({center:[ne.coords.longitude,ne.coords.latitude],zoom:b.zoom||12,duration:2e3})},null,{maximumAge:24*3600*1e3,timeout:5e3,enableHighAccuracy:!1})})),this.on("styledataloading",()=>{this.languageShouldUpdate=!!Fi.primaryLanguage||!!Fi.secondaryLanguage}),this.on("styledata",()=>{Fi.primaryLanguage&&(this.languageShouldUpdate||!this.isStyleInitialized)&&this.setPrimaryLanguage(Fi.primaryLanguage),Fi.secondaryLanguage&&(this.languageShouldUpdate||!this.isStyleInitialized)&&this.setSecondaryLanguage(Fi.secondaryLanguage),this.languageShouldUpdate=!1,this.isStyleInitialized=!0}),this.on("styledata",()=>{this.getTerrain()===null&&this.isTerrainEnabled&&this.enableTerrain(this.terrainExaggeration)}),this.once("load",()=>ca(this,null,function*(){pd()})),this.once("load",()=>ca(this,null,function*(){let de={logo:null};try{const ne=Object.keys(this.style.sourceCaches).map(ve=>this.getSource(ve)).filter(ve=>typeof ve.url=="string"&&ve.url.includes("tiles.json")),c=new URL(ne[0].url);c.searchParams.has("key")||c.searchParams.append("key",Fi.apiKey),de=yield(yield fetch(c.href)).json()}catch{}if("logo"in de&&de.logo){const ne=de.logo;this.addControl(new Fh({logoURL:ne}),b.logoPosition),b.attributionControl===!1&&this.addControl(new gr.AttributionControl(b))}else b.maptilerLogo&&this.addControl(new Fh,b.logoPosition);if(b.scaleControl){const ne=b.scaleControl===!0||b.scaleControl===void 0?"bottom-right":b.scaleControl,c=new gr.ScaleControl({unit:Fi.unit});this.addControl(c,ne),Fi.on("unit",ve=>{c.setUnit(ve)})}if(b.navigationControl!==!1){const ne=b.navigationControl===!0||b.navigationControl===void 0?"top-right":b.navigationControl;this.addControl(new gd,ne)}if(b.geolocateControl!==!1){const ne=b.geolocateControl===!0||b.geolocateControl===void 0?"top-right":b.geolocateControl;this.addControl(new Ed({positionOptions:{enableHighAccuracy:!0,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!0,showAccuracyCircle:!0,showUserLocation:!0}),ne)}if(b.terrainControl){const ne=b.terrainControl===!0||b.terrainControl===void 0?"top-right":b.terrainControl;this.addControl(new fd,ne)}if(b.fullscreenControl){const ne=b.fullscreenControl===!0||b.fullscreenControl===void 0?"top-right":b.fullscreenControl;this.addControl(new gr.FullscreenControl({}),ne)}})),b.terrain&&this.enableTerrain((k=b.terrainExaggeration)!=null?k:this.terrainExaggeration)}setStyle(b,k){return super.setStyle(Oh(b),k)}setLanguage(b=Ki.primaryLanguage){if(b===zr.AUTO)return this.setLanguage(Vl());this.setPrimaryLanguage(b)}setPrimaryLanguage(b=Ki.primaryLanguage){!Mh(b)||this.onStyleReady(()=>{if(b===zr.AUTO)return this.setPrimaryLanguage(Vl());Fi.primaryLanguage=b;const k=this.getStyle().layers,Z=/^\s*{\s*name\s*(:\s*(\S*))?\s*}$/,ie=/^\s*name\s*(:\s*(\S*))?\s*$/,de=/^\s*{\s*name\s*(:\s*(\S*))?\s*}(\s*){\s*name\s*(:\s*(\S*))?\s*}$/,ne=/^(.*)({\s*name\s*(:\s*(\S*))?\s*})(.*)$/,c=b?`name:${b}`:"name",ve=["case",["has",c],["get",c],["get","name:latin"]];for(let Ke=0;Ke<k.length;Ke+=1){const lt=k[Ke],St=lt.layout;if(!St||!St["text-field"])continue;const Me=this.getLayoutProperty(lt.id,"text-field");let K;if(Array.isArray(Me)&&Me.length>=2&&Me[0].trim().toLowerCase()==="concat"){const Je=Me.slice();for(let ti=0;ti<Me.length;ti+=1){const Jt=Me[ti];if((typeof Jt=="string"||Jt instanceof String)&&Z.exec(Jt.toString())){Je[ti]=ve;break}else if(Array.isArray(Jt)&&Jt.length>=2&&Jt[0].trim().toLowerCase()==="get"&&ie.exec(Jt[1].toString())){Je[ti]=ve;break}else if(Array.isArray(Jt)&&Jt.length===4&&Jt[0].trim().toLowerCase()==="case"){Je[ti]=ve;break}}this.setLayoutProperty(lt.id,"text-field",Je)}else if(Array.isArray(Me)&&Me.length>=2&&Me[0].trim().toLowerCase()==="get"&&ie.exec(Me[1].toString())){const Je=ve;this.setLayoutProperty(lt.id,"text-field",Je)}else if((typeof Me=="string"||Me instanceof String)&&Z.exec(Me.toString())){const Je=ve;this.setLayoutProperty(lt.id,"text-field",Je)}else if(Array.isArray(Me)&&Me.length===4&&Me[0].trim().toLowerCase()==="case"){const Je=ve;this.setLayoutProperty(lt.id,"text-field",Je)}else if((typeof Me=="string"||Me instanceof String)&&(K=de.exec(Me.toString()))!==null){const Je=`{${c}}${K[3]}{name${K[4]||""}}`;this.setLayoutProperty(lt.id,"text-field",Je)}else if((typeof Me=="string"||Me instanceof String)&&(K=ne.exec(Me.toString()))!==null){const Je=`${K[1]}{${c}}${K[5]}`;this.setLayoutProperty(lt.id,"text-field",Je)}}})}setSecondaryLanguage(b=Ki.secondaryLanguage){!Mh(b)||this.onStyleReady(()=>{if(b===zr.AUTO)return this.setSecondaryLanguage(Vl());Fi.secondaryLanguage=b;const k=this.getStyle().layers,Z=/^\s*{\s*name\s*(:\s*(\S*))?\s*}$/,ie=/^\s*name\s*(:\s*(\S*))?\s*$/,de=/^\s*{\s*name\s*(:\s*(\S*))?\s*}(\s*){\s*name\s*(:\s*(\S*))?\s*}$/;let ne;for(let c=0;c<k.length;c+=1){const ve=k[c],Ke=ve.layout;if(!Ke||!Ke["text-field"])continue;const lt=this.getLayoutProperty(ve.id,"text-field");let St;if(Array.isArray(lt)&<.length>=2&<[0].trim().toLowerCase()==="concat"){St=lt.slice();let Me=0;for(let K=0;K<lt.length;K+=1){const Je=lt[K];if((typeof Je=="string"||Je instanceof String)&&Z.exec(Je.toString())){if(Me===1){St[K]=`{name:${b}}`;break}Me+=1}else if(Array.isArray(Je)&&Je.length>=2&&Je[0].trim().toLowerCase()==="get"&&ie.exec(Je[1].toString())){if(Me===1){St[K][1]=`name:${b}`;break}Me+=1}else if(Array.isArray(Je)&&Je.length===4&&Je[0].trim().toLowerCase()==="case"){if(Me===1){St[K]=["get",`name:${b}`];break}Me+=1}}this.setLayoutProperty(ve.id,"text-field",St)}else if((typeof lt=="string"||lt instanceof String)&&(ne=de.exec(lt.toString()))!==null){const Me=b?`name:${b}`:"name";St=`{name${ne[1]||""}}${ne[3]}{${Me}}`,this.setLayoutProperty(ve.id,"text-field",St)}}})}getTerrainExaggeration(){return this.terrainExaggeration}hasTerrain(){return this.isTerrainEnabled}enableTerrain(b=this.terrainExaggeration){if(b<0){console.warn("Terrain exaggeration cannot be negative.");return}const k=this.getTerrain(),Z=()=>{this.isTerrainEnabled=!0,this.terrainExaggeration=b,this.addSource(Ki.terrainSourceId,{type:"raster-dem",url:Ki.terrainSourceURL}),this.setTerrain({source:Ki.terrainSourceId,exaggeration:b})};if(k){this.setTerrain(Zh(qh({},k),{exaggeration:b}));return}this.loaded()||this.isTerrainEnabled?Z():this.once("load",()=>{this.getTerrain()&&this.getSource(Ki.terrainSourceId)||Z()})}disableTerrain(){this.isTerrainEnabled=!1,this.setTerrain(null),this.getSource(Ki.terrainSourceId)&&this.removeSource(Ki.terrainSourceId)}setTerrainExaggeration(b){this.enableTerrain(b)}onStyleReady(b){this.isStyleLoaded()?b():this.once("styledata",()=>{b()})}fitToIpBounds(){return ca(this,null,function*(){const b=yield Nl.info();this.fitBounds(b.country_bounds,{duration:0,padding:100})})}centerOnIpPoint(b){return ca(this,null,function*(){const k=yield Nl.info();this.jumpTo({center:[k.longitude,k.latitude],zoom:b||11})})}getCameraHash(){const b=new Float32Array(5),k=this.getCenter();return b[0]=k.lng,b[1]=k.lat,b[2]=this.getZoom(),b[3]=this.getPitch(),b[4]=this.getBearing(),Mp.fromUint8Array(new Uint8Array(b.buffer))}}class ha{constructor(b,k){this.x=b,this.y=k}_matMult(b){const k=b[0]*this.x+b[1]*this.y,Z=b[2]*this.x+b[3]*this.y;return this.x=k,this.y=Z,this}_add(b){return this.x+=b.x,this.y+=b.y,this}_sub(b){return this.x-=b.x,this.y-=b.y,this}_mult(b){return this.x*=b,this.y*=b,this}_div(b){return this.x/=b,this.y/=b,this}_multByPoint(b){return this.x*=b.x,this.y*=b.y,this}_divByPoint(b){return this.x/=b.x,this.y/=b.y,this}_unit(){return this._div(this.mag()),this}_perp(){const b=this.y;return this.y=this.x,this.x=-b,this}_rotate(b){const k=Math.cos(b),Z=Math.sin(b),ie=k*this.x-Z*this.y,de=Z*this.x+k*this.y;return this.x=ie,this.y=de,this}_rotateAround(b,k){const Z=Math.cos(b),ie=Math.sin(b),de=k.x+Z*(this.x-k.x)-ie*(this.y-k.y),ne=k.y+ie*(this.x-k.x)+Z*(this.y-k.y);return this.x=de,this.y=ne,this}_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}clone(){return new ha(this.x,this.y)}add(b){return this.clone()._add(b)}sub(b){return this.clone()._sub(b)}multByPoint(b){return this.clone()._multByPoint(b)}divByPoint(b){return this.clone()._divByPoint(b)}mult(b){return this.clone()._mult(b)}div(b){return this.clone()._div(b)}rotate(b){return this.clone()._rotate(b)}rotateAround(b,k){return this.clone()._rotateAround(b,k)}matMult(b){return this.clone()._matMult(b)}unit(){return this.clone()._unit()}perp(){return this.clone()._perp()}round(){return this.clone()._round()}mag(){return Math.sqrt(this.x*this.x+this.y*this.y)}equals(b){return this.x===b.x&&this.y===b.y}dist(b){return Math.sqrt(this.distSqr(b))}distSqr(b){const k=b.x-this.x,Z=b.y-this.y;return k*k+Z*Z}angle(){return Math.atan2(this.y,this.x)}angleTo(b){return Math.atan2(this.y-b.y,this.x-b.x)}angleWith(b){return this.angleWithSep(b.x,b.y)}angleWithSep(b,k){return Math.atan2(this.x*k-this.y*b,this.x*b+this.y*k)}static convert(b){return b instanceof ha?b:Array.isArray(b)?new ha(b[0],b[1]):b}}const{supported:Ld,setRTLTextPlugin:Dd,getRTLTextPluginStatus:Rd,NavigationControl:Bd,GeolocateControl:Fd,AttributionControl:Od,LogoControl:Ud,ScaleControl:Vd,FullscreenControl:Nd,TerrainControl:$d,Popup:jd,Marker:Gd,Style:qd,LngLat:Zd,LngLatBounds:Xd,MercatorCoordinate:Wd,Evented:Hd,AJAXError:Kd,CanvasSource:Jd,GeoJSONSource:Yd,ImageSource:Qd,RasterDEMTileSource:em,RasterTileSource:tm,VectorTileSource:im,VideoSource:rm,prewarm:nm,clearPrewarmedResources:sm,version:am,workerCount:om,maxParallelImageRequests:lm,clearStorage:cm,workerUrl:hm,addProtocol:um,removeProtocol:pm}=gr;tt.AJAXError=Kd,tt.AttributionControl=Od,tt.CanvasSource=Jd,tt.Evented=Hd,tt.FullscreenControl=Nd,tt.GeoJSONSource=Yd,tt.GeolocateControl=Fd,tt.GeolocationType=Xh,tt.ImageSource=Qd,tt.Language=zr,tt.LanguageGeocoding=Ss,tt.LngLat=Zd,tt.LngLatBounds=Xd,tt.LogoControl=Ud,tt.Map=zd,tt.MapStyle=jl,tt.MapStyleVariant=Eo,tt.Marker=Gd,tt.MercatorCoordinate=Wd,tt.NavigationControl=Bd,tt.Point=ha,tt.Popup=jd,tt.RasterDEMTileSource=em,tt.RasterTileSource=tm,tt.ReferenceMapStyle=Io,tt.ScaleControl=Vd,tt.SdkConfig=Bh,tt.ServiceError=On,tt.Style=qd,tt.TerrainControl=$d,tt.VectorTileSource=im,tt.VideoSource=rm,tt.addProtocol=um,tt.clearPrewarmedResources=sm,tt.clearStorage=cm,tt.config=Fi,tt.coordinates=Qp,tt.data=id,tt.geocoding=Wp,tt.geolocation=Nl,tt.getRTLTextPluginStatus=Rd,tt.maxParallelImageRequests=lm,tt.prewarm=nm,tt.removeProtocol=pm,tt.setRTLTextPlugin=Dd,tt.staticMaps=ud,tt.supported=Ld,tt.version=am,tt.workerCount=om,tt.workerUrl=hm,Object.defineProperty(tt,"__esModule",{value:!0})});
|