@arenarium/maps 1.0.110 → 1.0.112
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/dist/style.css +1 -1
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -739,4 +739,4 @@ uniform ${P} ${E} u_${A};
|
|
|
739
739
|
`),se=ee.concat(yr.prelude.vertexSource,_.vertexSource,i.vertexSource).join(`
|
|
740
740
|
`);ur(P)||(ie=function(xe){return xe.replace(/\bin\s/g,"varying ").replace("out highp vec4 fragColor;","").replace(/fragColor/g,"gl_FragColor").replace(/texture\(/g,"texture2D(")}(ie),se=function(xe){return xe.replace(/\bin\s/g,"attribute ").replace(/\bout\s/g,"varying ").replace(/texture\(/g,"texture2D(")}(se));const re=P.createShader(P.FRAGMENT_SHADER);if(P.isContextLost())return void(this.failedToCreate=!0);if(P.shaderSource(re,ie),P.compileShader(re),!P.getShaderParameter(re,P.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${P.getShaderInfoLog(re)}`);P.attachShader(this.program,re);const pe=P.createShader(P.VERTEX_SHADER);if(P.isContextLost())return void(this.failedToCreate=!0);if(P.shaderSource(pe,se),P.compileShader(pe),!P.getShaderParameter(pe,P.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${P.getShaderInfoLog(pe)}`);P.attachShader(this.program,pe),this.attributes={};const Me={};this.numAttributes=F.length;for(let xe=0;xe<this.numAttributes;xe++)F[xe]&&(P.bindAttribLocation(this.program,xe,F[xe]),this.attributes[F[xe]]=xe);if(P.linkProgram(this.program),!P.getProgramParameter(this.program,P.LINK_STATUS))throw new Error(`Program failed to link: ${P.getProgramInfoLog(this.program)}`);P.deleteShader(pe),P.deleteShader(re);for(let xe=0;xe<te.length;xe++){const ve=te[xe];if(ve&&!Me[ve]){const be=P.getUniformLocation(this.program,ve);be&&(Me[ve]=be)}}this.fixedUniforms=l(e,Me),this.terrainUniforms=((xe,ve)=>({u_depth:new o.bH(xe,ve.u_depth),u_terrain:new o.bH(xe,ve.u_terrain),u_terrain_dim:new o.b8(xe,ve.u_terrain_dim),u_terrain_matrix:new o.bJ(xe,ve.u_terrain_matrix),u_terrain_unpack:new o.bK(xe,ve.u_terrain_unpack),u_terrain_exaggeration:new o.b8(xe,ve.u_terrain_exaggeration)}))(e,Me),this.projectionUniforms=((xe,ve)=>({u_projection_matrix:new o.bJ(xe,ve.u_projection_matrix),u_projection_tile_mercator_coords:new o.bK(xe,ve.u_projection_tile_mercator_coords),u_projection_clipping_plane:new o.bK(xe,ve.u_projection_clipping_plane),u_projection_transition:new o.b8(xe,ve.u_projection_transition),u_projection_fallback_matrix:new o.bJ(xe,ve.u_projection_fallback_matrix)}))(e,Me),this.binderUniforms=s?s.getUniforms(e,Me):[]}draw(e,i,s,l,h,f,_,x,T,P,E,A,F,O,H,q,W,K,te){const ee=e.gl;if(this.failedToCreate)return;if(e.program.set(this.program),e.setDepthMode(s),e.setStencilMode(l),e.setColorMode(h),e.setCullFace(f),x){e.activeTexture.set(ee.TEXTURE2),ee.bindTexture(ee.TEXTURE_2D,x.depthTexture),e.activeTexture.set(ee.TEXTURE3),ee.bindTexture(ee.TEXTURE_2D,x.texture);for(const se in this.terrainUniforms)this.terrainUniforms[se].set(x[se])}if(T)for(const se in T)this.projectionUniforms[Co[se]].set(T[se]);if(_)for(const se in this.fixedUniforms)this.fixedUniforms[se].set(_[se]);q&&q.setUniforms(e,this.binderUniforms,O,{zoom:H});let ie=0;switch(i){case ee.LINES:ie=2;break;case ee.TRIANGLES:ie=3;break;case ee.LINE_STRIP:ie=1}for(const se of F.get()){const re=se.vaos||(se.vaos={});(re[P]||(re[P]=new Pd)).bind(e,this,E,q?q.getPaintVertexBuffers():[],A,se.vertexOffset,W,K,te),ee.drawElements(i,se.primitiveLength*ie,ee.UNSIGNED_SHORT,se.primitiveOffset*ie*2)}}}function Ao(u,e,i){const s=1/o.az(i,1,e.transform.tileZoom),l=Math.pow(2,i.tileID.overscaledZ),h=i.tileSize*Math.pow(2,e.transform.tileZoom)/l,f=h*(i.tileID.canonical.x+i.tileID.wrap*l),_=h*i.tileID.canonical.y;return{u_image:0,u_texsize:i.imageAtlasTexture.size,u_scale:[s,u.fromScale,u.toScale],u_fade:u.t,u_pixel_coord_upper:[f>>16,_>>16],u_pixel_coord_lower:[65535&f,65535&_]}}const Eo=(u,e,i,s)=>{const l=u.style.light,h=l.properties.get("position"),f=[h.x,h.y,h.z],_=o.bN();l.properties.get("anchor")==="viewport"&&o.bO(_,u.transform.bearingInRadians),o.bP(f,f,_);const x=u.transform.transformLightDirection(f),T=l.properties.get("color");return{u_lightpos:f,u_lightpos_globe:x,u_lightintensity:l.properties.get("intensity"),u_lightcolor:[T.r,T.g,T.b],u_vertical_gradient:+e,u_opacity:i,u_fill_translate:s}},bn=(u,e,i,s,l,h,f)=>o.e(Eo(u,e,i,s),Ao(h,u,f),{u_height_factor:-Math.pow(2,l.overscaledZ)/f.tileSize/8}),Iu=(u,e,i,s)=>o.e(Ao(e,u,i),{u_fill_translate:s}),Ul=(u,e)=>({u_world:u,u_fill_translate:e}),Rs=(u,e,i,s,l)=>o.e(Iu(u,e,i,l),{u_world:s}),Ds=(u,e,i,s,l)=>{const h=u.transform;let f,_,x=0;if(i.paint.get("circle-pitch-alignment")==="map"){const T=o.az(e,1,h.zoom);f=!0,_=[T,T],x=T/(o.Z*Math.pow(2,e.tileID.overscaledZ))*2*Math.PI*l}else f=!1,_=h.pixelsToGLUnits;return{u_camera_to_center_distance:h.cameraToCenterDistance,u_scale_with_map:+(i.paint.get("circle-pitch-scale")==="map"),u_pitch_with_map:+f,u_device_pixel_ratio:u.pixelRatio,u_extrude_scale:_,u_globe_extrude_scale:x,u_translate:s}},Id=u=>({u_pixel_extrude_scale:[1/u.width,1/u.height]}),ko=u=>({u_viewport_size:[u.width,u.height]}),Au=(u,e=1)=>({u_color:u,u_overlay:0,u_overlay_scale:e}),_a=(u,e,i,s)=>{const l=o.az(u,1,e)/(o.Z*Math.pow(2,u.tileID.overscaledZ))*2*Math.PI*s;return{u_extrude_scale:o.az(u,1,e),u_intensity:i,u_globe_extrude_scale:l}},Eu=(u,e,i,s)=>{const l=o.K();o.bQ(l,0,u.width,u.height,0,0,1);const h=u.context.gl;return{u_matrix:l,u_world:[h.drawingBufferWidth,h.drawingBufferHeight],u_image:i,u_color_ramp:s,u_opacity:e.paint.get("heatmap-opacity")}},ku=(u,e,i)=>{const s=i.paint.get("hillshade-accent-color");let l;switch(i.paint.get("hillshade-method")){case"basic":l=4;break;case"combined":l=1;break;case"igor":l=2;break;case"multidirectional":l=3;break;default:l=0}const h=i.getIlluminationProperties();for(let f=0;f<h.directionRadians.length;f++)i.paint.get("hillshade-illumination-anchor")==="viewport"&&(h.directionRadians[f]+=u.transform.bearingInRadians);return{u_image:0,u_latrange:zu(0,e.tileID),u_exaggeration:i.paint.get("hillshade-exaggeration"),u_altitudes:h.altitudeRadians,u_azimuths:h.directionRadians,u_accent:s,u_method:l,u_highlights:h.highlightColor,u_shadows:h.shadowColor}},Ad=(u,e)=>{const i=e.stride,s=o.K();return o.bQ(s,0,o.Z,-8192,0,0,1),o.L(s,s,[0,-8192,0]),{u_matrix:s,u_image:1,u_dimension:[i,i],u_zoom:u.overscaledZ,u_unpack:e.getUnpackVector()}};function zu(u,e){const i=Math.pow(2,e.canonical.z),s=e.canonical.y;return[new o.$(0,s/i).toLngLat().lat,new o.$(0,(s+1)/i).toLngLat().lat]}const Ls=(u,e,i,s)=>{const l=u.transform;return{u_translation:qn(u,e,i),u_ratio:s/o.az(e,1,l.zoom),u_device_pixel_ratio:u.pixelRatio,u_units_to_pixels:[1/l.pixelsToGLUnits[0],1/l.pixelsToGLUnits[1]]}},Ru=(u,e,i,s,l)=>o.e(Ls(u,e,i,s),{u_image:0,u_image_height:l}),Du=(u,e,i,s,l)=>{const h=u.transform,f=$l(e,h);return{u_translation:qn(u,e,i),u_texsize:e.imageAtlasTexture.size,u_ratio:s/o.az(e,1,h.zoom),u_device_pixel_ratio:u.pixelRatio,u_image:0,u_scale:[f,l.fromScale,l.toScale],u_fade:l.t,u_units_to_pixels:[1/h.pixelsToGLUnits[0],1/h.pixelsToGLUnits[1]]}},Lu=(u,e,i,s,l,h)=>{const f=u.lineAtlas,_=$l(e,u.transform),x=i.layout.get("line-cap")==="round",T=f.getDash(l.from,x),P=f.getDash(l.to,x),E=T.width*h.fromScale,A=P.width*h.toScale;return o.e(Ls(u,e,i,s),{u_patternscale_a:[_/E,-T.height/2],u_patternscale_b:[_/A,-P.height/2],u_sdfgamma:f.width/(256*Math.min(E,A)*u.pixelRatio)/2,u_image:0,u_tex_y_a:T.y,u_tex_y_b:P.y,u_mix:h.t})};function $l(u,e){return 1/o.az(u,1,e.tileZoom)}function qn(u,e,i){return o.aA(u.transform,e,i.paint.get("line-translate"),i.paint.get("line-translate-anchor"))}const Bu=(u,e,i,s,l)=>{return{u_tl_parent:u,u_scale_parent:e,u_buffer_scale:1,u_fade_t:i.mix,u_opacity:i.opacity*s.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:s.paint.get("raster-brightness-min"),u_brightness_high:s.paint.get("raster-brightness-max"),u_saturation_factor:(f=s.paint.get("raster-saturation"),f>0?1-1/(1.001-f):-f),u_contrast_factor:(h=s.paint.get("raster-contrast"),h>0?1/(1-h):1+h),u_spin_weights:Fu(s.paint.get("raster-hue-rotate")),u_coords_top:[l[0].x,l[0].y,l[1].x,l[1].y],u_coords_bottom:[l[3].x,l[3].y,l[2].x,l[2].y]};var h,f};function Fu(u){u*=Math.PI/180;const e=Math.sin(u),i=Math.cos(u);return[(2*i+1)/3,(-Math.sqrt(3)*e-i+1)/3,(Math.sqrt(3)*e-i+1)/3]}const Wa=(u,e,i,s,l,h,f,_,x,T,P,E,A)=>{const F=f.transform;return{u_is_size_zoom_constant:+(u==="constant"||u==="source"),u_is_size_feature_constant:+(u==="constant"||u==="camera"),u_size_t:e?e.uSizeT:0,u_size:e?e.uSize:0,u_camera_to_center_distance:F.cameraToCenterDistance,u_pitch:F.pitch/360*2*Math.PI,u_rotate_symbol:+i,u_aspect_ratio:F.width/F.height,u_fade_change:f.options.fadeDuration?f.symbolFadeChange:1,u_label_plane_matrix:_,u_coord_matrix:x,u_is_text:+P,u_pitch_with_map:+s,u_is_along_line:l,u_is_variable_anchor:h,u_texsize:E,u_texture:0,u_translation:T,u_pitched_scale:A}},Ou=(u,e,i,s,l,h,f,_,x,T,P,E,A,F)=>{const O=f.transform;return o.e(Wa(u,e,i,s,l,h,f,_,x,T,P,E,F),{u_gamma_scale:s?Math.cos(O.pitch*Math.PI/180)*O.cameraToCenterDistance:1,u_device_pixel_ratio:f.pixelRatio,u_is_halo:1})},zo=(u,e,i,s,l,h,f,_,x,T,P,E,A)=>o.e(Ou(u,e,i,s,l,h,f,_,x,T,!0,P,0,A),{u_texsize_icon:E,u_texture_icon:1}),Ed=(u,e)=>({u_opacity:u,u_color:e}),kd=(u,e,i,s,l)=>o.e(function(h,f,_,x){const T=_.imageManager.getPattern(h.from.toString()),P=_.imageManager.getPattern(h.to.toString()),{width:E,height:A}=_.imageManager.getPixelSize(),F=Math.pow(2,x.tileID.overscaledZ),O=x.tileSize*Math.pow(2,_.transform.tileZoom)/F,H=O*(x.tileID.canonical.x+x.tileID.wrap*F),q=O*x.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:T.tl,u_pattern_br_a:T.br,u_pattern_tl_b:P.tl,u_pattern_br_b:P.br,u_texsize:[E,A],u_mix:f.t,u_pattern_size_a:T.displaySize,u_pattern_size_b:P.displaySize,u_scale_a:f.fromScale,u_scale_b:f.toScale,u_tile_units_to_pixels:1/o.az(x,1,_.transform.tileZoom),u_pixel_coord_upper:[H>>16,q>>16],u_pixel_coord_lower:[65535&H,65535&q]}}(i,l,e,s),{u_opacity:u}),Gl=(u,e)=>{},ju={fillExtrusion:(u,e)=>({u_lightpos:new o.bL(u,e.u_lightpos),u_lightpos_globe:new o.bL(u,e.u_lightpos_globe),u_lightintensity:new o.b8(u,e.u_lightintensity),u_lightcolor:new o.bL(u,e.u_lightcolor),u_vertical_gradient:new o.b8(u,e.u_vertical_gradient),u_opacity:new o.b8(u,e.u_opacity),u_fill_translate:new o.bM(u,e.u_fill_translate)}),fillExtrusionPattern:(u,e)=>({u_lightpos:new o.bL(u,e.u_lightpos),u_lightpos_globe:new o.bL(u,e.u_lightpos_globe),u_lightintensity:new o.b8(u,e.u_lightintensity),u_lightcolor:new o.bL(u,e.u_lightcolor),u_vertical_gradient:new o.b8(u,e.u_vertical_gradient),u_height_factor:new o.b8(u,e.u_height_factor),u_opacity:new o.b8(u,e.u_opacity),u_fill_translate:new o.bM(u,e.u_fill_translate),u_image:new o.bH(u,e.u_image),u_texsize:new o.bM(u,e.u_texsize),u_pixel_coord_upper:new o.bM(u,e.u_pixel_coord_upper),u_pixel_coord_lower:new o.bM(u,e.u_pixel_coord_lower),u_scale:new o.bL(u,e.u_scale),u_fade:new o.b8(u,e.u_fade)}),fill:(u,e)=>({u_fill_translate:new o.bM(u,e.u_fill_translate)}),fillPattern:(u,e)=>({u_image:new o.bH(u,e.u_image),u_texsize:new o.bM(u,e.u_texsize),u_pixel_coord_upper:new o.bM(u,e.u_pixel_coord_upper),u_pixel_coord_lower:new o.bM(u,e.u_pixel_coord_lower),u_scale:new o.bL(u,e.u_scale),u_fade:new o.b8(u,e.u_fade),u_fill_translate:new o.bM(u,e.u_fill_translate)}),fillOutline:(u,e)=>({u_world:new o.bM(u,e.u_world),u_fill_translate:new o.bM(u,e.u_fill_translate)}),fillOutlinePattern:(u,e)=>({u_world:new o.bM(u,e.u_world),u_image:new o.bH(u,e.u_image),u_texsize:new o.bM(u,e.u_texsize),u_pixel_coord_upper:new o.bM(u,e.u_pixel_coord_upper),u_pixel_coord_lower:new o.bM(u,e.u_pixel_coord_lower),u_scale:new o.bL(u,e.u_scale),u_fade:new o.b8(u,e.u_fade),u_fill_translate:new o.bM(u,e.u_fill_translate)}),circle:(u,e)=>({u_camera_to_center_distance:new o.b8(u,e.u_camera_to_center_distance),u_scale_with_map:new o.bH(u,e.u_scale_with_map),u_pitch_with_map:new o.bH(u,e.u_pitch_with_map),u_extrude_scale:new o.bM(u,e.u_extrude_scale),u_device_pixel_ratio:new o.b8(u,e.u_device_pixel_ratio),u_globe_extrude_scale:new o.b8(u,e.u_globe_extrude_scale),u_translate:new o.bM(u,e.u_translate)}),collisionBox:(u,e)=>({u_pixel_extrude_scale:new o.bM(u,e.u_pixel_extrude_scale)}),collisionCircle:(u,e)=>({u_viewport_size:new o.bM(u,e.u_viewport_size)}),debug:(u,e)=>({u_color:new o.bI(u,e.u_color),u_overlay:new o.bH(u,e.u_overlay),u_overlay_scale:new o.b8(u,e.u_overlay_scale)}),depth:Gl,clippingMask:Gl,heatmap:(u,e)=>({u_extrude_scale:new o.b8(u,e.u_extrude_scale),u_intensity:new o.b8(u,e.u_intensity),u_globe_extrude_scale:new o.b8(u,e.u_globe_extrude_scale)}),heatmapTexture:(u,e)=>({u_matrix:new o.bJ(u,e.u_matrix),u_world:new o.bM(u,e.u_world),u_image:new o.bH(u,e.u_image),u_color_ramp:new o.bH(u,e.u_color_ramp),u_opacity:new o.b8(u,e.u_opacity)}),hillshade:(u,e)=>({u_image:new o.bH(u,e.u_image),u_latrange:new o.bM(u,e.u_latrange),u_exaggeration:new o.b8(u,e.u_exaggeration),u_altitudes:new o.bS(u,e.u_altitudes),u_azimuths:new o.bS(u,e.u_azimuths),u_accent:new o.bI(u,e.u_accent),u_method:new o.bH(u,e.u_method),u_shadows:new o.bR(u,e.u_shadows),u_highlights:new o.bR(u,e.u_highlights)}),hillshadePrepare:(u,e)=>({u_matrix:new o.bJ(u,e.u_matrix),u_image:new o.bH(u,e.u_image),u_dimension:new o.bM(u,e.u_dimension),u_zoom:new o.b8(u,e.u_zoom),u_unpack:new o.bK(u,e.u_unpack)}),line:(u,e)=>({u_translation:new o.bM(u,e.u_translation),u_ratio:new o.b8(u,e.u_ratio),u_device_pixel_ratio:new o.b8(u,e.u_device_pixel_ratio),u_units_to_pixels:new o.bM(u,e.u_units_to_pixels)}),lineGradient:(u,e)=>({u_translation:new o.bM(u,e.u_translation),u_ratio:new o.b8(u,e.u_ratio),u_device_pixel_ratio:new o.b8(u,e.u_device_pixel_ratio),u_units_to_pixels:new o.bM(u,e.u_units_to_pixels),u_image:new o.bH(u,e.u_image),u_image_height:new o.b8(u,e.u_image_height)}),linePattern:(u,e)=>({u_translation:new o.bM(u,e.u_translation),u_texsize:new o.bM(u,e.u_texsize),u_ratio:new o.b8(u,e.u_ratio),u_device_pixel_ratio:new o.b8(u,e.u_device_pixel_ratio),u_image:new o.bH(u,e.u_image),u_units_to_pixels:new o.bM(u,e.u_units_to_pixels),u_scale:new o.bL(u,e.u_scale),u_fade:new o.b8(u,e.u_fade)}),lineSDF:(u,e)=>({u_translation:new o.bM(u,e.u_translation),u_ratio:new o.b8(u,e.u_ratio),u_device_pixel_ratio:new o.b8(u,e.u_device_pixel_ratio),u_units_to_pixels:new o.bM(u,e.u_units_to_pixels),u_patternscale_a:new o.bM(u,e.u_patternscale_a),u_patternscale_b:new o.bM(u,e.u_patternscale_b),u_sdfgamma:new o.b8(u,e.u_sdfgamma),u_image:new o.bH(u,e.u_image),u_tex_y_a:new o.b8(u,e.u_tex_y_a),u_tex_y_b:new o.b8(u,e.u_tex_y_b),u_mix:new o.b8(u,e.u_mix)}),raster:(u,e)=>({u_tl_parent:new o.bM(u,e.u_tl_parent),u_scale_parent:new o.b8(u,e.u_scale_parent),u_buffer_scale:new o.b8(u,e.u_buffer_scale),u_fade_t:new o.b8(u,e.u_fade_t),u_opacity:new o.b8(u,e.u_opacity),u_image0:new o.bH(u,e.u_image0),u_image1:new o.bH(u,e.u_image1),u_brightness_low:new o.b8(u,e.u_brightness_low),u_brightness_high:new o.b8(u,e.u_brightness_high),u_saturation_factor:new o.b8(u,e.u_saturation_factor),u_contrast_factor:new o.b8(u,e.u_contrast_factor),u_spin_weights:new o.bL(u,e.u_spin_weights),u_coords_top:new o.bK(u,e.u_coords_top),u_coords_bottom:new o.bK(u,e.u_coords_bottom)}),symbolIcon:(u,e)=>({u_is_size_zoom_constant:new o.bH(u,e.u_is_size_zoom_constant),u_is_size_feature_constant:new o.bH(u,e.u_is_size_feature_constant),u_size_t:new o.b8(u,e.u_size_t),u_size:new o.b8(u,e.u_size),u_camera_to_center_distance:new o.b8(u,e.u_camera_to_center_distance),u_pitch:new o.b8(u,e.u_pitch),u_rotate_symbol:new o.bH(u,e.u_rotate_symbol),u_aspect_ratio:new o.b8(u,e.u_aspect_ratio),u_fade_change:new o.b8(u,e.u_fade_change),u_label_plane_matrix:new o.bJ(u,e.u_label_plane_matrix),u_coord_matrix:new o.bJ(u,e.u_coord_matrix),u_is_text:new o.bH(u,e.u_is_text),u_pitch_with_map:new o.bH(u,e.u_pitch_with_map),u_is_along_line:new o.bH(u,e.u_is_along_line),u_is_variable_anchor:new o.bH(u,e.u_is_variable_anchor),u_texsize:new o.bM(u,e.u_texsize),u_texture:new o.bH(u,e.u_texture),u_translation:new o.bM(u,e.u_translation),u_pitched_scale:new o.b8(u,e.u_pitched_scale)}),symbolSDF:(u,e)=>({u_is_size_zoom_constant:new o.bH(u,e.u_is_size_zoom_constant),u_is_size_feature_constant:new o.bH(u,e.u_is_size_feature_constant),u_size_t:new o.b8(u,e.u_size_t),u_size:new o.b8(u,e.u_size),u_camera_to_center_distance:new o.b8(u,e.u_camera_to_center_distance),u_pitch:new o.b8(u,e.u_pitch),u_rotate_symbol:new o.bH(u,e.u_rotate_symbol),u_aspect_ratio:new o.b8(u,e.u_aspect_ratio),u_fade_change:new o.b8(u,e.u_fade_change),u_label_plane_matrix:new o.bJ(u,e.u_label_plane_matrix),u_coord_matrix:new o.bJ(u,e.u_coord_matrix),u_is_text:new o.bH(u,e.u_is_text),u_pitch_with_map:new o.bH(u,e.u_pitch_with_map),u_is_along_line:new o.bH(u,e.u_is_along_line),u_is_variable_anchor:new o.bH(u,e.u_is_variable_anchor),u_texsize:new o.bM(u,e.u_texsize),u_texture:new o.bH(u,e.u_texture),u_gamma_scale:new o.b8(u,e.u_gamma_scale),u_device_pixel_ratio:new o.b8(u,e.u_device_pixel_ratio),u_is_halo:new o.bH(u,e.u_is_halo),u_translation:new o.bM(u,e.u_translation),u_pitched_scale:new o.b8(u,e.u_pitched_scale)}),symbolTextAndIcon:(u,e)=>({u_is_size_zoom_constant:new o.bH(u,e.u_is_size_zoom_constant),u_is_size_feature_constant:new o.bH(u,e.u_is_size_feature_constant),u_size_t:new o.b8(u,e.u_size_t),u_size:new o.b8(u,e.u_size),u_camera_to_center_distance:new o.b8(u,e.u_camera_to_center_distance),u_pitch:new o.b8(u,e.u_pitch),u_rotate_symbol:new o.bH(u,e.u_rotate_symbol),u_aspect_ratio:new o.b8(u,e.u_aspect_ratio),u_fade_change:new o.b8(u,e.u_fade_change),u_label_plane_matrix:new o.bJ(u,e.u_label_plane_matrix),u_coord_matrix:new o.bJ(u,e.u_coord_matrix),u_is_text:new o.bH(u,e.u_is_text),u_pitch_with_map:new o.bH(u,e.u_pitch_with_map),u_is_along_line:new o.bH(u,e.u_is_along_line),u_is_variable_anchor:new o.bH(u,e.u_is_variable_anchor),u_texsize:new o.bM(u,e.u_texsize),u_texsize_icon:new o.bM(u,e.u_texsize_icon),u_texture:new o.bH(u,e.u_texture),u_texture_icon:new o.bH(u,e.u_texture_icon),u_gamma_scale:new o.b8(u,e.u_gamma_scale),u_device_pixel_ratio:new o.b8(u,e.u_device_pixel_ratio),u_is_halo:new o.bH(u,e.u_is_halo),u_translation:new o.bM(u,e.u_translation),u_pitched_scale:new o.b8(u,e.u_pitched_scale)}),background:(u,e)=>({u_opacity:new o.b8(u,e.u_opacity),u_color:new o.bI(u,e.u_color)}),backgroundPattern:(u,e)=>({u_opacity:new o.b8(u,e.u_opacity),u_image:new o.bH(u,e.u_image),u_pattern_tl_a:new o.bM(u,e.u_pattern_tl_a),u_pattern_br_a:new o.bM(u,e.u_pattern_br_a),u_pattern_tl_b:new o.bM(u,e.u_pattern_tl_b),u_pattern_br_b:new o.bM(u,e.u_pattern_br_b),u_texsize:new o.bM(u,e.u_texsize),u_mix:new o.b8(u,e.u_mix),u_pattern_size_a:new o.bM(u,e.u_pattern_size_a),u_pattern_size_b:new o.bM(u,e.u_pattern_size_b),u_scale_a:new o.b8(u,e.u_scale_a),u_scale_b:new o.b8(u,e.u_scale_b),u_pixel_coord_upper:new o.bM(u,e.u_pixel_coord_upper),u_pixel_coord_lower:new o.bM(u,e.u_pixel_coord_lower),u_tile_units_to_pixels:new o.b8(u,e.u_tile_units_to_pixels)}),terrain:(u,e)=>({u_texture:new o.bH(u,e.u_texture),u_ele_delta:new o.b8(u,e.u_ele_delta),u_fog_matrix:new o.bJ(u,e.u_fog_matrix),u_fog_color:new o.bI(u,e.u_fog_color),u_fog_ground_blend:new o.b8(u,e.u_fog_ground_blend),u_fog_ground_blend_opacity:new o.b8(u,e.u_fog_ground_blend_opacity),u_horizon_color:new o.bI(u,e.u_horizon_color),u_horizon_fog_blend:new o.b8(u,e.u_horizon_fog_blend),u_is_globe_mode:new o.b8(u,e.u_is_globe_mode)}),terrainDepth:(u,e)=>({u_ele_delta:new o.b8(u,e.u_ele_delta)}),terrainCoords:(u,e)=>({u_texture:new o.bH(u,e.u_texture),u_terrain_coords_id:new o.b8(u,e.u_terrain_coords_id),u_ele_delta:new o.b8(u,e.u_ele_delta)}),projectionErrorMeasurement:(u,e)=>({u_input:new o.b8(u,e.u_input),u_output_expected:new o.b8(u,e.u_output_expected)}),atmosphere:(u,e)=>({u_sun_pos:new o.bL(u,e.u_sun_pos),u_atmosphere_blend:new o.b8(u,e.u_atmosphere_blend),u_globe_position:new o.bL(u,e.u_globe_position),u_globe_radius:new o.b8(u,e.u_globe_radius),u_inv_proj_matrix:new o.bJ(u,e.u_inv_proj_matrix)}),sky:(u,e)=>({u_sky_color:new o.bI(u,e.u_sky_color),u_horizon_color:new o.bI(u,e.u_horizon_color),u_horizon:new o.bM(u,e.u_horizon),u_horizon_normal:new o.bM(u,e.u_horizon_normal),u_sky_horizon_blend:new o.b8(u,e.u_sky_horizon_blend),u_sky_blend:new o.b8(u,e.u_sky_blend)})};class Nu{constructor(e,i,s){this.context=e;const l=e.gl;this.buffer=l.createBuffer(),this.dynamicDraw=!!s,this.context.unbindVAO(),e.bindElementBuffer.set(this.buffer),l.bufferData(l.ELEMENT_ARRAY_BUFFER,i.arrayBuffer,this.dynamicDraw?l.DYNAMIC_DRAW:l.STATIC_DRAW),this.dynamicDraw||delete i.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(e){const i=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),i.bufferSubData(i.ELEMENT_ARRAY_BUFFER,0,e.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const ql={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class Zu{constructor(e,i,s,l){this.length=i.length,this.attributes=s,this.itemSize=i.bytesPerElement,this.dynamicDraw=l,this.context=e;const h=e.gl;this.buffer=h.createBuffer(),e.bindVertexBuffer.set(this.buffer),h.bufferData(h.ARRAY_BUFFER,i.arrayBuffer,this.dynamicDraw?h.DYNAMIC_DRAW:h.STATIC_DRAW),this.dynamicDraw||delete i.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(e){if(e.length!==this.length)throw new Error(`Length of new data is ${e.length}, which doesn't match current length of ${this.length}`);const i=this.context.gl;this.bind(),i.bufferSubData(i.ARRAY_BUFFER,0,e.arrayBuffer)}enableAttributes(e,i){for(let s=0;s<this.attributes.length;s++){const l=i.attributes[this.attributes[s].name];l!==void 0&&e.enableVertexAttribArray(l)}}setVertexAttribPointers(e,i,s){for(let l=0;l<this.attributes.length;l++){const h=this.attributes[l],f=i.attributes[h.name];f!==void 0&&e.vertexAttribPointer(f,h.components,e[ql[h.type]],!1,this.itemSize,h.offset+this.itemSize*(s||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class At{constructor(e){this.gl=e.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(e){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class kn extends At{getDefault(){return o.b7.transparent}set(e){const i=this.current;(e.r!==i.r||e.g!==i.g||e.b!==i.b||e.a!==i.a||this.dirty)&&(this.gl.clearColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}}class Hl extends At{getDefault(){return 1}set(e){(e!==this.current||this.dirty)&&(this.gl.clearDepth(e),this.current=e,this.dirty=!1)}}class Wl extends At{getDefault(){return 0}set(e){(e!==this.current||this.dirty)&&(this.gl.clearStencil(e),this.current=e,this.dirty=!1)}}class Xl extends At{getDefault(){return[!0,!0,!0,!0]}set(e){const i=this.current;(e[0]!==i[0]||e[1]!==i[1]||e[2]!==i[2]||e[3]!==i[3]||this.dirty)&&(this.gl.colorMask(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}class Vu extends At{getDefault(){return!0}set(e){(e!==this.current||this.dirty)&&(this.gl.depthMask(e),this.current=e,this.dirty=!1)}}class Kl extends At{getDefault(){return 255}set(e){(e!==this.current||this.dirty)&&(this.gl.stencilMask(e),this.current=e,this.dirty=!1)}}class ya extends At{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(e){const i=this.current;(e.func!==i.func||e.ref!==i.ref||e.mask!==i.mask||this.dirty)&&(this.gl.stencilFunc(e.func,e.ref,e.mask),this.current=e,this.dirty=!1)}}class Yl extends At{getDefault(){const e=this.gl;return[e.KEEP,e.KEEP,e.KEEP]}set(e){const i=this.current;(e[0]!==i[0]||e[1]!==i[1]||e[2]!==i[2]||this.dirty)&&(this.gl.stencilOp(e[0],e[1],e[2]),this.current=e,this.dirty=!1)}}class zd extends At{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const i=this.gl;e?i.enable(i.STENCIL_TEST):i.disable(i.STENCIL_TEST),this.current=e,this.dirty=!1}}class Rd extends At{getDefault(){return[0,1]}set(e){const i=this.current;(e[0]!==i[0]||e[1]!==i[1]||this.dirty)&&(this.gl.depthRange(e[0],e[1]),this.current=e,this.dirty=!1)}}class Dd extends At{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const i=this.gl;e?i.enable(i.DEPTH_TEST):i.disable(i.DEPTH_TEST),this.current=e,this.dirty=!1}}class Ld extends At{getDefault(){return this.gl.LESS}set(e){(e!==this.current||this.dirty)&&(this.gl.depthFunc(e),this.current=e,this.dirty=!1)}}class Uu extends At{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const i=this.gl;e?i.enable(i.BLEND):i.disable(i.BLEND),this.current=e,this.dirty=!1}}class Bd extends At{getDefault(){const e=this.gl;return[e.ONE,e.ZERO]}set(e){const i=this.current;(e[0]!==i[0]||e[1]!==i[1]||this.dirty)&&(this.gl.blendFunc(e[0],e[1]),this.current=e,this.dirty=!1)}}class $u extends At{getDefault(){return o.b7.transparent}set(e){const i=this.current;(e.r!==i.r||e.g!==i.g||e.b!==i.b||e.a!==i.a||this.dirty)&&(this.gl.blendColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}}class Ro extends At{getDefault(){return this.gl.FUNC_ADD}set(e){(e!==this.current||this.dirty)&&(this.gl.blendEquation(e),this.current=e,this.dirty=!1)}}class Do extends At{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const i=this.gl;e?i.enable(i.CULL_FACE):i.disable(i.CULL_FACE),this.current=e,this.dirty=!1}}class Lo extends At{getDefault(){return this.gl.BACK}set(e){(e!==this.current||this.dirty)&&(this.gl.cullFace(e),this.current=e,this.dirty=!1)}}class Jl extends At{getDefault(){return this.gl.CCW}set(e){(e!==this.current||this.dirty)&&(this.gl.frontFace(e),this.current=e,this.dirty=!1)}}class xa extends At{getDefault(){return null}set(e){(e!==this.current||this.dirty)&&(this.gl.useProgram(e),this.current=e,this.dirty=!1)}}class Bo extends At{getDefault(){return this.gl.TEXTURE0}set(e){(e!==this.current||this.dirty)&&(this.gl.activeTexture(e),this.current=e,this.dirty=!1)}}class Xa extends At{getDefault(){const e=this.gl;return[0,0,e.drawingBufferWidth,e.drawingBufferHeight]}set(e){const i=this.current;(e[0]!==i[0]||e[1]!==i[1]||e[2]!==i[2]||e[3]!==i[3]||this.dirty)&&(this.gl.viewport(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}class Wr extends At{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const i=this.gl;i.bindFramebuffer(i.FRAMEBUFFER,e),this.current=e,this.dirty=!1}}class Gu extends At{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const i=this.gl;i.bindRenderbuffer(i.RENDERBUFFER,e),this.current=e,this.dirty=!1}}class qu extends At{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const i=this.gl;i.bindTexture(i.TEXTURE_2D,e),this.current=e,this.dirty=!1}}class Ql extends At{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const i=this.gl;i.bindBuffer(i.ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class va extends At{getDefault(){return null}set(e){const i=this.gl;i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class Fo extends At{getDefault(){return null}set(e){var i;if(e===this.current&&!this.dirty)return;const s=this.gl;ur(s)?s.bindVertexArray(e):(i=s.getExtension("OES_vertex_array_object"))===null||i===void 0||i.bindVertexArrayOES(e),this.current=e,this.dirty=!1}}class Oo extends At{getDefault(){return 4}set(e){if(e===this.current&&!this.dirty)return;const i=this.gl;i.pixelStorei(i.UNPACK_ALIGNMENT,e),this.current=e,this.dirty=!1}}class Bs extends At{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const i=this.gl;i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e),this.current=e,this.dirty=!1}}class jo extends At{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const i=this.gl;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,e),this.current=e,this.dirty=!1}}class No extends At{constructor(e,i){super(e),this.context=e,this.parent=i}getDefault(){return null}}class Ka extends No{setDirty(){this.dirty=!0}set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const i=this.gl;i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,e,0),this.current=e,this.dirty=!1}}class Ya extends No{set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const i=this.gl;i.framebufferRenderbuffer(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.RENDERBUFFER,e),this.current=e,this.dirty=!1}}class Hu extends No{set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const i=this.gl;i.framebufferRenderbuffer(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.RENDERBUFFER,e),this.current=e,this.dirty=!1}}const Zo="Framebuffer is not complete";class _t{constructor(e,i,s,l,h){this.context=e,this.width=i,this.height=s;const f=e.gl,_=this.framebuffer=f.createFramebuffer();if(this.colorAttachment=new Ka(e,_),l)this.depthAttachment=h?new Hu(e,_):new Ya(e,_);else if(h)throw new Error("Stencil cannot be set without depth");if(f.checkFramebufferStatus(f.FRAMEBUFFER)!==f.FRAMEBUFFER_COMPLETE)throw new Error(Zo)}destroy(){const e=this.context.gl,i=this.colorAttachment.get();if(i&&e.deleteTexture(i),this.depthAttachment){const s=this.depthAttachment.get();s&&e.deleteRenderbuffer(s)}e.deleteFramebuffer(this.framebuffer)}}class Vo{constructor(e){var i,s;if(this.gl=e,this.clearColor=new kn(this),this.clearDepth=new Hl(this),this.clearStencil=new Wl(this),this.colorMask=new Xl(this),this.depthMask=new Vu(this),this.stencilMask=new Kl(this),this.stencilFunc=new ya(this),this.stencilOp=new Yl(this),this.stencilTest=new zd(this),this.depthRange=new Rd(this),this.depthTest=new Dd(this),this.depthFunc=new Ld(this),this.blend=new Uu(this),this.blendFunc=new Bd(this),this.blendColor=new $u(this),this.blendEquation=new Ro(this),this.cullFace=new Do(this),this.cullFaceSide=new Lo(this),this.frontFace=new Jl(this),this.program=new xa(this),this.activeTexture=new Bo(this),this.viewport=new Xa(this),this.bindFramebuffer=new Wr(this),this.bindRenderbuffer=new Gu(this),this.bindTexture=new qu(this),this.bindVertexBuffer=new Ql(this),this.bindElementBuffer=new va(this),this.bindVertexArray=new Fo(this),this.pixelStoreUnpack=new Oo(this),this.pixelStoreUnpackPremultiplyAlpha=new Bs(this),this.pixelStoreUnpackFlipY=new jo(this),this.extTextureFilterAnisotropic=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=e.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=e.getParameter(e.MAX_TEXTURE_SIZE),ur(e)){this.HALF_FLOAT=e.HALF_FLOAT;const l=e.getExtension("EXT_color_buffer_half_float");this.RGBA16F=(i=e.RGBA16F)!==null&&i!==void 0?i:l==null?void 0:l.RGBA16F_EXT,this.RGB16F=(s=e.RGB16F)!==null&&s!==void 0?s:l==null?void 0:l.RGB16F_EXT,e.getExtension("EXT_color_buffer_float")}else{e.getExtension("EXT_color_buffer_half_float"),e.getExtension("OES_texture_half_float_linear");const l=e.getExtension("OES_texture_half_float");this.HALF_FLOAT=l==null?void 0:l.HALF_FLOAT_OES}}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.bindVertexArray.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(e,i){return new Nu(this,e,i)}createVertexBuffer(e,i,s){return new Zu(this,e,i,s)}createRenderbuffer(e,i,s){const l=this.gl,h=l.createRenderbuffer();return this.bindRenderbuffer.set(h),l.renderbufferStorage(l.RENDERBUFFER,e,i,s),this.bindRenderbuffer.set(null),h}createFramebuffer(e,i,s,l){return new _t(this,e,i,s,l)}clear({color:e,depth:i,stencil:s}){const l=this.gl;let h=0;e&&(h|=l.COLOR_BUFFER_BIT,this.clearColor.set(e),this.colorMask.set([!0,!0,!0,!0])),i!==void 0&&(h|=l.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(i),this.depthMask.set(!0)),s!==void 0&&(h|=l.STENCIL_BUFFER_BIT,this.clearStencil.set(s),this.stencilMask.set(255)),l.clear(h)}setCullFace(e){e.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(e.mode),this.frontFace.set(e.frontFace))}setDepthMode(e){e.func!==this.gl.ALWAYS||e.mask?(this.depthTest.set(!0),this.depthFunc.set(e.func),this.depthMask.set(e.mask),this.depthRange.set(e.range)):this.depthTest.set(!1)}setStencilMode(e){e.test.func!==this.gl.ALWAYS||e.mask?(this.stencilTest.set(!0),this.stencilMask.set(e.mask),this.stencilOp.set([e.fail,e.depthFail,e.pass]),this.stencilFunc.set({func:e.test.func,ref:e.ref,mask:e.test.mask})):this.stencilTest.set(!1)}setColorMode(e){o.bE(e.blendFunction,Zt.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(e.blendFunction),this.blendColor.set(e.blendColor)),this.colorMask.set(e.mask)}createVertexArray(){var e;return ur(this.gl)?this.gl.createVertexArray():(e=this.gl.getExtension("OES_vertex_array_object"))===null||e===void 0?void 0:e.createVertexArrayOES()}deleteVertexArray(e){var i;return ur(this.gl)?this.gl.deleteVertexArray(e):(i=this.gl.getExtension("OES_vertex_array_object"))===null||i===void 0?void 0:i.deleteVertexArrayOES(e)}unbindVAO(){this.bindVertexArray.set(null)}}let Uo;function ec(u,e,i,s,l){const h=u.context,f=u.transform,_=h.gl,x=u.useProgram("collisionBox"),T=[];let P=0,E=0;for(let W=0;W<s.length;W++){const K=s[W],te=e.getTile(K).getBucket(i);if(!te)continue;const ee=l?te.textCollisionBox:te.iconCollisionBox,ie=te.collisionCircleArray;ie.length>0&&(T.push({circleArray:ie,circleOffset:E,coord:K}),P+=ie.length/4,E=P),ee&&x.draw(h,_.LINES,ot.disabled,ht.disabled,u.colorModeForRenderPass(),Tt.disabled,Id(u.transform),u.style.map.terrain&&u.style.map.terrain.getTerrainData(K),f.getProjectionData({overscaledTileID:K,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),i.id,ee.layoutVertexBuffer,ee.indexBuffer,ee.segments,null,u.transform.zoom,null,null,ee.collisionVertexBuffer)}if(!l||!T.length)return;const A=u.useProgram("collisionCircle"),F=new o.bT;F.resize(4*P),F._trim();let O=0;for(const W of T)for(let K=0;K<W.circleArray.length/4;K++){const te=4*K,ee=W.circleArray[te+0],ie=W.circleArray[te+1],se=W.circleArray[te+2],re=W.circleArray[te+3];F.emplace(O++,ee,ie,se,re,0),F.emplace(O++,ee,ie,se,re,1),F.emplace(O++,ee,ie,se,re,2),F.emplace(O++,ee,ie,se,re,3)}(!Uo||Uo.length<2*P)&&(Uo=function(W){const K=2*W,te=new o.bV;te.resize(K),te._trim();for(let ee=0;ee<K;ee++){const ie=6*ee;te.uint16[ie+0]=4*ee+0,te.uint16[ie+1]=4*ee+1,te.uint16[ie+2]=4*ee+2,te.uint16[ie+3]=4*ee+2,te.uint16[ie+4]=4*ee+3,te.uint16[ie+5]=4*ee+0}return te}(P));const H=h.createIndexBuffer(Uo,!0),q=h.createVertexBuffer(F,o.bU.members,!0);for(const W of T){const K=ko(u.transform);A.draw(h,_.TRIANGLES,ot.disabled,ht.disabled,u.colorModeForRenderPass(),Tt.disabled,K,u.style.map.terrain&&u.style.map.terrain.getTerrainData(W.coord),null,i.id,q,H,o.aJ.simpleSegment(0,2*W.circleOffset,W.circleArray.length,W.circleArray.length/2),null,u.transform.zoom,null,null,null)}q.destroy(),H.destroy()}const Fs=o.ad(new Float32Array(16));function Fd(u,e,i,s,l,h){const{horizontalAlign:f,verticalAlign:_}=o.aE(u);return new o.P((-(f-.5)*e/l+s[0])*h,(-(_-.5)*i/l+s[1])*h)}function Od(u,e,i,s,l,h){const f=e.tileAnchorPoint.add(new o.P(e.translation[0],e.translation[1]));if(e.pitchWithMap){let _=s.mult(h);i||(_=_.rotate(-l));const x=f.add(_);return we(x.x,x.y,e.pitchedLabelPlaneMatrix,e.getElevation).point}if(i){const _=li(e.tileAnchorPoint.x+1,e.tileAnchorPoint.y,e).point.sub(u),x=Math.atan(_.y/_.x)+(_.x<0?Math.PI:0);return u.add(s.rotate(x))}return u.add(s)}function Wu(u,e,i,s,l,h,f,_,x,T,P,E){const A=u.text.placedSymbolArray,F=u.text.dynamicLayoutVertexArray,O=u.icon.dynamicLayoutVertexArray,H={};F.clear();for(let q=0;q<A.length;q++){const W=A.get(q),K=W.hidden||!W.crossTileID||u.allowVerticalPlacement&&!W.placedOrientation?null:s[W.crossTileID];if(K){const te=new o.P(W.anchorX,W.anchorY),ee={getElevation:E,width:l.width,height:l.height,pitchedLabelPlaneMatrix:h,pitchWithMap:i,transform:l,tileAnchorPoint:te,translation:T,unwrappedTileID:P},ie=i?ut(te.x,te.y,ee):li(te.x,te.y,ee),se=Bt(l.cameraToCenterDistance,ie.signedDistanceFromCamera);let re=o.am(u.textSizeData,_,W)*se/o.ay;i&&(re*=u.tilePixelRatio/f);const{width:pe,height:Me,anchor:xe,textOffset:ve,textBoxScale:be}=K,Fe=Fd(xe,pe,Me,ve,be,re),Be=l.getPitchedTextCorrection(te.x+T[0],te.y+T[1],P),ke=Od(ie.point,ee,e,Fe,-l.bearingInRadians,Be),We=u.allowVerticalPlacement&&W.placedOrientation===o.al.vertical?Math.PI/2:0;for(let dt=0;dt<W.numGlyphs;dt++)o.as(F,ke,We);x&&W.associatedIconIndex>=0&&(H[W.associatedIconIndex]={shiftedAnchor:ke,angle:We})}else An(W.numGlyphs,F)}if(x){O.clear();const q=u.icon.placedSymbolArray;for(let W=0;W<q.length;W++){const K=q.get(W);if(K.hidden)An(K.numGlyphs,O);else{const te=H[W];if(te)for(let ee=0;ee<K.numGlyphs;ee++)o.as(O,te.shiftedAnchor,te.angle);else An(K.numGlyphs,O)}}u.icon.dynamicLayoutVertexBuffer.updateData(O)}u.text.dynamicLayoutVertexBuffer.updateData(F)}function jd(u,e,i){return i.iconsInText&&e?"symbolTextAndIcon":u?"symbolSDF":"symbolIcon"}function $o(u,e,i,s,l,h,f,_,x,T,P,E,A){const F=u.context,O=F.gl,H=u.transform,q=_==="map",W=x==="map",K=_!=="viewport"&&i.layout.get("symbol-placement")!=="point",te=q&&!W&&!K,ee=!i.layout.get("symbol-sort-key").isConstant();let ie=!1;const se=u.getDepthModeForSublayer(0,ot.ReadOnly),re=i._unevaluatedLayout.hasValue("text-variable-anchor")||i._unevaluatedLayout.hasValue("text-variable-anchor-offset"),pe=[],Me=H.getCircleRadiusCorrection();for(const xe of s){const ve=e.getTile(xe),be=ve.getBucket(i);if(!be)continue;const Fe=l?be.text:be.icon;if(!Fe||!Fe.segments.get().length||!Fe.hasVisibleVertices)continue;const Be=Fe.programConfigurations.get(i.id),ke=l||be.sdfIcons,We=l?be.textSizeData:be.iconSizeData,dt=W||H.pitch!==0,Mt=u.useProgram(jd(ke,l,be),Be),ti=o.ak(We,H.zoom),Vt=u.style.map.terrain&&u.style.map.terrain.getTerrainData(xe);let ii,ri,$t,kt,zi=[0,0],Zi=null;if(l)ri=ve.glyphAtlasTexture,$t=O.LINEAR,ii=ve.glyphAtlasTexture.size,be.iconsInText&&(zi=ve.imageAtlasTexture.size,Zi=ve.imageAtlasTexture,kt=dt||u.options.rotating||u.options.zooming||We.kind==="composite"||We.kind==="camera"?O.LINEAR:O.NEAREST);else{const Si=i.layout.get("icon-size").constantOr(0)!==1||be.iconsNeedLinear;ri=ve.imageAtlasTexture,$t=ke||u.options.rotating||u.options.zooming||Si||dt?O.LINEAR:O.NEAREST,ii=ve.imageAtlasTexture.size}const Qi=o.az(ve,1,u.transform.zoom),zt=et(q,u.transform,Qi),Wn=o.K();o.an(Wn,zt);const Mn=lt(W,q,u.transform,Qi),Xn=o.aA(H,ve,h,f),Ta=H.getProjectionData({overscaledTileID:xe,applyGlobeMatrix:!A,applyTerrainMatrix:!0}),Js=re&&be.hasTextData(),Kn=i.layout.get("icon-text-fit")!=="none"&&Js&&be.hasIconData();if(K){const Si=u.style.map.terrain?(wr,Ht)=>u.style.map.terrain.getElevation(xe,wr,Ht):null,Pi=i.layout.get("text-rotation-alignment")==="map";Et(be,u,l,zt,Wn,W,T,Pi,xe.toUnwrapped(),H.width,H.height,Xn,Si)}const Ma=l&&re||Kn,jr=K||Ma?Fs:W?zt:u.transform.clipSpaceToPixelsMatrix,Yn=ke&&i.paint.get(l?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let Rn;Rn=ke?be.iconsInText?zo(We.kind,ti,te,W,K,Ma,u,jr,Mn,Xn,ii,zi,Me):Ou(We.kind,ti,te,W,K,Ma,u,jr,Mn,Xn,l,ii,0,Me):Wa(We.kind,ti,te,W,K,Ma,u,jr,Mn,Xn,l,ii,Me);const Jn={program:Mt,buffers:Fe,uniformValues:Rn,projectionData:Ta,atlasTexture:ri,atlasTextureIcon:Zi,atlasInterpolation:$t,atlasInterpolationIcon:kt,isSDF:ke,hasHalo:Yn};if(ee&&be.canOverlap){ie=!0;const Si=Fe.segments.get();for(const Pi of Si)pe.push({segments:new o.aJ([Pi]),sortKey:Pi.sortKey,state:Jn,terrainData:Vt})}else pe.push({segments:Fe.segments,sortKey:0,state:Jn,terrainData:Vt})}ie&&pe.sort((xe,ve)=>xe.sortKey-ve.sortKey);for(const xe of pe){const ve=xe.state;if(F.activeTexture.set(O.TEXTURE0),ve.atlasTexture.bind(ve.atlasInterpolation,O.CLAMP_TO_EDGE),ve.atlasTextureIcon&&(F.activeTexture.set(O.TEXTURE1),ve.atlasTextureIcon&&ve.atlasTextureIcon.bind(ve.atlasInterpolationIcon,O.CLAMP_TO_EDGE)),ve.isSDF){const be=ve.uniformValues;ve.hasHalo&&(be.u_is_halo=1,Os(ve.buffers,xe.segments,i,u,ve.program,se,P,E,be,ve.projectionData,xe.terrainData)),be.u_is_halo=0}Os(ve.buffers,xe.segments,i,u,ve.program,se,P,E,ve.uniformValues,ve.projectionData,xe.terrainData)}}function Os(u,e,i,s,l,h,f,_,x,T,P){const E=s.context;l.draw(E,E.gl.TRIANGLES,h,f,_,Tt.backCCW,x,P,T,i.id,u.layoutVertexBuffer,u.indexBuffer,e,i.paint,s.transform.zoom,u.programConfigurations.get(i.id),u.dynamicLayoutVertexBuffer,u.opacityVertexBuffer)}function Go(u,e,i,s,l){const h=u.context,f=h.gl,_=ht.disabled,x=new Zt([f.ONE,f.ONE],o.b7.transparent,[!0,!0,!0,!0]),T=e.getBucket(i);if(!T)return;const P=s.key;let E=i.heatmapFbos.get(P);E||(E=qo(h,e.tileSize,e.tileSize),i.heatmapFbos.set(P,E)),h.bindFramebuffer.set(E.framebuffer),h.viewport.set([0,0,e.tileSize,e.tileSize]),h.clear({color:o.b7.transparent});const A=T.programConfigurations.get(i.id),F=u.useProgram("heatmap",A,!l),O=u.transform.getProjectionData({overscaledTileID:e.tileID,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),H=u.style.map.terrain.getTerrainData(s);F.draw(h,f.TRIANGLES,ot.disabled,_,x,Tt.disabled,_a(e,u.transform.zoom,i.paint.get("heatmap-intensity"),1),H,O,i.id,T.layoutVertexBuffer,T.indexBuffer,T.segments,i.paint,u.transform.zoom,A)}function tc(u,e,i,s,l){const h=u.context,f=h.gl,_=u.transform;h.setColorMode(u.colorModeForRenderPass());const x=ic(h,e),T=i.key,P=e.heatmapFbos.get(T);if(!P)return;h.activeTexture.set(f.TEXTURE0),f.bindTexture(f.TEXTURE_2D,P.colorAttachment.get()),h.activeTexture.set(f.TEXTURE1),x.bind(f.LINEAR,f.CLAMP_TO_EDGE);const E=_.getProjectionData({overscaledTileID:i,applyTerrainMatrix:l,applyGlobeMatrix:!s});u.useProgram("heatmapTexture").draw(h,f.TRIANGLES,ot.disabled,ht.disabled,u.colorModeForRenderPass(),Tt.disabled,Eu(u,e,0,1),null,E,e.id,u.rasterBoundsBuffer,u.quadTriangleIndexBuffer,u.rasterBoundsSegments,e.paint,_.zoom),P.destroy(),e.heatmapFbos.delete(T)}function qo(u,e,i){var s,l;const h=u.gl,f=h.createTexture();h.bindTexture(h.TEXTURE_2D,f),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_S,h.CLAMP_TO_EDGE),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_T,h.CLAMP_TO_EDGE),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MIN_FILTER,h.LINEAR),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MAG_FILTER,h.LINEAR);const _=(s=u.HALF_FLOAT)!==null&&s!==void 0?s:h.UNSIGNED_BYTE,x=(l=u.RGBA16F)!==null&&l!==void 0?l:h.RGBA;h.texImage2D(h.TEXTURE_2D,0,x,e,i,0,h.RGBA,_,null);const T=u.createFramebuffer(e,i,!1,!1);return T.colorAttachment.set(f),T}function ic(u,e){return e.colorRampTexture||(e.colorRampTexture=new Ut(u,e.colorRamp,u.gl.RGBA)),e.colorRampTexture}function js(u,e,i,s,l){if(!i||!s||!s.imageAtlas)return;const h=s.imageAtlas.patternPositions;let f=h[i.to.toString()],_=h[i.from.toString()];if(!f&&_&&(f=_),!_&&f&&(_=f),!f||!_){const x=l.getPaintProperty(e);f=h[x],_=h[x]}f&&_&&u.setConstantPatternPositions(f,_)}function Ns(u,e,i,s,l,h,f,_){const x=u.context.gl,T="fill-pattern",P=i.paint.get(T),E=P&&P.constantOr(1),A=i.getCrossfadeParameters();let F,O,H,q,W;const K=u.transform,te=i.paint.get("fill-translate"),ee=i.paint.get("fill-translate-anchor");f?(O=E&&!i.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",F=x.LINES):(O=E?"fillPattern":"fill",F=x.TRIANGLES);const ie=P.constantOr(null);for(const se of s){const re=e.getTile(se);if(E&&!re.patternsLoaded())continue;const pe=re.getBucket(i);if(!pe)continue;const Me=pe.programConfigurations.get(i.id),xe=u.useProgram(O,Me),ve=u.style.map.terrain&&u.style.map.terrain.getTerrainData(se);E&&(u.context.activeTexture.set(x.TEXTURE0),re.imageAtlasTexture.bind(x.LINEAR,x.CLAMP_TO_EDGE),Me.updatePaintBuffers(A)),js(Me,T,ie,re,i);const be=K.getProjectionData({overscaledTileID:se,applyGlobeMatrix:!_,applyTerrainMatrix:!0}),Fe=o.aA(K,re,te,ee);if(f){q=pe.indexBuffer2,W=pe.segments2;const ke=[x.drawingBufferWidth,x.drawingBufferHeight];H=O==="fillOutlinePattern"&&E?Rs(u,A,re,ke,Fe):Ul(ke,Fe)}else q=pe.indexBuffer,W=pe.segments,H=E?Iu(u,A,re,Fe):{u_fill_translate:Fe};const Be=u.stencilModeForClipping(se);xe.draw(u.context,F,l,Be,h,Tt.backCCW,H,ve,be,i.id,pe.layoutVertexBuffer,q,W,i.paint,u.transform.zoom,Me)}}function Zs(u,e,i,s,l,h,f,_){const x=u.context,T=x.gl,P="fill-extrusion-pattern",E=i.paint.get(P),A=E.constantOr(1),F=i.getCrossfadeParameters(),O=i.paint.get("fill-extrusion-opacity"),H=E.constantOr(null),q=u.transform;for(const W of s){const K=e.getTile(W),te=K.getBucket(i);if(!te)continue;const ee=u.style.map.terrain&&u.style.map.terrain.getTerrainData(W),ie=te.programConfigurations.get(i.id),se=u.useProgram(A?"fillExtrusionPattern":"fillExtrusion",ie);A&&(u.context.activeTexture.set(T.TEXTURE0),K.imageAtlasTexture.bind(T.LINEAR,T.CLAMP_TO_EDGE),ie.updatePaintBuffers(F));const re=q.getProjectionData({overscaledTileID:W,applyGlobeMatrix:!_,applyTerrainMatrix:!0});js(ie,P,H,K,i);const pe=o.aA(q,K,i.paint.get("fill-extrusion-translate"),i.paint.get("fill-extrusion-translate-anchor")),Me=i.paint.get("fill-extrusion-vertical-gradient"),xe=A?bn(u,Me,O,pe,W,F,K):Eo(u,Me,O,pe);se.draw(x,x.gl.TRIANGLES,l,h,f,Tt.backCCW,xe,ee,re,i.id,te.layoutVertexBuffer,te.indexBuffer,te.segments,i.paint,u.transform.zoom,ie,u.style.map.terrain&&te.centroidVertexBuffer)}}function rc(u,e,i,s,l,h,f,_,x){var T;const P=u.style.projection,E=u.context,A=u.transform,F=E.gl,O=[`#define NUM_ILLUMINATION_SOURCES ${i.paint.get("hillshade-highlight-color").values.length}`],H=u.useProgram("hillshade",null,!1,O),q=!u.options.moving;for(const W of s){const K=e.getTile(W),te=K.fbo;if(!te)continue;const ee=P.getMeshFromTileID(E,W.canonical,_,!0,"raster"),ie=(T=u.style.map.terrain)===null||T===void 0?void 0:T.getTerrainData(W);E.activeTexture.set(F.TEXTURE0),F.bindTexture(F.TEXTURE_2D,te.colorAttachment.get());const se=A.getProjectionData({overscaledTileID:W,aligned:q,applyGlobeMatrix:!x,applyTerrainMatrix:!0});H.draw(E,F.TRIANGLES,h,l[W.overscaledZ],f,Tt.backCCW,ku(u,K,i),ie,se,i.id,ee.vertexBuffer,ee.indexBuffer,ee.segments)}}const Vs=[new o.P(0,0),new o.P(o.Z,0),new o.P(o.Z,o.Z),new o.P(0,o.Z)];function Ho(u,e,i,s,l,h,f,_,x=!1,T=!1){const P=s[s.length-1].overscaledZ,E=u.context,A=E.gl,F=u.useProgram("raster"),O=u.transform,H=u.style.projection,q=u.colorModeForRenderPass(),W=!u.options.moving;for(const K of s){const te=u.getDepthModeForSublayer(K.overscaledZ-P,i.paint.get("raster-opacity")===1?ot.ReadWrite:ot.ReadOnly,A.LESS),ee=e.getTile(K);ee.registerFadeDuration(i.paint.get("raster-fade-duration"));const ie=e.findLoadedParent(K,0),se=e.findLoadedSibling(K),re=Xu(ee,ie||se||null,e,i,u.transform,u.style.map.terrain);let pe,Me;const xe=i.paint.get("raster-resampling")==="nearest"?A.NEAREST:A.LINEAR;E.activeTexture.set(A.TEXTURE0),ee.texture.bind(xe,A.CLAMP_TO_EDGE,A.LINEAR_MIPMAP_NEAREST),E.activeTexture.set(A.TEXTURE1),ie?(ie.texture.bind(xe,A.CLAMP_TO_EDGE,A.LINEAR_MIPMAP_NEAREST),pe=Math.pow(2,ie.tileID.overscaledZ-ee.tileID.overscaledZ),Me=[ee.tileID.canonical.x*pe%1,ee.tileID.canonical.y*pe%1]):ee.texture.bind(xe,A.CLAMP_TO_EDGE,A.LINEAR_MIPMAP_NEAREST),ee.texture.useMipmap&&E.extTextureFilterAnisotropic&&u.transform.pitch>20&&A.texParameterf(A.TEXTURE_2D,E.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,E.extTextureFilterAnisotropicMax);const ve=u.style.map.terrain&&u.style.map.terrain.getTerrainData(K),be=O.getProjectionData({overscaledTileID:K,aligned:W,applyGlobeMatrix:!T,applyTerrainMatrix:!0}),Fe=Bu(Me||[0,0],pe||1,re,i,_),Be=H.getMeshFromTileID(E,K.canonical,h,f,"raster");F.draw(E,A.TRIANGLES,te,l?l[K.overscaledZ]:ht.disabled,q,x?Tt.frontCCW:Tt.backCCW,Fe,ve,be,i.id,Be.vertexBuffer,Be.indexBuffer,Be.segments)}}function Xu(u,e,i,s,l,h){const f=s.paint.get("raster-fade-duration");if(!h&&f>0){const _=Ce.now(),x=(_-u.timeAdded)/f,T=e?(_-e.timeAdded)/f:-1,P=i.getSource(),E=me(l,{tileSize:P.tileSize,roundZoom:P.roundZoom}),A=!e||Math.abs(e.tileID.overscaledZ-E)>Math.abs(u.tileID.overscaledZ-E),F=A&&u.refreshedUponExpiration?1:o.ae(A?x:1-T,0,1);return u.refreshedUponExpiration&&x>=1&&(u.refreshedUponExpiration=!1),e?{opacity:1,mix:1-F}:{opacity:F,mix:0}}return{opacity:1,mix:0}}const Wo=new o.b7(1,0,0,1),nc=new o.b7(0,1,0,1),Ku=new o.b7(0,0,1,1),Yu=new o.b7(1,0,1,1),Xo=new o.b7(0,1,1,1);function Ko(u,e,i,s){Us(u,0,e+i/2,u.transform.width,i,s)}function Ju(u,e,i,s){Us(u,e-i/2,0,i,u.transform.height,s)}function Us(u,e,i,s,l,h){const f=u.context,_=f.gl;_.enable(_.SCISSOR_TEST),_.scissor(e*u.pixelRatio,i*u.pixelRatio,s*u.pixelRatio,l*u.pixelRatio),f.clear({color:h}),_.disable(_.SCISSOR_TEST)}function mi(u,e,i){const s=u.context,l=s.gl,h=u.useProgram("debug"),f=ot.disabled,_=ht.disabled,x=u.colorModeForRenderPass(),T="$debug",P=u.style.map.terrain&&u.style.map.terrain.getTerrainData(i);s.activeTexture.set(l.TEXTURE0);const E=e.getTileByID(i.key).latestRawTileData,A=Math.floor((E&&E.byteLength||0)/1024),F=e.getTile(i).tileSize,O=512/Math.min(F,512)*(i.overscaledZ/u.transform.zoom)*.5;let H=i.canonical.toString();i.overscaledZ!==i.canonical.z&&(H+=` => ${i.overscaledZ}`),function(W,K){W.initDebugOverlayCanvas();const te=W.debugOverlayCanvas,ee=W.context.gl,ie=W.debugOverlayCanvas.getContext("2d");ie.clearRect(0,0,te.width,te.height),ie.shadowColor="white",ie.shadowBlur=2,ie.lineWidth=1.5,ie.strokeStyle="white",ie.textBaseline="top",ie.font="bold 36px Open Sans, sans-serif",ie.fillText(K,5,5),ie.strokeText(K,5,5),W.debugOverlayTexture.update(te),W.debugOverlayTexture.bind(ee.LINEAR,ee.CLAMP_TO_EDGE)}(u,`${H} ${A}kB`);const q=u.transform.getProjectionData({overscaledTileID:i,applyGlobeMatrix:!0,applyTerrainMatrix:!0});h.draw(s,l.TRIANGLES,f,_,Zt.alphaBlended,Tt.disabled,Au(o.b7.transparent,O),null,q,T,u.debugBuffer,u.quadTriangleIndexBuffer,u.debugSegments),h.draw(s,l.LINE_STRIP,f,_,x,Tt.disabled,Au(o.b7.red),P,q,T,u.debugBuffer,u.tileBorderIndexBuffer,u.debugSegments)}function Hn(u,e,i,s){const{isRenderingGlobe:l}=s,h=u.context,f=h.gl,_=u.transform,x=u.colorModeForRenderPass(),T=u.getDepthModeFor3D(),P=u.useProgram("terrain");h.bindFramebuffer.set(null),h.viewport.set([0,0,u.width,u.height]);for(const E of i){const A=e.getTerrainMesh(E.tileID),F=u.renderToTexture.getTexture(E),O=e.getTerrainData(E.tileID);h.activeTexture.set(f.TEXTURE0),f.bindTexture(f.TEXTURE_2D,F.texture);const H=e.getMeshFrameDelta(_.zoom),q=_.calculateFogMatrix(E.tileID.toUnwrapped()),W=Cd(H,q,u.style.sky,_.pitch,l),K=_.getProjectionData({overscaledTileID:E.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});P.draw(h,f.TRIANGLES,T,ht.disabled,x,Tt.backCCW,W,O,K,"terrain",A.vertexBuffer,A.indexBuffer,A.segments)}}function Or(u,e){if(!e.mesh){const i=new o.aI;i.emplaceBack(-1,-1),i.emplaceBack(1,-1),i.emplaceBack(1,1),i.emplaceBack(-1,1);const s=new o.aK;s.emplaceBack(0,1,2),s.emplaceBack(0,2,3),e.mesh=new Va(u.createVertexBuffer(i,xr.members),u.createIndexBuffer(s),o.aJ.simpleSegment(0,0,i.length,s.length))}return e.mesh}class ac{constructor(e,i){this.context=new Vo(e),this.transform=i,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:o.ad(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=he.maxUnderzooming+he.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Ts}resize(e,i,s){if(this.width=Math.floor(e*s),this.height=Math.floor(i*s),this.pixelRatio=s,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const l of this.style._order)this.style._layers[l].resize()}setup(){const e=this.context,i=new o.aI;i.emplaceBack(0,0),i.emplaceBack(o.Z,0),i.emplaceBack(0,o.Z),i.emplaceBack(o.Z,o.Z),this.tileExtentBuffer=e.createVertexBuffer(i,xr.members),this.tileExtentSegments=o.aJ.simpleSegment(0,0,4,2);const s=new o.aI;s.emplaceBack(0,0),s.emplaceBack(o.Z,0),s.emplaceBack(0,o.Z),s.emplaceBack(o.Z,o.Z),this.debugBuffer=e.createVertexBuffer(s,xr.members),this.debugSegments=o.aJ.simpleSegment(0,0,4,5);const l=new o.b_;l.emplaceBack(0,0,0,0),l.emplaceBack(o.Z,0,o.Z,0),l.emplaceBack(0,o.Z,0,o.Z),l.emplaceBack(o.Z,o.Z,o.Z,o.Z),this.rasterBoundsBuffer=e.createVertexBuffer(l,Sd.members),this.rasterBoundsSegments=o.aJ.simpleSegment(0,0,4,2);const h=new o.aI;h.emplaceBack(0,0),h.emplaceBack(o.Z,0),h.emplaceBack(0,o.Z),h.emplaceBack(o.Z,o.Z),this.rasterBoundsBufferPosOnly=e.createVertexBuffer(h,xr.members),this.rasterBoundsSegmentsPosOnly=o.aJ.simpleSegment(0,0,4,5);const f=new o.aI;f.emplaceBack(0,0),f.emplaceBack(1,0),f.emplaceBack(0,1),f.emplaceBack(1,1),this.viewportBuffer=e.createVertexBuffer(f,xr.members),this.viewportSegments=o.aJ.simpleSegment(0,0,4,2);const _=new o.b$;_.emplaceBack(0),_.emplaceBack(1),_.emplaceBack(3),_.emplaceBack(2),_.emplaceBack(0),this.tileBorderIndexBuffer=e.createIndexBuffer(_);const x=new o.aK;x.emplaceBack(1,0,2),x.emplaceBack(1,2,3),this.quadTriangleIndexBuffer=e.createIndexBuffer(x);const T=this.context.gl;this.stencilClearMode=new ht({func:T.ALWAYS,mask:0},0,255,T.ZERO,T.ZERO,T.ZERO),this.tileExtentMesh=new Va(this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}clearStencil(){const e=this.context,i=e.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const s=o.K();o.bQ(s,0,this.width,this.height,0,0,1),o.M(s,s,[i.drawingBufferWidth,i.drawingBufferHeight,0]);const l={mainMatrix:s,tileMercatorCoords:[0,0,1,1],clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:s};this.useProgram("clippingMask",null,!0).draw(e,i.TRIANGLES,ot.disabled,this.stencilClearMode,Zt.disabled,Tt.disabled,null,null,l,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(e,i,s){if(this.currentStencilSource===e.source||!e.isTileClipped()||!i||!i.length)return;this.currentStencilSource=e.source,this.nextStencilID+i.length>256&&this.clearStencil();const l=this.context;l.setColorMode(Zt.disabled),l.setDepthMode(ot.disabled);const h={};for(const f of i)h[f.key]=this.nextStencilID++;this._renderTileMasks(h,i,s,!0),this._renderTileMasks(h,i,s,!1),this._tileClippingMaskIDs=h}_renderTileMasks(e,i,s,l){const h=this.context,f=h.gl,_=this.style.projection,x=this.transform,T=this.useProgram("clippingMask");for(const P of i){const E=e[P.key],A=this.style.map.terrain&&this.style.map.terrain.getTerrainData(P),F=_.getMeshFromTileID(this.context,P.canonical,l,!0,"stencil"),O=x.getProjectionData({overscaledTileID:P,applyGlobeMatrix:!s,applyTerrainMatrix:!0});T.draw(h,f.TRIANGLES,ot.disabled,new ht({func:f.ALWAYS,mask:0},E,255,f.KEEP,f.KEEP,f.REPLACE),Zt.disabled,s?Tt.disabled:Tt.backCCW,null,A,O,"$clipping",F.vertexBuffer,F.indexBuffer,F.segments)}}_renderTilesDepthBuffer(){const e=this.context,i=e.gl,s=this.style.projection,l=this.transform,h=this.useProgram("depth"),f=this.getDepthModeFor3D(),_=oe(l,{tileSize:l.tileSize});for(const x of _){const T=this.style.map.terrain&&this.style.map.terrain.getTerrainData(x),P=s.getMeshFromTileID(this.context,x.canonical,!0,!0,"raster"),E=l.getProjectionData({overscaledTileID:x,applyGlobeMatrix:!0,applyTerrainMatrix:!0});h.draw(e,i.TRIANGLES,f,ht.disabled,Zt.disabled,Tt.backCCW,null,T,E,"$clipping",P.vertexBuffer,P.indexBuffer,P.segments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const e=this.nextStencilID++,i=this.context.gl;return new ht({func:i.NOTEQUAL,mask:255},e,255,i.KEEP,i.KEEP,i.REPLACE)}stencilModeForClipping(e){const i=this.context.gl;return new ht({func:i.EQUAL,mask:255},this._tileClippingMaskIDs[e.key],0,i.KEEP,i.KEEP,i.REPLACE)}getStencilConfigForOverlapAndUpdateStencilID(e){const i=this.context.gl,s=e.sort((f,_)=>_.overscaledZ-f.overscaledZ),l=s[s.length-1].overscaledZ,h=s[0].overscaledZ-l+1;if(h>1){this.currentStencilSource=void 0,this.nextStencilID+h>256&&this.clearStencil();const f={};for(let _=0;_<h;_++)f[_+l]=new ht({func:i.GEQUAL,mask:255},_+this.nextStencilID,255,i.KEEP,i.KEEP,i.REPLACE);return this.nextStencilID+=h,[f,s]}return[{[l]:ht.disabled},s]}stencilConfigForOverlapTwoPass(e){const i=this.context.gl,s=e.sort((f,_)=>_.overscaledZ-f.overscaledZ),l=s[s.length-1].overscaledZ,h=s[0].overscaledZ-l+1;if(this.clearStencil(),h>1){const f={},_={};for(let x=0;x<h;x++)f[x+l]=new ht({func:i.GREATER,mask:255},h+1+x,255,i.KEEP,i.KEEP,i.REPLACE),_[x+l]=new ht({func:i.GREATER,mask:255},1+x,255,i.KEEP,i.KEEP,i.REPLACE);return this.nextStencilID=2*h+1,[f,_,s]}return this.nextStencilID=3,[{[l]:new ht({func:i.GREATER,mask:255},2,255,i.KEEP,i.KEEP,i.REPLACE)},{[l]:new ht({func:i.GREATER,mask:255},1,255,i.KEEP,i.KEEP,i.REPLACE)},s]}colorModeForRenderPass(){const e=this.context.gl;return this._showOverdrawInspector?new Zt([e.CONSTANT_COLOR,e.ONE],new o.b7(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?Zt.unblended:Zt.alphaBlended}getDepthModeForSublayer(e,i,s){if(!this.opaquePassEnabledForLayer())return ot.disabled;const l=1-((1+this.currentLayer)*this.numSublayers+e)*this.depthEpsilon;return new ot(s||this.context.gl.LEQUAL,i,[l,l])}getDepthModeFor3D(){return new ot(this.context.gl.LEQUAL,ot.ReadWrite,this.depthRangeFor3D)}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(e,i){var s,l;this.style=e,this.options=i,this.lineAtlas=e.lineAtlas,this.imageManager=e.imageManager,this.glyphManager=e.glyphManager,this.symbolFadeChange=e.placement.symbolFadeChange(Ce.now()),this.imageManager.beginFrame();const h=this.style._order,f=this.style.sourceCaches,_={},x={},T={},P={isRenderingToTexture:!1,isRenderingGlobe:((s=e.projection)===null||s===void 0?void 0:s.transitionState)>0};for(const A in f){const F=f[A];F.used&&F.prepare(this.context),_[A]=F.getVisibleCoordinates(!1),x[A]=_[A].slice().reverse(),T[A]=F.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let A=0;A<h.length;A++)if(this.style._layers[h[A]].is3D()){this.opaquePassCutoff=A;break}this.maybeDrawDepthAndCoords(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen";for(const A of h){const F=this.style._layers[A];if(!F.hasOffscreenPass()||F.isHidden(this.transform.zoom))continue;const O=x[F.source];(F.type==="custom"||O.length)&&this.renderLayer(this,f[F.source],F,O,P)}if((l=this.style.projection)===null||l===void 0||l.updateGPUdependent({context:this.context,useProgram:A=>this.useProgram(A)}),this.context.viewport.set([0,0,this.width,this.height]),this.context.bindFramebuffer.set(null),this.context.clear({color:i.showOverdrawInspector?o.b7.black:o.b7.transparent,depth:1}),this.clearStencil(),this.style.sky&&function(A,F){const O=A.context,H=O.gl,q=((se,re,pe)=>{const Me=Math.cos(re.rollInRadians),xe=Math.sin(re.rollInRadians),ve=le(re),be=re.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}).projectionTransition;return{u_sky_color:se.properties.get("sky-color"),u_horizon_color:se.properties.get("horizon-color"),u_horizon:[(re.width/2-ve*xe)*pe,(re.height/2+ve*Me)*pe],u_horizon_normal:[-xe,Me],u_sky_horizon_blend:se.properties.get("sky-horizon-blend")*re.height/2*pe,u_sky_blend:be}})(F,A.style.map.transform,A.pixelRatio),W=new ot(H.LEQUAL,ot.ReadWrite,[0,1]),K=ht.disabled,te=A.colorModeForRenderPass(),ee=A.useProgram("sky"),ie=Or(O,F);ee.draw(O,H.TRIANGLES,W,K,te,Tt.disabled,q,null,void 0,"sky",ie.vertexBuffer,ie.indexBuffer,ie.segments)}(this,this.style.sky),this._showOverdrawInspector=i.showOverdrawInspector,this.depthRangeFor3D=[0,1-(e._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=h.length-1;this.currentLayer>=0;this.currentLayer--){const A=this.style._layers[h[this.currentLayer]],F=f[A.source],O=_[A.source];this._renderTileClippingMasks(A,O,!1),this.renderLayer(this,F,A,O,P)}this.renderPass="translucent";let E=!1;for(this.currentLayer=0;this.currentLayer<h.length;this.currentLayer++){const A=this.style._layers[h[this.currentLayer]],F=f[A.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(A,P))continue;this.opaquePassEnabledForLayer()||E||(E=!0,P.isRenderingGlobe&&!this.style.map.terrain&&this._renderTilesDepthBuffer());const O=(A.type==="symbol"?T:x)[A.source];this._renderTileClippingMasks(A,_[A.source],!!this.renderToTexture),this.renderLayer(this,F,A,O,P)}if(P.isRenderingGlobe&&function(A,F,O){const H=A.context,q=H.gl,W=A.useProgram("atmosphere"),K=new ot(q.LEQUAL,ot.ReadOnly,[0,1]),te=A.transform,ee=function(be,Fe){const Be=be.properties.get("position"),ke=[-Be.x,-Be.y,-Be.z],We=o.ad(new Float64Array(16));return be.properties.get("anchor")==="map"&&(o.a_(We,We,Fe.rollInRadians),o.a$(We,We,-Fe.pitchInRadians),o.a_(We,We,Fe.bearingInRadians),o.a$(We,We,Fe.center.lat*Math.PI/180),o.bp(We,We,-Fe.center.lng*Math.PI/180)),o.bZ(ke,ke,We),ke}(O,A.transform),ie=te.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),se=F.properties.get("atmosphere-blend")*ie.projectionTransition;if(se===0)return;const re=fa(te.worldSize,te.center.lat),pe=te.inverseProjectionMatrix,Me=new Float64Array(4);Me[3]=1,o.at(Me,Me,te.modelViewProjectionMatrix),Me[0]/=Me[3],Me[1]/=Me[3],Me[2]/=Me[3],Me[3]=1,o.at(Me,Me,pe),Me[0]/=Me[3],Me[1]/=Me[3],Me[2]/=Me[3],Me[3]=1;const xe=((be,Fe,Be,ke,We)=>({u_sun_pos:be,u_atmosphere_blend:Fe,u_globe_position:Be,u_globe_radius:ke,u_inv_proj_matrix:We}))(ee,se,[Me[0],Me[1],Me[2]],re,pe),ve=Or(H,F);W.draw(H,q.TRIANGLES,K,ht.disabled,Zt.alphaBlended,Tt.disabled,xe,null,null,"atmosphere",ve.vertexBuffer,ve.indexBuffer,ve.segments)}(this,this.style.sky,this.style.light),this.options.showTileBoundaries){const A=function(F,O){let H=null;const q=Object.values(F._layers).flatMap(ee=>ee.source&&!ee.isHidden(O)?[F.sourceCaches[ee.source]]:[]),W=q.filter(ee=>ee.getSource().type==="vector"),K=q.filter(ee=>ee.getSource().type!=="vector"),te=ee=>{(!H||H.getSource().maxzoom<ee.getSource().maxzoom)&&(H=ee)};return W.forEach(ee=>te(ee)),H||K.forEach(ee=>te(ee)),H}(this.style,this.transform.zoom);A&&function(F,O,H){for(let q=0;q<H.length;q++)mi(F,O,H[q])}(this,A,A.getVisibleCoordinates())}this.options.showPadding&&function(A){const F=A.transform.padding;Ko(A,A.transform.height-(F.top||0),3,Wo),Ko(A,F.bottom||0,3,nc),Ju(A,F.left||0,3,Ku),Ju(A,A.transform.width-(F.right||0),3,Yu);const O=A.transform.centerPoint;(function(H,q,W,K){Us(H,q-1,W-10,2,20,K),Us(H,q-10,W-1,20,2,K)})(A,O.x,A.transform.height-O.y,Xo)}(this),this.context.setDefault()}maybeDrawDepthAndCoords(e){if(!this.style||!this.style.map||!this.style.map.terrain)return;const i=this.terrainFacilitator.matrix,s=this.transform.modelViewProjectionMatrix;let l=this.terrainFacilitator.dirty;l||(l=e?!o.c0(i,s):!o.c1(i,s)),l||(l=this.style.map.terrain.sourceCache.anyTilesAfterTime(this.terrainFacilitator.renderTime)),l&&(o.c2(i,s),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(h,f){const _=h.context,x=_.gl,T=h.transform,P=Zt.unblended,E=new ot(x.LEQUAL,ot.ReadWrite,[0,1]),A=f.sourceCache.getRenderableTiles(),F=h.useProgram("terrainDepth");_.bindFramebuffer.set(f.getFramebuffer("depth").framebuffer),_.viewport.set([0,0,h.width/devicePixelRatio,h.height/devicePixelRatio]),_.clear({color:o.b7.transparent,depth:1});for(const O of A){const H=f.getTerrainMesh(O.tileID),q=f.getTerrainData(O.tileID),W=T.getProjectionData({overscaledTileID:O.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0}),K={u_ele_delta:f.getMeshFrameDelta(T.zoom)};F.draw(_,x.TRIANGLES,E,ht.disabled,P,Tt.backCCW,K,q,W,"terrain",H.vertexBuffer,H.indexBuffer,H.segments)}_.bindFramebuffer.set(null),_.viewport.set([0,0,h.width,h.height])}(this,this.style.map.terrain),function(h,f){const _=h.context,x=_.gl,T=h.transform,P=Zt.unblended,E=new ot(x.LEQUAL,ot.ReadWrite,[0,1]),A=f.getCoordsTexture(),F=f.sourceCache.getRenderableTiles(),O=h.useProgram("terrainCoords");_.bindFramebuffer.set(f.getFramebuffer("coords").framebuffer),_.viewport.set([0,0,h.width/devicePixelRatio,h.height/devicePixelRatio]),_.clear({color:o.b7.transparent,depth:1}),f.coordsIndex=[];for(const H of F){const q=f.getTerrainMesh(H.tileID),W=f.getTerrainData(H.tileID);_.activeTexture.set(x.TEXTURE0),x.bindTexture(x.TEXTURE_2D,A.texture);const K={u_terrain_coords_id:(255-f.coordsIndex.length)/255,u_texture:0,u_ele_delta:f.getMeshFrameDelta(T.zoom)},te=T.getProjectionData({overscaledTileID:H.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});O.draw(_,x.TRIANGLES,E,ht.disabled,P,Tt.backCCW,K,W,te,"terrain",q.vertexBuffer,q.indexBuffer,q.segments),f.coordsIndex.push(H.tileID.key)}_.bindFramebuffer.set(null),_.viewport.set([0,0,h.width,h.height])}(this,this.style.map.terrain))}renderLayer(e,i,s,l,h){s.isHidden(this.transform.zoom)||(s.type==="background"||s.type==="custom"||(l||[]).length)&&(this.id=s.id,o.c3(s)?function(f,_,x,T,P,E){if(f.renderPass!=="translucent")return;const{isRenderingToTexture:A}=E,F=ht.disabled,O=f.colorModeForRenderPass();(x._unevaluatedLayout.hasValue("text-variable-anchor")||x._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(H,q,W,K,te,ee,ie,se,re){const pe=q.transform,Me=q.style.map.terrain,xe=te==="map",ve=ee==="map";for(const be of H){const Fe=K.getTile(be),Be=Fe.getBucket(W);if(!Be||!Be.text||!Be.text.segments.get().length)continue;const ke=o.ak(Be.textSizeData,pe.zoom),We=o.az(Fe,1,q.transform.zoom),dt=et(xe,q.transform,We),Mt=W.layout.get("icon-text-fit")!=="none"&&Be.hasIconData();if(ke){const ti=Math.pow(2,pe.zoom-Fe.tileID.overscaledZ),Vt=Me?(ii,ri)=>Me.getElevation(be,ii,ri):null;Wu(Be,xe,ve,re,pe,dt,ti,ke,Mt,o.aA(pe,Fe,ie,se),be.toUnwrapped(),Vt)}}}(T,f,x,_,x.layout.get("text-rotation-alignment"),x.layout.get("text-pitch-alignment"),x.paint.get("text-translate"),x.paint.get("text-translate-anchor"),P),x.paint.get("icon-opacity").constantOr(1)!==0&&$o(f,_,x,T,!1,x.paint.get("icon-translate"),x.paint.get("icon-translate-anchor"),x.layout.get("icon-rotation-alignment"),x.layout.get("icon-pitch-alignment"),x.layout.get("icon-keep-upright"),F,O,A),x.paint.get("text-opacity").constantOr(1)!==0&&$o(f,_,x,T,!0,x.paint.get("text-translate"),x.paint.get("text-translate-anchor"),x.layout.get("text-rotation-alignment"),x.layout.get("text-pitch-alignment"),x.layout.get("text-keep-upright"),F,O,A),_.map.showCollisionBoxes&&(ec(f,_,x,T,!0),ec(f,_,x,T,!1))}(e,i,s,l,this.style.placement.variableOffsets,h):o.c4(s)?function(f,_,x,T,P){if(f.renderPass!=="translucent")return;const{isRenderingToTexture:E}=P,A=x.paint.get("circle-opacity"),F=x.paint.get("circle-stroke-width"),O=x.paint.get("circle-stroke-opacity"),H=!x.layout.get("circle-sort-key").isConstant();if(A.constantOr(1)===0&&(F.constantOr(1)===0||O.constantOr(1)===0))return;const q=f.context,W=q.gl,K=f.transform,te=f.getDepthModeForSublayer(0,ot.ReadOnly),ee=ht.disabled,ie=f.colorModeForRenderPass(),se=[],re=K.getCircleRadiusCorrection();for(let pe=0;pe<T.length;pe++){const Me=T[pe],xe=_.getTile(Me),ve=xe.getBucket(x);if(!ve)continue;const be=x.paint.get("circle-translate"),Fe=x.paint.get("circle-translate-anchor"),Be=o.aA(K,xe,be,Fe),ke=ve.programConfigurations.get(x.id),We=f.useProgram("circle",ke),dt=ve.layoutVertexBuffer,Mt=ve.indexBuffer,ti=f.style.map.terrain&&f.style.map.terrain.getTerrainData(Me),Vt={programConfiguration:ke,program:We,layoutVertexBuffer:dt,indexBuffer:Mt,uniformValues:Ds(f,xe,x,Be,re),terrainData:ti,projectionData:K.getProjectionData({overscaledTileID:Me,applyGlobeMatrix:!E,applyTerrainMatrix:!0})};if(H){const ii=ve.segments.get();for(const ri of ii)se.push({segments:new o.aJ([ri]),sortKey:ri.sortKey,state:Vt})}else se.push({segments:ve.segments,sortKey:0,state:Vt})}H&&se.sort((pe,Me)=>pe.sortKey-Me.sortKey);for(const pe of se){const{programConfiguration:Me,program:xe,layoutVertexBuffer:ve,indexBuffer:be,uniformValues:Fe,terrainData:Be,projectionData:ke}=pe.state;xe.draw(q,W.TRIANGLES,te,ee,ie,Tt.backCCW,Fe,Be,ke,x.id,ve,be,pe.segments,x.paint,f.transform.zoom,Me)}}(e,i,s,l,h):o.c5(s)?function(f,_,x,T,P){if(x.paint.get("heatmap-opacity")===0)return;const E=f.context,{isRenderingToTexture:A,isRenderingGlobe:F}=P;if(f.style.map.terrain){for(const O of T){const H=_.getTile(O);_.hasRenderableParent(O)||(f.renderPass==="offscreen"?Go(f,H,x,O,F):f.renderPass==="translucent"&&tc(f,x,O,A,F))}E.viewport.set([0,0,f.width,f.height])}else f.renderPass==="offscreen"?function(O,H,q,W){const K=O.context,te=K.gl,ee=O.transform,ie=ht.disabled,se=new Zt([te.ONE,te.ONE],o.b7.transparent,[!0,!0,!0,!0]);(function(re,pe,Me){const xe=re.gl;re.activeTexture.set(xe.TEXTURE1),re.viewport.set([0,0,pe.width/4,pe.height/4]);let ve=Me.heatmapFbos.get(o.bW);ve?(xe.bindTexture(xe.TEXTURE_2D,ve.colorAttachment.get()),re.bindFramebuffer.set(ve.framebuffer)):(ve=qo(re,pe.width/4,pe.height/4),Me.heatmapFbos.set(o.bW,ve))})(K,O,q),K.clear({color:o.b7.transparent});for(let re=0;re<W.length;re++){const pe=W[re];if(H.hasRenderableParent(pe))continue;const Me=H.getTile(pe),xe=Me.getBucket(q);if(!xe)continue;const ve=xe.programConfigurations.get(q.id),be=O.useProgram("heatmap",ve),Fe=ee.getProjectionData({overscaledTileID:pe,applyGlobeMatrix:!0,applyTerrainMatrix:!1}),Be=ee.getCircleRadiusCorrection();be.draw(K,te.TRIANGLES,ot.disabled,ie,se,Tt.backCCW,_a(Me,ee.zoom,q.paint.get("heatmap-intensity"),Be),null,Fe,q.id,xe.layoutVertexBuffer,xe.indexBuffer,xe.segments,q.paint,ee.zoom,ve)}K.viewport.set([0,0,O.width,O.height])}(f,_,x,T):f.renderPass==="translucent"&&function(O,H){const q=O.context,W=q.gl;q.setColorMode(O.colorModeForRenderPass());const K=H.heatmapFbos.get(o.bW);K&&(q.activeTexture.set(W.TEXTURE0),W.bindTexture(W.TEXTURE_2D,K.colorAttachment.get()),q.activeTexture.set(W.TEXTURE1),ic(q,H).bind(W.LINEAR,W.CLAMP_TO_EDGE),O.useProgram("heatmapTexture").draw(q,W.TRIANGLES,ot.disabled,ht.disabled,O.colorModeForRenderPass(),Tt.disabled,Eu(O,H,0,1),null,null,H.id,O.viewportBuffer,O.quadTriangleIndexBuffer,O.viewportSegments,H.paint,O.transform.zoom))}(f,x)}(e,i,s,l,h):o.c6(s)?function(f,_,x,T,P){if(f.renderPass!=="translucent")return;const{isRenderingToTexture:E}=P,A=x.paint.get("line-opacity"),F=x.paint.get("line-width");if(A.constantOr(1)===0||F.constantOr(1)===0)return;const O=f.getDepthModeForSublayer(0,ot.ReadOnly),H=f.colorModeForRenderPass(),q=x.paint.get("line-dasharray"),W=x.paint.get("line-pattern"),K=W.constantOr(1),te=x.paint.get("line-gradient"),ee=x.getCrossfadeParameters(),ie=K?"linePattern":q?"lineSDF":te?"lineGradient":"line",se=f.context,re=se.gl,pe=f.transform;let Me=!0;for(const xe of T){const ve=_.getTile(xe);if(K&&!ve.patternsLoaded())continue;const be=ve.getBucket(x);if(!be)continue;const Fe=be.programConfigurations.get(x.id),Be=f.context.program.get(),ke=f.useProgram(ie,Fe),We=Me||ke.program!==Be,dt=f.style.map.terrain&&f.style.map.terrain.getTerrainData(xe),Mt=W.constantOr(null);if(Mt&&ve.imageAtlas){const $t=ve.imageAtlas,kt=$t.patternPositions[Mt.to.toString()],zi=$t.patternPositions[Mt.from.toString()];kt&&zi&&Fe.setConstantPatternPositions(kt,zi)}const ti=pe.getProjectionData({overscaledTileID:xe,applyGlobeMatrix:!E,applyTerrainMatrix:!0}),Vt=pe.getPixelScale(),ii=K?Du(f,ve,x,Vt,ee):q?Lu(f,ve,x,Vt,q,ee):te?Ru(f,ve,x,Vt,be.lineClipsArray.length):Ls(f,ve,x,Vt);if(K)se.activeTexture.set(re.TEXTURE0),ve.imageAtlasTexture.bind(re.LINEAR,re.CLAMP_TO_EDGE),Fe.updatePaintBuffers(ee);else if(q&&(We||f.lineAtlas.dirty))se.activeTexture.set(re.TEXTURE0),f.lineAtlas.bind(se);else if(te){const $t=be.gradients[x.id];let kt=$t.texture;if(x.gradientVersion!==$t.version){let zi=256;if(x.stepInterpolant){const Zi=_.getSource().maxzoom,Qi=xe.canonical.z===Zi?Math.ceil(1<<f.transform.maxZoom-xe.canonical.z):1;zi=o.ae(o.bX(be.maxLineLength/o.Z*1024*Qi),256,se.maxTextureSize)}$t.gradient=o.bY({expression:x.gradientExpression(),evaluationKey:"lineProgress",resolution:zi,image:$t.gradient||void 0,clips:be.lineClipsArray}),$t.texture?$t.texture.update($t.gradient):$t.texture=new Ut(se,$t.gradient,re.RGBA),$t.version=x.gradientVersion,kt=$t.texture}se.activeTexture.set(re.TEXTURE0),kt.bind(x.stepInterpolant?re.NEAREST:re.LINEAR,re.CLAMP_TO_EDGE)}const ri=f.stencilModeForClipping(xe);ke.draw(se,re.TRIANGLES,O,ri,H,Tt.disabled,ii,dt,ti,x.id,be.layoutVertexBuffer,be.indexBuffer,be.segments,x.paint,f.transform.zoom,Fe,be.layoutVertexBuffer2),Me=!1}}(e,i,s,l,h):o.c7(s)?function(f,_,x,T,P){const E=x.paint.get("fill-color"),A=x.paint.get("fill-opacity");if(A.constantOr(1)===0)return;const{isRenderingToTexture:F}=P,O=f.colorModeForRenderPass(),H=x.paint.get("fill-pattern"),q=f.opaquePassEnabledForLayer()&&!H.constantOr(1)&&E.constantOr(o.b7.transparent).a===1&&A.constantOr(0)===1?"opaque":"translucent";if(f.renderPass===q){const W=f.getDepthModeForSublayer(1,f.renderPass==="opaque"?ot.ReadWrite:ot.ReadOnly);Ns(f,_,x,T,W,O,!1,F)}if(f.renderPass==="translucent"&&x.paint.get("fill-antialias")){const W=f.getDepthModeForSublayer(x.getPaintProperty("fill-outline-color")?2:0,ot.ReadOnly);Ns(f,_,x,T,W,O,!0,F)}}(e,i,s,l,h):o.c8(s)?function(f,_,x,T,P){const E=x.paint.get("fill-extrusion-opacity");if(E===0)return;const{isRenderingToTexture:A}=P;if(f.renderPass==="translucent"){const F=new ot(f.context.gl.LEQUAL,ot.ReadWrite,f.depthRangeFor3D);if(E!==1||x.paint.get("fill-extrusion-pattern").constantOr(1))Zs(f,_,x,T,F,ht.disabled,Zt.disabled,A),Zs(f,_,x,T,F,f.stencilModeFor3D(),f.colorModeForRenderPass(),A);else{const O=f.colorModeForRenderPass();Zs(f,_,x,T,F,ht.disabled,O,A)}}}(e,i,s,l,h):o.c9(s)?function(f,_,x,T,P){if(f.renderPass!=="offscreen"&&f.renderPass!=="translucent")return;const{isRenderingToTexture:E}=P,A=f.context,F=f.style.projection.useSubdivision,O=f.getDepthModeForSublayer(0,ot.ReadOnly),H=f.colorModeForRenderPass();if(f.renderPass==="offscreen")(function(q,W,K,te,ee,ie,se){const re=q.context,pe=re.gl;for(const Me of K){const xe=W.getTile(Me),ve=xe.dem;if(!ve||!ve.data||!xe.needsHillshadePrepare)continue;const be=ve.dim,Fe=ve.stride,Be=ve.getPixels();if(re.activeTexture.set(pe.TEXTURE1),re.pixelStoreUnpackPremultiplyAlpha.set(!1),xe.demTexture=xe.demTexture||q.getTileTexture(Fe),xe.demTexture){const We=xe.demTexture;We.update(Be,{premultiply:!1}),We.bind(pe.NEAREST,pe.CLAMP_TO_EDGE)}else xe.demTexture=new Ut(re,Be,pe.RGBA,{premultiply:!1}),xe.demTexture.bind(pe.NEAREST,pe.CLAMP_TO_EDGE);re.activeTexture.set(pe.TEXTURE0);let ke=xe.fbo;if(!ke){const We=new Ut(re,{width:be,height:be,data:null},pe.RGBA);We.bind(pe.LINEAR,pe.CLAMP_TO_EDGE),ke=xe.fbo=re.createFramebuffer(be,be,!0,!1),ke.colorAttachment.set(We.texture)}re.bindFramebuffer.set(ke.framebuffer),re.viewport.set([0,0,be,be]),q.useProgram("hillshadePrepare").draw(re,pe.TRIANGLES,ee,ie,se,Tt.disabled,Ad(xe.tileID,ve),null,null,te.id,q.rasterBoundsBuffer,q.quadTriangleIndexBuffer,q.rasterBoundsSegments),xe.needsHillshadePrepare=!1}})(f,_,T,x,O,ht.disabled,H),A.viewport.set([0,0,f.width,f.height]);else if(f.renderPass==="translucent")if(F){const[q,W,K]=f.stencilConfigForOverlapTwoPass(T);rc(f,_,x,K,q,O,H,!1,E),rc(f,_,x,K,W,O,H,!0,E)}else{const[q,W]=f.getStencilConfigForOverlapAndUpdateStencilID(T);rc(f,_,x,W,q,O,H,!1,E)}}(e,i,s,l,h):o.ca(s)?function(f,_,x,T,P){if(f.renderPass!=="translucent"||x.paint.get("raster-opacity")===0||!T.length)return;const{isRenderingToTexture:E}=P,A=_.getSource(),F=f.style.projection.useSubdivision;if(A instanceof gr)Ho(f,_,x,T,null,!1,!1,A.tileCoords,A.flippedWindingOrder,E);else if(F){const[O,H,q]=f.stencilConfigForOverlapTwoPass(T);Ho(f,_,x,q,O,!1,!0,Vs,!1,E),Ho(f,_,x,q,H,!0,!0,Vs,!1,E)}else{const[O,H]=f.getStencilConfigForOverlapAndUpdateStencilID(T);Ho(f,_,x,H,O,!1,!0,Vs,!1,E)}}(e,i,s,l,h):o.cb(s)?function(f,_,x,T,P){const E=x.paint.get("background-color"),A=x.paint.get("background-opacity");if(A===0)return;const{isRenderingToTexture:F}=P,O=f.context,H=O.gl,q=f.style.projection,W=f.transform,K=W.tileSize,te=x.paint.get("background-pattern");if(f.isPatternMissing(te))return;const ee=!te&&E.a===1&&A===1&&f.opaquePassEnabledForLayer()?"opaque":"translucent";if(f.renderPass!==ee)return;const ie=ht.disabled,se=f.getDepthModeForSublayer(0,ee==="opaque"?ot.ReadWrite:ot.ReadOnly),re=f.colorModeForRenderPass(),pe=f.useProgram(te?"backgroundPattern":"background"),Me=T||oe(W,{tileSize:K,terrain:f.style.map.terrain});te&&(O.activeTexture.set(H.TEXTURE0),f.imageManager.bind(f.context));const xe=x.getCrossfadeParameters();for(const ve of Me){const be=W.getProjectionData({overscaledTileID:ve,applyGlobeMatrix:!F,applyTerrainMatrix:!0}),Fe=te?kd(A,f,te,{tileID:ve,tileSize:K},xe):Ed(A,E),Be=f.style.map.terrain&&f.style.map.terrain.getTerrainData(ve),ke=q.getMeshFromTileID(O,ve.canonical,!1,!0,"raster");pe.draw(O,H.TRIANGLES,se,ie,re,Tt.backCCW,Fe,Be,be,x.id,ke.vertexBuffer,ke.indexBuffer,ke.segments)}}(e,0,s,l,h):o.cc(s)&&function(f,_,x,T){const{isRenderingGlobe:P}=T,E=f.context,A=x.implementation,F=f.style.projection,O=f.transform,H=O.getProjectionDataForCustomLayer(P),q={farZ:O.farZ,nearZ:O.nearZ,fov:O.fov*Math.PI/180,modelViewProjectionMatrix:O.modelViewProjectionMatrix,projectionMatrix:O.projectionMatrix,shaderData:{variantName:F.shaderVariantName,vertexShaderPrelude:`const float PI = 3.141592653589793;
|
|
741
741
|
uniform mat4 u_projection_matrix;
|
|
742
|
-
${F.shaderPreludeCode.vertexSource}`,define:F.shaderDefine},defaultProjectionData:H},W=A.renderingMode?A.renderingMode:"2d";if(f.renderPass==="offscreen"){const K=A.prerender;K&&(f.setCustomLayerDefaults(),E.setColorMode(f.colorModeForRenderPass()),K.call(A,E.gl,q),E.setDirty(),f.setBaseState())}else if(f.renderPass==="translucent"){f.setCustomLayerDefaults(),E.setColorMode(f.colorModeForRenderPass()),E.setStencilMode(ht.disabled);const K=W==="3d"?f.getDepthModeFor3D():f.getDepthModeForSublayer(0,ot.ReadOnly);E.setDepthMode(K),A.render(E.gl,q),E.setDirty(),f.setBaseState(),E.bindFramebuffer.set(null)}}(e,0,s,h))}saveTileTexture(e){const i=this._tileTextures[e.size[0]];i?i.push(e):this._tileTextures[e.size[0]]=[e]}getTileTexture(e){const i=this._tileTextures[e];return i&&i.length>0?i.pop():null}isPatternMissing(e){if(!e)return!1;if(!e.from||!e.to)return!0;const i=this.imageManager.getPattern(e.from.toString()),s=this.imageManager.getPattern(e.to.toString());return!i||!s}useProgram(e,i,s=!1,l=[]){this.cache=this.cache||{};const h=!!this.style.map.terrain,f=this.style.projection,_=s?yr.projectionMercator:f.shaderPreludeCode,x=s?da:f.shaderDefine,T=e+(i?i.cacheKey:"")+`/${s?wt:f.shaderVariantName}`+(this._showOverdrawInspector?"/overdraw":"")+(h?"/terrain":"")+(l?`/${l.join("/")}`:"");return this.cache[T]||(this.cache[T]=new Io(this.context,yr[e],i,ju[e],this._showOverdrawInspector,h,_,x,l)),this.cache[T]}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 e=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(e.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new Ut(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:e,drawingBufferHeight:i}=this.context.gl;return this.width!==e||this.height!==i}}function $s(u,e){let i,s=!1,l=null,h=null;const f=()=>{l=null,s&&(u.apply(h,i),l=setTimeout(f,e),s=!1)};return(..._)=>(s=!0,h=this,i=_,l||f(),l)}class sc{constructor(e){this._getCurrentHash=()=>{const i=window.location.hash.replace("#","");if(this._hashName){let s;return i.split("&").map(l=>l.split("=")).forEach(l=>{l[0]===this._hashName&&(s=l)}),(s&&s[1]||"").split("/")}return i.split("/")},this._onHashChange=()=>{const i=this._getCurrentHash();if(!this._isValidHash(i))return!1;const s=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(i[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+i[2],+i[1]],zoom:+i[0],bearing:s,pitch:+(i[4]||0)}),!0},this._updateHashUnthrottled=()=>{const i=window.location.href.replace(/(#.*)?$/,this.getHashString());window.history.replaceState(window.history.state,null,i)},this._removeHash=()=>{const i=this._getCurrentHash();if(i.length===0)return;const s=i.join("/");let l=s;l.split("&").length>0&&(l=l.split("&")[0]),this._hashName&&(l=`${this._hashName}=${s}`);let h=window.location.hash.replace(l,"");h.startsWith("#&")?h=h.slice(0,1)+h.slice(2):h==="#"&&(h="");let f=window.location.href.replace(/(#.+)?$/,h);f=f.replace("&&","&"),window.history.replaceState(window.history.state,null,f)},this._updateHash=$s(this._updateHashUnthrottled,300),this._hashName=e&&encodeURIComponent(e)}addTo(e){return this._map=e,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),this._removeHash(),delete this._map,this}getHashString(e){const i=this._map.getCenter(),s=Math.round(100*this._map.getZoom())/100,l=Math.ceil((s*Math.LN2+Math.log(512/360/.5))/Math.LN10),h=Math.pow(10,l),f=Math.round(i.lng*h)/h,_=Math.round(i.lat*h)/h,x=this._map.getBearing(),T=this._map.getPitch();let P="";if(P+=e?`/${f}/${_}/${s}`:`${s}/${_}/${f}`,(x||T)&&(P+="/"+Math.round(10*x)/10),T&&(P+=`/${Math.round(T)}`),this._hashName){const E=this._hashName;let A=!1;const F=window.location.hash.slice(1).split("&").map(O=>{const H=O.split("=")[0];return H===E?(A=!0,`${H}=${P}`):O}).filter(O=>O);return A||F.push(`${E}=${P}`),`#${F.join("&")}`}return`#${P}`}_isValidHash(e){if(e.length<3||e.some(isNaN))return!1;try{new o.Q(+e[2],+e[1])}catch{return!1}const i=+e[0],s=+(e[3]||0),l=+(e[4]||0);return i>=this._map.getMinZoom()&&i<=this._map.getMaxZoom()&&s>=-180&&s<=180&&l>=this._map.getMinPitch()&&l<=this._map.getMaxPitch()}}const wn={linearity:.3,easing:o.cd(0,0,.3,1)},oc=o.e({deceleration:2500,maxSpeed:1400},wn),Gs=o.e({deceleration:20,maxSpeed:1400},wn),lc=o.e({deceleration:1e3,maxSpeed:360},wn),Qu=o.e({deceleration:1e3,maxSpeed:90},wn),eh=o.e({deceleration:1e3,maxSpeed:360},wn);class th{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:Ce.now(),settings:e})}_drainInertiaBuffer(){const e=this._inertiaBuffer,i=Ce.now();for(;e.length>0&&i-e[0].time>160;)e.shift()}_onMoveEnd(e){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const i={zoom:0,bearing:0,pitch:0,roll:0,pan:new o.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:h}of this._inertiaBuffer)i.zoom+=h.zoomDelta||0,i.bearing+=h.bearingDelta||0,i.pitch+=h.pitchDelta||0,i.roll+=h.rollDelta||0,h.panDelta&&i.pan._add(h.panDelta),h.around&&(i.around=h.around),h.pinchAround&&(i.pinchAround=h.pinchAround);const s=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,l={};if(i.pan.mag()){const h=Qa(i.pan.mag(),s,o.e({},oc,e||{})),f=i.pan.mult(h.amount/i.pan.mag()),_=this._map.cameraHelper.handlePanInertia(f,this._map.transform);l.center=_.easingCenter,l.offset=_.easingOffset,Ja(l,h)}if(i.zoom){const h=Qa(i.zoom,s,Gs);l.zoom=this._map.transform.zoom+h.amount,Ja(l,h)}if(i.bearing){const h=Qa(i.bearing,s,lc);l.bearing=this._map.transform.bearing+o.ae(h.amount,-179,179),Ja(l,h)}if(i.pitch){const h=Qa(i.pitch,s,Qu);l.pitch=this._map.transform.pitch+h.amount,Ja(l,h)}if(i.roll){const h=Qa(i.roll,s,eh);l.roll=this._map.transform.roll+o.ae(h.amount,-179,179),Ja(l,h)}if(l.zoom||l.bearing){const h=i.pinchAround===void 0?i.around:i.pinchAround;l.around=h?this._map.unproject(h):this._map.getCenter()}return this.clear(),o.e(l,{noMoveStart:!0})}}function Ja(u,e){(!u.duration||u.duration<e.duration)&&(u.duration=e.duration,u.easing=e.easing)}function Qa(u,e,i){const{maxSpeed:s,linearity:l,deceleration:h}=i,f=o.ae(u*l/(e/1e3),-s,s),_=Math.abs(f)/(h*l);return{easing:i.easing,duration:1e3*_,amount:f*(_/2)}}class ki extends o.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,i,s,l={}){s=s instanceof MouseEvent?s:new MouseEvent(e,s);const h=ce.mousePos(i.getCanvas(),s),f=i.unproject(h);super(e,o.e({point:h,lngLat:f,originalEvent:s},l)),this._defaultPrevented=!1,this.target=i}}class es extends o.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,i,s){const l=e==="touchend"?s.changedTouches:s.touches,h=ce.touchPos(i.getCanvasContainer(),l),f=h.map(x=>i.unproject(x)),_=h.reduce((x,T,P,E)=>x.add(T.div(E.length)),new o.P(0,0));super(e,{points:h,point:_,lngLats:f,lngLat:i.unproject(_),originalEvent:s}),this._defaultPrevented=!1}}class cc extends o.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,i,s){super(e,{originalEvent:s}),this._defaultPrevented=!1}}class ih{constructor(e,i){this._map=e,this._clickTolerance=i.clickTolerance}reset(){delete this._mousedownPos}wheel(e){return this._firePreventable(new cc(e.type,this._map,e))}mousedown(e,i){return this._mousedownPos=i,this._firePreventable(new ki(e.type,this._map,e))}mouseup(e){this._map.fire(new ki(e.type,this._map,e))}click(e,i){this._mousedownPos&&this._mousedownPos.dist(i)>=this._clickTolerance||this._map.fire(new ki(e.type,this._map,e))}dblclick(e){return this._firePreventable(new ki(e.type,this._map,e))}mouseover(e){this._map.fire(new ki(e.type,this._map,e))}mouseout(e){this._map.fire(new ki(e.type,this._map,e))}touchstart(e){return this._firePreventable(new es(e.type,this._map,e))}touchmove(e){this._map.fire(new es(e.type,this._map,e))}touchend(e){this._map.fire(new es(e.type,this._map,e))}touchcancel(e){this._map.fire(new es(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class rh{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(e){this._map.fire(new ki(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new ki("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._ignoreContextMenu||this._map.fire(new ki(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class ts{constructor(e){this._map=e}get transform(){return this._map._requestedCameraState||this._map.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(e){return this.transform.screenPointToLocation(o.P.convert(e),this._map.terrain)}}class uc{constructor(e,i){this._map=e,this._tr=new ts(e),this._el=e.getCanvasContainer(),this._container=e.getContainer(),this._clickTolerance=i.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(e,i){this.isEnabled()&&e.shiftKey&&e.button===0&&(ce.disableDrag(),this._startPos=this._lastPos=i,this._active=!0)}mousemoveWindow(e,i){if(!this._active)return;const s=i;if(this._lastPos.equals(s)||!this._box&&s.dist(this._startPos)<this._clickTolerance)return;const l=this._startPos;this._lastPos=s,this._box||(this._box=ce.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",e));const h=Math.min(l.x,s.x),f=Math.max(l.x,s.x),_=Math.min(l.y,s.y),x=Math.max(l.y,s.y);ce.setTransform(this._box,`translate(${h}px,${_}px)`),this._box.style.width=f-h+"px",this._box.style.height=x-_+"px"}mouseupWindow(e,i){if(!this._active||e.button!==0)return;const s=this._startPos,l=i;if(this.reset(),ce.suppressClick(),s.x!==l.x||s.y!==l.y)return this._map.fire(new o.l("boxzoomend",{originalEvent:e})),{cameraAnimation:h=>h.fitScreenCoordinates(s,l,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",e)}keydown(e){this._active&&e.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",e))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(ce.remove(this._box),this._box=null),ce.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(e,i){return this._map.fire(new o.l(e,{originalEvent:i}))}}function Yo(u,e){if(u.length!==e.length)throw new Error(`The number of touches and points are not equal - touches ${u.length}, points ${e.length}`);const i={};for(let s=0;s<u.length;s++)i[u[s].identifier]=e[s];return i}class nh{constructor(e){this.reset(),this.numTouches=e.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(e,i,s){(this.centroid||s.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=e.timeStamp),s.length===this.numTouches&&(this.centroid=function(l){const h=new o.P(0,0);for(const f of l)h._add(f);return h.div(l.length)}(i),this.touches=Yo(s,i)))}touchmove(e,i,s){if(this.aborted||!this.centroid)return;const l=Yo(s,i);for(const h in this.touches){const f=l[h];(!f||f.dist(this.touches[h])>30)&&(this.aborted=!0)}}touchend(e,i,s){if((!this.centroid||e.timeStamp-this.startTime>500)&&(this.aborted=!0),s.length===0){const l=!this.aborted&&this.centroid;if(this.reset(),l)return l}}}class is{constructor(e){this.singleTap=new nh(e),this.numTaps=e.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(e,i,s){this.singleTap.touchstart(e,i,s)}touchmove(e,i,s){this.singleTap.touchmove(e,i,s)}touchend(e,i,s){const l=this.singleTap.touchend(e,i,s);if(l){const h=e.timeStamp-this.lastTime<500,f=!this.lastTap||this.lastTap.dist(l)<30;if(h&&f||this.reset(),this.count++,this.lastTime=e.timeStamp,this.lastTap=l,this.count===this.numTaps)return this.reset(),l}}}class ah{constructor(e){this._tr=new ts(e),this._zoomIn=new is({numTouches:1,numTaps:2}),this._zoomOut=new is({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(e,i,s){this._zoomIn.touchstart(e,i,s),this._zoomOut.touchstart(e,i,s)}touchmove(e,i,s){this._zoomIn.touchmove(e,i,s),this._zoomOut.touchmove(e,i,s)}touchend(e,i,s){const l=this._zoomIn.touchend(e,i,s),h=this._zoomOut.touchend(e,i,s),f=this._tr;return l?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:_=>_.easeTo({duration:300,zoom:f.zoom+1,around:f.unproject(l)},{originalEvent:e})}):h?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:_=>_.easeTo({duration:300,zoom:f.zoom-1,around:f.unproject(h)},{originalEvent:e})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class dr{constructor(e){this._enabled=!!e.enable,this._moveStateManager=e.moveStateManager,this._clickTolerance=e.clickTolerance||1,this._moveFunction=e.move,this._activateOnStart=!!e.activateOnStart,e.assignEvents(this),this.reset()}reset(e){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(e)}_move(...e){const i=this._moveFunction(...e);if(i.bearingDelta||i.pitchDelta||i.rollDelta||i.around||i.panDelta)return this._active=!0,i}dragStart(e,i){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(e)&&(this._moveStateManager.startMove(e),this._lastPoint=Array.isArray(i)?i[0]:i,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(e,i){if(!this.isEnabled())return;const s=this._lastPoint;if(!s)return;if(e.preventDefault(),!this._moveStateManager.isValidMoveEvent(e))return void this.reset(e);const l=Array.isArray(i)?i[0]:i;return!this._moved&&l.dist(s)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=l,this._move(s,l))}dragEnd(e){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(e)&&(this._moved&&ce.suppressClick(),this.reset(e))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}}const on={0:1,2:2};class rs{constructor(e){this._correctEvent=e.checkCorrectEvent}startMove(e){const i=ce.mouseButton(e);this._eventButton=i}endMove(e){delete this._eventButton}isValidStartEvent(e){return this._correctEvent(e)}isValidMoveEvent(e){return!function(i,s){const l=on[s];return i.buttons===void 0||(i.buttons&l)!==l}(e,this._eventButton)}isValidEndEvent(e){return ce.mouseButton(e)===this._eventButton}}class ln{constructor(){this._firstTouch=void 0}_isOneFingerTouch(e){return e.targetTouches.length===1}_isSameTouchEvent(e){return e.targetTouches[0].identifier===this._firstTouch}startMove(e){this._firstTouch=e.targetTouches[0].identifier}endMove(e){delete this._firstTouch}isValidStartEvent(e){return this._isOneFingerTouch(e)}isValidMoveEvent(e){return this._isOneFingerTouch(e)&&this._isSameTouchEvent(e)}isValidEndEvent(e){return this._isOneFingerTouch(e)&&this._isSameTouchEvent(e)}}class ns{constructor(e=new rs({checkCorrectEvent:()=>!0}),i=new ln){this.mouseMoveStateManager=e,this.oneFingerTouchMoveStateManager=i}_executeRelevantHandler(e,i,s){return e instanceof MouseEvent?i(e):typeof TouchEvent<"u"&&e instanceof TouchEvent?s(e):void 0}startMove(e){this._executeRelevantHandler(e,i=>this.mouseMoveStateManager.startMove(i),i=>this.oneFingerTouchMoveStateManager.startMove(i))}endMove(e){this._executeRelevantHandler(e,i=>this.mouseMoveStateManager.endMove(i),i=>this.oneFingerTouchMoveStateManager.endMove(i))}isValidStartEvent(e){return this._executeRelevantHandler(e,i=>this.mouseMoveStateManager.isValidStartEvent(i),i=>this.oneFingerTouchMoveStateManager.isValidStartEvent(i))}isValidMoveEvent(e){return this._executeRelevantHandler(e,i=>this.mouseMoveStateManager.isValidMoveEvent(i),i=>this.oneFingerTouchMoveStateManager.isValidMoveEvent(i))}isValidEndEvent(e){return this._executeRelevantHandler(e,i=>this.mouseMoveStateManager.isValidEndEvent(i),i=>this.oneFingerTouchMoveStateManager.isValidEndEvent(i))}}const Jo=u=>{u.mousedown=u.dragStart,u.mousemoveWindow=u.dragMove,u.mouseup=u.dragEnd,u.contextmenu=e=>{e.preventDefault()}};class Nd{constructor(e,i){this._clickTolerance=e.clickTolerance||1,this._map=i,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new o.P(0,0)}_shouldBePrevented(e){return e<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(e,i,s){return this._calculateTransform(e,i,s)}touchmove(e,i,s){if(this._active){if(!this._shouldBePrevented(s.length))return e.preventDefault(),this._calculateTransform(e,i,s);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",e)}}touchend(e,i,s){this._calculateTransform(e,i,s),this._active&&this._shouldBePrevented(s.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(e,i,s){s.length>0&&(this._active=!0);const l=Yo(s,i),h=new o.P(0,0),f=new o.P(0,0);let _=0;for(const T in l){const P=l[T],E=this._touches[T];E&&(h._add(P),f._add(P.sub(E)),_++,l[T]=P)}if(this._touches=l,this._shouldBePrevented(_)||!f.mag())return;const x=f.div(_);return this._sum._add(x),this._sum.mag()<this._clickTolerance?void 0:{around:h.div(_),panDelta:x}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class hc{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(e,i,s){this._firstTwoTouches||s.length<2||(this._firstTwoTouches=[s[0].identifier,s[1].identifier],this._start([i[0],i[1]]))}touchmove(e,i,s){if(!this._firstTwoTouches)return;e.preventDefault();const[l,h]=this._firstTwoTouches,f=Qo(s,i,l),_=Qo(s,i,h);if(!f||!_)return;const x=this._aroundCenter?null:f.add(_).div(2);return this._move([f,_],x,e)}touchend(e,i,s){if(!this._firstTwoTouches)return;const[l,h]=this._firstTwoTouches,f=Qo(s,i,l),_=Qo(s,i,h);f&&_||(this._active&&ce.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(e){this._enabled=!0,this._aroundCenter=!!e&&e.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}}function Qo(u,e,i){for(let s=0;s<u.length;s++)if(u[s].identifier===i)return e[s]}function dc(u,e){return Math.log(u/e)/Math.LN2}class as extends hc{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(e){this._startDistance=this._distance=e[0].dist(e[1])}_move(e,i){const s=this._distance;if(this._distance=e[0].dist(e[1]),this._active||!(Math.abs(dc(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:dc(this._distance,s),pinchAround:i}}}function Tn(u,e){return 180*u.angleWith(e)/Math.PI}class $e extends hc{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(e){this._startVector=this._vector=e[0].sub(e[1]),this._minDiameter=e[0].dist(e[1])}_move(e,i,s){const l=this._vector;if(this._vector=e[0].sub(e[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:Tn(this._vector,l),pinchAround:i}}_isBelowThreshold(e){this._minDiameter=Math.min(this._minDiameter,e.mag());const i=25/(Math.PI*this._minDiameter)*360,s=Tn(e,this._startVector);return Math.abs(s)<i}}function el(u){return Math.abs(u.y)>Math.abs(u.x)}class tl extends hc{constructor(e){super(),this._currentTouchCount=0,this._map=e}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(e,i,s){super.touchstart(e,i,s),this._currentTouchCount=s.length}_start(e){this._lastPoints=e,el(e[0].sub(e[1]))&&(this._valid=!1)}_move(e,i,s){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const l=e[0].sub(this._lastPoints[0]),h=e[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(l,h,s.timeStamp),this._valid?(this._lastPoints=e,this._active=!0,{pitchDelta:(l.y+h.y)/2*-.5}):void 0}gestureBeginsVertically(e,i,s){if(this._valid!==void 0)return this._valid;const l=e.mag()>=2,h=i.mag()>=2;if(!l&&!h)return;if(!l||!h)return this._firstMove===void 0&&(this._firstMove=s),s-this._firstMove<100&&void 0;const f=e.y>0==i.y>0;return el(e)&&el(i)&&f}}const sh={panStep:100,bearingStep:15,pitchStep:10};class ss{constructor(e){this._tr=new ts(e);const i=sh;this._panStep=i.panStep,this._bearingStep=i.bearingStep,this._pitchStep=i.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;let i=0,s=0,l=0,h=0,f=0;switch(e.keyCode){case 61:case 107:case 171:case 187:i=1;break;case 189:case 109:case 173:i=-1;break;case 37:e.shiftKey?s=-1:(e.preventDefault(),h=-1);break;case 39:e.shiftKey?s=1:(e.preventDefault(),h=1);break;case 38:e.shiftKey?l=1:(e.preventDefault(),f=-1);break;case 40:e.shiftKey?l=-1:(e.preventDefault(),f=1);break;default:return}return this._rotationDisabled&&(s=0,l=0),{cameraAnimation:_=>{const x=this._tr;_.easeTo({duration:300,easeId:"keyboardHandler",easing:qs,zoom:i?Math.round(x.zoom)+i*(e.shiftKey?2:1):x.zoom,bearing:x.bearing+s*this._bearingStep,pitch:x.pitch+l*this._pitchStep,offset:[-h*this._panStep,-f*this._panStep],center:x.center},{originalEvent:e})}}}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 qs(u){return u*(2-u)}const pc=4.000244140625;class yt{constructor(e,i){this._onTimeout=s=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(s)},this._map=e,this._tr=new ts(e),this._triggerRenderFrame=i,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(e){this._defaultZoomRate=e}setWheelZoomRate(e){this._wheelZoomRate=e}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(e){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!e&&e.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(e){return!!this._map.cooperativeGestures.isEnabled()&&!(e.ctrlKey||this._map.cooperativeGestures.isBypassed(e))}wheel(e){if(!this.isEnabled())return;if(this._shouldBePrevented(e))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",e);let i=e.deltaMode===WheelEvent.DOM_DELTA_LINE?40*e.deltaY:e.deltaY;const s=Ce.now(),l=s-(this._lastWheelEventTime||0);this._lastWheelEventTime=s,i!==0&&i%pc==0?this._type="wheel":i!==0&&Math.abs(i)<4?this._type="trackpad":l>400?(this._type=null,this._lastValue=i,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(l*i)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,i+=this._lastValue)),e.shiftKey&&i&&(i/=4),this._type&&(this._lastWheelEvent=e,this._delta-=i,this._active||this._start(e)),e.preventDefault()}_start(e){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 i=ce.mousePos(this._map.getCanvas(),e),s=this._tr;this._aroundPoint=this._aroundCenter?s.transform.locationToScreenPoint(o.Q.convert(s.center)):i,this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const e=this._tr.transform;if(typeof this._lastExpectedZoom=="number"){const _=e.zoom-this._lastExpectedZoom;typeof this._startZoom=="number"&&(this._startZoom+=_),typeof this._targetZoom=="number"&&(this._targetZoom+=_)}if(this._delta!==0){const _=this._type==="wheel"&&Math.abs(this._delta)>pc?this._wheelZoomRate:this._defaultZoomRate;let x=2/(1+Math.exp(-Math.abs(this._delta*_)));this._delta<0&&x!==0&&(x=1/x);const T=typeof this._targetZoom!="number"?e.scale:o.ac(this._targetZoom);this._targetZoom=e.getConstrained(e.getCameraLngLat(),o.ah(T*x)).zoom,this._type==="wheel"&&(this._startZoom=e.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const i=typeof this._targetZoom!="number"?e.zoom:this._targetZoom,s=this._startZoom,l=this._easing;let h,f=!1;if(this._type==="wheel"&&s&&l){const _=Ce.now()-this._lastWheelEventTime,x=Math.min((_+5)/200,1),T=l(x);h=o.B.number(s,i,T),x<1?this._frameId||(this._frameId=!0):f=!0}else h=i,f=!0;return this._active=!0,f&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._lastExpectedZoom,delete this._finishTimeout},200)),this._lastExpectedZoom=h,{noInertia:!0,needsRenderFrame:!f,zoomDelta:h-e.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(e){let i=o.cf;if(this._prevEase){const s=this._prevEase,l=(Ce.now()-s.start)/s.duration,h=s.easing(l+.01)-s.easing(l),f=.27/Math.sqrt(h*h+1e-4)*.01,_=Math.sqrt(.0729-f*f);i=o.cd(f,_,.25,1)}return this._prevEase={start:Ce.now(),duration:e,easing:i},i}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,delete this._lastExpectedZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class il{constructor(e,i){this._clickZoom=e,this._tapZoom=i}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class Zd{constructor(e){this._tr=new ts(e),this.reset()}reset(){this._active=!1}dblclick(e,i){return e.preventDefault(),{cameraAnimation:s=>{s.easeTo({duration:300,zoom:this._tr.zoom+(e.shiftKey?-1:1),around:this._tr.unproject(i)},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class fc{constructor(){this._tap=new is({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(e,i,s){if(!this._swipePoint)if(this._tapTime){const l=i[0],h=e.timeStamp-this._tapTime<500,f=this._tapPoint.dist(l)<30;h&&f?s.length>0&&(this._swipePoint=l,this._swipeTouch=s[0].identifier):this.reset()}else this._tap.touchstart(e,i,s)}touchmove(e,i,s){if(this._tapTime){if(this._swipePoint){if(s[0].identifier!==this._swipeTouch)return;const l=i[0],h=l.y-this._swipePoint.y;return this._swipePoint=l,e.preventDefault(),this._active=!0,{zoomDelta:h/128}}}else this._tap.touchmove(e,i,s)}touchend(e,i,s){if(this._tapTime)this._swipePoint&&s.length===0&&this.reset();else{const l=this._tap.touchend(e,i,s);l&&(this._tapTime=e.timeStamp,this._tapPoint=l)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class oh{constructor(e,i,s){this._el=e,this._mousePan=i,this._touchPan=s}enable(e){this._inertiaOptions=e||{},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 lh{constructor(e,i,s,l){this._pitchWithRotate=e.pitchWithRotate,this._rollEnabled=e.rollEnabled,this._mouseRotate=i,this._mousePitch=s,this._mouseRoll=l}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable(),this._rollEnabled&&this._mouseRoll.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable(),this._mouseRoll.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())&&(!this._rollEnabled||this._mouseRoll.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()||this._mouseRoll.isActive()}}class mc{constructor(e,i,s,l){this._el=e,this._touchZoom=i,this._touchRotate=s,this._tapDragZoom=l,this._rotationDisabled=!1,this._enabled=!0}enable(e){this._touchZoom.enable(e),this._rotationDisabled||this._touchRotate.enable(e),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()}}class rl{constructor(e,i){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=e,this._options=i,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;const e=this._map.getCanvasContainer();e.classList.add("maplibregl-cooperative-gestures"),this._container=ce.create("div","maplibregl-cooperative-gesture-screen",e);let i=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(i=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const s=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),l=document.createElement("div");l.className="maplibregl-desktop-message",l.textContent=i,this._container.appendChild(l);const h=document.createElement("div");h.className="maplibregl-mobile-message",h.textContent=s,this._container.appendChild(h),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(ce.remove(this._container),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destroyUI()}isEnabled(){return this._enabled}isBypassed(e){return e[this._bypassKey]}notifyGestureBlocked(e,i){this._enabled&&(this._map.fire(new o.l("cooperativegestureprevented",{gestureType:e,originalEvent:i})),this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}}const Hs=u=>u.zoom||u.drag||u.roll||u.pitch||u.rotate;class Vd extends o.l{}function nl(u){return u.panDelta&&u.panDelta.mag()||u.zoomDelta||u.bearingDelta||u.pitchDelta||u.rollDelta}class Ud{constructor(e,i){this.handleWindowEvent=l=>{this.handleEvent(l,`${l.type}Window`)},this.handleEvent=(l,h)=>{if(l.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const f=l.type==="renderFrame"?void 0:l,_={needsRenderFrame:!1},x={},T={};for(const{handlerName:A,handler:F,allowed:O}of this._handlers){if(!F.isEnabled())continue;let H;if(this._blockedByActive(T,O,A))F.reset();else if(F[h||l.type]){if(o.cg(l,h||l.type)){const q=ce.mousePos(this._map.getCanvas(),l);H=F[h||l.type](l,q)}else if(o.ch(l,h||l.type)){const q=this._getMapTouches(l.touches),W=ce.touchPos(this._map.getCanvas(),q);H=F[h||l.type](l,W,q)}else o.ci(h||l.type)||(H=F[h||l.type](l));this.mergeHandlerResult(_,x,H,A,f),H&&H.needsRenderFrame&&this._triggerRenderFrame()}(H||F.isActive())&&(T[A]=F)}const P={};for(const A in this._previousActiveHandlers)T[A]||(P[A]=f);this._previousActiveHandlers=T,(Object.keys(P).length||nl(_))&&(this._changes.push([_,x,P]),this._triggerRenderFrame()),(Object.keys(T).length||nl(_))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:E}=_;E&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],E(this._map))},this._map=e,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new th(e),this._bearingSnap=i.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(i);const s=this._el;this._listeners=[[s,"touchstart",{passive:!0}],[s,"touchmove",{passive:!1}],[s,"touchend",void 0],[s,"touchcancel",void 0],[s,"mousedown",void 0],[s,"mousemove",void 0],[s,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[s,"mouseover",void 0],[s,"mouseout",void 0],[s,"dblclick",void 0],[s,"click",void 0],[s,"keydown",{capture:!1}],[s,"keyup",void 0],[s,"wheel",{passive:!1}],[s,"contextmenu",void 0],[window,"blur",void 0]];for(const[l,h,f]of this._listeners)ce.addEventListener(l,h,l===document?this.handleWindowEvent:this.handleEvent,f)}destroy(){for(const[e,i,s]of this._listeners)ce.removeEventListener(e,i,e===document?this.handleWindowEvent:this.handleEvent,s)}_addDefaultHandlers(e){const i=this._map,s=i.getCanvasContainer();this._add("mapEvent",new ih(i,e));const l=i.boxZoom=new uc(i,e);this._add("boxZoom",l),e.interactive&&e.boxZoom&&l.enable();const h=i.cooperativeGestures=new rl(i,e.cooperativeGestures);this._add("cooperativeGestures",h),e.cooperativeGestures&&h.enable();const f=new ah(i),_=new Zd(i);i.doubleClickZoom=new il(_,f),this._add("tapZoom",f),this._add("clickZoom",_),e.interactive&&e.doubleClickZoom&&i.doubleClickZoom.enable();const x=new fc;this._add("tapDragZoom",x);const T=i.touchPitch=new tl(i);this._add("touchPitch",T),e.interactive&&e.touchPitch&&i.touchPitch.enable(e.touchPitch);const P=()=>i.project(i.getCenter()),E=function({enable:ee,clickTolerance:ie,aroundCenter:se=!0,minPixelCenterThreshold:re=100,rotateDegreesPerPixelMoved:pe=.8},Me){const xe=new rs({checkCorrectEvent:ve=>ce.mouseButton(ve)===0&&ve.ctrlKey||ce.mouseButton(ve)===2&&!ve.ctrlKey});return new dr({clickTolerance:ie,move:(ve,be)=>{const Fe=Me();if(se&&Math.abs(Fe.y-ve.y)>re)return{bearingDelta:o.ce(new o.P(ve.x,be.y),be,Fe)};let Be=(be.x-ve.x)*pe;return se&&be.y<Fe.y&&(Be=-Be),{bearingDelta:Be}},moveStateManager:xe,enable:ee,assignEvents:Jo})}(e,P),A=function({enable:ee,clickTolerance:ie,pitchDegreesPerPixelMoved:se=-.5}){const re=new rs({checkCorrectEvent:pe=>ce.mouseButton(pe)===0&&pe.ctrlKey||ce.mouseButton(pe)===2});return new dr({clickTolerance:ie,move:(pe,Me)=>({pitchDelta:(Me.y-pe.y)*se}),moveStateManager:re,enable:ee,assignEvents:Jo})}(e),F=function({enable:ee,clickTolerance:ie,rollDegreesPerPixelMoved:se=.3},re){const pe=new rs({checkCorrectEvent:Me=>ce.mouseButton(Me)===2&&Me.ctrlKey});return new dr({clickTolerance:ie,move:(Me,xe)=>{const ve=re();let be=(xe.x-Me.x)*se;return xe.y<ve.y&&(be=-be),{rollDelta:be}},moveStateManager:pe,enable:ee,assignEvents:Jo})}(e,P);i.dragRotate=new lh(e,E,A,F),this._add("mouseRotate",E,["mousePitch"]),this._add("mousePitch",A,["mouseRotate","mouseRoll"]),this._add("mouseRoll",F,["mousePitch"]),e.interactive&&e.dragRotate&&i.dragRotate.enable();const O=function({enable:ee,clickTolerance:ie}){const se=new rs({checkCorrectEvent:re=>ce.mouseButton(re)===0&&!re.ctrlKey});return new dr({clickTolerance:ie,move:(re,pe)=>({around:pe,panDelta:pe.sub(re)}),activateOnStart:!0,moveStateManager:se,enable:ee,assignEvents:Jo})}(e),H=new Nd(e,i);i.dragPan=new oh(s,O,H),this._add("mousePan",O),this._add("touchPan",H,["touchZoom","touchRotate"]),e.interactive&&e.dragPan&&i.dragPan.enable(e.dragPan);const q=new $e,W=new as;i.touchZoomRotate=new mc(s,W,q,x),this._add("touchRotate",q,["touchPan","touchZoom"]),this._add("touchZoom",W,["touchPan","touchRotate"]),e.interactive&&e.touchZoomRotate&&i.touchZoomRotate.enable(e.touchZoomRotate);const K=i.scrollZoom=new yt(i,()=>this._triggerRenderFrame());this._add("scrollZoom",K,["mousePan"]),e.interactive&&e.scrollZoom&&i.scrollZoom.enable(e.scrollZoom);const te=i.keyboard=new ss(i);this._add("keyboard",te),e.interactive&&e.keyboard&&i.keyboard.enable(),this._add("blockableMapEvent",new rh(i))}_add(e,i,s){this._handlers.push({handlerName:e,handler:i,allowed:s}),this._handlersById[e]=i}stop(e){if(!this._updatingCamera){for(const{handler:i}of this._handlers)i.reset();this._inertia.clear(),this._fireEvents({},{},e),this._changes=[]}}isActive(){for(const{handler:e}of this._handlers)if(e.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!Hs(this._eventsInProgress)||this.isZooming()}_blockedByActive(e,i,s){for(const l in e)if(l!==s&&(!i||i.indexOf(l)<0))return!0;return!1}_getMapTouches(e){const i=[];for(const s of e)this._el.contains(s.target)&&i.push(s);return i}mergeHandlerResult(e,i,s,l,h){if(!s)return;o.e(e,s);const f={handlerName:l,originalEvent:s.originalEvent||h};s.zoomDelta!==void 0&&(i.zoom=f),s.panDelta!==void 0&&(i.drag=f),s.rollDelta!==void 0&&(i.roll=f),s.pitchDelta!==void 0&&(i.pitch=f),s.bearingDelta!==void 0&&(i.rotate=f)}_applyChanges(){const e={},i={},s={};for(const[l,h,f]of this._changes)l.panDelta&&(e.panDelta=(e.panDelta||new o.P(0,0))._add(l.panDelta)),l.zoomDelta&&(e.zoomDelta=(e.zoomDelta||0)+l.zoomDelta),l.bearingDelta&&(e.bearingDelta=(e.bearingDelta||0)+l.bearingDelta),l.pitchDelta&&(e.pitchDelta=(e.pitchDelta||0)+l.pitchDelta),l.rollDelta&&(e.rollDelta=(e.rollDelta||0)+l.rollDelta),l.around!==void 0&&(e.around=l.around),l.pinchAround!==void 0&&(e.pinchAround=l.pinchAround),l.noInertia&&(e.noInertia=l.noInertia),o.e(i,h),o.e(s,f);this._updateMapTransform(e,i,s),this._changes=[]}_updateMapTransform(e,i,s){const l=this._map,h=l._getTransformForUpdate(),f=l.terrain;if(!(nl(e)||f&&this._terrainMovement))return this._fireEvents(i,s,!0);l._stop(!0);let{panDelta:_,zoomDelta:x,bearingDelta:T,pitchDelta:P,rollDelta:E,around:A,pinchAround:F}=e;F!==void 0&&(A=F),A=A||l.transform.centerPoint,f&&!h.isPointOnMapSurface(A)&&(A=h.centerPoint);const O={panDelta:_,zoomDelta:x,rollDelta:E,pitchDelta:P,bearingDelta:T,around:A};this._map.cameraHelper.useGlobeControls&&!h.isPointOnMapSurface(A)&&(A=h.centerPoint);const H=A.distSqr(h.centerPoint)<.01?h.center:h.screenPointToLocation(_?A.sub(_):A);f?(this._map.cameraHelper.handleMapControlsRollPitchBearingZoom(O,h),this._terrainMovement||!i.drag&&!i.zoom?i.drag&&this._terrainMovement?h.setCenter(h.screenPointToLocation(h.centerPoint.sub(_))):this._map.cameraHelper.handleMapControlsPan(O,h,H):(this._terrainMovement=!0,this._map._elevationFreeze=!0,this._map.cameraHelper.handleMapControlsPan(O,h,H))):(this._map.cameraHelper.handleMapControlsRollPitchBearingZoom(O,h),this._map.cameraHelper.handleMapControlsPan(O,h,H)),l._applyUpdatedTransform(h),this._map._update(),e.noInertia||this._inertia.record(e),this._fireEvents(i,s,!0)}_fireEvents(e,i,s){const l=Hs(this._eventsInProgress),h=Hs(e),f={};for(const E in e){const{originalEvent:A}=e[E];this._eventsInProgress[E]||(f[`${E}start`]=A),this._eventsInProgress[E]=e[E]}!l&&h&&this._fireEvent("movestart",h.originalEvent);for(const E in f)this._fireEvent(E,f[E]);h&&this._fireEvent("move",h.originalEvent);for(const E in e){const{originalEvent:A}=e[E];this._fireEvent(E,A)}const _={};let x;for(const E in this._eventsInProgress){const{handlerName:A,originalEvent:F}=this._eventsInProgress[E];this._handlersById[A].isActive()||(delete this._eventsInProgress[E],x=i[A]||F,_[`${E}end`]=x)}for(const E in _)this._fireEvent(E,_[E]);const T=Hs(this._eventsInProgress),P=(l||h)&&!T;if(P&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;const E=this._map._getTransformForUpdate();this._map.getCenterClampedToGround()&&E.recalculateZoomAndCenter(this._map.terrain),this._map._applyUpdatedTransform(E)}if(s&&P){this._updatingCamera=!0;const E=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),A=F=>F!==0&&-this._bearingSnap<F&&F<this._bearingSnap;!E||!E.essential&&Ce.prefersReducedMotion?(this._map.fire(new o.l("moveend",{originalEvent:x})),A(this._map.getBearing())&&this._map.resetNorth()):(A(E.bearing||this._map.getBearing())&&(E.bearing=0),E.freezeElevation=!0,this._map.easeTo(E,{originalEvent:x})),this._updatingCamera=!1}}_fireEvent(e,i){this._map.fire(new o.l(e,i?{originalEvent:i}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(e=>{delete this._frameId,this.handleEvent(new Vd("renderFrame",{timeStamp:e})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class $d extends o.E{constructor(e,i,s){super(),this._renderFrameCallback=()=>{const l=Math.min((Ce.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(l)),l<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=e,this._bearingSnap=s.bearingSnap,this.cameraHelper=i,this.on("moveend",()=>{delete this._requestedCameraState})}migrateProjection(e,i){e.apply(this.transform),this.transform=e,this.cameraHelper=i}getCenter(){return new o.Q(this.transform.center.lng,this.transform.center.lat)}setCenter(e,i){return this.jumpTo({center:e},i)}getCenterElevation(){return this.transform.elevation}setCenterElevation(e,i){return this.jumpTo({elevation:e},i),this}getCenterClampedToGround(){return this._centerClampedToGround}setCenterClampedToGround(e){this._centerClampedToGround=e}panBy(e,i,s){return e=o.P.convert(e).mult(-1),this.panTo(this.transform.center,o.e({offset:e},i),s)}panTo(e,i,s){return this.easeTo(o.e({center:e},i),s)}getZoom(){return this.transform.zoom}setZoom(e,i){return this.jumpTo({zoom:e},i),this}zoomTo(e,i,s){return this.easeTo(o.e({zoom:e},i),s)}zoomIn(e,i){return this.zoomTo(this.getZoom()+1,e,i),this}zoomOut(e,i){return this.zoomTo(this.getZoom()-1,e,i),this}getVerticalFieldOfView(){return this.transform.fov}setVerticalFieldOfView(e,i){return e!=this.transform.fov&&(this.transform.setFov(e),this.fire(new o.l("movestart",i)).fire(new o.l("move",i)).fire(new o.l("moveend",i))),this}getBearing(){return this.transform.bearing}setBearing(e,i){return this.jumpTo({bearing:e},i),this}getPadding(){return this.transform.padding}setPadding(e,i){return this.jumpTo({padding:e},i),this}rotateTo(e,i,s){return this.easeTo(o.e({bearing:e},i),s)}resetNorth(e,i){return this.rotateTo(0,o.e({duration:1e3},e),i),this}resetNorthPitch(e,i){return this.easeTo(o.e({bearing:0,pitch:0,roll:0,duration:1e3},e),i),this}snapToNorth(e,i){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(e,i):this}getPitch(){return this.transform.pitch}setPitch(e,i){return this.jumpTo({pitch:e},i),this}getRoll(){return this.transform.roll}setRoll(e,i){return this.jumpTo({roll:e},i),this}cameraForBounds(e,i){e=jt.convert(e).adjustAntiMeridian();const s=i&&i.bearing||0;return this._cameraForBoxAndBearing(e.getNorthWest(),e.getSouthEast(),s,i)}_cameraForBoxAndBearing(e,i,s,l){const h={top:0,bottom:0,right:0,left:0};if(typeof(l=o.e({padding:h,offset:[0,0],maxZoom:this.transform.maxZoom},l)).padding=="number"){const T=l.padding;l.padding={top:T,bottom:T,right:T,left:T}}const f=o.e(h,l.padding);l.padding=f;const _=this.transform,x=new jt(e,i);return this.cameraHelper.cameraForBoxAndBearing(l,f,x,s,_)}fitBounds(e,i,s){return this._fitInternal(this.cameraForBounds(e,i),i,s)}fitScreenCoordinates(e,i,s,l,h){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.screenPointToLocation(o.P.convert(e)),this.transform.screenPointToLocation(o.P.convert(i)),s,l),l,h)}_fitInternal(e,i,s){return e?(delete(i=o.e(e,i)).padding,i.linear?this.easeTo(i,s):this.flyTo(i,s)):this}jumpTo(e,i){this.stop();const s=this._getTransformForUpdate();let l=!1,h=!1,f=!1;const _=s.zoom;this.cameraHelper.handleJumpToCenterZoom(s,e);const x=s.zoom!==_;return"elevation"in e&&s.elevation!==+e.elevation&&s.setElevation(+e.elevation),"bearing"in e&&s.bearing!==+e.bearing&&(l=!0,s.setBearing(+e.bearing)),"pitch"in e&&s.pitch!==+e.pitch&&(h=!0,s.setPitch(+e.pitch)),"roll"in e&&s.roll!==+e.roll&&(f=!0,s.setRoll(+e.roll)),e.padding==null||s.isPaddingEqual(e.padding)||s.setPadding(e.padding),this._applyUpdatedTransform(s),this.fire(new o.l("movestart",i)).fire(new o.l("move",i)),x&&this.fire(new o.l("zoomstart",i)).fire(new o.l("zoom",i)).fire(new o.l("zoomend",i)),l&&this.fire(new o.l("rotatestart",i)).fire(new o.l("rotate",i)).fire(new o.l("rotateend",i)),h&&this.fire(new o.l("pitchstart",i)).fire(new o.l("pitch",i)).fire(new o.l("pitchend",i)),f&&this.fire(new o.l("rollstart",i)).fire(new o.l("roll",i)).fire(new o.l("rollend",i)),this.fire(new o.l("moveend",i))}calculateCameraOptionsFromTo(e,i,s,l=0){const h=o.$.fromLngLat(e,i),f=o.$.fromLngLat(s,l),_=f.x-h.x,x=f.y-h.y,T=f.z-h.z,P=Math.hypot(_,x,T);if(P===0)throw new Error("Can't calculate camera options with same From and To");const E=Math.hypot(_,x),A=o.ah(this.transform.cameraToCenterDistance/P/this.transform.tileSize),F=180*Math.atan2(_,-x)/Math.PI;let O=180*Math.acos(E/P)/Math.PI;return O=T<0?90-O:90+O,{center:f.toLngLat(),elevation:l,zoom:A,pitch:O,bearing:F}}calculateCameraOptionsFromCameraLngLatAltRotation(e,i,s,l,h){const f=this.transform.calculateCenterFromCameraLngLatAlt(e,i,s,l);return{center:f.center,elevation:f.elevation,zoom:f.zoom,bearing:s,pitch:l,roll:h}}easeTo(e,i){this._stop(!1,e.easeId),((e=o.e({offset:[0,0],duration:500,easing:o.cf},e)).animate===!1||!e.essential&&Ce.prefersReducedMotion)&&(e.duration=0);const s=this._getTransformForUpdate(),l=this.getBearing(),h=s.pitch,f=s.roll,_="bearing"in e?this._normalizeBearing(e.bearing,l):l,x="pitch"in e?+e.pitch:h,T="roll"in e?this._normalizeBearing(e.roll,f):f,P="padding"in e?e.padding:s.padding,E=o.P.convert(e.offset);let A,F;e.around&&(A=o.Q.convert(e.around),F=s.locationToScreenPoint(A));const O={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching,rolling:this._rolling},H=this.cameraHelper.handleEaseTo(s,{bearing:_,pitch:x,roll:T,padding:P,around:A,aroundPoint:F,offsetAsPoint:E,offset:e.offset,zoom:e.zoom,center:e.center});return this._rotating=this._rotating||l!==_,this._pitching=this._pitching||x!==h,this._rolling=this._rolling||T!==f,this._padding=!s.isPaddingEqual(P),this._zooming=this._zooming||H.isZooming,this._easeId=e.easeId,this._prepareEase(i,e.noMoveStart,O),this.terrain&&this._prepareElevation(H.elevationCenter),this._ease(q=>{H.easeFunc(q),this.terrain&&!e.freezeElevation&&this._updateElevation(q),this._applyUpdatedTransform(s),this._fireMoveEvents(i)},q=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(i,q)},e),this}_prepareEase(e,i,s={}){this._moving=!0,i||s.moving||this.fire(new o.l("movestart",e)),this._zooming&&!s.zooming&&this.fire(new o.l("zoomstart",e)),this._rotating&&!s.rotating&&this.fire(new o.l("rotatestart",e)),this._pitching&&!s.pitching&&this.fire(new o.l("pitchstart",e)),this._rolling&&!s.rolling&&this.fire(new o.l("rollstart",e))}_prepareElevation(e){this._elevationCenter=e,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(e,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(e){this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom));const i=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(e<1&&i!==this._elevationTarget){const s=this._elevationTarget-this._elevationStart;this._elevationStart+=e*(s-(i-(s*e+this._elevationStart))/(1-e)),this._elevationTarget=i}this.transform.setElevation(o.B.number(this._elevationStart,this._elevationTarget,e))}_finalizeElevation(){this._elevationFreeze=!1,this.getCenterClampedToGround()&&this.transform.recalculateZoomAndCenter(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate||this.terrain?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_elevateCameraIfInsideTerrain(e){if(!this.terrain&&e.elevation>=0&&e.pitch<=90)return{};const i=e.getCameraLngLat(),s=e.getCameraAltitude(),l=this.terrain?this.terrain.getElevationForLngLatZoom(i,e.zoom):0;if(s<l){const h=this.calculateCameraOptionsFromTo(i,l,e.center,e.elevation);return{pitch:h.pitch,zoom:h.zoom}}return{}}_applyUpdatedTransform(e){const i=[];if(i.push(l=>this._elevateCameraIfInsideTerrain(l)),this.transformCameraUpdate&&i.push(l=>this.transformCameraUpdate(l)),!i.length)return;const s=e.clone();for(const l of i){const h=s.clone(),{center:f,zoom:_,roll:x,pitch:T,bearing:P,elevation:E}=l(h);f&&h.setCenter(f),E!==void 0&&h.setElevation(E),_!==void 0&&h.setZoom(_),x!==void 0&&h.setRoll(x),T!==void 0&&h.setPitch(T),P!==void 0&&h.setBearing(P),s.apply(h)}this.transform.apply(s)}_fireMoveEvents(e){this.fire(new o.l("move",e)),this._zooming&&this.fire(new o.l("zoom",e)),this._rotating&&this.fire(new o.l("rotate",e)),this._pitching&&this.fire(new o.l("pitch",e)),this._rolling&&this.fire(new o.l("roll",e))}_afterEase(e,i){if(this._easeId&&i&&this._easeId===i)return;delete this._easeId;const s=this._zooming,l=this._rotating,h=this._pitching,f=this._rolling;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._rolling=!1,this._padding=!1,s&&this.fire(new o.l("zoomend",e)),l&&this.fire(new o.l("rotateend",e)),h&&this.fire(new o.l("pitchend",e)),f&&this.fire(new o.l("rollend",e)),this.fire(new o.l("moveend",e))}flyTo(e,i){if(!e.essential&&Ce.prefersReducedMotion){const be=o.O(e,["center","zoom","bearing","pitch","roll","elevation"]);return this.jumpTo(be,i)}this.stop(),e=o.e({offset:[0,0],speed:1.2,curve:1.42,easing:o.cf},e);const s=this._getTransformForUpdate(),l=s.bearing,h=s.pitch,f=s.roll,_=s.padding,x="bearing"in e?this._normalizeBearing(e.bearing,l):l,T="pitch"in e?+e.pitch:h,P="roll"in e?this._normalizeBearing(e.roll,f):f,E="padding"in e?e.padding:s.padding,A=o.P.convert(e.offset);let F=s.centerPoint.add(A);const O=s.screenPointToLocation(F),H=this.cameraHelper.handleFlyTo(s,{bearing:x,pitch:T,roll:P,padding:E,locationAtOffset:O,offsetAsPoint:A,center:e.center,minZoom:e.minZoom,zoom:e.zoom});let q=e.curve;const W=Math.max(s.width,s.height),K=W/H.scaleOfZoom,te=H.pixelPathLength;typeof H.scaleOfMinZoom=="number"&&(q=Math.sqrt(W/H.scaleOfMinZoom/te*2));const ee=q*q;function ie(be){const Fe=(K*K-W*W+(be?-1:1)*ee*ee*te*te)/(2*(be?K:W)*ee*te);return Math.log(Math.sqrt(Fe*Fe+1)-Fe)}function se(be){return(Math.exp(be)-Math.exp(-be))/2}function re(be){return(Math.exp(be)+Math.exp(-be))/2}const pe=ie(!1);let Me=function(be){return re(pe)/re(pe+q*be)},xe=function(be){return W*((re(pe)*(se(Fe=pe+q*be)/re(Fe))-se(pe))/ee)/te;var Fe},ve=(ie(!0)-pe)/q;if(Math.abs(te)<2e-6||!isFinite(ve)){if(Math.abs(W-K)<1e-6)return this.easeTo(e,i);const be=K<W?-1:1;ve=Math.abs(Math.log(K/W))/q,xe=()=>0,Me=Fe=>Math.exp(be*q*Fe)}return e.duration="duration"in e?+e.duration:1e3*ve/("screenSpeed"in e?+e.screenSpeed/q:+e.speed),e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=l!==x,this._pitching=T!==h,this._rolling=P!==f,this._padding=!s.isPaddingEqual(E),this._prepareEase(i,!1),this.terrain&&this._prepareElevation(H.targetCenter),this._ease(be=>{const Fe=be*ve,Be=1/Me(Fe),ke=xe(Fe);this._rotating&&s.setBearing(o.B.number(l,x,be)),this._pitching&&s.setPitch(o.B.number(h,T,be)),this._rolling&&s.setRoll(o.B.number(f,P,be)),this._padding&&(s.interpolatePadding(_,E,be),F=s.centerPoint.add(A)),H.easeFunc(be,Be,ke,F),this.terrain&&!e.freezeElevation&&this._updateElevation(be),this._applyUpdatedTransform(s),this._fireMoveEvents(i)},()=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(i)},e),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(e,i){var s;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const l=this._onEaseEnd;delete this._onEaseEnd,l.call(this,i)}return e||(s=this.handlers)===null||s===void 0||s.stop(!1),this}_ease(e,i,s){s.animate===!1||s.duration===0?(e(1),i()):(this._easeStart=Ce.now(),this._easeOptions=s,this._onEaseFrame=e,this._onEaseEnd=i,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(e,i){e=o.aL(e,-180,180);const s=Math.abs(e-i);return Math.abs(e-360-i)<s&&(e-=360),Math.abs(e+360-i)<s&&(e+=360),e}queryTerrainElevation(e){return this.terrain?this.terrain.getElevationForLngLatZoom(o.Q.convert(e),this.transform.tileZoom):null}}const zn={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class qt{constructor(e=zn){this._toggleAttribution=()=>{this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))},this._updateData=i=>{!i||i.sourceDataType!=="metadata"&&i.sourceDataType!=="visibility"&&i.dataType!=="style"&&i.type!=="terrain"||this._updateAttributions()},this._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"))},this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},this.options=e}getDefaultPosition(){return"bottom-right"}onAdd(e){return this._map=e,this._compact=this.options.compact,this._container=ce.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=ce.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=ce.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(){ce.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(e,i){const s=this._map._getUIString(`AttributionControl.${i}`);e.title=s,e.setAttribute("aria-label",s)}_updateAttributions(){if(!this._map.style)return;let e=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?e=e.concat(this.options.customAttribution.map(l=>typeof l!="string"?"":l)):typeof this.options.customAttribution=="string"&&e.push(this.options.customAttribution)),this._map.style.stylesheet){const l=this._map.style.stylesheet;this.styleOwner=l.owner,this.styleId=l.id}const i=this._map.style.sourceCaches;for(const l in i){const h=i[l];if(h.used||h.usedForTerrain){const f=h.getSource();f.attribution&&e.indexOf(f.attribution)<0&&e.push(f.attribution)}}e=e.filter(l=>String(l).trim()),e.sort((l,h)=>l.length-h.length),e=e.filter((l,h)=>{for(let f=h+1;f<e.length;f++)if(e[f].indexOf(l)>=0)return!1;return!0});const s=e.join(" | ");s!==this._attribHTML&&(this._attribHTML=s,e.length?(this._innerContainer.innerHTML=ce.sanitize(s),this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class Ws{constructor(e={}){this._updateCompact=()=>{const i=this._container.children;if(i.length){const s=i[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&s.classList.add("maplibregl-compact"):s.classList.remove("maplibregl-compact")}},this.options=e}getDefaultPosition(){return"bottom-left"}onAdd(e){this._map=e,this._compact=this.options&&this.options.compact,this._container=ce.create("div","maplibregl-ctrl");const i=ce.create("a","maplibregl-ctrl-logo");return i.target="_blank",i.rel="noopener nofollow",i.href="https://maplibre.org/",i.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),i.setAttribute("rel","noopener nofollow"),this._container.appendChild(i),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){ce.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class gc{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(e){const i=++this._id;return this._queue.push({callback:e,id:i,cancelled:!1}),i}remove(e){const i=this._currentlyRunning,s=i?this._queue.concat(i):this._queue;for(const l of s)if(l.id===e)return void(l.cancelled=!0)}run(e=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const i=this._currentlyRunning=this._queue;this._queue=[];for(const s of i)if(!s.cancelled&&(s.callback(e),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var ch=o.aG([{name:"a_pos3d",type:"Int16",components:3}]);class uh extends o.E{constructor(e){super(),this._lastTilesetChange=Ce.now(),this.sourceCache=e,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.deltaZoom=1,this.tileSize=e._source.tileSize*2**this.deltaZoom,e.usedForTerrain=!0,e.tileSize=this.tileSize}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(e,i){this.sourceCache.update(e,i),this._renderableTilesKeys=[];const s={};for(const l of oe(e,{tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:i,calculateTileZoom:this.sourceCache._source.calculateTileZoom}))s[l.key]=!0,this._renderableTilesKeys.push(l.key),this._tiles[l.key]||(l.terrainRttPosMatrix32f=new Float64Array(16),o.bQ(l.terrainRttPosMatrix32f,0,o.Z,o.Z,0,0,1),this._tiles[l.key]=new qr(l,this.tileSize),this._lastTilesetChange=Ce.now());for(const l in this._tiles)s[l]||delete this._tiles[l]}freeRtt(e){for(const i in this._tiles){const s=this._tiles[i];(!e||s.tileID.equals(e)||s.tileID.isChildOf(e)||e.isChildOf(s.tileID))&&(s.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(e=>this.getTileByID(e))}getTileByID(e){return this._tiles[e]}getTerrainCoords(e,i){return i?this._getTerrainCoordsForTileRanges(e,i):this._getTerrainCoordsForRegularTile(e)}_getTerrainCoordsForRegularTile(e){const i={};for(const s of this._renderableTilesKeys){const l=this._tiles[s].tileID,h=e.clone(),f=o.b2();if(l.canonical.equals(e.canonical))o.bQ(f,0,o.Z,o.Z,0,0,1);else if(l.canonical.isChildOf(e.canonical)){const _=l.canonical.z-e.canonical.z,x=l.canonical.x-(l.canonical.x>>_<<_),T=l.canonical.y-(l.canonical.y>>_<<_),P=o.Z>>_;o.bQ(f,0,P,P,0,0,1),o.L(f,f,[-x*P,-T*P,0])}else{if(!e.canonical.isChildOf(l.canonical))continue;{const _=e.canonical.z-l.canonical.z,x=e.canonical.x-(e.canonical.x>>_<<_),T=e.canonical.y-(e.canonical.y>>_<<_),P=o.Z>>_;o.bQ(f,0,o.Z,o.Z,0,0,1),o.L(f,f,[x*P,T*P,0]),o.M(f,f,[1/2**_,1/2**_,0])}}h.terrainRttPosMatrix32f=new Float32Array(f),i[s]=h}return i}_getTerrainCoordsForTileRanges(e,i){const s={};for(const l of this._renderableTilesKeys){const h=this._tiles[l].tileID;if(!this._isWithinTileRanges(h,i))continue;const f=e.clone(),_=o.b2();if(h.canonical.z===e.canonical.z){const x=e.canonical.x-h.canonical.x,T=e.canonical.y-h.canonical.y;o.bQ(_,0,o.Z,o.Z,0,0,1),o.L(_,_,[x*o.Z,T*o.Z,0])}else if(h.canonical.z>e.canonical.z){const x=h.canonical.z-e.canonical.z,T=h.canonical.x-(h.canonical.x>>x<<x),P=h.canonical.y-(h.canonical.y>>x<<x),E=e.canonical.x-(h.canonical.x>>x),A=e.canonical.y-(h.canonical.y>>x),F=o.Z>>x;o.bQ(_,0,F,F,0,0,1),o.L(_,_,[-T*F+E*o.Z,-P*F+A*o.Z,0])}else{const x=e.canonical.z-h.canonical.z,T=e.canonical.x-(e.canonical.x>>x<<x),P=e.canonical.y-(e.canonical.y>>x<<x),E=(e.canonical.x>>x)-h.canonical.x,A=(e.canonical.y>>x)-h.canonical.y,F=o.Z<<x;o.bQ(_,0,F,F,0,0,1),o.L(_,_,[T*o.Z+E*F,P*o.Z+A*F,0])}f.terrainRttPosMatrix32f=new Float32Array(_),s[l]=f}return s}getSourceTile(e,i){const s=this.sourceCache._source;let l=e.overscaledZ-this.deltaZoom;if(l>s.maxzoom&&(l=s.maxzoom),l<s.minzoom)return null;this._sourceTileCache[e.key]||(this._sourceTileCache[e.key]=e.scaledTo(l).key);let h=this.sourceCache.getTileByID(this._sourceTileCache[e.key]);if((!h||!h.dem)&&i)for(;l>=s.minzoom&&(!h||!h.dem);)h=this.sourceCache.getTileByID(e.scaledTo(l--).key);return h}anyTilesAfterTime(e=Date.now()){return this._lastTilesetChange>=e}_isWithinTileRanges(e,i){return i[e.canonical.z]&&e.canonical.x>=i[e.canonical.z].minTileX&&e.canonical.x<=i[e.canonical.z].maxTileX&&e.canonical.y>=i[e.canonical.z].minTileY&&e.canonical.y<=i[e.canonical.z].maxTileY}}class hh{constructor(e,i,s){this._meshCache={},this.painter=e,this.sourceCache=new uh(i),this.options=s,this.exaggeration=typeof s.exaggeration=="number"?s.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(e,i,s,l=o.Z){var h;if(!(i>=0&&i<l&&s>=0&&s<l))return 0;const f=this.getTerrainData(e),_=(h=f.tile)===null||h===void 0?void 0:h.dem;if(!_)return 0;const x=o.cj([],[i/l*o.Z,s/l*o.Z],f.u_terrain_matrix),T=[x[0]*_.dim,x[1]*_.dim],P=Math.floor(T[0]),E=Math.floor(T[1]),A=T[0]-P,F=T[1]-E;return _.get(P,E)*(1-A)*(1-F)+_.get(P+1,E)*A*(1-F)+_.get(P,E+1)*(1-A)*F+_.get(P+1,E+1)*A*F}getElevationForLngLatZoom(e,i){if(!o.ck(i,e.wrap()))return 0;const{tileID:s,mercatorX:l,mercatorY:h}=this._getOverscaledTileIDFromLngLatZoom(e,i);return this.getElevation(s,l%o.Z,h%o.Z,o.Z)}getElevation(e,i,s,l=o.Z){return this.getDEMElevation(e,i,s,l)*this.exaggeration}getTerrainData(e){if(!this._emptyDemTexture){const l=this.painter.context,h=new o.R({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new Ut(l,h,l.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new Ut(l,new o.R({width:1,height:1}),l.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(l.gl.NEAREST,l.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=o.ad([])}const i=this.sourceCache.getSourceTile(e,!0);if(i&&i.dem&&(!i.demTexture||i.needsTerrainPrepare)){const l=this.painter.context;i.demTexture=this.painter.getTileTexture(i.dem.stride),i.demTexture?i.demTexture.update(i.dem.getPixels(),{premultiply:!1}):i.demTexture=new Ut(l,i.dem.getPixels(),l.gl.RGBA,{premultiply:!1}),i.demTexture.bind(l.gl.NEAREST,l.gl.CLAMP_TO_EDGE),i.needsTerrainPrepare=!1}const s=i&&i+i.tileID.key+e.key;if(s&&!this._demMatrixCache[s]){const l=this.sourceCache.sourceCache._source.maxzoom;let h=e.canonical.z-i.tileID.canonical.z;e.overscaledZ>e.canonical.z&&(e.canonical.z>=l?h=e.canonical.z-l:o.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const f=e.canonical.x-(e.canonical.x>>h<<h),_=e.canonical.y-(e.canonical.y>>h<<h),x=o.cl(new Float64Array(16),[1/(o.Z<<h),1/(o.Z<<h),0]);o.L(x,x,[f*o.Z,_*o.Z,0]),this._demMatrixCache[e.key]={matrix:x,coord:e}}return{u_depth:2,u_terrain:3,u_terrain_dim:i&&i.dem&&i.dem.dim||1,u_terrain_matrix:s?this._demMatrixCache[e.key].matrix:this._emptyDemMatrix,u_terrain_unpack:i&&i.dem&&i.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(i&&i.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:i}}getFramebuffer(e){const i=this.painter,s=i.width/devicePixelRatio,l=i.height/devicePixelRatio;return!this._fbo||this._fbo.width===s&&this._fbo.height===l||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new Ut(i.context,{width:s,height:l,data:null},i.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(i.context.gl.NEAREST,i.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new Ut(i.context,{width:s,height:l,data:null},i.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(i.context.gl.NEAREST,i.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=i.context.createFramebuffer(s,l,!0,!1),this._fbo.depthAttachment.set(i.context.createRenderbuffer(i.context.gl.DEPTH_COMPONENT16,s,l))),this._fbo.colorAttachment.set(e==="coords"?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){const e=this.painter.context;if(this._coordsTexture)return this._coordsTexture;const i=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let h=0,f=0;h<this._coordsTextureSize;h++)for(let _=0;_<this._coordsTextureSize;_++,f+=4)i[f+0]=255&_,i[f+1]=255&h,i[f+2]=_>>8<<4|h>>8,i[f+3]=0;const s=new o.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(i.buffer)),l=new Ut(e,s,e.gl.RGBA,{premultiply:!1});return l.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),this._coordsTexture=l,l}pointCoordinate(e){this.painter.maybeDrawDepthAndCoords(!0);const i=new Uint8Array(4),s=this.painter.context,l=s.gl,h=Math.round(e.x*this.painter.pixelRatio/devicePixelRatio),f=Math.round(e.y*this.painter.pixelRatio/devicePixelRatio),_=Math.round(this.painter.height/devicePixelRatio);s.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),l.readPixels(h,_-f-1,1,1,l.RGBA,l.UNSIGNED_BYTE,i),s.bindFramebuffer.set(null);const x=i[0]+(i[2]>>4<<8),T=i[1]+((15&i[2])<<8),P=this.coordsIndex[255-i[3]],E=P&&this.sourceCache.getTileByID(P);if(!E)return null;const A=this._coordsTextureSize,F=(1<<E.tileID.canonical.z)*A;return new o.$((E.tileID.canonical.x*A+x)/F+E.tileID.wrap,(E.tileID.canonical.y*A+T)/F,this.getElevation(E.tileID,x,T,A))}depthAtPoint(e){const i=new Uint8Array(4),s=this.painter.context,l=s.gl;return s.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer),l.readPixels(e.x,this.painter.height/devicePixelRatio-e.y-1,1,1,l.RGBA,l.UNSIGNED_BYTE,i),s.bindFramebuffer.set(null),(i[0]/16777216+i[1]/65536+i[2]/256+i[3])/256}getTerrainMesh(e){var i;const s=((i=this.painter.style.projection)===null||i===void 0?void 0:i.transitionState)>0,l=s&&e.canonical.y===0,h=s&&e.canonical.y===(1<<e.canonical.z)-1,f=`m_${l?"n":""}_${h?"s":""}`;if(this._meshCache[f])return this._meshCache[f];const _=this.painter.context,x=new o.cm,T=new o.aK,P=this.meshSize,E=o.Z/P,A=P*P;for(let re=0;re<=P;re++)for(let pe=0;pe<=P;pe++)x.emplaceBack(pe*E,re*E,0);for(let re=0;re<A;re+=P+1)for(let pe=0;pe<P;pe++)T.emplaceBack(pe+re,P+pe+re+1,P+pe+re+2),T.emplaceBack(pe+re,P+pe+re+2,pe+re+1);const F=x.length,O=F+(P+1),H=(P+1)*P,q=l?o.b9:0,W=l?0:1,K=h?o.ba:o.Z,te=h?0:1;for(let re=0;re<=P;re++)x.emplaceBack(re*E,q,W);for(let re=0;re<=P;re++)x.emplaceBack(re*E,K,te);for(let re=0;re<P;re++)T.emplaceBack(H+re,O+re,O+re+1),T.emplaceBack(H+re,O+re+1,H+re+1),T.emplaceBack(0+re,F+re+1,F+re),T.emplaceBack(0+re,0+re+1,F+re+1);const ee=x.length,ie=ee+2*(P+1);for(const re of[0,1])for(let pe=0;pe<=P;pe++)for(const Me of[0,1])x.emplaceBack(re*o.Z,pe*E,Me);for(let re=0;re<2*P;re+=2)T.emplaceBack(ee+re,ee+re+1,ee+re+3),T.emplaceBack(ee+re,ee+re+3,ee+re+2),T.emplaceBack(ie+re,ie+re+3,ie+re+1),T.emplaceBack(ie+re,ie+re+2,ie+re+3);const se=new Va(_.createVertexBuffer(x,ch.members),_.createIndexBuffer(T),o.aJ.simpleSegment(0,0,x.length,T.length));return this._meshCache[f]=se,se}getMeshFrameDelta(e){return 2*Math.PI*o.bu/Math.pow(2,Math.max(e,0))/5}getMinTileElevationForLngLatZoom(e,i){var s;const{tileID:l}=this._getOverscaledTileIDFromLngLatZoom(e,i);return(s=this.getMinMaxElevation(l).minElevation)!==null&&s!==void 0?s:0}getMinMaxElevation(e){const i=this.getTerrainData(e).tile,s={minElevation:null,maxElevation:null};return i&&i.dem&&(s.minElevation=i.dem.min*this.exaggeration,s.maxElevation=i.dem.max*this.exaggeration),s}_getOverscaledTileIDFromLngLatZoom(e,i){const s=o.$.fromLngLat(e.wrap()),l=(1<<i)*o.Z,h=s.x*l,f=s.y*l,_=Math.floor(h/o.Z),x=Math.floor(f/o.Z);return{tileID:new o.Y(i,0,i,_,x),mercatorX:h,mercatorY:f}}}class Gd{constructor(e,i,s){this._context=e,this._size=i,this._tileSize=s,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(const e of this._objects)e.texture.destroy(),e.fbo.destroy()}_createObject(e){const i=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),s=new Ut(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return s.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),this._context.extTextureFilterAnisotropic&&this._context.gl.texParameterf(this._context.gl.TEXTURE_2D,this._context.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,this._context.extTextureFilterAnisotropicMax),i.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),i.colorAttachment.set(s.texture),{id:e,fbo:i,texture:s,stamp:-1,inUse:!1}}getObjectForId(e){return this._objects[e]}useObject(e){e.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter(i=>e.id!==i),this._recentlyUsed.push(e.id)}stampObject(e){e.stamp=++this._stamp}getOrCreateFreeObject(){for(const i of this._recentlyUsed)if(!this._objects[i].inUse)return this._objects[i];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const e=this._createObject(this._objects.length);return this._objects.push(e),e}freeObject(e){e.inUse=!1}freeAllObjects(){for(const e of this._objects)this.freeObject(e)}isFull(){return!(this._objects.length<this._size)&&this._objects.some(e=>!e.inUse)===!1}}const br={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class al{constructor(e,i){this.painter=e,this.terrain=i,this.pool=new Gd(e.context,30,i.sourceCache.tileSize*i.qualityFactor)}destruct(){this.pool.destruct()}getTexture(e){return this.pool.getObjectForId(e.rtt[this._stacks.length-1].id).texture}prepareForRender(e,i){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=e._order.filter(s=>!e._layers[s].isHidden(i)),this._coordsAscending={};for(const s in e.sourceCaches){this._coordsAscending[s]={};const l=e.sourceCaches[s].getVisibleCoordinates(),h=e.sourceCaches[s].getSource(),f=h instanceof gr?h.terrainTileRanges:null;for(const _ of l){const x=this.terrain.sourceCache.getTerrainCoords(_,f);for(const T in x)this._coordsAscending[s][T]||(this._coordsAscending[s][T]=[]),this._coordsAscending[s][T].push(x[T])}}this._coordsAscendingStr={};for(const s of e._order){const l=e._layers[s],h=l.source;if(br[l.type]&&!this._coordsAscendingStr[h]){this._coordsAscendingStr[h]={};for(const f in this._coordsAscending[h])this._coordsAscendingStr[h][f]=this._coordsAscending[h][f].map(_=>_.key).sort().join()}}for(const s of this._renderableTiles)for(const l in this._coordsAscendingStr){const h=this._coordsAscendingStr[l][s.tileID.key];h&&h!==s.rttCoords[l]&&(s.rtt=[])}}renderLayer(e,i){if(e.isHidden(this.painter.transform.zoom))return!1;const s=Object.assign(Object.assign({},i),{isRenderingToTexture:!0}),l=e.type,h=this.painter,f=this._renderableLayerIds[this._renderableLayerIds.length-1]===e.id;if(br[l]&&(this._prevType&&br[this._prevType]||this._stacks.push([]),this._prevType=l,this._stacks[this._stacks.length-1].push(e.id),!f))return!0;if(br[this._prevType]||br[l]&&f){this._prevType=l;const _=this._stacks.length-1,x=this._stacks[_]||[];for(const T of this._renderableTiles){if(this.pool.isFull()&&(Hn(this.painter,this.terrain,this._rttTiles,s),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(T),T.rtt[_]){const E=this.pool.getObjectForId(T.rtt[_].id);if(E.stamp===T.rtt[_].stamp){this.pool.useObject(E);continue}}const P=this.pool.getOrCreateFreeObject();this.pool.useObject(P),this.pool.stampObject(P),T.rtt[_]={id:P.id,stamp:P.stamp},h.context.bindFramebuffer.set(P.fbo.framebuffer),h.context.clear({color:o.b7.transparent,stencil:0}),h.currentStencilSource=void 0;for(let E=0;E<x.length;E++){const A=h.style._layers[x[E]],F=A.source?this._coordsAscending[A.source][T.tileID.key]:[T.tileID];h.context.viewport.set([0,0,P.fbo.width,P.fbo.height]),h._renderTileClippingMasks(A,F,!0),h.renderLayer(h,h.style.sourceCaches[A.source],A,F,s),A.source&&(T.rttCoords[A.source]=this._coordsAscendingStr[A.source][T.tileID.key])}}return Hn(this.painter,this.terrain,this._rttTiles,s),this._rttTiles=[],this.pool.freeAllObjects(),br[l]}return!1}}const Ke={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"MapLibre logo","Map.Title":"Map","Marker.Title":"Map marker","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","Popup.Close":"Close popup","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","GlobeControl.Enable":"Enable globe","GlobeControl.Disable":"Disable globe","TerrainControl.Enable":"Enable terrain","TerrainControl.Disable":"Disable terrain","CooperativeGesturesHandler.WindowsHelpText":"Use Ctrl + scroll to zoom the map","CooperativeGesturesHandler.MacHelpText":"Use ⌘ + scroll to zoom the map","CooperativeGesturesHandler.MobileHelpText":"Use two fingers to move the map"},nt=de,Xs={hash:!1,interactive:!0,bearingSnap:7,attributionControl:zn,maplibreLogo:!1,refreshExpiredTiles:!0,canvasContextAttributes:{antialias:!1,preserveDrawingBuffer:!1,powerPreference:"high-performance",failIfMajorPerformanceCaveat:!1,desynchronized:!1,contextType:void 0},scrollZoom:!0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,trackResize:!0,center:[0,0],elevation:0,zoom:0,bearing:0,pitch:0,roll:0,renderWorldCopies:!0,maxTileCacheSize:null,maxTileCacheZoomLevels:o.a.MAX_TILE_CACHE_ZOOM_LEVELS,transformRequest:null,transformCameraUpdate:null,fadeDuration:300,crossSourceCollisions:!0,clickTolerance:3,localIdeographFontFamily:"sans-serif",pitchWithRotate:!0,rollEnabled:!1,validateStyle:!0,maxCanvasSize:[4096,4096],cancelPendingTileRequestsWhileZooming:!0,centerClampedToGround:!0},_c={showCompass:!0,showZoom:!0,visualizePitch:!1,visualizeRoll:!0};class yc{constructor(e,i,s=!1){this.mousedown=h=>{this.startMove(h,ce.mousePos(this.element,h)),ce.addEventListener(window,"mousemove",this.mousemove),ce.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=h=>{this.move(h,ce.mousePos(this.element,h))},this.mouseup=h=>{this._rotatePitchHanlder.dragEnd(h),this.offTemp()},this.touchstart=h=>{h.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=ce.touchPos(this.element,h.targetTouches)[0],this.startMove(h,this._startPos),ce.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),ce.addEventListener(window,"touchend",this.touchend))},this.touchmove=h=>{h.targetTouches.length!==1?this.reset():(this._lastPos=ce.touchPos(this.element,h.targetTouches)[0],this.move(h,this._lastPos))},this.touchend=h=>{h.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()},this.reset=()=>{this._rotatePitchHanlder.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10,this.element=i;const l=new ns;this._rotatePitchHanlder=new dr({clickTolerance:3,move:(h,f)=>{const _=i.getBoundingClientRect(),x=new o.P((_.bottom-_.top)/2,(_.right-_.left)/2);return{bearingDelta:o.ce(new o.P(h.x,f.y),f,x),pitchDelta:s?-.5*(f.y-h.y):void 0}},moveStateManager:l,enable:!0,assignEvents:()=>{}}),this.map=e,ce.addEventListener(i,"mousedown",this.mousedown),ce.addEventListener(i,"touchstart",this.touchstart,{passive:!1}),ce.addEventListener(i,"touchcancel",this.reset)}startMove(e,i){this._rotatePitchHanlder.dragStart(e,i),ce.disableDrag()}move(e,i){const s=this.map,{bearingDelta:l,pitchDelta:h}=this._rotatePitchHanlder.dragMove(e,i)||{};l&&s.setBearing(s.getBearing()+l),h&&s.setPitch(s.getPitch()+h)}off(){const e=this.element;ce.removeEventListener(e,"mousedown",this.mousedown),ce.removeEventListener(e,"touchstart",this.touchstart,{passive:!1}),ce.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),ce.removeEventListener(window,"touchend",this.touchend),ce.removeEventListener(e,"touchcancel",this.reset),this.offTemp()}offTemp(){ce.enableDrag(),ce.removeEventListener(window,"mousemove",this.mousemove),ce.removeEventListener(window,"mouseup",this.mouseup),ce.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),ce.removeEventListener(window,"touchend",this.touchend)}}let Mi;function xc(u,e,i,s=!1){if(s||!i.getCoveringTilesDetailsProvider().allowWorldCopies())return u==null?void 0:u.wrap();const l=new o.Q(u.lng,u.lat);if(u=new o.Q(u.lng,u.lat),e){const h=new o.Q(u.lng-360,u.lat),f=new o.Q(u.lng+360,u.lat),_=i.locationToScreenPoint(u).distSqr(e);i.locationToScreenPoint(h).distSqr(e)<_?u=h:i.locationToScreenPoint(f).distSqr(e)<_&&(u=f)}for(;Math.abs(u.lng-i.center.lng)>180;){const h=i.locationToScreenPoint(u);if(h.x>=0&&h.y>=0&&h.x<=i.width&&h.y<=i.height)break;u.lng>i.center.lng?u.lng-=360:u.lng+=360}return u.lng!==l.lng&&i.isPointOnMapSurface(i.locationToScreenPoint(u))?u:l}const Xr={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 dh(u,e,i){const s=u.classList;for(const l in Xr)s.remove(`maplibregl-${i}-anchor-${l}`);s.add(`maplibregl-${i}-anchor-${e}`)}class ba extends o.E{constructor(e){if(super(),this._onKeyPress=i=>{const s=i.code,l=i.charCode||i.keyCode;s!=="Space"&&s!=="Enter"&&l!==32&&l!==13||this.togglePopup()},this._onMapClick=i=>{const s=i.originalEvent.target,l=this._element;this._popup&&(s===l||l.contains(s))&&this.togglePopup()},this._update=i=>{if(!this._map)return;const s=this._map.loaded()&&!this._map.isMoving();((i==null?void 0:i.type)==="terrain"||(i==null?void 0:i.type)==="render"&&!s)&&this._map.once("render",this._update),this._lngLat=xc(this._lngLat,this._flatPos,this._map.transform),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationToScreenPoint(this._lngLat)._add(this._offset));let l="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?l=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(l=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let h="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?h="rotateX(0deg)":this._pitchAlignment==="map"&&(h=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||i&&i.type!=="moveend"||(this._pos=this._pos.round()),ce.setTransform(this._element,`${Xr[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${h} ${l}`),Ce.frameAsync(new AbortController).then(()=>{this._updateOpacity(i&&i.type==="moveend")}).catch(()=>{})},this._onMove=i=>{if(!this._isDragging){const s=this._clickTolerance||this._map._clickTolerance;this._isDragging=i.point.dist(this._pointerdownPos)>=s}this._isDragging&&(this._pos=i.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 o.l("dragstart"))),this.fire(new o.l("drag")))},this._onUp=()=>{this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._state==="active"&&this.fire(new o.l("dragend")),this._state="inactive"},this._addDragHandler=i=>{this._element.contains(i.originalEvent.target)&&(i.preventDefault(),this._positionDelta=i.point.sub(this._pos).add(this._offset),this._pointerdownPos=i.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},this._anchor=e&&e.anchor||"center",this._color=e&&e.color||"#3FB1CE",this._scale=e&&e.scale||1,this._draggable=e&&e.draggable||!1,this._clickTolerance=e&&e.clickTolerance||0,this._subpixelPositioning=e&&e.subpixelPositioning||!1,this._isDragging=!1,this._state="inactive",this._rotation=e&&e.rotation||0,this._rotationAlignment=e&&e.rotationAlignment||"auto",this._pitchAlignment=e&&e.pitchAlignment&&e.pitchAlignment!=="auto"?e.pitchAlignment:this._rotationAlignment,this.setOpacity(e==null?void 0:e.opacity,e==null?void 0:e.opacityWhenCovered),e&&e.element)this._element=e.element,this._offset=o.P.convert(e&&e.offset||[0,0]);else{this._defaultMarker=!0,this._element=ce.create("div");const i=ce.createNS("http://www.w3.org/2000/svg","svg"),s=41,l=27;i.setAttributeNS(null,"display","block"),i.setAttributeNS(null,"height",`${s}px`),i.setAttributeNS(null,"width",`${l}px`),i.setAttributeNS(null,"viewBox",`0 0 ${l} ${s}`);const h=ce.createNS("http://www.w3.org/2000/svg","g");h.setAttributeNS(null,"stroke","none"),h.setAttributeNS(null,"stroke-width","1"),h.setAttributeNS(null,"fill","none"),h.setAttributeNS(null,"fill-rule","evenodd");const f=ce.createNS("http://www.w3.org/2000/svg","g");f.setAttributeNS(null,"fill-rule","nonzero");const _=ce.createNS("http://www.w3.org/2000/svg","g");_.setAttributeNS(null,"transform","translate(3.0, 29.0)"),_.setAttributeNS(null,"fill","#000000");const x=[{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 W of x){const K=ce.createNS("http://www.w3.org/2000/svg","ellipse");K.setAttributeNS(null,"opacity","0.04"),K.setAttributeNS(null,"cx","10.5"),K.setAttributeNS(null,"cy","5.80029008"),K.setAttributeNS(null,"rx",W.rx),K.setAttributeNS(null,"ry",W.ry),_.appendChild(K)}const T=ce.createNS("http://www.w3.org/2000/svg","g");T.setAttributeNS(null,"fill",this._color);const P=ce.createNS("http://www.w3.org/2000/svg","path");P.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),T.appendChild(P);const E=ce.createNS("http://www.w3.org/2000/svg","g");E.setAttributeNS(null,"opacity","0.25"),E.setAttributeNS(null,"fill","#000000");const A=ce.createNS("http://www.w3.org/2000/svg","path");A.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"),E.appendChild(A);const F=ce.createNS("http://www.w3.org/2000/svg","g");F.setAttributeNS(null,"transform","translate(6.0, 7.0)"),F.setAttributeNS(null,"fill","#FFFFFF");const O=ce.createNS("http://www.w3.org/2000/svg","g");O.setAttributeNS(null,"transform","translate(8.0, 8.0)");const H=ce.createNS("http://www.w3.org/2000/svg","circle");H.setAttributeNS(null,"fill","#000000"),H.setAttributeNS(null,"opacity","0.25"),H.setAttributeNS(null,"cx","5.5"),H.setAttributeNS(null,"cy","5.5"),H.setAttributeNS(null,"r","5.4999962");const q=ce.createNS("http://www.w3.org/2000/svg","circle");q.setAttributeNS(null,"fill","#FFFFFF"),q.setAttributeNS(null,"cx","5.5"),q.setAttributeNS(null,"cy","5.5"),q.setAttributeNS(null,"r","5.4999962"),O.appendChild(H),O.appendChild(q),f.appendChild(_),f.appendChild(T),f.appendChild(E),f.appendChild(F),f.appendChild(O),i.appendChild(f),i.setAttributeNS(null,"height",s*this._scale+"px"),i.setAttributeNS(null,"width",l*this._scale+"px"),this._element.appendChild(i),this._offset=o.P.convert(e&&e.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",i=>{i.preventDefault()}),this._element.addEventListener("mousedown",i=>{i.preventDefault()}),dh(this._element,this._anchor,"marker"),e&&e.className)for(const i of e.className.split(" "))this._element.classList.add(i);this._popup=null}addTo(e){return this.remove(),this._map=e,this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label",e._getUIString("Marker.Title")),e.getCanvasContainer().appendChild(this._element),e.on("move",this._update),e.on("moveend",this._update),e.on("terrain",this._update),e.on("projectiontransition",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("terrain",this._update),this._map.off("projectiontransition",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),ce.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=o.Q.convert(e),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(e){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),e){if(!("offset"in e.options)){const l=Math.abs(13.5)/Math.SQRT2;e.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[l,-1*(38.1-13.5+l)],"bottom-right":[-l,-1*(38.1-13.5+l)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=e,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}setSubpixelPositioning(e){return this._subpixelPositioning=e,this}getPopup(){return this._popup}togglePopup(){const e=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:e?(e.isOpen()?e.remove():(e.setLngLat(this._lngLat),e.addTo(this._map)),this):this}_updateOpacity(e=!1){var i,s;const l=(i=this._map)===null||i===void 0?void 0:i.terrain,h=this._map.transform.isLocationOccluded(this._lngLat);if(!l||h){const F=h?this._opacityWhenCovered:this._opacity;return void(this._element.style.opacity!==F&&(this._element.style.opacity=F))}if(e)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}const f=this._map,_=f.terrain.depthAtPoint(this._pos),x=f.terrain.getElevationForLngLatZoom(this._lngLat,f.transform.tileZoom);if(f.transform.lngLatToCameraDepth(this._lngLat,x)-_<.006)return void(this._element.style.opacity=this._opacity);const T=-this._offset.y/f.transform.pixelsPerMeter,P=Math.sin(f.getPitch()*Math.PI/180)*T,E=f.terrain.depthAtPoint(new o.P(this._pos.x,this._pos.y-this._offset.y)),A=f.transform.lngLatToCameraDepth(this._lngLat,x+P)-E>.006;!((s=this._popup)===null||s===void 0)&&s.isOpen()&&A&&this._popup.remove(),this._element.style.opacity=A?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(e){return this._offset=o.P.convert(e),this._update(),this}addClassName(e){this._element.classList.add(e)}removeClassName(e){this._element.classList.remove(e)}toggleClassName(e){return this._element.classList.toggle(e)}setDraggable(e){return this._draggable=!!e,this._map&&(e?(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(e){return this._rotation=e||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(e){return this._rotationAlignment=e||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(e){return this._pitchAlignment=e&&e!=="auto"?e:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(e,i){return(this._opacity===void 0||e===void 0&&i===void 0)&&(this._opacity="1",this._opacityWhenCovered="0.2"),e!==void 0&&(this._opacity=e),i!==void 0&&(this._opacityWhenCovered=i),this._map&&this._updateOpacity(!0),this}}const ui={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let ei=0,os=!1;const Ks={maxWidth:100,unit:"metric"};function Ys(u,e,i){const s=i&&i.maxWidth||100,l=u._container.clientHeight/2,h=u._container.clientWidth/2,f=u.unproject([h-s/2,l]),_=u.unproject([h+s/2,l]),x=Math.round(u.project(_).x-u.project(f).x),T=Math.min(s,x,u._container.clientWidth),P=f.distanceTo(_);if(i&&i.unit==="imperial"){const E=3.2808*P;E>5280?wa(e,T,E/5280,u._getUIString("ScaleControl.Miles")):wa(e,T,E,u._getUIString("ScaleControl.Feet"))}else i&&i.unit==="nautical"?wa(e,T,P/1852,u._getUIString("ScaleControl.NauticalMiles")):P>=1e3?wa(e,T,P/1e3,u._getUIString("ScaleControl.Kilometers")):wa(e,T,P,u._getUIString("ScaleControl.Meters"))}function wa(u,e,i,s){const l=function(h){const f=Math.pow(10,`${Math.floor(h)}`.length-1);let _=h/f;return _=_>=10?10:_>=5?5:_>=3?3:_>=2?2:_>=1?1:function(x){const T=Math.pow(10,Math.ceil(-Math.log(x)/Math.LN10));return Math.round(x*T)/T}(_),f*_}(i);u.style.width=e*(l/i)+"px",u.innerHTML=`${l} ${s}`}const vc={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1,locationOccludedOpacity:void 0},bc=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function ls(u){if(u){if(typeof u=="number"){const e=Math.round(Math.abs(u)/Math.SQRT2);return{center:new o.P(0,0),top:new o.P(0,u),"top-left":new o.P(e,e),"top-right":new o.P(-e,e),bottom:new o.P(0,-u),"bottom-left":new o.P(e,-e),"bottom-right":new o.P(-e,-e),left:new o.P(u,0),right:new o.P(-u,0)}}if(u instanceof o.P||Array.isArray(u)){const e=o.P.convert(u);return{center:e,top:e,"top-left":e,"top-right":e,bottom:e,"bottom-left":e,"bottom-right":e,left:e,right:e}}return{center:o.P.convert(u.center||[0,0]),top:o.P.convert(u.top||[0,0]),"top-left":o.P.convert(u["top-left"]||[0,0]),"top-right":o.P.convert(u["top-right"]||[0,0]),bottom:o.P.convert(u.bottom||[0,0]),"bottom-left":o.P.convert(u["bottom-left"]||[0,0]),"bottom-right":o.P.convert(u["bottom-right"]||[0,0]),left:o.P.convert(u.left||[0,0]),right:o.P.convert(u.right||[0,0])}}return ls(new o.P(0,0))}const wc=de;S.AJAXError=o.cq,S.Event=o.l,S.Evented=o.E,S.LngLat=o.Q,S.MercatorCoordinate=o.$,S.Point=o.P,S.addProtocol=o.cr,S.config=o.a,S.removeProtocol=o.cs,S.AttributionControl=qt,S.BoxZoomHandler=uc,S.CanvasSource=an,S.CooperativeGesturesHandler=rl,S.DoubleClickZoomHandler=il,S.DragPanHandler=oh,S.DragRotateHandler=lh,S.EdgeInsets=Ss,S.FullscreenControl=class extends o.E{constructor(u={}){super(),this._onFullscreenChange=()=>{var e;let i=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;!((e=i==null?void 0:i.shadowRoot)===null||e===void 0)&&e.fullscreenElement;)i=i.shadowRoot.fullscreenElement;i===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,u&&u.container&&(u.container instanceof HTMLElement?this._container=u.container:o.w("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(u){return this._map=u,this._container||(this._container=this._map.getContainer()),this._controlContainer=ce.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){ce.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const u=this._fullscreenButton=ce.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);ce.create("span","maplibregl-ctrl-icon",u).setAttribute("aria-hidden","true"),u.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const u=this._getTitle();this._fullscreenButton.setAttribute("aria-label",u),this._fullscreenButton.title=u}_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(),this._fullscreen?(this.fire(new o.l("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new o.l("fullscreenend")),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable())}_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()}},S.GeoJSONSource=sa,S.GeolocateControl=class extends o.E{constructor(u){super(),this._onSuccess=e=>{if(this._map){if(this._isOutOfMapMaxBounds(e))return this._setErrorState(),this.fire(new o.l("outofmaxbounds",e)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=e,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(e),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(e),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new o.l("geolocate",e)),this._finish()}},this._updateCamera=e=>{const i=new o.Q(e.coords.longitude,e.coords.latitude),s=e.coords.accuracy,l=this._map.getBearing(),h=o.e({bearing:l},this.options.fitBoundsOptions),f=jt.fromLngLat(i,s);this._map.fitBounds(f,h,{geolocateSource:!0})},this._updateMarker=e=>{if(e){const i=new o.Q(e.coords.longitude,e.coords.latitude);this._accuracyCircleMarker.setLngLat(i).addTo(this._map),this._userLocationDotMarker.setLngLat(i).addTo(this._map),this._accuracy=e.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onZoom=()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},this._onError=e=>{if(this._map){if(e.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 i=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=i,this._geolocateButton.setAttribute("aria-label",i),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(e.code===3&&os)return;this.options.trackUserLocation&&this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new o.l("error",e)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",e=>e.preventDefault()),this._geolocateButton=ce.create("button","maplibregl-ctrl-geolocate",this._container),ce.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",this._geolocateButton.disabled=!0)},this._finishSetupUI=e=>{if(this._map){if(e===!1){o.w("Geolocation support is not available so the GeolocateControl will be disabled.");const i=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=i,this._geolocateButton.setAttribute("aria-label",i)}else{const i=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=i,this._geolocateButton.setAttribute("aria-label",i)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=ce.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new ba({element:this._dotElement}),this._circleElement=ce.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new ba({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",()=>this.trigger()),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",i=>{i.geolocateSource||this._watchState!=="ACTIVE_LOCK"||i.originalEvent&&i.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 o.l("trackuserlocationend")),this.fire(new o.l("userlocationlostfocus")))})}},this.options=o.e({},ui,u)}onAdd(u){return this._map=u,this._container=ce.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),function(){return o._(this,arguments,void 0,function*(e=!1){if(Mi!==void 0&&!e)return Mi;if(window.navigator.permissions===void 0)return Mi=!!window.navigator.geolocation,Mi;try{Mi=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{Mi=!!window.navigator.geolocation}return Mi})}().then(e=>this._finishSetupUI(e)),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(),ce.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,ei=0,os=!1}_isOutOfMapMaxBounds(u){const e=this._map.getMaxBounds(),i=u.coords;return e&&(i.longitude<e.getWest()||i.longitude>e.getEast()||i.latitude<e.getSouth()||i.latitude>e.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}`)}}_updateCircleRadius(){const u=this._map.getBounds(),e=u.getSouthEast(),i=u.getNorthEast(),s=e.distanceTo(i),l=Math.ceil(this._accuracy/(s/this._map._container.clientHeight)*2);this._circleElement.style.width=`${l}px`,this._circleElement.style.height=`${l}px`}trigger(){if(!this._setup)return o.w("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new o.l("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":ei--,os=!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 o.l("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 o.l("trackuserlocationstart")),this.fire(new o.l("userlocationfocus"));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 u;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),ei++,ei>1?(u={maximumAge:6e5,timeout:0},os=!0):(u=this.options.positionOptions,os=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,u)}}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)}},S.GlobeControl=class{constructor(){this._toggleProjection=()=>{var u;const e=(u=this._map.getProjection())===null||u===void 0?void 0:u.type;this._map.setProjection(e!=="mercator"&&e?{type:"mercator"}:{type:"globe"}),this._updateGlobeIcon()},this._updateGlobeIcon=()=>{var u;this._globeButton.classList.remove("maplibregl-ctrl-globe"),this._globeButton.classList.remove("maplibregl-ctrl-globe-enabled"),((u=this._map.getProjection())===null||u===void 0?void 0:u.type)==="globe"?(this._globeButton.classList.add("maplibregl-ctrl-globe-enabled"),this._globeButton.title=this._map._getUIString("GlobeControl.Disable")):(this._globeButton.classList.add("maplibregl-ctrl-globe"),this._globeButton.title=this._map._getUIString("GlobeControl.Enable"))}}onAdd(u){return this._map=u,this._container=ce.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._globeButton=ce.create("button","maplibregl-ctrl-globe",this._container),ce.create("span","maplibregl-ctrl-icon",this._globeButton).setAttribute("aria-hidden","true"),this._globeButton.type="button",this._globeButton.addEventListener("click",this._toggleProjection),this._updateGlobeIcon(),this._map.on("styledata",this._updateGlobeIcon),this._container}onRemove(){ce.remove(this._container),this._map.off("styledata",this._updateGlobeIcon),this._globeButton.removeEventListener("click",this._toggleProjection),this._map=void 0}},S.Hash=sc,S.ImageSource=gr,S.KeyboardHandler=ss,S.LngLatBounds=jt,S.LogoControl=Ws,S.Map=class extends $d{constructor(u){var e,i;o.cn.mark(o.co.create);const s=Object.assign(Object.assign(Object.assign({},Xs),u),{canvasContextAttributes:Object.assign(Object.assign({},Xs.canvasContextAttributes),u.canvasContextAttributes)});if(s.minZoom!=null&&s.maxZoom!=null&&s.minZoom>s.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(s.minPitch!=null&&s.maxPitch!=null&&s.minPitch>s.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(s.minPitch!=null&&s.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(s.maxPitch!=null&&s.maxPitch>180)throw new Error("maxPitch must be less than or equal to 180");const l=new $a,h=new Ps;if(s.minZoom!==void 0&&l.setMinZoom(s.minZoom),s.maxZoom!==void 0&&l.setMaxZoom(s.maxZoom),s.minPitch!==void 0&&l.setMinPitch(s.minPitch),s.maxPitch!==void 0&&l.setMaxPitch(s.maxPitch),s.renderWorldCopies!==void 0&&l.setRenderWorldCopies(s.renderWorldCopies),super(l,h,{bearingSnap:s.bearingSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new gc,this._controls=[],this._mapId=o.a4(),this._contextLost=_=>{_.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new o.l("webglcontextlost",{originalEvent:_}))},this._contextRestored=_=>{this._setupPainter(),this.resize(),this._update(),this.fire(new o.l("webglcontextrestored",{originalEvent:_}))},this._onMapScroll=_=>{if(_.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=s.interactive,this._maxTileCacheSize=s.maxTileCacheSize,this._maxTileCacheZoomLevels=s.maxTileCacheZoomLevels,this._canvasContextAttributes=Object.assign({},s.canvasContextAttributes),this._trackResize=s.trackResize===!0,this._bearingSnap=s.bearingSnap,this._centerClampedToGround=s.centerClampedToGround,this._refreshExpiredTiles=s.refreshExpiredTiles===!0,this._fadeDuration=s.fadeDuration,this._crossSourceCollisions=s.crossSourceCollisions===!0,this._collectResourceTiming=s.collectResourceTiming===!0,this._locale=Object.assign(Object.assign({},Ke),s.locale),this._clickTolerance=s.clickTolerance,this._overridePixelRatio=s.pixelRatio,this._maxCanvasSize=s.maxCanvasSize,this.transformCameraUpdate=s.transformCameraUpdate,this.cancelPendingTileRequestsWhileZooming=s.cancelPendingTileRequestsWhileZooming===!0,this._imageQueueHandle=ai.addThrottleControl(()=>this.isMoving()),this._requestManager=new It(s.transformRequest),typeof s.container=="string"){if(this._container=document.getElementById(s.container),!this._container)throw new Error(`Container '${s.container}' not found.`)}else{if(!(s.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=s.container}if(s.maxBounds&&this.setMaxBounds(s.maxBounds),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)}),this.once("idle",()=>{this._idleTriggered=!0}),typeof window<"u"){addEventListener("online",this._onWindowOnline,!1);let _=!1;const x=$s(T=>{this._trackResize&&!this._removed&&(this.resize(T),this.redraw())},50);this._resizeObserver=new ResizeObserver(T=>{_?x(T):_=!0}),this._resizeObserver.observe(this._container)}this.handlers=new Ud(this,s),this._hash=s.hash&&new sc(typeof s.hash=="string"&&s.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:s.center,elevation:s.elevation,zoom:s.zoom,bearing:s.bearing,pitch:s.pitch,roll:s.roll}),s.bounds&&(this.resize(),this.fitBounds(s.bounds,o.e({},s.fitBoundsOptions,{duration:0}))));const f=typeof s.style=="string"||((i=(e=s.style)===null||e===void 0?void 0:e.projection)===null||i===void 0?void 0:i.type)!=="globe";this.resize(null,f),this._localIdeographFontFamily=s.localIdeographFontFamily,this._validateStyle=s.validateStyle,s.style&&this.setStyle(s.style,{localIdeographFontFamily:s.localIdeographFontFamily}),s.attributionControl&&this.addControl(new qt(typeof s.attributionControl=="boolean"?void 0:s.attributionControl)),s.maplibreLogo&&this.addControl(new Ws,s.logoPosition),this.on("style.load",()=>{if(f||this._resizeTransform(),this.transform.unmodified){const _=o.O(this.style.stylesheet,["center","zoom","bearing","pitch","roll"]);this.jumpTo(_)}}),this.on("data",_=>{this._update(_.dataType==="style"),this.fire(new o.l(`${_.dataType}data`,_))}),this.on("dataloading",_=>{this.fire(new o.l(`${_.dataType}dataloading`,_))}),this.on("dataabort",_=>{this.fire(new o.l("sourcedataabort",_))})}_getMapId(){return this._mapId}addControl(u,e){if(e===void 0&&(e=u.getDefaultPosition?u.getDefaultPosition():"top-right"),!u||!u.onAdd)return this.fire(new o.k(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const i=u.onAdd(this);this._controls.push(u);const s=this._controlPositions[e];return e.indexOf("bottom")!==-1?s.insertBefore(i,s.firstChild):s.appendChild(i),this}removeControl(u){if(!u||!u.onRemove)return this.fire(new o.k(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const e=this._controls.indexOf(u);return e>-1&&this._controls.splice(e,1),u.onRemove(this),this}hasControl(u){return this._controls.indexOf(u)>-1}calculateCameraOptionsFromTo(u,e,i,s){return s==null&&this.terrain&&(s=this.terrain.getElevationForLngLatZoom(i,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(u,e,i,s)}resize(u,e=!0){const[i,s]=this._containerDimensions(),l=this._getClampedPixelRatio(i,s);if(this._resizeCanvas(i,s,l),this.painter.resize(i,s,l),this.painter.overLimit()){const f=this.painter.context.gl;this._maxCanvasSize=[f.drawingBufferWidth,f.drawingBufferHeight];const _=this._getClampedPixelRatio(i,s);this._resizeCanvas(i,s,_),this.painter.resize(i,s,_)}this._resizeTransform(e);const h=!this._moving;return h&&(this.stop(),this.fire(new o.l("movestart",u)).fire(new o.l("move",u))),this.fire(new o.l("resize",u)),h&&this.fire(new o.l("moveend",u)),this}_resizeTransform(u=!0){var e;const[i,s]=this._containerDimensions();this.transform.resize(i,s,u),(e=this._requestedCameraState)===null||e===void 0||e.resize(i,s,u)}_getClampedPixelRatio(u,e){const{0:i,1:s}=this._maxCanvasSize,l=this.getPixelRatio(),h=u*l,f=e*l;return Math.min(h>i?i/h:1,f>s?s/f:1)*l}getPixelRatio(){var u;return(u=this._overridePixelRatio)!==null&&u!==void 0?u:devicePixelRatio}setPixelRatio(u){this._overridePixelRatio=u,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(u){return this.transform.setMaxBounds(jt.convert(u)),this._update()}setMinZoom(u){if((u=u??-2)>=-2&&u<=this.transform.maxZoom)return this.transform.setMinZoom(u),this._update(),this.getZoom()<u&&this.setZoom(u),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(u){if((u=u??22)>=this.transform.minZoom)return this.transform.setMaxZoom(u),this._update(),this.getZoom()>u&&this.setZoom(u),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(u){if((u=u??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(u>=0&&u<=this.transform.maxPitch)return this.transform.setMinPitch(u),this._update(),this.getPitch()<u&&this.setPitch(u),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(u){if((u=u??60)>180)throw new Error("maxPitch must be less than or equal to 180");if(u>=this.transform.minPitch)return this.transform.setMaxPitch(u),this._update(),this.getPitch()>u&&this.setPitch(u),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(u){return this.transform.setRenderWorldCopies(u),this._update()}project(u){return this.transform.locationToScreenPoint(o.Q.convert(u),this.style&&this.terrain)}unproject(u){return this.transform.screenPointToLocation(o.P.convert(u),this.terrain)}isMoving(){var u;return this._moving||((u=this.handlers)===null||u===void 0?void 0:u.isMoving())}isZooming(){var u;return this._zooming||((u=this.handlers)===null||u===void 0?void 0:u.isZooming())}isRotating(){var u;return this._rotating||((u=this.handlers)===null||u===void 0?void 0:u.isRotating())}_createDelegatedListener(u,e,i){if(u==="mouseenter"||u==="mouseover"){let s=!1;return{layers:e,listener:i,delegates:{mousemove:h=>{const f=e.filter(x=>this.getLayer(x)),_=f.length!==0?this.queryRenderedFeatures(h.point,{layers:f}):[];_.length?s||(s=!0,i.call(this,new ki(u,this,h.originalEvent,{features:_}))):s=!1},mouseout:()=>{s=!1}}}}if(u==="mouseleave"||u==="mouseout"){let s=!1;return{layers:e,listener:i,delegates:{mousemove:f=>{const _=e.filter(x=>this.getLayer(x));(_.length!==0?this.queryRenderedFeatures(f.point,{layers:_}):[]).length?s=!0:s&&(s=!1,i.call(this,new ki(u,this,f.originalEvent)))},mouseout:f=>{s&&(s=!1,i.call(this,new ki(u,this,f.originalEvent)))}}}}{const s=l=>{const h=e.filter(_=>this.getLayer(_)),f=h.length!==0?this.queryRenderedFeatures(l.point,{layers:h}):[];f.length&&(l.features=f,i.call(this,l),delete l.features)};return{layers:e,listener:i,delegates:{[u]:s}}}}_saveDelegatedListener(u,e){this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[u]=this._delegatedListeners[u]||[],this._delegatedListeners[u].push(e)}_removeDelegatedListener(u,e,i){if(!this._delegatedListeners||!this._delegatedListeners[u])return;const s=this._delegatedListeners[u];for(let l=0;l<s.length;l++){const h=s[l];if(h.listener===i&&h.layers.length===e.length&&h.layers.every(f=>e.includes(f))){for(const f in h.delegates)this.off(f,h.delegates[f]);return void s.splice(l,1)}}}on(u,e,i){if(i===void 0)return super.on(u,e);const s=typeof e=="string"?[e]:e,l=this._createDelegatedListener(u,s,i);this._saveDelegatedListener(u,l);for(const h in l.delegates)this.on(h,l.delegates[h]);return{unsubscribe:()=>{this._removeDelegatedListener(u,s,i)}}}once(u,e,i){if(i===void 0)return super.once(u,e);const s=typeof e=="string"?[e]:e,l=this._createDelegatedListener(u,s,i);for(const h in l.delegates){const f=l.delegates[h];l.delegates[h]=(..._)=>{this._removeDelegatedListener(u,s,i),f(..._)}}this._saveDelegatedListener(u,l);for(const h in l.delegates)this.once(h,l.delegates[h]);return this}off(u,e,i){return i===void 0?super.off(u,e):(this._removeDelegatedListener(u,typeof e=="string"?[e]:e,i),this)}queryRenderedFeatures(u,e){if(!this.style)return[];let i;const s=u instanceof o.P||Array.isArray(u),l=s?u:[[0,0],[this.transform.width,this.transform.height]];if(e=e||(s?{}:u)||{},l instanceof o.P||typeof l[0]=="number")i=[o.P.convert(l)];else{const h=o.P.convert(l[0]),f=o.P.convert(l[1]);i=[h,new o.P(f.x,h.y),f,new o.P(h.x,f.y),h]}return this.style.queryRenderedFeatures(i,e,this.transform)}querySourceFeatures(u,e){return this.style.querySourceFeatures(u,e)}setStyle(u,e){return(e=o.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},e)).diff!==!1&&e.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&u?(this._diffStyle(u,e),this):(this._localIdeographFontFamily=e.localIdeographFontFamily,this._updateStyle(u,e))}setTransformRequest(u){return this._requestManager.setTransformRequest(u),this}_getUIString(u){const e=this._locale[u];if(e==null)throw new Error(`Missing UI string '${u}'`);return e}_updateStyle(u,e){var i,s;if(e.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",()=>this._updateStyle(u,e));const l=this.style&&e.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!u)),u?(this.style=new Vl(this,e||{}),this.style.setEventedParent(this,{style:this.style}),typeof u=="string"?this.style.loadURL(u,e,l):this.style.loadJSON(u,e,l),this):((s=(i=this.style)===null||i===void 0?void 0:i.projection)===null||s===void 0||s.destroy(),delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new Vl(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(u,e){if(typeof u=="string"){const i=this._requestManager.transformRequest(u,"Style");o.j(i,new AbortController).then(s=>{this._updateDiff(s.data,e)}).catch(s=>{s&&this.fire(new o.k(s))})}else typeof u=="object"&&this._updateDiff(u,e)}_updateDiff(u,e){try{this.style.setState(u,e)&&this._update(!0)}catch(i){o.w(`Unable to perform style diff: ${i.message||i.error||i}. Rebuilding the style from scratch.`),this._updateStyle(u,e)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():o.w("There is no style added to the map.")}addSource(u,e){return this._lazyInitEmptyStyle(),this.style.addSource(u,e),this._update(!0)}isSourceLoaded(u){const e=this.style&&this.style.sourceCaches[u];if(e!==void 0)return e.loaded();this.fire(new o.k(new Error(`There is no source with ID '${u}'`)))}setTerrain(u){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),u){const e=this.style.sourceCaches[u.source];if(!e)throw new Error(`cannot load terrain, because there exists no source with ID: ${u.source}`);this.terrain===null&&e.reload();for(const i in this.style._layers){const s=this.style._layers[i];s.type==="hillshade"&&s.source===u.source&&o.w("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain=new hh(this.painter,e,u),this.painter.renderToTexture=new al(this.painter,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._terrainDataCallback=i=>{var s;i.dataType==="style"?this.terrain.sourceCache.freeRtt():i.dataType==="source"&&i.tile&&(i.sourceId!==u.source||this._elevationFreeze||(this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))),((s=i.source)===null||s===void 0?void 0:s.type)==="image"?this.terrain.sourceCache.freeRtt():this.terrain.sourceCache.freeRtt(i.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.setMinElevationForCurrentTile(0),this._centerClampedToGround&&this.transform.setElevation(0);return this.fire(new o.l("terrain",{terrain:u})),this}getTerrain(){var u,e;return(e=(u=this.terrain)===null||u===void 0?void 0:u.options)!==null&&e!==void 0?e:null}areTilesLoaded(){const u=this.style&&this.style.sourceCaches;for(const e in u){const i=u[e]._tiles;for(const s in i){const l=i[s];if(l.state!=="loaded"&&l.state!=="errored")return!1}}return!0}removeSource(u){return this.style.removeSource(u),this._update(!0)}getSource(u){return this.style.getSource(u)}setSourceTileLodParams(u,e,i){if(i){const s=this.getSource(i);if(!s)throw new Error(`There is no source with ID "${i}", cannot set LOD parameters`);s.calculateTileZoom=ae(Math.max(1,u),Math.max(1,e))}else for(const s in this.style.sourceCaches)this.style.sourceCaches[s].getSource().calculateTileZoom=ae(Math.max(1,u),Math.max(1,e));return this._update(!0),this}refreshTiles(u,e){const i=this.style.sourceCaches[u];if(!i)throw new Error(`There is no source cache with ID "${u}", cannot refresh tile`);e===void 0?i.reload():i.refreshTiles(e.map(s=>new o.a1(s.z,s.x,s.y)))}addImage(u,e,i={}){const{pixelRatio:s=1,sdf:l=!1,stretchX:h,stretchY:f,content:_,textFitWidth:x,textFitHeight:T}=i;if(this._lazyInitEmptyStyle(),!(e instanceof HTMLImageElement||o.b(e))){if(e.width===void 0||e.height===void 0)return this.fire(new o.k(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:P,height:E,data:A}=e,F=e;return this.style.addImage(u,{data:new o.R({width:P,height:E},new Uint8Array(A)),pixelRatio:s,stretchX:h,stretchY:f,content:_,textFitWidth:x,textFitHeight:T,sdf:l,version:0,userImage:F}),F.onAdd&&F.onAdd(this,u),this}}{const{width:P,height:E,data:A}=Ce.getImageData(e);this.style.addImage(u,{data:new o.R({width:P,height:E},A),pixelRatio:s,stretchX:h,stretchY:f,content:_,textFitWidth:x,textFitHeight:T,sdf:l,version:0})}}updateImage(u,e){const i=this.style.getImage(u);if(!i)return this.fire(new o.k(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const s=e instanceof HTMLImageElement||o.b(e)?Ce.getImageData(e):e,{width:l,height:h,data:f}=s;if(l===void 0||h===void 0)return this.fire(new o.k(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(l!==i.data.width||h!==i.data.height)return this.fire(new o.k(new Error("The width and height of the updated image must be that same as the previous version of the image")));const _=!(e instanceof HTMLImageElement||o.b(e));return i.data.replace(f,_),this.style.updateImage(u,i),this}getImage(u){return this.style.getImage(u)}hasImage(u){return u?!!this.style.getImage(u):(this.fire(new o.k(new Error("Missing required image id"))),!1)}removeImage(u){this.style.removeImage(u)}loadImage(u){return ai.getImage(this._requestManager.transformRequest(u,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(u,e){return this._lazyInitEmptyStyle(),this.style.addLayer(u,e),this._update(!0)}moveLayer(u,e){return this.style.moveLayer(u,e),this._update(!0)}removeLayer(u){return this.style.removeLayer(u),this._update(!0)}getLayer(u){return this.style.getLayer(u)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(u,e,i){return this.style.setLayerZoomRange(u,e,i),this._update(!0)}setFilter(u,e,i={}){return this.style.setFilter(u,e,i),this._update(!0)}getFilter(u){return this.style.getFilter(u)}setPaintProperty(u,e,i,s={}){return this.style.setPaintProperty(u,e,i,s),this._update(!0)}getPaintProperty(u,e){return this.style.getPaintProperty(u,e)}setLayoutProperty(u,e,i,s={}){return this.style.setLayoutProperty(u,e,i,s),this._update(!0)}getLayoutProperty(u,e){return this.style.getLayoutProperty(u,e)}setGlyphs(u,e={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(u,e),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(u,e,i={}){return this._lazyInitEmptyStyle(),this.style.addSprite(u,e,i,s=>{s||this._update(!0)}),this}removeSprite(u){return this._lazyInitEmptyStyle(),this.style.removeSprite(u),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(u,e={}){return this._lazyInitEmptyStyle(),this.style.setSprite(u,e,i=>{i||this._update(!0)}),this}setLight(u,e={}){return this._lazyInitEmptyStyle(),this.style.setLight(u,e),this._update(!0)}getLight(){return this.style.getLight()}setSky(u,e={}){return this._lazyInitEmptyStyle(),this.style.setSky(u,e),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(u,e){return this.style.setFeatureState(u,e),this._update()}removeFeatureState(u,e){return this.style.removeFeatureState(u,e),this._update()}getFeatureState(u){return this.style.getFeatureState(u)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let u=0,e=0;return this._container&&(u=this._container.clientWidth||400,e=this._container.clientHeight||300),[u,e]}_setupContainer(){const u=this._container;u.classList.add("maplibregl-map");const e=this._canvasContainer=ce.create("div","maplibregl-canvas-container",u);this._interactive&&e.classList.add("maplibregl-interactive"),this._canvas=ce.create("canvas","maplibregl-canvas",e),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex",this._interactive?"0":"-1"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region");const i=this._containerDimensions(),s=this._getClampedPixelRatio(i[0],i[1]);this._resizeCanvas(i[0],i[1],s);const l=this._controlContainer=ce.create("div","maplibregl-control-container",u),h=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(f=>{h[f]=ce.create("div",`maplibregl-ctrl-${f} `,l)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(u,e,i){this._canvas.width=Math.floor(i*u),this._canvas.height=Math.floor(i*e),this._canvas.style.width=`${u}px`,this._canvas.style.height=`${e}px`}_setupPainter(){const u=Object.assign(Object.assign({},this._canvasContextAttributes),{alpha:!0,depth:!0,stencil:!0,premultipliedAlpha:!0});let e=null;this._canvas.addEventListener("webglcontextcreationerror",s=>{e={requestedAttributes:u},s&&(e.statusMessage=s.statusMessage,e.type=s.type)},{once:!0});let i=null;if(i=this._canvasContextAttributes.contextType?this._canvas.getContext(this._canvasContextAttributes.contextType,u):this._canvas.getContext("webgl2",u)||this._canvas.getContext("webgl",u),!i){const s="Failed to initialize WebGL";throw e?(e.message=s,new Error(JSON.stringify(e))):new Error(s)}this.painter=new ac(i,this.transform),Ve.testSupport(i)}migrateProjection(u,e){super.migrateProjection(u,e),this.painter.transform=u,this.fire(new o.l("projectiontransition",{newProjection:this.style.projection.name}))}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(u){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||u,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(u){return this._update(),this._renderTaskQueue.add(u)}_cancelRenderFrame(u){this._renderTaskQueue.remove(u)}_render(u){var e,i,s,l,h;const f=this._idleTriggered?this._fadeDuration:0,_=((e=this.style.projection)===null||e===void 0?void 0:e.transitionState)>0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(u),this._removed)return;let x=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const E=this.transform.zoom,A=Ce.now();this.style.zoomHistory.update(E,A);const F=new o.C(E,{now:A,fadeDuration:f,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),O=F.crossFadingFactor();O===1&&O===this._crossFadingFactor||(x=!0,this._crossFadingFactor=O),this.style.update(F)}const T=((i=this.style.projection)===null||i===void 0?void 0:i.transitionState)>0!==_;(s=this.style.projection)===null||s===void 0||s.setErrorQueryLatitudeDegrees(this.transform.center.lat),this.transform.setTransitionState((l=this.style.projection)===null||l===void 0?void 0:l.transitionState,(h=this.style.projection)===null||h===void 0?void 0:h.latitudeErrorCorrectionRadians),this.style&&(this._sourcesDirty||T)&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),!this._elevationFreeze&&this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.setMinElevationForCurrentTile(0),this._centerClampedToGround&&this.transform.setElevation(0)),this._placementDirty=this.style&&this.style._updatePlacement(this.transform,this.showCollisionBoxes,f,this._crossSourceCollisions,T),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:f,showPadding:this.showPadding}),this.fire(new o.l("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,o.cn.mark(o.co.load),this.fire(new o.l("load"))),this.style&&(this.style.hasTransitions()||x)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const P=this._sourcesDirty||this._styleDirty||this._placementDirty;return P||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new o.l("idle")),!this._loaded||this._fullyLoaded||P||(this._fullyLoaded=!0,o.cn.mark(o.co.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var u;this._hash&&this._hash.remove();for(const i of this._controls)i.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&removeEventListener("online",this._onWindowOnline,!1),ai.removeThrottleControl(this._imageQueueHandle),(u=this._resizeObserver)===null||u===void 0||u.disconnect();const e=this.painter.context.gl.getExtension("WEBGL_lose_context");e!=null&&e.loseContext&&e.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),ce.remove(this._canvasContainer),ce.remove(this._controlContainer),this._container.removeEventListener("scroll",this._onMapScroll,!1),this._container.classList.remove("maplibregl-map"),o.cn.clearMetrics(),this._removed=!0,this.fire(new o.l("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,Ce.frame(this._frameRequest,u=>{o.cn.frame(u),this._frameRequest=null;try{this._render(u)}catch(e){if(!o.cp(e)&&!function(i){return i.message===Zo}(e))throw e}},()=>{}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(u){this._showTileBoundaries!==u&&(this._showTileBoundaries=u,this._update())}get showPadding(){return!!this._showPadding}set showPadding(u){this._showPadding!==u&&(this._showPadding=u,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(u){this._showCollisionBoxes!==u&&(this._showCollisionBoxes=u,u?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(u){this._showOverdrawInspector!==u&&(this._showOverdrawInspector=u,this._update())}get repaint(){return!!this._repaint}set repaint(u){this._repaint!==u&&(this._repaint=u,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(u){this._vertices=u,this._update()}get version(){return nt}getCameraTargetElevation(){return this.transform.elevation}getProjection(){return this.style.getProjection()}setProjection(u){return this._lazyInitEmptyStyle(),this.style.setProjection(u),this._update(!0)}},S.MapMouseEvent=ki,S.MapTouchEvent=es,S.MapWheelEvent=cc,S.Marker=ba,S.NavigationControl=class{constructor(u){this._updateZoomButtons=()=>{const e=this._map.getZoom(),i=e===this._map.getMaxZoom(),s=e===this._map.getMinZoom();this._zoomInButton.disabled=i,this._zoomOutButton.disabled=s,this._zoomInButton.setAttribute("aria-disabled",i.toString()),this._zoomOutButton.setAttribute("aria-disabled",s.toString())},this._rotateCompassArrow=()=>{this._compassIcon.style.transform=this.options.visualizePitch&&this.options.visualizeRoll?`scale(${1/Math.pow(Math.cos(this._map.transform.pitchInRadians),.5)}) rotateZ(${-this._map.transform.roll}deg) rotateX(${this._map.transform.pitch}deg) rotateZ(${-this._map.transform.bearing}deg)`:this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitchInRadians),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${-this._map.transform.bearing}deg)`:this.options.visualizeRoll?`rotate(${-this._map.transform.bearing-this._map.transform.roll}deg)`:`rotate(${-this._map.transform.bearing}deg)`},this._setButtonTitle=(e,i)=>{const s=this._map._getUIString(`NavigationControl.${i}`);e.title=s,e.setAttribute("aria-label",s)},this.options=o.e({},_c,u),this._container=ce.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",e=>e.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",e=>this._map.zoomIn({},{originalEvent:e})),ce.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",e=>this._map.zoomOut({},{originalEvent:e})),ce.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",e=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:e}):this._map.resetNorth({},{originalEvent:e})}),this._compassIcon=ce.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(u){return this._map=u,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.options.visualizeRoll&&this._map.on("roll",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new yc(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){ce.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.options.visualizeRoll&&this._map.off("roll",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(u,e){const i=ce.create("button",u,this._container);return i.type="button",i.addEventListener("click",e),i}},S.Popup=class extends o.E{constructor(u){super(),this._updateOpacity=()=>{this.options.locationOccludedOpacity!==void 0&&(this._container.style.opacity=this._map.transform.isLocationOccluded(this.getLngLat())?`${this.options.locationOccludedOpacity}`:void 0)},this.remove=()=>(this._content&&ce.remove(this._content),this._container&&(ce.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),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new o.l("close"))),this),this._onMouseUp=e=>{this._update(e.point)},this._onMouseMove=e=>{this._update(e.point)},this._onDrag=e=>{this._update(e.point)},this._update=e=>{if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=ce.create("div","maplibregl-popup",this._map.getContainer()),this._tip=ce.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const f of this.options.className.split(" "))this._container.classList.add(f);this._closeButton&&this._closeButton.setAttribute("aria-label",this._map._getUIString("Popup.Close")),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=xc(this._lngLat,this._flatPos,this._map.transform,this._trackPointer),this._trackPointer&&!e)return;const i=this._flatPos=this._pos=this._trackPointer&&e?e:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&e?e:this._map.transform.locationToScreenPoint(this._lngLat));let s=this.options.anchor;const l=ls(this.options.offset);if(!s){const f=this._container.offsetWidth,_=this._container.offsetHeight;let x;x=i.y+l.bottom.y<_?["top"]:i.y>this._map.transform.height-_?["bottom"]:[],i.x<f/2?x.push("left"):i.x>this._map.transform.width-f/2&&x.push("right"),s=x.length===0?"bottom":x.join("-")}let h=i.add(l[s]);this.options.subpixelPositioning||(h=h.round()),ce.setTransform(this._container,`${Xr[s]} translate(${h.x}px,${h.y}px)`),dh(this._container,s,"popup"),this._updateOpacity()},this._onClose=()=>{this.remove()},this.options=o.e(Object.create(vc),u)}addTo(u){return this._map&&this.remove(),this._map=u,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 o.l("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(u){return this._lngLat=o.Q.convert(u),this._pos=null,this._flatPos=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._flatPos=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(u){return this.setDOMContent(document.createTextNode(u))}setHTML(u){const e=document.createDocumentFragment(),i=document.createElement("body");let s;for(i.innerHTML=u;s=i.firstChild,s;)e.appendChild(s);return this.setDOMContent(e)}getMaxWidth(){var u;return(u=this._container)===null||u===void 0?void 0:u.style.maxWidth}setMaxWidth(u){return this.options.maxWidth=u,this._update(),this}setDOMContent(u){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=ce.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(u),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(u){return this._container&&this._container.classList.add(u),this}removeClassName(u){return this._container&&this._container.classList.remove(u),this}setOffset(u){return this.options.offset=u,this._update(),this}toggleClassName(u){if(this._container)return this._container.classList.toggle(u)}setSubpixelPositioning(u){this.options.subpixelPositioning=u}_createCloseButton(){this.options.closeButton&&(this._closeButton=ce.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const u=this._container.querySelector(bc);u&&u.focus()}},S.RasterDEMTileSource=aa,S.RasterTileSource=Cr,S.ScaleControl=class{constructor(u){this._onMove=()=>{Ys(this._map,this._container,this.options)},this.setUnit=e=>{this.options.unit=e,Ys(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},Ks),u)}getDefaultPosition(){return"bottom-left"}onAdd(u){return this._map=u,this._container=ce.create("div","maplibregl-ctrl maplibregl-ctrl-scale",u.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){ce.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},S.ScrollZoomHandler=yt,S.Style=Vl,S.TerrainControl=class{constructor(u){this._toggleTerrain=()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()},this._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.Disable")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.Enable"))},this.options=u}onAdd(u){return this._map=u,this._container=ce.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=ce.create("button","maplibregl-ctrl-terrain",this._container),ce.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(){ce.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},S.TwoFingersTouchPitchHandler=tl,S.TwoFingersTouchRotateHandler=$e,S.TwoFingersTouchZoomHandler=as,S.TwoFingersTouchZoomRotateHandler=mc,S.VectorTileSource=xn,S.VideoSource=Ir,S.addSourceType=(u,e)=>o._(void 0,void 0,void 0,function*(){if(qe(u))throw new Error(`A source type called "${u}" already exists.`);((i,s)=>{De[i]=s})(u,e)}),S.clearPrewarmedResources=function(){const u=Xi;u&&(u.isPreloaded()&&u.numActive()===1?(u.release(Mr),Xi=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()"))},S.createTileMesh=Cs,S.getMaxParallelImageRequests=function(){return o.a.MAX_PARALLEL_IMAGE_REQUESTS},S.getRTLTextPluginStatus=function(){return cr().getRTLTextPluginStatus()},S.getVersion=function(){return wc},S.getWorkerCount=function(){return Sr.workerCount},S.getWorkerUrl=function(){return o.a.WORKER_URL},S.importScriptInWorkers=function(u){return nn().broadcast("IS",u)},S.prewarm=function(){Pr().acquire(Mr)},S.setMaxParallelImageRequests=function(u){o.a.MAX_PARALLEL_IMAGE_REQUESTS=u},S.setRTLTextPlugin=function(u,e){return cr().setRTLTextPlugin(u,e)},S.setWorkerCount=function(u){Sr.workerCount=u},S.setWorkerUrl=function(u){o.a.WORKER_URL=u}});var B=w;return B})}(pu)),pu.exports}var ly=oy();const rd=ay(ly);class kf{constructor(g,w,I,R,B){Rt(this,"bounds1");Rt(this,"bounds2");Rt(this,"getBounds",(g,w,I,R)=>new rd.LngLatBounds([g,w],[I,R]));Rt(this,"contains",(g,w)=>this.bounds1.contains([w,g])||this.bounds2.contains([w,g]));const S=g.unproject([w,I]),o=g.unproject([R,B]);if(S.lng<-180){this.bounds1=this.getBounds(-180,S.lat,o.lng,o.lat),this.bounds2=this.getBounds(S.wrap().lng,S.lat,180,o.lat);return}if(o.lng>180){this.bounds1=this.getBounds(S.lng,S.lat,180,o.lat),this.bounds2=this.getBounds(-180,S.lat,o.wrap().lng,o.lat);return}this.bounds1=this.getBounds(S.lng,S.lat,o.lng,o.lat),this.bounds2=this.getBounds(0,0,0,0)}}const cy={version:8,sources:{openmaptiles:{type:"vector",url:"https://tiles.openfreemap.org/planet"}},glyphs:"https://tiles.openfreemap.org/fonts/{fontstack}/{range}.pbf",layers:[{id:"background",type:"background",paint:{"background-color":"rgba(120, 120, 120, 1)"}},{id:"park",type:"fill",source:"openmaptiles","source-layer":"park",filter:["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],paint:{"fill-color":"rgba(128, 128, 128, 1)"}},{id:"water",type:"fill",source:"openmaptiles","source-layer":"water",filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["!=",["get","brunnel"],"tunnel"]],paint:{"fill-antialias":!0,"fill-color":"rgba(56, 56, 56, 1)"}},{id:"landcover_ice_shelf",type:"fill",source:"openmaptiles","source-layer":"landcover",maxzoom:8,filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["==",["get","subclass"],"ice_shelf"]],paint:{"fill-color":"rgba(128, 128, 128, 1)","fill-opacity":.7}},{id:"landcover_glacier",type:"fill",source:"openmaptiles","source-layer":"landcover",maxzoom:8,filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["==",["get","subclass"],"glacier"]],paint:{"fill-color":"rgba(153, 153, 153, 1)","fill-opacity":["interpolate",["linear"],["zoom"],0,1,8,.5]}},{id:"landuse_residential",type:"fill",source:"openmaptiles","source-layer":"landuse",maxzoom:16,filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["==",["get","class"],"residential"]],paint:{"fill-color":"rgba(104, 104, 104, 1)","fill-opacity":["interpolate",["exponential",.6],["zoom"],8,.8,9,.6]}},{id:"landcover_wood",type:"fill",source:"openmaptiles","source-layer":"landcover",minzoom:10,filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["==",["get","class"],"wood"]],paint:{"fill-color":"rgba(128, 128, 128, 1)","fill-opacity":["interpolate",["linear"],["zoom"],8,0,12,1]}},{id:"waterway",type:"line",source:"openmaptiles","source-layer":"waterway",filter:["==",["geometry-type"],"LineString"],paint:{"line-color":"rgba(56, 56, 56, 1)"}},{id:"building",type:"fill",source:"openmaptiles","source-layer":"building",minzoom:12,paint:{"fill-antialias":!0,"fill-color":"rgba(136, 136, 136, 1)","fill-outline-color":"rgba(102, 102, 102, 1)"}},{id:"tunnel_motorway_casing",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","brunnel"],"tunnel"],["==",["get","class"],"motorway"]]],layout:{"line-cap":"butt","line-join":"miter"},paint:{"line-color":"rgba(68, 68, 68, 1)","line-opacity":1,"line-width":["interpolate",["exponential",1.4],["zoom"],5.8,0,6,3,20,40]}},{id:"tunnel_motorway_inner",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","brunnel"],"tunnel"],["==",["get","class"],"motorway"]]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(85, 85, 85, 1)","line-width":["interpolate",["exponential",1.4],["zoom"],4,2,6,1.3,20,30]}},{id:"aeroway-taxiway",type:"line",source:"openmaptiles","source-layer":"aeroway",minzoom:12,filter:["match",["get","class"],["taxiway"],!0,!1],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(85, 85, 85, 1)","line-opacity":1,"line-width":["interpolate",["exponential",1.55],["zoom"],13,1.8,20,20]}},{id:"aeroway-runway-casing",type:"line",source:"openmaptiles","source-layer":"aeroway",minzoom:11,filter:["match",["get","class"],["runway"],!0,!1],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(85, 85, 85, 1)","line-opacity":1,"line-width":["interpolate",["exponential",1.5],["zoom"],11,6,17,55]}},{id:"aeroway-area",type:"fill",source:"openmaptiles","source-layer":"aeroway",minzoom:4,filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["match",["get","class"],["runway","taxiway"],!0,!1]],paint:{"fill-color":"rgba(128, 128, 128, 1)","fill-opacity":["interpolate",["linear"],["zoom"],13,0,14,1]}},{id:"aeroway-runway",type:"line",source:"openmaptiles","source-layer":"aeroway",minzoom:11,filter:["all",["match",["get","class"],["runway"],!0,!1],["==",["geometry-type"],"LineString"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(68, 68, 68, 1)","line-opacity":1,"line-width":["interpolate",["exponential",1.5],["zoom"],11,4,17,50]}},{id:"road_area_pier",type:"fill",source:"openmaptiles","source-layer":"transportation",filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["==",["get","class"],"pier"]],paint:{"fill-antialias":!0,"fill-color":"rgba(50, 50, 50, 1)"}},{id:"road_pier",type:"line",source:"openmaptiles","source-layer":"transportation",filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["pier"],!0,!1]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(52, 52, 52, 1)","line-width":["interpolate",["exponential",1.2],["zoom"],15,1,17,4]}},{id:"highway_path",type:"line",source:"openmaptiles","source-layer":"transportation",filter:["all",["==",["geometry-type"],"LineString"],["==",["get","class"],"path"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(88, 88, 88, 1)","line-opacity":.9,"line-width":["interpolate",["exponential",1.2],["zoom"],13,1,20,10]}},{id:"highway_minor",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:8,filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["minor","service","track"],!0,!1]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-opacity":.9,"line-width":["interpolate",["exponential",1.55],["zoom"],13,1.8,20,20],"line-color":"rgba(102, 102, 102, 1)"}},{id:"highway_major_casing",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:11,filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["primary","secondary","tertiary","trunk"],!0,!1]],layout:{"line-cap":"butt","line-join":"miter"},paint:{"line-dasharray":[12,0],"line-width":["interpolate",["exponential",1.3],["zoom"],10,3,20,23],"line-color":"rgba(85, 85, 85, 1)"}},{id:"highway_major_inner",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:11,filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["primary","secondary","tertiary","trunk"],!0,!1]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(102, 102, 102, 1)","line-width":["interpolate",["exponential",1.3],["zoom"],10,2,20,20]}},{id:"highway_major_subtle",type:"line",source:"openmaptiles","source-layer":"transportation",maxzoom:11,filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["primary","secondary","tertiary","trunk"],!0,!1]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-width":2,"line-color":"rgba(85, 85, 85, 1)"}},{id:"highway_motorway_casing",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["match",["get","brunnel"],["bridge","tunnel"],!1,!0],["==",["get","class"],"motorway"]]],layout:{"line-cap":"butt","line-join":"miter"},paint:{"line-color":"rgba(68, 68, 68, 1)","line-dasharray":[2,0],"line-opacity":1,"line-width":["interpolate",["exponential",1.4],["zoom"],5.8,0,6,3,20,40]}},{id:"highway_motorway_inner",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["match",["get","brunnel"],["bridge","tunnel"],!1,!0],["==",["get","class"],"motorway"]]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":["interpolate",["linear"],["zoom"],5.8,"rgba(102, 102, 102, 1)",6,"rgba(85, 85, 85, 1)"],"line-width":["interpolate",["exponential",1.4],["zoom"],4,2,6,1.3,20,30]}},{id:"highway_motorway_subtle",type:"line",source:"openmaptiles","source-layer":"transportation",maxzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["==",["get","class"],"motorway"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(102, 102, 102, 1)","line-width":["interpolate",["exponential",1.4],["zoom"],4,2,6,1.3]}},{id:"railway_transit",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:16,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","class"],"transit"],["match",["get","brunnel"],["tunnel"],!1,!0]]],layout:{"line-join":"round"},paint:{"line-color":"rgba(85, 85, 85, 1)","line-width":3}},{id:"railway_transit_dashline",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:16,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","class"],"transit"],["match",["get","brunnel"],["tunnel"],!1,!0]]],layout:{"line-join":"round"},paint:{"line-color":"rgba(68, 68, 68, 1)","line-dasharray":[3,3],"line-width":2}},{id:"railway_service",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:16,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","class"],"rail"],["has","service"]]],layout:{"line-join":"round"},paint:{"line-color":"rgba(102, 102, 102, 1)","line-width":3}},{id:"railway_service_dashline",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:16,filter:["all",["==",["geometry-type"],"LineString"],["==",["get","class"],"rail"],["has","service"]],layout:{"line-join":"round"},paint:{"line-color":"rgba(85, 85, 85, 1)","line-dasharray":[3,3],"line-width":2}},{id:"railway",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:13,filter:["all",["==",["geometry-type"],"LineString"],["all",["!",["has","service"]],["==",["get","class"],"rail"]]],layout:{"line-join":"round"},paint:{"line-color":"rgba(85, 85, 85, 1)","line-width":["interpolate",["exponential",1.3],["zoom"],16,3,20,7]}},{id:"railway_dashline",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:13,filter:["all",["==",["geometry-type"],"LineString"],["all",["!",["has","service"]],["==",["get","class"],"rail"]]],layout:{"line-join":"round"},paint:{"line-color":"rgba(68, 68, 68, 1)","line-dasharray":[3,3],"line-width":["interpolate",["exponential",1.3],["zoom"],16,2,20,6]}},{id:"highway_motorway_bridge_casing",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","brunnel"],"bridge"],["==",["get","class"],"motorway"]]],layout:{"line-cap":"butt","line-join":"miter"},paint:{"line-color":"rgba(68, 68, 68, 1)","line-dasharray":[2,0],"line-opacity":1,"line-width":["interpolate",["exponential",1.4],["zoom"],5.8,0,6,5,20,45]}},{id:"highway_motorway_bridge_inner",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","brunnel"],"bridge"],["==",["get","class"],"motorway"]]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":["interpolate",["linear"],["zoom"],5.8,"rgba(102, 102, 102, 1)",6,"rgba(85, 85, 85, 1)"],"line-width":["interpolate",["exponential",1.4],["zoom"],4,2,6,1.3,20,30]}},{id:"boundary_3",type:"line",source:"openmaptiles","source-layer":"boundary",minzoom:8,filter:["all",[">=",["get","admin_level"],3],["<=",["get","admin_level"],6],["!=",["get","maritime"],1],["!=",["get","disputed"],1],["!",["has","claimed_by"]]],paint:{"line-color":"rgba(68, 68, 68, 1)","line-dasharray":[1,1],"line-width":["interpolate",["linear"],["zoom"],7,1,11,2]}},{id:"boundary_2",type:"line",source:"openmaptiles","source-layer":"boundary",filter:["all",["==",["get","admin_level"],2],["!=",["get","maritime"],1],["!=",["get","disputed"],1],["!",["has","claimed_by"]]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(51, 51, 51, 1)","line-opacity":["interpolate",["linear"],["zoom"],0,.4,4,1],"line-width":["interpolate",["linear"],["zoom"],3,1,5,1.2,12,3]}},{id:"boundary_disputed",type:"line",source:"openmaptiles","source-layer":"boundary",filter:["all",["!=",["get","maritime"],1],["==",["get","disputed"],1]],paint:{"line-color":"rgba(51, 51, 51, 1)","line-dasharray":[1,2],"line-width":["interpolate",["linear"],["zoom"],3,1,5,1.2,12,3]}},{id:"waterway_line_label",type:"symbol",source:"openmaptiles","source-layer":"waterway",minzoom:10,filter:["==",["geometry-type"],"LineString"],layout:{"symbol-placement":"line","symbol-spacing":350,"text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-letter-spacing":.2,"text-max-width":5,"text-size":14},paint:{"text-color":"rgba(34, 34, 34, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"water_name_point_label",type:"symbol",source:"openmaptiles","source-layer":"water_name",minzoom:0,filter:["==",["geometry-type"],"Point"],layout:{visibility:"none"}},{id:"water_name_line_label",type:"symbol",source:"openmaptiles","source-layer":"water_name",filter:["==",["geometry-type"],"LineString"],layout:{visibility:"none"}},{id:"highway-name-path",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:15.5,filter:["==",["get","class"],"path"],layout:{"symbol-placement":"line","text-field":["get","name:latin"],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"map","text-size":["interpolate",["linear"],["zoom"],13,12,14,13]},paint:{"text-color":"rgba(158, 158, 158, 1)","text-halo-color":"rgba(244, 244, 244, 1)","text-halo-width":.5}},{id:"highway-name-minor",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:15,filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["minor","service","track"],!0,!1]],layout:{"symbol-placement":"line","text-field":["get","name:latin"],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"map","text-size":["interpolate",["linear"],["zoom"],13,12,14,13]},paint:{"text-color":"rgba(17, 17, 17, 1)","text-halo-width":1,"text-halo-color":"rgba(255, 255, 255, 1)"}},{id:"highway-name-major",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:12.2,filter:["match",["get","class"],["primary","secondary","tertiary","trunk"],!0,!1],layout:{"symbol-placement":"line","text-field":["get","name:latin"],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"map","text-size":["interpolate",["linear"],["zoom"],13,12,14,13]},paint:{"text-color":"rgba(34, 34, 34, 1)","text-halo-width":1,"text-halo-color":"rgba(255, 255, 255, 1)"}},{id:"highway-shield-non-us",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:11,filter:["all",["<=",["get","ref_length"],6],["==",["geometry-type"],"LineString"],["match",["get","network"],["us-highway","us-interstate","us-state"],!1,!0]],layout:{"icon-rotation-alignment":"viewport","icon-size":1,"symbol-placement":["step",["zoom"],"point",11,"line"],"symbol-spacing":200,"text-field":["to-string",["get","ref"]],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"viewport","text-size":10},paint:{"text-halo-color":"rgba(255, 255, 255, 1)","text-color":"rgba(255, 255, 255, 1)"}},{id:"highway-shield-us-interstate",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:11,filter:["all",["<=",["get","ref_length"],6],["==",["geometry-type"],"LineString"],["match",["get","network"],["us-interstate"],!0,!1]],layout:{"icon-rotation-alignment":"viewport","icon-size":1,"symbol-placement":["step",["zoom"],"point",7,"line",8,"line"],"symbol-spacing":200,"text-field":["to-string",["get","ref"]],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"viewport","text-size":10}},{id:"road_shield_us",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:12,filter:["all",["<=",["get","ref_length"],6],["==",["geometry-type"],"LineString"],["match",["get","network"],["us-highway","us-state"],!0,!1]],layout:{"icon-rotation-alignment":"viewport","icon-size":1,"symbol-placement":["step",["zoom"],"point",11,"line"],"symbol-spacing":200,"text-field":["to-string",["get","ref"]],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"viewport","text-size":10}},{id:"airport",type:"symbol",source:"openmaptiles","source-layer":"aerodrome_label",minzoom:11,filter:["all",["has","iata"]],layout:{"icon-size":1,"text-anchor":"top","text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-max-width":9,"text-offset":[0,.6],"text-optional":!0,"text-padding":2,"text-size":12},paint:{"text-color":"rgba(51, 51, 51, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_other",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:8,filter:["match",["get","class"],["city","continent","country","state","town","village"],!1,!0],layout:{"text-field":["get","name:latin"],"text-font":["Noto Sans Regular"],"text-letter-spacing":.1,"text-max-width":9,"text-size":["interpolate",["linear"],["zoom"],8,9,12,10],"text-transform":"uppercase"},paint:{"text-color":"rgba(17, 17, 17, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_village",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:9,filter:["==",["get","class"],"village"],layout:{"icon-allow-overlap":!0,"icon-optional":!1,"icon-size":.2,"text-anchor":"bottom","text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-max-width":8,"text-size":["interpolate",["exponential",1.2],["zoom"],7,10,11,12]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_town",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:6,filter:["==",["get","class"],"town"],layout:{"icon-allow-overlap":!0,"icon-optional":!1,"icon-size":.2,"text-anchor":"bottom","text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-max-width":8,"text-size":["interpolate",["exponential",1.2],["zoom"],7,12,11,14]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_state",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:5,maxzoom:8,filter:["==",["get","class"],"state"],layout:{"text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-letter-spacing":.2,"text-max-width":9,"text-size":["interpolate",["linear"],["zoom"],5,10,8,14],"text-transform":"uppercase"},paint:{"text-color":"rgba(17, 17, 17, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_city",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:3,filter:["all",["==",["get","class"],"city"],["!=",["get","capital"],2]],layout:{"icon-allow-overlap":!0,"icon-optional":!1,"icon-size":.4,"text-anchor":"bottom","text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-max-width":8,"text-offset":[0,-.1],"text-size":["interpolate",["exponential",1.2],["zoom"],4,11,7,13,11,18]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_city_capital",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:3,filter:["all",["==",["get","class"],"city"],["==",["get","capital"],2]],layout:{"icon-allow-overlap":!0,"icon-optional":!1,"icon-size":.5,"text-anchor":"bottom","text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Bold"],"text-max-width":8,"text-offset":[0,-.2],"text-size":["interpolate",["exponential",1.2],["zoom"],4,12,7,14,11,20]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_country_3",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:2,maxzoom:9,filter:["all",["==",["get","class"],"country"],[">=",["get","rank"],3]],layout:{"text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Bold"],"text-max-width":6.25,"text-size":["interpolate",["linear"],["zoom"],3,9,7,17]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_country_2",type:"symbol",source:"openmaptiles","source-layer":"place",maxzoom:9,filter:["all",["==",["get","class"],"country"],["==",["get","rank"],2]],layout:{"text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Bold"],"text-max-width":6.25,"text-size":["interpolate",["linear"],["zoom"],2,9,5,17]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_country_1",type:"symbol",source:"openmaptiles","source-layer":"place",maxzoom:9,filter:["all",["==",["get","class"],"country"],["==",["get","rank"],1]],layout:{"text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Bold"],"text-max-width":6.25,"text-size":["interpolate",["linear"],["zoom"],1,9,4,17]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}}]},uy={version:8,sources:{openmaptiles:{type:"vector",url:"https://tiles.openfreemap.org/planet"}},glyphs:"https://tiles.openfreemap.org/fonts/{fontstack}/{range}.pbf",layers:[{id:"background",type:"background",paint:{"background-color":"rgba(220, 220, 220, 1)"}},{id:"park",type:"fill",source:"openmaptiles","source-layer":"park",filter:["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],paint:{"fill-color":"rgba(228, 228, 228, 1)"}},{id:"water",type:"fill",source:"openmaptiles","source-layer":"water",filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["!=",["get","brunnel"],"tunnel"]],paint:{"fill-antialias":!0,"fill-color":"rgba(156, 156, 156, 1)"}},{id:"landcover_ice_shelf",type:"fill",source:"openmaptiles","source-layer":"landcover",maxzoom:8,filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["==",["get","subclass"],"ice_shelf"]],paint:{"fill-color":"rgba(228, 228, 228, 1)","fill-opacity":.7}},{id:"landcover_glacier",type:"fill",source:"openmaptiles","source-layer":"landcover",maxzoom:8,filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["==",["get","subclass"],"glacier"]],paint:{"fill-color":"rgba(253, 253, 253, 1)","fill-opacity":["interpolate",["linear"],["zoom"],0,1,8,.5]}},{id:"landuse_residential",type:"fill",source:"openmaptiles","source-layer":"landuse",maxzoom:16,filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["==",["get","class"],"residential"]],paint:{"fill-color":"rgba(204, 204, 204, 1)","fill-opacity":["interpolate",["exponential",.6],["zoom"],8,.8,9,.6]}},{id:"landcover_wood",type:"fill",source:"openmaptiles","source-layer":"landcover",minzoom:10,filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["==",["get","class"],"wood"]],paint:{"fill-color":"rgba(228, 228, 228, 1)","fill-opacity":["interpolate",["linear"],["zoom"],8,0,12,1]}},{id:"waterway",type:"line",source:"openmaptiles","source-layer":"waterway",filter:["==",["geometry-type"],"LineString"],paint:{"line-color":"rgba(156, 156, 156, 1)"}},{id:"building",type:"fill",source:"openmaptiles","source-layer":"building",minzoom:12,paint:{"fill-antialias":!0,"fill-color":"rgba(236, 236, 236, 1)","fill-outline-color":"rgba(202, 202, 202, 1)"}},{id:"tunnel_motorway_casing",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","brunnel"],"tunnel"],["==",["get","class"],"motorway"]]],layout:{"line-cap":"butt","line-join":"miter"},paint:{"line-color":"rgb(168, 168, 168)","line-opacity":1,"line-width":["interpolate",["exponential",1.4],["zoom"],5.8,0,6,3,20,40]}},{id:"tunnel_motorway_inner",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","brunnel"],"tunnel"],["==",["get","class"],"motorway"]]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgb(185, 185, 185)","line-width":["interpolate",["exponential",1.4],["zoom"],4,2,6,1.3,20,30]}},{id:"aeroway-taxiway",type:"line",source:"openmaptiles","source-layer":"aeroway",minzoom:12,filter:["match",["get","class"],["taxiway"],!0,!1],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(185, 185, 185, 1)","line-opacity":1,"line-width":["interpolate",["exponential",1.55],["zoom"],13,1.8,20,20]}},{id:"aeroway-runway-casing",type:"line",source:"openmaptiles","source-layer":"aeroway",minzoom:11,filter:["match",["get","class"],["runway"],!0,!1],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(185, 185, 185, 1)","line-opacity":1,"line-width":["interpolate",["exponential",1.5],["zoom"],11,6,17,55]}},{id:"aeroway-area",type:"fill",source:"openmaptiles","source-layer":"aeroway",minzoom:4,filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["match",["get","class"],["runway","taxiway"],!0,!1]],paint:{"fill-color":"rgba(228, 228, 228, 1)","fill-opacity":["interpolate",["linear"],["zoom"],13,0,14,1]}},{id:"aeroway-runway",type:"line",source:"openmaptiles","source-layer":"aeroway",minzoom:11,filter:["all",["match",["get","class"],["runway"],!0,!1],["==",["geometry-type"],"LineString"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(168, 168, 168, 1)","line-opacity":1,"line-width":["interpolate",["exponential",1.5],["zoom"],11,4,17,50]}},{id:"road_area_pier",type:"fill",source:"openmaptiles","source-layer":"transportation",filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["==",["get","class"],"pier"]],paint:{"fill-antialias":!0,"fill-color":"rgba(150, 150, 150, 1)"}},{id:"road_pier",type:"line",source:"openmaptiles","source-layer":"transportation",filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["pier"],!0,!1]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(152, 152, 152, 1)","line-width":["interpolate",["exponential",1.2],["zoom"],15,1,17,4]}},{id:"highway_path",type:"line",source:"openmaptiles","source-layer":"transportation",filter:["all",["==",["geometry-type"],"LineString"],["==",["get","class"],"path"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgb(188, 188, 188)","line-opacity":.9,"line-width":["interpolate",["exponential",1.2],["zoom"],13,1,20,10]}},{id:"highway_minor",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:8,filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["minor","service","track"],!0,!1]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(202, 202, 202, 1)","line-opacity":.9,"line-width":["interpolate",["exponential",1.55],["zoom"],13,1.8,20,20]}},{id:"highway_major_casing",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:11,filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["primary","secondary","tertiary","trunk"],!0,!1]],layout:{"line-cap":"butt","line-join":"miter"},paint:{"line-color":"rgb(185, 185, 185)","line-dasharray":[12,0],"line-width":["interpolate",["exponential",1.3],["zoom"],10,3,20,23]}},{id:"highway_major_inner",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:11,filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["primary","secondary","tertiary","trunk"],!0,!1]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(202, 202, 202, 1)","line-width":["interpolate",["exponential",1.3],["zoom"],10,2,20,20]}},{id:"highway_major_subtle",type:"line",source:"openmaptiles","source-layer":"transportation",maxzoom:11,filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["primary","secondary","tertiary","trunk"],!0,!1]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(185, 185, 185, 1)","line-width":2}},{id:"highway_motorway_casing",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["match",["get","brunnel"],["bridge","tunnel"],!1,!0],["==",["get","class"],"motorway"]]],layout:{"line-cap":"butt","line-join":"miter"},paint:{"line-color":"rgb(168, 168, 168)","line-dasharray":[2,0],"line-opacity":1,"line-width":["interpolate",["exponential",1.4],["zoom"],5.8,0,6,3,20,40]}},{id:"highway_motorway_inner",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["match",["get","brunnel"],["bridge","tunnel"],!1,!0],["==",["get","class"],"motorway"]]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":["interpolate",["linear"],["zoom"],5.8,"rgba(202, 202, 202, 1)",6,"rgba(185, 185, 185, 1)"],"line-width":["interpolate",["exponential",1.4],["zoom"],4,2,6,1.3,20,30]}},{id:"highway_motorway_subtle",type:"line",source:"openmaptiles","source-layer":"transportation",maxzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["==",["get","class"],"motorway"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(202, 202, 202, 1)","line-width":["interpolate",["exponential",1.4],["zoom"],4,2,6,1.3]}},{id:"railway_transit",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:16,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","class"],"transit"],["match",["get","brunnel"],["tunnel"],!1,!0]]],layout:{"line-join":"round"},paint:{"line-color":"rgba(185, 185, 185, 1)","line-width":3}},{id:"railway_transit_dashline",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:16,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","class"],"transit"],["match",["get","brunnel"],["tunnel"],!1,!0]]],layout:{"line-join":"round"},paint:{"line-color":"rgba(168, 168, 168, 1)","line-dasharray":[3,3],"line-width":2}},{id:"railway_service",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:16,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","class"],"rail"],["has","service"]]],layout:{"line-join":"round"},paint:{"line-color":"rgba(202, 202, 202, 1)","line-width":3}},{id:"railway_service_dashline",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:16,filter:["all",["==",["geometry-type"],"LineString"],["==",["get","class"],"rail"],["has","service"]],layout:{"line-join":"round"},paint:{"line-color":"rgba(185, 185, 185, 1)","line-dasharray":[3,3],"line-width":2}},{id:"railway",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:13,filter:["all",["==",["geometry-type"],"LineString"],["all",["!",["has","service"]],["==",["get","class"],"rail"]]],layout:{"line-join":"round"},paint:{"line-color":"rgba(185, 185, 185, 1)","line-width":["interpolate",["exponential",1.3],["zoom"],16,3,20,7]}},{id:"railway_dashline",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:13,filter:["all",["==",["geometry-type"],"LineString"],["all",["!",["has","service"]],["==",["get","class"],"rail"]]],layout:{"line-join":"round"},paint:{"line-color":"rgba(168, 168, 168, 1)","line-dasharray":[3,3],"line-width":["interpolate",["exponential",1.3],["zoom"],16,2,20,6]}},{id:"highway_motorway_bridge_casing",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","brunnel"],"bridge"],["==",["get","class"],"motorway"]]],layout:{"line-cap":"butt","line-join":"miter"},paint:{"line-color":"rgb(168, 168, 168)","line-dasharray":[2,0],"line-opacity":1,"line-width":["interpolate",["exponential",1.4],["zoom"],5.8,0,6,5,20,45]}},{id:"highway_motorway_bridge_inner",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","brunnel"],"bridge"],["==",["get","class"],"motorway"]]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":["interpolate",["linear"],["zoom"],5.8,"rgba(202, 202, 202, 1)",6,"rgba(185, 185, 185, 1)"],"line-width":["interpolate",["exponential",1.4],["zoom"],4,2,6,1.3,20,30]}},{id:"boundary_3",type:"line",source:"openmaptiles","source-layer":"boundary",minzoom:8,filter:["all",[">=",["get","admin_level"],3],["<=",["get","admin_level"],6],["!=",["get","maritime"],1],["!=",["get","disputed"],1],["!",["has","claimed_by"]]],paint:{"line-color":"rgba(168, 168, 168, 1)","line-dasharray":[1,1],"line-width":["interpolate",["linear"],["zoom"],7,1,11,2]}},{id:"boundary_2",type:"line",source:"openmaptiles","source-layer":"boundary",filter:["all",["==",["get","admin_level"],2],["!=",["get","maritime"],1],["!=",["get","disputed"],1],["!",["has","claimed_by"]]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(151, 151, 151, 1)","line-opacity":["interpolate",["linear"],["zoom"],0,.4,4,1],"line-width":["interpolate",["linear"],["zoom"],3,1,5,1.2,12,3]}},{id:"boundary_disputed",type:"line",source:"openmaptiles","source-layer":"boundary",filter:["all",["!=",["get","maritime"],1],["==",["get","disputed"],1]],paint:{"line-color":"rgba(151, 151, 151, 1)","line-dasharray":[1,2],"line-width":["interpolate",["linear"],["zoom"],3,1,5,1.2,12,3]}},{id:"waterway_line_label",type:"symbol",source:"openmaptiles","source-layer":"waterway",minzoom:10,filter:["==",["geometry-type"],"LineString"],layout:{"symbol-placement":"line","symbol-spacing":350,"text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-letter-spacing":.2,"text-max-width":5,"text-size":14},paint:{"text-color":"rgba(34, 34, 34, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1.5}},{id:"water_name_point_label",type:"symbol",source:"openmaptiles","source-layer":"water_name",minzoom:0,filter:["==",["geometry-type"],"Point"],layout:{visibility:"none"}},{id:"water_name_line_label",type:"symbol",source:"openmaptiles","source-layer":"water_name",filter:["==",["geometry-type"],"LineString"],layout:{visibility:"none"}},{id:"highway-name-path",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:15.5,filter:["==",["get","class"],"path"],layout:{"symbol-placement":"line","text-field":["get","name:latin"],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"map","text-size":["interpolate",["linear"],["zoom"],13,12,14,13]},paint:{"text-color":"rgba(158, 158, 158, 1)","text-halo-color":"rgba(244, 244, 244, 1)","text-halo-width":.5}},{id:"highway-name-minor",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:15,filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["minor","service","track"],!0,!1]],layout:{"symbol-placement":"line","text-field":["get","name:latin"],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"map","text-size":["interpolate",["linear"],["zoom"],13,12,14,13]},paint:{"text-color":"rgba(17, 17, 17, 1)","text-halo-width":1,"text-halo-color":"rgba(255, 255, 255, 1)"}},{id:"highway-name-major",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:12.2,filter:["match",["get","class"],["primary","secondary","tertiary","trunk"],!0,!1],layout:{"symbol-placement":"line","text-field":["get","name:latin"],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"map","text-size":["interpolate",["linear"],["zoom"],13,12,14,13]},paint:{"text-color":"rgba(34, 34, 34, 1)","text-halo-width":1,"text-halo-color":"rgba(255, 255, 255, 1)"}},{id:"highway-shield-non-us",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:11,filter:["all",["<=",["get","ref_length"],6],["==",["geometry-type"],"LineString"],["match",["get","network"],["us-highway","us-interstate","us-state"],!1,!0]],layout:{"icon-rotation-alignment":"viewport","icon-size":1,"symbol-placement":["step",["zoom"],"point",11,"line"],"symbol-spacing":200,"text-field":["to-string",["get","ref"]],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"viewport","text-size":10},paint:{"text-halo-color":"rgba(0, 0, 0, 1)","text-color":"rgba(0, 0, 0, 1)"}},{id:"highway-shield-us-interstate",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:11,filter:["all",["<=",["get","ref_length"],6],["==",["geometry-type"],"LineString"],["match",["get","network"],["us-interstate"],!0,!1]],layout:{"icon-rotation-alignment":"viewport","icon-size":1,"symbol-placement":["step",["zoom"],"point",7,"line",8,"line"],"symbol-spacing":200,"text-field":["to-string",["get","ref"]],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"viewport","text-size":10}},{id:"road_shield_us",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:12,filter:["all",["<=",["get","ref_length"],6],["==",["geometry-type"],"LineString"],["match",["get","network"],["us-highway","us-state"],!0,!1]],layout:{"icon-rotation-alignment":"viewport","icon-size":1,"symbol-placement":["step",["zoom"],"point",11,"line"],"symbol-spacing":200,"text-field":["to-string",["get","ref"]],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"viewport","text-size":10}},{id:"airport",type:"symbol",source:"openmaptiles","source-layer":"aerodrome_label",minzoom:11,filter:["all",["has","iata"]],layout:{"icon-size":1,"text-anchor":"top","text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-max-width":9,"text-offset":[0,.6],"text-optional":!0,"text-padding":2,"text-size":12},paint:{"text-color":"rgba(51, 51, 51, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_other",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:8,filter:["match",["get","class"],["city","continent","country","state","town","village"],!1,!0],layout:{"text-field":["get","name:latin"],"text-font":["Noto Sans Regular"],"text-letter-spacing":.1,"text-max-width":9,"text-size":["interpolate",["linear"],["zoom"],8,9,12,10],"text-transform":"uppercase"},paint:{"text-color":"rgba(17, 17, 17, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_village",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:9,filter:["==",["get","class"],"village"],layout:{"icon-allow-overlap":!0,"icon-optional":!1,"icon-size":.2,"text-anchor":"bottom","text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-max-width":8,"text-size":["interpolate",["exponential",1.2],["zoom"],7,10,11,12]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_town",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:6,filter:["==",["get","class"],"town"],layout:{"icon-allow-overlap":!0,"icon-optional":!1,"icon-size":.2,"text-anchor":"bottom","text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-max-width":8,"text-size":["interpolate",["exponential",1.2],["zoom"],7,12,11,14]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_state",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:5,maxzoom:8,filter:["==",["get","class"],"state"],layout:{"text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-letter-spacing":.2,"text-max-width":9,"text-size":["interpolate",["linear"],["zoom"],5,10,8,14],"text-transform":"uppercase"},paint:{"text-color":"rgba(17, 17, 17, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_city",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:3,filter:["all",["==",["get","class"],"city"],["!=",["get","capital"],2]],layout:{"icon-allow-overlap":!0,"icon-optional":!1,"icon-size":.4,"text-anchor":"bottom","text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-max-width":8,"text-offset":[0,-.1],"text-size":["interpolate",["exponential",1.2],["zoom"],4,11,7,13,11,18]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_city_capital",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:3,filter:["all",["==",["get","class"],"city"],["==",["get","capital"],2]],layout:{"icon-allow-overlap":!0,"icon-optional":!1,"icon-size":.5,"text-anchor":"bottom","text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Bold"],"text-max-width":8,"text-offset":[0,-.2],"text-size":["interpolate",["exponential",1.2],["zoom"],4,12,7,14,11,20]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_country_3",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:2,maxzoom:9,filter:["all",["==",["get","class"],"country"],[">=",["get","rank"],3]],layout:{"text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Bold"],"text-max-width":6.25,"text-size":["interpolate",["linear"],["zoom"],3,9,7,17]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_country_2",type:"symbol",source:"openmaptiles","source-layer":"place",maxzoom:9,filter:["all",["==",["get","class"],"country"],["==",["get","rank"],2]],layout:{"text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Bold"],"text-max-width":6.25,"text-size":["interpolate",["linear"],["zoom"],2,9,5,17]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_country_1",type:"symbol",source:"openmaptiles","source-layer":"place",maxzoom:9,filter:["all",["==",["get","class"],"country"],["==",["get","rank"],1]],layout:{"text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Bold"],"text-max-width":6.25,"text-size":["interpolate",["linear"],["zoom"],1,9,4,17]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}}]};var Ot;(function(b){b.assertEqual=R=>{};function g(R){}b.assertIs=g;function w(R){throw new Error}b.assertNever=w,b.arrayToEnum=R=>{const B={};for(const S of R)B[S]=S;return B},b.getValidEnumValues=R=>{const B=b.objectKeys(R).filter(o=>typeof R[R[o]]!="number"),S={};for(const o of B)S[o]=R[o];return b.objectValues(S)},b.objectValues=R=>b.objectKeys(R).map(function(B){return R[B]}),b.objectKeys=typeof Object.keys=="function"?R=>Object.keys(R):R=>{const B=[];for(const S in R)Object.prototype.hasOwnProperty.call(R,S)&&B.push(S);return B},b.find=(R,B)=>{for(const S of R)if(B(S))return S},b.isInteger=typeof Number.isInteger=="function"?R=>Number.isInteger(R):R=>typeof R=="number"&&Number.isFinite(R)&&Math.floor(R)===R;function I(R,B=" | "){return R.map(S=>typeof S=="string"?`'${S}'`:S).join(B)}b.joinValues=I,b.jsonStringifyReplacer=(R,B)=>typeof B=="bigint"?B.toString():B})(Ot||(Ot={}));var zf;(function(b){b.mergeShapes=(g,w)=>({...g,...w})})(zf||(zf={}));const Ye=Ot.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),za=b=>{switch(typeof b){case"undefined":return Ye.undefined;case"string":return Ye.string;case"number":return Number.isNaN(b)?Ye.nan:Ye.number;case"boolean":return Ye.boolean;case"function":return Ye.function;case"bigint":return Ye.bigint;case"symbol":return Ye.symbol;case"object":return Array.isArray(b)?Ye.array:b===null?Ye.null:b.then&&typeof b.then=="function"&&b.catch&&typeof b.catch=="function"?Ye.promise:typeof Map<"u"&&b instanceof Map?Ye.map:typeof Set<"u"&&b instanceof Set?Ye.set:typeof Date<"u"&&b instanceof Date?Ye.date:Ye.object;default:return Ye.unknown}},Ne=Ot.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class _n extends Error{get errors(){return this.issues}constructor(g){super(),this.issues=[],this.addIssue=I=>{this.issues=[...this.issues,I]},this.addIssues=(I=[])=>{this.issues=[...this.issues,...I]};const w=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,w):this.__proto__=w,this.name="ZodError",this.issues=g}format(g){const w=g||function(B){return B.message},I={_errors:[]},R=B=>{for(const S of B.issues)if(S.code==="invalid_union")S.unionErrors.map(R);else if(S.code==="invalid_return_type")R(S.returnTypeError);else if(S.code==="invalid_arguments")R(S.argumentsError);else if(S.path.length===0)I._errors.push(w(S));else{let o=I,de=0;for(;de<S.path.length;){const ge=S.path[de];de===S.path.length-1?(o[ge]=o[ge]||{_errors:[]},o[ge]._errors.push(w(S))):o[ge]=o[ge]||{_errors:[]},o=o[ge],de++}}};return R(this),I}static assert(g){if(!(g instanceof _n))throw new Error(`Not a ZodError: ${g}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Ot.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(g=w=>w.message){const w={},I=[];for(const R of this.issues)R.path.length>0?(w[R.path[0]]=w[R.path[0]]||[],w[R.path[0]].push(g(R))):I.push(g(R));return{formErrors:I,fieldErrors:w}}get formErrors(){return this.flatten()}}_n.create=b=>new _n(b);const Ml=(b,g)=>{let w;switch(b.code){case Ne.invalid_type:b.received===Ye.undefined?w="Required":w=`Expected ${b.expected}, received ${b.received}`;break;case Ne.invalid_literal:w=`Invalid literal value, expected ${JSON.stringify(b.expected,Ot.jsonStringifyReplacer)}`;break;case Ne.unrecognized_keys:w=`Unrecognized key(s) in object: ${Ot.joinValues(b.keys,", ")}`;break;case Ne.invalid_union:w="Invalid input";break;case Ne.invalid_union_discriminator:w=`Invalid discriminator value. Expected ${Ot.joinValues(b.options)}`;break;case Ne.invalid_enum_value:w=`Invalid enum value. Expected ${Ot.joinValues(b.options)}, received '${b.received}'`;break;case Ne.invalid_arguments:w="Invalid function arguments";break;case Ne.invalid_return_type:w="Invalid function return type";break;case Ne.invalid_date:w="Invalid date";break;case Ne.invalid_string:typeof b.validation=="object"?"includes"in b.validation?(w=`Invalid input: must include "${b.validation.includes}"`,typeof b.validation.position=="number"&&(w=`${w} at one or more positions greater than or equal to ${b.validation.position}`)):"startsWith"in b.validation?w=`Invalid input: must start with "${b.validation.startsWith}"`:"endsWith"in b.validation?w=`Invalid input: must end with "${b.validation.endsWith}"`:Ot.assertNever(b.validation):b.validation!=="regex"?w=`Invalid ${b.validation}`:w="Invalid";break;case Ne.too_small:b.type==="array"?w=`Array must contain ${b.exact?"exactly":b.inclusive?"at least":"more than"} ${b.minimum} element(s)`:b.type==="string"?w=`String must contain ${b.exact?"exactly":b.inclusive?"at least":"over"} ${b.minimum} character(s)`:b.type==="number"?w=`Number must be ${b.exact?"exactly equal to ":b.inclusive?"greater than or equal to ":"greater than "}${b.minimum}`:b.type==="date"?w=`Date must be ${b.exact?"exactly equal to ":b.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(b.minimum))}`:w="Invalid input";break;case Ne.too_big:b.type==="array"?w=`Array must contain ${b.exact?"exactly":b.inclusive?"at most":"less than"} ${b.maximum} element(s)`:b.type==="string"?w=`String must contain ${b.exact?"exactly":b.inclusive?"at most":"under"} ${b.maximum} character(s)`:b.type==="number"?w=`Number must be ${b.exact?"exactly":b.inclusive?"less than or equal to":"less than"} ${b.maximum}`:b.type==="bigint"?w=`BigInt must be ${b.exact?"exactly":b.inclusive?"less than or equal to":"less than"} ${b.maximum}`:b.type==="date"?w=`Date must be ${b.exact?"exactly":b.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(b.maximum))}`:w="Invalid input";break;case Ne.custom:w="Invalid input";break;case Ne.invalid_intersection_types:w="Intersection results could not be merged";break;case Ne.not_multiple_of:w=`Number must be a multiple of ${b.multipleOf}`;break;case Ne.not_finite:w="Number must be finite";break;default:w=g.defaultError,Ot.assertNever(b)}return{message:w}};let hy=Ml;function nd(){return hy}const ad=b=>{const{data:g,path:w,errorMaps:I,issueData:R}=b,B=[...w,...R.path||[]],S={...R,path:B};if(R.message!==void 0)return{...R,path:B,message:R.message};let o="";const de=I.filter(ge=>!!ge).slice().reverse();for(const ge of de)o=ge(S,{data:g,defaultError:o}).message;return{...R,path:B,message:o}};function He(b,g){const w=nd(),I=ad({issueData:g,data:b.data,path:b.path,errorMaps:[b.common.contextualErrorMap,b.schemaErrorMap,w,w===Ml?void 0:Ml].filter(R=>!!R)});b.common.issues.push(I)}class tn{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(g,w){const I=[];for(const R of w){if(R.status==="aborted")return ft;R.status==="dirty"&&g.dirty(),I.push(R.value)}return{status:g.value,value:I}}static async mergeObjectAsync(g,w){const I=[];for(const R of w){const B=await R.key,S=await R.value;I.push({key:B,value:S})}return tn.mergeObjectSync(g,I)}static mergeObjectSync(g,w){const I={};for(const R of w){const{key:B,value:S}=R;if(B.status==="aborted"||S.status==="aborted")return ft;B.status==="dirty"&&g.dirty(),S.status==="dirty"&&g.dirty(),B.value!=="__proto__"&&(typeof S.value<"u"||R.alwaysSet)&&(I[B.value]=S.value)}return{status:g.value,value:I}}}const ft=Object.freeze({status:"aborted"}),Sl=b=>({status:"dirty",value:b}),$r=b=>({status:"valid",value:b}),Rf=b=>b.status==="aborted",Df=b=>b.status==="dirty",po=b=>b.status==="valid",fu=b=>typeof Promise<"u"&&b instanceof Promise;var it;(function(b){b.errToObj=g=>typeof g=="string"?{message:g}:g||{},b.toString=g=>typeof g=="string"?g:g==null?void 0:g.message})(it||(it={}));class Ra{constructor(g,w,I,R){this._cachedPath=[],this.parent=g,this.data=w,this._path=I,this._key=R}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Lf=(b,g)=>{if(po(g))return{success:!0,data:g.value};if(!b.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const w=new _n(b.common.issues);return this._error=w,this._error}}};function St(b){if(!b)return{};const{errorMap:g,invalid_type_error:w,required_error:I,description:R}=b;if(g&&(w||I))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return g?{errorMap:g,description:R}:{errorMap:(S,o)=>{const{message:de}=b;return S.code==="invalid_enum_value"?{message:de??o.defaultError}:typeof o.data>"u"?{message:de??I??o.defaultError}:S.code!=="invalid_type"?{message:o.defaultError}:{message:de??w??o.defaultError}},description:R}}class Dt{get description(){return this._def.description}_getType(g){return za(g.data)}_getOrReturnCtx(g,w){return w||{common:g.parent.common,data:g.data,parsedType:za(g.data),schemaErrorMap:this._def.errorMap,path:g.path,parent:g.parent}}_processInputParams(g){return{status:new tn,ctx:{common:g.parent.common,data:g.data,parsedType:za(g.data),schemaErrorMap:this._def.errorMap,path:g.path,parent:g.parent}}}_parseSync(g){const w=this._parse(g);if(fu(w))throw new Error("Synchronous parse encountered promise.");return w}_parseAsync(g){const w=this._parse(g);return Promise.resolve(w)}parse(g,w){const I=this.safeParse(g,w);if(I.success)return I.data;throw I.error}safeParse(g,w){const I={common:{issues:[],async:(w==null?void 0:w.async)??!1,contextualErrorMap:w==null?void 0:w.errorMap},path:(w==null?void 0:w.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:g,parsedType:za(g)},R=this._parseSync({data:g,path:I.path,parent:I});return Lf(I,R)}"~validate"(g){var I,R;const w={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:g,parsedType:za(g)};if(!this["~standard"].async)try{const B=this._parseSync({data:g,path:[],parent:w});return po(B)?{value:B.value}:{issues:w.common.issues}}catch(B){(R=(I=B==null?void 0:B.message)==null?void 0:I.toLowerCase())!=null&&R.includes("encountered")&&(this["~standard"].async=!0),w.common={issues:[],async:!0}}return this._parseAsync({data:g,path:[],parent:w}).then(B=>po(B)?{value:B.value}:{issues:w.common.issues})}async parseAsync(g,w){const I=await this.safeParseAsync(g,w);if(I.success)return I.data;throw I.error}async safeParseAsync(g,w){const I={common:{issues:[],contextualErrorMap:w==null?void 0:w.errorMap,async:!0},path:(w==null?void 0:w.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:g,parsedType:za(g)},R=this._parse({data:g,path:I.path,parent:I}),B=await(fu(R)?R:Promise.resolve(R));return Lf(I,B)}refine(g,w){const I=R=>typeof w=="string"||typeof w>"u"?{message:w}:typeof w=="function"?w(R):w;return this._refinement((R,B)=>{const S=g(R),o=()=>B.addIssue({code:Ne.custom,...I(R)});return typeof Promise<"u"&&S instanceof Promise?S.then(de=>de?!0:(o(),!1)):S?!0:(o(),!1)})}refinement(g,w){return this._refinement((I,R)=>g(I)?!0:(R.addIssue(typeof w=="function"?w(I,R):w),!1))}_refinement(g){return new yo({schema:this,typeName:mt.ZodEffects,effect:{type:"refinement",refinement:g}})}superRefine(g){return this._refinement(g)}constructor(g){this.spa=this.safeParseAsync,this._def=g,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:w=>this["~validate"](w)}}optional(){return Ba.create(this,this._def)}nullable(){return xo.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Un.create(this)}promise(){return Al.create(this,this._def)}or(g){return gu.create([this,g],this._def)}and(g){return _u.create(this,g,this._def)}transform(g){return new yo({...St(this._def),schema:this,typeName:mt.ZodEffects,effect:{type:"transform",transform:g}})}default(g){const w=typeof g=="function"?g:()=>g;return new dd({...St(this._def),innerType:this,defaultValue:w,typeName:mt.ZodDefault})}brand(){return new Dy({typeName:mt.ZodBranded,type:this,...St(this._def)})}catch(g){const w=typeof g=="function"?g:()=>g;return new pd({...St(this._def),innerType:this,catchValue:w,typeName:mt.ZodCatch})}describe(g){const w=this.constructor;return new w({...this._def,description:g})}pipe(g){return fd.create(this,g)}readonly(){return md.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const dy=/^c[^\s-]{8,}$/i,py=/^[0-9a-z]+$/,fy=/^[0-9A-HJKMNP-TV-Z]{26}$/i,my=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,gy=/^[a-z0-9_-]{21}$/i,_y=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,yy=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,xy=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,vy="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let sd;const by=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,wy=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Ty=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,My=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Sy=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Py=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Bf="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Cy=new RegExp(`^${Bf}$`);function Ff(b){let g="[0-5]\\d";b.precision?g=`${g}\\.\\d{${b.precision}}`:b.precision==null&&(g=`${g}(\\.\\d+)?`);const w=b.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${g})${w}`}function Iy(b){return new RegExp(`^${Ff(b)}$`)}function Ay(b){let g=`${Bf}T${Ff(b)}`;const w=[];return w.push(b.local?"Z?":"Z"),b.offset&&w.push("([+-]\\d{2}:?\\d{2})"),g=`${g}(${w.join("|")})`,new RegExp(`^${g}$`)}function Ey(b,g){return!!((g==="v4"||!g)&&by.test(b)||(g==="v6"||!g)&&Ty.test(b))}function ky(b,g){if(!_y.test(b))return!1;try{const[w]=b.split("."),I=w.replace(/-/g,"+").replace(/_/g,"/").padEnd(w.length+(4-w.length%4)%4,"="),R=JSON.parse(atob(I));return!(typeof R!="object"||R===null||"typ"in R&&(R==null?void 0:R.typ)!=="JWT"||!R.alg||g&&R.alg!==g)}catch{return!1}}function zy(b,g){return!!((g==="v4"||!g)&&wy.test(b)||(g==="v6"||!g)&&My.test(b))}class Da extends Dt{_parse(g){if(this._def.coerce&&(g.data=String(g.data)),this._getType(g)!==Ye.string){const B=this._getOrReturnCtx(g);return He(B,{code:Ne.invalid_type,expected:Ye.string,received:B.parsedType}),ft}const I=new tn;let R;for(const B of this._def.checks)if(B.kind==="min")g.data.length<B.value&&(R=this._getOrReturnCtx(g,R),He(R,{code:Ne.too_small,minimum:B.value,type:"string",inclusive:!0,exact:!1,message:B.message}),I.dirty());else if(B.kind==="max")g.data.length>B.value&&(R=this._getOrReturnCtx(g,R),He(R,{code:Ne.too_big,maximum:B.value,type:"string",inclusive:!0,exact:!1,message:B.message}),I.dirty());else if(B.kind==="length"){const S=g.data.length>B.value,o=g.data.length<B.value;(S||o)&&(R=this._getOrReturnCtx(g,R),S?He(R,{code:Ne.too_big,maximum:B.value,type:"string",inclusive:!0,exact:!0,message:B.message}):o&&He(R,{code:Ne.too_small,minimum:B.value,type:"string",inclusive:!0,exact:!0,message:B.message}),I.dirty())}else if(B.kind==="email")xy.test(g.data)||(R=this._getOrReturnCtx(g,R),He(R,{validation:"email",code:Ne.invalid_string,message:B.message}),I.dirty());else if(B.kind==="emoji")sd||(sd=new RegExp(vy,"u")),sd.test(g.data)||(R=this._getOrReturnCtx(g,R),He(R,{validation:"emoji",code:Ne.invalid_string,message:B.message}),I.dirty());else if(B.kind==="uuid")my.test(g.data)||(R=this._getOrReturnCtx(g,R),He(R,{validation:"uuid",code:Ne.invalid_string,message:B.message}),I.dirty());else if(B.kind==="nanoid")gy.test(g.data)||(R=this._getOrReturnCtx(g,R),He(R,{validation:"nanoid",code:Ne.invalid_string,message:B.message}),I.dirty());else if(B.kind==="cuid")dy.test(g.data)||(R=this._getOrReturnCtx(g,R),He(R,{validation:"cuid",code:Ne.invalid_string,message:B.message}),I.dirty());else if(B.kind==="cuid2")py.test(g.data)||(R=this._getOrReturnCtx(g,R),He(R,{validation:"cuid2",code:Ne.invalid_string,message:B.message}),I.dirty());else if(B.kind==="ulid")fy.test(g.data)||(R=this._getOrReturnCtx(g,R),He(R,{validation:"ulid",code:Ne.invalid_string,message:B.message}),I.dirty());else if(B.kind==="url")try{new URL(g.data)}catch{R=this._getOrReturnCtx(g,R),He(R,{validation:"url",code:Ne.invalid_string,message:B.message}),I.dirty()}else B.kind==="regex"?(B.regex.lastIndex=0,B.regex.test(g.data)||(R=this._getOrReturnCtx(g,R),He(R,{validation:"regex",code:Ne.invalid_string,message:B.message}),I.dirty())):B.kind==="trim"?g.data=g.data.trim():B.kind==="includes"?g.data.includes(B.value,B.position)||(R=this._getOrReturnCtx(g,R),He(R,{code:Ne.invalid_string,validation:{includes:B.value,position:B.position},message:B.message}),I.dirty()):B.kind==="toLowerCase"?g.data=g.data.toLowerCase():B.kind==="toUpperCase"?g.data=g.data.toUpperCase():B.kind==="startsWith"?g.data.startsWith(B.value)||(R=this._getOrReturnCtx(g,R),He(R,{code:Ne.invalid_string,validation:{startsWith:B.value},message:B.message}),I.dirty()):B.kind==="endsWith"?g.data.endsWith(B.value)||(R=this._getOrReturnCtx(g,R),He(R,{code:Ne.invalid_string,validation:{endsWith:B.value},message:B.message}),I.dirty()):B.kind==="datetime"?Ay(B).test(g.data)||(R=this._getOrReturnCtx(g,R),He(R,{code:Ne.invalid_string,validation:"datetime",message:B.message}),I.dirty()):B.kind==="date"?Cy.test(g.data)||(R=this._getOrReturnCtx(g,R),He(R,{code:Ne.invalid_string,validation:"date",message:B.message}),I.dirty()):B.kind==="time"?Iy(B).test(g.data)||(R=this._getOrReturnCtx(g,R),He(R,{code:Ne.invalid_string,validation:"time",message:B.message}),I.dirty()):B.kind==="duration"?yy.test(g.data)||(R=this._getOrReturnCtx(g,R),He(R,{validation:"duration",code:Ne.invalid_string,message:B.message}),I.dirty()):B.kind==="ip"?Ey(g.data,B.version)||(R=this._getOrReturnCtx(g,R),He(R,{validation:"ip",code:Ne.invalid_string,message:B.message}),I.dirty()):B.kind==="jwt"?ky(g.data,B.alg)||(R=this._getOrReturnCtx(g,R),He(R,{validation:"jwt",code:Ne.invalid_string,message:B.message}),I.dirty()):B.kind==="cidr"?zy(g.data,B.version)||(R=this._getOrReturnCtx(g,R),He(R,{validation:"cidr",code:Ne.invalid_string,message:B.message}),I.dirty()):B.kind==="base64"?Sy.test(g.data)||(R=this._getOrReturnCtx(g,R),He(R,{validation:"base64",code:Ne.invalid_string,message:B.message}),I.dirty()):B.kind==="base64url"?Py.test(g.data)||(R=this._getOrReturnCtx(g,R),He(R,{validation:"base64url",code:Ne.invalid_string,message:B.message}),I.dirty()):Ot.assertNever(B);return{status:I.value,value:g.data}}_regex(g,w,I){return this.refinement(R=>g.test(R),{validation:w,code:Ne.invalid_string,...it.errToObj(I)})}_addCheck(g){return new Da({...this._def,checks:[...this._def.checks,g]})}email(g){return this._addCheck({kind:"email",...it.errToObj(g)})}url(g){return this._addCheck({kind:"url",...it.errToObj(g)})}emoji(g){return this._addCheck({kind:"emoji",...it.errToObj(g)})}uuid(g){return this._addCheck({kind:"uuid",...it.errToObj(g)})}nanoid(g){return this._addCheck({kind:"nanoid",...it.errToObj(g)})}cuid(g){return this._addCheck({kind:"cuid",...it.errToObj(g)})}cuid2(g){return this._addCheck({kind:"cuid2",...it.errToObj(g)})}ulid(g){return this._addCheck({kind:"ulid",...it.errToObj(g)})}base64(g){return this._addCheck({kind:"base64",...it.errToObj(g)})}base64url(g){return this._addCheck({kind:"base64url",...it.errToObj(g)})}jwt(g){return this._addCheck({kind:"jwt",...it.errToObj(g)})}ip(g){return this._addCheck({kind:"ip",...it.errToObj(g)})}cidr(g){return this._addCheck({kind:"cidr",...it.errToObj(g)})}datetime(g){return typeof g=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:g}):this._addCheck({kind:"datetime",precision:typeof(g==null?void 0:g.precision)>"u"?null:g==null?void 0:g.precision,offset:(g==null?void 0:g.offset)??!1,local:(g==null?void 0:g.local)??!1,...it.errToObj(g==null?void 0:g.message)})}date(g){return this._addCheck({kind:"date",message:g})}time(g){return typeof g=="string"?this._addCheck({kind:"time",precision:null,message:g}):this._addCheck({kind:"time",precision:typeof(g==null?void 0:g.precision)>"u"?null:g==null?void 0:g.precision,...it.errToObj(g==null?void 0:g.message)})}duration(g){return this._addCheck({kind:"duration",...it.errToObj(g)})}regex(g,w){return this._addCheck({kind:"regex",regex:g,...it.errToObj(w)})}includes(g,w){return this._addCheck({kind:"includes",value:g,position:w==null?void 0:w.position,...it.errToObj(w==null?void 0:w.message)})}startsWith(g,w){return this._addCheck({kind:"startsWith",value:g,...it.errToObj(w)})}endsWith(g,w){return this._addCheck({kind:"endsWith",value:g,...it.errToObj(w)})}min(g,w){return this._addCheck({kind:"min",value:g,...it.errToObj(w)})}max(g,w){return this._addCheck({kind:"max",value:g,...it.errToObj(w)})}length(g,w){return this._addCheck({kind:"length",value:g,...it.errToObj(w)})}nonempty(g){return this.min(1,it.errToObj(g))}trim(){return new Da({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Da({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Da({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(g=>g.kind==="datetime")}get isDate(){return!!this._def.checks.find(g=>g.kind==="date")}get isTime(){return!!this._def.checks.find(g=>g.kind==="time")}get isDuration(){return!!this._def.checks.find(g=>g.kind==="duration")}get isEmail(){return!!this._def.checks.find(g=>g.kind==="email")}get isURL(){return!!this._def.checks.find(g=>g.kind==="url")}get isEmoji(){return!!this._def.checks.find(g=>g.kind==="emoji")}get isUUID(){return!!this._def.checks.find(g=>g.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(g=>g.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(g=>g.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(g=>g.kind==="cuid2")}get isULID(){return!!this._def.checks.find(g=>g.kind==="ulid")}get isIP(){return!!this._def.checks.find(g=>g.kind==="ip")}get isCIDR(){return!!this._def.checks.find(g=>g.kind==="cidr")}get isBase64(){return!!this._def.checks.find(g=>g.kind==="base64")}get isBase64url(){return!!this._def.checks.find(g=>g.kind==="base64url")}get minLength(){let g=null;for(const w of this._def.checks)w.kind==="min"&&(g===null||w.value>g)&&(g=w.value);return g}get maxLength(){let g=null;for(const w of this._def.checks)w.kind==="max"&&(g===null||w.value<g)&&(g=w.value);return g}}Da.create=b=>new Da({checks:[],typeName:mt.ZodString,coerce:(b==null?void 0:b.coerce)??!1,...St(b)});function Ry(b,g){const w=(b.toString().split(".")[1]||"").length,I=(g.toString().split(".")[1]||"").length,R=w>I?w:I,B=Number.parseInt(b.toFixed(R).replace(".","")),S=Number.parseInt(g.toFixed(R).replace(".",""));return B%S/10**R}class fo extends Dt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(g){if(this._def.coerce&&(g.data=Number(g.data)),this._getType(g)!==Ye.number){const B=this._getOrReturnCtx(g);return He(B,{code:Ne.invalid_type,expected:Ye.number,received:B.parsedType}),ft}let I;const R=new tn;for(const B of this._def.checks)B.kind==="int"?Ot.isInteger(g.data)||(I=this._getOrReturnCtx(g,I),He(I,{code:Ne.invalid_type,expected:"integer",received:"float",message:B.message}),R.dirty()):B.kind==="min"?(B.inclusive?g.data<B.value:g.data<=B.value)&&(I=this._getOrReturnCtx(g,I),He(I,{code:Ne.too_small,minimum:B.value,type:"number",inclusive:B.inclusive,exact:!1,message:B.message}),R.dirty()):B.kind==="max"?(B.inclusive?g.data>B.value:g.data>=B.value)&&(I=this._getOrReturnCtx(g,I),He(I,{code:Ne.too_big,maximum:B.value,type:"number",inclusive:B.inclusive,exact:!1,message:B.message}),R.dirty()):B.kind==="multipleOf"?Ry(g.data,B.value)!==0&&(I=this._getOrReturnCtx(g,I),He(I,{code:Ne.not_multiple_of,multipleOf:B.value,message:B.message}),R.dirty()):B.kind==="finite"?Number.isFinite(g.data)||(I=this._getOrReturnCtx(g,I),He(I,{code:Ne.not_finite,message:B.message}),R.dirty()):Ot.assertNever(B);return{status:R.value,value:g.data}}gte(g,w){return this.setLimit("min",g,!0,it.toString(w))}gt(g,w){return this.setLimit("min",g,!1,it.toString(w))}lte(g,w){return this.setLimit("max",g,!0,it.toString(w))}lt(g,w){return this.setLimit("max",g,!1,it.toString(w))}setLimit(g,w,I,R){return new fo({...this._def,checks:[...this._def.checks,{kind:g,value:w,inclusive:I,message:it.toString(R)}]})}_addCheck(g){return new fo({...this._def,checks:[...this._def.checks,g]})}int(g){return this._addCheck({kind:"int",message:it.toString(g)})}positive(g){return this._addCheck({kind:"min",value:0,inclusive:!1,message:it.toString(g)})}negative(g){return this._addCheck({kind:"max",value:0,inclusive:!1,message:it.toString(g)})}nonpositive(g){return this._addCheck({kind:"max",value:0,inclusive:!0,message:it.toString(g)})}nonnegative(g){return this._addCheck({kind:"min",value:0,inclusive:!0,message:it.toString(g)})}multipleOf(g,w){return this._addCheck({kind:"multipleOf",value:g,message:it.toString(w)})}finite(g){return this._addCheck({kind:"finite",message:it.toString(g)})}safe(g){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:it.toString(g)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:it.toString(g)})}get minValue(){let g=null;for(const w of this._def.checks)w.kind==="min"&&(g===null||w.value>g)&&(g=w.value);return g}get maxValue(){let g=null;for(const w of this._def.checks)w.kind==="max"&&(g===null||w.value<g)&&(g=w.value);return g}get isInt(){return!!this._def.checks.find(g=>g.kind==="int"||g.kind==="multipleOf"&&Ot.isInteger(g.value))}get isFinite(){let g=null,w=null;for(const I of this._def.checks){if(I.kind==="finite"||I.kind==="int"||I.kind==="multipleOf")return!0;I.kind==="min"?(w===null||I.value>w)&&(w=I.value):I.kind==="max"&&(g===null||I.value<g)&&(g=I.value)}return Number.isFinite(w)&&Number.isFinite(g)}}fo.create=b=>new fo({checks:[],typeName:mt.ZodNumber,coerce:(b==null?void 0:b.coerce)||!1,...St(b)});class Pl extends Dt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(g){if(this._def.coerce)try{g.data=BigInt(g.data)}catch{return this._getInvalidInput(g)}if(this._getType(g)!==Ye.bigint)return this._getInvalidInput(g);let I;const R=new tn;for(const B of this._def.checks)B.kind==="min"?(B.inclusive?g.data<B.value:g.data<=B.value)&&(I=this._getOrReturnCtx(g,I),He(I,{code:Ne.too_small,type:"bigint",minimum:B.value,inclusive:B.inclusive,message:B.message}),R.dirty()):B.kind==="max"?(B.inclusive?g.data>B.value:g.data>=B.value)&&(I=this._getOrReturnCtx(g,I),He(I,{code:Ne.too_big,type:"bigint",maximum:B.value,inclusive:B.inclusive,message:B.message}),R.dirty()):B.kind==="multipleOf"?g.data%B.value!==BigInt(0)&&(I=this._getOrReturnCtx(g,I),He(I,{code:Ne.not_multiple_of,multipleOf:B.value,message:B.message}),R.dirty()):Ot.assertNever(B);return{status:R.value,value:g.data}}_getInvalidInput(g){const w=this._getOrReturnCtx(g);return He(w,{code:Ne.invalid_type,expected:Ye.bigint,received:w.parsedType}),ft}gte(g,w){return this.setLimit("min",g,!0,it.toString(w))}gt(g,w){return this.setLimit("min",g,!1,it.toString(w))}lte(g,w){return this.setLimit("max",g,!0,it.toString(w))}lt(g,w){return this.setLimit("max",g,!1,it.toString(w))}setLimit(g,w,I,R){return new Pl({...this._def,checks:[...this._def.checks,{kind:g,value:w,inclusive:I,message:it.toString(R)}]})}_addCheck(g){return new Pl({...this._def,checks:[...this._def.checks,g]})}positive(g){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:it.toString(g)})}negative(g){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:it.toString(g)})}nonpositive(g){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:it.toString(g)})}nonnegative(g){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:it.toString(g)})}multipleOf(g,w){return this._addCheck({kind:"multipleOf",value:g,message:it.toString(w)})}get minValue(){let g=null;for(const w of this._def.checks)w.kind==="min"&&(g===null||w.value>g)&&(g=w.value);return g}get maxValue(){let g=null;for(const w of this._def.checks)w.kind==="max"&&(g===null||w.value<g)&&(g=w.value);return g}}Pl.create=b=>new Pl({checks:[],typeName:mt.ZodBigInt,coerce:(b==null?void 0:b.coerce)??!1,...St(b)});class od extends Dt{_parse(g){if(this._def.coerce&&(g.data=!!g.data),this._getType(g)!==Ye.boolean){const I=this._getOrReturnCtx(g);return He(I,{code:Ne.invalid_type,expected:Ye.boolean,received:I.parsedType}),ft}return $r(g.data)}}od.create=b=>new od({typeName:mt.ZodBoolean,coerce:(b==null?void 0:b.coerce)||!1,...St(b)});class mu extends Dt{_parse(g){if(this._def.coerce&&(g.data=new Date(g.data)),this._getType(g)!==Ye.date){const B=this._getOrReturnCtx(g);return He(B,{code:Ne.invalid_type,expected:Ye.date,received:B.parsedType}),ft}if(Number.isNaN(g.data.getTime())){const B=this._getOrReturnCtx(g);return He(B,{code:Ne.invalid_date}),ft}const I=new tn;let R;for(const B of this._def.checks)B.kind==="min"?g.data.getTime()<B.value&&(R=this._getOrReturnCtx(g,R),He(R,{code:Ne.too_small,message:B.message,inclusive:!0,exact:!1,minimum:B.value,type:"date"}),I.dirty()):B.kind==="max"?g.data.getTime()>B.value&&(R=this._getOrReturnCtx(g,R),He(R,{code:Ne.too_big,message:B.message,inclusive:!0,exact:!1,maximum:B.value,type:"date"}),I.dirty()):Ot.assertNever(B);return{status:I.value,value:new Date(g.data.getTime())}}_addCheck(g){return new mu({...this._def,checks:[...this._def.checks,g]})}min(g,w){return this._addCheck({kind:"min",value:g.getTime(),message:it.toString(w)})}max(g,w){return this._addCheck({kind:"max",value:g.getTime(),message:it.toString(w)})}get minDate(){let g=null;for(const w of this._def.checks)w.kind==="min"&&(g===null||w.value>g)&&(g=w.value);return g!=null?new Date(g):null}get maxDate(){let g=null;for(const w of this._def.checks)w.kind==="max"&&(g===null||w.value<g)&&(g=w.value);return g!=null?new Date(g):null}}mu.create=b=>new mu({checks:[],coerce:(b==null?void 0:b.coerce)||!1,typeName:mt.ZodDate,...St(b)});class Of extends Dt{_parse(g){if(this._getType(g)!==Ye.symbol){const I=this._getOrReturnCtx(g);return He(I,{code:Ne.invalid_type,expected:Ye.symbol,received:I.parsedType}),ft}return $r(g.data)}}Of.create=b=>new Of({typeName:mt.ZodSymbol,...St(b)});class jf extends Dt{_parse(g){if(this._getType(g)!==Ye.undefined){const I=this._getOrReturnCtx(g);return He(I,{code:Ne.invalid_type,expected:Ye.undefined,received:I.parsedType}),ft}return $r(g.data)}}jf.create=b=>new jf({typeName:mt.ZodUndefined,...St(b)});class Nf extends Dt{_parse(g){if(this._getType(g)!==Ye.null){const I=this._getOrReturnCtx(g);return He(I,{code:Ne.invalid_type,expected:Ye.null,received:I.parsedType}),ft}return $r(g.data)}}Nf.create=b=>new Nf({typeName:mt.ZodNull,...St(b)});class ld extends Dt{constructor(){super(...arguments),this._any=!0}_parse(g){return $r(g.data)}}ld.create=b=>new ld({typeName:mt.ZodAny,...St(b)});class mo extends Dt{constructor(){super(...arguments),this._unknown=!0}_parse(g){return $r(g.data)}}mo.create=b=>new mo({typeName:mt.ZodUnknown,...St(b)});class La extends Dt{_parse(g){const w=this._getOrReturnCtx(g);return He(w,{code:Ne.invalid_type,expected:Ye.never,received:w.parsedType}),ft}}La.create=b=>new La({typeName:mt.ZodNever,...St(b)});class cd extends Dt{_parse(g){if(this._getType(g)!==Ye.undefined){const I=this._getOrReturnCtx(g);return He(I,{code:Ne.invalid_type,expected:Ye.void,received:I.parsedType}),ft}return $r(g.data)}}cd.create=b=>new cd({typeName:mt.ZodVoid,...St(b)});class Un extends Dt{_parse(g){const{ctx:w,status:I}=this._processInputParams(g),R=this._def;if(w.parsedType!==Ye.array)return He(w,{code:Ne.invalid_type,expected:Ye.array,received:w.parsedType}),ft;if(R.exactLength!==null){const S=w.data.length>R.exactLength.value,o=w.data.length<R.exactLength.value;(S||o)&&(He(w,{code:S?Ne.too_big:Ne.too_small,minimum:o?R.exactLength.value:void 0,maximum:S?R.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:R.exactLength.message}),I.dirty())}if(R.minLength!==null&&w.data.length<R.minLength.value&&(He(w,{code:Ne.too_small,minimum:R.minLength.value,type:"array",inclusive:!0,exact:!1,message:R.minLength.message}),I.dirty()),R.maxLength!==null&&w.data.length>R.maxLength.value&&(He(w,{code:Ne.too_big,maximum:R.maxLength.value,type:"array",inclusive:!0,exact:!1,message:R.maxLength.message}),I.dirty()),w.common.async)return Promise.all([...w.data].map((S,o)=>R.type._parseAsync(new Ra(w,S,w.path,o)))).then(S=>tn.mergeArray(I,S));const B=[...w.data].map((S,o)=>R.type._parseSync(new Ra(w,S,w.path,o)));return tn.mergeArray(I,B)}get element(){return this._def.type}min(g,w){return new Un({...this._def,minLength:{value:g,message:it.toString(w)}})}max(g,w){return new Un({...this._def,maxLength:{value:g,message:it.toString(w)}})}length(g,w){return new Un({...this._def,exactLength:{value:g,message:it.toString(w)}})}nonempty(g){return this.min(1,g)}}Un.create=(b,g)=>new Un({type:b,minLength:null,maxLength:null,exactLength:null,typeName:mt.ZodArray,...St(g)});function go(b){if(b instanceof Bi){const g={};for(const w in b.shape){const I=b.shape[w];g[w]=Ba.create(go(I))}return new Bi({...b._def,shape:()=>g})}else return b instanceof Un?new Un({...b._def,type:go(b.element)}):b instanceof Ba?Ba.create(go(b.unwrap())):b instanceof xo?xo.create(go(b.unwrap())):b instanceof ra?ra.create(b.items.map(g=>go(g))):b}class Bi extends Dt{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const g=this._def.shape(),w=Ot.objectKeys(g);return this._cached={shape:g,keys:w},this._cached}_parse(g){if(this._getType(g)!==Ye.object){const ge=this._getOrReturnCtx(g);return He(ge,{code:Ne.invalid_type,expected:Ye.object,received:ge.parsedType}),ft}const{status:I,ctx:R}=this._processInputParams(g),{shape:B,keys:S}=this._getCached(),o=[];if(!(this._def.catchall instanceof La&&this._def.unknownKeys==="strip"))for(const ge in R.data)S.includes(ge)||o.push(ge);const de=[];for(const ge of S){const ze=B[ge],Oe=R.data[ge];de.push({key:{status:"valid",value:ge},value:ze._parse(new Ra(R,Oe,R.path,ge)),alwaysSet:ge in R.data})}if(this._def.catchall instanceof La){const ge=this._def.unknownKeys;if(ge==="passthrough")for(const ze of o)de.push({key:{status:"valid",value:ze},value:{status:"valid",value:R.data[ze]}});else if(ge==="strict")o.length>0&&(He(R,{code:Ne.unrecognized_keys,keys:o}),I.dirty());else if(ge!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const ge=this._def.catchall;for(const ze of o){const Oe=R.data[ze];de.push({key:{status:"valid",value:ze},value:ge._parse(new Ra(R,Oe,R.path,ze)),alwaysSet:ze in R.data})}}return R.common.async?Promise.resolve().then(async()=>{const ge=[];for(const ze of de){const Oe=await ze.key,Ce=await ze.value;ge.push({key:Oe,value:Ce,alwaysSet:ze.alwaysSet})}return ge}).then(ge=>tn.mergeObjectSync(I,ge)):tn.mergeObjectSync(I,de)}get shape(){return this._def.shape()}strict(g){return it.errToObj,new Bi({...this._def,unknownKeys:"strict",...g!==void 0?{errorMap:(w,I)=>{var B,S;const R=((S=(B=this._def).errorMap)==null?void 0:S.call(B,w,I).message)??I.defaultError;return w.code==="unrecognized_keys"?{message:it.errToObj(g).message??R}:{message:R}}}:{}})}strip(){return new Bi({...this._def,unknownKeys:"strip"})}passthrough(){return new Bi({...this._def,unknownKeys:"passthrough"})}extend(g){return new Bi({...this._def,shape:()=>({...this._def.shape(),...g})})}merge(g){return new Bi({unknownKeys:g._def.unknownKeys,catchall:g._def.catchall,shape:()=>({...this._def.shape(),...g._def.shape()}),typeName:mt.ZodObject})}setKey(g,w){return this.augment({[g]:w})}catchall(g){return new Bi({...this._def,catchall:g})}pick(g){const w={};for(const I of Ot.objectKeys(g))g[I]&&this.shape[I]&&(w[I]=this.shape[I]);return new Bi({...this._def,shape:()=>w})}omit(g){const w={};for(const I of Ot.objectKeys(this.shape))g[I]||(w[I]=this.shape[I]);return new Bi({...this._def,shape:()=>w})}deepPartial(){return go(this)}partial(g){const w={};for(const I of Ot.objectKeys(this.shape)){const R=this.shape[I];g&&!g[I]?w[I]=R:w[I]=R.optional()}return new Bi({...this._def,shape:()=>w})}required(g){const w={};for(const I of Ot.objectKeys(this.shape))if(g&&!g[I])w[I]=this.shape[I];else{let B=this.shape[I];for(;B instanceof Ba;)B=B._def.innerType;w[I]=B}return new Bi({...this._def,shape:()=>w})}keyof(){return Uf(Ot.objectKeys(this.shape))}}Bi.create=(b,g)=>new Bi({shape:()=>b,unknownKeys:"strip",catchall:La.create(),typeName:mt.ZodObject,...St(g)}),Bi.strictCreate=(b,g)=>new Bi({shape:()=>b,unknownKeys:"strict",catchall:La.create(),typeName:mt.ZodObject,...St(g)}),Bi.lazycreate=(b,g)=>new Bi({shape:b,unknownKeys:"strip",catchall:La.create(),typeName:mt.ZodObject,...St(g)});class gu extends Dt{_parse(g){const{ctx:w}=this._processInputParams(g),I=this._def.options;function R(B){for(const o of B)if(o.result.status==="valid")return o.result;for(const o of B)if(o.result.status==="dirty")return w.common.issues.push(...o.ctx.common.issues),o.result;const S=B.map(o=>new _n(o.ctx.common.issues));return He(w,{code:Ne.invalid_union,unionErrors:S}),ft}if(w.common.async)return Promise.all(I.map(async B=>{const S={...w,common:{...w.common,issues:[]},parent:null};return{result:await B._parseAsync({data:w.data,path:w.path,parent:S}),ctx:S}})).then(R);{let B;const S=[];for(const de of I){const ge={...w,common:{...w.common,issues:[]},parent:null},ze=de._parseSync({data:w.data,path:w.path,parent:ge});if(ze.status==="valid")return ze;ze.status==="dirty"&&!B&&(B={result:ze,ctx:ge}),ge.common.issues.length&&S.push(ge.common.issues)}if(B)return w.common.issues.push(...B.ctx.common.issues),B.result;const o=S.map(de=>new _n(de));return He(w,{code:Ne.invalid_union,unionErrors:o}),ft}}get options(){return this._def.options}}gu.create=(b,g)=>new gu({options:b,typeName:mt.ZodUnion,...St(g)});function ud(b,g){const w=za(b),I=za(g);if(b===g)return{valid:!0,data:b};if(w===Ye.object&&I===Ye.object){const R=Ot.objectKeys(g),B=Ot.objectKeys(b).filter(o=>R.indexOf(o)!==-1),S={...b,...g};for(const o of B){const de=ud(b[o],g[o]);if(!de.valid)return{valid:!1};S[o]=de.data}return{valid:!0,data:S}}else if(w===Ye.array&&I===Ye.array){if(b.length!==g.length)return{valid:!1};const R=[];for(let B=0;B<b.length;B++){const S=b[B],o=g[B],de=ud(S,o);if(!de.valid)return{valid:!1};R.push(de.data)}return{valid:!0,data:R}}else return w===Ye.date&&I===Ye.date&&+b==+g?{valid:!0,data:b}:{valid:!1}}class _u extends Dt{_parse(g){const{status:w,ctx:I}=this._processInputParams(g),R=(B,S)=>{if(Rf(B)||Rf(S))return ft;const o=ud(B.value,S.value);return o.valid?((Df(B)||Df(S))&&w.dirty(),{status:w.value,value:o.data}):(He(I,{code:Ne.invalid_intersection_types}),ft)};return I.common.async?Promise.all([this._def.left._parseAsync({data:I.data,path:I.path,parent:I}),this._def.right._parseAsync({data:I.data,path:I.path,parent:I})]).then(([B,S])=>R(B,S)):R(this._def.left._parseSync({data:I.data,path:I.path,parent:I}),this._def.right._parseSync({data:I.data,path:I.path,parent:I}))}}_u.create=(b,g,w)=>new _u({left:b,right:g,typeName:mt.ZodIntersection,...St(w)});class ra extends Dt{_parse(g){const{status:w,ctx:I}=this._processInputParams(g);if(I.parsedType!==Ye.array)return He(I,{code:Ne.invalid_type,expected:Ye.array,received:I.parsedType}),ft;if(I.data.length<this._def.items.length)return He(I,{code:Ne.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ft;!this._def.rest&&I.data.length>this._def.items.length&&(He(I,{code:Ne.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),w.dirty());const B=[...I.data].map((S,o)=>{const de=this._def.items[o]||this._def.rest;return de?de._parse(new Ra(I,S,I.path,o)):null}).filter(S=>!!S);return I.common.async?Promise.all(B).then(S=>tn.mergeArray(w,S)):tn.mergeArray(w,B)}get items(){return this._def.items}rest(g){return new ra({...this._def,rest:g})}}ra.create=(b,g)=>{if(!Array.isArray(b))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ra({items:b,typeName:mt.ZodTuple,rest:null,...St(g)})};class Zf extends Dt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(g){const{status:w,ctx:I}=this._processInputParams(g);if(I.parsedType!==Ye.map)return He(I,{code:Ne.invalid_type,expected:Ye.map,received:I.parsedType}),ft;const R=this._def.keyType,B=this._def.valueType,S=[...I.data.entries()].map(([o,de],ge)=>({key:R._parse(new Ra(I,o,I.path,[ge,"key"])),value:B._parse(new Ra(I,de,I.path,[ge,"value"]))}));if(I.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const de of S){const ge=await de.key,ze=await de.value;if(ge.status==="aborted"||ze.status==="aborted")return ft;(ge.status==="dirty"||ze.status==="dirty")&&w.dirty(),o.set(ge.value,ze.value)}return{status:w.value,value:o}})}else{const o=new Map;for(const de of S){const ge=de.key,ze=de.value;if(ge.status==="aborted"||ze.status==="aborted")return ft;(ge.status==="dirty"||ze.status==="dirty")&&w.dirty(),o.set(ge.value,ze.value)}return{status:w.value,value:o}}}}Zf.create=(b,g,w)=>new Zf({valueType:g,keyType:b,typeName:mt.ZodMap,...St(w)});class Cl extends Dt{_parse(g){const{status:w,ctx:I}=this._processInputParams(g);if(I.parsedType!==Ye.set)return He(I,{code:Ne.invalid_type,expected:Ye.set,received:I.parsedType}),ft;const R=this._def;R.minSize!==null&&I.data.size<R.minSize.value&&(He(I,{code:Ne.too_small,minimum:R.minSize.value,type:"set",inclusive:!0,exact:!1,message:R.minSize.message}),w.dirty()),R.maxSize!==null&&I.data.size>R.maxSize.value&&(He(I,{code:Ne.too_big,maximum:R.maxSize.value,type:"set",inclusive:!0,exact:!1,message:R.maxSize.message}),w.dirty());const B=this._def.valueType;function S(de){const ge=new Set;for(const ze of de){if(ze.status==="aborted")return ft;ze.status==="dirty"&&w.dirty(),ge.add(ze.value)}return{status:w.value,value:ge}}const o=[...I.data.values()].map((de,ge)=>B._parse(new Ra(I,de,I.path,ge)));return I.common.async?Promise.all(o).then(de=>S(de)):S(o)}min(g,w){return new Cl({...this._def,minSize:{value:g,message:it.toString(w)}})}max(g,w){return new Cl({...this._def,maxSize:{value:g,message:it.toString(w)}})}size(g,w){return this.min(g,w).max(g,w)}nonempty(g){return this.min(1,g)}}Cl.create=(b,g)=>new Cl({valueType:b,minSize:null,maxSize:null,typeName:mt.ZodSet,...St(g)});class Il extends Dt{constructor(){super(...arguments),this.validate=this.implement}_parse(g){const{ctx:w}=this._processInputParams(g);if(w.parsedType!==Ye.function)return He(w,{code:Ne.invalid_type,expected:Ye.function,received:w.parsedType}),ft;function I(o,de){return ad({data:o,path:w.path,errorMaps:[w.common.contextualErrorMap,w.schemaErrorMap,nd(),Ml].filter(ge=>!!ge),issueData:{code:Ne.invalid_arguments,argumentsError:de}})}function R(o,de){return ad({data:o,path:w.path,errorMaps:[w.common.contextualErrorMap,w.schemaErrorMap,nd(),Ml].filter(ge=>!!ge),issueData:{code:Ne.invalid_return_type,returnTypeError:de}})}const B={errorMap:w.common.contextualErrorMap},S=w.data;if(this._def.returns instanceof Al){const o=this;return $r(async function(...de){const ge=new _n([]),ze=await o._def.args.parseAsync(de,B).catch(ce=>{throw ge.addIssue(I(de,ce)),ge}),Oe=await Reflect.apply(S,this,ze);return await o._def.returns._def.type.parseAsync(Oe,B).catch(ce=>{throw ge.addIssue(R(Oe,ce)),ge})})}else{const o=this;return $r(function(...de){const ge=o._def.args.safeParse(de,B);if(!ge.success)throw new _n([I(de,ge.error)]);const ze=Reflect.apply(S,this,ge.data),Oe=o._def.returns.safeParse(ze,B);if(!Oe.success)throw new _n([R(ze,Oe.error)]);return Oe.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...g){return new Il({...this._def,args:ra.create(g).rest(mo.create())})}returns(g){return new Il({...this._def,returns:g})}implement(g){return this.parse(g)}strictImplement(g){return this.parse(g)}static create(g,w,I){return new Il({args:g||ra.create([]).rest(mo.create()),returns:w||mo.create(),typeName:mt.ZodFunction,...St(I)})}}class Vf extends Dt{get schema(){return this._def.getter()}_parse(g){const{ctx:w}=this._processInputParams(g);return this._def.getter()._parse({data:w.data,path:w.path,parent:w})}}Vf.create=(b,g)=>new Vf({getter:b,typeName:mt.ZodLazy,...St(g)});class hd extends Dt{_parse(g){if(g.data!==this._def.value){const w=this._getOrReturnCtx(g);return He(w,{received:w.data,code:Ne.invalid_literal,expected:this._def.value}),ft}return{status:"valid",value:g.data}}get value(){return this._def.value}}hd.create=(b,g)=>new hd({value:b,typeName:mt.ZodLiteral,...St(g)});function Uf(b,g){return new _o({values:b,typeName:mt.ZodEnum,...St(g)})}class _o extends Dt{_parse(g){if(typeof g.data!="string"){const w=this._getOrReturnCtx(g),I=this._def.values;return He(w,{expected:Ot.joinValues(I),received:w.parsedType,code:Ne.invalid_type}),ft}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(g.data)){const w=this._getOrReturnCtx(g),I=this._def.values;return He(w,{received:w.data,code:Ne.invalid_enum_value,options:I}),ft}return $r(g.data)}get options(){return this._def.values}get enum(){const g={};for(const w of this._def.values)g[w]=w;return g}get Values(){const g={};for(const w of this._def.values)g[w]=w;return g}get Enum(){const g={};for(const w of this._def.values)g[w]=w;return g}extract(g,w=this._def){return _o.create(g,{...this._def,...w})}exclude(g,w=this._def){return _o.create(this.options.filter(I=>!g.includes(I)),{...this._def,...w})}}_o.create=Uf;class $f extends Dt{_parse(g){const w=Ot.getValidEnumValues(this._def.values),I=this._getOrReturnCtx(g);if(I.parsedType!==Ye.string&&I.parsedType!==Ye.number){const R=Ot.objectValues(w);return He(I,{expected:Ot.joinValues(R),received:I.parsedType,code:Ne.invalid_type}),ft}if(this._cache||(this._cache=new Set(Ot.getValidEnumValues(this._def.values))),!this._cache.has(g.data)){const R=Ot.objectValues(w);return He(I,{received:I.data,code:Ne.invalid_enum_value,options:R}),ft}return $r(g.data)}get enum(){return this._def.values}}$f.create=(b,g)=>new $f({values:b,typeName:mt.ZodNativeEnum,...St(g)});class Al extends Dt{unwrap(){return this._def.type}_parse(g){const{ctx:w}=this._processInputParams(g);if(w.parsedType!==Ye.promise&&w.common.async===!1)return He(w,{code:Ne.invalid_type,expected:Ye.promise,received:w.parsedType}),ft;const I=w.parsedType===Ye.promise?w.data:Promise.resolve(w.data);return $r(I.then(R=>this._def.type.parseAsync(R,{path:w.path,errorMap:w.common.contextualErrorMap})))}}Al.create=(b,g)=>new Al({type:b,typeName:mt.ZodPromise,...St(g)});class yo extends Dt{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===mt.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(g){const{status:w,ctx:I}=this._processInputParams(g),R=this._def.effect||null,B={addIssue:S=>{He(I,S),S.fatal?w.abort():w.dirty()},get path(){return I.path}};if(B.addIssue=B.addIssue.bind(B),R.type==="preprocess"){const S=R.transform(I.data,B);if(I.common.async)return Promise.resolve(S).then(async o=>{if(w.value==="aborted")return ft;const de=await this._def.schema._parseAsync({data:o,path:I.path,parent:I});return de.status==="aborted"?ft:de.status==="dirty"||w.value==="dirty"?Sl(de.value):de});{if(w.value==="aborted")return ft;const o=this._def.schema._parseSync({data:S,path:I.path,parent:I});return o.status==="aborted"?ft:o.status==="dirty"||w.value==="dirty"?Sl(o.value):o}}if(R.type==="refinement"){const S=o=>{const de=R.refinement(o,B);if(I.common.async)return Promise.resolve(de);if(de instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(I.common.async===!1){const o=this._def.schema._parseSync({data:I.data,path:I.path,parent:I});return o.status==="aborted"?ft:(o.status==="dirty"&&w.dirty(),S(o.value),{status:w.value,value:o.value})}else return this._def.schema._parseAsync({data:I.data,path:I.path,parent:I}).then(o=>o.status==="aborted"?ft:(o.status==="dirty"&&w.dirty(),S(o.value).then(()=>({status:w.value,value:o.value}))))}if(R.type==="transform")if(I.common.async===!1){const S=this._def.schema._parseSync({data:I.data,path:I.path,parent:I});if(!po(S))return ft;const o=R.transform(S.value,B);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:w.value,value:o}}else return this._def.schema._parseAsync({data:I.data,path:I.path,parent:I}).then(S=>po(S)?Promise.resolve(R.transform(S.value,B)).then(o=>({status:w.value,value:o})):ft);Ot.assertNever(R)}}yo.create=(b,g,w)=>new yo({schema:b,typeName:mt.ZodEffects,effect:g,...St(w)}),yo.createWithPreprocess=(b,g,w)=>new yo({schema:g,effect:{type:"preprocess",transform:b},typeName:mt.ZodEffects,...St(w)});class Ba extends Dt{_parse(g){return this._getType(g)===Ye.undefined?$r(void 0):this._def.innerType._parse(g)}unwrap(){return this._def.innerType}}Ba.create=(b,g)=>new Ba({innerType:b,typeName:mt.ZodOptional,...St(g)});class xo extends Dt{_parse(g){return this._getType(g)===Ye.null?$r(null):this._def.innerType._parse(g)}unwrap(){return this._def.innerType}}xo.create=(b,g)=>new xo({innerType:b,typeName:mt.ZodNullable,...St(g)});class dd extends Dt{_parse(g){const{ctx:w}=this._processInputParams(g);let I=w.data;return w.parsedType===Ye.undefined&&(I=this._def.defaultValue()),this._def.innerType._parse({data:I,path:w.path,parent:w})}removeDefault(){return this._def.innerType}}dd.create=(b,g)=>new dd({innerType:b,typeName:mt.ZodDefault,defaultValue:typeof g.default=="function"?g.default:()=>g.default,...St(g)});class pd extends Dt{_parse(g){const{ctx:w}=this._processInputParams(g),I={...w,common:{...w.common,issues:[]}},R=this._def.innerType._parse({data:I.data,path:I.path,parent:{...I}});return fu(R)?R.then(B=>({status:"valid",value:B.status==="valid"?B.value:this._def.catchValue({get error(){return new _n(I.common.issues)},input:I.data})})):{status:"valid",value:R.status==="valid"?R.value:this._def.catchValue({get error(){return new _n(I.common.issues)},input:I.data})}}removeCatch(){return this._def.innerType}}pd.create=(b,g)=>new pd({innerType:b,typeName:mt.ZodCatch,catchValue:typeof g.catch=="function"?g.catch:()=>g.catch,...St(g)});class Gf extends Dt{_parse(g){if(this._getType(g)!==Ye.nan){const I=this._getOrReturnCtx(g);return He(I,{code:Ne.invalid_type,expected:Ye.nan,received:I.parsedType}),ft}return{status:"valid",value:g.data}}}Gf.create=b=>new Gf({typeName:mt.ZodNaN,...St(b)});class Dy extends Dt{_parse(g){const{ctx:w}=this._processInputParams(g),I=w.data;return this._def.type._parse({data:I,path:w.path,parent:w})}unwrap(){return this._def.type}}class fd extends Dt{_parse(g){const{status:w,ctx:I}=this._processInputParams(g);if(I.common.async)return(async()=>{const B=await this._def.in._parseAsync({data:I.data,path:I.path,parent:I});return B.status==="aborted"?ft:B.status==="dirty"?(w.dirty(),Sl(B.value)):this._def.out._parseAsync({data:B.value,path:I.path,parent:I})})();{const R=this._def.in._parseSync({data:I.data,path:I.path,parent:I});return R.status==="aborted"?ft:R.status==="dirty"?(w.dirty(),{status:"dirty",value:R.value}):this._def.out._parseSync({data:R.value,path:I.path,parent:I})}}static create(g,w){return new fd({in:g,out:w,typeName:mt.ZodPipeline})}}class md extends Dt{_parse(g){const w=this._def.innerType._parse(g),I=R=>(po(R)&&(R.value=Object.freeze(R.value)),R);return fu(w)?w.then(R=>I(R)):I(w)}unwrap(){return this._def.innerType}}md.create=(b,g)=>new md({innerType:b,typeName:mt.ZodReadonly,...St(g)});var mt;(function(b){b.ZodString="ZodString",b.ZodNumber="ZodNumber",b.ZodNaN="ZodNaN",b.ZodBigInt="ZodBigInt",b.ZodBoolean="ZodBoolean",b.ZodDate="ZodDate",b.ZodSymbol="ZodSymbol",b.ZodUndefined="ZodUndefined",b.ZodNull="ZodNull",b.ZodAny="ZodAny",b.ZodUnknown="ZodUnknown",b.ZodNever="ZodNever",b.ZodVoid="ZodVoid",b.ZodArray="ZodArray",b.ZodObject="ZodObject",b.ZodUnion="ZodUnion",b.ZodDiscriminatedUnion="ZodDiscriminatedUnion",b.ZodIntersection="ZodIntersection",b.ZodTuple="ZodTuple",b.ZodRecord="ZodRecord",b.ZodMap="ZodMap",b.ZodSet="ZodSet",b.ZodFunction="ZodFunction",b.ZodLazy="ZodLazy",b.ZodLiteral="ZodLiteral",b.ZodEnum="ZodEnum",b.ZodEffects="ZodEffects",b.ZodNativeEnum="ZodNativeEnum",b.ZodOptional="ZodOptional",b.ZodNullable="ZodNullable",b.ZodDefault="ZodDefault",b.ZodCatch="ZodCatch",b.ZodPromise="ZodPromise",b.ZodBranded="ZodBranded",b.ZodPipeline="ZodPipeline",b.ZodReadonly="ZodReadonly"})(mt||(mt={}));const Fa=Da.create,qi=fo.create,Ly=od.create,By=ld.create;mo.create,La.create;const yu=cd.create,gd=Un.create,nr=Bi.create;gu.create,_u.create;const qf=ra.create,El=Il.create,_d=hd.create,Fy=_o.create,Oy=Al.create;Ba.create,xo.create;const xu=nr({lat:qi(),lng:qi()}),jy=nr({center:xu,zoom:qi()}),Ny=nr({sw:xu,ne:xu}),Hf=nr({primary:Fa().max(64),background:Fa().max(64),text:Fa().max(64)}),Zy=nr({name:_d("dark").or(_d("light")),colors:Hf}),Vy=nr({name:_d("custom"),url:Fa().max(256),colors:Hf}),Uy=Zy.or(Vy),$y=nr({pin:nr({fade:Ly().optional(),maxCount:qi().optional(),maxZoom:qi().optional()}).optional(),animation:nr({queue:nr({limit:qi().optional()}).optional()}).optional()}),Gy=nr({container:Fa(),position:nr({center:nr({lat:qi(),lng:qi()}),zoom:qi()}),style:Uy,restriction:nr({minZoom:qi().min(td).max(Tl).optional(),maxZoom:qi().min(td).max(Tl).optional(),maxBounds:Ny.optional()}).optional(),configuration:$y.optional()});Fy(["idle","move","click","popup_click"]);const qy=El().returns(yu()),Hy=El().returns(yu()),Wy=El().args(jy).returns(yu()),Xy=El().args(xu).returns(yu()),Ky={load:qy,idle:Hy,move:Wy,click:Xy},Wf=nr({id:Fa().min(1),rank:qi(),lat:qi().min(-90).max(90),lng:qi().min(-180).max(180),width:qi().min(56),height:qi().min(56)}),Yy=qf([qi(),gd(qf([qi(),qi()]))]),Xf=El().args(Fa()).returns(Oy(By())),Jy=nr({data:Wf,state:Yy,callbacks:nr({body:Xf,pin:Xf.optional()})}),Qy=gd(Jy);nr({key:Fa(),data:gd(Wf)});var ex=Uh('<div class="container svelte-puxsd1"><div class="map svelte-puxsd1"></div> <div class="logo svelte-puxsd1"><a href="https://arenarium.dev" target="_blank" class="svelte-puxsd1">@arenarium/maps</a></div></div>');function Kf(b,g){Jc(g,!0);let w,I,R,B,S,o=rr(0),de=rr(0),ge=rr(!1),ze=rr(void 0);Pf(()=>{Gy.parse(g.options),Oe(),ce()});function Oe(){var De,qe,Ze;R=((De=g.options.restriction)==null?void 0:De.minZoom)??td,B=((qe=g.options.restriction)==null?void 0:qe.maxZoom)??Tl,S=(Ze=g.options.restriction)==null?void 0:Ze.maxBounds,w=new rd.Map({style:gt(g.options.style),center:{lat:g.options.position.center.lat,lng:g.options.position.center.lng},zoom:g.options.position.zoom,minZoom:Lt(R),maxZoom:B,maxBounds:S?[S.sw.lng,S.sw.lat,S.ne.lng,S.ne.lat]:void 0,container:I,pitchWithRotate:!1,attributionControl:{compact:!1}})}const Ce=()=>w;function ce(){w.on("load",Ve),w.on("move",Nt),w.on("idle",xt),w.on("click",Ei),w.dragRotate.disable(),w.keyboard.disable(),w.touchZoomRotate.disableRotation(),w.touchPitch.disable()}function Ve(){gi(ge,!0),It("load",null)}function Nt(){const De=w.getCenter(),qe=w.getZoom();It("move",{center:De,zoom:qe});const Ze=w.getBounds();gi(ze,{sw:{lat:Ze.getSouthWest().lat,lng:Ze.getSouthWest().lng},ne:{lat:Ze.getNorthEast().lat,lng:Ze.getNorthEast().lng}},!0)}function xt(){It("idle",null);const De=w.getBounds();gi(ze,{sw:{lat:De.getSouthWest().lat,lng:De.getSouthWest().lng},ne:{lat:De.getNorthEast().lat,lng:De.getNorthEast().lng}},!0)}function Ei(De){It("click",{lat:De.lngLat.lat,lng:De.lngLat.lng})}const pi=new Map;function Hi(De,qe){var Yt;const Ze=Ky[De];if(!Ze)throw new Error(`No schema defined for event ${De}`);if(!Ze.safeParse(qe).success)throw new Error(`Invalid handler for event ${De}`);pi.has(De)||pi.set(De,new Set),(Yt=pi.get(De))==null||Yt.add(qe)}function ai(De,qe){const Ze=pi.get(De);Ze&&Ze.delete(qe)&&Ze.size===0&&pi.delete(De)}function It(De,qe){const Ze=pi.get(De);Ze&&Ze.size>0&&[...Ze].forEach(Qe=>{try{Qe(qe)}catch(Yt){console.error(Yt)}})}function Lt(De){const qe=Af,Ze=Math.ceil(Math.log2(pt(o)/qe));return Math.max(De,Ze)}function mr(){const De=w.getCenter();return De?{lat:De.lat,lng:De.lng}:{lat:g.options.position.center.lat,lng:g.options.position.center.lng}}function Ut(){return w.getZoom()??g.options.position.zoom}function rn(){if(!w)throw new Error("Map not loaded!");const De=w.getBounds();return{sw:{lat:De.getSouthWest().lat,lng:De.getSouthWest().lng},ne:{lat:De.getNorthEast().lat,lng:De.getNorthEast().lng}}}function Cn(De){if(!w)throw new Error("Map not loaded! Consider using the position option");w.setCenter(De)}function Lr(De){if(!w)throw new Error("Map not loaded! Consider using the position option");w.setZoom(De)}function ar(){if(!w)throw new Error("Map not loaded! Consider using the position option");w.zoomIn()}function sr(){if(!w)throw new Error("Map not loaded! Consider using the position option.");w.zoomOut()}function _i(De){if(!w)throw new Error("Map not loaded! Consider using the restriction option.");R=De,w.setMinZoom(Lt(De))}function yn(De){if(!w)throw new Error("Map not loaded! Consider using the restriction option.");B=De,w.setMaxZoom(De)}function Pt(De){if(!w)throw new Error("Map not loaded! Consider using the restriction option.");S=De,w.setMaxBounds([De.sw.lng,De.sw.lat,De.ne.lng,De.ne.lat])}let si=rr(Aa(g.options.style));mn(()=>{pt(ge)&&w.setStyle(gt(pt(si)),{diff:!0})});function gt(De){if(De.name=="custom")return De.url;switch(De.name){case"light":return uy;case"dark":return cy}}function Fi(){return $p(pt(si))}function Wi(De){gi(si,De,!0),w.setStyle(gt(pt(si)),{diff:!0})}let Mr=rr(Aa(g.options.configuration));mn(()=>{var De,qe,Ze;(Ze=(qe=(De=pt(Mr))==null?void 0:De.animation)==null?void 0:qe.queue)!=null&&Ze.limit?ia.setLimit(pt(Mr).animation.queue.limit):ia.setLimit(8*navigator.hardwareConcurrency)});function Sr(){return $p(pt(Mr))}function $n(De){gi(Mr,De,!0)}class Xi{constructor(qe){Rt(this,"id");Rt(this,"lat");Rt(this,"lng");Rt(this,"zoom");Rt(this,"element");Rt(this,"component");Rt(this,"libreMarker");this.id=qe.data.id,this.lat=qe.data.lat,this.lng=qe.data.lng,this.zoom=qe.state[0]}create(){this.createElement(),this.createLibreMarker(),this.updateZIndex()}createElement(){throw new Error("Create element not implemented")}createLibreMarker(){const qe=this.element;if(!qe)throw new Error("Failed to create libre marker");const Ze=new rd.Marker({element:qe});Ze.setLngLat([this.lng,this.lat]),this.libreMarker=Ze}update(qe){this.zoom=qe.state[0],this.updateZIndex()}updateZIndex(){throw new Error("Update z-index not implemented")}updateMap(qe){const Ze=this.libreMarker,Qe=this.component;if(Ze==null||Qe==null)throw new Error("Failed to update popup map");qe?Ze._map!=qe&&Ze.addTo(qe):Ze._map!=null&&Ze.remove()}isInBlock(qe,Ze){return this.zoom<=qe&&Ze.contains(this.lat,this.lng)}remove(){var qe,Ze;(qe=this.libreMarker)==null||qe.remove(),(Ze=this.element)==null||Ze.remove()}}class yi extends Xi{constructor(Ze){super(Ze);Rt(this,"pinLoading",!1);Rt(this,"pinLoaded",!1);Rt(this,"pinCallback");this.pinCallback=Ze.callbacks.pin}createElement(){this.element=document.createElement("div"),this.element.classList.add("circle"),this.component=Gh(ny,{target:this.element,props:{id:this.id+"_circle",priority:this.zoom*hu}})}updateZIndex(){const Ze=this.element;if(!Ze)return;const Qe=Math.round((Tl-this.zoom)*hu);Ze.style.zIndex=Qe.toString()}updateMap(Ze){var Qe;super.updateMap(Ze),(Qe=this.component)==null||Qe.setDisplayed(Ze!=null)}updateState(Ze){const Qe=this.component;if(!Qe)throw new Error("Failed to update circle state");Qe.setScale(this.getScale(Ze))}updatePin(){var Qe;if(this.pinCallback==null||this.pinLoaded||this.pinLoading)return;const Ze=(Qe=this.component)==null?void 0:Qe.getBody();Ze!=null&&(this.pinLoading=!0,this.pinCallback(this.id).then(Yt=>{Ze.appendChild(Yt),this.pinLoaded=!0,this.pinLoading=!1}))}setExpanded(){if(this.component==null)throw new Error("Failed to set circle expanded");this.component.setScale(1)}setCollapsed(){if(this.component==null)throw new Error("Failed to set circle collapsed");this.component.setScale(0)}getScale(Ze){return Math.max(0,1-(this.zoom-Ze)*.125)}isCollapsed(){return this.component==null?!1:this.component.getCollapsed()}isPinLoaded(){return this.pinCallback==null||this.pinLoaded}}class Pr extends Xi{constructor(Ze){super(Ze);Rt(this,"width");Rt(this,"height");Rt(this,"states");Rt(this,"bodyLoading",!1);Rt(this,"bodyLoaded",!1);Rt(this,"bodyCallback");this.id=Ze.data.id,this.states=Ze.state[1].map(Qe=>[Qe[0],du.DEGREES[Qe[1]]]),this.width=Ze.data.width,this.height=Ze.data.height,this.bodyCallback=Ze.callbacks.body}createElement(){this.element=document.createElement("div"),this.element.classList.add("marker"),this.component=Gh(iy,{target:this.element,props:{id:this.id+"_marker",priority:this.zoom*hu,width:this.width,height:this.height}})}update(Ze){super.update(Ze),this.states=Ze.state[1].map(Qe=>[Qe[0],du.DEGREES[Qe[1]]])}updateZIndex(){const Ze=this.element;if(!Ze)return;const Qe=Math.round((Tl-this.zoom)*hu)+Y_;Ze.style.zIndex=Qe.toString()}updateMap(Ze){var Qe;super.updateMap(Ze),(Qe=this.component)==null||Qe.setDisplayed(Ze!=null)}updateState(Ze){const Qe=this.component;if(!Qe)throw new Error("Failed to update marker state");Qe.setAngle(this.getAngle(Ze))}updateBody(){var Qe;if(this.bodyLoaded||this.bodyLoading)return;const Ze=(Qe=this.component)==null?void 0:Qe.getBody();Ze!=null&&(this.bodyLoading=!0,this.bodyCallback(this.id).then(Yt=>{Ze.appendChild(Yt),this.bodyLoading=!1,this.bodyLoaded=!0}))}getAngle(Ze){const Qe=this.states.findLast(Yt=>Yt[0]<=Ze);if(!Qe)throw new Error("Angle not found");return Qe[1]}setCollapsed(Ze){if(this.component==null)throw new Error("Failed to set marker collapsed");this.component.setCollapsed(Ze)}isExpanded(){return this.component?this.component.getExpanded():!1}isCollapsed(){return this.component?this.component.getCollapsed():!1}isBodyLoaded(){return this.bodyLoaded}}class xi{constructor(qe){Rt(this,"id");Rt(this,"rank");Rt(this,"lat");Rt(this,"lng");Rt(this,"zoom");Rt(this,"circle");Rt(this,"marker");this.id=qe.data.id,this.rank=qe.data.rank,this.lat=qe.data.lat,this.lng=qe.data.lng,this.zoom=qe.state[0],this.circle=new yi(qe),this.marker=new Pr(qe)}create(){this.circle.create(),this.marker.create()}update(qe){this.circle.update(qe),this.marker.update(qe)}remove(){this.circle.remove(),this.marker.remove()}}let nn,fi=new Array,or=new Map,vi=!1,lr=Af,Oi=Wp(()=>pt(ze)?new kf(w,-512,pt(de)+lr,pt(o)+lr,-512):void 0),jt=Wp(()=>pt(ze)?new kf(w,0,pt(de),pt(o),0):void 0);Pf(()=>{const De=()=>{Gr(),nn=window.setTimeout(De,25)};return De(),()=>clearInterval(nn)});function Gr(){var Yt,cr,qr,sn,In,_r;if(pt(ge)==!1||pt(jt)==null||pt(Oi)==null||fi.length==0||vi)return;const De=w.getZoom();if(!De)return;let qe=0,Ze=((cr=(Yt=g.options.configuration)==null?void 0:Yt.pin)==null?void 0:cr.maxCount)??Math.max(Q_,8*navigator.hardwareConcurrency),Qe=((sn=(qr=g.options.configuration)==null?void 0:qr.pin)==null?void 0:sn.maxZoom)??J_;for(const Ki of fi){const Qt=Ki.circle;pt(jt).contains(Qt.lat,Qt.lng)?De<=Qt.zoom&&Qt.zoom<=De+Qe?(qe<Ze&&(((_r=(In=pt(Mr))==null?void 0:In.pin)==null?void 0:_r.fade)==!0?Qt.updateState(De):Qt.setExpanded(),Qt.updateMap(w),Qt.isPinLoaded()==!1&&Qt.updatePin()),qe++):(Qt.setCollapsed(),Qt.isCollapsed()&&Qt.updateMap(null)):Qt.updateMap(null);const le=Ki.marker;pt(Oi).contains(le.lat,le.lng)?le.zoom<=De?(le.updateState(De),le.setCollapsed(!1),le.updateMap(w),le.isExpanded()&&le.isBodyLoaded()==!1&&le.updateBody()):(le.setCollapsed(!0),le.isCollapsed()&&le.updateMap(null)):le.updateMap(null)}}async function xn(De){try{vi=!0;const qe=new Map(De.map(Qe=>[Qe.data.id,new xi(Qe)])),Ze=Array.from(fi);for(const Qe of Ze)qe.has(Qe.id)==!1&&(Qe.remove(),or.delete(Qe.id),fi.splice(fi.indexOf(Qe),1));for(const Qe of De){const Yt=or.get(Qe.data.id);if(Yt)Yt.update(Qe);else{const cr=new xi(Qe);cr.create(),or.set(Qe.data.id,cr),fi.push(cr)}}fi.sort((Qe,Yt)=>Qe.zoom-Yt.zoom)}catch(qe){throw console.error(qe),fi.length=0,or.clear(),qe}finally{vi=!1}}function Cr(){try{vi=!0,fi.forEach(De=>De.remove()),fi.length=0,or.clear()}catch(De){throw console.error(De),fi.forEach(qe=>qe.remove()),fi.length=0,or.clear(),De}finally{vi=!1}}async function aa(De){await Qy.parseAsync(De),await xn(De)}function sa(){Cr()}function gr(De){const qe=or.get(De);qe!=null&&w.flyTo({center:{lat:qe.lat,lng:qe.lng},zoom:qe.zoom})}var Ir=ex();R_("resize",Fh,()=>w.setMinZoom(Lt(R)));var an=eu(Ir);return _s(an,De=>I=De,()=>I),Oh(()=>Xh(Ir,`--map-style-primary: ${pt(si).colors.primary??""}; --map-style-background: ${pt(si).colors.background??""}; --map-style-text: ${pt(si).colors.text??""};`)),Mf(an,"clientWidth",De=>gi(o,De)),Mf(an,"clientHeight",De=>gi(de,De)),$h(b,Ir),Qc({maplibre:Ce,on:Hi,off:ai,emit:It,getCenter:mr,getZoom:Ut,getBounds:rn,setCenter:Cn,setZoom:Lr,zoomIn:ar,zoomOut:sr,setMinZoom:_i,setMaxZoom:yn,setMaxBounds:Pt,getStyle:Fi,setStyle:Wi,getConfiguration:Sr,setConfiguration:$n,updatePopups:aa,removePopups:sa,revealPopup:gr})}function tx(b){const g=document.getElementById(b.container);if(!g)throw new Error(`Container not found: ${b.container}`);return Gh(Kf,{target:g,props:{options:b}})}function ix(b){F_(b)}Ft.Map=Kf,Ft.mountMap=tx,Ft.unmountMap=ix,Object.defineProperty(Ft,Symbol.toStringTag,{value:"Module"})});
|
|
742
|
+
${F.shaderPreludeCode.vertexSource}`,define:F.shaderDefine},defaultProjectionData:H},W=A.renderingMode?A.renderingMode:"2d";if(f.renderPass==="offscreen"){const K=A.prerender;K&&(f.setCustomLayerDefaults(),E.setColorMode(f.colorModeForRenderPass()),K.call(A,E.gl,q),E.setDirty(),f.setBaseState())}else if(f.renderPass==="translucent"){f.setCustomLayerDefaults(),E.setColorMode(f.colorModeForRenderPass()),E.setStencilMode(ht.disabled);const K=W==="3d"?f.getDepthModeFor3D():f.getDepthModeForSublayer(0,ot.ReadOnly);E.setDepthMode(K),A.render(E.gl,q),E.setDirty(),f.setBaseState(),E.bindFramebuffer.set(null)}}(e,0,s,h))}saveTileTexture(e){const i=this._tileTextures[e.size[0]];i?i.push(e):this._tileTextures[e.size[0]]=[e]}getTileTexture(e){const i=this._tileTextures[e];return i&&i.length>0?i.pop():null}isPatternMissing(e){if(!e)return!1;if(!e.from||!e.to)return!0;const i=this.imageManager.getPattern(e.from.toString()),s=this.imageManager.getPattern(e.to.toString());return!i||!s}useProgram(e,i,s=!1,l=[]){this.cache=this.cache||{};const h=!!this.style.map.terrain,f=this.style.projection,_=s?yr.projectionMercator:f.shaderPreludeCode,x=s?da:f.shaderDefine,T=e+(i?i.cacheKey:"")+`/${s?wt:f.shaderVariantName}`+(this._showOverdrawInspector?"/overdraw":"")+(h?"/terrain":"")+(l?`/${l.join("/")}`:"");return this.cache[T]||(this.cache[T]=new Io(this.context,yr[e],i,ju[e],this._showOverdrawInspector,h,_,x,l)),this.cache[T]}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 e=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(e.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new Ut(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:e,drawingBufferHeight:i}=this.context.gl;return this.width!==e||this.height!==i}}function $s(u,e){let i,s=!1,l=null,h=null;const f=()=>{l=null,s&&(u.apply(h,i),l=setTimeout(f,e),s=!1)};return(..._)=>(s=!0,h=this,i=_,l||f(),l)}class sc{constructor(e){this._getCurrentHash=()=>{const i=window.location.hash.replace("#","");if(this._hashName){let s;return i.split("&").map(l=>l.split("=")).forEach(l=>{l[0]===this._hashName&&(s=l)}),(s&&s[1]||"").split("/")}return i.split("/")},this._onHashChange=()=>{const i=this._getCurrentHash();if(!this._isValidHash(i))return!1;const s=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(i[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+i[2],+i[1]],zoom:+i[0],bearing:s,pitch:+(i[4]||0)}),!0},this._updateHashUnthrottled=()=>{const i=window.location.href.replace(/(#.*)?$/,this.getHashString());window.history.replaceState(window.history.state,null,i)},this._removeHash=()=>{const i=this._getCurrentHash();if(i.length===0)return;const s=i.join("/");let l=s;l.split("&").length>0&&(l=l.split("&")[0]),this._hashName&&(l=`${this._hashName}=${s}`);let h=window.location.hash.replace(l,"");h.startsWith("#&")?h=h.slice(0,1)+h.slice(2):h==="#"&&(h="");let f=window.location.href.replace(/(#.+)?$/,h);f=f.replace("&&","&"),window.history.replaceState(window.history.state,null,f)},this._updateHash=$s(this._updateHashUnthrottled,300),this._hashName=e&&encodeURIComponent(e)}addTo(e){return this._map=e,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),this._removeHash(),delete this._map,this}getHashString(e){const i=this._map.getCenter(),s=Math.round(100*this._map.getZoom())/100,l=Math.ceil((s*Math.LN2+Math.log(512/360/.5))/Math.LN10),h=Math.pow(10,l),f=Math.round(i.lng*h)/h,_=Math.round(i.lat*h)/h,x=this._map.getBearing(),T=this._map.getPitch();let P="";if(P+=e?`/${f}/${_}/${s}`:`${s}/${_}/${f}`,(x||T)&&(P+="/"+Math.round(10*x)/10),T&&(P+=`/${Math.round(T)}`),this._hashName){const E=this._hashName;let A=!1;const F=window.location.hash.slice(1).split("&").map(O=>{const H=O.split("=")[0];return H===E?(A=!0,`${H}=${P}`):O}).filter(O=>O);return A||F.push(`${E}=${P}`),`#${F.join("&")}`}return`#${P}`}_isValidHash(e){if(e.length<3||e.some(isNaN))return!1;try{new o.Q(+e[2],+e[1])}catch{return!1}const i=+e[0],s=+(e[3]||0),l=+(e[4]||0);return i>=this._map.getMinZoom()&&i<=this._map.getMaxZoom()&&s>=-180&&s<=180&&l>=this._map.getMinPitch()&&l<=this._map.getMaxPitch()}}const wn={linearity:.3,easing:o.cd(0,0,.3,1)},oc=o.e({deceleration:2500,maxSpeed:1400},wn),Gs=o.e({deceleration:20,maxSpeed:1400},wn),lc=o.e({deceleration:1e3,maxSpeed:360},wn),Qu=o.e({deceleration:1e3,maxSpeed:90},wn),eh=o.e({deceleration:1e3,maxSpeed:360},wn);class th{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:Ce.now(),settings:e})}_drainInertiaBuffer(){const e=this._inertiaBuffer,i=Ce.now();for(;e.length>0&&i-e[0].time>160;)e.shift()}_onMoveEnd(e){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const i={zoom:0,bearing:0,pitch:0,roll:0,pan:new o.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:h}of this._inertiaBuffer)i.zoom+=h.zoomDelta||0,i.bearing+=h.bearingDelta||0,i.pitch+=h.pitchDelta||0,i.roll+=h.rollDelta||0,h.panDelta&&i.pan._add(h.panDelta),h.around&&(i.around=h.around),h.pinchAround&&(i.pinchAround=h.pinchAround);const s=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,l={};if(i.pan.mag()){const h=Qa(i.pan.mag(),s,o.e({},oc,e||{})),f=i.pan.mult(h.amount/i.pan.mag()),_=this._map.cameraHelper.handlePanInertia(f,this._map.transform);l.center=_.easingCenter,l.offset=_.easingOffset,Ja(l,h)}if(i.zoom){const h=Qa(i.zoom,s,Gs);l.zoom=this._map.transform.zoom+h.amount,Ja(l,h)}if(i.bearing){const h=Qa(i.bearing,s,lc);l.bearing=this._map.transform.bearing+o.ae(h.amount,-179,179),Ja(l,h)}if(i.pitch){const h=Qa(i.pitch,s,Qu);l.pitch=this._map.transform.pitch+h.amount,Ja(l,h)}if(i.roll){const h=Qa(i.roll,s,eh);l.roll=this._map.transform.roll+o.ae(h.amount,-179,179),Ja(l,h)}if(l.zoom||l.bearing){const h=i.pinchAround===void 0?i.around:i.pinchAround;l.around=h?this._map.unproject(h):this._map.getCenter()}return this.clear(),o.e(l,{noMoveStart:!0})}}function Ja(u,e){(!u.duration||u.duration<e.duration)&&(u.duration=e.duration,u.easing=e.easing)}function Qa(u,e,i){const{maxSpeed:s,linearity:l,deceleration:h}=i,f=o.ae(u*l/(e/1e3),-s,s),_=Math.abs(f)/(h*l);return{easing:i.easing,duration:1e3*_,amount:f*(_/2)}}class ki extends o.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,i,s,l={}){s=s instanceof MouseEvent?s:new MouseEvent(e,s);const h=ce.mousePos(i.getCanvas(),s),f=i.unproject(h);super(e,o.e({point:h,lngLat:f,originalEvent:s},l)),this._defaultPrevented=!1,this.target=i}}class es extends o.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,i,s){const l=e==="touchend"?s.changedTouches:s.touches,h=ce.touchPos(i.getCanvasContainer(),l),f=h.map(x=>i.unproject(x)),_=h.reduce((x,T,P,E)=>x.add(T.div(E.length)),new o.P(0,0));super(e,{points:h,point:_,lngLats:f,lngLat:i.unproject(_),originalEvent:s}),this._defaultPrevented=!1}}class cc extends o.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,i,s){super(e,{originalEvent:s}),this._defaultPrevented=!1}}class ih{constructor(e,i){this._map=e,this._clickTolerance=i.clickTolerance}reset(){delete this._mousedownPos}wheel(e){return this._firePreventable(new cc(e.type,this._map,e))}mousedown(e,i){return this._mousedownPos=i,this._firePreventable(new ki(e.type,this._map,e))}mouseup(e){this._map.fire(new ki(e.type,this._map,e))}click(e,i){this._mousedownPos&&this._mousedownPos.dist(i)>=this._clickTolerance||this._map.fire(new ki(e.type,this._map,e))}dblclick(e){return this._firePreventable(new ki(e.type,this._map,e))}mouseover(e){this._map.fire(new ki(e.type,this._map,e))}mouseout(e){this._map.fire(new ki(e.type,this._map,e))}touchstart(e){return this._firePreventable(new es(e.type,this._map,e))}touchmove(e){this._map.fire(new es(e.type,this._map,e))}touchend(e){this._map.fire(new es(e.type,this._map,e))}touchcancel(e){this._map.fire(new es(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class rh{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(e){this._map.fire(new ki(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new ki("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._ignoreContextMenu||this._map.fire(new ki(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class ts{constructor(e){this._map=e}get transform(){return this._map._requestedCameraState||this._map.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(e){return this.transform.screenPointToLocation(o.P.convert(e),this._map.terrain)}}class uc{constructor(e,i){this._map=e,this._tr=new ts(e),this._el=e.getCanvasContainer(),this._container=e.getContainer(),this._clickTolerance=i.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(e,i){this.isEnabled()&&e.shiftKey&&e.button===0&&(ce.disableDrag(),this._startPos=this._lastPos=i,this._active=!0)}mousemoveWindow(e,i){if(!this._active)return;const s=i;if(this._lastPos.equals(s)||!this._box&&s.dist(this._startPos)<this._clickTolerance)return;const l=this._startPos;this._lastPos=s,this._box||(this._box=ce.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",e));const h=Math.min(l.x,s.x),f=Math.max(l.x,s.x),_=Math.min(l.y,s.y),x=Math.max(l.y,s.y);ce.setTransform(this._box,`translate(${h}px,${_}px)`),this._box.style.width=f-h+"px",this._box.style.height=x-_+"px"}mouseupWindow(e,i){if(!this._active||e.button!==0)return;const s=this._startPos,l=i;if(this.reset(),ce.suppressClick(),s.x!==l.x||s.y!==l.y)return this._map.fire(new o.l("boxzoomend",{originalEvent:e})),{cameraAnimation:h=>h.fitScreenCoordinates(s,l,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",e)}keydown(e){this._active&&e.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",e))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(ce.remove(this._box),this._box=null),ce.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(e,i){return this._map.fire(new o.l(e,{originalEvent:i}))}}function Yo(u,e){if(u.length!==e.length)throw new Error(`The number of touches and points are not equal - touches ${u.length}, points ${e.length}`);const i={};for(let s=0;s<u.length;s++)i[u[s].identifier]=e[s];return i}class nh{constructor(e){this.reset(),this.numTouches=e.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(e,i,s){(this.centroid||s.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=e.timeStamp),s.length===this.numTouches&&(this.centroid=function(l){const h=new o.P(0,0);for(const f of l)h._add(f);return h.div(l.length)}(i),this.touches=Yo(s,i)))}touchmove(e,i,s){if(this.aborted||!this.centroid)return;const l=Yo(s,i);for(const h in this.touches){const f=l[h];(!f||f.dist(this.touches[h])>30)&&(this.aborted=!0)}}touchend(e,i,s){if((!this.centroid||e.timeStamp-this.startTime>500)&&(this.aborted=!0),s.length===0){const l=!this.aborted&&this.centroid;if(this.reset(),l)return l}}}class is{constructor(e){this.singleTap=new nh(e),this.numTaps=e.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(e,i,s){this.singleTap.touchstart(e,i,s)}touchmove(e,i,s){this.singleTap.touchmove(e,i,s)}touchend(e,i,s){const l=this.singleTap.touchend(e,i,s);if(l){const h=e.timeStamp-this.lastTime<500,f=!this.lastTap||this.lastTap.dist(l)<30;if(h&&f||this.reset(),this.count++,this.lastTime=e.timeStamp,this.lastTap=l,this.count===this.numTaps)return this.reset(),l}}}class ah{constructor(e){this._tr=new ts(e),this._zoomIn=new is({numTouches:1,numTaps:2}),this._zoomOut=new is({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(e,i,s){this._zoomIn.touchstart(e,i,s),this._zoomOut.touchstart(e,i,s)}touchmove(e,i,s){this._zoomIn.touchmove(e,i,s),this._zoomOut.touchmove(e,i,s)}touchend(e,i,s){const l=this._zoomIn.touchend(e,i,s),h=this._zoomOut.touchend(e,i,s),f=this._tr;return l?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:_=>_.easeTo({duration:300,zoom:f.zoom+1,around:f.unproject(l)},{originalEvent:e})}):h?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:_=>_.easeTo({duration:300,zoom:f.zoom-1,around:f.unproject(h)},{originalEvent:e})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class dr{constructor(e){this._enabled=!!e.enable,this._moveStateManager=e.moveStateManager,this._clickTolerance=e.clickTolerance||1,this._moveFunction=e.move,this._activateOnStart=!!e.activateOnStart,e.assignEvents(this),this.reset()}reset(e){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(e)}_move(...e){const i=this._moveFunction(...e);if(i.bearingDelta||i.pitchDelta||i.rollDelta||i.around||i.panDelta)return this._active=!0,i}dragStart(e,i){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(e)&&(this._moveStateManager.startMove(e),this._lastPoint=Array.isArray(i)?i[0]:i,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(e,i){if(!this.isEnabled())return;const s=this._lastPoint;if(!s)return;if(e.preventDefault(),!this._moveStateManager.isValidMoveEvent(e))return void this.reset(e);const l=Array.isArray(i)?i[0]:i;return!this._moved&&l.dist(s)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=l,this._move(s,l))}dragEnd(e){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(e)&&(this._moved&&ce.suppressClick(),this.reset(e))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}}const on={0:1,2:2};class rs{constructor(e){this._correctEvent=e.checkCorrectEvent}startMove(e){const i=ce.mouseButton(e);this._eventButton=i}endMove(e){delete this._eventButton}isValidStartEvent(e){return this._correctEvent(e)}isValidMoveEvent(e){return!function(i,s){const l=on[s];return i.buttons===void 0||(i.buttons&l)!==l}(e,this._eventButton)}isValidEndEvent(e){return ce.mouseButton(e)===this._eventButton}}class ln{constructor(){this._firstTouch=void 0}_isOneFingerTouch(e){return e.targetTouches.length===1}_isSameTouchEvent(e){return e.targetTouches[0].identifier===this._firstTouch}startMove(e){this._firstTouch=e.targetTouches[0].identifier}endMove(e){delete this._firstTouch}isValidStartEvent(e){return this._isOneFingerTouch(e)}isValidMoveEvent(e){return this._isOneFingerTouch(e)&&this._isSameTouchEvent(e)}isValidEndEvent(e){return this._isOneFingerTouch(e)&&this._isSameTouchEvent(e)}}class ns{constructor(e=new rs({checkCorrectEvent:()=>!0}),i=new ln){this.mouseMoveStateManager=e,this.oneFingerTouchMoveStateManager=i}_executeRelevantHandler(e,i,s){return e instanceof MouseEvent?i(e):typeof TouchEvent<"u"&&e instanceof TouchEvent?s(e):void 0}startMove(e){this._executeRelevantHandler(e,i=>this.mouseMoveStateManager.startMove(i),i=>this.oneFingerTouchMoveStateManager.startMove(i))}endMove(e){this._executeRelevantHandler(e,i=>this.mouseMoveStateManager.endMove(i),i=>this.oneFingerTouchMoveStateManager.endMove(i))}isValidStartEvent(e){return this._executeRelevantHandler(e,i=>this.mouseMoveStateManager.isValidStartEvent(i),i=>this.oneFingerTouchMoveStateManager.isValidStartEvent(i))}isValidMoveEvent(e){return this._executeRelevantHandler(e,i=>this.mouseMoveStateManager.isValidMoveEvent(i),i=>this.oneFingerTouchMoveStateManager.isValidMoveEvent(i))}isValidEndEvent(e){return this._executeRelevantHandler(e,i=>this.mouseMoveStateManager.isValidEndEvent(i),i=>this.oneFingerTouchMoveStateManager.isValidEndEvent(i))}}const Jo=u=>{u.mousedown=u.dragStart,u.mousemoveWindow=u.dragMove,u.mouseup=u.dragEnd,u.contextmenu=e=>{e.preventDefault()}};class Nd{constructor(e,i){this._clickTolerance=e.clickTolerance||1,this._map=i,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new o.P(0,0)}_shouldBePrevented(e){return e<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(e,i,s){return this._calculateTransform(e,i,s)}touchmove(e,i,s){if(this._active){if(!this._shouldBePrevented(s.length))return e.preventDefault(),this._calculateTransform(e,i,s);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",e)}}touchend(e,i,s){this._calculateTransform(e,i,s),this._active&&this._shouldBePrevented(s.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(e,i,s){s.length>0&&(this._active=!0);const l=Yo(s,i),h=new o.P(0,0),f=new o.P(0,0);let _=0;for(const T in l){const P=l[T],E=this._touches[T];E&&(h._add(P),f._add(P.sub(E)),_++,l[T]=P)}if(this._touches=l,this._shouldBePrevented(_)||!f.mag())return;const x=f.div(_);return this._sum._add(x),this._sum.mag()<this._clickTolerance?void 0:{around:h.div(_),panDelta:x}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class hc{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(e,i,s){this._firstTwoTouches||s.length<2||(this._firstTwoTouches=[s[0].identifier,s[1].identifier],this._start([i[0],i[1]]))}touchmove(e,i,s){if(!this._firstTwoTouches)return;e.preventDefault();const[l,h]=this._firstTwoTouches,f=Qo(s,i,l),_=Qo(s,i,h);if(!f||!_)return;const x=this._aroundCenter?null:f.add(_).div(2);return this._move([f,_],x,e)}touchend(e,i,s){if(!this._firstTwoTouches)return;const[l,h]=this._firstTwoTouches,f=Qo(s,i,l),_=Qo(s,i,h);f&&_||(this._active&&ce.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(e){this._enabled=!0,this._aroundCenter=!!e&&e.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}}function Qo(u,e,i){for(let s=0;s<u.length;s++)if(u[s].identifier===i)return e[s]}function dc(u,e){return Math.log(u/e)/Math.LN2}class as extends hc{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(e){this._startDistance=this._distance=e[0].dist(e[1])}_move(e,i){const s=this._distance;if(this._distance=e[0].dist(e[1]),this._active||!(Math.abs(dc(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:dc(this._distance,s),pinchAround:i}}}function Tn(u,e){return 180*u.angleWith(e)/Math.PI}class $e extends hc{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(e){this._startVector=this._vector=e[0].sub(e[1]),this._minDiameter=e[0].dist(e[1])}_move(e,i,s){const l=this._vector;if(this._vector=e[0].sub(e[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:Tn(this._vector,l),pinchAround:i}}_isBelowThreshold(e){this._minDiameter=Math.min(this._minDiameter,e.mag());const i=25/(Math.PI*this._minDiameter)*360,s=Tn(e,this._startVector);return Math.abs(s)<i}}function el(u){return Math.abs(u.y)>Math.abs(u.x)}class tl extends hc{constructor(e){super(),this._currentTouchCount=0,this._map=e}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(e,i,s){super.touchstart(e,i,s),this._currentTouchCount=s.length}_start(e){this._lastPoints=e,el(e[0].sub(e[1]))&&(this._valid=!1)}_move(e,i,s){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const l=e[0].sub(this._lastPoints[0]),h=e[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(l,h,s.timeStamp),this._valid?(this._lastPoints=e,this._active=!0,{pitchDelta:(l.y+h.y)/2*-.5}):void 0}gestureBeginsVertically(e,i,s){if(this._valid!==void 0)return this._valid;const l=e.mag()>=2,h=i.mag()>=2;if(!l&&!h)return;if(!l||!h)return this._firstMove===void 0&&(this._firstMove=s),s-this._firstMove<100&&void 0;const f=e.y>0==i.y>0;return el(e)&&el(i)&&f}}const sh={panStep:100,bearingStep:15,pitchStep:10};class ss{constructor(e){this._tr=new ts(e);const i=sh;this._panStep=i.panStep,this._bearingStep=i.bearingStep,this._pitchStep=i.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;let i=0,s=0,l=0,h=0,f=0;switch(e.keyCode){case 61:case 107:case 171:case 187:i=1;break;case 189:case 109:case 173:i=-1;break;case 37:e.shiftKey?s=-1:(e.preventDefault(),h=-1);break;case 39:e.shiftKey?s=1:(e.preventDefault(),h=1);break;case 38:e.shiftKey?l=1:(e.preventDefault(),f=-1);break;case 40:e.shiftKey?l=-1:(e.preventDefault(),f=1);break;default:return}return this._rotationDisabled&&(s=0,l=0),{cameraAnimation:_=>{const x=this._tr;_.easeTo({duration:300,easeId:"keyboardHandler",easing:qs,zoom:i?Math.round(x.zoom)+i*(e.shiftKey?2:1):x.zoom,bearing:x.bearing+s*this._bearingStep,pitch:x.pitch+l*this._pitchStep,offset:[-h*this._panStep,-f*this._panStep],center:x.center},{originalEvent:e})}}}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 qs(u){return u*(2-u)}const pc=4.000244140625;class yt{constructor(e,i){this._onTimeout=s=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(s)},this._map=e,this._tr=new ts(e),this._triggerRenderFrame=i,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(e){this._defaultZoomRate=e}setWheelZoomRate(e){this._wheelZoomRate=e}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(e){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!e&&e.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(e){return!!this._map.cooperativeGestures.isEnabled()&&!(e.ctrlKey||this._map.cooperativeGestures.isBypassed(e))}wheel(e){if(!this.isEnabled())return;if(this._shouldBePrevented(e))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",e);let i=e.deltaMode===WheelEvent.DOM_DELTA_LINE?40*e.deltaY:e.deltaY;const s=Ce.now(),l=s-(this._lastWheelEventTime||0);this._lastWheelEventTime=s,i!==0&&i%pc==0?this._type="wheel":i!==0&&Math.abs(i)<4?this._type="trackpad":l>400?(this._type=null,this._lastValue=i,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(l*i)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,i+=this._lastValue)),e.shiftKey&&i&&(i/=4),this._type&&(this._lastWheelEvent=e,this._delta-=i,this._active||this._start(e)),e.preventDefault()}_start(e){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 i=ce.mousePos(this._map.getCanvas(),e),s=this._tr;this._aroundPoint=this._aroundCenter?s.transform.locationToScreenPoint(o.Q.convert(s.center)):i,this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const e=this._tr.transform;if(typeof this._lastExpectedZoom=="number"){const _=e.zoom-this._lastExpectedZoom;typeof this._startZoom=="number"&&(this._startZoom+=_),typeof this._targetZoom=="number"&&(this._targetZoom+=_)}if(this._delta!==0){const _=this._type==="wheel"&&Math.abs(this._delta)>pc?this._wheelZoomRate:this._defaultZoomRate;let x=2/(1+Math.exp(-Math.abs(this._delta*_)));this._delta<0&&x!==0&&(x=1/x);const T=typeof this._targetZoom!="number"?e.scale:o.ac(this._targetZoom);this._targetZoom=e.getConstrained(e.getCameraLngLat(),o.ah(T*x)).zoom,this._type==="wheel"&&(this._startZoom=e.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const i=typeof this._targetZoom!="number"?e.zoom:this._targetZoom,s=this._startZoom,l=this._easing;let h,f=!1;if(this._type==="wheel"&&s&&l){const _=Ce.now()-this._lastWheelEventTime,x=Math.min((_+5)/200,1),T=l(x);h=o.B.number(s,i,T),x<1?this._frameId||(this._frameId=!0):f=!0}else h=i,f=!0;return this._active=!0,f&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._lastExpectedZoom,delete this._finishTimeout},200)),this._lastExpectedZoom=h,{noInertia:!0,needsRenderFrame:!f,zoomDelta:h-e.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(e){let i=o.cf;if(this._prevEase){const s=this._prevEase,l=(Ce.now()-s.start)/s.duration,h=s.easing(l+.01)-s.easing(l),f=.27/Math.sqrt(h*h+1e-4)*.01,_=Math.sqrt(.0729-f*f);i=o.cd(f,_,.25,1)}return this._prevEase={start:Ce.now(),duration:e,easing:i},i}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,delete this._lastExpectedZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class il{constructor(e,i){this._clickZoom=e,this._tapZoom=i}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class Zd{constructor(e){this._tr=new ts(e),this.reset()}reset(){this._active=!1}dblclick(e,i){return e.preventDefault(),{cameraAnimation:s=>{s.easeTo({duration:300,zoom:this._tr.zoom+(e.shiftKey?-1:1),around:this._tr.unproject(i)},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class fc{constructor(){this._tap=new is({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(e,i,s){if(!this._swipePoint)if(this._tapTime){const l=i[0],h=e.timeStamp-this._tapTime<500,f=this._tapPoint.dist(l)<30;h&&f?s.length>0&&(this._swipePoint=l,this._swipeTouch=s[0].identifier):this.reset()}else this._tap.touchstart(e,i,s)}touchmove(e,i,s){if(this._tapTime){if(this._swipePoint){if(s[0].identifier!==this._swipeTouch)return;const l=i[0],h=l.y-this._swipePoint.y;return this._swipePoint=l,e.preventDefault(),this._active=!0,{zoomDelta:h/128}}}else this._tap.touchmove(e,i,s)}touchend(e,i,s){if(this._tapTime)this._swipePoint&&s.length===0&&this.reset();else{const l=this._tap.touchend(e,i,s);l&&(this._tapTime=e.timeStamp,this._tapPoint=l)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class oh{constructor(e,i,s){this._el=e,this._mousePan=i,this._touchPan=s}enable(e){this._inertiaOptions=e||{},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 lh{constructor(e,i,s,l){this._pitchWithRotate=e.pitchWithRotate,this._rollEnabled=e.rollEnabled,this._mouseRotate=i,this._mousePitch=s,this._mouseRoll=l}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable(),this._rollEnabled&&this._mouseRoll.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable(),this._mouseRoll.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())&&(!this._rollEnabled||this._mouseRoll.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()||this._mouseRoll.isActive()}}class mc{constructor(e,i,s,l){this._el=e,this._touchZoom=i,this._touchRotate=s,this._tapDragZoom=l,this._rotationDisabled=!1,this._enabled=!0}enable(e){this._touchZoom.enable(e),this._rotationDisabled||this._touchRotate.enable(e),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()}}class rl{constructor(e,i){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=e,this._options=i,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;const e=this._map.getCanvasContainer();e.classList.add("maplibregl-cooperative-gestures"),this._container=ce.create("div","maplibregl-cooperative-gesture-screen",e);let i=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(i=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const s=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),l=document.createElement("div");l.className="maplibregl-desktop-message",l.textContent=i,this._container.appendChild(l);const h=document.createElement("div");h.className="maplibregl-mobile-message",h.textContent=s,this._container.appendChild(h),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(ce.remove(this._container),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destroyUI()}isEnabled(){return this._enabled}isBypassed(e){return e[this._bypassKey]}notifyGestureBlocked(e,i){this._enabled&&(this._map.fire(new o.l("cooperativegestureprevented",{gestureType:e,originalEvent:i})),this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}}const Hs=u=>u.zoom||u.drag||u.roll||u.pitch||u.rotate;class Vd extends o.l{}function nl(u){return u.panDelta&&u.panDelta.mag()||u.zoomDelta||u.bearingDelta||u.pitchDelta||u.rollDelta}class Ud{constructor(e,i){this.handleWindowEvent=l=>{this.handleEvent(l,`${l.type}Window`)},this.handleEvent=(l,h)=>{if(l.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const f=l.type==="renderFrame"?void 0:l,_={needsRenderFrame:!1},x={},T={};for(const{handlerName:A,handler:F,allowed:O}of this._handlers){if(!F.isEnabled())continue;let H;if(this._blockedByActive(T,O,A))F.reset();else if(F[h||l.type]){if(o.cg(l,h||l.type)){const q=ce.mousePos(this._map.getCanvas(),l);H=F[h||l.type](l,q)}else if(o.ch(l,h||l.type)){const q=this._getMapTouches(l.touches),W=ce.touchPos(this._map.getCanvas(),q);H=F[h||l.type](l,W,q)}else o.ci(h||l.type)||(H=F[h||l.type](l));this.mergeHandlerResult(_,x,H,A,f),H&&H.needsRenderFrame&&this._triggerRenderFrame()}(H||F.isActive())&&(T[A]=F)}const P={};for(const A in this._previousActiveHandlers)T[A]||(P[A]=f);this._previousActiveHandlers=T,(Object.keys(P).length||nl(_))&&(this._changes.push([_,x,P]),this._triggerRenderFrame()),(Object.keys(T).length||nl(_))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:E}=_;E&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],E(this._map))},this._map=e,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new th(e),this._bearingSnap=i.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(i);const s=this._el;this._listeners=[[s,"touchstart",{passive:!0}],[s,"touchmove",{passive:!1}],[s,"touchend",void 0],[s,"touchcancel",void 0],[s,"mousedown",void 0],[s,"mousemove",void 0],[s,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[s,"mouseover",void 0],[s,"mouseout",void 0],[s,"dblclick",void 0],[s,"click",void 0],[s,"keydown",{capture:!1}],[s,"keyup",void 0],[s,"wheel",{passive:!1}],[s,"contextmenu",void 0],[window,"blur",void 0]];for(const[l,h,f]of this._listeners)ce.addEventListener(l,h,l===document?this.handleWindowEvent:this.handleEvent,f)}destroy(){for(const[e,i,s]of this._listeners)ce.removeEventListener(e,i,e===document?this.handleWindowEvent:this.handleEvent,s)}_addDefaultHandlers(e){const i=this._map,s=i.getCanvasContainer();this._add("mapEvent",new ih(i,e));const l=i.boxZoom=new uc(i,e);this._add("boxZoom",l),e.interactive&&e.boxZoom&&l.enable();const h=i.cooperativeGestures=new rl(i,e.cooperativeGestures);this._add("cooperativeGestures",h),e.cooperativeGestures&&h.enable();const f=new ah(i),_=new Zd(i);i.doubleClickZoom=new il(_,f),this._add("tapZoom",f),this._add("clickZoom",_),e.interactive&&e.doubleClickZoom&&i.doubleClickZoom.enable();const x=new fc;this._add("tapDragZoom",x);const T=i.touchPitch=new tl(i);this._add("touchPitch",T),e.interactive&&e.touchPitch&&i.touchPitch.enable(e.touchPitch);const P=()=>i.project(i.getCenter()),E=function({enable:ee,clickTolerance:ie,aroundCenter:se=!0,minPixelCenterThreshold:re=100,rotateDegreesPerPixelMoved:pe=.8},Me){const xe=new rs({checkCorrectEvent:ve=>ce.mouseButton(ve)===0&&ve.ctrlKey||ce.mouseButton(ve)===2&&!ve.ctrlKey});return new dr({clickTolerance:ie,move:(ve,be)=>{const Fe=Me();if(se&&Math.abs(Fe.y-ve.y)>re)return{bearingDelta:o.ce(new o.P(ve.x,be.y),be,Fe)};let Be=(be.x-ve.x)*pe;return se&&be.y<Fe.y&&(Be=-Be),{bearingDelta:Be}},moveStateManager:xe,enable:ee,assignEvents:Jo})}(e,P),A=function({enable:ee,clickTolerance:ie,pitchDegreesPerPixelMoved:se=-.5}){const re=new rs({checkCorrectEvent:pe=>ce.mouseButton(pe)===0&&pe.ctrlKey||ce.mouseButton(pe)===2});return new dr({clickTolerance:ie,move:(pe,Me)=>({pitchDelta:(Me.y-pe.y)*se}),moveStateManager:re,enable:ee,assignEvents:Jo})}(e),F=function({enable:ee,clickTolerance:ie,rollDegreesPerPixelMoved:se=.3},re){const pe=new rs({checkCorrectEvent:Me=>ce.mouseButton(Me)===2&&Me.ctrlKey});return new dr({clickTolerance:ie,move:(Me,xe)=>{const ve=re();let be=(xe.x-Me.x)*se;return xe.y<ve.y&&(be=-be),{rollDelta:be}},moveStateManager:pe,enable:ee,assignEvents:Jo})}(e,P);i.dragRotate=new lh(e,E,A,F),this._add("mouseRotate",E,["mousePitch"]),this._add("mousePitch",A,["mouseRotate","mouseRoll"]),this._add("mouseRoll",F,["mousePitch"]),e.interactive&&e.dragRotate&&i.dragRotate.enable();const O=function({enable:ee,clickTolerance:ie}){const se=new rs({checkCorrectEvent:re=>ce.mouseButton(re)===0&&!re.ctrlKey});return new dr({clickTolerance:ie,move:(re,pe)=>({around:pe,panDelta:pe.sub(re)}),activateOnStart:!0,moveStateManager:se,enable:ee,assignEvents:Jo})}(e),H=new Nd(e,i);i.dragPan=new oh(s,O,H),this._add("mousePan",O),this._add("touchPan",H,["touchZoom","touchRotate"]),e.interactive&&e.dragPan&&i.dragPan.enable(e.dragPan);const q=new $e,W=new as;i.touchZoomRotate=new mc(s,W,q,x),this._add("touchRotate",q,["touchPan","touchZoom"]),this._add("touchZoom",W,["touchPan","touchRotate"]),e.interactive&&e.touchZoomRotate&&i.touchZoomRotate.enable(e.touchZoomRotate);const K=i.scrollZoom=new yt(i,()=>this._triggerRenderFrame());this._add("scrollZoom",K,["mousePan"]),e.interactive&&e.scrollZoom&&i.scrollZoom.enable(e.scrollZoom);const te=i.keyboard=new ss(i);this._add("keyboard",te),e.interactive&&e.keyboard&&i.keyboard.enable(),this._add("blockableMapEvent",new rh(i))}_add(e,i,s){this._handlers.push({handlerName:e,handler:i,allowed:s}),this._handlersById[e]=i}stop(e){if(!this._updatingCamera){for(const{handler:i}of this._handlers)i.reset();this._inertia.clear(),this._fireEvents({},{},e),this._changes=[]}}isActive(){for(const{handler:e}of this._handlers)if(e.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!Hs(this._eventsInProgress)||this.isZooming()}_blockedByActive(e,i,s){for(const l in e)if(l!==s&&(!i||i.indexOf(l)<0))return!0;return!1}_getMapTouches(e){const i=[];for(const s of e)this._el.contains(s.target)&&i.push(s);return i}mergeHandlerResult(e,i,s,l,h){if(!s)return;o.e(e,s);const f={handlerName:l,originalEvent:s.originalEvent||h};s.zoomDelta!==void 0&&(i.zoom=f),s.panDelta!==void 0&&(i.drag=f),s.rollDelta!==void 0&&(i.roll=f),s.pitchDelta!==void 0&&(i.pitch=f),s.bearingDelta!==void 0&&(i.rotate=f)}_applyChanges(){const e={},i={},s={};for(const[l,h,f]of this._changes)l.panDelta&&(e.panDelta=(e.panDelta||new o.P(0,0))._add(l.panDelta)),l.zoomDelta&&(e.zoomDelta=(e.zoomDelta||0)+l.zoomDelta),l.bearingDelta&&(e.bearingDelta=(e.bearingDelta||0)+l.bearingDelta),l.pitchDelta&&(e.pitchDelta=(e.pitchDelta||0)+l.pitchDelta),l.rollDelta&&(e.rollDelta=(e.rollDelta||0)+l.rollDelta),l.around!==void 0&&(e.around=l.around),l.pinchAround!==void 0&&(e.pinchAround=l.pinchAround),l.noInertia&&(e.noInertia=l.noInertia),o.e(i,h),o.e(s,f);this._updateMapTransform(e,i,s),this._changes=[]}_updateMapTransform(e,i,s){const l=this._map,h=l._getTransformForUpdate(),f=l.terrain;if(!(nl(e)||f&&this._terrainMovement))return this._fireEvents(i,s,!0);l._stop(!0);let{panDelta:_,zoomDelta:x,bearingDelta:T,pitchDelta:P,rollDelta:E,around:A,pinchAround:F}=e;F!==void 0&&(A=F),A=A||l.transform.centerPoint,f&&!h.isPointOnMapSurface(A)&&(A=h.centerPoint);const O={panDelta:_,zoomDelta:x,rollDelta:E,pitchDelta:P,bearingDelta:T,around:A};this._map.cameraHelper.useGlobeControls&&!h.isPointOnMapSurface(A)&&(A=h.centerPoint);const H=A.distSqr(h.centerPoint)<.01?h.center:h.screenPointToLocation(_?A.sub(_):A);f?(this._map.cameraHelper.handleMapControlsRollPitchBearingZoom(O,h),this._terrainMovement||!i.drag&&!i.zoom?i.drag&&this._terrainMovement?h.setCenter(h.screenPointToLocation(h.centerPoint.sub(_))):this._map.cameraHelper.handleMapControlsPan(O,h,H):(this._terrainMovement=!0,this._map._elevationFreeze=!0,this._map.cameraHelper.handleMapControlsPan(O,h,H))):(this._map.cameraHelper.handleMapControlsRollPitchBearingZoom(O,h),this._map.cameraHelper.handleMapControlsPan(O,h,H)),l._applyUpdatedTransform(h),this._map._update(),e.noInertia||this._inertia.record(e),this._fireEvents(i,s,!0)}_fireEvents(e,i,s){const l=Hs(this._eventsInProgress),h=Hs(e),f={};for(const E in e){const{originalEvent:A}=e[E];this._eventsInProgress[E]||(f[`${E}start`]=A),this._eventsInProgress[E]=e[E]}!l&&h&&this._fireEvent("movestart",h.originalEvent);for(const E in f)this._fireEvent(E,f[E]);h&&this._fireEvent("move",h.originalEvent);for(const E in e){const{originalEvent:A}=e[E];this._fireEvent(E,A)}const _={};let x;for(const E in this._eventsInProgress){const{handlerName:A,originalEvent:F}=this._eventsInProgress[E];this._handlersById[A].isActive()||(delete this._eventsInProgress[E],x=i[A]||F,_[`${E}end`]=x)}for(const E in _)this._fireEvent(E,_[E]);const T=Hs(this._eventsInProgress),P=(l||h)&&!T;if(P&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;const E=this._map._getTransformForUpdate();this._map.getCenterClampedToGround()&&E.recalculateZoomAndCenter(this._map.terrain),this._map._applyUpdatedTransform(E)}if(s&&P){this._updatingCamera=!0;const E=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),A=F=>F!==0&&-this._bearingSnap<F&&F<this._bearingSnap;!E||!E.essential&&Ce.prefersReducedMotion?(this._map.fire(new o.l("moveend",{originalEvent:x})),A(this._map.getBearing())&&this._map.resetNorth()):(A(E.bearing||this._map.getBearing())&&(E.bearing=0),E.freezeElevation=!0,this._map.easeTo(E,{originalEvent:x})),this._updatingCamera=!1}}_fireEvent(e,i){this._map.fire(new o.l(e,i?{originalEvent:i}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(e=>{delete this._frameId,this.handleEvent(new Vd("renderFrame",{timeStamp:e})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class $d extends o.E{constructor(e,i,s){super(),this._renderFrameCallback=()=>{const l=Math.min((Ce.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(l)),l<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=e,this._bearingSnap=s.bearingSnap,this.cameraHelper=i,this.on("moveend",()=>{delete this._requestedCameraState})}migrateProjection(e,i){e.apply(this.transform),this.transform=e,this.cameraHelper=i}getCenter(){return new o.Q(this.transform.center.lng,this.transform.center.lat)}setCenter(e,i){return this.jumpTo({center:e},i)}getCenterElevation(){return this.transform.elevation}setCenterElevation(e,i){return this.jumpTo({elevation:e},i),this}getCenterClampedToGround(){return this._centerClampedToGround}setCenterClampedToGround(e){this._centerClampedToGround=e}panBy(e,i,s){return e=o.P.convert(e).mult(-1),this.panTo(this.transform.center,o.e({offset:e},i),s)}panTo(e,i,s){return this.easeTo(o.e({center:e},i),s)}getZoom(){return this.transform.zoom}setZoom(e,i){return this.jumpTo({zoom:e},i),this}zoomTo(e,i,s){return this.easeTo(o.e({zoom:e},i),s)}zoomIn(e,i){return this.zoomTo(this.getZoom()+1,e,i),this}zoomOut(e,i){return this.zoomTo(this.getZoom()-1,e,i),this}getVerticalFieldOfView(){return this.transform.fov}setVerticalFieldOfView(e,i){return e!=this.transform.fov&&(this.transform.setFov(e),this.fire(new o.l("movestart",i)).fire(new o.l("move",i)).fire(new o.l("moveend",i))),this}getBearing(){return this.transform.bearing}setBearing(e,i){return this.jumpTo({bearing:e},i),this}getPadding(){return this.transform.padding}setPadding(e,i){return this.jumpTo({padding:e},i),this}rotateTo(e,i,s){return this.easeTo(o.e({bearing:e},i),s)}resetNorth(e,i){return this.rotateTo(0,o.e({duration:1e3},e),i),this}resetNorthPitch(e,i){return this.easeTo(o.e({bearing:0,pitch:0,roll:0,duration:1e3},e),i),this}snapToNorth(e,i){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(e,i):this}getPitch(){return this.transform.pitch}setPitch(e,i){return this.jumpTo({pitch:e},i),this}getRoll(){return this.transform.roll}setRoll(e,i){return this.jumpTo({roll:e},i),this}cameraForBounds(e,i){e=jt.convert(e).adjustAntiMeridian();const s=i&&i.bearing||0;return this._cameraForBoxAndBearing(e.getNorthWest(),e.getSouthEast(),s,i)}_cameraForBoxAndBearing(e,i,s,l){const h={top:0,bottom:0,right:0,left:0};if(typeof(l=o.e({padding:h,offset:[0,0],maxZoom:this.transform.maxZoom},l)).padding=="number"){const T=l.padding;l.padding={top:T,bottom:T,right:T,left:T}}const f=o.e(h,l.padding);l.padding=f;const _=this.transform,x=new jt(e,i);return this.cameraHelper.cameraForBoxAndBearing(l,f,x,s,_)}fitBounds(e,i,s){return this._fitInternal(this.cameraForBounds(e,i),i,s)}fitScreenCoordinates(e,i,s,l,h){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.screenPointToLocation(o.P.convert(e)),this.transform.screenPointToLocation(o.P.convert(i)),s,l),l,h)}_fitInternal(e,i,s){return e?(delete(i=o.e(e,i)).padding,i.linear?this.easeTo(i,s):this.flyTo(i,s)):this}jumpTo(e,i){this.stop();const s=this._getTransformForUpdate();let l=!1,h=!1,f=!1;const _=s.zoom;this.cameraHelper.handleJumpToCenterZoom(s,e);const x=s.zoom!==_;return"elevation"in e&&s.elevation!==+e.elevation&&s.setElevation(+e.elevation),"bearing"in e&&s.bearing!==+e.bearing&&(l=!0,s.setBearing(+e.bearing)),"pitch"in e&&s.pitch!==+e.pitch&&(h=!0,s.setPitch(+e.pitch)),"roll"in e&&s.roll!==+e.roll&&(f=!0,s.setRoll(+e.roll)),e.padding==null||s.isPaddingEqual(e.padding)||s.setPadding(e.padding),this._applyUpdatedTransform(s),this.fire(new o.l("movestart",i)).fire(new o.l("move",i)),x&&this.fire(new o.l("zoomstart",i)).fire(new o.l("zoom",i)).fire(new o.l("zoomend",i)),l&&this.fire(new o.l("rotatestart",i)).fire(new o.l("rotate",i)).fire(new o.l("rotateend",i)),h&&this.fire(new o.l("pitchstart",i)).fire(new o.l("pitch",i)).fire(new o.l("pitchend",i)),f&&this.fire(new o.l("rollstart",i)).fire(new o.l("roll",i)).fire(new o.l("rollend",i)),this.fire(new o.l("moveend",i))}calculateCameraOptionsFromTo(e,i,s,l=0){const h=o.$.fromLngLat(e,i),f=o.$.fromLngLat(s,l),_=f.x-h.x,x=f.y-h.y,T=f.z-h.z,P=Math.hypot(_,x,T);if(P===0)throw new Error("Can't calculate camera options with same From and To");const E=Math.hypot(_,x),A=o.ah(this.transform.cameraToCenterDistance/P/this.transform.tileSize),F=180*Math.atan2(_,-x)/Math.PI;let O=180*Math.acos(E/P)/Math.PI;return O=T<0?90-O:90+O,{center:f.toLngLat(),elevation:l,zoom:A,pitch:O,bearing:F}}calculateCameraOptionsFromCameraLngLatAltRotation(e,i,s,l,h){const f=this.transform.calculateCenterFromCameraLngLatAlt(e,i,s,l);return{center:f.center,elevation:f.elevation,zoom:f.zoom,bearing:s,pitch:l,roll:h}}easeTo(e,i){this._stop(!1,e.easeId),((e=o.e({offset:[0,0],duration:500,easing:o.cf},e)).animate===!1||!e.essential&&Ce.prefersReducedMotion)&&(e.duration=0);const s=this._getTransformForUpdate(),l=this.getBearing(),h=s.pitch,f=s.roll,_="bearing"in e?this._normalizeBearing(e.bearing,l):l,x="pitch"in e?+e.pitch:h,T="roll"in e?this._normalizeBearing(e.roll,f):f,P="padding"in e?e.padding:s.padding,E=o.P.convert(e.offset);let A,F;e.around&&(A=o.Q.convert(e.around),F=s.locationToScreenPoint(A));const O={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching,rolling:this._rolling},H=this.cameraHelper.handleEaseTo(s,{bearing:_,pitch:x,roll:T,padding:P,around:A,aroundPoint:F,offsetAsPoint:E,offset:e.offset,zoom:e.zoom,center:e.center});return this._rotating=this._rotating||l!==_,this._pitching=this._pitching||x!==h,this._rolling=this._rolling||T!==f,this._padding=!s.isPaddingEqual(P),this._zooming=this._zooming||H.isZooming,this._easeId=e.easeId,this._prepareEase(i,e.noMoveStart,O),this.terrain&&this._prepareElevation(H.elevationCenter),this._ease(q=>{H.easeFunc(q),this.terrain&&!e.freezeElevation&&this._updateElevation(q),this._applyUpdatedTransform(s),this._fireMoveEvents(i)},q=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(i,q)},e),this}_prepareEase(e,i,s={}){this._moving=!0,i||s.moving||this.fire(new o.l("movestart",e)),this._zooming&&!s.zooming&&this.fire(new o.l("zoomstart",e)),this._rotating&&!s.rotating&&this.fire(new o.l("rotatestart",e)),this._pitching&&!s.pitching&&this.fire(new o.l("pitchstart",e)),this._rolling&&!s.rolling&&this.fire(new o.l("rollstart",e))}_prepareElevation(e){this._elevationCenter=e,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(e,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(e){this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom));const i=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(e<1&&i!==this._elevationTarget){const s=this._elevationTarget-this._elevationStart;this._elevationStart+=e*(s-(i-(s*e+this._elevationStart))/(1-e)),this._elevationTarget=i}this.transform.setElevation(o.B.number(this._elevationStart,this._elevationTarget,e))}_finalizeElevation(){this._elevationFreeze=!1,this.getCenterClampedToGround()&&this.transform.recalculateZoomAndCenter(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate||this.terrain?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_elevateCameraIfInsideTerrain(e){if(!this.terrain&&e.elevation>=0&&e.pitch<=90)return{};const i=e.getCameraLngLat(),s=e.getCameraAltitude(),l=this.terrain?this.terrain.getElevationForLngLatZoom(i,e.zoom):0;if(s<l){const h=this.calculateCameraOptionsFromTo(i,l,e.center,e.elevation);return{pitch:h.pitch,zoom:h.zoom}}return{}}_applyUpdatedTransform(e){const i=[];if(i.push(l=>this._elevateCameraIfInsideTerrain(l)),this.transformCameraUpdate&&i.push(l=>this.transformCameraUpdate(l)),!i.length)return;const s=e.clone();for(const l of i){const h=s.clone(),{center:f,zoom:_,roll:x,pitch:T,bearing:P,elevation:E}=l(h);f&&h.setCenter(f),E!==void 0&&h.setElevation(E),_!==void 0&&h.setZoom(_),x!==void 0&&h.setRoll(x),T!==void 0&&h.setPitch(T),P!==void 0&&h.setBearing(P),s.apply(h)}this.transform.apply(s)}_fireMoveEvents(e){this.fire(new o.l("move",e)),this._zooming&&this.fire(new o.l("zoom",e)),this._rotating&&this.fire(new o.l("rotate",e)),this._pitching&&this.fire(new o.l("pitch",e)),this._rolling&&this.fire(new o.l("roll",e))}_afterEase(e,i){if(this._easeId&&i&&this._easeId===i)return;delete this._easeId;const s=this._zooming,l=this._rotating,h=this._pitching,f=this._rolling;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._rolling=!1,this._padding=!1,s&&this.fire(new o.l("zoomend",e)),l&&this.fire(new o.l("rotateend",e)),h&&this.fire(new o.l("pitchend",e)),f&&this.fire(new o.l("rollend",e)),this.fire(new o.l("moveend",e))}flyTo(e,i){if(!e.essential&&Ce.prefersReducedMotion){const be=o.O(e,["center","zoom","bearing","pitch","roll","elevation"]);return this.jumpTo(be,i)}this.stop(),e=o.e({offset:[0,0],speed:1.2,curve:1.42,easing:o.cf},e);const s=this._getTransformForUpdate(),l=s.bearing,h=s.pitch,f=s.roll,_=s.padding,x="bearing"in e?this._normalizeBearing(e.bearing,l):l,T="pitch"in e?+e.pitch:h,P="roll"in e?this._normalizeBearing(e.roll,f):f,E="padding"in e?e.padding:s.padding,A=o.P.convert(e.offset);let F=s.centerPoint.add(A);const O=s.screenPointToLocation(F),H=this.cameraHelper.handleFlyTo(s,{bearing:x,pitch:T,roll:P,padding:E,locationAtOffset:O,offsetAsPoint:A,center:e.center,minZoom:e.minZoom,zoom:e.zoom});let q=e.curve;const W=Math.max(s.width,s.height),K=W/H.scaleOfZoom,te=H.pixelPathLength;typeof H.scaleOfMinZoom=="number"&&(q=Math.sqrt(W/H.scaleOfMinZoom/te*2));const ee=q*q;function ie(be){const Fe=(K*K-W*W+(be?-1:1)*ee*ee*te*te)/(2*(be?K:W)*ee*te);return Math.log(Math.sqrt(Fe*Fe+1)-Fe)}function se(be){return(Math.exp(be)-Math.exp(-be))/2}function re(be){return(Math.exp(be)+Math.exp(-be))/2}const pe=ie(!1);let Me=function(be){return re(pe)/re(pe+q*be)},xe=function(be){return W*((re(pe)*(se(Fe=pe+q*be)/re(Fe))-se(pe))/ee)/te;var Fe},ve=(ie(!0)-pe)/q;if(Math.abs(te)<2e-6||!isFinite(ve)){if(Math.abs(W-K)<1e-6)return this.easeTo(e,i);const be=K<W?-1:1;ve=Math.abs(Math.log(K/W))/q,xe=()=>0,Me=Fe=>Math.exp(be*q*Fe)}return e.duration="duration"in e?+e.duration:1e3*ve/("screenSpeed"in e?+e.screenSpeed/q:+e.speed),e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=l!==x,this._pitching=T!==h,this._rolling=P!==f,this._padding=!s.isPaddingEqual(E),this._prepareEase(i,!1),this.terrain&&this._prepareElevation(H.targetCenter),this._ease(be=>{const Fe=be*ve,Be=1/Me(Fe),ke=xe(Fe);this._rotating&&s.setBearing(o.B.number(l,x,be)),this._pitching&&s.setPitch(o.B.number(h,T,be)),this._rolling&&s.setRoll(o.B.number(f,P,be)),this._padding&&(s.interpolatePadding(_,E,be),F=s.centerPoint.add(A)),H.easeFunc(be,Be,ke,F),this.terrain&&!e.freezeElevation&&this._updateElevation(be),this._applyUpdatedTransform(s),this._fireMoveEvents(i)},()=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(i)},e),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(e,i){var s;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const l=this._onEaseEnd;delete this._onEaseEnd,l.call(this,i)}return e||(s=this.handlers)===null||s===void 0||s.stop(!1),this}_ease(e,i,s){s.animate===!1||s.duration===0?(e(1),i()):(this._easeStart=Ce.now(),this._easeOptions=s,this._onEaseFrame=e,this._onEaseEnd=i,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(e,i){e=o.aL(e,-180,180);const s=Math.abs(e-i);return Math.abs(e-360-i)<s&&(e-=360),Math.abs(e+360-i)<s&&(e+=360),e}queryTerrainElevation(e){return this.terrain?this.terrain.getElevationForLngLatZoom(o.Q.convert(e),this.transform.tileZoom):null}}const zn={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class qt{constructor(e=zn){this._toggleAttribution=()=>{this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))},this._updateData=i=>{!i||i.sourceDataType!=="metadata"&&i.sourceDataType!=="visibility"&&i.dataType!=="style"&&i.type!=="terrain"||this._updateAttributions()},this._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"))},this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},this.options=e}getDefaultPosition(){return"bottom-right"}onAdd(e){return this._map=e,this._compact=this.options.compact,this._container=ce.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=ce.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=ce.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(){ce.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(e,i){const s=this._map._getUIString(`AttributionControl.${i}`);e.title=s,e.setAttribute("aria-label",s)}_updateAttributions(){if(!this._map.style)return;let e=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?e=e.concat(this.options.customAttribution.map(l=>typeof l!="string"?"":l)):typeof this.options.customAttribution=="string"&&e.push(this.options.customAttribution)),this._map.style.stylesheet){const l=this._map.style.stylesheet;this.styleOwner=l.owner,this.styleId=l.id}const i=this._map.style.sourceCaches;for(const l in i){const h=i[l];if(h.used||h.usedForTerrain){const f=h.getSource();f.attribution&&e.indexOf(f.attribution)<0&&e.push(f.attribution)}}e=e.filter(l=>String(l).trim()),e.sort((l,h)=>l.length-h.length),e=e.filter((l,h)=>{for(let f=h+1;f<e.length;f++)if(e[f].indexOf(l)>=0)return!1;return!0});const s=e.join(" | ");s!==this._attribHTML&&(this._attribHTML=s,e.length?(this._innerContainer.innerHTML=ce.sanitize(s),this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class Ws{constructor(e={}){this._updateCompact=()=>{const i=this._container.children;if(i.length){const s=i[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&s.classList.add("maplibregl-compact"):s.classList.remove("maplibregl-compact")}},this.options=e}getDefaultPosition(){return"bottom-left"}onAdd(e){this._map=e,this._compact=this.options&&this.options.compact,this._container=ce.create("div","maplibregl-ctrl");const i=ce.create("a","maplibregl-ctrl-logo");return i.target="_blank",i.rel="noopener nofollow",i.href="https://maplibre.org/",i.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),i.setAttribute("rel","noopener nofollow"),this._container.appendChild(i),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){ce.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class gc{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(e){const i=++this._id;return this._queue.push({callback:e,id:i,cancelled:!1}),i}remove(e){const i=this._currentlyRunning,s=i?this._queue.concat(i):this._queue;for(const l of s)if(l.id===e)return void(l.cancelled=!0)}run(e=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const i=this._currentlyRunning=this._queue;this._queue=[];for(const s of i)if(!s.cancelled&&(s.callback(e),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var ch=o.aG([{name:"a_pos3d",type:"Int16",components:3}]);class uh extends o.E{constructor(e){super(),this._lastTilesetChange=Ce.now(),this.sourceCache=e,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.deltaZoom=1,this.tileSize=e._source.tileSize*2**this.deltaZoom,e.usedForTerrain=!0,e.tileSize=this.tileSize}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(e,i){this.sourceCache.update(e,i),this._renderableTilesKeys=[];const s={};for(const l of oe(e,{tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:i,calculateTileZoom:this.sourceCache._source.calculateTileZoom}))s[l.key]=!0,this._renderableTilesKeys.push(l.key),this._tiles[l.key]||(l.terrainRttPosMatrix32f=new Float64Array(16),o.bQ(l.terrainRttPosMatrix32f,0,o.Z,o.Z,0,0,1),this._tiles[l.key]=new qr(l,this.tileSize),this._lastTilesetChange=Ce.now());for(const l in this._tiles)s[l]||delete this._tiles[l]}freeRtt(e){for(const i in this._tiles){const s=this._tiles[i];(!e||s.tileID.equals(e)||s.tileID.isChildOf(e)||e.isChildOf(s.tileID))&&(s.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(e=>this.getTileByID(e))}getTileByID(e){return this._tiles[e]}getTerrainCoords(e,i){return i?this._getTerrainCoordsForTileRanges(e,i):this._getTerrainCoordsForRegularTile(e)}_getTerrainCoordsForRegularTile(e){const i={};for(const s of this._renderableTilesKeys){const l=this._tiles[s].tileID,h=e.clone(),f=o.b2();if(l.canonical.equals(e.canonical))o.bQ(f,0,o.Z,o.Z,0,0,1);else if(l.canonical.isChildOf(e.canonical)){const _=l.canonical.z-e.canonical.z,x=l.canonical.x-(l.canonical.x>>_<<_),T=l.canonical.y-(l.canonical.y>>_<<_),P=o.Z>>_;o.bQ(f,0,P,P,0,0,1),o.L(f,f,[-x*P,-T*P,0])}else{if(!e.canonical.isChildOf(l.canonical))continue;{const _=e.canonical.z-l.canonical.z,x=e.canonical.x-(e.canonical.x>>_<<_),T=e.canonical.y-(e.canonical.y>>_<<_),P=o.Z>>_;o.bQ(f,0,o.Z,o.Z,0,0,1),o.L(f,f,[x*P,T*P,0]),o.M(f,f,[1/2**_,1/2**_,0])}}h.terrainRttPosMatrix32f=new Float32Array(f),i[s]=h}return i}_getTerrainCoordsForTileRanges(e,i){const s={};for(const l of this._renderableTilesKeys){const h=this._tiles[l].tileID;if(!this._isWithinTileRanges(h,i))continue;const f=e.clone(),_=o.b2();if(h.canonical.z===e.canonical.z){const x=e.canonical.x-h.canonical.x,T=e.canonical.y-h.canonical.y;o.bQ(_,0,o.Z,o.Z,0,0,1),o.L(_,_,[x*o.Z,T*o.Z,0])}else if(h.canonical.z>e.canonical.z){const x=h.canonical.z-e.canonical.z,T=h.canonical.x-(h.canonical.x>>x<<x),P=h.canonical.y-(h.canonical.y>>x<<x),E=e.canonical.x-(h.canonical.x>>x),A=e.canonical.y-(h.canonical.y>>x),F=o.Z>>x;o.bQ(_,0,F,F,0,0,1),o.L(_,_,[-T*F+E*o.Z,-P*F+A*o.Z,0])}else{const x=e.canonical.z-h.canonical.z,T=e.canonical.x-(e.canonical.x>>x<<x),P=e.canonical.y-(e.canonical.y>>x<<x),E=(e.canonical.x>>x)-h.canonical.x,A=(e.canonical.y>>x)-h.canonical.y,F=o.Z<<x;o.bQ(_,0,F,F,0,0,1),o.L(_,_,[T*o.Z+E*F,P*o.Z+A*F,0])}f.terrainRttPosMatrix32f=new Float32Array(_),s[l]=f}return s}getSourceTile(e,i){const s=this.sourceCache._source;let l=e.overscaledZ-this.deltaZoom;if(l>s.maxzoom&&(l=s.maxzoom),l<s.minzoom)return null;this._sourceTileCache[e.key]||(this._sourceTileCache[e.key]=e.scaledTo(l).key);let h=this.sourceCache.getTileByID(this._sourceTileCache[e.key]);if((!h||!h.dem)&&i)for(;l>=s.minzoom&&(!h||!h.dem);)h=this.sourceCache.getTileByID(e.scaledTo(l--).key);return h}anyTilesAfterTime(e=Date.now()){return this._lastTilesetChange>=e}_isWithinTileRanges(e,i){return i[e.canonical.z]&&e.canonical.x>=i[e.canonical.z].minTileX&&e.canonical.x<=i[e.canonical.z].maxTileX&&e.canonical.y>=i[e.canonical.z].minTileY&&e.canonical.y<=i[e.canonical.z].maxTileY}}class hh{constructor(e,i,s){this._meshCache={},this.painter=e,this.sourceCache=new uh(i),this.options=s,this.exaggeration=typeof s.exaggeration=="number"?s.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(e,i,s,l=o.Z){var h;if(!(i>=0&&i<l&&s>=0&&s<l))return 0;const f=this.getTerrainData(e),_=(h=f.tile)===null||h===void 0?void 0:h.dem;if(!_)return 0;const x=o.cj([],[i/l*o.Z,s/l*o.Z],f.u_terrain_matrix),T=[x[0]*_.dim,x[1]*_.dim],P=Math.floor(T[0]),E=Math.floor(T[1]),A=T[0]-P,F=T[1]-E;return _.get(P,E)*(1-A)*(1-F)+_.get(P+1,E)*A*(1-F)+_.get(P,E+1)*(1-A)*F+_.get(P+1,E+1)*A*F}getElevationForLngLatZoom(e,i){if(!o.ck(i,e.wrap()))return 0;const{tileID:s,mercatorX:l,mercatorY:h}=this._getOverscaledTileIDFromLngLatZoom(e,i);return this.getElevation(s,l%o.Z,h%o.Z,o.Z)}getElevation(e,i,s,l=o.Z){return this.getDEMElevation(e,i,s,l)*this.exaggeration}getTerrainData(e){if(!this._emptyDemTexture){const l=this.painter.context,h=new o.R({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new Ut(l,h,l.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new Ut(l,new o.R({width:1,height:1}),l.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(l.gl.NEAREST,l.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=o.ad([])}const i=this.sourceCache.getSourceTile(e,!0);if(i&&i.dem&&(!i.demTexture||i.needsTerrainPrepare)){const l=this.painter.context;i.demTexture=this.painter.getTileTexture(i.dem.stride),i.demTexture?i.demTexture.update(i.dem.getPixels(),{premultiply:!1}):i.demTexture=new Ut(l,i.dem.getPixels(),l.gl.RGBA,{premultiply:!1}),i.demTexture.bind(l.gl.NEAREST,l.gl.CLAMP_TO_EDGE),i.needsTerrainPrepare=!1}const s=i&&i+i.tileID.key+e.key;if(s&&!this._demMatrixCache[s]){const l=this.sourceCache.sourceCache._source.maxzoom;let h=e.canonical.z-i.tileID.canonical.z;e.overscaledZ>e.canonical.z&&(e.canonical.z>=l?h=e.canonical.z-l:o.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const f=e.canonical.x-(e.canonical.x>>h<<h),_=e.canonical.y-(e.canonical.y>>h<<h),x=o.cl(new Float64Array(16),[1/(o.Z<<h),1/(o.Z<<h),0]);o.L(x,x,[f*o.Z,_*o.Z,0]),this._demMatrixCache[e.key]={matrix:x,coord:e}}return{u_depth:2,u_terrain:3,u_terrain_dim:i&&i.dem&&i.dem.dim||1,u_terrain_matrix:s?this._demMatrixCache[e.key].matrix:this._emptyDemMatrix,u_terrain_unpack:i&&i.dem&&i.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(i&&i.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:i}}getFramebuffer(e){const i=this.painter,s=i.width/devicePixelRatio,l=i.height/devicePixelRatio;return!this._fbo||this._fbo.width===s&&this._fbo.height===l||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new Ut(i.context,{width:s,height:l,data:null},i.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(i.context.gl.NEAREST,i.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new Ut(i.context,{width:s,height:l,data:null},i.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(i.context.gl.NEAREST,i.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=i.context.createFramebuffer(s,l,!0,!1),this._fbo.depthAttachment.set(i.context.createRenderbuffer(i.context.gl.DEPTH_COMPONENT16,s,l))),this._fbo.colorAttachment.set(e==="coords"?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){const e=this.painter.context;if(this._coordsTexture)return this._coordsTexture;const i=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let h=0,f=0;h<this._coordsTextureSize;h++)for(let _=0;_<this._coordsTextureSize;_++,f+=4)i[f+0]=255&_,i[f+1]=255&h,i[f+2]=_>>8<<4|h>>8,i[f+3]=0;const s=new o.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(i.buffer)),l=new Ut(e,s,e.gl.RGBA,{premultiply:!1});return l.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),this._coordsTexture=l,l}pointCoordinate(e){this.painter.maybeDrawDepthAndCoords(!0);const i=new Uint8Array(4),s=this.painter.context,l=s.gl,h=Math.round(e.x*this.painter.pixelRatio/devicePixelRatio),f=Math.round(e.y*this.painter.pixelRatio/devicePixelRatio),_=Math.round(this.painter.height/devicePixelRatio);s.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),l.readPixels(h,_-f-1,1,1,l.RGBA,l.UNSIGNED_BYTE,i),s.bindFramebuffer.set(null);const x=i[0]+(i[2]>>4<<8),T=i[1]+((15&i[2])<<8),P=this.coordsIndex[255-i[3]],E=P&&this.sourceCache.getTileByID(P);if(!E)return null;const A=this._coordsTextureSize,F=(1<<E.tileID.canonical.z)*A;return new o.$((E.tileID.canonical.x*A+x)/F+E.tileID.wrap,(E.tileID.canonical.y*A+T)/F,this.getElevation(E.tileID,x,T,A))}depthAtPoint(e){const i=new Uint8Array(4),s=this.painter.context,l=s.gl;return s.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer),l.readPixels(e.x,this.painter.height/devicePixelRatio-e.y-1,1,1,l.RGBA,l.UNSIGNED_BYTE,i),s.bindFramebuffer.set(null),(i[0]/16777216+i[1]/65536+i[2]/256+i[3])/256}getTerrainMesh(e){var i;const s=((i=this.painter.style.projection)===null||i===void 0?void 0:i.transitionState)>0,l=s&&e.canonical.y===0,h=s&&e.canonical.y===(1<<e.canonical.z)-1,f=`m_${l?"n":""}_${h?"s":""}`;if(this._meshCache[f])return this._meshCache[f];const _=this.painter.context,x=new o.cm,T=new o.aK,P=this.meshSize,E=o.Z/P,A=P*P;for(let re=0;re<=P;re++)for(let pe=0;pe<=P;pe++)x.emplaceBack(pe*E,re*E,0);for(let re=0;re<A;re+=P+1)for(let pe=0;pe<P;pe++)T.emplaceBack(pe+re,P+pe+re+1,P+pe+re+2),T.emplaceBack(pe+re,P+pe+re+2,pe+re+1);const F=x.length,O=F+(P+1),H=(P+1)*P,q=l?o.b9:0,W=l?0:1,K=h?o.ba:o.Z,te=h?0:1;for(let re=0;re<=P;re++)x.emplaceBack(re*E,q,W);for(let re=0;re<=P;re++)x.emplaceBack(re*E,K,te);for(let re=0;re<P;re++)T.emplaceBack(H+re,O+re,O+re+1),T.emplaceBack(H+re,O+re+1,H+re+1),T.emplaceBack(0+re,F+re+1,F+re),T.emplaceBack(0+re,0+re+1,F+re+1);const ee=x.length,ie=ee+2*(P+1);for(const re of[0,1])for(let pe=0;pe<=P;pe++)for(const Me of[0,1])x.emplaceBack(re*o.Z,pe*E,Me);for(let re=0;re<2*P;re+=2)T.emplaceBack(ee+re,ee+re+1,ee+re+3),T.emplaceBack(ee+re,ee+re+3,ee+re+2),T.emplaceBack(ie+re,ie+re+3,ie+re+1),T.emplaceBack(ie+re,ie+re+2,ie+re+3);const se=new Va(_.createVertexBuffer(x,ch.members),_.createIndexBuffer(T),o.aJ.simpleSegment(0,0,x.length,T.length));return this._meshCache[f]=se,se}getMeshFrameDelta(e){return 2*Math.PI*o.bu/Math.pow(2,Math.max(e,0))/5}getMinTileElevationForLngLatZoom(e,i){var s;const{tileID:l}=this._getOverscaledTileIDFromLngLatZoom(e,i);return(s=this.getMinMaxElevation(l).minElevation)!==null&&s!==void 0?s:0}getMinMaxElevation(e){const i=this.getTerrainData(e).tile,s={minElevation:null,maxElevation:null};return i&&i.dem&&(s.minElevation=i.dem.min*this.exaggeration,s.maxElevation=i.dem.max*this.exaggeration),s}_getOverscaledTileIDFromLngLatZoom(e,i){const s=o.$.fromLngLat(e.wrap()),l=(1<<i)*o.Z,h=s.x*l,f=s.y*l,_=Math.floor(h/o.Z),x=Math.floor(f/o.Z);return{tileID:new o.Y(i,0,i,_,x),mercatorX:h,mercatorY:f}}}class Gd{constructor(e,i,s){this._context=e,this._size=i,this._tileSize=s,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(const e of this._objects)e.texture.destroy(),e.fbo.destroy()}_createObject(e){const i=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),s=new Ut(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return s.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),this._context.extTextureFilterAnisotropic&&this._context.gl.texParameterf(this._context.gl.TEXTURE_2D,this._context.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,this._context.extTextureFilterAnisotropicMax),i.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),i.colorAttachment.set(s.texture),{id:e,fbo:i,texture:s,stamp:-1,inUse:!1}}getObjectForId(e){return this._objects[e]}useObject(e){e.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter(i=>e.id!==i),this._recentlyUsed.push(e.id)}stampObject(e){e.stamp=++this._stamp}getOrCreateFreeObject(){for(const i of this._recentlyUsed)if(!this._objects[i].inUse)return this._objects[i];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const e=this._createObject(this._objects.length);return this._objects.push(e),e}freeObject(e){e.inUse=!1}freeAllObjects(){for(const e of this._objects)this.freeObject(e)}isFull(){return!(this._objects.length<this._size)&&this._objects.some(e=>!e.inUse)===!1}}const br={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class al{constructor(e,i){this.painter=e,this.terrain=i,this.pool=new Gd(e.context,30,i.sourceCache.tileSize*i.qualityFactor)}destruct(){this.pool.destruct()}getTexture(e){return this.pool.getObjectForId(e.rtt[this._stacks.length-1].id).texture}prepareForRender(e,i){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=e._order.filter(s=>!e._layers[s].isHidden(i)),this._coordsAscending={};for(const s in e.sourceCaches){this._coordsAscending[s]={};const l=e.sourceCaches[s].getVisibleCoordinates(),h=e.sourceCaches[s].getSource(),f=h instanceof gr?h.terrainTileRanges:null;for(const _ of l){const x=this.terrain.sourceCache.getTerrainCoords(_,f);for(const T in x)this._coordsAscending[s][T]||(this._coordsAscending[s][T]=[]),this._coordsAscending[s][T].push(x[T])}}this._coordsAscendingStr={};for(const s of e._order){const l=e._layers[s],h=l.source;if(br[l.type]&&!this._coordsAscendingStr[h]){this._coordsAscendingStr[h]={};for(const f in this._coordsAscending[h])this._coordsAscendingStr[h][f]=this._coordsAscending[h][f].map(_=>_.key).sort().join()}}for(const s of this._renderableTiles)for(const l in this._coordsAscendingStr){const h=this._coordsAscendingStr[l][s.tileID.key];h&&h!==s.rttCoords[l]&&(s.rtt=[])}}renderLayer(e,i){if(e.isHidden(this.painter.transform.zoom))return!1;const s=Object.assign(Object.assign({},i),{isRenderingToTexture:!0}),l=e.type,h=this.painter,f=this._renderableLayerIds[this._renderableLayerIds.length-1]===e.id;if(br[l]&&(this._prevType&&br[this._prevType]||this._stacks.push([]),this._prevType=l,this._stacks[this._stacks.length-1].push(e.id),!f))return!0;if(br[this._prevType]||br[l]&&f){this._prevType=l;const _=this._stacks.length-1,x=this._stacks[_]||[];for(const T of this._renderableTiles){if(this.pool.isFull()&&(Hn(this.painter,this.terrain,this._rttTiles,s),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(T),T.rtt[_]){const E=this.pool.getObjectForId(T.rtt[_].id);if(E.stamp===T.rtt[_].stamp){this.pool.useObject(E);continue}}const P=this.pool.getOrCreateFreeObject();this.pool.useObject(P),this.pool.stampObject(P),T.rtt[_]={id:P.id,stamp:P.stamp},h.context.bindFramebuffer.set(P.fbo.framebuffer),h.context.clear({color:o.b7.transparent,stencil:0}),h.currentStencilSource=void 0;for(let E=0;E<x.length;E++){const A=h.style._layers[x[E]],F=A.source?this._coordsAscending[A.source][T.tileID.key]:[T.tileID];h.context.viewport.set([0,0,P.fbo.width,P.fbo.height]),h._renderTileClippingMasks(A,F,!0),h.renderLayer(h,h.style.sourceCaches[A.source],A,F,s),A.source&&(T.rttCoords[A.source]=this._coordsAscendingStr[A.source][T.tileID.key])}}return Hn(this.painter,this.terrain,this._rttTiles,s),this._rttTiles=[],this.pool.freeAllObjects(),br[l]}return!1}}const Ke={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"MapLibre logo","Map.Title":"Map","Marker.Title":"Map marker","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","Popup.Close":"Close popup","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","GlobeControl.Enable":"Enable globe","GlobeControl.Disable":"Disable globe","TerrainControl.Enable":"Enable terrain","TerrainControl.Disable":"Disable terrain","CooperativeGesturesHandler.WindowsHelpText":"Use Ctrl + scroll to zoom the map","CooperativeGesturesHandler.MacHelpText":"Use ⌘ + scroll to zoom the map","CooperativeGesturesHandler.MobileHelpText":"Use two fingers to move the map"},nt=de,Xs={hash:!1,interactive:!0,bearingSnap:7,attributionControl:zn,maplibreLogo:!1,refreshExpiredTiles:!0,canvasContextAttributes:{antialias:!1,preserveDrawingBuffer:!1,powerPreference:"high-performance",failIfMajorPerformanceCaveat:!1,desynchronized:!1,contextType:void 0},scrollZoom:!0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,trackResize:!0,center:[0,0],elevation:0,zoom:0,bearing:0,pitch:0,roll:0,renderWorldCopies:!0,maxTileCacheSize:null,maxTileCacheZoomLevels:o.a.MAX_TILE_CACHE_ZOOM_LEVELS,transformRequest:null,transformCameraUpdate:null,fadeDuration:300,crossSourceCollisions:!0,clickTolerance:3,localIdeographFontFamily:"sans-serif",pitchWithRotate:!0,rollEnabled:!1,validateStyle:!0,maxCanvasSize:[4096,4096],cancelPendingTileRequestsWhileZooming:!0,centerClampedToGround:!0},_c={showCompass:!0,showZoom:!0,visualizePitch:!1,visualizeRoll:!0};class yc{constructor(e,i,s=!1){this.mousedown=h=>{this.startMove(h,ce.mousePos(this.element,h)),ce.addEventListener(window,"mousemove",this.mousemove),ce.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=h=>{this.move(h,ce.mousePos(this.element,h))},this.mouseup=h=>{this._rotatePitchHanlder.dragEnd(h),this.offTemp()},this.touchstart=h=>{h.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=ce.touchPos(this.element,h.targetTouches)[0],this.startMove(h,this._startPos),ce.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),ce.addEventListener(window,"touchend",this.touchend))},this.touchmove=h=>{h.targetTouches.length!==1?this.reset():(this._lastPos=ce.touchPos(this.element,h.targetTouches)[0],this.move(h,this._lastPos))},this.touchend=h=>{h.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()},this.reset=()=>{this._rotatePitchHanlder.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10,this.element=i;const l=new ns;this._rotatePitchHanlder=new dr({clickTolerance:3,move:(h,f)=>{const _=i.getBoundingClientRect(),x=new o.P((_.bottom-_.top)/2,(_.right-_.left)/2);return{bearingDelta:o.ce(new o.P(h.x,f.y),f,x),pitchDelta:s?-.5*(f.y-h.y):void 0}},moveStateManager:l,enable:!0,assignEvents:()=>{}}),this.map=e,ce.addEventListener(i,"mousedown",this.mousedown),ce.addEventListener(i,"touchstart",this.touchstart,{passive:!1}),ce.addEventListener(i,"touchcancel",this.reset)}startMove(e,i){this._rotatePitchHanlder.dragStart(e,i),ce.disableDrag()}move(e,i){const s=this.map,{bearingDelta:l,pitchDelta:h}=this._rotatePitchHanlder.dragMove(e,i)||{};l&&s.setBearing(s.getBearing()+l),h&&s.setPitch(s.getPitch()+h)}off(){const e=this.element;ce.removeEventListener(e,"mousedown",this.mousedown),ce.removeEventListener(e,"touchstart",this.touchstart,{passive:!1}),ce.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),ce.removeEventListener(window,"touchend",this.touchend),ce.removeEventListener(e,"touchcancel",this.reset),this.offTemp()}offTemp(){ce.enableDrag(),ce.removeEventListener(window,"mousemove",this.mousemove),ce.removeEventListener(window,"mouseup",this.mouseup),ce.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),ce.removeEventListener(window,"touchend",this.touchend)}}let Mi;function xc(u,e,i,s=!1){if(s||!i.getCoveringTilesDetailsProvider().allowWorldCopies())return u==null?void 0:u.wrap();const l=new o.Q(u.lng,u.lat);if(u=new o.Q(u.lng,u.lat),e){const h=new o.Q(u.lng-360,u.lat),f=new o.Q(u.lng+360,u.lat),_=i.locationToScreenPoint(u).distSqr(e);i.locationToScreenPoint(h).distSqr(e)<_?u=h:i.locationToScreenPoint(f).distSqr(e)<_&&(u=f)}for(;Math.abs(u.lng-i.center.lng)>180;){const h=i.locationToScreenPoint(u);if(h.x>=0&&h.y>=0&&h.x<=i.width&&h.y<=i.height)break;u.lng>i.center.lng?u.lng-=360:u.lng+=360}return u.lng!==l.lng&&i.isPointOnMapSurface(i.locationToScreenPoint(u))?u:l}const Xr={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 dh(u,e,i){const s=u.classList;for(const l in Xr)s.remove(`maplibregl-${i}-anchor-${l}`);s.add(`maplibregl-${i}-anchor-${e}`)}class ba extends o.E{constructor(e){if(super(),this._onKeyPress=i=>{const s=i.code,l=i.charCode||i.keyCode;s!=="Space"&&s!=="Enter"&&l!==32&&l!==13||this.togglePopup()},this._onMapClick=i=>{const s=i.originalEvent.target,l=this._element;this._popup&&(s===l||l.contains(s))&&this.togglePopup()},this._update=i=>{if(!this._map)return;const s=this._map.loaded()&&!this._map.isMoving();((i==null?void 0:i.type)==="terrain"||(i==null?void 0:i.type)==="render"&&!s)&&this._map.once("render",this._update),this._lngLat=xc(this._lngLat,this._flatPos,this._map.transform),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationToScreenPoint(this._lngLat)._add(this._offset));let l="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?l=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(l=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let h="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?h="rotateX(0deg)":this._pitchAlignment==="map"&&(h=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||i&&i.type!=="moveend"||(this._pos=this._pos.round()),ce.setTransform(this._element,`${Xr[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${h} ${l}`),Ce.frameAsync(new AbortController).then(()=>{this._updateOpacity(i&&i.type==="moveend")}).catch(()=>{})},this._onMove=i=>{if(!this._isDragging){const s=this._clickTolerance||this._map._clickTolerance;this._isDragging=i.point.dist(this._pointerdownPos)>=s}this._isDragging&&(this._pos=i.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 o.l("dragstart"))),this.fire(new o.l("drag")))},this._onUp=()=>{this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._state==="active"&&this.fire(new o.l("dragend")),this._state="inactive"},this._addDragHandler=i=>{this._element.contains(i.originalEvent.target)&&(i.preventDefault(),this._positionDelta=i.point.sub(this._pos).add(this._offset),this._pointerdownPos=i.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},this._anchor=e&&e.anchor||"center",this._color=e&&e.color||"#3FB1CE",this._scale=e&&e.scale||1,this._draggable=e&&e.draggable||!1,this._clickTolerance=e&&e.clickTolerance||0,this._subpixelPositioning=e&&e.subpixelPositioning||!1,this._isDragging=!1,this._state="inactive",this._rotation=e&&e.rotation||0,this._rotationAlignment=e&&e.rotationAlignment||"auto",this._pitchAlignment=e&&e.pitchAlignment&&e.pitchAlignment!=="auto"?e.pitchAlignment:this._rotationAlignment,this.setOpacity(e==null?void 0:e.opacity,e==null?void 0:e.opacityWhenCovered),e&&e.element)this._element=e.element,this._offset=o.P.convert(e&&e.offset||[0,0]);else{this._defaultMarker=!0,this._element=ce.create("div");const i=ce.createNS("http://www.w3.org/2000/svg","svg"),s=41,l=27;i.setAttributeNS(null,"display","block"),i.setAttributeNS(null,"height",`${s}px`),i.setAttributeNS(null,"width",`${l}px`),i.setAttributeNS(null,"viewBox",`0 0 ${l} ${s}`);const h=ce.createNS("http://www.w3.org/2000/svg","g");h.setAttributeNS(null,"stroke","none"),h.setAttributeNS(null,"stroke-width","1"),h.setAttributeNS(null,"fill","none"),h.setAttributeNS(null,"fill-rule","evenodd");const f=ce.createNS("http://www.w3.org/2000/svg","g");f.setAttributeNS(null,"fill-rule","nonzero");const _=ce.createNS("http://www.w3.org/2000/svg","g");_.setAttributeNS(null,"transform","translate(3.0, 29.0)"),_.setAttributeNS(null,"fill","#000000");const x=[{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 W of x){const K=ce.createNS("http://www.w3.org/2000/svg","ellipse");K.setAttributeNS(null,"opacity","0.04"),K.setAttributeNS(null,"cx","10.5"),K.setAttributeNS(null,"cy","5.80029008"),K.setAttributeNS(null,"rx",W.rx),K.setAttributeNS(null,"ry",W.ry),_.appendChild(K)}const T=ce.createNS("http://www.w3.org/2000/svg","g");T.setAttributeNS(null,"fill",this._color);const P=ce.createNS("http://www.w3.org/2000/svg","path");P.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),T.appendChild(P);const E=ce.createNS("http://www.w3.org/2000/svg","g");E.setAttributeNS(null,"opacity","0.25"),E.setAttributeNS(null,"fill","#000000");const A=ce.createNS("http://www.w3.org/2000/svg","path");A.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"),E.appendChild(A);const F=ce.createNS("http://www.w3.org/2000/svg","g");F.setAttributeNS(null,"transform","translate(6.0, 7.0)"),F.setAttributeNS(null,"fill","#FFFFFF");const O=ce.createNS("http://www.w3.org/2000/svg","g");O.setAttributeNS(null,"transform","translate(8.0, 8.0)");const H=ce.createNS("http://www.w3.org/2000/svg","circle");H.setAttributeNS(null,"fill","#000000"),H.setAttributeNS(null,"opacity","0.25"),H.setAttributeNS(null,"cx","5.5"),H.setAttributeNS(null,"cy","5.5"),H.setAttributeNS(null,"r","5.4999962");const q=ce.createNS("http://www.w3.org/2000/svg","circle");q.setAttributeNS(null,"fill","#FFFFFF"),q.setAttributeNS(null,"cx","5.5"),q.setAttributeNS(null,"cy","5.5"),q.setAttributeNS(null,"r","5.4999962"),O.appendChild(H),O.appendChild(q),f.appendChild(_),f.appendChild(T),f.appendChild(E),f.appendChild(F),f.appendChild(O),i.appendChild(f),i.setAttributeNS(null,"height",s*this._scale+"px"),i.setAttributeNS(null,"width",l*this._scale+"px"),this._element.appendChild(i),this._offset=o.P.convert(e&&e.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",i=>{i.preventDefault()}),this._element.addEventListener("mousedown",i=>{i.preventDefault()}),dh(this._element,this._anchor,"marker"),e&&e.className)for(const i of e.className.split(" "))this._element.classList.add(i);this._popup=null}addTo(e){return this.remove(),this._map=e,this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label",e._getUIString("Marker.Title")),e.getCanvasContainer().appendChild(this._element),e.on("move",this._update),e.on("moveend",this._update),e.on("terrain",this._update),e.on("projectiontransition",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("terrain",this._update),this._map.off("projectiontransition",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),ce.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=o.Q.convert(e),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(e){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),e){if(!("offset"in e.options)){const l=Math.abs(13.5)/Math.SQRT2;e.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[l,-1*(38.1-13.5+l)],"bottom-right":[-l,-1*(38.1-13.5+l)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=e,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}setSubpixelPositioning(e){return this._subpixelPositioning=e,this}getPopup(){return this._popup}togglePopup(){const e=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:e?(e.isOpen()?e.remove():(e.setLngLat(this._lngLat),e.addTo(this._map)),this):this}_updateOpacity(e=!1){var i,s;const l=(i=this._map)===null||i===void 0?void 0:i.terrain,h=this._map.transform.isLocationOccluded(this._lngLat);if(!l||h){const F=h?this._opacityWhenCovered:this._opacity;return void(this._element.style.opacity!==F&&(this._element.style.opacity=F))}if(e)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}const f=this._map,_=f.terrain.depthAtPoint(this._pos),x=f.terrain.getElevationForLngLatZoom(this._lngLat,f.transform.tileZoom);if(f.transform.lngLatToCameraDepth(this._lngLat,x)-_<.006)return void(this._element.style.opacity=this._opacity);const T=-this._offset.y/f.transform.pixelsPerMeter,P=Math.sin(f.getPitch()*Math.PI/180)*T,E=f.terrain.depthAtPoint(new o.P(this._pos.x,this._pos.y-this._offset.y)),A=f.transform.lngLatToCameraDepth(this._lngLat,x+P)-E>.006;!((s=this._popup)===null||s===void 0)&&s.isOpen()&&A&&this._popup.remove(),this._element.style.opacity=A?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(e){return this._offset=o.P.convert(e),this._update(),this}addClassName(e){this._element.classList.add(e)}removeClassName(e){this._element.classList.remove(e)}toggleClassName(e){return this._element.classList.toggle(e)}setDraggable(e){return this._draggable=!!e,this._map&&(e?(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(e){return this._rotation=e||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(e){return this._rotationAlignment=e||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(e){return this._pitchAlignment=e&&e!=="auto"?e:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(e,i){return(this._opacity===void 0||e===void 0&&i===void 0)&&(this._opacity="1",this._opacityWhenCovered="0.2"),e!==void 0&&(this._opacity=e),i!==void 0&&(this._opacityWhenCovered=i),this._map&&this._updateOpacity(!0),this}}const ui={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let ei=0,os=!1;const Ks={maxWidth:100,unit:"metric"};function Ys(u,e,i){const s=i&&i.maxWidth||100,l=u._container.clientHeight/2,h=u._container.clientWidth/2,f=u.unproject([h-s/2,l]),_=u.unproject([h+s/2,l]),x=Math.round(u.project(_).x-u.project(f).x),T=Math.min(s,x,u._container.clientWidth),P=f.distanceTo(_);if(i&&i.unit==="imperial"){const E=3.2808*P;E>5280?wa(e,T,E/5280,u._getUIString("ScaleControl.Miles")):wa(e,T,E,u._getUIString("ScaleControl.Feet"))}else i&&i.unit==="nautical"?wa(e,T,P/1852,u._getUIString("ScaleControl.NauticalMiles")):P>=1e3?wa(e,T,P/1e3,u._getUIString("ScaleControl.Kilometers")):wa(e,T,P,u._getUIString("ScaleControl.Meters"))}function wa(u,e,i,s){const l=function(h){const f=Math.pow(10,`${Math.floor(h)}`.length-1);let _=h/f;return _=_>=10?10:_>=5?5:_>=3?3:_>=2?2:_>=1?1:function(x){const T=Math.pow(10,Math.ceil(-Math.log(x)/Math.LN10));return Math.round(x*T)/T}(_),f*_}(i);u.style.width=e*(l/i)+"px",u.innerHTML=`${l} ${s}`}const vc={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1,locationOccludedOpacity:void 0},bc=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function ls(u){if(u){if(typeof u=="number"){const e=Math.round(Math.abs(u)/Math.SQRT2);return{center:new o.P(0,0),top:new o.P(0,u),"top-left":new o.P(e,e),"top-right":new o.P(-e,e),bottom:new o.P(0,-u),"bottom-left":new o.P(e,-e),"bottom-right":new o.P(-e,-e),left:new o.P(u,0),right:new o.P(-u,0)}}if(u instanceof o.P||Array.isArray(u)){const e=o.P.convert(u);return{center:e,top:e,"top-left":e,"top-right":e,bottom:e,"bottom-left":e,"bottom-right":e,left:e,right:e}}return{center:o.P.convert(u.center||[0,0]),top:o.P.convert(u.top||[0,0]),"top-left":o.P.convert(u["top-left"]||[0,0]),"top-right":o.P.convert(u["top-right"]||[0,0]),bottom:o.P.convert(u.bottom||[0,0]),"bottom-left":o.P.convert(u["bottom-left"]||[0,0]),"bottom-right":o.P.convert(u["bottom-right"]||[0,0]),left:o.P.convert(u.left||[0,0]),right:o.P.convert(u.right||[0,0])}}return ls(new o.P(0,0))}const wc=de;S.AJAXError=o.cq,S.Event=o.l,S.Evented=o.E,S.LngLat=o.Q,S.MercatorCoordinate=o.$,S.Point=o.P,S.addProtocol=o.cr,S.config=o.a,S.removeProtocol=o.cs,S.AttributionControl=qt,S.BoxZoomHandler=uc,S.CanvasSource=an,S.CooperativeGesturesHandler=rl,S.DoubleClickZoomHandler=il,S.DragPanHandler=oh,S.DragRotateHandler=lh,S.EdgeInsets=Ss,S.FullscreenControl=class extends o.E{constructor(u={}){super(),this._onFullscreenChange=()=>{var e;let i=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;!((e=i==null?void 0:i.shadowRoot)===null||e===void 0)&&e.fullscreenElement;)i=i.shadowRoot.fullscreenElement;i===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,u&&u.container&&(u.container instanceof HTMLElement?this._container=u.container:o.w("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(u){return this._map=u,this._container||(this._container=this._map.getContainer()),this._controlContainer=ce.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){ce.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const u=this._fullscreenButton=ce.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);ce.create("span","maplibregl-ctrl-icon",u).setAttribute("aria-hidden","true"),u.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const u=this._getTitle();this._fullscreenButton.setAttribute("aria-label",u),this._fullscreenButton.title=u}_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(),this._fullscreen?(this.fire(new o.l("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new o.l("fullscreenend")),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable())}_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()}},S.GeoJSONSource=sa,S.GeolocateControl=class extends o.E{constructor(u){super(),this._onSuccess=e=>{if(this._map){if(this._isOutOfMapMaxBounds(e))return this._setErrorState(),this.fire(new o.l("outofmaxbounds",e)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=e,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(e),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(e),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new o.l("geolocate",e)),this._finish()}},this._updateCamera=e=>{const i=new o.Q(e.coords.longitude,e.coords.latitude),s=e.coords.accuracy,l=this._map.getBearing(),h=o.e({bearing:l},this.options.fitBoundsOptions),f=jt.fromLngLat(i,s);this._map.fitBounds(f,h,{geolocateSource:!0})},this._updateMarker=e=>{if(e){const i=new o.Q(e.coords.longitude,e.coords.latitude);this._accuracyCircleMarker.setLngLat(i).addTo(this._map),this._userLocationDotMarker.setLngLat(i).addTo(this._map),this._accuracy=e.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onZoom=()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},this._onError=e=>{if(this._map){if(e.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 i=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=i,this._geolocateButton.setAttribute("aria-label",i),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(e.code===3&&os)return;this.options.trackUserLocation&&this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new o.l("error",e)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",e=>e.preventDefault()),this._geolocateButton=ce.create("button","maplibregl-ctrl-geolocate",this._container),ce.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",this._geolocateButton.disabled=!0)},this._finishSetupUI=e=>{if(this._map){if(e===!1){o.w("Geolocation support is not available so the GeolocateControl will be disabled.");const i=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=i,this._geolocateButton.setAttribute("aria-label",i)}else{const i=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=i,this._geolocateButton.setAttribute("aria-label",i)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=ce.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new ba({element:this._dotElement}),this._circleElement=ce.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new ba({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",()=>this.trigger()),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",i=>{i.geolocateSource||this._watchState!=="ACTIVE_LOCK"||i.originalEvent&&i.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 o.l("trackuserlocationend")),this.fire(new o.l("userlocationlostfocus")))})}},this.options=o.e({},ui,u)}onAdd(u){return this._map=u,this._container=ce.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),function(){return o._(this,arguments,void 0,function*(e=!1){if(Mi!==void 0&&!e)return Mi;if(window.navigator.permissions===void 0)return Mi=!!window.navigator.geolocation,Mi;try{Mi=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{Mi=!!window.navigator.geolocation}return Mi})}().then(e=>this._finishSetupUI(e)),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(),ce.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,ei=0,os=!1}_isOutOfMapMaxBounds(u){const e=this._map.getMaxBounds(),i=u.coords;return e&&(i.longitude<e.getWest()||i.longitude>e.getEast()||i.latitude<e.getSouth()||i.latitude>e.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}`)}}_updateCircleRadius(){const u=this._map.getBounds(),e=u.getSouthEast(),i=u.getNorthEast(),s=e.distanceTo(i),l=Math.ceil(this._accuracy/(s/this._map._container.clientHeight)*2);this._circleElement.style.width=`${l}px`,this._circleElement.style.height=`${l}px`}trigger(){if(!this._setup)return o.w("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new o.l("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":ei--,os=!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 o.l("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 o.l("trackuserlocationstart")),this.fire(new o.l("userlocationfocus"));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 u;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),ei++,ei>1?(u={maximumAge:6e5,timeout:0},os=!0):(u=this.options.positionOptions,os=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,u)}}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)}},S.GlobeControl=class{constructor(){this._toggleProjection=()=>{var u;const e=(u=this._map.getProjection())===null||u===void 0?void 0:u.type;this._map.setProjection(e!=="mercator"&&e?{type:"mercator"}:{type:"globe"}),this._updateGlobeIcon()},this._updateGlobeIcon=()=>{var u;this._globeButton.classList.remove("maplibregl-ctrl-globe"),this._globeButton.classList.remove("maplibregl-ctrl-globe-enabled"),((u=this._map.getProjection())===null||u===void 0?void 0:u.type)==="globe"?(this._globeButton.classList.add("maplibregl-ctrl-globe-enabled"),this._globeButton.title=this._map._getUIString("GlobeControl.Disable")):(this._globeButton.classList.add("maplibregl-ctrl-globe"),this._globeButton.title=this._map._getUIString("GlobeControl.Enable"))}}onAdd(u){return this._map=u,this._container=ce.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._globeButton=ce.create("button","maplibregl-ctrl-globe",this._container),ce.create("span","maplibregl-ctrl-icon",this._globeButton).setAttribute("aria-hidden","true"),this._globeButton.type="button",this._globeButton.addEventListener("click",this._toggleProjection),this._updateGlobeIcon(),this._map.on("styledata",this._updateGlobeIcon),this._container}onRemove(){ce.remove(this._container),this._map.off("styledata",this._updateGlobeIcon),this._globeButton.removeEventListener("click",this._toggleProjection),this._map=void 0}},S.Hash=sc,S.ImageSource=gr,S.KeyboardHandler=ss,S.LngLatBounds=jt,S.LogoControl=Ws,S.Map=class extends $d{constructor(u){var e,i;o.cn.mark(o.co.create);const s=Object.assign(Object.assign(Object.assign({},Xs),u),{canvasContextAttributes:Object.assign(Object.assign({},Xs.canvasContextAttributes),u.canvasContextAttributes)});if(s.minZoom!=null&&s.maxZoom!=null&&s.minZoom>s.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(s.minPitch!=null&&s.maxPitch!=null&&s.minPitch>s.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(s.minPitch!=null&&s.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(s.maxPitch!=null&&s.maxPitch>180)throw new Error("maxPitch must be less than or equal to 180");const l=new $a,h=new Ps;if(s.minZoom!==void 0&&l.setMinZoom(s.minZoom),s.maxZoom!==void 0&&l.setMaxZoom(s.maxZoom),s.minPitch!==void 0&&l.setMinPitch(s.minPitch),s.maxPitch!==void 0&&l.setMaxPitch(s.maxPitch),s.renderWorldCopies!==void 0&&l.setRenderWorldCopies(s.renderWorldCopies),super(l,h,{bearingSnap:s.bearingSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new gc,this._controls=[],this._mapId=o.a4(),this._contextLost=_=>{_.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new o.l("webglcontextlost",{originalEvent:_}))},this._contextRestored=_=>{this._setupPainter(),this.resize(),this._update(),this.fire(new o.l("webglcontextrestored",{originalEvent:_}))},this._onMapScroll=_=>{if(_.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=s.interactive,this._maxTileCacheSize=s.maxTileCacheSize,this._maxTileCacheZoomLevels=s.maxTileCacheZoomLevels,this._canvasContextAttributes=Object.assign({},s.canvasContextAttributes),this._trackResize=s.trackResize===!0,this._bearingSnap=s.bearingSnap,this._centerClampedToGround=s.centerClampedToGround,this._refreshExpiredTiles=s.refreshExpiredTiles===!0,this._fadeDuration=s.fadeDuration,this._crossSourceCollisions=s.crossSourceCollisions===!0,this._collectResourceTiming=s.collectResourceTiming===!0,this._locale=Object.assign(Object.assign({},Ke),s.locale),this._clickTolerance=s.clickTolerance,this._overridePixelRatio=s.pixelRatio,this._maxCanvasSize=s.maxCanvasSize,this.transformCameraUpdate=s.transformCameraUpdate,this.cancelPendingTileRequestsWhileZooming=s.cancelPendingTileRequestsWhileZooming===!0,this._imageQueueHandle=ai.addThrottleControl(()=>this.isMoving()),this._requestManager=new It(s.transformRequest),typeof s.container=="string"){if(this._container=document.getElementById(s.container),!this._container)throw new Error(`Container '${s.container}' not found.`)}else{if(!(s.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=s.container}if(s.maxBounds&&this.setMaxBounds(s.maxBounds),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)}),this.once("idle",()=>{this._idleTriggered=!0}),typeof window<"u"){addEventListener("online",this._onWindowOnline,!1);let _=!1;const x=$s(T=>{this._trackResize&&!this._removed&&(this.resize(T),this.redraw())},50);this._resizeObserver=new ResizeObserver(T=>{_?x(T):_=!0}),this._resizeObserver.observe(this._container)}this.handlers=new Ud(this,s),this._hash=s.hash&&new sc(typeof s.hash=="string"&&s.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:s.center,elevation:s.elevation,zoom:s.zoom,bearing:s.bearing,pitch:s.pitch,roll:s.roll}),s.bounds&&(this.resize(),this.fitBounds(s.bounds,o.e({},s.fitBoundsOptions,{duration:0}))));const f=typeof s.style=="string"||((i=(e=s.style)===null||e===void 0?void 0:e.projection)===null||i===void 0?void 0:i.type)!=="globe";this.resize(null,f),this._localIdeographFontFamily=s.localIdeographFontFamily,this._validateStyle=s.validateStyle,s.style&&this.setStyle(s.style,{localIdeographFontFamily:s.localIdeographFontFamily}),s.attributionControl&&this.addControl(new qt(typeof s.attributionControl=="boolean"?void 0:s.attributionControl)),s.maplibreLogo&&this.addControl(new Ws,s.logoPosition),this.on("style.load",()=>{if(f||this._resizeTransform(),this.transform.unmodified){const _=o.O(this.style.stylesheet,["center","zoom","bearing","pitch","roll"]);this.jumpTo(_)}}),this.on("data",_=>{this._update(_.dataType==="style"),this.fire(new o.l(`${_.dataType}data`,_))}),this.on("dataloading",_=>{this.fire(new o.l(`${_.dataType}dataloading`,_))}),this.on("dataabort",_=>{this.fire(new o.l("sourcedataabort",_))})}_getMapId(){return this._mapId}addControl(u,e){if(e===void 0&&(e=u.getDefaultPosition?u.getDefaultPosition():"top-right"),!u||!u.onAdd)return this.fire(new o.k(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const i=u.onAdd(this);this._controls.push(u);const s=this._controlPositions[e];return e.indexOf("bottom")!==-1?s.insertBefore(i,s.firstChild):s.appendChild(i),this}removeControl(u){if(!u||!u.onRemove)return this.fire(new o.k(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const e=this._controls.indexOf(u);return e>-1&&this._controls.splice(e,1),u.onRemove(this),this}hasControl(u){return this._controls.indexOf(u)>-1}calculateCameraOptionsFromTo(u,e,i,s){return s==null&&this.terrain&&(s=this.terrain.getElevationForLngLatZoom(i,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(u,e,i,s)}resize(u,e=!0){const[i,s]=this._containerDimensions(),l=this._getClampedPixelRatio(i,s);if(this._resizeCanvas(i,s,l),this.painter.resize(i,s,l),this.painter.overLimit()){const f=this.painter.context.gl;this._maxCanvasSize=[f.drawingBufferWidth,f.drawingBufferHeight];const _=this._getClampedPixelRatio(i,s);this._resizeCanvas(i,s,_),this.painter.resize(i,s,_)}this._resizeTransform(e);const h=!this._moving;return h&&(this.stop(),this.fire(new o.l("movestart",u)).fire(new o.l("move",u))),this.fire(new o.l("resize",u)),h&&this.fire(new o.l("moveend",u)),this}_resizeTransform(u=!0){var e;const[i,s]=this._containerDimensions();this.transform.resize(i,s,u),(e=this._requestedCameraState)===null||e===void 0||e.resize(i,s,u)}_getClampedPixelRatio(u,e){const{0:i,1:s}=this._maxCanvasSize,l=this.getPixelRatio(),h=u*l,f=e*l;return Math.min(h>i?i/h:1,f>s?s/f:1)*l}getPixelRatio(){var u;return(u=this._overridePixelRatio)!==null&&u!==void 0?u:devicePixelRatio}setPixelRatio(u){this._overridePixelRatio=u,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(u){return this.transform.setMaxBounds(jt.convert(u)),this._update()}setMinZoom(u){if((u=u??-2)>=-2&&u<=this.transform.maxZoom)return this.transform.setMinZoom(u),this._update(),this.getZoom()<u&&this.setZoom(u),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(u){if((u=u??22)>=this.transform.minZoom)return this.transform.setMaxZoom(u),this._update(),this.getZoom()>u&&this.setZoom(u),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(u){if((u=u??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(u>=0&&u<=this.transform.maxPitch)return this.transform.setMinPitch(u),this._update(),this.getPitch()<u&&this.setPitch(u),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(u){if((u=u??60)>180)throw new Error("maxPitch must be less than or equal to 180");if(u>=this.transform.minPitch)return this.transform.setMaxPitch(u),this._update(),this.getPitch()>u&&this.setPitch(u),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(u){return this.transform.setRenderWorldCopies(u),this._update()}project(u){return this.transform.locationToScreenPoint(o.Q.convert(u),this.style&&this.terrain)}unproject(u){return this.transform.screenPointToLocation(o.P.convert(u),this.terrain)}isMoving(){var u;return this._moving||((u=this.handlers)===null||u===void 0?void 0:u.isMoving())}isZooming(){var u;return this._zooming||((u=this.handlers)===null||u===void 0?void 0:u.isZooming())}isRotating(){var u;return this._rotating||((u=this.handlers)===null||u===void 0?void 0:u.isRotating())}_createDelegatedListener(u,e,i){if(u==="mouseenter"||u==="mouseover"){let s=!1;return{layers:e,listener:i,delegates:{mousemove:h=>{const f=e.filter(x=>this.getLayer(x)),_=f.length!==0?this.queryRenderedFeatures(h.point,{layers:f}):[];_.length?s||(s=!0,i.call(this,new ki(u,this,h.originalEvent,{features:_}))):s=!1},mouseout:()=>{s=!1}}}}if(u==="mouseleave"||u==="mouseout"){let s=!1;return{layers:e,listener:i,delegates:{mousemove:f=>{const _=e.filter(x=>this.getLayer(x));(_.length!==0?this.queryRenderedFeatures(f.point,{layers:_}):[]).length?s=!0:s&&(s=!1,i.call(this,new ki(u,this,f.originalEvent)))},mouseout:f=>{s&&(s=!1,i.call(this,new ki(u,this,f.originalEvent)))}}}}{const s=l=>{const h=e.filter(_=>this.getLayer(_)),f=h.length!==0?this.queryRenderedFeatures(l.point,{layers:h}):[];f.length&&(l.features=f,i.call(this,l),delete l.features)};return{layers:e,listener:i,delegates:{[u]:s}}}}_saveDelegatedListener(u,e){this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[u]=this._delegatedListeners[u]||[],this._delegatedListeners[u].push(e)}_removeDelegatedListener(u,e,i){if(!this._delegatedListeners||!this._delegatedListeners[u])return;const s=this._delegatedListeners[u];for(let l=0;l<s.length;l++){const h=s[l];if(h.listener===i&&h.layers.length===e.length&&h.layers.every(f=>e.includes(f))){for(const f in h.delegates)this.off(f,h.delegates[f]);return void s.splice(l,1)}}}on(u,e,i){if(i===void 0)return super.on(u,e);const s=typeof e=="string"?[e]:e,l=this._createDelegatedListener(u,s,i);this._saveDelegatedListener(u,l);for(const h in l.delegates)this.on(h,l.delegates[h]);return{unsubscribe:()=>{this._removeDelegatedListener(u,s,i)}}}once(u,e,i){if(i===void 0)return super.once(u,e);const s=typeof e=="string"?[e]:e,l=this._createDelegatedListener(u,s,i);for(const h in l.delegates){const f=l.delegates[h];l.delegates[h]=(..._)=>{this._removeDelegatedListener(u,s,i),f(..._)}}this._saveDelegatedListener(u,l);for(const h in l.delegates)this.once(h,l.delegates[h]);return this}off(u,e,i){return i===void 0?super.off(u,e):(this._removeDelegatedListener(u,typeof e=="string"?[e]:e,i),this)}queryRenderedFeatures(u,e){if(!this.style)return[];let i;const s=u instanceof o.P||Array.isArray(u),l=s?u:[[0,0],[this.transform.width,this.transform.height]];if(e=e||(s?{}:u)||{},l instanceof o.P||typeof l[0]=="number")i=[o.P.convert(l)];else{const h=o.P.convert(l[0]),f=o.P.convert(l[1]);i=[h,new o.P(f.x,h.y),f,new o.P(h.x,f.y),h]}return this.style.queryRenderedFeatures(i,e,this.transform)}querySourceFeatures(u,e){return this.style.querySourceFeatures(u,e)}setStyle(u,e){return(e=o.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},e)).diff!==!1&&e.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&u?(this._diffStyle(u,e),this):(this._localIdeographFontFamily=e.localIdeographFontFamily,this._updateStyle(u,e))}setTransformRequest(u){return this._requestManager.setTransformRequest(u),this}_getUIString(u){const e=this._locale[u];if(e==null)throw new Error(`Missing UI string '${u}'`);return e}_updateStyle(u,e){var i,s;if(e.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",()=>this._updateStyle(u,e));const l=this.style&&e.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!u)),u?(this.style=new Vl(this,e||{}),this.style.setEventedParent(this,{style:this.style}),typeof u=="string"?this.style.loadURL(u,e,l):this.style.loadJSON(u,e,l),this):((s=(i=this.style)===null||i===void 0?void 0:i.projection)===null||s===void 0||s.destroy(),delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new Vl(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(u,e){if(typeof u=="string"){const i=this._requestManager.transformRequest(u,"Style");o.j(i,new AbortController).then(s=>{this._updateDiff(s.data,e)}).catch(s=>{s&&this.fire(new o.k(s))})}else typeof u=="object"&&this._updateDiff(u,e)}_updateDiff(u,e){try{this.style.setState(u,e)&&this._update(!0)}catch(i){o.w(`Unable to perform style diff: ${i.message||i.error||i}. Rebuilding the style from scratch.`),this._updateStyle(u,e)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():o.w("There is no style added to the map.")}addSource(u,e){return this._lazyInitEmptyStyle(),this.style.addSource(u,e),this._update(!0)}isSourceLoaded(u){const e=this.style&&this.style.sourceCaches[u];if(e!==void 0)return e.loaded();this.fire(new o.k(new Error(`There is no source with ID '${u}'`)))}setTerrain(u){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),u){const e=this.style.sourceCaches[u.source];if(!e)throw new Error(`cannot load terrain, because there exists no source with ID: ${u.source}`);this.terrain===null&&e.reload();for(const i in this.style._layers){const s=this.style._layers[i];s.type==="hillshade"&&s.source===u.source&&o.w("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain=new hh(this.painter,e,u),this.painter.renderToTexture=new al(this.painter,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._terrainDataCallback=i=>{var s;i.dataType==="style"?this.terrain.sourceCache.freeRtt():i.dataType==="source"&&i.tile&&(i.sourceId!==u.source||this._elevationFreeze||(this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))),((s=i.source)===null||s===void 0?void 0:s.type)==="image"?this.terrain.sourceCache.freeRtt():this.terrain.sourceCache.freeRtt(i.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.setMinElevationForCurrentTile(0),this._centerClampedToGround&&this.transform.setElevation(0);return this.fire(new o.l("terrain",{terrain:u})),this}getTerrain(){var u,e;return(e=(u=this.terrain)===null||u===void 0?void 0:u.options)!==null&&e!==void 0?e:null}areTilesLoaded(){const u=this.style&&this.style.sourceCaches;for(const e in u){const i=u[e]._tiles;for(const s in i){const l=i[s];if(l.state!=="loaded"&&l.state!=="errored")return!1}}return!0}removeSource(u){return this.style.removeSource(u),this._update(!0)}getSource(u){return this.style.getSource(u)}setSourceTileLodParams(u,e,i){if(i){const s=this.getSource(i);if(!s)throw new Error(`There is no source with ID "${i}", cannot set LOD parameters`);s.calculateTileZoom=ae(Math.max(1,u),Math.max(1,e))}else for(const s in this.style.sourceCaches)this.style.sourceCaches[s].getSource().calculateTileZoom=ae(Math.max(1,u),Math.max(1,e));return this._update(!0),this}refreshTiles(u,e){const i=this.style.sourceCaches[u];if(!i)throw new Error(`There is no source cache with ID "${u}", cannot refresh tile`);e===void 0?i.reload():i.refreshTiles(e.map(s=>new o.a1(s.z,s.x,s.y)))}addImage(u,e,i={}){const{pixelRatio:s=1,sdf:l=!1,stretchX:h,stretchY:f,content:_,textFitWidth:x,textFitHeight:T}=i;if(this._lazyInitEmptyStyle(),!(e instanceof HTMLImageElement||o.b(e))){if(e.width===void 0||e.height===void 0)return this.fire(new o.k(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:P,height:E,data:A}=e,F=e;return this.style.addImage(u,{data:new o.R({width:P,height:E},new Uint8Array(A)),pixelRatio:s,stretchX:h,stretchY:f,content:_,textFitWidth:x,textFitHeight:T,sdf:l,version:0,userImage:F}),F.onAdd&&F.onAdd(this,u),this}}{const{width:P,height:E,data:A}=Ce.getImageData(e);this.style.addImage(u,{data:new o.R({width:P,height:E},A),pixelRatio:s,stretchX:h,stretchY:f,content:_,textFitWidth:x,textFitHeight:T,sdf:l,version:0})}}updateImage(u,e){const i=this.style.getImage(u);if(!i)return this.fire(new o.k(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const s=e instanceof HTMLImageElement||o.b(e)?Ce.getImageData(e):e,{width:l,height:h,data:f}=s;if(l===void 0||h===void 0)return this.fire(new o.k(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(l!==i.data.width||h!==i.data.height)return this.fire(new o.k(new Error("The width and height of the updated image must be that same as the previous version of the image")));const _=!(e instanceof HTMLImageElement||o.b(e));return i.data.replace(f,_),this.style.updateImage(u,i),this}getImage(u){return this.style.getImage(u)}hasImage(u){return u?!!this.style.getImage(u):(this.fire(new o.k(new Error("Missing required image id"))),!1)}removeImage(u){this.style.removeImage(u)}loadImage(u){return ai.getImage(this._requestManager.transformRequest(u,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(u,e){return this._lazyInitEmptyStyle(),this.style.addLayer(u,e),this._update(!0)}moveLayer(u,e){return this.style.moveLayer(u,e),this._update(!0)}removeLayer(u){return this.style.removeLayer(u),this._update(!0)}getLayer(u){return this.style.getLayer(u)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(u,e,i){return this.style.setLayerZoomRange(u,e,i),this._update(!0)}setFilter(u,e,i={}){return this.style.setFilter(u,e,i),this._update(!0)}getFilter(u){return this.style.getFilter(u)}setPaintProperty(u,e,i,s={}){return this.style.setPaintProperty(u,e,i,s),this._update(!0)}getPaintProperty(u,e){return this.style.getPaintProperty(u,e)}setLayoutProperty(u,e,i,s={}){return this.style.setLayoutProperty(u,e,i,s),this._update(!0)}getLayoutProperty(u,e){return this.style.getLayoutProperty(u,e)}setGlyphs(u,e={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(u,e),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(u,e,i={}){return this._lazyInitEmptyStyle(),this.style.addSprite(u,e,i,s=>{s||this._update(!0)}),this}removeSprite(u){return this._lazyInitEmptyStyle(),this.style.removeSprite(u),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(u,e={}){return this._lazyInitEmptyStyle(),this.style.setSprite(u,e,i=>{i||this._update(!0)}),this}setLight(u,e={}){return this._lazyInitEmptyStyle(),this.style.setLight(u,e),this._update(!0)}getLight(){return this.style.getLight()}setSky(u,e={}){return this._lazyInitEmptyStyle(),this.style.setSky(u,e),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(u,e){return this.style.setFeatureState(u,e),this._update()}removeFeatureState(u,e){return this.style.removeFeatureState(u,e),this._update()}getFeatureState(u){return this.style.getFeatureState(u)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let u=0,e=0;return this._container&&(u=this._container.clientWidth||400,e=this._container.clientHeight||300),[u,e]}_setupContainer(){const u=this._container;u.classList.add("maplibregl-map");const e=this._canvasContainer=ce.create("div","maplibregl-canvas-container",u);this._interactive&&e.classList.add("maplibregl-interactive"),this._canvas=ce.create("canvas","maplibregl-canvas",e),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex",this._interactive?"0":"-1"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region");const i=this._containerDimensions(),s=this._getClampedPixelRatio(i[0],i[1]);this._resizeCanvas(i[0],i[1],s);const l=this._controlContainer=ce.create("div","maplibregl-control-container",u),h=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(f=>{h[f]=ce.create("div",`maplibregl-ctrl-${f} `,l)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(u,e,i){this._canvas.width=Math.floor(i*u),this._canvas.height=Math.floor(i*e),this._canvas.style.width=`${u}px`,this._canvas.style.height=`${e}px`}_setupPainter(){const u=Object.assign(Object.assign({},this._canvasContextAttributes),{alpha:!0,depth:!0,stencil:!0,premultipliedAlpha:!0});let e=null;this._canvas.addEventListener("webglcontextcreationerror",s=>{e={requestedAttributes:u},s&&(e.statusMessage=s.statusMessage,e.type=s.type)},{once:!0});let i=null;if(i=this._canvasContextAttributes.contextType?this._canvas.getContext(this._canvasContextAttributes.contextType,u):this._canvas.getContext("webgl2",u)||this._canvas.getContext("webgl",u),!i){const s="Failed to initialize WebGL";throw e?(e.message=s,new Error(JSON.stringify(e))):new Error(s)}this.painter=new ac(i,this.transform),Ve.testSupport(i)}migrateProjection(u,e){super.migrateProjection(u,e),this.painter.transform=u,this.fire(new o.l("projectiontransition",{newProjection:this.style.projection.name}))}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(u){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||u,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(u){return this._update(),this._renderTaskQueue.add(u)}_cancelRenderFrame(u){this._renderTaskQueue.remove(u)}_render(u){var e,i,s,l,h;const f=this._idleTriggered?this._fadeDuration:0,_=((e=this.style.projection)===null||e===void 0?void 0:e.transitionState)>0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(u),this._removed)return;let x=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const E=this.transform.zoom,A=Ce.now();this.style.zoomHistory.update(E,A);const F=new o.C(E,{now:A,fadeDuration:f,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),O=F.crossFadingFactor();O===1&&O===this._crossFadingFactor||(x=!0,this._crossFadingFactor=O),this.style.update(F)}const T=((i=this.style.projection)===null||i===void 0?void 0:i.transitionState)>0!==_;(s=this.style.projection)===null||s===void 0||s.setErrorQueryLatitudeDegrees(this.transform.center.lat),this.transform.setTransitionState((l=this.style.projection)===null||l===void 0?void 0:l.transitionState,(h=this.style.projection)===null||h===void 0?void 0:h.latitudeErrorCorrectionRadians),this.style&&(this._sourcesDirty||T)&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),!this._elevationFreeze&&this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.setMinElevationForCurrentTile(0),this._centerClampedToGround&&this.transform.setElevation(0)),this._placementDirty=this.style&&this.style._updatePlacement(this.transform,this.showCollisionBoxes,f,this._crossSourceCollisions,T),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:f,showPadding:this.showPadding}),this.fire(new o.l("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,o.cn.mark(o.co.load),this.fire(new o.l("load"))),this.style&&(this.style.hasTransitions()||x)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const P=this._sourcesDirty||this._styleDirty||this._placementDirty;return P||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new o.l("idle")),!this._loaded||this._fullyLoaded||P||(this._fullyLoaded=!0,o.cn.mark(o.co.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var u;this._hash&&this._hash.remove();for(const i of this._controls)i.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&removeEventListener("online",this._onWindowOnline,!1),ai.removeThrottleControl(this._imageQueueHandle),(u=this._resizeObserver)===null||u===void 0||u.disconnect();const e=this.painter.context.gl.getExtension("WEBGL_lose_context");e!=null&&e.loseContext&&e.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),ce.remove(this._canvasContainer),ce.remove(this._controlContainer),this._container.removeEventListener("scroll",this._onMapScroll,!1),this._container.classList.remove("maplibregl-map"),o.cn.clearMetrics(),this._removed=!0,this.fire(new o.l("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,Ce.frame(this._frameRequest,u=>{o.cn.frame(u),this._frameRequest=null;try{this._render(u)}catch(e){if(!o.cp(e)&&!function(i){return i.message===Zo}(e))throw e}},()=>{}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(u){this._showTileBoundaries!==u&&(this._showTileBoundaries=u,this._update())}get showPadding(){return!!this._showPadding}set showPadding(u){this._showPadding!==u&&(this._showPadding=u,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(u){this._showCollisionBoxes!==u&&(this._showCollisionBoxes=u,u?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(u){this._showOverdrawInspector!==u&&(this._showOverdrawInspector=u,this._update())}get repaint(){return!!this._repaint}set repaint(u){this._repaint!==u&&(this._repaint=u,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(u){this._vertices=u,this._update()}get version(){return nt}getCameraTargetElevation(){return this.transform.elevation}getProjection(){return this.style.getProjection()}setProjection(u){return this._lazyInitEmptyStyle(),this.style.setProjection(u),this._update(!0)}},S.MapMouseEvent=ki,S.MapTouchEvent=es,S.MapWheelEvent=cc,S.Marker=ba,S.NavigationControl=class{constructor(u){this._updateZoomButtons=()=>{const e=this._map.getZoom(),i=e===this._map.getMaxZoom(),s=e===this._map.getMinZoom();this._zoomInButton.disabled=i,this._zoomOutButton.disabled=s,this._zoomInButton.setAttribute("aria-disabled",i.toString()),this._zoomOutButton.setAttribute("aria-disabled",s.toString())},this._rotateCompassArrow=()=>{this._compassIcon.style.transform=this.options.visualizePitch&&this.options.visualizeRoll?`scale(${1/Math.pow(Math.cos(this._map.transform.pitchInRadians),.5)}) rotateZ(${-this._map.transform.roll}deg) rotateX(${this._map.transform.pitch}deg) rotateZ(${-this._map.transform.bearing}deg)`:this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitchInRadians),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${-this._map.transform.bearing}deg)`:this.options.visualizeRoll?`rotate(${-this._map.transform.bearing-this._map.transform.roll}deg)`:`rotate(${-this._map.transform.bearing}deg)`},this._setButtonTitle=(e,i)=>{const s=this._map._getUIString(`NavigationControl.${i}`);e.title=s,e.setAttribute("aria-label",s)},this.options=o.e({},_c,u),this._container=ce.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",e=>e.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",e=>this._map.zoomIn({},{originalEvent:e})),ce.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",e=>this._map.zoomOut({},{originalEvent:e})),ce.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",e=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:e}):this._map.resetNorth({},{originalEvent:e})}),this._compassIcon=ce.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(u){return this._map=u,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.options.visualizeRoll&&this._map.on("roll",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new yc(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){ce.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.options.visualizeRoll&&this._map.off("roll",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(u,e){const i=ce.create("button",u,this._container);return i.type="button",i.addEventListener("click",e),i}},S.Popup=class extends o.E{constructor(u){super(),this._updateOpacity=()=>{this.options.locationOccludedOpacity!==void 0&&(this._container.style.opacity=this._map.transform.isLocationOccluded(this.getLngLat())?`${this.options.locationOccludedOpacity}`:void 0)},this.remove=()=>(this._content&&ce.remove(this._content),this._container&&(ce.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),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new o.l("close"))),this),this._onMouseUp=e=>{this._update(e.point)},this._onMouseMove=e=>{this._update(e.point)},this._onDrag=e=>{this._update(e.point)},this._update=e=>{if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=ce.create("div","maplibregl-popup",this._map.getContainer()),this._tip=ce.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const f of this.options.className.split(" "))this._container.classList.add(f);this._closeButton&&this._closeButton.setAttribute("aria-label",this._map._getUIString("Popup.Close")),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=xc(this._lngLat,this._flatPos,this._map.transform,this._trackPointer),this._trackPointer&&!e)return;const i=this._flatPos=this._pos=this._trackPointer&&e?e:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&e?e:this._map.transform.locationToScreenPoint(this._lngLat));let s=this.options.anchor;const l=ls(this.options.offset);if(!s){const f=this._container.offsetWidth,_=this._container.offsetHeight;let x;x=i.y+l.bottom.y<_?["top"]:i.y>this._map.transform.height-_?["bottom"]:[],i.x<f/2?x.push("left"):i.x>this._map.transform.width-f/2&&x.push("right"),s=x.length===0?"bottom":x.join("-")}let h=i.add(l[s]);this.options.subpixelPositioning||(h=h.round()),ce.setTransform(this._container,`${Xr[s]} translate(${h.x}px,${h.y}px)`),dh(this._container,s,"popup"),this._updateOpacity()},this._onClose=()=>{this.remove()},this.options=o.e(Object.create(vc),u)}addTo(u){return this._map&&this.remove(),this._map=u,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 o.l("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(u){return this._lngLat=o.Q.convert(u),this._pos=null,this._flatPos=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._flatPos=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(u){return this.setDOMContent(document.createTextNode(u))}setHTML(u){const e=document.createDocumentFragment(),i=document.createElement("body");let s;for(i.innerHTML=u;s=i.firstChild,s;)e.appendChild(s);return this.setDOMContent(e)}getMaxWidth(){var u;return(u=this._container)===null||u===void 0?void 0:u.style.maxWidth}setMaxWidth(u){return this.options.maxWidth=u,this._update(),this}setDOMContent(u){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=ce.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(u),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(u){return this._container&&this._container.classList.add(u),this}removeClassName(u){return this._container&&this._container.classList.remove(u),this}setOffset(u){return this.options.offset=u,this._update(),this}toggleClassName(u){if(this._container)return this._container.classList.toggle(u)}setSubpixelPositioning(u){this.options.subpixelPositioning=u}_createCloseButton(){this.options.closeButton&&(this._closeButton=ce.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const u=this._container.querySelector(bc);u&&u.focus()}},S.RasterDEMTileSource=aa,S.RasterTileSource=Cr,S.ScaleControl=class{constructor(u){this._onMove=()=>{Ys(this._map,this._container,this.options)},this.setUnit=e=>{this.options.unit=e,Ys(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},Ks),u)}getDefaultPosition(){return"bottom-left"}onAdd(u){return this._map=u,this._container=ce.create("div","maplibregl-ctrl maplibregl-ctrl-scale",u.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){ce.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},S.ScrollZoomHandler=yt,S.Style=Vl,S.TerrainControl=class{constructor(u){this._toggleTerrain=()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()},this._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.Disable")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.Enable"))},this.options=u}onAdd(u){return this._map=u,this._container=ce.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=ce.create("button","maplibregl-ctrl-terrain",this._container),ce.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(){ce.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},S.TwoFingersTouchPitchHandler=tl,S.TwoFingersTouchRotateHandler=$e,S.TwoFingersTouchZoomHandler=as,S.TwoFingersTouchZoomRotateHandler=mc,S.VectorTileSource=xn,S.VideoSource=Ir,S.addSourceType=(u,e)=>o._(void 0,void 0,void 0,function*(){if(qe(u))throw new Error(`A source type called "${u}" already exists.`);((i,s)=>{De[i]=s})(u,e)}),S.clearPrewarmedResources=function(){const u=Xi;u&&(u.isPreloaded()&&u.numActive()===1?(u.release(Mr),Xi=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()"))},S.createTileMesh=Cs,S.getMaxParallelImageRequests=function(){return o.a.MAX_PARALLEL_IMAGE_REQUESTS},S.getRTLTextPluginStatus=function(){return cr().getRTLTextPluginStatus()},S.getVersion=function(){return wc},S.getWorkerCount=function(){return Sr.workerCount},S.getWorkerUrl=function(){return o.a.WORKER_URL},S.importScriptInWorkers=function(u){return nn().broadcast("IS",u)},S.prewarm=function(){Pr().acquire(Mr)},S.setMaxParallelImageRequests=function(u){o.a.MAX_PARALLEL_IMAGE_REQUESTS=u},S.setRTLTextPlugin=function(u,e){return cr().setRTLTextPlugin(u,e)},S.setWorkerCount=function(u){Sr.workerCount=u},S.setWorkerUrl=function(u){o.a.WORKER_URL=u}});var B=w;return B})}(pu)),pu.exports}var ly=oy();const rd=ay(ly);class kf{constructor(g,w,I,R,B){Rt(this,"bounds1");Rt(this,"bounds2");Rt(this,"getBounds",(g,w,I,R)=>new rd.LngLatBounds([g,w],[I,R]));Rt(this,"contains",(g,w)=>this.bounds1.contains([w,g])||this.bounds2.contains([w,g]));const S=g.unproject([w,I]),o=g.unproject([R,B]);if(S.lng<-180){this.bounds1=this.getBounds(-180,S.lat,o.lng,o.lat),this.bounds2=this.getBounds(S.wrap().lng,S.lat,180,o.lat);return}if(o.lng>180){this.bounds1=this.getBounds(S.lng,S.lat,180,o.lat),this.bounds2=this.getBounds(-180,S.lat,o.wrap().lng,o.lat);return}this.bounds1=this.getBounds(S.lng,S.lat,o.lng,o.lat),this.bounds2=this.getBounds(0,0,0,0)}}const cy={version:8,sources:{openmaptiles:{type:"vector",url:"https://tiles.openfreemap.org/planet"}},glyphs:"https://tiles.openfreemap.org/fonts/{fontstack}/{range}.pbf",layers:[{id:"background",type:"background",paint:{"background-color":"rgba(120, 120, 120, 1)"}},{id:"park",type:"fill",source:"openmaptiles","source-layer":"park",filter:["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],paint:{"fill-color":"rgba(128, 128, 128, 1)"}},{id:"water",type:"fill",source:"openmaptiles","source-layer":"water",filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["!=",["get","brunnel"],"tunnel"]],paint:{"fill-antialias":!0,"fill-color":"rgba(56, 56, 56, 1)"}},{id:"landcover_ice_shelf",type:"fill",source:"openmaptiles","source-layer":"landcover",maxzoom:8,filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["==",["get","subclass"],"ice_shelf"]],paint:{"fill-color":"rgba(128, 128, 128, 1)","fill-opacity":.7}},{id:"landcover_glacier",type:"fill",source:"openmaptiles","source-layer":"landcover",maxzoom:8,filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["==",["get","subclass"],"glacier"]],paint:{"fill-color":"rgba(153, 153, 153, 1)","fill-opacity":["interpolate",["linear"],["zoom"],0,1,8,.5]}},{id:"landuse_residential",type:"fill",source:"openmaptiles","source-layer":"landuse",maxzoom:16,filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["==",["get","class"],"residential"]],paint:{"fill-color":"rgba(104, 104, 104, 1)","fill-opacity":["interpolate",["exponential",.6],["zoom"],8,.8,9,.6]}},{id:"landcover_wood",type:"fill",source:"openmaptiles","source-layer":"landcover",minzoom:10,filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["==",["get","class"],"wood"]],paint:{"fill-color":"rgba(128, 128, 128, 1)","fill-opacity":["interpolate",["linear"],["zoom"],8,0,12,1]}},{id:"waterway",type:"line",source:"openmaptiles","source-layer":"waterway",filter:["==",["geometry-type"],"LineString"],paint:{"line-color":"rgba(56, 56, 56, 1)"}},{id:"building",type:"fill",source:"openmaptiles","source-layer":"building",minzoom:12,paint:{"fill-antialias":!0,"fill-color":"rgba(136, 136, 136, 1)","fill-outline-color":"rgba(102, 102, 102, 1)"}},{id:"tunnel_motorway_casing",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","brunnel"],"tunnel"],["==",["get","class"],"motorway"]]],layout:{"line-cap":"butt","line-join":"miter"},paint:{"line-color":"rgba(68, 68, 68, 1)","line-opacity":1,"line-width":["interpolate",["exponential",1.4],["zoom"],5.8,0,6,3,20,40]}},{id:"tunnel_motorway_inner",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","brunnel"],"tunnel"],["==",["get","class"],"motorway"]]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(85, 85, 85, 1)","line-width":["interpolate",["exponential",1.4],["zoom"],4,2,6,1.3,20,30]}},{id:"aeroway-taxiway",type:"line",source:"openmaptiles","source-layer":"aeroway",minzoom:12,filter:["match",["get","class"],["taxiway"],!0,!1],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(85, 85, 85, 1)","line-opacity":1,"line-width":["interpolate",["exponential",1.55],["zoom"],13,1.8,20,20]}},{id:"aeroway-runway-casing",type:"line",source:"openmaptiles","source-layer":"aeroway",minzoom:11,filter:["match",["get","class"],["runway"],!0,!1],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(85, 85, 85, 1)","line-opacity":1,"line-width":["interpolate",["exponential",1.5],["zoom"],11,6,17,55]}},{id:"aeroway-area",type:"fill",source:"openmaptiles","source-layer":"aeroway",minzoom:4,filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["match",["get","class"],["runway","taxiway"],!0,!1]],paint:{"fill-color":"rgba(128, 128, 128, 1)","fill-opacity":["interpolate",["linear"],["zoom"],13,0,14,1]}},{id:"aeroway-runway",type:"line",source:"openmaptiles","source-layer":"aeroway",minzoom:11,filter:["all",["match",["get","class"],["runway"],!0,!1],["==",["geometry-type"],"LineString"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(68, 68, 68, 1)","line-opacity":1,"line-width":["interpolate",["exponential",1.5],["zoom"],11,4,17,50]}},{id:"road_area_pier",type:"fill",source:"openmaptiles","source-layer":"transportation",filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["==",["get","class"],"pier"]],paint:{"fill-antialias":!0,"fill-color":"rgba(50, 50, 50, 1)"}},{id:"road_pier",type:"line",source:"openmaptiles","source-layer":"transportation",filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["pier"],!0,!1]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(52, 52, 52, 1)","line-width":["interpolate",["exponential",1.2],["zoom"],15,1,17,4]}},{id:"highway_path",type:"line",source:"openmaptiles","source-layer":"transportation",filter:["all",["==",["geometry-type"],"LineString"],["==",["get","class"],"path"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(88, 88, 88, 1)","line-opacity":.9,"line-width":["interpolate",["exponential",1.2],["zoom"],13,1,20,10]}},{id:"highway_minor",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:8,filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["minor","service","track"],!0,!1]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-opacity":.9,"line-width":["interpolate",["exponential",1.55],["zoom"],13,1.8,20,20],"line-color":"rgba(102, 102, 102, 1)"}},{id:"highway_major_casing",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:11,filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["primary","secondary","tertiary","trunk"],!0,!1]],layout:{"line-cap":"butt","line-join":"miter"},paint:{"line-dasharray":[12,0],"line-width":["interpolate",["exponential",1.3],["zoom"],10,3,20,23],"line-color":"rgba(85, 85, 85, 1)"}},{id:"highway_major_inner",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:11,filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["primary","secondary","tertiary","trunk"],!0,!1]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(102, 102, 102, 1)","line-width":["interpolate",["exponential",1.3],["zoom"],10,2,20,20]}},{id:"highway_major_subtle",type:"line",source:"openmaptiles","source-layer":"transportation",maxzoom:11,filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["primary","secondary","tertiary","trunk"],!0,!1]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-width":2,"line-color":"rgba(85, 85, 85, 1)"}},{id:"highway_motorway_casing",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["match",["get","brunnel"],["bridge","tunnel"],!1,!0],["==",["get","class"],"motorway"]]],layout:{"line-cap":"butt","line-join":"miter"},paint:{"line-color":"rgba(68, 68, 68, 1)","line-dasharray":[2,0],"line-opacity":1,"line-width":["interpolate",["exponential",1.4],["zoom"],5.8,0,6,3,20,40]}},{id:"highway_motorway_inner",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["match",["get","brunnel"],["bridge","tunnel"],!1,!0],["==",["get","class"],"motorway"]]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":["interpolate",["linear"],["zoom"],5.8,"rgba(102, 102, 102, 1)",6,"rgba(85, 85, 85, 1)"],"line-width":["interpolate",["exponential",1.4],["zoom"],4,2,6,1.3,20,30]}},{id:"highway_motorway_subtle",type:"line",source:"openmaptiles","source-layer":"transportation",maxzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["==",["get","class"],"motorway"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(102, 102, 102, 1)","line-width":["interpolate",["exponential",1.4],["zoom"],4,2,6,1.3]}},{id:"railway_transit",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:16,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","class"],"transit"],["match",["get","brunnel"],["tunnel"],!1,!0]]],layout:{"line-join":"round"},paint:{"line-color":"rgba(85, 85, 85, 1)","line-width":3}},{id:"railway_transit_dashline",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:16,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","class"],"transit"],["match",["get","brunnel"],["tunnel"],!1,!0]]],layout:{"line-join":"round"},paint:{"line-color":"rgba(68, 68, 68, 1)","line-dasharray":[3,3],"line-width":2}},{id:"railway_service",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:16,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","class"],"rail"],["has","service"]]],layout:{"line-join":"round"},paint:{"line-color":"rgba(102, 102, 102, 1)","line-width":3}},{id:"railway_service_dashline",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:16,filter:["all",["==",["geometry-type"],"LineString"],["==",["get","class"],"rail"],["has","service"]],layout:{"line-join":"round"},paint:{"line-color":"rgba(85, 85, 85, 1)","line-dasharray":[3,3],"line-width":2}},{id:"railway",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:13,filter:["all",["==",["geometry-type"],"LineString"],["all",["!",["has","service"]],["==",["get","class"],"rail"]]],layout:{"line-join":"round"},paint:{"line-color":"rgba(85, 85, 85, 1)","line-width":["interpolate",["exponential",1.3],["zoom"],16,3,20,7]}},{id:"railway_dashline",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:13,filter:["all",["==",["geometry-type"],"LineString"],["all",["!",["has","service"]],["==",["get","class"],"rail"]]],layout:{"line-join":"round"},paint:{"line-color":"rgba(68, 68, 68, 1)","line-dasharray":[3,3],"line-width":["interpolate",["exponential",1.3],["zoom"],16,2,20,6]}},{id:"highway_motorway_bridge_casing",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","brunnel"],"bridge"],["==",["get","class"],"motorway"]]],layout:{"line-cap":"butt","line-join":"miter"},paint:{"line-color":"rgba(68, 68, 68, 1)","line-dasharray":[2,0],"line-opacity":1,"line-width":["interpolate",["exponential",1.4],["zoom"],5.8,0,6,5,20,45]}},{id:"highway_motorway_bridge_inner",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","brunnel"],"bridge"],["==",["get","class"],"motorway"]]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":["interpolate",["linear"],["zoom"],5.8,"rgba(102, 102, 102, 1)",6,"rgba(85, 85, 85, 1)"],"line-width":["interpolate",["exponential",1.4],["zoom"],4,2,6,1.3,20,30]}},{id:"boundary_3",type:"line",source:"openmaptiles","source-layer":"boundary",minzoom:8,filter:["all",[">=",["get","admin_level"],3],["<=",["get","admin_level"],6],["!=",["get","maritime"],1],["!=",["get","disputed"],1],["!",["has","claimed_by"]]],paint:{"line-color":"rgba(68, 68, 68, 1)","line-dasharray":[1,1],"line-width":["interpolate",["linear"],["zoom"],7,1,11,2]}},{id:"boundary_2",type:"line",source:"openmaptiles","source-layer":"boundary",filter:["all",["==",["get","admin_level"],2],["!=",["get","maritime"],1],["!=",["get","disputed"],1],["!",["has","claimed_by"]]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(51, 51, 51, 1)","line-opacity":["interpolate",["linear"],["zoom"],0,.4,4,1],"line-width":["interpolate",["linear"],["zoom"],3,1,5,1.2,12,3]}},{id:"boundary_disputed",type:"line",source:"openmaptiles","source-layer":"boundary",filter:["all",["!=",["get","maritime"],1],["==",["get","disputed"],1]],paint:{"line-color":"rgba(51, 51, 51, 1)","line-dasharray":[1,2],"line-width":["interpolate",["linear"],["zoom"],3,1,5,1.2,12,3]}},{id:"waterway_line_label",type:"symbol",source:"openmaptiles","source-layer":"waterway",minzoom:10,filter:["==",["geometry-type"],"LineString"],layout:{"symbol-placement":"line","symbol-spacing":350,"text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-letter-spacing":.2,"text-max-width":5,"text-size":14},paint:{"text-color":"rgba(34, 34, 34, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"water_name_point_label",type:"symbol",source:"openmaptiles","source-layer":"water_name",minzoom:0,filter:["==",["geometry-type"],"Point"],layout:{visibility:"none"}},{id:"water_name_line_label",type:"symbol",source:"openmaptiles","source-layer":"water_name",filter:["==",["geometry-type"],"LineString"],layout:{visibility:"none"}},{id:"highway-name-path",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:15.5,filter:["==",["get","class"],"path"],layout:{"symbol-placement":"line","text-field":["get","name:latin"],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"map","text-size":["interpolate",["linear"],["zoom"],13,12,14,13]},paint:{"text-color":"rgba(158, 158, 158, 1)","text-halo-color":"rgba(244, 244, 244, 1)","text-halo-width":.5}},{id:"highway-name-minor",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:15,filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["minor","service","track"],!0,!1]],layout:{"symbol-placement":"line","text-field":["get","name:latin"],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"map","text-size":["interpolate",["linear"],["zoom"],13,12,14,13]},paint:{"text-color":"rgba(17, 17, 17, 1)","text-halo-width":1,"text-halo-color":"rgba(255, 255, 255, 1)"}},{id:"highway-name-major",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:12.2,filter:["match",["get","class"],["primary","secondary","tertiary","trunk"],!0,!1],layout:{"symbol-placement":"line","text-field":["get","name:latin"],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"map","text-size":["interpolate",["linear"],["zoom"],13,12,14,13]},paint:{"text-color":"rgba(34, 34, 34, 1)","text-halo-width":1,"text-halo-color":"rgba(255, 255, 255, 1)"}},{id:"highway-shield-non-us",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:11,filter:["all",["<=",["get","ref_length"],6],["==",["geometry-type"],"LineString"],["match",["get","network"],["us-highway","us-interstate","us-state"],!1,!0]],layout:{"icon-rotation-alignment":"viewport","icon-size":1,"symbol-placement":["step",["zoom"],"point",11,"line"],"symbol-spacing":200,"text-field":["to-string",["get","ref"]],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"viewport","text-size":10},paint:{"text-halo-color":"rgba(255, 255, 255, 1)","text-color":"rgba(255, 255, 255, 1)"}},{id:"highway-shield-us-interstate",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:11,filter:["all",["<=",["get","ref_length"],6],["==",["geometry-type"],"LineString"],["match",["get","network"],["us-interstate"],!0,!1]],layout:{"icon-rotation-alignment":"viewport","icon-size":1,"symbol-placement":["step",["zoom"],"point",7,"line",8,"line"],"symbol-spacing":200,"text-field":["to-string",["get","ref"]],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"viewport","text-size":10}},{id:"road_shield_us",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:12,filter:["all",["<=",["get","ref_length"],6],["==",["geometry-type"],"LineString"],["match",["get","network"],["us-highway","us-state"],!0,!1]],layout:{"icon-rotation-alignment":"viewport","icon-size":1,"symbol-placement":["step",["zoom"],"point",11,"line"],"symbol-spacing":200,"text-field":["to-string",["get","ref"]],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"viewport","text-size":10}},{id:"airport",type:"symbol",source:"openmaptiles","source-layer":"aerodrome_label",minzoom:11,filter:["all",["has","iata"]],layout:{"icon-size":1,"text-anchor":"top","text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-max-width":9,"text-offset":[0,.6],"text-optional":!0,"text-padding":2,"text-size":12},paint:{"text-color":"rgba(51, 51, 51, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_other",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:8,filter:["match",["get","class"],["city","continent","country","state","town","village"],!1,!0],layout:{"text-field":["get","name:latin"],"text-font":["Noto Sans Regular"],"text-letter-spacing":.1,"text-max-width":9,"text-size":["interpolate",["linear"],["zoom"],8,9,12,10],"text-transform":"uppercase"},paint:{"text-color":"rgba(17, 17, 17, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_village",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:9,filter:["==",["get","class"],"village"],layout:{"icon-allow-overlap":!0,"icon-optional":!1,"icon-size":.2,"text-anchor":"bottom","text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-max-width":8,"text-size":["interpolate",["exponential",1.2],["zoom"],7,10,11,12]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_town",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:6,filter:["==",["get","class"],"town"],layout:{"icon-allow-overlap":!0,"icon-optional":!1,"icon-size":.2,"text-anchor":"bottom","text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-max-width":8,"text-size":["interpolate",["exponential",1.2],["zoom"],7,12,11,14]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_state",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:5,maxzoom:8,filter:["==",["get","class"],"state"],layout:{"text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-letter-spacing":.2,"text-max-width":9,"text-size":["interpolate",["linear"],["zoom"],5,10,8,14],"text-transform":"uppercase"},paint:{"text-color":"rgba(17, 17, 17, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_city",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:3,filter:["all",["==",["get","class"],"city"],["!=",["get","capital"],2]],layout:{"icon-allow-overlap":!0,"icon-optional":!1,"icon-size":.4,"text-anchor":"bottom","text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-max-width":8,"text-offset":[0,-.1],"text-size":["interpolate",["exponential",1.2],["zoom"],4,11,7,13,11,18]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_city_capital",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:3,filter:["all",["==",["get","class"],"city"],["==",["get","capital"],2]],layout:{"icon-allow-overlap":!0,"icon-optional":!1,"icon-size":.5,"text-anchor":"bottom","text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Bold"],"text-max-width":8,"text-offset":[0,-.2],"text-size":["interpolate",["exponential",1.2],["zoom"],4,12,7,14,11,20]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_country_3",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:2,maxzoom:9,filter:["all",["==",["get","class"],"country"],[">=",["get","rank"],3]],layout:{"text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Bold"],"text-max-width":6.25,"text-size":["interpolate",["linear"],["zoom"],3,9,7,17]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_country_2",type:"symbol",source:"openmaptiles","source-layer":"place",maxzoom:9,filter:["all",["==",["get","class"],"country"],["==",["get","rank"],2]],layout:{"text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Bold"],"text-max-width":6.25,"text-size":["interpolate",["linear"],["zoom"],2,9,5,17]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_country_1",type:"symbol",source:"openmaptiles","source-layer":"place",maxzoom:9,filter:["all",["==",["get","class"],"country"],["==",["get","rank"],1]],layout:{"text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Bold"],"text-max-width":6.25,"text-size":["interpolate",["linear"],["zoom"],1,9,4,17]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}}]},uy={version:8,sources:{openmaptiles:{type:"vector",url:"https://tiles.openfreemap.org/planet"}},glyphs:"https://tiles.openfreemap.org/fonts/{fontstack}/{range}.pbf",layers:[{id:"background",type:"background",paint:{"background-color":"rgba(220, 220, 220, 1)"}},{id:"park",type:"fill",source:"openmaptiles","source-layer":"park",filter:["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],paint:{"fill-color":"rgba(228, 228, 228, 1)"}},{id:"water",type:"fill",source:"openmaptiles","source-layer":"water",filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["!=",["get","brunnel"],"tunnel"]],paint:{"fill-antialias":!0,"fill-color":"rgba(156, 156, 156, 1)"}},{id:"landcover_ice_shelf",type:"fill",source:"openmaptiles","source-layer":"landcover",maxzoom:8,filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["==",["get","subclass"],"ice_shelf"]],paint:{"fill-color":"rgba(228, 228, 228, 1)","fill-opacity":.7}},{id:"landcover_glacier",type:"fill",source:"openmaptiles","source-layer":"landcover",maxzoom:8,filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["==",["get","subclass"],"glacier"]],paint:{"fill-color":"rgba(253, 253, 253, 1)","fill-opacity":["interpolate",["linear"],["zoom"],0,1,8,.5]}},{id:"landuse_residential",type:"fill",source:"openmaptiles","source-layer":"landuse",maxzoom:16,filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["==",["get","class"],"residential"]],paint:{"fill-color":"rgba(204, 204, 204, 1)","fill-opacity":["interpolate",["exponential",.6],["zoom"],8,.8,9,.6]}},{id:"landcover_wood",type:"fill",source:"openmaptiles","source-layer":"landcover",minzoom:10,filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["==",["get","class"],"wood"]],paint:{"fill-color":"rgba(228, 228, 228, 1)","fill-opacity":["interpolate",["linear"],["zoom"],8,0,12,1]}},{id:"waterway",type:"line",source:"openmaptiles","source-layer":"waterway",filter:["==",["geometry-type"],"LineString"],paint:{"line-color":"rgba(156, 156, 156, 1)"}},{id:"building",type:"fill",source:"openmaptiles","source-layer":"building",minzoom:12,paint:{"fill-antialias":!0,"fill-color":"rgba(236, 236, 236, 1)","fill-outline-color":"rgba(202, 202, 202, 1)"}},{id:"tunnel_motorway_casing",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","brunnel"],"tunnel"],["==",["get","class"],"motorway"]]],layout:{"line-cap":"butt","line-join":"miter"},paint:{"line-color":"rgb(168, 168, 168)","line-opacity":1,"line-width":["interpolate",["exponential",1.4],["zoom"],5.8,0,6,3,20,40]}},{id:"tunnel_motorway_inner",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","brunnel"],"tunnel"],["==",["get","class"],"motorway"]]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgb(185, 185, 185)","line-width":["interpolate",["exponential",1.4],["zoom"],4,2,6,1.3,20,30]}},{id:"aeroway-taxiway",type:"line",source:"openmaptiles","source-layer":"aeroway",minzoom:12,filter:["match",["get","class"],["taxiway"],!0,!1],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(185, 185, 185, 1)","line-opacity":1,"line-width":["interpolate",["exponential",1.55],["zoom"],13,1.8,20,20]}},{id:"aeroway-runway-casing",type:"line",source:"openmaptiles","source-layer":"aeroway",minzoom:11,filter:["match",["get","class"],["runway"],!0,!1],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(185, 185, 185, 1)","line-opacity":1,"line-width":["interpolate",["exponential",1.5],["zoom"],11,6,17,55]}},{id:"aeroway-area",type:"fill",source:"openmaptiles","source-layer":"aeroway",minzoom:4,filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["match",["get","class"],["runway","taxiway"],!0,!1]],paint:{"fill-color":"rgba(228, 228, 228, 1)","fill-opacity":["interpolate",["linear"],["zoom"],13,0,14,1]}},{id:"aeroway-runway",type:"line",source:"openmaptiles","source-layer":"aeroway",minzoom:11,filter:["all",["match",["get","class"],["runway"],!0,!1],["==",["geometry-type"],"LineString"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(168, 168, 168, 1)","line-opacity":1,"line-width":["interpolate",["exponential",1.5],["zoom"],11,4,17,50]}},{id:"road_area_pier",type:"fill",source:"openmaptiles","source-layer":"transportation",filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["==",["get","class"],"pier"]],paint:{"fill-antialias":!0,"fill-color":"rgba(150, 150, 150, 1)"}},{id:"road_pier",type:"line",source:"openmaptiles","source-layer":"transportation",filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["pier"],!0,!1]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(152, 152, 152, 1)","line-width":["interpolate",["exponential",1.2],["zoom"],15,1,17,4]}},{id:"highway_path",type:"line",source:"openmaptiles","source-layer":"transportation",filter:["all",["==",["geometry-type"],"LineString"],["==",["get","class"],"path"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgb(188, 188, 188)","line-opacity":.9,"line-width":["interpolate",["exponential",1.2],["zoom"],13,1,20,10]}},{id:"highway_minor",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:8,filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["minor","service","track"],!0,!1]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(202, 202, 202, 1)","line-opacity":.9,"line-width":["interpolate",["exponential",1.55],["zoom"],13,1.8,20,20]}},{id:"highway_major_casing",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:11,filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["primary","secondary","tertiary","trunk"],!0,!1]],layout:{"line-cap":"butt","line-join":"miter"},paint:{"line-color":"rgb(185, 185, 185)","line-dasharray":[12,0],"line-width":["interpolate",["exponential",1.3],["zoom"],10,3,20,23]}},{id:"highway_major_inner",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:11,filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["primary","secondary","tertiary","trunk"],!0,!1]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(202, 202, 202, 1)","line-width":["interpolate",["exponential",1.3],["zoom"],10,2,20,20]}},{id:"highway_major_subtle",type:"line",source:"openmaptiles","source-layer":"transportation",maxzoom:11,filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["primary","secondary","tertiary","trunk"],!0,!1]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(185, 185, 185, 1)","line-width":2}},{id:"highway_motorway_casing",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["match",["get","brunnel"],["bridge","tunnel"],!1,!0],["==",["get","class"],"motorway"]]],layout:{"line-cap":"butt","line-join":"miter"},paint:{"line-color":"rgb(168, 168, 168)","line-dasharray":[2,0],"line-opacity":1,"line-width":["interpolate",["exponential",1.4],["zoom"],5.8,0,6,3,20,40]}},{id:"highway_motorway_inner",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["match",["get","brunnel"],["bridge","tunnel"],!1,!0],["==",["get","class"],"motorway"]]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":["interpolate",["linear"],["zoom"],5.8,"rgba(202, 202, 202, 1)",6,"rgba(185, 185, 185, 1)"],"line-width":["interpolate",["exponential",1.4],["zoom"],4,2,6,1.3,20,30]}},{id:"highway_motorway_subtle",type:"line",source:"openmaptiles","source-layer":"transportation",maxzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["==",["get","class"],"motorway"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(202, 202, 202, 1)","line-width":["interpolate",["exponential",1.4],["zoom"],4,2,6,1.3]}},{id:"railway_transit",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:16,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","class"],"transit"],["match",["get","brunnel"],["tunnel"],!1,!0]]],layout:{"line-join":"round"},paint:{"line-color":"rgba(185, 185, 185, 1)","line-width":3}},{id:"railway_transit_dashline",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:16,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","class"],"transit"],["match",["get","brunnel"],["tunnel"],!1,!0]]],layout:{"line-join":"round"},paint:{"line-color":"rgba(168, 168, 168, 1)","line-dasharray":[3,3],"line-width":2}},{id:"railway_service",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:16,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","class"],"rail"],["has","service"]]],layout:{"line-join":"round"},paint:{"line-color":"rgba(202, 202, 202, 1)","line-width":3}},{id:"railway_service_dashline",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:16,filter:["all",["==",["geometry-type"],"LineString"],["==",["get","class"],"rail"],["has","service"]],layout:{"line-join":"round"},paint:{"line-color":"rgba(185, 185, 185, 1)","line-dasharray":[3,3],"line-width":2}},{id:"railway",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:13,filter:["all",["==",["geometry-type"],"LineString"],["all",["!",["has","service"]],["==",["get","class"],"rail"]]],layout:{"line-join":"round"},paint:{"line-color":"rgba(185, 185, 185, 1)","line-width":["interpolate",["exponential",1.3],["zoom"],16,3,20,7]}},{id:"railway_dashline",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:13,filter:["all",["==",["geometry-type"],"LineString"],["all",["!",["has","service"]],["==",["get","class"],"rail"]]],layout:{"line-join":"round"},paint:{"line-color":"rgba(168, 168, 168, 1)","line-dasharray":[3,3],"line-width":["interpolate",["exponential",1.3],["zoom"],16,2,20,6]}},{id:"highway_motorway_bridge_casing",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","brunnel"],"bridge"],["==",["get","class"],"motorway"]]],layout:{"line-cap":"butt","line-join":"miter"},paint:{"line-color":"rgb(168, 168, 168)","line-dasharray":[2,0],"line-opacity":1,"line-width":["interpolate",["exponential",1.4],["zoom"],5.8,0,6,5,20,45]}},{id:"highway_motorway_bridge_inner",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","brunnel"],"bridge"],["==",["get","class"],"motorway"]]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":["interpolate",["linear"],["zoom"],5.8,"rgba(202, 202, 202, 1)",6,"rgba(185, 185, 185, 1)"],"line-width":["interpolate",["exponential",1.4],["zoom"],4,2,6,1.3,20,30]}},{id:"boundary_3",type:"line",source:"openmaptiles","source-layer":"boundary",minzoom:8,filter:["all",[">=",["get","admin_level"],3],["<=",["get","admin_level"],6],["!=",["get","maritime"],1],["!=",["get","disputed"],1],["!",["has","claimed_by"]]],paint:{"line-color":"rgba(168, 168, 168, 1)","line-dasharray":[1,1],"line-width":["interpolate",["linear"],["zoom"],7,1,11,2]}},{id:"boundary_2",type:"line",source:"openmaptiles","source-layer":"boundary",filter:["all",["==",["get","admin_level"],2],["!=",["get","maritime"],1],["!=",["get","disputed"],1],["!",["has","claimed_by"]]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(151, 151, 151, 1)","line-opacity":["interpolate",["linear"],["zoom"],0,.4,4,1],"line-width":["interpolate",["linear"],["zoom"],3,1,5,1.2,12,3]}},{id:"boundary_disputed",type:"line",source:"openmaptiles","source-layer":"boundary",filter:["all",["!=",["get","maritime"],1],["==",["get","disputed"],1]],paint:{"line-color":"rgba(151, 151, 151, 1)","line-dasharray":[1,2],"line-width":["interpolate",["linear"],["zoom"],3,1,5,1.2,12,3]}},{id:"waterway_line_label",type:"symbol",source:"openmaptiles","source-layer":"waterway",minzoom:10,filter:["==",["geometry-type"],"LineString"],layout:{"symbol-placement":"line","symbol-spacing":350,"text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-letter-spacing":.2,"text-max-width":5,"text-size":14},paint:{"text-color":"rgba(34, 34, 34, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1.5}},{id:"water_name_point_label",type:"symbol",source:"openmaptiles","source-layer":"water_name",minzoom:0,filter:["==",["geometry-type"],"Point"],layout:{visibility:"none"}},{id:"water_name_line_label",type:"symbol",source:"openmaptiles","source-layer":"water_name",filter:["==",["geometry-type"],"LineString"],layout:{visibility:"none"}},{id:"highway-name-path",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:15.5,filter:["==",["get","class"],"path"],layout:{"symbol-placement":"line","text-field":["get","name:latin"],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"map","text-size":["interpolate",["linear"],["zoom"],13,12,14,13]},paint:{"text-color":"rgba(158, 158, 158, 1)","text-halo-color":"rgba(244, 244, 244, 1)","text-halo-width":.5}},{id:"highway-name-minor",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:15,filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["minor","service","track"],!0,!1]],layout:{"symbol-placement":"line","text-field":["get","name:latin"],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"map","text-size":["interpolate",["linear"],["zoom"],13,12,14,13]},paint:{"text-color":"rgba(17, 17, 17, 1)","text-halo-width":1,"text-halo-color":"rgba(255, 255, 255, 1)"}},{id:"highway-name-major",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:12.2,filter:["match",["get","class"],["primary","secondary","tertiary","trunk"],!0,!1],layout:{"symbol-placement":"line","text-field":["get","name:latin"],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"map","text-size":["interpolate",["linear"],["zoom"],13,12,14,13]},paint:{"text-color":"rgba(34, 34, 34, 1)","text-halo-width":1,"text-halo-color":"rgba(255, 255, 255, 1)"}},{id:"highway-shield-non-us",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:11,filter:["all",["<=",["get","ref_length"],6],["==",["geometry-type"],"LineString"],["match",["get","network"],["us-highway","us-interstate","us-state"],!1,!0]],layout:{"icon-rotation-alignment":"viewport","icon-size":1,"symbol-placement":["step",["zoom"],"point",11,"line"],"symbol-spacing":200,"text-field":["to-string",["get","ref"]],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"viewport","text-size":10},paint:{"text-halo-color":"rgba(0, 0, 0, 1)","text-color":"rgba(0, 0, 0, 1)"}},{id:"highway-shield-us-interstate",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:11,filter:["all",["<=",["get","ref_length"],6],["==",["geometry-type"],"LineString"],["match",["get","network"],["us-interstate"],!0,!1]],layout:{"icon-rotation-alignment":"viewport","icon-size":1,"symbol-placement":["step",["zoom"],"point",7,"line",8,"line"],"symbol-spacing":200,"text-field":["to-string",["get","ref"]],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"viewport","text-size":10}},{id:"road_shield_us",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:12,filter:["all",["<=",["get","ref_length"],6],["==",["geometry-type"],"LineString"],["match",["get","network"],["us-highway","us-state"],!0,!1]],layout:{"icon-rotation-alignment":"viewport","icon-size":1,"symbol-placement":["step",["zoom"],"point",11,"line"],"symbol-spacing":200,"text-field":["to-string",["get","ref"]],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"viewport","text-size":10}},{id:"airport",type:"symbol",source:"openmaptiles","source-layer":"aerodrome_label",minzoom:11,filter:["all",["has","iata"]],layout:{"icon-size":1,"text-anchor":"top","text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-max-width":9,"text-offset":[0,.6],"text-optional":!0,"text-padding":2,"text-size":12},paint:{"text-color":"rgba(51, 51, 51, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_other",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:8,filter:["match",["get","class"],["city","continent","country","state","town","village"],!1,!0],layout:{"text-field":["get","name:latin"],"text-font":["Noto Sans Regular"],"text-letter-spacing":.1,"text-max-width":9,"text-size":["interpolate",["linear"],["zoom"],8,9,12,10],"text-transform":"uppercase"},paint:{"text-color":"rgba(17, 17, 17, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_village",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:9,filter:["==",["get","class"],"village"],layout:{"icon-allow-overlap":!0,"icon-optional":!1,"icon-size":.2,"text-anchor":"bottom","text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-max-width":8,"text-size":["interpolate",["exponential",1.2],["zoom"],7,10,11,12]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_town",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:6,filter:["==",["get","class"],"town"],layout:{"icon-allow-overlap":!0,"icon-optional":!1,"icon-size":.2,"text-anchor":"bottom","text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-max-width":8,"text-size":["interpolate",["exponential",1.2],["zoom"],7,12,11,14]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_state",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:5,maxzoom:8,filter:["==",["get","class"],"state"],layout:{"text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-letter-spacing":.2,"text-max-width":9,"text-size":["interpolate",["linear"],["zoom"],5,10,8,14],"text-transform":"uppercase"},paint:{"text-color":"rgba(17, 17, 17, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_city",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:3,filter:["all",["==",["get","class"],"city"],["!=",["get","capital"],2]],layout:{"icon-allow-overlap":!0,"icon-optional":!1,"icon-size":.4,"text-anchor":"bottom","text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-max-width":8,"text-offset":[0,-.1],"text-size":["interpolate",["exponential",1.2],["zoom"],4,11,7,13,11,18]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_city_capital",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:3,filter:["all",["==",["get","class"],"city"],["==",["get","capital"],2]],layout:{"icon-allow-overlap":!0,"icon-optional":!1,"icon-size":.5,"text-anchor":"bottom","text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Bold"],"text-max-width":8,"text-offset":[0,-.2],"text-size":["interpolate",["exponential",1.2],["zoom"],4,12,7,14,11,20]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_country_3",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:2,maxzoom:9,filter:["all",["==",["get","class"],"country"],[">=",["get","rank"],3]],layout:{"text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Bold"],"text-max-width":6.25,"text-size":["interpolate",["linear"],["zoom"],3,9,7,17]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_country_2",type:"symbol",source:"openmaptiles","source-layer":"place",maxzoom:9,filter:["all",["==",["get","class"],"country"],["==",["get","rank"],2]],layout:{"text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Bold"],"text-max-width":6.25,"text-size":["interpolate",["linear"],["zoom"],2,9,5,17]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_country_1",type:"symbol",source:"openmaptiles","source-layer":"place",maxzoom:9,filter:["all",["==",["get","class"],"country"],["==",["get","rank"],1]],layout:{"text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Bold"],"text-max-width":6.25,"text-size":["interpolate",["linear"],["zoom"],1,9,4,17]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}}]};var Ot;(function(b){b.assertEqual=R=>{};function g(R){}b.assertIs=g;function w(R){throw new Error}b.assertNever=w,b.arrayToEnum=R=>{const B={};for(const S of R)B[S]=S;return B},b.getValidEnumValues=R=>{const B=b.objectKeys(R).filter(o=>typeof R[R[o]]!="number"),S={};for(const o of B)S[o]=R[o];return b.objectValues(S)},b.objectValues=R=>b.objectKeys(R).map(function(B){return R[B]}),b.objectKeys=typeof Object.keys=="function"?R=>Object.keys(R):R=>{const B=[];for(const S in R)Object.prototype.hasOwnProperty.call(R,S)&&B.push(S);return B},b.find=(R,B)=>{for(const S of R)if(B(S))return S},b.isInteger=typeof Number.isInteger=="function"?R=>Number.isInteger(R):R=>typeof R=="number"&&Number.isFinite(R)&&Math.floor(R)===R;function I(R,B=" | "){return R.map(S=>typeof S=="string"?`'${S}'`:S).join(B)}b.joinValues=I,b.jsonStringifyReplacer=(R,B)=>typeof B=="bigint"?B.toString():B})(Ot||(Ot={}));var zf;(function(b){b.mergeShapes=(g,w)=>({...g,...w})})(zf||(zf={}));const Ye=Ot.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),za=b=>{switch(typeof b){case"undefined":return Ye.undefined;case"string":return Ye.string;case"number":return Number.isNaN(b)?Ye.nan:Ye.number;case"boolean":return Ye.boolean;case"function":return Ye.function;case"bigint":return Ye.bigint;case"symbol":return Ye.symbol;case"object":return Array.isArray(b)?Ye.array:b===null?Ye.null:b.then&&typeof b.then=="function"&&b.catch&&typeof b.catch=="function"?Ye.promise:typeof Map<"u"&&b instanceof Map?Ye.map:typeof Set<"u"&&b instanceof Set?Ye.set:typeof Date<"u"&&b instanceof Date?Ye.date:Ye.object;default:return Ye.unknown}},Ne=Ot.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class _n extends Error{get errors(){return this.issues}constructor(g){super(),this.issues=[],this.addIssue=I=>{this.issues=[...this.issues,I]},this.addIssues=(I=[])=>{this.issues=[...this.issues,...I]};const w=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,w):this.__proto__=w,this.name="ZodError",this.issues=g}format(g){const w=g||function(B){return B.message},I={_errors:[]},R=B=>{for(const S of B.issues)if(S.code==="invalid_union")S.unionErrors.map(R);else if(S.code==="invalid_return_type")R(S.returnTypeError);else if(S.code==="invalid_arguments")R(S.argumentsError);else if(S.path.length===0)I._errors.push(w(S));else{let o=I,de=0;for(;de<S.path.length;){const ge=S.path[de];de===S.path.length-1?(o[ge]=o[ge]||{_errors:[]},o[ge]._errors.push(w(S))):o[ge]=o[ge]||{_errors:[]},o=o[ge],de++}}};return R(this),I}static assert(g){if(!(g instanceof _n))throw new Error(`Not a ZodError: ${g}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Ot.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(g=w=>w.message){const w={},I=[];for(const R of this.issues)R.path.length>0?(w[R.path[0]]=w[R.path[0]]||[],w[R.path[0]].push(g(R))):I.push(g(R));return{formErrors:I,fieldErrors:w}}get formErrors(){return this.flatten()}}_n.create=b=>new _n(b);const Ml=(b,g)=>{let w;switch(b.code){case Ne.invalid_type:b.received===Ye.undefined?w="Required":w=`Expected ${b.expected}, received ${b.received}`;break;case Ne.invalid_literal:w=`Invalid literal value, expected ${JSON.stringify(b.expected,Ot.jsonStringifyReplacer)}`;break;case Ne.unrecognized_keys:w=`Unrecognized key(s) in object: ${Ot.joinValues(b.keys,", ")}`;break;case Ne.invalid_union:w="Invalid input";break;case Ne.invalid_union_discriminator:w=`Invalid discriminator value. Expected ${Ot.joinValues(b.options)}`;break;case Ne.invalid_enum_value:w=`Invalid enum value. Expected ${Ot.joinValues(b.options)}, received '${b.received}'`;break;case Ne.invalid_arguments:w="Invalid function arguments";break;case Ne.invalid_return_type:w="Invalid function return type";break;case Ne.invalid_date:w="Invalid date";break;case Ne.invalid_string:typeof b.validation=="object"?"includes"in b.validation?(w=`Invalid input: must include "${b.validation.includes}"`,typeof b.validation.position=="number"&&(w=`${w} at one or more positions greater than or equal to ${b.validation.position}`)):"startsWith"in b.validation?w=`Invalid input: must start with "${b.validation.startsWith}"`:"endsWith"in b.validation?w=`Invalid input: must end with "${b.validation.endsWith}"`:Ot.assertNever(b.validation):b.validation!=="regex"?w=`Invalid ${b.validation}`:w="Invalid";break;case Ne.too_small:b.type==="array"?w=`Array must contain ${b.exact?"exactly":b.inclusive?"at least":"more than"} ${b.minimum} element(s)`:b.type==="string"?w=`String must contain ${b.exact?"exactly":b.inclusive?"at least":"over"} ${b.minimum} character(s)`:b.type==="number"?w=`Number must be ${b.exact?"exactly equal to ":b.inclusive?"greater than or equal to ":"greater than "}${b.minimum}`:b.type==="date"?w=`Date must be ${b.exact?"exactly equal to ":b.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(b.minimum))}`:w="Invalid input";break;case Ne.too_big:b.type==="array"?w=`Array must contain ${b.exact?"exactly":b.inclusive?"at most":"less than"} ${b.maximum} element(s)`:b.type==="string"?w=`String must contain ${b.exact?"exactly":b.inclusive?"at most":"under"} ${b.maximum} character(s)`:b.type==="number"?w=`Number must be ${b.exact?"exactly":b.inclusive?"less than or equal to":"less than"} ${b.maximum}`:b.type==="bigint"?w=`BigInt must be ${b.exact?"exactly":b.inclusive?"less than or equal to":"less than"} ${b.maximum}`:b.type==="date"?w=`Date must be ${b.exact?"exactly":b.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(b.maximum))}`:w="Invalid input";break;case Ne.custom:w="Invalid input";break;case Ne.invalid_intersection_types:w="Intersection results could not be merged";break;case Ne.not_multiple_of:w=`Number must be a multiple of ${b.multipleOf}`;break;case Ne.not_finite:w="Number must be finite";break;default:w=g.defaultError,Ot.assertNever(b)}return{message:w}};let hy=Ml;function nd(){return hy}const ad=b=>{const{data:g,path:w,errorMaps:I,issueData:R}=b,B=[...w,...R.path||[]],S={...R,path:B};if(R.message!==void 0)return{...R,path:B,message:R.message};let o="";const de=I.filter(ge=>!!ge).slice().reverse();for(const ge of de)o=ge(S,{data:g,defaultError:o}).message;return{...R,path:B,message:o}};function He(b,g){const w=nd(),I=ad({issueData:g,data:b.data,path:b.path,errorMaps:[b.common.contextualErrorMap,b.schemaErrorMap,w,w===Ml?void 0:Ml].filter(R=>!!R)});b.common.issues.push(I)}class tn{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(g,w){const I=[];for(const R of w){if(R.status==="aborted")return ft;R.status==="dirty"&&g.dirty(),I.push(R.value)}return{status:g.value,value:I}}static async mergeObjectAsync(g,w){const I=[];for(const R of w){const B=await R.key,S=await R.value;I.push({key:B,value:S})}return tn.mergeObjectSync(g,I)}static mergeObjectSync(g,w){const I={};for(const R of w){const{key:B,value:S}=R;if(B.status==="aborted"||S.status==="aborted")return ft;B.status==="dirty"&&g.dirty(),S.status==="dirty"&&g.dirty(),B.value!=="__proto__"&&(typeof S.value<"u"||R.alwaysSet)&&(I[B.value]=S.value)}return{status:g.value,value:I}}}const ft=Object.freeze({status:"aborted"}),Sl=b=>({status:"dirty",value:b}),$r=b=>({status:"valid",value:b}),Rf=b=>b.status==="aborted",Df=b=>b.status==="dirty",po=b=>b.status==="valid",fu=b=>typeof Promise<"u"&&b instanceof Promise;var it;(function(b){b.errToObj=g=>typeof g=="string"?{message:g}:g||{},b.toString=g=>typeof g=="string"?g:g==null?void 0:g.message})(it||(it={}));class Ra{constructor(g,w,I,R){this._cachedPath=[],this.parent=g,this.data=w,this._path=I,this._key=R}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Lf=(b,g)=>{if(po(g))return{success:!0,data:g.value};if(!b.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const w=new _n(b.common.issues);return this._error=w,this._error}}};function St(b){if(!b)return{};const{errorMap:g,invalid_type_error:w,required_error:I,description:R}=b;if(g&&(w||I))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return g?{errorMap:g,description:R}:{errorMap:(S,o)=>{const{message:de}=b;return S.code==="invalid_enum_value"?{message:de??o.defaultError}:typeof o.data>"u"?{message:de??I??o.defaultError}:S.code!=="invalid_type"?{message:o.defaultError}:{message:de??w??o.defaultError}},description:R}}class Dt{get description(){return this._def.description}_getType(g){return za(g.data)}_getOrReturnCtx(g,w){return w||{common:g.parent.common,data:g.data,parsedType:za(g.data),schemaErrorMap:this._def.errorMap,path:g.path,parent:g.parent}}_processInputParams(g){return{status:new tn,ctx:{common:g.parent.common,data:g.data,parsedType:za(g.data),schemaErrorMap:this._def.errorMap,path:g.path,parent:g.parent}}}_parseSync(g){const w=this._parse(g);if(fu(w))throw new Error("Synchronous parse encountered promise.");return w}_parseAsync(g){const w=this._parse(g);return Promise.resolve(w)}parse(g,w){const I=this.safeParse(g,w);if(I.success)return I.data;throw I.error}safeParse(g,w){const I={common:{issues:[],async:(w==null?void 0:w.async)??!1,contextualErrorMap:w==null?void 0:w.errorMap},path:(w==null?void 0:w.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:g,parsedType:za(g)},R=this._parseSync({data:g,path:I.path,parent:I});return Lf(I,R)}"~validate"(g){var I,R;const w={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:g,parsedType:za(g)};if(!this["~standard"].async)try{const B=this._parseSync({data:g,path:[],parent:w});return po(B)?{value:B.value}:{issues:w.common.issues}}catch(B){(R=(I=B==null?void 0:B.message)==null?void 0:I.toLowerCase())!=null&&R.includes("encountered")&&(this["~standard"].async=!0),w.common={issues:[],async:!0}}return this._parseAsync({data:g,path:[],parent:w}).then(B=>po(B)?{value:B.value}:{issues:w.common.issues})}async parseAsync(g,w){const I=await this.safeParseAsync(g,w);if(I.success)return I.data;throw I.error}async safeParseAsync(g,w){const I={common:{issues:[],contextualErrorMap:w==null?void 0:w.errorMap,async:!0},path:(w==null?void 0:w.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:g,parsedType:za(g)},R=this._parse({data:g,path:I.path,parent:I}),B=await(fu(R)?R:Promise.resolve(R));return Lf(I,B)}refine(g,w){const I=R=>typeof w=="string"||typeof w>"u"?{message:w}:typeof w=="function"?w(R):w;return this._refinement((R,B)=>{const S=g(R),o=()=>B.addIssue({code:Ne.custom,...I(R)});return typeof Promise<"u"&&S instanceof Promise?S.then(de=>de?!0:(o(),!1)):S?!0:(o(),!1)})}refinement(g,w){return this._refinement((I,R)=>g(I)?!0:(R.addIssue(typeof w=="function"?w(I,R):w),!1))}_refinement(g){return new yo({schema:this,typeName:mt.ZodEffects,effect:{type:"refinement",refinement:g}})}superRefine(g){return this._refinement(g)}constructor(g){this.spa=this.safeParseAsync,this._def=g,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:w=>this["~validate"](w)}}optional(){return Ba.create(this,this._def)}nullable(){return xo.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Un.create(this)}promise(){return Al.create(this,this._def)}or(g){return gu.create([this,g],this._def)}and(g){return _u.create(this,g,this._def)}transform(g){return new yo({...St(this._def),schema:this,typeName:mt.ZodEffects,effect:{type:"transform",transform:g}})}default(g){const w=typeof g=="function"?g:()=>g;return new dd({...St(this._def),innerType:this,defaultValue:w,typeName:mt.ZodDefault})}brand(){return new Dy({typeName:mt.ZodBranded,type:this,...St(this._def)})}catch(g){const w=typeof g=="function"?g:()=>g;return new pd({...St(this._def),innerType:this,catchValue:w,typeName:mt.ZodCatch})}describe(g){const w=this.constructor;return new w({...this._def,description:g})}pipe(g){return fd.create(this,g)}readonly(){return md.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const dy=/^c[^\s-]{8,}$/i,py=/^[0-9a-z]+$/,fy=/^[0-9A-HJKMNP-TV-Z]{26}$/i,my=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,gy=/^[a-z0-9_-]{21}$/i,_y=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,yy=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,xy=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,vy="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let sd;const by=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,wy=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Ty=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,My=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Sy=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Py=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Bf="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Cy=new RegExp(`^${Bf}$`);function Ff(b){let g="[0-5]\\d";b.precision?g=`${g}\\.\\d{${b.precision}}`:b.precision==null&&(g=`${g}(\\.\\d+)?`);const w=b.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${g})${w}`}function Iy(b){return new RegExp(`^${Ff(b)}$`)}function Ay(b){let g=`${Bf}T${Ff(b)}`;const w=[];return w.push(b.local?"Z?":"Z"),b.offset&&w.push("([+-]\\d{2}:?\\d{2})"),g=`${g}(${w.join("|")})`,new RegExp(`^${g}$`)}function Ey(b,g){return!!((g==="v4"||!g)&&by.test(b)||(g==="v6"||!g)&&Ty.test(b))}function ky(b,g){if(!_y.test(b))return!1;try{const[w]=b.split("."),I=w.replace(/-/g,"+").replace(/_/g,"/").padEnd(w.length+(4-w.length%4)%4,"="),R=JSON.parse(atob(I));return!(typeof R!="object"||R===null||"typ"in R&&(R==null?void 0:R.typ)!=="JWT"||!R.alg||g&&R.alg!==g)}catch{return!1}}function zy(b,g){return!!((g==="v4"||!g)&&wy.test(b)||(g==="v6"||!g)&&My.test(b))}class Da extends Dt{_parse(g){if(this._def.coerce&&(g.data=String(g.data)),this._getType(g)!==Ye.string){const B=this._getOrReturnCtx(g);return He(B,{code:Ne.invalid_type,expected:Ye.string,received:B.parsedType}),ft}const I=new tn;let R;for(const B of this._def.checks)if(B.kind==="min")g.data.length<B.value&&(R=this._getOrReturnCtx(g,R),He(R,{code:Ne.too_small,minimum:B.value,type:"string",inclusive:!0,exact:!1,message:B.message}),I.dirty());else if(B.kind==="max")g.data.length>B.value&&(R=this._getOrReturnCtx(g,R),He(R,{code:Ne.too_big,maximum:B.value,type:"string",inclusive:!0,exact:!1,message:B.message}),I.dirty());else if(B.kind==="length"){const S=g.data.length>B.value,o=g.data.length<B.value;(S||o)&&(R=this._getOrReturnCtx(g,R),S?He(R,{code:Ne.too_big,maximum:B.value,type:"string",inclusive:!0,exact:!0,message:B.message}):o&&He(R,{code:Ne.too_small,minimum:B.value,type:"string",inclusive:!0,exact:!0,message:B.message}),I.dirty())}else if(B.kind==="email")xy.test(g.data)||(R=this._getOrReturnCtx(g,R),He(R,{validation:"email",code:Ne.invalid_string,message:B.message}),I.dirty());else if(B.kind==="emoji")sd||(sd=new RegExp(vy,"u")),sd.test(g.data)||(R=this._getOrReturnCtx(g,R),He(R,{validation:"emoji",code:Ne.invalid_string,message:B.message}),I.dirty());else if(B.kind==="uuid")my.test(g.data)||(R=this._getOrReturnCtx(g,R),He(R,{validation:"uuid",code:Ne.invalid_string,message:B.message}),I.dirty());else if(B.kind==="nanoid")gy.test(g.data)||(R=this._getOrReturnCtx(g,R),He(R,{validation:"nanoid",code:Ne.invalid_string,message:B.message}),I.dirty());else if(B.kind==="cuid")dy.test(g.data)||(R=this._getOrReturnCtx(g,R),He(R,{validation:"cuid",code:Ne.invalid_string,message:B.message}),I.dirty());else if(B.kind==="cuid2")py.test(g.data)||(R=this._getOrReturnCtx(g,R),He(R,{validation:"cuid2",code:Ne.invalid_string,message:B.message}),I.dirty());else if(B.kind==="ulid")fy.test(g.data)||(R=this._getOrReturnCtx(g,R),He(R,{validation:"ulid",code:Ne.invalid_string,message:B.message}),I.dirty());else if(B.kind==="url")try{new URL(g.data)}catch{R=this._getOrReturnCtx(g,R),He(R,{validation:"url",code:Ne.invalid_string,message:B.message}),I.dirty()}else B.kind==="regex"?(B.regex.lastIndex=0,B.regex.test(g.data)||(R=this._getOrReturnCtx(g,R),He(R,{validation:"regex",code:Ne.invalid_string,message:B.message}),I.dirty())):B.kind==="trim"?g.data=g.data.trim():B.kind==="includes"?g.data.includes(B.value,B.position)||(R=this._getOrReturnCtx(g,R),He(R,{code:Ne.invalid_string,validation:{includes:B.value,position:B.position},message:B.message}),I.dirty()):B.kind==="toLowerCase"?g.data=g.data.toLowerCase():B.kind==="toUpperCase"?g.data=g.data.toUpperCase():B.kind==="startsWith"?g.data.startsWith(B.value)||(R=this._getOrReturnCtx(g,R),He(R,{code:Ne.invalid_string,validation:{startsWith:B.value},message:B.message}),I.dirty()):B.kind==="endsWith"?g.data.endsWith(B.value)||(R=this._getOrReturnCtx(g,R),He(R,{code:Ne.invalid_string,validation:{endsWith:B.value},message:B.message}),I.dirty()):B.kind==="datetime"?Ay(B).test(g.data)||(R=this._getOrReturnCtx(g,R),He(R,{code:Ne.invalid_string,validation:"datetime",message:B.message}),I.dirty()):B.kind==="date"?Cy.test(g.data)||(R=this._getOrReturnCtx(g,R),He(R,{code:Ne.invalid_string,validation:"date",message:B.message}),I.dirty()):B.kind==="time"?Iy(B).test(g.data)||(R=this._getOrReturnCtx(g,R),He(R,{code:Ne.invalid_string,validation:"time",message:B.message}),I.dirty()):B.kind==="duration"?yy.test(g.data)||(R=this._getOrReturnCtx(g,R),He(R,{validation:"duration",code:Ne.invalid_string,message:B.message}),I.dirty()):B.kind==="ip"?Ey(g.data,B.version)||(R=this._getOrReturnCtx(g,R),He(R,{validation:"ip",code:Ne.invalid_string,message:B.message}),I.dirty()):B.kind==="jwt"?ky(g.data,B.alg)||(R=this._getOrReturnCtx(g,R),He(R,{validation:"jwt",code:Ne.invalid_string,message:B.message}),I.dirty()):B.kind==="cidr"?zy(g.data,B.version)||(R=this._getOrReturnCtx(g,R),He(R,{validation:"cidr",code:Ne.invalid_string,message:B.message}),I.dirty()):B.kind==="base64"?Sy.test(g.data)||(R=this._getOrReturnCtx(g,R),He(R,{validation:"base64",code:Ne.invalid_string,message:B.message}),I.dirty()):B.kind==="base64url"?Py.test(g.data)||(R=this._getOrReturnCtx(g,R),He(R,{validation:"base64url",code:Ne.invalid_string,message:B.message}),I.dirty()):Ot.assertNever(B);return{status:I.value,value:g.data}}_regex(g,w,I){return this.refinement(R=>g.test(R),{validation:w,code:Ne.invalid_string,...it.errToObj(I)})}_addCheck(g){return new Da({...this._def,checks:[...this._def.checks,g]})}email(g){return this._addCheck({kind:"email",...it.errToObj(g)})}url(g){return this._addCheck({kind:"url",...it.errToObj(g)})}emoji(g){return this._addCheck({kind:"emoji",...it.errToObj(g)})}uuid(g){return this._addCheck({kind:"uuid",...it.errToObj(g)})}nanoid(g){return this._addCheck({kind:"nanoid",...it.errToObj(g)})}cuid(g){return this._addCheck({kind:"cuid",...it.errToObj(g)})}cuid2(g){return this._addCheck({kind:"cuid2",...it.errToObj(g)})}ulid(g){return this._addCheck({kind:"ulid",...it.errToObj(g)})}base64(g){return this._addCheck({kind:"base64",...it.errToObj(g)})}base64url(g){return this._addCheck({kind:"base64url",...it.errToObj(g)})}jwt(g){return this._addCheck({kind:"jwt",...it.errToObj(g)})}ip(g){return this._addCheck({kind:"ip",...it.errToObj(g)})}cidr(g){return this._addCheck({kind:"cidr",...it.errToObj(g)})}datetime(g){return typeof g=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:g}):this._addCheck({kind:"datetime",precision:typeof(g==null?void 0:g.precision)>"u"?null:g==null?void 0:g.precision,offset:(g==null?void 0:g.offset)??!1,local:(g==null?void 0:g.local)??!1,...it.errToObj(g==null?void 0:g.message)})}date(g){return this._addCheck({kind:"date",message:g})}time(g){return typeof g=="string"?this._addCheck({kind:"time",precision:null,message:g}):this._addCheck({kind:"time",precision:typeof(g==null?void 0:g.precision)>"u"?null:g==null?void 0:g.precision,...it.errToObj(g==null?void 0:g.message)})}duration(g){return this._addCheck({kind:"duration",...it.errToObj(g)})}regex(g,w){return this._addCheck({kind:"regex",regex:g,...it.errToObj(w)})}includes(g,w){return this._addCheck({kind:"includes",value:g,position:w==null?void 0:w.position,...it.errToObj(w==null?void 0:w.message)})}startsWith(g,w){return this._addCheck({kind:"startsWith",value:g,...it.errToObj(w)})}endsWith(g,w){return this._addCheck({kind:"endsWith",value:g,...it.errToObj(w)})}min(g,w){return this._addCheck({kind:"min",value:g,...it.errToObj(w)})}max(g,w){return this._addCheck({kind:"max",value:g,...it.errToObj(w)})}length(g,w){return this._addCheck({kind:"length",value:g,...it.errToObj(w)})}nonempty(g){return this.min(1,it.errToObj(g))}trim(){return new Da({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Da({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Da({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(g=>g.kind==="datetime")}get isDate(){return!!this._def.checks.find(g=>g.kind==="date")}get isTime(){return!!this._def.checks.find(g=>g.kind==="time")}get isDuration(){return!!this._def.checks.find(g=>g.kind==="duration")}get isEmail(){return!!this._def.checks.find(g=>g.kind==="email")}get isURL(){return!!this._def.checks.find(g=>g.kind==="url")}get isEmoji(){return!!this._def.checks.find(g=>g.kind==="emoji")}get isUUID(){return!!this._def.checks.find(g=>g.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(g=>g.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(g=>g.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(g=>g.kind==="cuid2")}get isULID(){return!!this._def.checks.find(g=>g.kind==="ulid")}get isIP(){return!!this._def.checks.find(g=>g.kind==="ip")}get isCIDR(){return!!this._def.checks.find(g=>g.kind==="cidr")}get isBase64(){return!!this._def.checks.find(g=>g.kind==="base64")}get isBase64url(){return!!this._def.checks.find(g=>g.kind==="base64url")}get minLength(){let g=null;for(const w of this._def.checks)w.kind==="min"&&(g===null||w.value>g)&&(g=w.value);return g}get maxLength(){let g=null;for(const w of this._def.checks)w.kind==="max"&&(g===null||w.value<g)&&(g=w.value);return g}}Da.create=b=>new Da({checks:[],typeName:mt.ZodString,coerce:(b==null?void 0:b.coerce)??!1,...St(b)});function Ry(b,g){const w=(b.toString().split(".")[1]||"").length,I=(g.toString().split(".")[1]||"").length,R=w>I?w:I,B=Number.parseInt(b.toFixed(R).replace(".","")),S=Number.parseInt(g.toFixed(R).replace(".",""));return B%S/10**R}class fo extends Dt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(g){if(this._def.coerce&&(g.data=Number(g.data)),this._getType(g)!==Ye.number){const B=this._getOrReturnCtx(g);return He(B,{code:Ne.invalid_type,expected:Ye.number,received:B.parsedType}),ft}let I;const R=new tn;for(const B of this._def.checks)B.kind==="int"?Ot.isInteger(g.data)||(I=this._getOrReturnCtx(g,I),He(I,{code:Ne.invalid_type,expected:"integer",received:"float",message:B.message}),R.dirty()):B.kind==="min"?(B.inclusive?g.data<B.value:g.data<=B.value)&&(I=this._getOrReturnCtx(g,I),He(I,{code:Ne.too_small,minimum:B.value,type:"number",inclusive:B.inclusive,exact:!1,message:B.message}),R.dirty()):B.kind==="max"?(B.inclusive?g.data>B.value:g.data>=B.value)&&(I=this._getOrReturnCtx(g,I),He(I,{code:Ne.too_big,maximum:B.value,type:"number",inclusive:B.inclusive,exact:!1,message:B.message}),R.dirty()):B.kind==="multipleOf"?Ry(g.data,B.value)!==0&&(I=this._getOrReturnCtx(g,I),He(I,{code:Ne.not_multiple_of,multipleOf:B.value,message:B.message}),R.dirty()):B.kind==="finite"?Number.isFinite(g.data)||(I=this._getOrReturnCtx(g,I),He(I,{code:Ne.not_finite,message:B.message}),R.dirty()):Ot.assertNever(B);return{status:R.value,value:g.data}}gte(g,w){return this.setLimit("min",g,!0,it.toString(w))}gt(g,w){return this.setLimit("min",g,!1,it.toString(w))}lte(g,w){return this.setLimit("max",g,!0,it.toString(w))}lt(g,w){return this.setLimit("max",g,!1,it.toString(w))}setLimit(g,w,I,R){return new fo({...this._def,checks:[...this._def.checks,{kind:g,value:w,inclusive:I,message:it.toString(R)}]})}_addCheck(g){return new fo({...this._def,checks:[...this._def.checks,g]})}int(g){return this._addCheck({kind:"int",message:it.toString(g)})}positive(g){return this._addCheck({kind:"min",value:0,inclusive:!1,message:it.toString(g)})}negative(g){return this._addCheck({kind:"max",value:0,inclusive:!1,message:it.toString(g)})}nonpositive(g){return this._addCheck({kind:"max",value:0,inclusive:!0,message:it.toString(g)})}nonnegative(g){return this._addCheck({kind:"min",value:0,inclusive:!0,message:it.toString(g)})}multipleOf(g,w){return this._addCheck({kind:"multipleOf",value:g,message:it.toString(w)})}finite(g){return this._addCheck({kind:"finite",message:it.toString(g)})}safe(g){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:it.toString(g)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:it.toString(g)})}get minValue(){let g=null;for(const w of this._def.checks)w.kind==="min"&&(g===null||w.value>g)&&(g=w.value);return g}get maxValue(){let g=null;for(const w of this._def.checks)w.kind==="max"&&(g===null||w.value<g)&&(g=w.value);return g}get isInt(){return!!this._def.checks.find(g=>g.kind==="int"||g.kind==="multipleOf"&&Ot.isInteger(g.value))}get isFinite(){let g=null,w=null;for(const I of this._def.checks){if(I.kind==="finite"||I.kind==="int"||I.kind==="multipleOf")return!0;I.kind==="min"?(w===null||I.value>w)&&(w=I.value):I.kind==="max"&&(g===null||I.value<g)&&(g=I.value)}return Number.isFinite(w)&&Number.isFinite(g)}}fo.create=b=>new fo({checks:[],typeName:mt.ZodNumber,coerce:(b==null?void 0:b.coerce)||!1,...St(b)});class Pl extends Dt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(g){if(this._def.coerce)try{g.data=BigInt(g.data)}catch{return this._getInvalidInput(g)}if(this._getType(g)!==Ye.bigint)return this._getInvalidInput(g);let I;const R=new tn;for(const B of this._def.checks)B.kind==="min"?(B.inclusive?g.data<B.value:g.data<=B.value)&&(I=this._getOrReturnCtx(g,I),He(I,{code:Ne.too_small,type:"bigint",minimum:B.value,inclusive:B.inclusive,message:B.message}),R.dirty()):B.kind==="max"?(B.inclusive?g.data>B.value:g.data>=B.value)&&(I=this._getOrReturnCtx(g,I),He(I,{code:Ne.too_big,type:"bigint",maximum:B.value,inclusive:B.inclusive,message:B.message}),R.dirty()):B.kind==="multipleOf"?g.data%B.value!==BigInt(0)&&(I=this._getOrReturnCtx(g,I),He(I,{code:Ne.not_multiple_of,multipleOf:B.value,message:B.message}),R.dirty()):Ot.assertNever(B);return{status:R.value,value:g.data}}_getInvalidInput(g){const w=this._getOrReturnCtx(g);return He(w,{code:Ne.invalid_type,expected:Ye.bigint,received:w.parsedType}),ft}gte(g,w){return this.setLimit("min",g,!0,it.toString(w))}gt(g,w){return this.setLimit("min",g,!1,it.toString(w))}lte(g,w){return this.setLimit("max",g,!0,it.toString(w))}lt(g,w){return this.setLimit("max",g,!1,it.toString(w))}setLimit(g,w,I,R){return new Pl({...this._def,checks:[...this._def.checks,{kind:g,value:w,inclusive:I,message:it.toString(R)}]})}_addCheck(g){return new Pl({...this._def,checks:[...this._def.checks,g]})}positive(g){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:it.toString(g)})}negative(g){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:it.toString(g)})}nonpositive(g){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:it.toString(g)})}nonnegative(g){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:it.toString(g)})}multipleOf(g,w){return this._addCheck({kind:"multipleOf",value:g,message:it.toString(w)})}get minValue(){let g=null;for(const w of this._def.checks)w.kind==="min"&&(g===null||w.value>g)&&(g=w.value);return g}get maxValue(){let g=null;for(const w of this._def.checks)w.kind==="max"&&(g===null||w.value<g)&&(g=w.value);return g}}Pl.create=b=>new Pl({checks:[],typeName:mt.ZodBigInt,coerce:(b==null?void 0:b.coerce)??!1,...St(b)});class od extends Dt{_parse(g){if(this._def.coerce&&(g.data=!!g.data),this._getType(g)!==Ye.boolean){const I=this._getOrReturnCtx(g);return He(I,{code:Ne.invalid_type,expected:Ye.boolean,received:I.parsedType}),ft}return $r(g.data)}}od.create=b=>new od({typeName:mt.ZodBoolean,coerce:(b==null?void 0:b.coerce)||!1,...St(b)});class mu extends Dt{_parse(g){if(this._def.coerce&&(g.data=new Date(g.data)),this._getType(g)!==Ye.date){const B=this._getOrReturnCtx(g);return He(B,{code:Ne.invalid_type,expected:Ye.date,received:B.parsedType}),ft}if(Number.isNaN(g.data.getTime())){const B=this._getOrReturnCtx(g);return He(B,{code:Ne.invalid_date}),ft}const I=new tn;let R;for(const B of this._def.checks)B.kind==="min"?g.data.getTime()<B.value&&(R=this._getOrReturnCtx(g,R),He(R,{code:Ne.too_small,message:B.message,inclusive:!0,exact:!1,minimum:B.value,type:"date"}),I.dirty()):B.kind==="max"?g.data.getTime()>B.value&&(R=this._getOrReturnCtx(g,R),He(R,{code:Ne.too_big,message:B.message,inclusive:!0,exact:!1,maximum:B.value,type:"date"}),I.dirty()):Ot.assertNever(B);return{status:I.value,value:new Date(g.data.getTime())}}_addCheck(g){return new mu({...this._def,checks:[...this._def.checks,g]})}min(g,w){return this._addCheck({kind:"min",value:g.getTime(),message:it.toString(w)})}max(g,w){return this._addCheck({kind:"max",value:g.getTime(),message:it.toString(w)})}get minDate(){let g=null;for(const w of this._def.checks)w.kind==="min"&&(g===null||w.value>g)&&(g=w.value);return g!=null?new Date(g):null}get maxDate(){let g=null;for(const w of this._def.checks)w.kind==="max"&&(g===null||w.value<g)&&(g=w.value);return g!=null?new Date(g):null}}mu.create=b=>new mu({checks:[],coerce:(b==null?void 0:b.coerce)||!1,typeName:mt.ZodDate,...St(b)});class Of extends Dt{_parse(g){if(this._getType(g)!==Ye.symbol){const I=this._getOrReturnCtx(g);return He(I,{code:Ne.invalid_type,expected:Ye.symbol,received:I.parsedType}),ft}return $r(g.data)}}Of.create=b=>new Of({typeName:mt.ZodSymbol,...St(b)});class jf extends Dt{_parse(g){if(this._getType(g)!==Ye.undefined){const I=this._getOrReturnCtx(g);return He(I,{code:Ne.invalid_type,expected:Ye.undefined,received:I.parsedType}),ft}return $r(g.data)}}jf.create=b=>new jf({typeName:mt.ZodUndefined,...St(b)});class Nf extends Dt{_parse(g){if(this._getType(g)!==Ye.null){const I=this._getOrReturnCtx(g);return He(I,{code:Ne.invalid_type,expected:Ye.null,received:I.parsedType}),ft}return $r(g.data)}}Nf.create=b=>new Nf({typeName:mt.ZodNull,...St(b)});class ld extends Dt{constructor(){super(...arguments),this._any=!0}_parse(g){return $r(g.data)}}ld.create=b=>new ld({typeName:mt.ZodAny,...St(b)});class mo extends Dt{constructor(){super(...arguments),this._unknown=!0}_parse(g){return $r(g.data)}}mo.create=b=>new mo({typeName:mt.ZodUnknown,...St(b)});class La extends Dt{_parse(g){const w=this._getOrReturnCtx(g);return He(w,{code:Ne.invalid_type,expected:Ye.never,received:w.parsedType}),ft}}La.create=b=>new La({typeName:mt.ZodNever,...St(b)});class cd extends Dt{_parse(g){if(this._getType(g)!==Ye.undefined){const I=this._getOrReturnCtx(g);return He(I,{code:Ne.invalid_type,expected:Ye.void,received:I.parsedType}),ft}return $r(g.data)}}cd.create=b=>new cd({typeName:mt.ZodVoid,...St(b)});class Un extends Dt{_parse(g){const{ctx:w,status:I}=this._processInputParams(g),R=this._def;if(w.parsedType!==Ye.array)return He(w,{code:Ne.invalid_type,expected:Ye.array,received:w.parsedType}),ft;if(R.exactLength!==null){const S=w.data.length>R.exactLength.value,o=w.data.length<R.exactLength.value;(S||o)&&(He(w,{code:S?Ne.too_big:Ne.too_small,minimum:o?R.exactLength.value:void 0,maximum:S?R.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:R.exactLength.message}),I.dirty())}if(R.minLength!==null&&w.data.length<R.minLength.value&&(He(w,{code:Ne.too_small,minimum:R.minLength.value,type:"array",inclusive:!0,exact:!1,message:R.minLength.message}),I.dirty()),R.maxLength!==null&&w.data.length>R.maxLength.value&&(He(w,{code:Ne.too_big,maximum:R.maxLength.value,type:"array",inclusive:!0,exact:!1,message:R.maxLength.message}),I.dirty()),w.common.async)return Promise.all([...w.data].map((S,o)=>R.type._parseAsync(new Ra(w,S,w.path,o)))).then(S=>tn.mergeArray(I,S));const B=[...w.data].map((S,o)=>R.type._parseSync(new Ra(w,S,w.path,o)));return tn.mergeArray(I,B)}get element(){return this._def.type}min(g,w){return new Un({...this._def,minLength:{value:g,message:it.toString(w)}})}max(g,w){return new Un({...this._def,maxLength:{value:g,message:it.toString(w)}})}length(g,w){return new Un({...this._def,exactLength:{value:g,message:it.toString(w)}})}nonempty(g){return this.min(1,g)}}Un.create=(b,g)=>new Un({type:b,minLength:null,maxLength:null,exactLength:null,typeName:mt.ZodArray,...St(g)});function go(b){if(b instanceof Bi){const g={};for(const w in b.shape){const I=b.shape[w];g[w]=Ba.create(go(I))}return new Bi({...b._def,shape:()=>g})}else return b instanceof Un?new Un({...b._def,type:go(b.element)}):b instanceof Ba?Ba.create(go(b.unwrap())):b instanceof xo?xo.create(go(b.unwrap())):b instanceof ra?ra.create(b.items.map(g=>go(g))):b}class Bi extends Dt{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const g=this._def.shape(),w=Ot.objectKeys(g);return this._cached={shape:g,keys:w},this._cached}_parse(g){if(this._getType(g)!==Ye.object){const ge=this._getOrReturnCtx(g);return He(ge,{code:Ne.invalid_type,expected:Ye.object,received:ge.parsedType}),ft}const{status:I,ctx:R}=this._processInputParams(g),{shape:B,keys:S}=this._getCached(),o=[];if(!(this._def.catchall instanceof La&&this._def.unknownKeys==="strip"))for(const ge in R.data)S.includes(ge)||o.push(ge);const de=[];for(const ge of S){const ze=B[ge],Oe=R.data[ge];de.push({key:{status:"valid",value:ge},value:ze._parse(new Ra(R,Oe,R.path,ge)),alwaysSet:ge in R.data})}if(this._def.catchall instanceof La){const ge=this._def.unknownKeys;if(ge==="passthrough")for(const ze of o)de.push({key:{status:"valid",value:ze},value:{status:"valid",value:R.data[ze]}});else if(ge==="strict")o.length>0&&(He(R,{code:Ne.unrecognized_keys,keys:o}),I.dirty());else if(ge!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const ge=this._def.catchall;for(const ze of o){const Oe=R.data[ze];de.push({key:{status:"valid",value:ze},value:ge._parse(new Ra(R,Oe,R.path,ze)),alwaysSet:ze in R.data})}}return R.common.async?Promise.resolve().then(async()=>{const ge=[];for(const ze of de){const Oe=await ze.key,Ce=await ze.value;ge.push({key:Oe,value:Ce,alwaysSet:ze.alwaysSet})}return ge}).then(ge=>tn.mergeObjectSync(I,ge)):tn.mergeObjectSync(I,de)}get shape(){return this._def.shape()}strict(g){return it.errToObj,new Bi({...this._def,unknownKeys:"strict",...g!==void 0?{errorMap:(w,I)=>{var B,S;const R=((S=(B=this._def).errorMap)==null?void 0:S.call(B,w,I).message)??I.defaultError;return w.code==="unrecognized_keys"?{message:it.errToObj(g).message??R}:{message:R}}}:{}})}strip(){return new Bi({...this._def,unknownKeys:"strip"})}passthrough(){return new Bi({...this._def,unknownKeys:"passthrough"})}extend(g){return new Bi({...this._def,shape:()=>({...this._def.shape(),...g})})}merge(g){return new Bi({unknownKeys:g._def.unknownKeys,catchall:g._def.catchall,shape:()=>({...this._def.shape(),...g._def.shape()}),typeName:mt.ZodObject})}setKey(g,w){return this.augment({[g]:w})}catchall(g){return new Bi({...this._def,catchall:g})}pick(g){const w={};for(const I of Ot.objectKeys(g))g[I]&&this.shape[I]&&(w[I]=this.shape[I]);return new Bi({...this._def,shape:()=>w})}omit(g){const w={};for(const I of Ot.objectKeys(this.shape))g[I]||(w[I]=this.shape[I]);return new Bi({...this._def,shape:()=>w})}deepPartial(){return go(this)}partial(g){const w={};for(const I of Ot.objectKeys(this.shape)){const R=this.shape[I];g&&!g[I]?w[I]=R:w[I]=R.optional()}return new Bi({...this._def,shape:()=>w})}required(g){const w={};for(const I of Ot.objectKeys(this.shape))if(g&&!g[I])w[I]=this.shape[I];else{let B=this.shape[I];for(;B instanceof Ba;)B=B._def.innerType;w[I]=B}return new Bi({...this._def,shape:()=>w})}keyof(){return Uf(Ot.objectKeys(this.shape))}}Bi.create=(b,g)=>new Bi({shape:()=>b,unknownKeys:"strip",catchall:La.create(),typeName:mt.ZodObject,...St(g)}),Bi.strictCreate=(b,g)=>new Bi({shape:()=>b,unknownKeys:"strict",catchall:La.create(),typeName:mt.ZodObject,...St(g)}),Bi.lazycreate=(b,g)=>new Bi({shape:b,unknownKeys:"strip",catchall:La.create(),typeName:mt.ZodObject,...St(g)});class gu extends Dt{_parse(g){const{ctx:w}=this._processInputParams(g),I=this._def.options;function R(B){for(const o of B)if(o.result.status==="valid")return o.result;for(const o of B)if(o.result.status==="dirty")return w.common.issues.push(...o.ctx.common.issues),o.result;const S=B.map(o=>new _n(o.ctx.common.issues));return He(w,{code:Ne.invalid_union,unionErrors:S}),ft}if(w.common.async)return Promise.all(I.map(async B=>{const S={...w,common:{...w.common,issues:[]},parent:null};return{result:await B._parseAsync({data:w.data,path:w.path,parent:S}),ctx:S}})).then(R);{let B;const S=[];for(const de of I){const ge={...w,common:{...w.common,issues:[]},parent:null},ze=de._parseSync({data:w.data,path:w.path,parent:ge});if(ze.status==="valid")return ze;ze.status==="dirty"&&!B&&(B={result:ze,ctx:ge}),ge.common.issues.length&&S.push(ge.common.issues)}if(B)return w.common.issues.push(...B.ctx.common.issues),B.result;const o=S.map(de=>new _n(de));return He(w,{code:Ne.invalid_union,unionErrors:o}),ft}}get options(){return this._def.options}}gu.create=(b,g)=>new gu({options:b,typeName:mt.ZodUnion,...St(g)});function ud(b,g){const w=za(b),I=za(g);if(b===g)return{valid:!0,data:b};if(w===Ye.object&&I===Ye.object){const R=Ot.objectKeys(g),B=Ot.objectKeys(b).filter(o=>R.indexOf(o)!==-1),S={...b,...g};for(const o of B){const de=ud(b[o],g[o]);if(!de.valid)return{valid:!1};S[o]=de.data}return{valid:!0,data:S}}else if(w===Ye.array&&I===Ye.array){if(b.length!==g.length)return{valid:!1};const R=[];for(let B=0;B<b.length;B++){const S=b[B],o=g[B],de=ud(S,o);if(!de.valid)return{valid:!1};R.push(de.data)}return{valid:!0,data:R}}else return w===Ye.date&&I===Ye.date&&+b==+g?{valid:!0,data:b}:{valid:!1}}class _u extends Dt{_parse(g){const{status:w,ctx:I}=this._processInputParams(g),R=(B,S)=>{if(Rf(B)||Rf(S))return ft;const o=ud(B.value,S.value);return o.valid?((Df(B)||Df(S))&&w.dirty(),{status:w.value,value:o.data}):(He(I,{code:Ne.invalid_intersection_types}),ft)};return I.common.async?Promise.all([this._def.left._parseAsync({data:I.data,path:I.path,parent:I}),this._def.right._parseAsync({data:I.data,path:I.path,parent:I})]).then(([B,S])=>R(B,S)):R(this._def.left._parseSync({data:I.data,path:I.path,parent:I}),this._def.right._parseSync({data:I.data,path:I.path,parent:I}))}}_u.create=(b,g,w)=>new _u({left:b,right:g,typeName:mt.ZodIntersection,...St(w)});class ra extends Dt{_parse(g){const{status:w,ctx:I}=this._processInputParams(g);if(I.parsedType!==Ye.array)return He(I,{code:Ne.invalid_type,expected:Ye.array,received:I.parsedType}),ft;if(I.data.length<this._def.items.length)return He(I,{code:Ne.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ft;!this._def.rest&&I.data.length>this._def.items.length&&(He(I,{code:Ne.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),w.dirty());const B=[...I.data].map((S,o)=>{const de=this._def.items[o]||this._def.rest;return de?de._parse(new Ra(I,S,I.path,o)):null}).filter(S=>!!S);return I.common.async?Promise.all(B).then(S=>tn.mergeArray(w,S)):tn.mergeArray(w,B)}get items(){return this._def.items}rest(g){return new ra({...this._def,rest:g})}}ra.create=(b,g)=>{if(!Array.isArray(b))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ra({items:b,typeName:mt.ZodTuple,rest:null,...St(g)})};class Zf extends Dt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(g){const{status:w,ctx:I}=this._processInputParams(g);if(I.parsedType!==Ye.map)return He(I,{code:Ne.invalid_type,expected:Ye.map,received:I.parsedType}),ft;const R=this._def.keyType,B=this._def.valueType,S=[...I.data.entries()].map(([o,de],ge)=>({key:R._parse(new Ra(I,o,I.path,[ge,"key"])),value:B._parse(new Ra(I,de,I.path,[ge,"value"]))}));if(I.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const de of S){const ge=await de.key,ze=await de.value;if(ge.status==="aborted"||ze.status==="aborted")return ft;(ge.status==="dirty"||ze.status==="dirty")&&w.dirty(),o.set(ge.value,ze.value)}return{status:w.value,value:o}})}else{const o=new Map;for(const de of S){const ge=de.key,ze=de.value;if(ge.status==="aborted"||ze.status==="aborted")return ft;(ge.status==="dirty"||ze.status==="dirty")&&w.dirty(),o.set(ge.value,ze.value)}return{status:w.value,value:o}}}}Zf.create=(b,g,w)=>new Zf({valueType:g,keyType:b,typeName:mt.ZodMap,...St(w)});class Cl extends Dt{_parse(g){const{status:w,ctx:I}=this._processInputParams(g);if(I.parsedType!==Ye.set)return He(I,{code:Ne.invalid_type,expected:Ye.set,received:I.parsedType}),ft;const R=this._def;R.minSize!==null&&I.data.size<R.minSize.value&&(He(I,{code:Ne.too_small,minimum:R.minSize.value,type:"set",inclusive:!0,exact:!1,message:R.minSize.message}),w.dirty()),R.maxSize!==null&&I.data.size>R.maxSize.value&&(He(I,{code:Ne.too_big,maximum:R.maxSize.value,type:"set",inclusive:!0,exact:!1,message:R.maxSize.message}),w.dirty());const B=this._def.valueType;function S(de){const ge=new Set;for(const ze of de){if(ze.status==="aborted")return ft;ze.status==="dirty"&&w.dirty(),ge.add(ze.value)}return{status:w.value,value:ge}}const o=[...I.data.values()].map((de,ge)=>B._parse(new Ra(I,de,I.path,ge)));return I.common.async?Promise.all(o).then(de=>S(de)):S(o)}min(g,w){return new Cl({...this._def,minSize:{value:g,message:it.toString(w)}})}max(g,w){return new Cl({...this._def,maxSize:{value:g,message:it.toString(w)}})}size(g,w){return this.min(g,w).max(g,w)}nonempty(g){return this.min(1,g)}}Cl.create=(b,g)=>new Cl({valueType:b,minSize:null,maxSize:null,typeName:mt.ZodSet,...St(g)});class Il extends Dt{constructor(){super(...arguments),this.validate=this.implement}_parse(g){const{ctx:w}=this._processInputParams(g);if(w.parsedType!==Ye.function)return He(w,{code:Ne.invalid_type,expected:Ye.function,received:w.parsedType}),ft;function I(o,de){return ad({data:o,path:w.path,errorMaps:[w.common.contextualErrorMap,w.schemaErrorMap,nd(),Ml].filter(ge=>!!ge),issueData:{code:Ne.invalid_arguments,argumentsError:de}})}function R(o,de){return ad({data:o,path:w.path,errorMaps:[w.common.contextualErrorMap,w.schemaErrorMap,nd(),Ml].filter(ge=>!!ge),issueData:{code:Ne.invalid_return_type,returnTypeError:de}})}const B={errorMap:w.common.contextualErrorMap},S=w.data;if(this._def.returns instanceof Al){const o=this;return $r(async function(...de){const ge=new _n([]),ze=await o._def.args.parseAsync(de,B).catch(ce=>{throw ge.addIssue(I(de,ce)),ge}),Oe=await Reflect.apply(S,this,ze);return await o._def.returns._def.type.parseAsync(Oe,B).catch(ce=>{throw ge.addIssue(R(Oe,ce)),ge})})}else{const o=this;return $r(function(...de){const ge=o._def.args.safeParse(de,B);if(!ge.success)throw new _n([I(de,ge.error)]);const ze=Reflect.apply(S,this,ge.data),Oe=o._def.returns.safeParse(ze,B);if(!Oe.success)throw new _n([R(ze,Oe.error)]);return Oe.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...g){return new Il({...this._def,args:ra.create(g).rest(mo.create())})}returns(g){return new Il({...this._def,returns:g})}implement(g){return this.parse(g)}strictImplement(g){return this.parse(g)}static create(g,w,I){return new Il({args:g||ra.create([]).rest(mo.create()),returns:w||mo.create(),typeName:mt.ZodFunction,...St(I)})}}class Vf extends Dt{get schema(){return this._def.getter()}_parse(g){const{ctx:w}=this._processInputParams(g);return this._def.getter()._parse({data:w.data,path:w.path,parent:w})}}Vf.create=(b,g)=>new Vf({getter:b,typeName:mt.ZodLazy,...St(g)});class hd extends Dt{_parse(g){if(g.data!==this._def.value){const w=this._getOrReturnCtx(g);return He(w,{received:w.data,code:Ne.invalid_literal,expected:this._def.value}),ft}return{status:"valid",value:g.data}}get value(){return this._def.value}}hd.create=(b,g)=>new hd({value:b,typeName:mt.ZodLiteral,...St(g)});function Uf(b,g){return new _o({values:b,typeName:mt.ZodEnum,...St(g)})}class _o extends Dt{_parse(g){if(typeof g.data!="string"){const w=this._getOrReturnCtx(g),I=this._def.values;return He(w,{expected:Ot.joinValues(I),received:w.parsedType,code:Ne.invalid_type}),ft}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(g.data)){const w=this._getOrReturnCtx(g),I=this._def.values;return He(w,{received:w.data,code:Ne.invalid_enum_value,options:I}),ft}return $r(g.data)}get options(){return this._def.values}get enum(){const g={};for(const w of this._def.values)g[w]=w;return g}get Values(){const g={};for(const w of this._def.values)g[w]=w;return g}get Enum(){const g={};for(const w of this._def.values)g[w]=w;return g}extract(g,w=this._def){return _o.create(g,{...this._def,...w})}exclude(g,w=this._def){return _o.create(this.options.filter(I=>!g.includes(I)),{...this._def,...w})}}_o.create=Uf;class $f extends Dt{_parse(g){const w=Ot.getValidEnumValues(this._def.values),I=this._getOrReturnCtx(g);if(I.parsedType!==Ye.string&&I.parsedType!==Ye.number){const R=Ot.objectValues(w);return He(I,{expected:Ot.joinValues(R),received:I.parsedType,code:Ne.invalid_type}),ft}if(this._cache||(this._cache=new Set(Ot.getValidEnumValues(this._def.values))),!this._cache.has(g.data)){const R=Ot.objectValues(w);return He(I,{received:I.data,code:Ne.invalid_enum_value,options:R}),ft}return $r(g.data)}get enum(){return this._def.values}}$f.create=(b,g)=>new $f({values:b,typeName:mt.ZodNativeEnum,...St(g)});class Al extends Dt{unwrap(){return this._def.type}_parse(g){const{ctx:w}=this._processInputParams(g);if(w.parsedType!==Ye.promise&&w.common.async===!1)return He(w,{code:Ne.invalid_type,expected:Ye.promise,received:w.parsedType}),ft;const I=w.parsedType===Ye.promise?w.data:Promise.resolve(w.data);return $r(I.then(R=>this._def.type.parseAsync(R,{path:w.path,errorMap:w.common.contextualErrorMap})))}}Al.create=(b,g)=>new Al({type:b,typeName:mt.ZodPromise,...St(g)});class yo extends Dt{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===mt.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(g){const{status:w,ctx:I}=this._processInputParams(g),R=this._def.effect||null,B={addIssue:S=>{He(I,S),S.fatal?w.abort():w.dirty()},get path(){return I.path}};if(B.addIssue=B.addIssue.bind(B),R.type==="preprocess"){const S=R.transform(I.data,B);if(I.common.async)return Promise.resolve(S).then(async o=>{if(w.value==="aborted")return ft;const de=await this._def.schema._parseAsync({data:o,path:I.path,parent:I});return de.status==="aborted"?ft:de.status==="dirty"||w.value==="dirty"?Sl(de.value):de});{if(w.value==="aborted")return ft;const o=this._def.schema._parseSync({data:S,path:I.path,parent:I});return o.status==="aborted"?ft:o.status==="dirty"||w.value==="dirty"?Sl(o.value):o}}if(R.type==="refinement"){const S=o=>{const de=R.refinement(o,B);if(I.common.async)return Promise.resolve(de);if(de instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(I.common.async===!1){const o=this._def.schema._parseSync({data:I.data,path:I.path,parent:I});return o.status==="aborted"?ft:(o.status==="dirty"&&w.dirty(),S(o.value),{status:w.value,value:o.value})}else return this._def.schema._parseAsync({data:I.data,path:I.path,parent:I}).then(o=>o.status==="aborted"?ft:(o.status==="dirty"&&w.dirty(),S(o.value).then(()=>({status:w.value,value:o.value}))))}if(R.type==="transform")if(I.common.async===!1){const S=this._def.schema._parseSync({data:I.data,path:I.path,parent:I});if(!po(S))return ft;const o=R.transform(S.value,B);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:w.value,value:o}}else return this._def.schema._parseAsync({data:I.data,path:I.path,parent:I}).then(S=>po(S)?Promise.resolve(R.transform(S.value,B)).then(o=>({status:w.value,value:o})):ft);Ot.assertNever(R)}}yo.create=(b,g,w)=>new yo({schema:b,typeName:mt.ZodEffects,effect:g,...St(w)}),yo.createWithPreprocess=(b,g,w)=>new yo({schema:g,effect:{type:"preprocess",transform:b},typeName:mt.ZodEffects,...St(w)});class Ba extends Dt{_parse(g){return this._getType(g)===Ye.undefined?$r(void 0):this._def.innerType._parse(g)}unwrap(){return this._def.innerType}}Ba.create=(b,g)=>new Ba({innerType:b,typeName:mt.ZodOptional,...St(g)});class xo extends Dt{_parse(g){return this._getType(g)===Ye.null?$r(null):this._def.innerType._parse(g)}unwrap(){return this._def.innerType}}xo.create=(b,g)=>new xo({innerType:b,typeName:mt.ZodNullable,...St(g)});class dd extends Dt{_parse(g){const{ctx:w}=this._processInputParams(g);let I=w.data;return w.parsedType===Ye.undefined&&(I=this._def.defaultValue()),this._def.innerType._parse({data:I,path:w.path,parent:w})}removeDefault(){return this._def.innerType}}dd.create=(b,g)=>new dd({innerType:b,typeName:mt.ZodDefault,defaultValue:typeof g.default=="function"?g.default:()=>g.default,...St(g)});class pd extends Dt{_parse(g){const{ctx:w}=this._processInputParams(g),I={...w,common:{...w.common,issues:[]}},R=this._def.innerType._parse({data:I.data,path:I.path,parent:{...I}});return fu(R)?R.then(B=>({status:"valid",value:B.status==="valid"?B.value:this._def.catchValue({get error(){return new _n(I.common.issues)},input:I.data})})):{status:"valid",value:R.status==="valid"?R.value:this._def.catchValue({get error(){return new _n(I.common.issues)},input:I.data})}}removeCatch(){return this._def.innerType}}pd.create=(b,g)=>new pd({innerType:b,typeName:mt.ZodCatch,catchValue:typeof g.catch=="function"?g.catch:()=>g.catch,...St(g)});class Gf extends Dt{_parse(g){if(this._getType(g)!==Ye.nan){const I=this._getOrReturnCtx(g);return He(I,{code:Ne.invalid_type,expected:Ye.nan,received:I.parsedType}),ft}return{status:"valid",value:g.data}}}Gf.create=b=>new Gf({typeName:mt.ZodNaN,...St(b)});class Dy extends Dt{_parse(g){const{ctx:w}=this._processInputParams(g),I=w.data;return this._def.type._parse({data:I,path:w.path,parent:w})}unwrap(){return this._def.type}}class fd extends Dt{_parse(g){const{status:w,ctx:I}=this._processInputParams(g);if(I.common.async)return(async()=>{const B=await this._def.in._parseAsync({data:I.data,path:I.path,parent:I});return B.status==="aborted"?ft:B.status==="dirty"?(w.dirty(),Sl(B.value)):this._def.out._parseAsync({data:B.value,path:I.path,parent:I})})();{const R=this._def.in._parseSync({data:I.data,path:I.path,parent:I});return R.status==="aborted"?ft:R.status==="dirty"?(w.dirty(),{status:"dirty",value:R.value}):this._def.out._parseSync({data:R.value,path:I.path,parent:I})}}static create(g,w){return new fd({in:g,out:w,typeName:mt.ZodPipeline})}}class md extends Dt{_parse(g){const w=this._def.innerType._parse(g),I=R=>(po(R)&&(R.value=Object.freeze(R.value)),R);return fu(w)?w.then(R=>I(R)):I(w)}unwrap(){return this._def.innerType}}md.create=(b,g)=>new md({innerType:b,typeName:mt.ZodReadonly,...St(g)});var mt;(function(b){b.ZodString="ZodString",b.ZodNumber="ZodNumber",b.ZodNaN="ZodNaN",b.ZodBigInt="ZodBigInt",b.ZodBoolean="ZodBoolean",b.ZodDate="ZodDate",b.ZodSymbol="ZodSymbol",b.ZodUndefined="ZodUndefined",b.ZodNull="ZodNull",b.ZodAny="ZodAny",b.ZodUnknown="ZodUnknown",b.ZodNever="ZodNever",b.ZodVoid="ZodVoid",b.ZodArray="ZodArray",b.ZodObject="ZodObject",b.ZodUnion="ZodUnion",b.ZodDiscriminatedUnion="ZodDiscriminatedUnion",b.ZodIntersection="ZodIntersection",b.ZodTuple="ZodTuple",b.ZodRecord="ZodRecord",b.ZodMap="ZodMap",b.ZodSet="ZodSet",b.ZodFunction="ZodFunction",b.ZodLazy="ZodLazy",b.ZodLiteral="ZodLiteral",b.ZodEnum="ZodEnum",b.ZodEffects="ZodEffects",b.ZodNativeEnum="ZodNativeEnum",b.ZodOptional="ZodOptional",b.ZodNullable="ZodNullable",b.ZodDefault="ZodDefault",b.ZodCatch="ZodCatch",b.ZodPromise="ZodPromise",b.ZodBranded="ZodBranded",b.ZodPipeline="ZodPipeline",b.ZodReadonly="ZodReadonly"})(mt||(mt={}));const Fa=Da.create,qi=fo.create,Ly=od.create,By=ld.create;mo.create,La.create;const yu=cd.create,gd=Un.create,nr=Bi.create;gu.create,_u.create;const qf=ra.create,El=Il.create,_d=hd.create,Fy=_o.create,Oy=Al.create;Ba.create,xo.create;const xu=nr({lat:qi(),lng:qi()}),jy=nr({center:xu,zoom:qi()}),Ny=nr({sw:xu,ne:xu}),Hf=nr({primary:Fa().max(64),background:Fa().max(64),text:Fa().max(64)}),Zy=nr({name:_d("dark").or(_d("light")),colors:Hf}),Vy=nr({name:_d("custom"),url:Fa().max(256),colors:Hf}),Uy=Zy.or(Vy),$y=nr({pin:nr({fade:Ly().optional(),maxCount:qi().optional(),maxZoom:qi().optional()}).optional(),animation:nr({queue:nr({limit:qi().optional()}).optional()}).optional()}),Gy=nr({container:Fa(),position:nr({center:nr({lat:qi(),lng:qi()}),zoom:qi()}),style:Uy,restriction:nr({minZoom:qi().min(td).max(Tl).optional(),maxZoom:qi().min(td).max(Tl).optional(),maxBounds:Ny.optional()}).optional(),configuration:$y.optional()});Fy(["idle","move","click","popup_click"]);const qy=El().returns(yu()),Hy=El().returns(yu()),Wy=El().args(jy).returns(yu()),Xy=El().args(xu).returns(yu()),Ky={load:qy,idle:Hy,move:Wy,click:Xy},Wf=nr({id:Fa().min(1),rank:qi(),lat:qi().min(-90).max(90),lng:qi().min(-180).max(180),width:qi().min(56),height:qi().min(56)}),Yy=qf([qi(),gd(qf([qi(),qi()]))]),Xf=El().args(Fa()).returns(Oy(By())),Jy=nr({data:Wf,state:Yy,callbacks:nr({body:Xf,pin:Xf.optional()})}),Qy=gd(Jy);nr({key:Fa(),data:gd(Wf)});var ex=Uh('<div class="container svelte-1xg3z1s"><div class="map svelte-1xg3z1s"></div> <div class="logo svelte-1xg3z1s"><a href="https://arenarium.dev" target="_blank" class="svelte-1xg3z1s"><span class="text">@arenarium/maps</span></a></div></div>');function Kf(b,g){Jc(g,!0);let w,I,R,B,S,o=rr(0),de=rr(0),ge=rr(!1),ze=rr(void 0);Pf(()=>{Gy.parse(g.options),Oe(),ce()});function Oe(){var De,qe,Ze;R=((De=g.options.restriction)==null?void 0:De.minZoom)??td,B=((qe=g.options.restriction)==null?void 0:qe.maxZoom)??Tl,S=(Ze=g.options.restriction)==null?void 0:Ze.maxBounds,w=new rd.Map({style:gt(g.options.style),center:{lat:g.options.position.center.lat,lng:g.options.position.center.lng},zoom:g.options.position.zoom,minZoom:Lt(R),maxZoom:B,maxBounds:S?[S.sw.lng,S.sw.lat,S.ne.lng,S.ne.lat]:void 0,container:I,pitchWithRotate:!1,attributionControl:{compact:!1}})}const Ce=()=>w;function ce(){w.on("load",Ve),w.on("move",Nt),w.on("idle",xt),w.on("click",Ei),w.dragRotate.disable(),w.keyboard.disable(),w.touchZoomRotate.disableRotation(),w.touchPitch.disable()}function Ve(){gi(ge,!0),It("load",null)}function Nt(){const De=w.getCenter(),qe=w.getZoom();It("move",{center:De,zoom:qe});const Ze=w.getBounds();gi(ze,{sw:{lat:Ze.getSouthWest().lat,lng:Ze.getSouthWest().lng},ne:{lat:Ze.getNorthEast().lat,lng:Ze.getNorthEast().lng}},!0)}function xt(){It("idle",null);const De=w.getBounds();gi(ze,{sw:{lat:De.getSouthWest().lat,lng:De.getSouthWest().lng},ne:{lat:De.getNorthEast().lat,lng:De.getNorthEast().lng}},!0)}function Ei(De){It("click",{lat:De.lngLat.lat,lng:De.lngLat.lng})}const pi=new Map;function Hi(De,qe){var Yt;const Ze=Ky[De];if(!Ze)throw new Error(`No schema defined for event ${De}`);if(!Ze.safeParse(qe).success)throw new Error(`Invalid handler for event ${De}`);pi.has(De)||pi.set(De,new Set),(Yt=pi.get(De))==null||Yt.add(qe)}function ai(De,qe){const Ze=pi.get(De);Ze&&Ze.delete(qe)&&Ze.size===0&&pi.delete(De)}function It(De,qe){const Ze=pi.get(De);Ze&&Ze.size>0&&[...Ze].forEach(Qe=>{try{Qe(qe)}catch(Yt){console.error(Yt)}})}function Lt(De){const qe=Af,Ze=Math.ceil(Math.log2(pt(o)/qe));return Math.max(De,Ze)}function mr(){const De=w.getCenter();return De?{lat:De.lat,lng:De.lng}:{lat:g.options.position.center.lat,lng:g.options.position.center.lng}}function Ut(){return w.getZoom()??g.options.position.zoom}function rn(){if(!w)throw new Error("Map not loaded!");const De=w.getBounds();return{sw:{lat:De.getSouthWest().lat,lng:De.getSouthWest().lng},ne:{lat:De.getNorthEast().lat,lng:De.getNorthEast().lng}}}function Cn(De){if(!w)throw new Error("Map not loaded! Consider using the position option");w.setCenter(De)}function Lr(De){if(!w)throw new Error("Map not loaded! Consider using the position option");w.setZoom(De)}function ar(){if(!w)throw new Error("Map not loaded! Consider using the position option");w.zoomIn()}function sr(){if(!w)throw new Error("Map not loaded! Consider using the position option.");w.zoomOut()}function _i(De){if(!w)throw new Error("Map not loaded! Consider using the restriction option.");R=De,w.setMinZoom(Lt(De))}function yn(De){if(!w)throw new Error("Map not loaded! Consider using the restriction option.");B=De,w.setMaxZoom(De)}function Pt(De){if(!w)throw new Error("Map not loaded! Consider using the restriction option.");S=De,w.setMaxBounds([De.sw.lng,De.sw.lat,De.ne.lng,De.ne.lat])}let si=rr(Aa(g.options.style));mn(()=>{pt(ge)&&w.setStyle(gt(pt(si)),{diff:!0})});function gt(De){if(De.name=="custom")return De.url;switch(De.name){case"light":return uy;case"dark":return cy}}function Fi(){return $p(pt(si))}function Wi(De){gi(si,De,!0),w.setStyle(gt(pt(si)),{diff:!0})}let Mr=rr(Aa(g.options.configuration));mn(()=>{var De,qe,Ze;(Ze=(qe=(De=pt(Mr))==null?void 0:De.animation)==null?void 0:qe.queue)!=null&&Ze.limit?ia.setLimit(pt(Mr).animation.queue.limit):ia.setLimit(8*navigator.hardwareConcurrency)});function Sr(){return $p(pt(Mr))}function $n(De){gi(Mr,De,!0)}class Xi{constructor(qe){Rt(this,"id");Rt(this,"lat");Rt(this,"lng");Rt(this,"zoom");Rt(this,"element");Rt(this,"component");Rt(this,"libreMarker");this.id=qe.data.id,this.lat=qe.data.lat,this.lng=qe.data.lng,this.zoom=qe.state[0]}create(){this.createElement(),this.createLibreMarker(),this.updateZIndex()}createElement(){throw new Error("Create element not implemented")}createLibreMarker(){const qe=this.element;if(!qe)throw new Error("Failed to create libre marker");const Ze=new rd.Marker({element:qe});Ze.setLngLat([this.lng,this.lat]),this.libreMarker=Ze}update(qe){this.zoom=qe.state[0],this.updateZIndex()}updateZIndex(){throw new Error("Update z-index not implemented")}updateMap(qe){const Ze=this.libreMarker,Qe=this.component;if(Ze==null||Qe==null)throw new Error("Failed to update popup map");qe?Ze._map!=qe&&Ze.addTo(qe):Ze._map!=null&&Ze.remove()}isInBlock(qe,Ze){return this.zoom<=qe&&Ze.contains(this.lat,this.lng)}remove(){var qe,Ze;(qe=this.libreMarker)==null||qe.remove(),(Ze=this.element)==null||Ze.remove()}}class yi extends Xi{constructor(Ze){super(Ze);Rt(this,"pinLoading",!1);Rt(this,"pinLoaded",!1);Rt(this,"pinCallback");this.pinCallback=Ze.callbacks.pin}createElement(){this.element=document.createElement("div"),this.element.classList.add("circle"),this.component=Gh(ny,{target:this.element,props:{id:this.id+"_circle",priority:this.zoom*hu}})}updateZIndex(){const Ze=this.element;if(!Ze)return;const Qe=Math.round((Tl-this.zoom)*hu);Ze.style.zIndex=Qe.toString()}updateMap(Ze){var Qe;super.updateMap(Ze),(Qe=this.component)==null||Qe.setDisplayed(Ze!=null)}updateState(Ze){const Qe=this.component;if(!Qe)throw new Error("Failed to update circle state");Qe.setScale(this.getScale(Ze))}updatePin(){var Qe;if(this.pinCallback==null||this.pinLoaded||this.pinLoading)return;const Ze=(Qe=this.component)==null?void 0:Qe.getBody();Ze!=null&&(this.pinLoading=!0,this.pinCallback(this.id).then(Yt=>{Ze.appendChild(Yt),this.pinLoaded=!0,this.pinLoading=!1}))}setExpanded(){if(this.component==null)throw new Error("Failed to set circle expanded");this.component.setScale(1)}setCollapsed(){if(this.component==null)throw new Error("Failed to set circle collapsed");this.component.setScale(0)}getScale(Ze){return Math.max(0,1-(this.zoom-Ze)*.125)}isCollapsed(){return this.component==null?!1:this.component.getCollapsed()}isPinLoaded(){return this.pinCallback==null||this.pinLoaded}}class Pr extends Xi{constructor(Ze){super(Ze);Rt(this,"width");Rt(this,"height");Rt(this,"states");Rt(this,"bodyLoading",!1);Rt(this,"bodyLoaded",!1);Rt(this,"bodyCallback");this.id=Ze.data.id,this.states=Ze.state[1].map(Qe=>[Qe[0],du.DEGREES[Qe[1]]]),this.width=Ze.data.width,this.height=Ze.data.height,this.bodyCallback=Ze.callbacks.body}createElement(){this.element=document.createElement("div"),this.element.classList.add("marker"),this.component=Gh(iy,{target:this.element,props:{id:this.id+"_marker",priority:this.zoom*hu,width:this.width,height:this.height}})}update(Ze){super.update(Ze),this.states=Ze.state[1].map(Qe=>[Qe[0],du.DEGREES[Qe[1]]])}updateZIndex(){const Ze=this.element;if(!Ze)return;const Qe=Math.round((Tl-this.zoom)*hu)+Y_;Ze.style.zIndex=Qe.toString()}updateMap(Ze){var Qe;super.updateMap(Ze),(Qe=this.component)==null||Qe.setDisplayed(Ze!=null)}updateState(Ze){const Qe=this.component;if(!Qe)throw new Error("Failed to update marker state");Qe.setAngle(this.getAngle(Ze))}updateBody(){var Qe;if(this.bodyLoaded||this.bodyLoading)return;const Ze=(Qe=this.component)==null?void 0:Qe.getBody();Ze!=null&&(this.bodyLoading=!0,this.bodyCallback(this.id).then(Yt=>{Ze.appendChild(Yt),this.bodyLoading=!1,this.bodyLoaded=!0}))}getAngle(Ze){const Qe=this.states.findLast(Yt=>Yt[0]<=Ze);if(!Qe)throw new Error("Angle not found");return Qe[1]}setCollapsed(Ze){if(this.component==null)throw new Error("Failed to set marker collapsed");this.component.setCollapsed(Ze)}isExpanded(){return this.component?this.component.getExpanded():!1}isCollapsed(){return this.component?this.component.getCollapsed():!1}isBodyLoaded(){return this.bodyLoaded}}class xi{constructor(qe){Rt(this,"id");Rt(this,"rank");Rt(this,"lat");Rt(this,"lng");Rt(this,"zoom");Rt(this,"circle");Rt(this,"marker");this.id=qe.data.id,this.rank=qe.data.rank,this.lat=qe.data.lat,this.lng=qe.data.lng,this.zoom=qe.state[0],this.circle=new yi(qe),this.marker=new Pr(qe)}create(){this.circle.create(),this.marker.create()}update(qe){this.circle.update(qe),this.marker.update(qe)}remove(){this.circle.remove(),this.marker.remove()}}let nn,fi=new Array,or=new Map,vi=!1,lr=Af,Oi=Wp(()=>pt(ze)?new kf(w,-512,pt(de)+lr,pt(o)+lr,-512):void 0),jt=Wp(()=>pt(ze)?new kf(w,0,pt(de),pt(o),0):void 0);Pf(()=>{const De=()=>{Gr(),nn=window.setTimeout(De,25)};return De(),()=>clearInterval(nn)});function Gr(){var Yt,cr,qr,sn,In,_r;if(pt(ge)==!1||pt(jt)==null||pt(Oi)==null||fi.length==0||vi)return;const De=w.getZoom();if(!De)return;let qe=0,Ze=((cr=(Yt=g.options.configuration)==null?void 0:Yt.pin)==null?void 0:cr.maxCount)??Math.max(Q_,8*navigator.hardwareConcurrency),Qe=((sn=(qr=g.options.configuration)==null?void 0:qr.pin)==null?void 0:sn.maxZoom)??J_;for(const Ki of fi){const Qt=Ki.circle;pt(jt).contains(Qt.lat,Qt.lng)?De<=Qt.zoom&&Qt.zoom<=De+Qe?(qe<Ze&&(((_r=(In=pt(Mr))==null?void 0:In.pin)==null?void 0:_r.fade)==!0?Qt.updateState(De):Qt.setExpanded(),Qt.updateMap(w),Qt.isPinLoaded()==!1&&Qt.updatePin()),qe++):(Qt.setCollapsed(),Qt.isCollapsed()&&Qt.updateMap(null)):Qt.updateMap(null);const le=Ki.marker;pt(Oi).contains(le.lat,le.lng)?le.zoom<=De?(le.updateState(De),le.setCollapsed(!1),le.updateMap(w),le.isExpanded()&&le.isBodyLoaded()==!1&&le.updateBody()):(le.setCollapsed(!0),le.isCollapsed()&&le.updateMap(null)):le.updateMap(null)}}async function xn(De){try{vi=!0;const qe=new Map(De.map(Qe=>[Qe.data.id,new xi(Qe)])),Ze=Array.from(fi);for(const Qe of Ze)qe.has(Qe.id)==!1&&(Qe.remove(),or.delete(Qe.id),fi.splice(fi.indexOf(Qe),1));for(const Qe of De){const Yt=or.get(Qe.data.id);if(Yt)Yt.update(Qe);else{const cr=new xi(Qe);cr.create(),or.set(Qe.data.id,cr),fi.push(cr)}}fi.sort((Qe,Yt)=>Qe.zoom-Yt.zoom)}catch(qe){throw console.error(qe),fi.length=0,or.clear(),qe}finally{vi=!1}}function Cr(){try{vi=!0,fi.forEach(De=>De.remove()),fi.length=0,or.clear()}catch(De){throw console.error(De),fi.forEach(qe=>qe.remove()),fi.length=0,or.clear(),De}finally{vi=!1}}async function aa(De){await Qy.parseAsync(De),await xn(De)}function sa(){Cr()}function gr(De){const qe=or.get(De);qe!=null&&w.flyTo({center:{lat:qe.lat,lng:qe.lng},zoom:qe.zoom})}var Ir=ex();R_("resize",Fh,()=>w.setMinZoom(Lt(R)));var an=eu(Ir);return _s(an,De=>I=De,()=>I),Oh(()=>Xh(Ir,`--map-style-primary: ${pt(si).colors.primary??""}; --map-style-background: ${pt(si).colors.background??""}; --map-style-text: ${pt(si).colors.text??""};`)),Mf(an,"clientWidth",De=>gi(o,De)),Mf(an,"clientHeight",De=>gi(de,De)),$h(b,Ir),Qc({maplibre:Ce,on:Hi,off:ai,emit:It,getCenter:mr,getZoom:Ut,getBounds:rn,setCenter:Cn,setZoom:Lr,zoomIn:ar,zoomOut:sr,setMinZoom:_i,setMaxZoom:yn,setMaxBounds:Pt,getStyle:Fi,setStyle:Wi,getConfiguration:Sr,setConfiguration:$n,updatePopups:aa,removePopups:sa,revealPopup:gr})}function tx(b){const g=document.getElementById(b.container);if(!g)throw new Error(`Container not found: ${b.container}`);return Gh(Kf,{target:g,props:{options:b}})}function ix(b){F_(b)}Ft.Map=Kf,Ft.mountMap=tx,Ft.unmountMap=ix,Object.defineProperty(Ft,Symbol.toStringTag,{value:"Module"})});
|