@arenarium/maps 1.0.47 → 1.0.48

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 CHANGED
@@ -726,4 +726,4 @@ uniform ${I} ${E} u_${k};
726
726
  `),te=Q.concat(Kr.prelude.vertexSource,_.vertexSource,i.vertexSource).join(`
727
727
  `);Yr(T)||(ee=function(fe){return fe.replace(/\bin\s/g,"varying ").replace("out highp vec4 fragColor;","").replace(/fragColor/g,"gl_FragColor").replace(/texture\(/g,"texture2D(")}(ee),te=function(fe){return fe.replace(/\bin\s/g,"attribute ").replace(/\bout\s/g,"varying ").replace(/texture\(/g,"texture2D(")}(te));const oe=T.createShader(T.FRAGMENT_SHADER);if(T.isContextLost())return void(this.failedToCreate=!0);if(T.shaderSource(oe,ee),T.compileShader(oe),!T.getShaderParameter(oe,T.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${T.getShaderInfoLog(oe)}`);T.attachShader(this.program,oe);const re=T.createShader(T.VERTEX_SHADER);if(T.isContextLost())return void(this.failedToCreate=!0);if(T.shaderSource(re,te),T.compileShader(re),!T.getShaderParameter(re,T.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${T.getShaderInfoLog(re)}`);T.attachShader(this.program,re),this.attributes={};const me={};this.numAttributes=k.length;for(let fe=0;fe<this.numAttributes;fe++)k[fe]&&(T.bindAttribLocation(this.program,fe,k[fe]),this.attributes[k[fe]]=fe);if(T.linkProgram(this.program),!T.getProgramParameter(this.program,T.LINK_STATUS))throw new Error(`Program failed to link: ${T.getProgramInfoLog(this.program)}`);T.deleteShader(re),T.deleteShader(oe);for(let fe=0;fe<X.length;fe++){const Se=X[fe];if(Se&&!me[Se]){const Ie=T.getUniformLocation(this.program,Se);Ie&&(me[Se]=Ie)}}this.fixedUniforms=l(e,me),this.terrainUniforms=((fe,Se)=>({u_depth:new o.bF(fe,Se.u_depth),u_terrain:new o.bF(fe,Se.u_terrain),u_terrain_dim:new o.b8(fe,Se.u_terrain_dim),u_terrain_matrix:new o.bH(fe,Se.u_terrain_matrix),u_terrain_unpack:new o.bI(fe,Se.u_terrain_unpack),u_terrain_exaggeration:new o.b8(fe,Se.u_terrain_exaggeration)}))(e,me),this.projectionUniforms=((fe,Se)=>({u_projection_matrix:new o.bH(fe,Se.u_projection_matrix),u_projection_tile_mercator_coords:new o.bI(fe,Se.u_projection_tile_mercator_coords),u_projection_clipping_plane:new o.bI(fe,Se.u_projection_clipping_plane),u_projection_transition:new o.b8(fe,Se.u_projection_transition),u_projection_fallback_matrix:new o.bH(fe,Se.u_projection_fallback_matrix)}))(e,me),this.binderUniforms=s?s.getUniforms(e,me):[]}draw(e,i,s,l,h,f,_,v,T,I,E,k,O,Z,q,G,W,X,Q){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),v){e.activeTexture.set(ee.TEXTURE2),ee.bindTexture(ee.TEXTURE_2D,v.depthTexture),e.activeTexture.set(ee.TEXTURE3),ee.bindTexture(ee.TEXTURE_2D,v.texture);for(const oe in this.terrainUniforms)this.terrainUniforms[oe].set(v[oe])}if(T)for(const oe in T)this.projectionUniforms[Fd[oe]].set(T[oe]);if(_)for(const oe in this.fixedUniforms)this.fixedUniforms[oe].set(_[oe]);G&&G.setUniforms(e,this.binderUniforms,Z,{zoom:q});let te=0;switch(i){case ee.LINES:te=2;break;case ee.TRIANGLES:te=3;break;case ee.LINE_STRIP:te=1}for(const oe of O.get()){const re=oe.vaos||(oe.vaos={});(re[I]||(re[I]=new tc)).bind(e,this,E,G?G.getPaintVertexBuffers():[],k,oe.vertexOffset,W,X,Q),ee.drawElements(i,oe.primitiveLength*te,ee.UNSIGNED_SHORT,oe.primitiveOffset*te*2)}}}function rs(u,e,i){const s=1/o.aw(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 ih=(u,e,i,s)=>{const l=u.style.light,h=l.properties.get("position"),f=[h.x,h.y,h.z],_=o.bL();l.properties.get("anchor")==="viewport"&&o.bM(_,u.transform.bearingInRadians),o.bN(f,f,_);const v=u.transform.transformLightDirection(f),T=l.properties.get("color");return{u_lightpos:f,u_lightpos_globe:v,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}},Fo=(u,e,i,s,l,h,f)=>o.e(ih(u,e,i,s),rs(h,u,f),{u_height_factor:-Math.pow(2,l.overscaledZ)/f.tileSize/8}),rh=(u,e,i,s)=>o.e(rs(e,u,i),{u_fill_translate:s}),ns=(u,e)=>({u_world:u,u_fill_translate:e}),Bd=(u,e,i,s,l)=>o.e(rh(u,e,i,l),{u_world:s}),nh=(u,e,i,s,l)=>{const h=u.transform;let f,_,v=0;if(i.paint.get("circle-pitch-alignment")==="map"){const T=o.aw(e,1,h.zoom);f=!0,_=[T,T],v=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:v,u_translate:s}},Od=u=>({u_pixel_extrude_scale:[1/u.width,1/u.height]}),ah=u=>({u_viewport_size:[u.width,u.height]}),Bo=(u,e=1)=>({u_color:u,u_overlay:0,u_overlay_scale:e}),ic=(u,e,i,s)=>{const l=o.aw(u,1,e)/(o.Z*Math.pow(2,u.tileID.overscaledZ))*2*Math.PI*s;return{u_extrude_scale:o.aw(u,1,e),u_intensity:i,u_globe_extrude_scale:l}},rc=(u,e,i,s)=>{const l=o.K();o.bO(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")}},sh=(u,e,i)=>{const s=i.paint.get("hillshade-shadow-color"),l=i.paint.get("hillshade-highlight-color"),h=i.paint.get("hillshade-accent-color");let f=i.paint.get("hillshade-illumination-direction")*(Math.PI/180);return i.paint.get("hillshade-illumination-anchor")==="viewport"&&(f+=u.transform.bearingInRadians),{u_image:0,u_latrange:ya(0,e.tileID),u_light:[i.paint.get("hillshade-exaggeration"),f],u_shadow:s,u_highlight:l,u_accent:h}},oh=(u,e)=>{const i=e.stride,s=o.K();return o.bO(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 ya(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 Oo=(u,e,i,s)=>{const l=u.transform;return{u_translation:ch(u,e,i),u_ratio:s/o.aw(e,1,l.zoom),u_device_pixel_ratio:u.pixelRatio,u_units_to_pixels:[1/l.pixelsToGLUnits[0],1/l.pixelsToGLUnits[1]]}},lh=(u,e,i,s,l)=>o.e(Oo(u,e,i,s),{u_image:0,u_image_height:l}),Zs=(u,e,i,s,l)=>{const h=u.transform,f=Vs(e,h);return{u_translation:ch(u,e,i),u_texsize:e.imageAtlasTexture.size,u_ratio:s/o.aw(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]]}},jd=(u,e,i,s,l,h)=>{const f=u.lineAtlas,_=Vs(e,u.transform),v=i.layout.get("line-cap")==="round",T=f.getDash(l.from,v),I=f.getDash(l.to,v),E=T.width*h.fromScale,k=I.width*h.toScale;return o.e(Oo(u,e,i,s),{u_patternscale_a:[_/E,-T.height/2],u_patternscale_b:[_/k,-I.height/2],u_sdfgamma:f.width/(256*Math.min(E,k)*u.pixelRatio)/2,u_image:0,u_tex_y_a:T.y,u_tex_y_b:I.y,u_mix:h.t})};function Vs(u,e){return 1/o.aw(u,1,e.tileZoom)}function ch(u,e,i){return o.ax(u.transform,e,i.paint.get("line-translate"),i.paint.get("line-translate-anchor"))}const Nd=(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:uh(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 uh(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 nc=(u,e,i,s,l,h,f,_,v,T,I,E,k)=>{const O=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:O.cameraToCenterDistance,u_pitch:O.pitch/360*2*Math.PI,u_rotate_symbol:+i,u_aspect_ratio:O.width/O.height,u_fade_change:f.options.fadeDuration?f.symbolFadeChange:1,u_label_plane_matrix:_,u_coord_matrix:v,u_is_text:+I,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:k}},ac=(u,e,i,s,l,h,f,_,v,T,I,E,k,O)=>{const Z=f.transform;return o.e(nc(u,e,i,s,l,h,f,_,v,T,I,E,O),{u_gamma_scale:s?Math.cos(Z.pitch*Math.PI/180)*Z.cameraToCenterDistance:1,u_device_pixel_ratio:f.pixelRatio,u_is_halo:1})},sc=(u,e,i,s,l,h,f,_,v,T,I,E,k)=>o.e(ac(u,e,i,s,l,h,f,_,v,T,!0,I,0,k),{u_texsize_icon:E,u_texture_icon:1}),hh=(u,e)=>({u_opacity:u,u_color:e}),jo=(u,e,i,s,l)=>o.e(function(h,f,_,v){const T=_.imageManager.getPattern(h.from.toString()),I=_.imageManager.getPattern(h.to.toString()),{width:E,height:k}=_.imageManager.getPixelSize(),O=Math.pow(2,v.tileID.overscaledZ),Z=v.tileSize*Math.pow(2,_.transform.tileZoom)/O,q=Z*(v.tileID.canonical.x+v.tileID.wrap*O),G=Z*v.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:T.tl,u_pattern_br_a:T.br,u_pattern_tl_b:I.tl,u_pattern_br_b:I.br,u_texsize:[E,k],u_mix:f.t,u_pattern_size_a:T.displaySize,u_pattern_size_b:I.displaySize,u_scale_a:f.fromScale,u_scale_b:f.toScale,u_tile_units_to_pixels:1/o.aw(v,1,_.transform.tileZoom),u_pixel_coord_upper:[q>>16,G>>16],u_pixel_coord_lower:[65535&q,65535&G]}}(i,l,e,s),{u_opacity:u}),hn=(u,e)=>{},oc={fillExtrusion:(u,e)=>({u_lightpos:new o.bJ(u,e.u_lightpos),u_lightpos_globe:new o.bJ(u,e.u_lightpos_globe),u_lightintensity:new o.b8(u,e.u_lightintensity),u_lightcolor:new o.bJ(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.bK(u,e.u_fill_translate)}),fillExtrusionPattern:(u,e)=>({u_lightpos:new o.bJ(u,e.u_lightpos),u_lightpos_globe:new o.bJ(u,e.u_lightpos_globe),u_lightintensity:new o.b8(u,e.u_lightintensity),u_lightcolor:new o.bJ(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.bK(u,e.u_fill_translate),u_image:new o.bF(u,e.u_image),u_texsize:new o.bK(u,e.u_texsize),u_pixel_coord_upper:new o.bK(u,e.u_pixel_coord_upper),u_pixel_coord_lower:new o.bK(u,e.u_pixel_coord_lower),u_scale:new o.bJ(u,e.u_scale),u_fade:new o.b8(u,e.u_fade)}),fill:(u,e)=>({u_fill_translate:new o.bK(u,e.u_fill_translate)}),fillPattern:(u,e)=>({u_image:new o.bF(u,e.u_image),u_texsize:new o.bK(u,e.u_texsize),u_pixel_coord_upper:new o.bK(u,e.u_pixel_coord_upper),u_pixel_coord_lower:new o.bK(u,e.u_pixel_coord_lower),u_scale:new o.bJ(u,e.u_scale),u_fade:new o.b8(u,e.u_fade),u_fill_translate:new o.bK(u,e.u_fill_translate)}),fillOutline:(u,e)=>({u_world:new o.bK(u,e.u_world),u_fill_translate:new o.bK(u,e.u_fill_translate)}),fillOutlinePattern:(u,e)=>({u_world:new o.bK(u,e.u_world),u_image:new o.bF(u,e.u_image),u_texsize:new o.bK(u,e.u_texsize),u_pixel_coord_upper:new o.bK(u,e.u_pixel_coord_upper),u_pixel_coord_lower:new o.bK(u,e.u_pixel_coord_lower),u_scale:new o.bJ(u,e.u_scale),u_fade:new o.b8(u,e.u_fade),u_fill_translate:new o.bK(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.bF(u,e.u_scale_with_map),u_pitch_with_map:new o.bF(u,e.u_pitch_with_map),u_extrude_scale:new o.bK(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.bK(u,e.u_translate)}),collisionBox:(u,e)=>({u_pixel_extrude_scale:new o.bK(u,e.u_pixel_extrude_scale)}),collisionCircle:(u,e)=>({u_viewport_size:new o.bK(u,e.u_viewport_size)}),debug:(u,e)=>({u_color:new o.bG(u,e.u_color),u_overlay:new o.bF(u,e.u_overlay),u_overlay_scale:new o.b8(u,e.u_overlay_scale)}),depth:hn,clippingMask:hn,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.bH(u,e.u_matrix),u_world:new o.bK(u,e.u_world),u_image:new o.bF(u,e.u_image),u_color_ramp:new o.bF(u,e.u_color_ramp),u_opacity:new o.b8(u,e.u_opacity)}),hillshade:(u,e)=>({u_image:new o.bF(u,e.u_image),u_latrange:new o.bK(u,e.u_latrange),u_light:new o.bK(u,e.u_light),u_shadow:new o.bG(u,e.u_shadow),u_highlight:new o.bG(u,e.u_highlight),u_accent:new o.bG(u,e.u_accent)}),hillshadePrepare:(u,e)=>({u_matrix:new o.bH(u,e.u_matrix),u_image:new o.bF(u,e.u_image),u_dimension:new o.bK(u,e.u_dimension),u_zoom:new o.b8(u,e.u_zoom),u_unpack:new o.bI(u,e.u_unpack)}),line:(u,e)=>({u_translation:new o.bK(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.bK(u,e.u_units_to_pixels)}),lineGradient:(u,e)=>({u_translation:new o.bK(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.bK(u,e.u_units_to_pixels),u_image:new o.bF(u,e.u_image),u_image_height:new o.b8(u,e.u_image_height)}),linePattern:(u,e)=>({u_translation:new o.bK(u,e.u_translation),u_texsize:new o.bK(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.bF(u,e.u_image),u_units_to_pixels:new o.bK(u,e.u_units_to_pixels),u_scale:new o.bJ(u,e.u_scale),u_fade:new o.b8(u,e.u_fade)}),lineSDF:(u,e)=>({u_translation:new o.bK(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.bK(u,e.u_units_to_pixels),u_patternscale_a:new o.bK(u,e.u_patternscale_a),u_patternscale_b:new o.bK(u,e.u_patternscale_b),u_sdfgamma:new o.b8(u,e.u_sdfgamma),u_image:new o.bF(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.bK(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.bF(u,e.u_image0),u_image1:new o.bF(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.bJ(u,e.u_spin_weights),u_coords_top:new o.bI(u,e.u_coords_top),u_coords_bottom:new o.bI(u,e.u_coords_bottom)}),symbolIcon:(u,e)=>({u_is_size_zoom_constant:new o.bF(u,e.u_is_size_zoom_constant),u_is_size_feature_constant:new o.bF(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.bF(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.bH(u,e.u_label_plane_matrix),u_coord_matrix:new o.bH(u,e.u_coord_matrix),u_is_text:new o.bF(u,e.u_is_text),u_pitch_with_map:new o.bF(u,e.u_pitch_with_map),u_is_along_line:new o.bF(u,e.u_is_along_line),u_is_variable_anchor:new o.bF(u,e.u_is_variable_anchor),u_texsize:new o.bK(u,e.u_texsize),u_texture:new o.bF(u,e.u_texture),u_translation:new o.bK(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.bF(u,e.u_is_size_zoom_constant),u_is_size_feature_constant:new o.bF(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.bF(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.bH(u,e.u_label_plane_matrix),u_coord_matrix:new o.bH(u,e.u_coord_matrix),u_is_text:new o.bF(u,e.u_is_text),u_pitch_with_map:new o.bF(u,e.u_pitch_with_map),u_is_along_line:new o.bF(u,e.u_is_along_line),u_is_variable_anchor:new o.bF(u,e.u_is_variable_anchor),u_texsize:new o.bK(u,e.u_texsize),u_texture:new o.bF(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.bF(u,e.u_is_halo),u_translation:new o.bK(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.bF(u,e.u_is_size_zoom_constant),u_is_size_feature_constant:new o.bF(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.bF(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.bH(u,e.u_label_plane_matrix),u_coord_matrix:new o.bH(u,e.u_coord_matrix),u_is_text:new o.bF(u,e.u_is_text),u_pitch_with_map:new o.bF(u,e.u_pitch_with_map),u_is_along_line:new o.bF(u,e.u_is_along_line),u_is_variable_anchor:new o.bF(u,e.u_is_variable_anchor),u_texsize:new o.bK(u,e.u_texsize),u_texsize_icon:new o.bK(u,e.u_texsize_icon),u_texture:new o.bF(u,e.u_texture),u_texture_icon:new o.bF(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.bF(u,e.u_is_halo),u_translation:new o.bK(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.bG(u,e.u_color)}),backgroundPattern:(u,e)=>({u_opacity:new o.b8(u,e.u_opacity),u_image:new o.bF(u,e.u_image),u_pattern_tl_a:new o.bK(u,e.u_pattern_tl_a),u_pattern_br_a:new o.bK(u,e.u_pattern_br_a),u_pattern_tl_b:new o.bK(u,e.u_pattern_tl_b),u_pattern_br_b:new o.bK(u,e.u_pattern_br_b),u_texsize:new o.bK(u,e.u_texsize),u_mix:new o.b8(u,e.u_mix),u_pattern_size_a:new o.bK(u,e.u_pattern_size_a),u_pattern_size_b:new o.bK(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.bK(u,e.u_pixel_coord_upper),u_pixel_coord_lower:new o.bK(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.bF(u,e.u_texture),u_ele_delta:new o.b8(u,e.u_ele_delta),u_fog_matrix:new o.bH(u,e.u_fog_matrix),u_fog_color:new o.bG(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.bG(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.bF(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.bJ(u,e.u_sun_pos),u_atmosphere_blend:new o.b8(u,e.u_atmosphere_blend),u_globe_position:new o.bJ(u,e.u_globe_position),u_globe_radius:new o.b8(u,e.u_globe_radius),u_inv_proj_matrix:new o.bH(u,e.u_inv_proj_matrix)}),sky:(u,e)=>({u_sky_color:new o.bG(u,e.u_sky_color),u_horizon_color:new o.bG(u,e.u_horizon_color),u_horizon:new o.bK(u,e.u_horizon),u_horizon_normal:new o.bK(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 lc{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 cc={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class dh{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[cc[h.type]],!1,this.itemSize,h.offset+this.itemSize*(s||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class Lt{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 xa extends Lt{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 uc extends Lt{getDefault(){return 1}set(e){(e!==this.current||this.dirty)&&(this.gl.clearDepth(e),this.current=e,this.dirty=!1)}}class Zd extends Lt{getDefault(){return 0}set(e){(e!==this.current||this.dirty)&&(this.gl.clearStencil(e),this.current=e,this.dirty=!1)}}class Vd extends Lt{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 Ud extends Lt{getDefault(){return!0}set(e){(e!==this.current||this.dirty)&&(this.gl.depthMask(e),this.current=e,this.dirty=!1)}}class $d extends Lt{getDefault(){return 255}set(e){(e!==this.current||this.dirty)&&(this.gl.stencilMask(e),this.current=e,this.dirty=!1)}}class ph extends Lt{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 Gd extends Lt{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 fh extends Lt{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 No extends Lt{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 Zo extends Lt{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 Vo extends Lt{getDefault(){return this.gl.LESS}set(e){(e!==this.current||this.dirty)&&(this.gl.depthFunc(e),this.current=e,this.dirty=!1)}}class hc extends Lt{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 va extends Lt{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 as extends Lt{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 Zr extends Lt{getDefault(){return this.gl.FUNC_ADD}set(e){(e!==this.current||this.dirty)&&(this.gl.blendEquation(e),this.current=e,this.dirty=!1)}}class mh extends Lt{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 gh extends Lt{getDefault(){return this.gl.BACK}set(e){(e!==this.current||this.dirty)&&(this.gl.cullFace(e),this.current=e,this.dirty=!1)}}class dc extends Lt{getDefault(){return this.gl.CCW}set(e){(e!==this.current||this.dirty)&&(this.gl.frontFace(e),this.current=e,this.dirty=!1)}}class ba extends Lt{getDefault(){return null}set(e){(e!==this.current||this.dirty)&&(this.gl.useProgram(e),this.current=e,this.dirty=!1)}}class Uo extends Lt{getDefault(){return this.gl.TEXTURE0}set(e){(e!==this.current||this.dirty)&&(this.gl.activeTexture(e),this.current=e,this.dirty=!1)}}class $o extends Lt{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 Us extends Lt{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 Go extends Lt{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 _h extends Lt{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 ss extends Lt{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 os extends Lt{getDefault(){return null}set(e){const i=this.gl;i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class yh extends Lt{getDefault(){return null}set(e){var i;if(e===this.current&&!this.dirty)return;const s=this.gl;Yr(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 pc extends Lt{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 zt extends Lt{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 qo extends Lt{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 fc extends Lt{constructor(e,i){super(e),this.context=e,this.parent=i}getDefault(){return null}}class xh extends fc{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 $s extends fc{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 qd extends fc{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 vh="Framebuffer is not complete";class bh{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 xh(e,_),l)this.depthAttachment=h?new qd(e,_):new $s(e,_);else if(h)throw new Error("Stencil cannot be set without depth");if(f.checkFramebufferStatus(f.FRAMEBUFFER)!==f.FRAMEBUFFER_COMPLETE)throw new Error(vh)}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 Wd{constructor(e){var i,s;if(this.gl=e,this.clearColor=new xa(this),this.clearDepth=new uc(this),this.clearStencil=new Zd(this),this.colorMask=new Vd(this),this.depthMask=new Ud(this),this.stencilMask=new $d(this),this.stencilFunc=new ph(this),this.stencilOp=new Gd(this),this.stencilTest=new fh(this),this.depthRange=new No(this),this.depthTest=new Zo(this),this.depthFunc=new Vo(this),this.blend=new hc(this),this.blendFunc=new va(this),this.blendColor=new as(this),this.blendEquation=new Zr(this),this.cullFace=new mh(this),this.cullFaceSide=new gh(this),this.frontFace=new dc(this),this.program=new ba(this),this.activeTexture=new Uo(this),this.viewport=new $o(this),this.bindFramebuffer=new Us(this),this.bindRenderbuffer=new Go(this),this.bindTexture=new _h(this),this.bindVertexBuffer=new ss(this),this.bindElementBuffer=new os(this),this.bindVertexArray=new yh(this),this.pixelStoreUnpack=new pc(this),this.pixelStoreUnpackPremultiplyAlpha=new zt(this),this.pixelStoreUnpackFlipY=new qo(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),Yr(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 lc(this,e,i)}createVertexBuffer(e,i,s){return new dh(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 bh(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.bC(e.blendFunction,ei.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 Yr(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 Yr(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 ls;function Gs(u,e,i,s,l){const h=u.context,f=u.transform,_=h.gl,v=u.useProgram("collisionBox"),T=[];let I=0,E=0;for(let W=0;W<s.length;W++){const X=s[W],Q=e.getTile(X).getBucket(i);if(!Q)continue;const ee=l?Q.textCollisionBox:Q.iconCollisionBox,te=Q.collisionCircleArray;te.length>0&&(T.push({circleArray:te,circleOffset:E,coord:X}),I+=te.length/4,E=I),ee&&v.draw(h,_.LINES,ft.disabled,Ct.disabled,u.colorModeForRenderPass(),Dt.disabled,Od(u.transform),u.style.map.terrain&&u.style.map.terrain.getTerrainData(X),f.getProjectionData({overscaledTileID:X,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 k=u.useProgram("collisionCircle"),O=new o.bP;O.resize(4*I),O._trim();let Z=0;for(const W of T)for(let X=0;X<W.circleArray.length/4;X++){const Q=4*X,ee=W.circleArray[Q+0],te=W.circleArray[Q+1],oe=W.circleArray[Q+2],re=W.circleArray[Q+3];O.emplace(Z++,ee,te,oe,re,0),O.emplace(Z++,ee,te,oe,re,1),O.emplace(Z++,ee,te,oe,re,2),O.emplace(Z++,ee,te,oe,re,3)}(!ls||ls.length<2*I)&&(ls=function(W){const X=2*W,Q=new o.bR;Q.resize(X),Q._trim();for(let ee=0;ee<X;ee++){const te=6*ee;Q.uint16[te+0]=4*ee+0,Q.uint16[te+1]=4*ee+1,Q.uint16[te+2]=4*ee+2,Q.uint16[te+3]=4*ee+2,Q.uint16[te+4]=4*ee+3,Q.uint16[te+5]=4*ee+0}return Q}(I));const q=h.createIndexBuffer(ls,!0),G=h.createVertexBuffer(O,o.bQ.members,!0);for(const W of T){const X=ah(u.transform);k.draw(h,_.TRIANGLES,ft.disabled,Ct.disabled,u.colorModeForRenderPass(),Dt.disabled,X,u.style.map.terrain&&u.style.map.terrain.getTerrainData(W.coord),null,i.id,G,q,o.aG.simpleSegment(0,2*W.circleOffset,W.circleArray.length,W.circleArray.length/2),null,u.transform.zoom,null,null,null)}G.destroy(),q.destroy()}const Wo=o.at(new Float32Array(16));function mc(u,e,i,s,l,h){const{horizontalAlign:f,verticalAlign:_}=o.aB(u);return new o.P((-(f-.5)*e/l+s[0])*h,(-(_-.5)*i/l+s[1])*h)}function gc(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 v=f.add(_);return ve(v.x,v.y,e.pitchedLabelPlaneMatrix,e.getElevation).point}if(i){const _=kt(e.tileAnchorPoint.x+1,e.tileAnchorPoint.y,e).point.sub(u),v=Math.atan(_.y/_.x)+(_.x<0?Math.PI:0);return u.add(s.rotate(v))}return u.add(s)}function wh(u,e,i,s,l,h,f,_,v,T,I,E){const k=u.text.placedSymbolArray,O=u.text.dynamicLayoutVertexArray,Z=u.icon.dynamicLayoutVertexArray,q={};O.clear();for(let G=0;G<k.length;G++){const W=k.get(G),X=W.hidden||!W.crossTileID||u.allowVerticalPlacement&&!W.placedOrientation?null:s[W.crossTileID];if(X){const Q=new o.P(W.anchorX,W.anchorY),ee={getElevation:E,width:l.width,height:l.height,pitchedLabelPlaneMatrix:h,pitchWithMap:i,transform:l,tileAnchorPoint:Q,translation:T,unwrappedTileID:I},te=i?We(Q.x,Q.y,ee):kt(Q.x,Q.y,ee),oe=de(l.cameraToCenterDistance,te.signedDistanceFromCamera);let re=o.ai(u.textSizeData,_,W)*oe/o.av;i&&(re*=u.tilePixelRatio/f);const{width:me,height:fe,anchor:Se,textOffset:Ie,textBoxScale:Te}=X,je=mc(Se,me,fe,Ie,Te,re),Be=l.getPitchedTextCorrection(Q.x+T[0],Q.y+T[1],I),Ce=gc(te.point,ee,e,je,-l.bearingInRadians,Be),He=u.allowVerticalPlacement&&W.placedOrientation===o.ah.vertical?Math.PI/2:0;for(let pt=0;pt<W.numGlyphs;pt++)o.ao(O,Ce,He);v&&W.associatedIconIndex>=0&&(q[W.associatedIconIndex]={shiftedAnchor:Ce,angle:He})}else at(W.numGlyphs,O)}if(v){Z.clear();const G=u.icon.placedSymbolArray;for(let W=0;W<G.length;W++){const X=G.get(W);if(X.hidden)at(X.numGlyphs,Z);else{const Q=q[W];if(Q)for(let ee=0;ee<X.numGlyphs;ee++)o.ao(Z,Q.shiftedAnchor,Q.angle);else at(X.numGlyphs,Z)}}u.icon.dynamicLayoutVertexBuffer.updateData(Z)}u.text.dynamicLayoutVertexBuffer.updateData(O)}function Ho(u,e,i){return i.iconsInText&&e?"symbolTextAndIcon":u?"symbolSDF":"symbolIcon"}function qs(u,e,i,s,l,h,f,_,v,T,I,E,k){const O=u.context,Z=O.gl,q=u.transform,G=_==="map",W=v==="map",X=_!=="viewport"&&i.layout.get("symbol-placement")!=="point",Q=G&&!W&&!X,ee=!i.layout.get("symbol-sort-key").isConstant();let te=!1;const oe=u.getDepthModeForSublayer(0,ft.ReadOnly),re=i._unevaluatedLayout.hasValue("text-variable-anchor")||i._unevaluatedLayout.hasValue("text-variable-anchor-offset"),me=[],fe=q.getCircleRadiusCorrection();for(const Se of s){const Ie=e.getTile(Se),Te=Ie.getBucket(i);if(!Te)continue;const je=l?Te.text:Te.icon;if(!je||!je.segments.get().length||!je.hasVisibleVertices)continue;const Be=je.programConfigurations.get(i.id),Ce=l||Te.sdfIcons,He=l?Te.textSizeData:Te.iconSizeData,pt=W||q.pitch!==0,jt=u.useProgram(Ho(Ce,l,Te),Be),mt=o.ag(He,q.zoom),Wt=u.style.map.terrain&&u.style.map.terrain.getTerrainData(Se);let Yt,ii,Ut,Ht,Ii=[0,0],Bi=null;if(l)ii=Ie.glyphAtlasTexture,Ut=Z.LINEAR,Yt=Ie.glyphAtlasTexture.size,Te.iconsInText&&(Ii=Ie.imageAtlasTexture.size,Bi=Ie.imageAtlasTexture,Ht=pt||u.options.rotating||u.options.zooming||He.kind==="composite"||He.kind==="camera"?Z.LINEAR:Z.NEAREST);else{const _i=i.layout.get("icon-size").constantOr(0)!==1||Te.iconsNeedLinear;ii=Ie.imageAtlasTexture,Ut=Ce||u.options.rotating||u.options.zooming||_i||pt?Z.LINEAR:Z.NEAREST,Yt=Ie.imageAtlasTexture.size}const Zi=o.aw(Ie,1,u.transform.zoom),vr=pe(G,u.transform,Zi),An=o.K();o.aj(An,vr);const mn=ce(W,G,u.transform,Zi),Yn=o.ax(q,Ie,h,f),Jn=q.getProjectionData({overscaledTileID:Se,applyGlobeMatrix:!k,applyTerrainMatrix:!0}),ka=re&&Te.hasTextData(),gn=i.layout.get("icon-text-fit")!=="none"&&ka&&Te.hasIconData();if(X){const _i=u.style.map.terrain?(zi,Kt)=>u.style.map.terrain.getElevation(Se,zi,Kt):null,yi=i.layout.get("text-rotation-alignment")==="map";Ze(Te,u,l,vr,An,W,T,yi,Se.toUnwrapped(),q.width,q.height,Yn,_i)}const zn=l&&re||gn,Ar=X||zn?Wo:W?vr:u.transform.clipSpaceToPixelsMatrix,Rn=Ce&&i.paint.get(l?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let Ea;Ea=Ce?Te.iconsInText?sc(He.kind,mt,Q,W,X,zn,u,Ar,mn,Yn,Yt,Ii,fe):ac(He.kind,mt,Q,W,X,zn,u,Ar,mn,Yn,l,Yt,0,fe):nc(He.kind,mt,Q,W,X,zn,u,Ar,mn,Yn,l,Yt,fe);const Aa={program:jt,buffers:je,uniformValues:Ea,projectionData:Jn,atlasTexture:ii,atlasTextureIcon:Bi,atlasInterpolation:Ut,atlasInterpolationIcon:Ht,isSDF:Ce,hasHalo:Rn};if(ee&&Te.canOverlap){te=!0;const _i=je.segments.get();for(const yi of _i)me.push({segments:new o.aG([yi]),sortKey:yi.sortKey,state:Aa,terrainData:Wt})}else me.push({segments:je.segments,sortKey:0,state:Aa,terrainData:Wt})}te&&me.sort((Se,Ie)=>Se.sortKey-Ie.sortKey);for(const Se of me){const Ie=Se.state;if(O.activeTexture.set(Z.TEXTURE0),Ie.atlasTexture.bind(Ie.atlasInterpolation,Z.CLAMP_TO_EDGE),Ie.atlasTextureIcon&&(O.activeTexture.set(Z.TEXTURE1),Ie.atlasTextureIcon&&Ie.atlasTextureIcon.bind(Ie.atlasInterpolationIcon,Z.CLAMP_TO_EDGE)),Ie.isSDF){const Te=Ie.uniformValues;Ie.hasHalo&&(Te.u_is_halo=1,Xo(Ie.buffers,Se.segments,i,u,Ie.program,oe,I,E,Te,Ie.projectionData,Se.terrainData)),Te.u_is_halo=0}Xo(Ie.buffers,Se.segments,i,u,Ie.program,oe,I,E,Ie.uniformValues,Ie.projectionData,Se.terrainData)}}function Xo(u,e,i,s,l,h,f,_,v,T,I){const E=s.context;l.draw(E,E.gl.TRIANGLES,h,f,_,Dt.backCCW,v,I,T,i.id,u.layoutVertexBuffer,u.indexBuffer,e,i.paint,s.transform.zoom,u.programConfigurations.get(i.id),u.dynamicLayoutVertexBuffer,u.opacityVertexBuffer)}function Hd(u,e,i,s,l){const h=u.context,f=h.gl,_=Ct.disabled,v=new ei([f.ONE,f.ONE],o.b7.transparent,[!0,!0,!0,!0]),T=e.getBucket(i);if(!T)return;const I=s.key;let E=i.heatmapFbos.get(I);E||(E=Th(h,e.tileSize,e.tileSize),i.heatmapFbos.set(I,E)),h.bindFramebuffer.set(E.framebuffer),h.viewport.set([0,0,e.tileSize,e.tileSize]),h.clear({color:o.b7.transparent});const k=T.programConfigurations.get(i.id),O=u.useProgram("heatmap",k,!l),Z=u.transform.getProjectionData({overscaledTileID:e.tileID,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),q=u.style.map.terrain.getTerrainData(s);O.draw(h,f.TRIANGLES,ft.disabled,_,v,Dt.disabled,ic(e,u.transform.zoom,i.paint.get("heatmap-intensity"),1),q,Z,i.id,T.layoutVertexBuffer,T.indexBuffer,T.segments,i.paint,u.transform.zoom,k)}function _c(u,e,i,s,l){const h=u.context,f=h.gl,_=u.transform;h.setColorMode(u.colorModeForRenderPass());const v=yc(h,e),T=i.key,I=e.heatmapFbos.get(T);if(!I)return;h.activeTexture.set(f.TEXTURE0),f.bindTexture(f.TEXTURE_2D,I.colorAttachment.get()),h.activeTexture.set(f.TEXTURE1),v.bind(f.LINEAR,f.CLAMP_TO_EDGE);const E=_.getProjectionData({overscaledTileID:i,applyTerrainMatrix:l,applyGlobeMatrix:!s});u.useProgram("heatmapTexture").draw(h,f.TRIANGLES,ft.disabled,Ct.disabled,u.colorModeForRenderPass(),Dt.disabled,rc(u,e,0,1),null,E,e.id,u.rasterBoundsBuffer,u.quadTriangleIndexBuffer,u.rasterBoundsSegments,e.paint,_.zoom),I.destroy(),e.heatmapFbos.delete(T)}function Th(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,v=(l=u.RGBA16F)!==null&&l!==void 0?l:h.RGBA;h.texImage2D(h.TEXTURE_2D,0,v,e,i,0,h.RGBA,_,null);const T=u.createFramebuffer(e,i,!1,!1);return T.colorAttachment.set(f),T}function yc(u,e){return e.colorRampTexture||(e.colorRampTexture=new Ot(u,e.colorRamp,u.gl.RGBA)),e.colorRampTexture}function Ws(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 v=l.getPaintProperty(e);f=h[v],_=h[v]}f&&_&&u.setConstantPatternPositions(f,_)}function Ko(u,e,i,s,l,h,f,_){const v=u.context.gl,T="fill-pattern",I=i.paint.get(T),E=I&&I.constantOr(1),k=i.getCrossfadeParameters();let O,Z,q,G,W;const X=u.transform,Q=i.paint.get("fill-translate"),ee=i.paint.get("fill-translate-anchor");f?(Z=E&&!i.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",O=v.LINES):(Z=E?"fillPattern":"fill",O=v.TRIANGLES);const te=I.constantOr(null);for(const oe of s){const re=e.getTile(oe);if(E&&!re.patternsLoaded())continue;const me=re.getBucket(i);if(!me)continue;const fe=me.programConfigurations.get(i.id),Se=u.useProgram(Z,fe),Ie=u.style.map.terrain&&u.style.map.terrain.getTerrainData(oe);E&&(u.context.activeTexture.set(v.TEXTURE0),re.imageAtlasTexture.bind(v.LINEAR,v.CLAMP_TO_EDGE),fe.updatePaintBuffers(k)),Ws(fe,T,te,re,i);const Te=X.getProjectionData({overscaledTileID:oe,applyGlobeMatrix:!_,applyTerrainMatrix:!0}),je=o.ax(X,re,Q,ee);if(f){G=me.indexBuffer2,W=me.segments2;const Ce=[v.drawingBufferWidth,v.drawingBufferHeight];q=Z==="fillOutlinePattern"&&E?Bd(u,k,re,Ce,je):ns(Ce,je)}else G=me.indexBuffer,W=me.segments,q=E?rh(u,k,re,je):{u_fill_translate:je};let Be;if(u.renderPass==="translucent"&&_){const[Ce]=u.getStencilConfigForOverlapAndUpdateStencilID(s);Be=Ce[oe.overscaledZ]}else Be=u.stencilModeForClipping(oe);Se.draw(u.context,O,l,Be,h,Dt.backCCW,q,Ie,Te,i.id,me.layoutVertexBuffer,G,W,i.paint,u.transform.zoom,fe)}}function Yo(u,e,i,s,l,h,f,_){const v=u.context,T=v.gl,I="fill-extrusion-pattern",E=i.paint.get(I),k=E.constantOr(1),O=i.getCrossfadeParameters(),Z=i.paint.get("fill-extrusion-opacity"),q=E.constantOr(null),G=u.transform;for(const W of s){const X=e.getTile(W),Q=X.getBucket(i);if(!Q)continue;const ee=u.style.map.terrain&&u.style.map.terrain.getTerrainData(W),te=Q.programConfigurations.get(i.id),oe=u.useProgram(k?"fillExtrusionPattern":"fillExtrusion",te);k&&(u.context.activeTexture.set(T.TEXTURE0),X.imageAtlasTexture.bind(T.LINEAR,T.CLAMP_TO_EDGE),te.updatePaintBuffers(O));const re=G.getProjectionData({overscaledTileID:W,applyGlobeMatrix:!_,applyTerrainMatrix:!0});Ws(te,I,q,X,i);const me=o.ax(G,X,i.paint.get("fill-extrusion-translate"),i.paint.get("fill-extrusion-translate-anchor")),fe=i.paint.get("fill-extrusion-vertical-gradient"),Se=k?Fo(u,fe,Z,me,W,O,X):ih(u,fe,Z,me);oe.draw(v,v.gl.TRIANGLES,l,h,f,Dt.backCCW,Se,ee,re,i.id,Q.layoutVertexBuffer,Q.indexBuffer,Q.segments,i.paint,u.transform.zoom,te,u.style.map.terrain&&Q.centroidVertexBuffer)}}function Jo(u,e,i,s,l,h,f,_,v){var T;const I=u.style.projection,E=u.context,k=u.transform,O=E.gl,Z=u.useProgram("hillshade"),q=!u.options.moving;for(const G of s){const W=e.getTile(G),X=W.fbo;if(!X)continue;const Q=I.getMeshFromTileID(E,G.canonical,_,!0,"raster"),ee=(T=u.style.map.terrain)===null||T===void 0?void 0:T.getTerrainData(G);E.activeTexture.set(O.TEXTURE0),O.bindTexture(O.TEXTURE_2D,X.colorAttachment.get());const te=k.getProjectionData({overscaledTileID:G,aligned:q,applyGlobeMatrix:!v,applyTerrainMatrix:!0});Z.draw(E,O.TRIANGLES,h,l[G.overscaledZ],f,Dt.backCCW,sh(u,W,i),ee,te,i.id,Q.vertexBuffer,Q.indexBuffer,Q.segments)}}const cs=[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 us(u,e,i,s,l,h,f,_,v=!1,T=!1){const I=s[s.length-1].overscaledZ,E=u.context,k=E.gl,O=u.useProgram("raster"),Z=u.transform,q=u.style.projection,G=u.colorModeForRenderPass(),W=!u.options.moving;for(const X of s){const Q=u.getDepthModeForSublayer(X.overscaledZ-I,i.paint.get("raster-opacity")===1?ft.ReadWrite:ft.ReadOnly,k.LESS),ee=e.getTile(X);ee.registerFadeDuration(i.paint.get("raster-fade-duration"));const te=e.findLoadedParent(X,0),oe=e.findLoadedSibling(X),re=Xd(ee,te||oe||null,e,i,u.transform,u.style.map.terrain);let me,fe;const Se=i.paint.get("raster-resampling")==="nearest"?k.NEAREST:k.LINEAR;E.activeTexture.set(k.TEXTURE0),ee.texture.bind(Se,k.CLAMP_TO_EDGE,k.LINEAR_MIPMAP_NEAREST),E.activeTexture.set(k.TEXTURE1),te?(te.texture.bind(Se,k.CLAMP_TO_EDGE,k.LINEAR_MIPMAP_NEAREST),me=Math.pow(2,te.tileID.overscaledZ-ee.tileID.overscaledZ),fe=[ee.tileID.canonical.x*me%1,ee.tileID.canonical.y*me%1]):ee.texture.bind(Se,k.CLAMP_TO_EDGE,k.LINEAR_MIPMAP_NEAREST),ee.texture.useMipmap&&E.extTextureFilterAnisotropic&&u.transform.pitch>20&&k.texParameterf(k.TEXTURE_2D,E.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,E.extTextureFilterAnisotropicMax);const Ie=u.style.map.terrain&&u.style.map.terrain.getTerrainData(X),Te=Z.getProjectionData({overscaledTileID:X,aligned:W,applyGlobeMatrix:!T,applyTerrainMatrix:!0}),je=Nd(fe||[0,0],me||1,re,i,_),Be=q.getMeshFromTileID(E,X.canonical,h,f,"raster");O.draw(E,k.TRIANGLES,Q,l?l[X.overscaledZ]:Ct.disabled,G,v?Dt.frontCCW:Dt.backCCW,je,Ie,Te,i.id,Be.vertexBuffer,Be.indexBuffer,Be.segments)}}function Xd(u,e,i,s,l,h){const f=s.paint.get("raster-fade-duration");if(!h&&f>0){const _=xe.now(),v=(_-u.timeAdded)/f,T=e?(_-e.timeAdded)/f:-1,I=i.getSource(),E=Sn(l,{tileSize:I.tileSize,roundZoom:I.roundZoom}),k=!e||Math.abs(e.tileID.overscaledZ-E)>Math.abs(u.tileID.overscaledZ-E),O=k&&u.refreshedUponExpiration?1:o.ae(k?v:1-T,0,1);return u.refreshedUponExpiration&&v>=1&&(u.refreshedUponExpiration=!1),e?{opacity:1,mix:1-O}:{opacity:O,mix:0}}return{opacity:1,mix:0}}const Ph=new o.b7(1,0,0,1),wi=new o.b7(0,1,0,1),wa=new o.b7(0,0,1,1),Vr=new o.b7(1,0,1,1),xc=new o.b7(0,1,1,1);function Qo(u,e,i,s){kn(u,0,e+i/2,u.transform.width,i,s)}function vc(u,e,i,s){kn(u,e-i/2,0,i,u.transform.height,s)}function kn(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 Hs(u,e,i){const s=u.context,l=s.gl,h=u.useProgram("debug"),f=ft.disabled,_=Ct.disabled,v=u.colorModeForRenderPass(),T="$debug",I=u.style.map.terrain&&u.style.map.terrain.getTerrainData(i);s.activeTexture.set(l.TEXTURE0);const E=e.getTileByID(i.key).latestRawTileData,k=Math.floor((E&&E.byteLength||0)/1024),O=e.getTile(i).tileSize,Z=512/Math.min(O,512)*(i.overscaledZ/u.transform.zoom)*.5;let q=i.canonical.toString();i.overscaledZ!==i.canonical.z&&(q+=` => ${i.overscaledZ}`),function(W,X){W.initDebugOverlayCanvas();const Q=W.debugOverlayCanvas,ee=W.context.gl,te=W.debugOverlayCanvas.getContext("2d");te.clearRect(0,0,Q.width,Q.height),te.shadowColor="white",te.shadowBlur=2,te.lineWidth=1.5,te.strokeStyle="white",te.textBaseline="top",te.font="bold 36px Open Sans, sans-serif",te.fillText(X,5,5),te.strokeText(X,5,5),W.debugOverlayTexture.update(Q),W.debugOverlayTexture.bind(ee.LINEAR,ee.CLAMP_TO_EDGE)}(u,`${q} ${k}kB`);const G=u.transform.getProjectionData({overscaledTileID:i,applyGlobeMatrix:!0,applyTerrainMatrix:!0});h.draw(s,l.TRIANGLES,f,_,ei.alphaBlended,Dt.disabled,Bo(o.b7.transparent,Z),null,G,T,u.debugBuffer,u.quadTriangleIndexBuffer,u.debugSegments),h.draw(s,l.LINE_STRIP,f,_,v,Dt.disabled,Bo(o.b7.red),I,G,T,u.debugBuffer,u.tileBorderIndexBuffer,u.debugSegments)}function el(u,e,i,s){const{isRenderingGlobe:l}=s,h=u.context,f=h.gl,_=u.transform,v=u.colorModeForRenderPass(),T=u.getDepthModeFor3D(),I=u.useProgram("terrain");h.bindFramebuffer.set(null),h.viewport.set([0,0,u.width,u.height]);for(const E of i){const k=e.getTerrainMesh(E.tileID),O=u.renderToTexture.getTexture(E),Z=e.getTerrainData(E.tileID);h.activeTexture.set(f.TEXTURE0),f.bindTexture(f.TEXTURE_2D,O.texture);const q=e.getMeshFrameDelta(_.zoom),G=_.calculateFogMatrix(E.tileID.toUnwrapped()),W=un(q,G,u.style.sky,_.pitch,l),X=_.getProjectionData({overscaledTileID:E.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});I.draw(h,f.TRIANGLES,T,Ct.disabled,v,Dt.backCCW,W,Z,X,"terrain",k.vertexBuffer,k.indexBuffer,k.segments)}}function bc(u,e){if(!e.mesh){const i=new o.aF;i.emplaceBack(-1,-1),i.emplaceBack(1,-1),i.emplaceBack(1,1),i.emplaceBack(-1,1);const s=new o.aH;s.emplaceBack(0,1,2),s.emplaceBack(0,2,3),e.mesh=new ma(u.createVertexBuffer(i,Wn.members),u.createIndexBuffer(s),o.aG.simpleSegment(0,0,i.length,s.length))}return e.mesh}class Sh{constructor(e,i){this.context=new Wd(e),this.transform=i,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:o.at(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=N.maxUnderzooming+N.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new ko}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.aF;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,Wn.members),this.tileExtentSegments=o.aG.simpleSegment(0,0,4,2);const s=new o.aF;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,Wn.members),this.debugSegments=o.aG.simpleSegment(0,0,4,5);const l=new o.bW;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,ec.members),this.rasterBoundsSegments=o.aG.simpleSegment(0,0,4,2);const h=new o.aF;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,Wn.members),this.rasterBoundsSegmentsPosOnly=o.aG.simpleSegment(0,0,4,5);const f=new o.aF;f.emplaceBack(0,0),f.emplaceBack(1,0),f.emplaceBack(0,1),f.emplaceBack(1,1),this.viewportBuffer=e.createVertexBuffer(f,Wn.members),this.viewportSegments=o.aG.simpleSegment(0,0,4,2);const _=new o.bX;_.emplaceBack(0),_.emplaceBack(1),_.emplaceBack(3),_.emplaceBack(2),_.emplaceBack(0),this.tileBorderIndexBuffer=e.createIndexBuffer(_);const v=new o.aH;v.emplaceBack(1,0,2),v.emplaceBack(1,2,3),this.quadTriangleIndexBuffer=e.createIndexBuffer(v);const T=this.context.gl;this.stencilClearMode=new Ct({func:T.ALWAYS,mask:0},0,255,T.ZERO,T.ZERO,T.ZERO),this.tileExtentMesh=new ma(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.bO(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,ft.disabled,this.stencilClearMode,ei.disabled,Dt.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(ei.disabled),l.setDepthMode(ft.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,v=this.transform,T=this.useProgram("clippingMask");for(const I of i){const E=e[I.key],k=this.style.map.terrain&&this.style.map.terrain.getTerrainData(I),O=_.getMeshFromTileID(this.context,I.canonical,l,!0,"stencil"),Z=v.getProjectionData({overscaledTileID:I,applyGlobeMatrix:!0,applyTerrainMatrix:!0});T.draw(h,f.TRIANGLES,ft.disabled,new Ct({func:f.ALWAYS,mask:0},E,255,f.KEEP,f.KEEP,f.REPLACE),ei.disabled,s?Dt.disabled:Dt.backCCW,null,k,Z,"$clipping",O.vertexBuffer,O.indexBuffer,O.segments)}}_renderTilesDepthBuffer(){const e=this.context,i=e.gl,s=this.style.projection,l=this.transform,h=this.useProgram("depth"),f=this.getDepthModeFor3D(),_=he(l,{tileSize:l.tileSize});for(const v of _){const T=this.style.map.terrain&&this.style.map.terrain.getTerrainData(v),I=s.getMeshFromTileID(this.context,v.canonical,!0,!0,"raster"),E=l.getProjectionData({overscaledTileID:v,applyGlobeMatrix:!0,applyTerrainMatrix:!0});h.draw(e,i.TRIANGLES,f,Ct.disabled,ei.disabled,Dt.backCCW,null,T,E,"$clipping",I.vertexBuffer,I.indexBuffer,I.segments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const e=this.nextStencilID++,i=this.context.gl;return new Ct({func:i.NOTEQUAL,mask:255},e,255,i.KEEP,i.KEEP,i.REPLACE)}stencilModeForClipping(e){const i=this.context.gl;return new Ct({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 Ct({func:i.GEQUAL,mask:255},_+this.nextStencilID,255,i.KEEP,i.KEEP,i.REPLACE);return this.nextStencilID+=h,[f,s]}return[{[l]:Ct.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 v=0;v<h;v++)f[v+l]=new Ct({func:i.GREATER,mask:255},h+1+v,255,i.KEEP,i.KEEP,i.REPLACE),_[v+l]=new Ct({func:i.GREATER,mask:255},1+v,255,i.KEEP,i.KEEP,i.REPLACE);return this.nextStencilID=2*h+1,[f,_,s]}return this.nextStencilID=3,[{[l]:new Ct({func:i.GREATER,mask:255},2,255,i.KEEP,i.KEEP,i.REPLACE)},{[l]:new Ct({func:i.GREATER,mask:255},1,255,i.KEEP,i.KEEP,i.REPLACE)},s]}colorModeForRenderPass(){const e=this.context.gl;return this._showOverdrawInspector?new ei([e.CONSTANT_COLOR,e.ONE],new o.b7(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?ei.unblended:ei.alphaBlended}getDepthModeForSublayer(e,i,s){if(!this.opaquePassEnabledForLayer())return ft.disabled;const l=1-((1+this.currentLayer)*this.numSublayers+e)*this.depthEpsilon;return new ft(s||this.context.gl.LEQUAL,i,[l,l])}getDepthModeFor3D(){return new ft(this.context.gl.LEQUAL,ft.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(xe.now()),this.imageManager.beginFrame();const h=this.style._order,f=this.style.sourceCaches,_={},v={},T={},I={isRenderingToTexture:!1,isRenderingGlobe:((s=e.projection)===null||s===void 0?void 0:s.transitionState)>0};for(const k in f){const O=f[k];O.used&&O.prepare(this.context),_[k]=O.getVisibleCoordinates(!1),v[k]=_[k].slice().reverse(),T[k]=O.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let k=0;k<h.length;k++)if(this.style._layers[h[k]].is3D()){this.opaquePassCutoff=k;break}this.maybeDrawDepthAndCoords(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen";for(const k of h){const O=this.style._layers[k];if(!O.hasOffscreenPass()||O.isHidden(this.transform.zoom))continue;const Z=v[O.source];(O.type==="custom"||Z.length)&&this.renderLayer(this,f[O.source],O,Z,I)}if((l=this.style.projection)===null||l===void 0||l.updateGPUdependent({context:this.context,useProgram:k=>this.useProgram(k)}),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(k,O){const Z=k.context,q=Z.gl,G=((oe,re,me)=>{const fe=Math.cos(re.rollInRadians),Se=Math.sin(re.rollInRadians),Ie=Xa(re),Te=re.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}).projectionTransition;return{u_sky_color:oe.properties.get("sky-color"),u_horizon_color:oe.properties.get("horizon-color"),u_horizon:[(re.width/2-Ie*Se)*me,(re.height/2+Ie*fe)*me],u_horizon_normal:[-Se,fe],u_sky_horizon_blend:oe.properties.get("sky-horizon-blend")*re.height/2*me,u_sky_blend:Te}})(O,k.style.map.transform,k.pixelRatio),W=new ft(q.LEQUAL,ft.ReadWrite,[0,1]),X=Ct.disabled,Q=k.colorModeForRenderPass(),ee=k.useProgram("sky"),te=bc(Z,O);ee.draw(Z,q.TRIANGLES,W,X,Q,Dt.disabled,G,null,void 0,"sky",te.vertexBuffer,te.indexBuffer,te.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 k=this.style._layers[h[this.currentLayer]],O=f[k.source],Z=_[k.source];this._renderTileClippingMasks(k,Z,!1),this.renderLayer(this,O,k,Z,I)}this.renderPass="translucent";let E=!1;for(this.currentLayer=0;this.currentLayer<h.length;this.currentLayer++){const k=this.style._layers[h[this.currentLayer]],O=f[k.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(k,I))continue;this.opaquePassEnabledForLayer()||E||(E=!0,I.isRenderingGlobe&&!this.style.map.terrain&&this._renderTilesDepthBuffer());const Z=(k.type==="symbol"?T:v)[k.source];this._renderTileClippingMasks(k,_[k.source],!1),this.renderLayer(this,O,k,Z,I)}if(I.isRenderingGlobe&&function(k,O,Z){const q=k.context,G=q.gl,W=k.useProgram("atmosphere"),X=new ft(G.LEQUAL,ft.ReadOnly,[0,1]),Q=k.transform,ee=function(Te,je){const Be=Te.properties.get("position"),Ce=[-Be.x,-Be.y,-Be.z],He=o.at(new Float64Array(16));return Te.properties.get("anchor")==="map"&&(o.a_(He,He,je.rollInRadians),o.a$(He,He,-je.pitchInRadians),o.a_(He,He,je.bearingInRadians),o.a$(He,He,je.center.lat*Math.PI/180),o.bm(He,He,-je.center.lng*Math.PI/180)),o.bV(Ce,Ce,He),Ce}(Z,k.transform),te=Q.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),oe=O.properties.get("atmosphere-blend")*te.projectionTransition;if(oe===0)return;const re=Ro(Q.worldSize,Q.center.lat),me=Q.inverseProjectionMatrix,fe=new Float64Array(4);fe[3]=1,o.ap(fe,fe,Q.modelViewProjectionMatrix),fe[0]/=fe[3],fe[1]/=fe[3],fe[2]/=fe[3],fe[3]=1,o.ap(fe,fe,me),fe[0]/=fe[3],fe[1]/=fe[3],fe[2]/=fe[3],fe[3]=1;const Se=((Te,je,Be,Ce,He)=>({u_sun_pos:Te,u_atmosphere_blend:je,u_globe_position:Be,u_globe_radius:Ce,u_inv_proj_matrix:He}))(ee,oe,[fe[0],fe[1],fe[2]],re,me),Ie=bc(q,O);W.draw(q,G.TRIANGLES,X,Ct.disabled,ei.alphaBlended,Dt.disabled,Se,null,null,"atmosphere",Ie.vertexBuffer,Ie.indexBuffer,Ie.segments)}(this,this.style.sky,this.style.light),this.options.showTileBoundaries){const k=function(O,Z){let q=null;const G=Object.values(O._layers).flatMap(ee=>ee.source&&!ee.isHidden(Z)?[O.sourceCaches[ee.source]]:[]),W=G.filter(ee=>ee.getSource().type==="vector"),X=G.filter(ee=>ee.getSource().type!=="vector"),Q=ee=>{(!q||q.getSource().maxzoom<ee.getSource().maxzoom)&&(q=ee)};return W.forEach(ee=>Q(ee)),q||X.forEach(ee=>Q(ee)),q}(this.style,this.transform.zoom);k&&function(O,Z,q){for(let G=0;G<q.length;G++)Hs(O,Z,q[G])}(this,k,k.getVisibleCoordinates())}this.options.showPadding&&function(k){const O=k.transform.padding;Qo(k,k.transform.height-(O.top||0),3,Ph),Qo(k,O.bottom||0,3,wi),vc(k,O.left||0,3,wa),vc(k,k.transform.width-(O.right||0),3,Vr);const Z=k.transform.centerPoint;(function(q,G,W,X){kn(q,G-1,W-10,2,20,X),kn(q,G-10,W-1,20,2,X)})(k,Z.x,k.transform.height-Z.y,xc)}(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.bY(i,s):!o.bZ(i,s)),l||(l=this.style.map.terrain.sourceCache.anyTilesAfterTime(this.terrainFacilitator.renderTime)),l&&(o.b_(i,s),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(h,f){const _=h.context,v=_.gl,T=h.transform,I=ei.unblended,E=new ft(v.LEQUAL,ft.ReadWrite,[0,1]),k=f.sourceCache.getRenderableTiles(),O=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 Z of k){const q=f.getTerrainMesh(Z.tileID),G=f.getTerrainData(Z.tileID),W=T.getProjectionData({overscaledTileID:Z.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0}),X={u_ele_delta:f.getMeshFrameDelta(T.zoom)};O.draw(_,v.TRIANGLES,E,Ct.disabled,I,Dt.backCCW,X,G,W,"terrain",q.vertexBuffer,q.indexBuffer,q.segments)}_.bindFramebuffer.set(null),_.viewport.set([0,0,h.width,h.height])}(this,this.style.map.terrain),function(h,f){const _=h.context,v=_.gl,T=h.transform,I=ei.unblended,E=new ft(v.LEQUAL,ft.ReadWrite,[0,1]),k=f.getCoordsTexture(),O=f.sourceCache.getRenderableTiles(),Z=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 q of O){const G=f.getTerrainMesh(q.tileID),W=f.getTerrainData(q.tileID);_.activeTexture.set(v.TEXTURE0),v.bindTexture(v.TEXTURE_2D,k.texture);const X={u_terrain_coords_id:(255-f.coordsIndex.length)/255,u_texture:0,u_ele_delta:f.getMeshFrameDelta(T.zoom)},Q=T.getProjectionData({overscaledTileID:q.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});Z.draw(_,v.TRIANGLES,E,Ct.disabled,I,Dt.backCCW,X,W,Q,"terrain",G.vertexBuffer,G.indexBuffer,G.segments),f.coordsIndex.push(q.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.b$(s)?function(f,_,v,T,I,E){if(f.renderPass!=="translucent")return;const{isRenderingToTexture:k}=E,O=Ct.disabled,Z=f.colorModeForRenderPass();(v._unevaluatedLayout.hasValue("text-variable-anchor")||v._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(q,G,W,X,Q,ee,te,oe,re){const me=G.transform,fe=G.style.map.terrain,Se=Q==="map",Ie=ee==="map";for(const Te of q){const je=X.getTile(Te),Be=je.getBucket(W);if(!Be||!Be.text||!Be.text.segments.get().length)continue;const Ce=o.ag(Be.textSizeData,me.zoom),He=o.aw(je,1,G.transform.zoom),pt=pe(Se,G.transform,He),jt=W.layout.get("icon-text-fit")!=="none"&&Be.hasIconData();if(Ce){const mt=Math.pow(2,me.zoom-je.tileID.overscaledZ),Wt=fe?(Yt,ii)=>fe.getElevation(Te,Yt,ii):null;wh(Be,Se,Ie,re,me,pt,mt,Ce,jt,o.ax(me,je,te,oe),Te.toUnwrapped(),Wt)}}}(T,f,v,_,v.layout.get("text-rotation-alignment"),v.layout.get("text-pitch-alignment"),v.paint.get("text-translate"),v.paint.get("text-translate-anchor"),I),v.paint.get("icon-opacity").constantOr(1)!==0&&qs(f,_,v,T,!1,v.paint.get("icon-translate"),v.paint.get("icon-translate-anchor"),v.layout.get("icon-rotation-alignment"),v.layout.get("icon-pitch-alignment"),v.layout.get("icon-keep-upright"),O,Z,k),v.paint.get("text-opacity").constantOr(1)!==0&&qs(f,_,v,T,!0,v.paint.get("text-translate"),v.paint.get("text-translate-anchor"),v.layout.get("text-rotation-alignment"),v.layout.get("text-pitch-alignment"),v.layout.get("text-keep-upright"),O,Z,k),_.map.showCollisionBoxes&&(Gs(f,_,v,T,!0),Gs(f,_,v,T,!1))}(e,i,s,l,this.style.placement.variableOffsets,h):o.c0(s)?function(f,_,v,T,I){if(f.renderPass!=="translucent")return;const{isRenderingToTexture:E}=I,k=v.paint.get("circle-opacity"),O=v.paint.get("circle-stroke-width"),Z=v.paint.get("circle-stroke-opacity"),q=!v.layout.get("circle-sort-key").isConstant();if(k.constantOr(1)===0&&(O.constantOr(1)===0||Z.constantOr(1)===0))return;const G=f.context,W=G.gl,X=f.transform,Q=f.getDepthModeForSublayer(0,ft.ReadOnly),ee=Ct.disabled,te=f.colorModeForRenderPass(),oe=[],re=X.getCircleRadiusCorrection();for(let me=0;me<T.length;me++){const fe=T[me],Se=_.getTile(fe),Ie=Se.getBucket(v);if(!Ie)continue;const Te=v.paint.get("circle-translate"),je=v.paint.get("circle-translate-anchor"),Be=o.ax(X,Se,Te,je),Ce=Ie.programConfigurations.get(v.id),He=f.useProgram("circle",Ce),pt=Ie.layoutVertexBuffer,jt=Ie.indexBuffer,mt=f.style.map.terrain&&f.style.map.terrain.getTerrainData(fe),Wt={programConfiguration:Ce,program:He,layoutVertexBuffer:pt,indexBuffer:jt,uniformValues:nh(f,Se,v,Be,re),terrainData:mt,projectionData:X.getProjectionData({overscaledTileID:fe,applyGlobeMatrix:!E,applyTerrainMatrix:!0})};if(q){const Yt=Ie.segments.get();for(const ii of Yt)oe.push({segments:new o.aG([ii]),sortKey:ii.sortKey,state:Wt})}else oe.push({segments:Ie.segments,sortKey:0,state:Wt})}q&&oe.sort((me,fe)=>me.sortKey-fe.sortKey);for(const me of oe){const{programConfiguration:fe,program:Se,layoutVertexBuffer:Ie,indexBuffer:Te,uniformValues:je,terrainData:Be,projectionData:Ce}=me.state;Se.draw(G,W.TRIANGLES,Q,ee,te,Dt.backCCW,je,Be,Ce,v.id,Ie,Te,me.segments,v.paint,f.transform.zoom,fe)}}(e,i,s,l,h):o.c1(s)?function(f,_,v,T,I){if(v.paint.get("heatmap-opacity")===0)return;const E=f.context,{isRenderingToTexture:k,isRenderingGlobe:O}=I;if(f.style.map.terrain){for(const Z of T){const q=_.getTile(Z);_.hasRenderableParent(Z)||(f.renderPass==="offscreen"?Hd(f,q,v,Z,O):f.renderPass==="translucent"&&_c(f,v,Z,k,O))}E.viewport.set([0,0,f.width,f.height])}else f.renderPass==="offscreen"?function(Z,q,G,W){const X=Z.context,Q=X.gl,ee=Z.transform,te=Ct.disabled,oe=new ei([Q.ONE,Q.ONE],o.b7.transparent,[!0,!0,!0,!0]);(function(re,me,fe){const Se=re.gl;re.activeTexture.set(Se.TEXTURE1),re.viewport.set([0,0,me.width/4,me.height/4]);let Ie=fe.heatmapFbos.get(o.bS);Ie?(Se.bindTexture(Se.TEXTURE_2D,Ie.colorAttachment.get()),re.bindFramebuffer.set(Ie.framebuffer)):(Ie=Th(re,me.width/4,me.height/4),fe.heatmapFbos.set(o.bS,Ie))})(X,Z,G),X.clear({color:o.b7.transparent});for(let re=0;re<W.length;re++){const me=W[re];if(q.hasRenderableParent(me))continue;const fe=q.getTile(me),Se=fe.getBucket(G);if(!Se)continue;const Ie=Se.programConfigurations.get(G.id),Te=Z.useProgram("heatmap",Ie),je=ee.getProjectionData({overscaledTileID:me,applyGlobeMatrix:!0,applyTerrainMatrix:!1}),Be=ee.getCircleRadiusCorrection();Te.draw(X,Q.TRIANGLES,ft.disabled,te,oe,Dt.backCCW,ic(fe,ee.zoom,G.paint.get("heatmap-intensity"),Be),null,je,G.id,Se.layoutVertexBuffer,Se.indexBuffer,Se.segments,G.paint,ee.zoom,Ie)}X.viewport.set([0,0,Z.width,Z.height])}(f,_,v,T):f.renderPass==="translucent"&&function(Z,q){const G=Z.context,W=G.gl;G.setColorMode(Z.colorModeForRenderPass());const X=q.heatmapFbos.get(o.bS);X&&(G.activeTexture.set(W.TEXTURE0),W.bindTexture(W.TEXTURE_2D,X.colorAttachment.get()),G.activeTexture.set(W.TEXTURE1),yc(G,q).bind(W.LINEAR,W.CLAMP_TO_EDGE),Z.useProgram("heatmapTexture").draw(G,W.TRIANGLES,ft.disabled,Ct.disabled,Z.colorModeForRenderPass(),Dt.disabled,rc(Z,q,0,1),null,null,q.id,Z.viewportBuffer,Z.quadTriangleIndexBuffer,Z.viewportSegments,q.paint,Z.transform.zoom))}(f,v)}(e,i,s,l,h):o.c2(s)?function(f,_,v,T,I){if(f.renderPass!=="translucent")return;const{isRenderingToTexture:E}=I,k=v.paint.get("line-opacity"),O=v.paint.get("line-width");if(k.constantOr(1)===0||O.constantOr(1)===0)return;const Z=f.getDepthModeForSublayer(0,ft.ReadOnly),q=f.colorModeForRenderPass(),G=v.paint.get("line-dasharray"),W=v.paint.get("line-pattern"),X=W.constantOr(1),Q=v.paint.get("line-gradient"),ee=v.getCrossfadeParameters(),te=X?"linePattern":G?"lineSDF":Q?"lineGradient":"line",oe=f.context,re=oe.gl,me=f.transform;let fe=!0;for(const Se of T){const Ie=_.getTile(Se);if(X&&!Ie.patternsLoaded())continue;const Te=Ie.getBucket(v);if(!Te)continue;const je=Te.programConfigurations.get(v.id),Be=f.context.program.get(),Ce=f.useProgram(te,je),He=fe||Ce.program!==Be,pt=f.style.map.terrain&&f.style.map.terrain.getTerrainData(Se),jt=W.constantOr(null);if(jt&&Ie.imageAtlas){const Ut=Ie.imageAtlas,Ht=Ut.patternPositions[jt.to.toString()],Ii=Ut.patternPositions[jt.from.toString()];Ht&&Ii&&je.setConstantPatternPositions(Ht,Ii)}const mt=me.getProjectionData({overscaledTileID:Se,applyGlobeMatrix:!E,applyTerrainMatrix:!0}),Wt=me.getPixelScale(),Yt=X?Zs(f,Ie,v,Wt,ee):G?jd(f,Ie,v,Wt,G,ee):Q?lh(f,Ie,v,Wt,Te.lineClipsArray.length):Oo(f,Ie,v,Wt);if(X)oe.activeTexture.set(re.TEXTURE0),Ie.imageAtlasTexture.bind(re.LINEAR,re.CLAMP_TO_EDGE),je.updatePaintBuffers(ee);else if(G&&(He||f.lineAtlas.dirty))oe.activeTexture.set(re.TEXTURE0),f.lineAtlas.bind(oe);else if(Q){const Ut=Te.gradients[v.id];let Ht=Ut.texture;if(v.gradientVersion!==Ut.version){let Ii=256;if(v.stepInterpolant){const Bi=_.getSource().maxzoom,Zi=Se.canonical.z===Bi?Math.ceil(1<<f.transform.maxZoom-Se.canonical.z):1;Ii=o.ae(o.bT(Te.maxLineLength/o.Z*1024*Zi),256,oe.maxTextureSize)}Ut.gradient=o.bU({expression:v.gradientExpression(),evaluationKey:"lineProgress",resolution:Ii,image:Ut.gradient||void 0,clips:Te.lineClipsArray}),Ut.texture?Ut.texture.update(Ut.gradient):Ut.texture=new Ot(oe,Ut.gradient,re.RGBA),Ut.version=v.gradientVersion,Ht=Ut.texture}oe.activeTexture.set(re.TEXTURE0),Ht.bind(v.stepInterpolant?re.NEAREST:re.LINEAR,re.CLAMP_TO_EDGE)}let ii;if(E){const[Ut]=f.getStencilConfigForOverlapAndUpdateStencilID(T);ii=Ut[Se.overscaledZ]}else ii=f.stencilModeForClipping(Se);Ce.draw(oe,re.TRIANGLES,Z,ii,q,Dt.disabled,Yt,pt,mt,v.id,Te.layoutVertexBuffer,Te.indexBuffer,Te.segments,v.paint,f.transform.zoom,je,Te.layoutVertexBuffer2),fe=!1}}(e,i,s,l,h):o.c3(s)?function(f,_,v,T,I){const E=v.paint.get("fill-color"),k=v.paint.get("fill-opacity");if(k.constantOr(1)===0)return;const{isRenderingToTexture:O}=I,Z=f.colorModeForRenderPass(),q=v.paint.get("fill-pattern"),G=f.opaquePassEnabledForLayer()&&!q.constantOr(1)&&E.constantOr(o.b7.transparent).a===1&&k.constantOr(0)===1?"opaque":"translucent";if(f.renderPass===G){const W=f.getDepthModeForSublayer(1,f.renderPass==="opaque"?ft.ReadWrite:ft.ReadOnly);Ko(f,_,v,T,W,Z,!1,O)}if(f.renderPass==="translucent"&&v.paint.get("fill-antialias")){const W=f.getDepthModeForSublayer(v.getPaintProperty("fill-outline-color")?2:0,ft.ReadOnly);Ko(f,_,v,T,W,Z,!0,O)}}(e,i,s,l,h):o.c4(s)?function(f,_,v,T,I){const E=v.paint.get("fill-extrusion-opacity");if(E===0)return;const{isRenderingToTexture:k}=I;if(f.renderPass==="translucent"){const O=new ft(f.context.gl.LEQUAL,ft.ReadWrite,f.depthRangeFor3D);if(E!==1||v.paint.get("fill-extrusion-pattern").constantOr(1))Yo(f,_,v,T,O,Ct.disabled,ei.disabled,k),Yo(f,_,v,T,O,f.stencilModeFor3D(),f.colorModeForRenderPass(),k);else{const Z=f.colorModeForRenderPass();Yo(f,_,v,T,O,Ct.disabled,Z,k)}}}(e,i,s,l,h):o.c5(s)?function(f,_,v,T,I){if(f.renderPass!=="offscreen"&&f.renderPass!=="translucent")return;const{isRenderingToTexture:E}=I,k=f.context,O=f.style.projection.useSubdivision,Z=f.getDepthModeForSublayer(0,ft.ReadOnly),q=f.colorModeForRenderPass();if(f.renderPass==="offscreen")(function(G,W,X,Q,ee,te,oe){const re=G.context,me=re.gl;for(const fe of X){const Se=W.getTile(fe),Ie=Se.dem;if(!Ie||!Ie.data||!Se.needsHillshadePrepare)continue;const Te=Ie.dim,je=Ie.stride,Be=Ie.getPixels();if(re.activeTexture.set(me.TEXTURE1),re.pixelStoreUnpackPremultiplyAlpha.set(!1),Se.demTexture=Se.demTexture||G.getTileTexture(je),Se.demTexture){const He=Se.demTexture;He.update(Be,{premultiply:!1}),He.bind(me.NEAREST,me.CLAMP_TO_EDGE)}else Se.demTexture=new Ot(re,Be,me.RGBA,{premultiply:!1}),Se.demTexture.bind(me.NEAREST,me.CLAMP_TO_EDGE);re.activeTexture.set(me.TEXTURE0);let Ce=Se.fbo;if(!Ce){const He=new Ot(re,{width:Te,height:Te,data:null},me.RGBA);He.bind(me.LINEAR,me.CLAMP_TO_EDGE),Ce=Se.fbo=re.createFramebuffer(Te,Te,!0,!1),Ce.colorAttachment.set(He.texture)}re.bindFramebuffer.set(Ce.framebuffer),re.viewport.set([0,0,Te,Te]),G.useProgram("hillshadePrepare").draw(re,me.TRIANGLES,ee,te,oe,Dt.disabled,oh(Se.tileID,Ie),null,null,Q.id,G.rasterBoundsBuffer,G.quadTriangleIndexBuffer,G.rasterBoundsSegments),Se.needsHillshadePrepare=!1}})(f,_,T,v,Z,Ct.disabled,q),k.viewport.set([0,0,f.width,f.height]);else if(f.renderPass==="translucent")if(O){const[G,W,X]=f.stencilConfigForOverlapTwoPass(T);Jo(f,_,v,X,G,Z,q,!1,E),Jo(f,_,v,X,W,Z,q,!0,E)}else{const[G,W]=f.getStencilConfigForOverlapAndUpdateStencilID(T);Jo(f,_,v,W,G,Z,q,!1,E)}}(e,i,s,l,h):o.c6(s)?function(f,_,v,T,I){if(f.renderPass!=="translucent"||v.paint.get("raster-opacity")===0||!T.length)return;const{isRenderingToTexture:E}=I,k=_.getSource(),O=f.style.projection.useSubdivision;if(k instanceof st)us(f,_,v,T,null,!1,!1,k.tileCoords,k.flippedWindingOrder,E);else if(O){const[Z,q,G]=f.stencilConfigForOverlapTwoPass(T);us(f,_,v,G,Z,!1,!0,cs,!1,E),us(f,_,v,G,q,!0,!0,cs,!1,E)}else{const[Z,q]=f.getStencilConfigForOverlapAndUpdateStencilID(T);us(f,_,v,q,Z,!1,!0,cs,!1,E)}}(e,i,s,l,h):o.c7(s)?function(f,_,v,T,I){const E=v.paint.get("background-color"),k=v.paint.get("background-opacity");if(k===0)return;const{isRenderingToTexture:O}=I,Z=f.context,q=Z.gl,G=f.style.projection,W=f.transform,X=W.tileSize,Q=v.paint.get("background-pattern");if(f.isPatternMissing(Q))return;const ee=!Q&&E.a===1&&k===1&&f.opaquePassEnabledForLayer()?"opaque":"translucent";if(f.renderPass!==ee)return;const te=Ct.disabled,oe=f.getDepthModeForSublayer(0,ee==="opaque"?ft.ReadWrite:ft.ReadOnly),re=f.colorModeForRenderPass(),me=f.useProgram(Q?"backgroundPattern":"background"),fe=T||he(W,{tileSize:X,terrain:f.style.map.terrain});Q&&(Z.activeTexture.set(q.TEXTURE0),f.imageManager.bind(f.context));const Se=v.getCrossfadeParameters();for(const Ie of fe){const Te=W.getProjectionData({overscaledTileID:Ie,applyGlobeMatrix:!O,applyTerrainMatrix:!0}),je=Q?jo(k,f,Q,{tileID:Ie,tileSize:X},Se):hh(k,E),Be=f.style.map.terrain&&f.style.map.terrain.getTerrainData(Ie),Ce=G.getMeshFromTileID(Z,Ie.canonical,!1,!0,"raster");me.draw(Z,q.TRIANGLES,oe,te,re,Dt.backCCW,je,Be,Te,v.id,Ce.vertexBuffer,Ce.indexBuffer,Ce.segments)}}(e,0,s,l,h):o.c8(s)&&function(f,_,v,T){const{isRenderingGlobe:I}=T,E=f.context,k=v.implementation,O=f.style.projection,Z=f.transform,q=Z.getProjectionDataForCustomLayer(I),G={farZ:Z.farZ,nearZ:Z.nearZ,fov:Z.fov*Math.PI/180,modelViewProjectionMatrix:Z.modelViewProjectionMatrix,projectionMatrix:Z.projectionMatrix,shaderData:{variantName:O.shaderVariantName,vertexShaderPrelude:`const float PI = 3.141592653589793;
728
728
  uniform mat4 u_projection_matrix;
729
- ${O.shaderPreludeCode.vertexSource}`,define:O.shaderDefine},defaultProjectionData:q},W=k.renderingMode?k.renderingMode:"2d";if(f.renderPass==="offscreen"){const X=k.prerender;X&&(f.setCustomLayerDefaults(),E.setColorMode(f.colorModeForRenderPass()),X.call(k,E.gl,G),E.setDirty(),f.setBaseState())}else if(f.renderPass==="translucent"){f.setCustomLayerDefaults(),E.setColorMode(f.colorModeForRenderPass()),E.setStencilMode(Ct.disabled);const X=W==="3d"?f.getDepthModeFor3D():f.getDepthModeForSublayer(0,ft.ReadOnly);E.setDepthMode(X),k.render(E.gl,G),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){this.cache=this.cache||{};const l=!!this.style.map.terrain,h=this.style.projection,f=e+(i?i.cacheKey:"")+`/${s?Ha:h.shaderVariantName}`+(this._showOverdrawInspector?"/overdraw":"")+(l?"/terrain":"");return this.cache[f]||(this.cache[f]=new Ns(this.context,Kr[e],i,oc[e],this._showOverdrawInspector,l,s?Kr.projectionMercator:h.shaderPreludeCode,s?In:h.shaderDefine)),this.cache[f]}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 Ot(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 wc(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 Tc{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=wc(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,v=this._map.getBearing(),T=this._map.getPitch();let I="";if(I+=e?`/${f}/${_}/${s}`:`${s}/${_}/${f}`,(v||T)&&(I+="/"+Math.round(10*v)/10),T&&(I+=`/${Math.round(T)}`),this._hashName){const E=this._hashName;let k=!1;const O=window.location.hash.slice(1).split("&").map(Z=>{const q=Z.split("=")[0];return q===E?(k=!0,`${q}=${I}`):Z}).filter(Z=>Z);return k||O.push(`${E}=${I}`),`#${O.join("&")}`}return`#${I}`}_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 hs={linearity:.3,easing:o.c9(0,0,.3,1)},Ta=o.e({deceleration:2500,maxSpeed:1400},hs),Mh=o.e({deceleration:20,maxSpeed:1400},hs),Ih=o.e({deceleration:1e3,maxSpeed:360},hs),Ch=o.e({deceleration:1e3,maxSpeed:90},hs),kh=o.e({deceleration:1e3,maxSpeed:360},hs);class Eh{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:xe.now(),settings:e})}_drainInertiaBuffer(){const e=this._inertiaBuffer,i=xe.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=ps(i.pan.mag(),s,o.e({},Ta,e||{})),f=i.pan.mult(h.amount/i.pan.mag()),_=this._map.cameraHelper.handlePanInertia(f,this._map.transform);l.center=_.easingCenter,l.offset=_.easingOffset,ds(l,h)}if(i.zoom){const h=ps(i.zoom,s,Mh);l.zoom=this._map.transform.zoom+h.amount,ds(l,h)}if(i.bearing){const h=ps(i.bearing,s,Ih);l.bearing=this._map.transform.bearing+o.ae(h.amount,-179,179),ds(l,h)}if(i.pitch){const h=ps(i.pitch,s,Ch);l.pitch=this._map.transform.pitch+h.amount,ds(l,h)}if(i.roll){const h=ps(i.roll,s,kh);l.roll=this._map.transform.roll+o.ae(h.amount,-179,179),ds(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 ds(u,e){(!u.duration||u.duration<e.duration)&&(u.duration=e.duration,u.easing=e.easing)}function ps(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 er 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=ie.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 fs 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=ie.touchPos(i.getCanvasContainer(),l),f=h.map(v=>i.unproject(v)),_=h.reduce((v,T,I,E)=>v.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 Ur extends o.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,i,s){super(e,{originalEvent:s}),this._defaultPrevented=!1}}class dn{constructor(e,i){this._map=e,this._clickTolerance=i.clickTolerance}reset(){delete this._mousedownPos}wheel(e){return this._firePreventable(new Ur(e.type,this._map,e))}mousedown(e,i){return this._mousedownPos=i,this._firePreventable(new er(e.type,this._map,e))}mouseup(e){this._map.fire(new er(e.type,this._map,e))}click(e,i){this._mousedownPos&&this._mousedownPos.dist(i)>=this._clickTolerance||this._map.fire(new er(e.type,this._map,e))}dblclick(e){return this._firePreventable(new er(e.type,this._map,e))}mouseover(e){this._map.fire(new er(e.type,this._map,e))}mouseout(e){this._map.fire(new er(e.type,this._map,e))}touchstart(e){return this._firePreventable(new fs(e.type,this._map,e))}touchmove(e){this._map.fire(new fs(e.type,this._map,e))}touchend(e){this._map.fire(new fs(e.type,this._map,e))}touchcancel(e){this._map.fire(new fs(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Ah{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(e){this._map.fire(new er(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new er("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._ignoreContextMenu||this._map.fire(new er(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class yr{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 Pa{constructor(e,i){this._map=e,this._tr=new yr(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&&(ie.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=ie.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),v=Math.max(l.y,s.y);ie.setTransform(this._box,`translate(${h}px,${_}px)`),this._box.style.width=f-h+"px",this._box.style.height=v-_+"px"}mouseupWindow(e,i){if(!this._active||e.button!==0)return;const s=this._startPos,l=i;if(this.reset(),ie.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&&(ie.remove(this._box),this._box=null),ie.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(e,i){return this._map.fire(new o.l(e,{originalEvent:i}))}}function Pc(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 Kd{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=Pc(s,i)))}touchmove(e,i,s){if(this.aborted||!this.centroid)return;const l=Pc(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 Sc{constructor(e){this.singleTap=new Kd(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 Yd{constructor(e){this._tr=new yr(e),this._zoomIn=new Sc({numTouches:1,numTaps:2}),this._zoomOut=new Sc({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 ms{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&&ie.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 Xs={0:1,2:2};class Er{constructor(e){this._correctEvent=e.checkCorrectEvent}startMove(e){const i=ie.mouseButton(e);this._eventButton=i}endMove(e){delete this._eventButton}isValidStartEvent(e){return this._correctEvent(e)}isValidMoveEvent(e){return!function(i,s){const l=Xs[s];return i.buttons===void 0||(i.buttons&l)!==l}(e,this._eventButton)}isValidEndEvent(e){return ie.mouseButton(e)===this._eventButton}}class $e{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 zh{constructor(e=new Er({checkCorrectEvent:()=>!0}),i=new $e){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 gs=u=>{u.mousedown=u.dragStart,u.mousemoveWindow=u.dragMove,u.mouseup=u.dragEnd,u.contextmenu=e=>{e.preventDefault()}};class Rh{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=Pc(s,i),h=new o.P(0,0),f=new o.P(0,0);let _=0;for(const T in l){const I=l[T],E=this._touches[T];E&&(h._add(I),f._add(I.sub(E)),_++,l[T]=I)}if(this._touches=l,this._shouldBePrevented(_)||!f.mag())return;const v=f.div(_);return this._sum._add(v),this._sum.mag()<this._clickTolerance?void 0:{around:h.div(_),panDelta:v}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Sa{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=Kn(s,i,l),_=Kn(s,i,h);if(!f||!_)return;const v=this._aroundCenter?null:f.add(_).div(2);return this._move([f,_],v,e)}touchend(e,i,s){if(!this._firstTwoTouches)return;const[l,h]=this._firstTwoTouches,f=Kn(s,i,l),_=Kn(s,i,h);f&&_||(this._active&&ie.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 Kn(u,e,i){for(let s=0;s<u.length;s++)if(u[s].identifier===i)return e[s]}function Mc(u,e){return Math.log(u/e)/Math.LN2}class wt extends Sa{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(Mc(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:Mc(this._distance,s),pinchAround:i}}}function tl(u,e){return 180*u.angleWith(e)/Math.PI}class Dh extends Sa{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:tl(this._vector,l),pinchAround:i}}_isBelowThreshold(e){this._minDiameter=Math.min(this._minDiameter,e.mag());const i=25/(Math.PI*this._minDiameter)*360,s=tl(e,this._startVector);return Math.abs(s)<i}}function Ks(u){return Math.abs(u.y)>Math.abs(u.x)}class Lh extends Sa{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,Ks(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 Ks(e)&&Ks(i)&&f}}const Jd={panStep:100,bearingStep:15,pitchStep:10};class Ic{constructor(e){this._tr=new yr(e);const i=Jd;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 v=this._tr;_.easeTo({duration:300,easeId:"keyboardHandler",easing:Cc,zoom:i?Math.round(v.zoom)+i*(e.shiftKey?2:1):v.zoom,bearing:v.bearing+s*this._bearingStep,pitch:v.pitch+l*this._pitchStep,offset:[-h*this._panStep,-f*this._panStep],center:v.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 Cc(u){return u*(2-u)}const kc=4.000244140625;class Fh{constructor(e,i){this._onTimeout=s=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(s)},this._map=e,this._tr=new yr(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=xe.now(),l=s-(this._lastWheelEventTime||0);this._lastWheelEventTime=s,i!==0&&i%kc==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=ie.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)>kc?this._wheelZoomRate:this._defaultZoomRate;let v=2/(1+Math.exp(-Math.abs(this._delta*_)));this._delta<0&&v!==0&&(v=1/v);const T=typeof this._targetZoom!="number"?e.scale:o.aI(this._targetZoom);this._targetZoom=Math.min(e.maxZoom,Math.max(e.minZoom,o.ab(T*v))),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 _=xe.now()-this._lastWheelEventTime,v=Math.min((_+5)/200,1),T=l(v);h=o.B.number(s,i,T),v<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.cb;if(this._prevEase){const s=this._prevEase,l=(xe.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.c9(f,_,.25,1)}return this._prevEase={start:xe.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 Ec{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 Qd{constructor(e){this._tr=new yr(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 ep{constructor(){this._tap=new Sc({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 En{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 ti{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 Ys{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 il{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=ie.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&&(ie.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 Js=u=>u.zoom||u.drag||u.roll||u.pitch||u.rotate;class Bh extends o.l{}function rl(u){return u.panDelta&&u.panDelta.mag()||u.zoomDelta||u.bearingDelta||u.pitchDelta||u.rollDelta}class tp{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},v={},T={};for(const{handlerName:k,handler:O,allowed:Z}of this._handlers){if(!O.isEnabled())continue;let q;if(this._blockedByActive(T,Z,k))O.reset();else if(O[h||l.type]){if(o.cc(l,h||l.type)){const G=ie.mousePos(this._map.getCanvas(),l);q=O[h||l.type](l,G)}else if(o.cd(l,h||l.type)){const G=this._getMapTouches(l.touches),W=ie.touchPos(this._map.getCanvas(),G);q=O[h||l.type](l,W,G)}else o.ce(h||l.type)||(q=O[h||l.type](l));this.mergeHandlerResult(_,v,q,k,f),q&&q.needsRenderFrame&&this._triggerRenderFrame()}(q||O.isActive())&&(T[k]=O)}const I={};for(const k in this._previousActiveHandlers)T[k]||(I[k]=f);this._previousActiveHandlers=T,(Object.keys(I).length||rl(_))&&(this._changes.push([_,v,I]),this._triggerRenderFrame()),(Object.keys(T).length||rl(_))&&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 Eh(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)ie.addEventListener(l,h,l===document?this.handleWindowEvent:this.handleEvent,f)}destroy(){for(const[e,i,s]of this._listeners)ie.removeEventListener(e,i,e===document?this.handleWindowEvent:this.handleEvent,s)}_addDefaultHandlers(e){const i=this._map,s=i.getCanvasContainer();this._add("mapEvent",new dn(i,e));const l=i.boxZoom=new Pa(i,e);this._add("boxZoom",l),e.interactive&&e.boxZoom&&l.enable();const h=i.cooperativeGestures=new il(i,e.cooperativeGestures);this._add("cooperativeGestures",h),e.cooperativeGestures&&h.enable();const f=new Yd(i),_=new Qd(i);i.doubleClickZoom=new Ec(_,f),this._add("tapZoom",f),this._add("clickZoom",_),e.interactive&&e.doubleClickZoom&&i.doubleClickZoom.enable();const v=new ep;this._add("tapDragZoom",v);const T=i.touchPitch=new Lh(i);this._add("touchPitch",T),e.interactive&&e.touchPitch&&i.touchPitch.enable(e.touchPitch);const I=()=>i.project(i.getCenter()),E=function({enable:ee,clickTolerance:te,aroundCenter:oe=!0,minPixelCenterThreshold:re=100,rotateDegreesPerPixelMoved:me=.8},fe){const Se=new Er({checkCorrectEvent:Ie=>ie.mouseButton(Ie)===0&&Ie.ctrlKey||ie.mouseButton(Ie)===2&&!Ie.ctrlKey});return new ms({clickTolerance:te,move:(Ie,Te)=>{const je=fe();if(oe&&Math.abs(je.y-Ie.y)>re)return{bearingDelta:o.ca(new o.P(Ie.x,Te.y),Te,je)};let Be=(Te.x-Ie.x)*me;return oe&&Te.y<je.y&&(Be=-Be),{bearingDelta:Be}},moveStateManager:Se,enable:ee,assignEvents:gs})}(e,I),k=function({enable:ee,clickTolerance:te,pitchDegreesPerPixelMoved:oe=-.5}){const re=new Er({checkCorrectEvent:me=>ie.mouseButton(me)===0&&me.ctrlKey||ie.mouseButton(me)===2});return new ms({clickTolerance:te,move:(me,fe)=>({pitchDelta:(fe.y-me.y)*oe}),moveStateManager:re,enable:ee,assignEvents:gs})}(e),O=function({enable:ee,clickTolerance:te,rollDegreesPerPixelMoved:oe=.3},re){const me=new Er({checkCorrectEvent:fe=>ie.mouseButton(fe)===2&&fe.ctrlKey});return new ms({clickTolerance:te,move:(fe,Se)=>{const Ie=re();let Te=(Se.x-fe.x)*oe;return Se.y<Ie.y&&(Te=-Te),{rollDelta:Te}},moveStateManager:me,enable:ee,assignEvents:gs})}(e,I);i.dragRotate=new ti(e,E,k,O),this._add("mouseRotate",E,["mousePitch"]),this._add("mousePitch",k,["mouseRotate","mouseRoll"]),this._add("mouseRoll",O,["mousePitch"]),e.interactive&&e.dragRotate&&i.dragRotate.enable();const Z=function({enable:ee,clickTolerance:te}){const oe=new Er({checkCorrectEvent:re=>ie.mouseButton(re)===0&&!re.ctrlKey});return new ms({clickTolerance:te,move:(re,me)=>({around:me,panDelta:me.sub(re)}),activateOnStart:!0,moveStateManager:oe,enable:ee,assignEvents:gs})}(e),q=new Rh(e,i);i.dragPan=new En(s,Z,q),this._add("mousePan",Z),this._add("touchPan",q,["touchZoom","touchRotate"]),e.interactive&&e.dragPan&&i.dragPan.enable(e.dragPan);const G=new Dh,W=new wt;i.touchZoomRotate=new Ys(s,W,G,v),this._add("touchRotate",G,["touchPan","touchZoom"]),this._add("touchZoom",W,["touchPan","touchRotate"]),e.interactive&&e.touchZoomRotate&&i.touchZoomRotate.enable(e.touchZoomRotate);const X=i.scrollZoom=new Fh(i,()=>this._triggerRenderFrame());this._add("scrollZoom",X,["mousePan"]),e.interactive&&e.scrollZoom&&i.scrollZoom.enable(e.scrollZoom);const Q=i.keyboard=new Ic(i);this._add("keyboard",Q),e.interactive&&e.keyboard&&i.keyboard.enable(),this._add("blockableMapEvent",new Ah(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!!Js(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(!(rl(e)||f&&this._terrainMovement))return this._fireEvents(i,s,!0);l._stop(!0);let{panDelta:_,zoomDelta:v,bearingDelta:T,pitchDelta:I,rollDelta:E,around:k,pinchAround:O}=e;O!==void 0&&(k=O),k=k||l.transform.centerPoint,f&&!h.isPointOnMapSurface(k)&&(k=h.centerPoint);const Z={panDelta:_,zoomDelta:v,rollDelta:E,pitchDelta:I,bearingDelta:T,around:k};this._map.cameraHelper.useGlobeControls&&!h.isPointOnMapSurface(k)&&(k=h.centerPoint);const q=k.distSqr(h.centerPoint)<.01?h.center:h.screenPointToLocation(_?k.sub(_):k);f?(this._map.cameraHelper.handleMapControlsRollPitchBearingZoom(Z,h),this._terrainMovement||!i.drag&&!i.zoom?i.drag&&this._terrainMovement?h.setCenter(h.screenPointToLocation(h.centerPoint.sub(_))):this._map.cameraHelper.handleMapControlsPan(Z,h,q):(this._terrainMovement=!0,this._map._elevationFreeze=!0,this._map.cameraHelper.handleMapControlsPan(Z,h,q))):(this._map.cameraHelper.handleMapControlsRollPitchBearingZoom(Z,h),this._map.cameraHelper.handleMapControlsPan(Z,h,q)),l._applyUpdatedTransform(h),this._map._update(),e.noInertia||this._inertia.record(e),this._fireEvents(i,s,!0)}_fireEvents(e,i,s){const l=Js(this._eventsInProgress),h=Js(e),f={};for(const E in e){const{originalEvent:k}=e[E];this._eventsInProgress[E]||(f[`${E}start`]=k),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:k}=e[E];this._fireEvent(E,k)}const _={};let v;for(const E in this._eventsInProgress){const{handlerName:k,originalEvent:O}=this._eventsInProgress[E];this._handlersById[k].isActive()||(delete this._eventsInProgress[E],v=i[k]||O,_[`${E}end`]=v)}for(const E in _)this._fireEvent(E,_[E]);const T=Js(this._eventsInProgress),I=(l||h)&&!T;if(I&&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&&I){this._updatingCamera=!0;const E=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),k=O=>O!==0&&-this._bearingSnap<O&&O<this._bearingSnap;!E||!E.essential&&xe.prefersReducedMotion?(this._map.fire(new o.l("moveend",{originalEvent:v})),k(this._map.getBearing())&&this._map.resetNorth()):(k(E.bearing||this._map.getBearing())&&(E.bearing=0),E.freezeElevation=!0,this._map.easeTo(E,{originalEvent:v})),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 Bh("renderFrame",{timeStamp:e})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class pn extends o.E{constructor(e,i,s){super(),this._renderFrameCallback=()=>{const l=Math.min((xe.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=Ve.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,v=new Ve(e,i);return this.cameraHelper.cameraForBoxAndBearing(l,f,v,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 v=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)),v&&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,v=f.y-h.y,T=f.z-h.z,I=Math.hypot(_,v,T);if(I===0)throw new Error("Can't calculate camera options with same From and To");const E=Math.hypot(_,v),k=o.ab(this.transform.cameraToCenterDistance/I/this.transform.tileSize),O=180*Math.atan2(_,-v)/Math.PI;let Z=180*Math.acos(E/I)/Math.PI;return Z=T<0?90-Z:90+Z,{center:f.toLngLat(),elevation:l,zoom:k,pitch:Z,bearing:O}}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.cb},e)).animate===!1||!e.essential&&xe.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,v="pitch"in e?+e.pitch:h,T="roll"in e?this._normalizeBearing(e.roll,f):f,I="padding"in e?e.padding:s.padding,E=o.P.convert(e.offset);let k,O;e.around&&(k=o.Q.convert(e.around),O=s.locationToScreenPoint(k));const Z={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching,rolling:this._rolling},q=this.cameraHelper.handleEaseTo(s,{bearing:_,pitch:v,roll:T,padding:I,around:k,aroundPoint:O,offsetAsPoint:E,offset:e.offset,zoom:e.zoom,center:e.center});return this._rotating=this._rotating||l!==_,this._pitching=this._pitching||v!==h,this._rolling=this._rolling||T!==f,this._padding=!s.isPaddingEqual(I),this._zooming=this._zooming||q.isZooming,this._easeId=e.easeId,this._prepareEase(i,e.noMoveStart,Z),this.terrain&&this._prepareElevation(q.elevationCenter),this._ease(G=>{q.easeFunc(G),this.terrain&&!e.freezeElevation&&this._updateElevation(G),this._applyUpdatedTransform(s),this._fireMoveEvents(i)},G=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(i,G)},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:v,pitch:T,bearing:I,elevation:E}=l(h);f&&h.setCenter(f),E!==void 0&&h.setElevation(E),_!==void 0&&h.setZoom(_),v!==void 0&&h.setRoll(v),T!==void 0&&h.setPitch(T),I!==void 0&&h.setBearing(I),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&&xe.prefersReducedMotion){const Te=o.O(e,["center","zoom","bearing","pitch","roll","elevation"]);return this.jumpTo(Te,i)}this.stop(),e=o.e({offset:[0,0],speed:1.2,curve:1.42,easing:o.cb},e);const s=this._getTransformForUpdate(),l=s.bearing,h=s.pitch,f=s.roll,_=s.padding,v="bearing"in e?this._normalizeBearing(e.bearing,l):l,T="pitch"in e?+e.pitch:h,I="roll"in e?this._normalizeBearing(e.roll,f):f,E="padding"in e?e.padding:s.padding,k=o.P.convert(e.offset);let O=s.centerPoint.add(k);const Z=s.screenPointToLocation(O),q=this.cameraHelper.handleFlyTo(s,{bearing:v,pitch:T,roll:I,padding:E,locationAtOffset:Z,offsetAsPoint:k,center:e.center,minZoom:e.minZoom,zoom:e.zoom});let G=e.curve;const W=Math.max(s.width,s.height),X=W/q.scaleOfZoom,Q=q.pixelPathLength;typeof q.scaleOfMinZoom=="number"&&(G=Math.sqrt(W/q.scaleOfMinZoom/Q*2));const ee=G*G;function te(Te){const je=(X*X-W*W+(Te?-1:1)*ee*ee*Q*Q)/(2*(Te?X:W)*ee*Q);return Math.log(Math.sqrt(je*je+1)-je)}function oe(Te){return(Math.exp(Te)-Math.exp(-Te))/2}function re(Te){return(Math.exp(Te)+Math.exp(-Te))/2}const me=te(!1);let fe=function(Te){return re(me)/re(me+G*Te)},Se=function(Te){return W*((re(me)*(oe(je=me+G*Te)/re(je))-oe(me))/ee)/Q;var je},Ie=(te(!0)-me)/G;if(Math.abs(Q)<2e-6||!isFinite(Ie)){if(Math.abs(W-X)<1e-6)return this.easeTo(e,i);const Te=X<W?-1:1;Ie=Math.abs(Math.log(X/W))/G,Se=()=>0,fe=je=>Math.exp(Te*G*je)}return e.duration="duration"in e?+e.duration:1e3*Ie/("screenSpeed"in e?+e.screenSpeed/G:+e.speed),e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=l!==v,this._pitching=T!==h,this._rolling=I!==f,this._padding=!s.isPaddingEqual(E),this._prepareEase(i,!1),this.terrain&&this._prepareElevation(q.targetCenter),this._ease(Te=>{const je=Te*Ie,Be=1/fe(je),Ce=Se(je);this._rotating&&s.setBearing(o.B.number(l,v,Te)),this._pitching&&s.setPitch(o.B.number(h,T,Te)),this._rolling&&s.setRoll(o.B.number(f,I,Te)),this._padding&&(s.interpolatePadding(_,E,Te),O=s.centerPoint.add(k)),q.easeFunc(Te,Be,Ce,O),this.terrain&&!e.freezeElevation&&this._updateElevation(Te),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=xe.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 Qs={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class Je{constructor(e=Qs){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=ie.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=ie.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=ie.create("div","maplibregl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("terrain",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container}onRemove(){ie.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(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=ie.sanitize(s),this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class nt{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=ie.create("div","maplibregl-ctrl");const i=ie.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(){ie.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class nl{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 Ac=o.aD([{name:"a_pos3d",type:"Int16",components:3}]);class zc extends o.E{constructor(e){super(),this._lastTilesetChange=xe.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 he(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.bO(l.terrainRttPosMatrix32f,0,o.Z,o.Z,0,0,1),this._tiles[l.key]=new ln(l,this.tileSize),this._lastTilesetChange=xe.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.bO(f,0,o.Z,o.Z,0,0,1);else if(l.canonical.isChildOf(e.canonical)){const _=l.canonical.z-e.canonical.z,v=l.canonical.x-(l.canonical.x>>_<<_),T=l.canonical.y-(l.canonical.y>>_<<_),I=o.Z>>_;o.bO(f,0,I,I,0,0,1),o.L(f,f,[-v*I,-T*I,0])}else{if(!e.canonical.isChildOf(l.canonical))continue;{const _=e.canonical.z-l.canonical.z,v=e.canonical.x-(e.canonical.x>>_<<_),T=e.canonical.y-(e.canonical.y>>_<<_),I=o.Z>>_;o.bO(f,0,o.Z,o.Z,0,0,1),o.L(f,f,[v*I,T*I,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 v=e.canonical.x-h.canonical.x,T=e.canonical.y-h.canonical.y;o.bO(_,0,o.Z,o.Z,0,0,1),o.L(_,_,[v*o.Z,T*o.Z,0])}else if(h.canonical.z>e.canonical.z){const v=h.canonical.z-e.canonical.z,T=h.canonical.x-(h.canonical.x>>v<<v),I=h.canonical.y-(h.canonical.y>>v<<v),E=e.canonical.x-(h.canonical.x>>v),k=e.canonical.y-(h.canonical.y>>v),O=o.Z>>v;o.bO(_,0,O,O,0,0,1),o.L(_,_,[-T*O+E*o.Z,-I*O+k*o.Z,0])}else{const v=e.canonical.z-h.canonical.z,T=e.canonical.x-(e.canonical.x>>v<<v),I=e.canonical.y-(e.canonical.y>>v<<v),E=(e.canonical.x>>v)-h.canonical.x,k=(e.canonical.y>>v)-h.canonical.y,O=o.Z<<v;o.bO(_,0,O,O,0,0,1),o.L(_,_,[T*o.Z+E*O,I*o.Z+k*O,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 xr{constructor(e,i,s){this._meshCache={},this.painter=e,this.sourceCache=new zc(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 v=o.cf([],[i/l*o.Z,s/l*o.Z],f.u_terrain_matrix),T=[v[0]*_.dim,v[1]*_.dim],I=Math.floor(T[0]),E=Math.floor(T[1]),k=T[0]-I,O=T[1]-E;return _.get(I,E)*(1-k)*(1-O)+_.get(I+1,E)*k*(1-O)+_.get(I,E+1)*(1-k)*O+_.get(I+1,E+1)*k*O}getElevationForLngLatZoom(e,i){if(!o.cg(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 Ot(l,h,l.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new Ot(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.at([])}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 Ot(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),v=o.ch(new Float64Array(16),[1/(o.Z<<h),1/(o.Z<<h),0]);o.L(v,v,[f*o.Z,_*o.Z,0]),this._demMatrixCache[e.key]={matrix:v,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 Ot(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 Ot(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 Ot(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 v=i[0]+(i[2]>>4<<8),T=i[1]+((15&i[2])<<8),I=this.coordsIndex[255-i[3]],E=I&&this.sourceCache.getTileByID(I);if(!E)return null;const k=this._coordsTextureSize,O=(1<<E.tileID.canonical.z)*k;return new o.$((E.tileID.canonical.x*k+v)/O+E.tileID.wrap,(E.tileID.canonical.y*k+T)/O,this.getElevation(E.tileID,v,T,k))}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,v=new o.ci,T=new o.aH,I=this.meshSize,E=o.Z/I,k=I*I;for(let re=0;re<=I;re++)for(let me=0;me<=I;me++)v.emplaceBack(me*E,re*E,0);for(let re=0;re<k;re+=I+1)for(let me=0;me<I;me++)T.emplaceBack(me+re,I+me+re+1,I+me+re+2),T.emplaceBack(me+re,I+me+re+2,me+re+1);const O=v.length,Z=O+(I+1),q=(I+1)*I,G=l?o.b9:0,W=l?0:1,X=h?o.ba:o.Z,Q=h?0:1;for(let re=0;re<=I;re++)v.emplaceBack(re*E,G,W);for(let re=0;re<=I;re++)v.emplaceBack(re*E,X,Q);for(let re=0;re<I;re++)T.emplaceBack(q+re,Z+re,Z+re+1),T.emplaceBack(q+re,Z+re+1,q+re+1),T.emplaceBack(0+re,O+re+1,O+re),T.emplaceBack(0+re,0+re+1,O+re+1);const ee=v.length,te=ee+2*(I+1);for(const re of[0,1])for(let me=0;me<=I;me++)for(const fe of[0,1])v.emplaceBack(re*o.Z,me*E,fe);for(let re=0;re<2*I;re+=2)T.emplaceBack(ee+re,ee+re+1,ee+re+3),T.emplaceBack(ee+re,ee+re+3,ee+re+2),T.emplaceBack(te+re,te+re+3,te+re+1),T.emplaceBack(te+re,te+re+2,te+re+3);const oe=new ma(_.createVertexBuffer(v,Ac.members),_.createIndexBuffer(T),o.aG.simpleSegment(0,0,v.length,T.length));return this._meshCache[f]=oe,oe}getMeshFrameDelta(e){return 2*Math.PI*o.br/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),v=Math.floor(f/o.Z);return{tileID:new o.Y(i,0,i,_,v),mercatorX:h,mercatorY:f}}}class Oh{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 Ot(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 cr={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class ip{constructor(e,i){this.painter=e,this.terrain=i,this.pool=new Oh(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 st?h.terrainTileRanges:null;for(const _ of l){const v=this.terrain.sourceCache.getTerrainCoords(_,f);for(const T in v)this._coordsAscending[s][T]||(this._coordsAscending[s][T]=[]),this._coordsAscending[s][T].push(v[T])}}this._coordsAscendingStr={};for(const s of e._order){const l=e._layers[s],h=l.source;if(cr[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(cr[l]&&(this._prevType&&cr[this._prevType]||this._stacks.push([]),this._prevType=l,this._stacks[this._stacks.length-1].push(e.id),!f))return!0;if(cr[this._prevType]||cr[l]&&f){this._prevType=l;const _=this._stacks.length-1,v=this._stacks[_]||[];for(const T of this._renderableTiles){if(this.pool.isFull()&&(el(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 I=this.pool.getOrCreateFreeObject();this.pool.useObject(I),this.pool.stampObject(I),T.rtt[_]={id:I.id,stamp:I.stamp},h.context.bindFramebuffer.set(I.fbo.framebuffer),h.context.clear({color:o.b7.transparent,stencil:0}),h.currentStencilSource=void 0;for(let E=0;E<v.length;E++){const k=h.style._layers[v[E]],O=k.source?this._coordsAscending[k.source][T.tileID.key]:[T.tileID];h.context.viewport.set([0,0,I.fbo.width,I.fbo.height]),h._renderTileClippingMasks(k,O,!0),h.renderLayer(h,h.style.sourceCaches[k.source],k,O,s),k.source&&(T.rttCoords[k.source]=this._coordsAscendingStr[k.source][T.tileID.key])}}return el(this.painter,this.terrain,this._rttTiles,s),this._rttTiles=[],this.pool.freeAllObjects(),cr[l]}return!1}}const eo={"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"},gi=le,Ti={hash:!1,interactive:!0,bearingSnap:7,attributionControl:Qs,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},jh={showCompass:!0,showZoom:!0,visualizePitch:!1,visualizeRoll:!0};class to{constructor(e,i,s=!1){this.mousedown=h=>{this.startMove(h,ie.mousePos(this.element,h)),ie.addEventListener(window,"mousemove",this.mousemove),ie.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=h=>{this.move(h,ie.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=ie.touchPos(this.element,h.targetTouches)[0],this.startMove(h,this._startPos),ie.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),ie.addEventListener(window,"touchend",this.touchend))},this.touchmove=h=>{h.targetTouches.length!==1?this.reset():(this._lastPos=ie.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 zh;this._rotatePitchHanlder=new ms({clickTolerance:3,move:(h,f)=>{const _=i.getBoundingClientRect(),v=new o.P((_.bottom-_.top)/2,(_.right-_.left)/2);return{bearingDelta:o.ca(new o.P(h.x,f.y),f,v),pitchDelta:s?-.5*(f.y-h.y):void 0}},moveStateManager:l,enable:!0,assignEvents:()=>{}}),this.map=e,ie.addEventListener(i,"mousedown",this.mousedown),ie.addEventListener(i,"touchstart",this.touchstart,{passive:!1}),ie.addEventListener(i,"touchcancel",this.reset)}startMove(e,i){this._rotatePitchHanlder.dragStart(e,i),ie.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;ie.removeEventListener(e,"mousedown",this.mousedown),ie.removeEventListener(e,"touchstart",this.touchstart,{passive:!1}),ie.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),ie.removeEventListener(window,"touchend",this.touchend),ie.removeEventListener(e,"touchcancel",this.reset),this.offTemp()}offTemp(){ie.enableDrag(),ie.removeEventListener(window,"mousemove",this.mousemove),ie.removeEventListener(window,"mouseup",this.mouseup),ie.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),ie.removeEventListener(window,"touchend",this.touchend)}}let fn;function al(u,e,i){const s=new o.Q(u.lng,u.lat);if(u=new o.Q(u.lng,u.lat),e){const l=new o.Q(u.lng-360,u.lat),h=new o.Q(u.lng+360,u.lat),f=i.locationToScreenPoint(u).distSqr(e);i.locationToScreenPoint(l).distSqr(e)<f?u=l:i.locationToScreenPoint(h).distSqr(e)<f&&(u=h)}for(;Math.abs(u.lng-i.center.lng)>180;){const l=i.locationToScreenPoint(u);if(l.x>=0&&l.y>=0&&l.x<=i.width&&l.y<=i.height)break;u.lng>i.center.lng?u.lng-=360:u.lng+=360}return u.lng!==s.lng&&i.isPointOnMapSurface(i.locationToScreenPoint(u))?u:s}const io={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 sl(u,e,i){const s=u.classList;for(const l in io)s.remove(`maplibregl-${i}-anchor-${l}`);s.add(`maplibregl-${i}-anchor-${e}`)}class Ma 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=>{var s;if(!this._map)return;const l=this._map.loaded()&&!this._map.isMoving();((i==null?void 0:i.type)==="terrain"||(i==null?void 0:i.type)==="render"&&!l)&&this._map.once("render",this._update),this._lngLat=this._map.transform.renderWorldCopies?al(this._lngLat,this._flatPos,this._map.transform):(s=this._lngLat)===null||s===void 0?void 0:s.wrap(),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 h="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?h=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(h=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let f="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?f="rotateX(0deg)":this._pitchAlignment==="map"&&(f=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||i&&i.type!=="moveend"||(this._pos=this._pos.round()),ie.setTransform(this._element,`${io[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${f} ${h}`),xe.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=ie.create("div");const i=ie.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=ie.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=ie.createNS("http://www.w3.org/2000/svg","g");f.setAttributeNS(null,"fill-rule","nonzero");const _=ie.createNS("http://www.w3.org/2000/svg","g");_.setAttributeNS(null,"transform","translate(3.0, 29.0)"),_.setAttributeNS(null,"fill","#000000");const v=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(const W of v){const X=ie.createNS("http://www.w3.org/2000/svg","ellipse");X.setAttributeNS(null,"opacity","0.04"),X.setAttributeNS(null,"cx","10.5"),X.setAttributeNS(null,"cy","5.80029008"),X.setAttributeNS(null,"rx",W.rx),X.setAttributeNS(null,"ry",W.ry),_.appendChild(X)}const T=ie.createNS("http://www.w3.org/2000/svg","g");T.setAttributeNS(null,"fill",this._color);const I=ie.createNS("http://www.w3.org/2000/svg","path");I.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),T.appendChild(I);const E=ie.createNS("http://www.w3.org/2000/svg","g");E.setAttributeNS(null,"opacity","0.25"),E.setAttributeNS(null,"fill","#000000");const k=ie.createNS("http://www.w3.org/2000/svg","path");k.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(k);const O=ie.createNS("http://www.w3.org/2000/svg","g");O.setAttributeNS(null,"transform","translate(6.0, 7.0)"),O.setAttributeNS(null,"fill","#FFFFFF");const Z=ie.createNS("http://www.w3.org/2000/svg","g");Z.setAttributeNS(null,"transform","translate(8.0, 8.0)");const q=ie.createNS("http://www.w3.org/2000/svg","circle");q.setAttributeNS(null,"fill","#000000"),q.setAttributeNS(null,"opacity","0.25"),q.setAttributeNS(null,"cx","5.5"),q.setAttributeNS(null,"cy","5.5"),q.setAttributeNS(null,"r","5.4999962");const G=ie.createNS("http://www.w3.org/2000/svg","circle");G.setAttributeNS(null,"fill","#FFFFFF"),G.setAttributeNS(null,"cx","5.5"),G.setAttributeNS(null,"cy","5.5"),G.setAttributeNS(null,"r","5.4999962"),Z.appendChild(q),Z.appendChild(G),f.appendChild(_),f.appendChild(T),f.appendChild(E),f.appendChild(O),f.appendChild(Z),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()}),sl(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),ie.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;if(!(!((i=this._map)===null||i===void 0)&&i.terrain)){const E=this._map.transform.isLocationOccluded(this._lngLat)?this._opacityWhenCovered:this._opacity;return void(this._element.style.opacity!==E&&(this._element.style.opacity=E))}if(e)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}const l=this._map,h=l.terrain.depthAtPoint(this._pos),f=l.terrain.getElevationForLngLatZoom(this._lngLat,l.transform.tileZoom);if(l.transform.lngLatToCameraDepth(this._lngLat,f)-h<.006)return void(this._element.style.opacity=this._opacity);const _=-this._offset.y/l.transform.pixelsPerMeter,v=Math.sin(l.getPitch()*Math.PI/180)*_,T=l.terrain.depthAtPoint(new o.P(this._pos.x,this._pos.y-this._offset.y)),I=l.transform.lngLatToCameraDepth(this._lngLat,f+v)-T>.006;!((s=this._popup)===null||s===void 0)&&s.isOpen()&&I&&this._popup.remove(),this._element.style.opacity=I?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 Rc={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let _s=0,Ia=!1;const Dc={maxWidth:100,unit:"metric"};function ol(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]),v=Math.round(u.project(_).x-u.project(f).x),T=Math.min(s,v,u._container.clientWidth),I=f.distanceTo(_);if(i&&i.unit==="imperial"){const E=3.2808*I;E>5280?Ca(e,T,E/5280,u._getUIString("ScaleControl.Miles")):Ca(e,T,E,u._getUIString("ScaleControl.Feet"))}else i&&i.unit==="nautical"?Ca(e,T,I/1852,u._getUIString("ScaleControl.NauticalMiles")):I>=1e3?Ca(e,T,I/1e3,u._getUIString("ScaleControl.Kilometers")):Ca(e,T,I,u._getUIString("ScaleControl.Meters"))}function Ca(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(v){const T=Math.pow(10,Math.ceil(-Math.log(v)/Math.LN10));return Math.round(v*T)/T}(_),f*_}(i);u.style.width=e*(l/i)+"px",u.innerHTML=`${l}&nbsp;${s}`}const Lc={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1,locationOccludedOpacity:void 0},Fc=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function ro(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 ro(new o.P(0,0))}const Bc=le;S.AJAXError=o.cm,S.Event=o.l,S.Evented=o.E,S.LngLat=o.Q,S.MercatorCoordinate=o.$,S.Point=o.P,S.addProtocol=o.cn,S.config=o.a,S.removeProtocol=o.co,S.AttributionControl=Je,S.BoxZoomHandler=Pa,S.CanvasSource=qt,S.CooperativeGesturesHandler=il,S.DoubleClickZoomHandler=Ec,S.DragPanHandler=En,S.DragRotateHandler=ti,S.EdgeInsets=oi,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=ie.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){ie.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const u=this._fullscreenButton=ie.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);ie.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=Pt,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=Ve.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(this.options.trackUserLocation)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&&Ia)return;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=ie.create("button","maplibregl-ctrl-geolocate",this._container),ie.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=ie.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new Ma({element:this._dotElement}),this._circleElement=ie.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Ma({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({},Rc,u)}onAdd(u){return this._map=u,this._container=ie.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),function(){return o._(this,arguments,void 0,function*(e=!1){if(fn!==void 0&&!e)return fn;if(window.navigator.permissions===void 0)return fn=!!window.navigator.geolocation,fn;try{fn=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{fn=!!window.navigator.geolocation}return fn})}().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(),ie.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,_s=0,Ia=!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":_s--,Ia=!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"),_s++,_s>1?(u={maximumAge:6e5,timeout:0},Ia=!0):(u=this.options.positionOptions,Ia=!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=ie.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._globeButton=ie.create("button","maplibregl-ctrl-globe",this._container),ie.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(){ie.remove(this._container),this._map.off("styledata",this._updateGlobeIcon),this._globeButton.removeEventListener("click",this._toggleProjection),this._map=void 0}},S.Hash=Tc,S.ImageSource=st,S.KeyboardHandler=Ic,S.LngLatBounds=Ve,S.LogoControl=nt,S.Map=class extends pn{constructor(u){var e,i;o.cj.mark(o.ck.create);const s=Object.assign(Object.assign(Object.assign({},Ti),u),{canvasContextAttributes:Object.assign(Object.assign({},Ti.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 li,h=new _r;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 nl,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({},eo),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=Jt.addThrottleControl(()=>this.isMoving()),this._requestManager=new pi(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 v=wc(T=>{this._trackResize&&!this._removed&&(this.resize(T),this.redraw())},50);this._resizeObserver=new ResizeObserver(T=>{_?v(T):_=!0}),this._resizeObserver.observe(this._container)}this.handlers=new tp(this,s),this._hash=s.hash&&new Tc(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 Je(typeof s.attributionControl=="boolean"?void 0:s.attributionControl)),s.maplibreLogo&&this.addControl(new nt,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(Ve.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(v=>this.getLayer(v)),_=f.length!==0?this.queryRenderedFeatures(h.point,{layers:f}):[];_.length?s||(s=!0,i.call(this,new er(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(v=>this.getLayer(v));(_.length!==0?this.queryRenderedFeatures(f.point,{layers:_}):[]).length?s=!0:s&&(s=!1,i.call(this,new er(u,this,f.originalEvent)))},mouseout:f=>{s&&(s=!1,i.call(this,new er(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 ts(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 ts(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 xr(this.painter,e,u),this.painter.renderToTexture=new ip(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)}addImage(u,e,i={}){const{pixelRatio:s=1,sdf:l=!1,stretchX:h,stretchY:f,content:_,textFitWidth:v,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:I,height:E,data:k}=e,O=e;return this.style.addImage(u,{data:new o.R({width:I,height:E},new Uint8Array(k)),pixelRatio:s,stretchX:h,stretchY:f,content:_,textFitWidth:v,textFitHeight:T,sdf:l,version:0,userImage:O}),O.onAdd&&O.onAdd(this,u),this}}{const{width:I,height:E,data:k}=xe.getImageData(e);this.style.addImage(u,{data:new o.R({width:I,height:E},k),pixelRatio:s,stretchX:h,stretchY:f,content:_,textFitWidth:v,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)?xe.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 Jt.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=ie.create("div","maplibregl-canvas-container",u);this._interactive&&e.classList.add("maplibregl-interactive"),this._canvas=ie.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=ie.create("div","maplibregl-control-container",u),h=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(f=>{h[f]=ie.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 Sh(i,this.transform),De.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 v=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const E=this.transform.zoom,k=xe.now();this.style.zoomHistory.update(E,k);const O=new o.C(E,{now:k,fadeDuration:f,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),Z=O.crossFadingFactor();Z===1&&Z===this._crossFadingFactor||(v=!0,this._crossFadingFactor=Z),this.style.update(O)}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.cj.mark(o.ck.load),this.fire(new o.l("load"))),this.style&&(this.style.hasTransitions()||v)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const I=this._sourcesDirty||this._styleDirty||this._placementDirty;return I||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new o.l("idle")),!this._loaded||this._fullyLoaded||I||(this._fullyLoaded=!0,o.cj.mark(o.ck.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),Jt.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),ie.remove(this._canvasContainer),ie.remove(this._controlContainer),this._container.removeEventListener("scroll",this._onMapScroll,!1),this._container.classList.remove("maplibregl-map"),o.cj.clearMetrics(),this._removed=!0,this.fire(new o.l("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,xe.frame(this._frameRequest,u=>{o.cj.frame(u),this._frameRequest=null;try{this._render(u)}catch(e){if(!o.cl(e)&&!function(i){return i.message===vh}(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 gi}getCameraTargetElevation(){return this.transform.elevation}getProjection(){return this.style.getProjection()}setProjection(u){return this._lazyInitEmptyStyle(),this.style.setProjection(u),this._update(!0)}},S.MapMouseEvent=er,S.MapTouchEvent=fs,S.MapWheelEvent=Ur,S.Marker=Ma,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({},jh,u),this._container=ie.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})),ie.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})),ie.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=ie.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 to(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){ie.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this.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=ie.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&&ie.remove(this._content),this._container&&(ie.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),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=>{var i;if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=ie.create("div","maplibregl-popup",this._map.getContainer()),this._tip=ie.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const _ of this.options.className.split(" "))this._container.classList.add(_);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=this._map.transform.renderWorldCopies&&!this._trackPointer?al(this._lngLat,this._flatPos,this._map.transform):(i=this._lngLat)===null||i===void 0?void 0:i.wrap(),this._trackPointer&&!e)return;const s=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 l=this.options.anchor;const h=ro(this.options.offset);if(!l){const _=this._container.offsetWidth,v=this._container.offsetHeight;let T;T=s.y+h.bottom.y<v?["top"]:s.y>this._map.transform.height-v?["bottom"]:[],s.x<_/2?T.push("left"):s.x>this._map.transform.width-_/2&&T.push("right"),l=T.length===0?"bottom":T.join("-")}let f=s.add(h[l]);this.options.subpixelPositioning||(f=f.round()),ie.setTransform(this._container,`${io[l]} translate(${f.x}px,${f.y}px)`),sl(this._container,l,"popup"),this._updateOpacity()},this._onClose=()=>{this.remove()},this.options=o.e(Object.create(Lc),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=ie.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=ie.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="&#215;",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const u=this._container.querySelector(Fc);u&&u.focus()}},S.RasterDEMTileSource=bi,S.RasterTileSource=Gt,S.ScaleControl=class{constructor(u){this._onMove=()=>{ol(this._map,this._container,this.options)},this.setUnit=e=>{this.options.unit=e,ol(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},Dc),u)}getDefaultPosition(){return"bottom-left"}onAdd(u){return this._map=u,this._container=ie.create("div","maplibregl-ctrl maplibregl-ctrl-scale",u.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){ie.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},S.ScrollZoomHandler=Fh,S.Style=ts,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=ie.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=ie.create("button","maplibregl-ctrl-terrain",this._container),ie.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(){ie.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},S.TwoFingersTouchPitchHandler=Lh,S.TwoFingersTouchRotateHandler=Dh,S.TwoFingersTouchZoomHandler=wt,S.TwoFingersTouchZoomRotateHandler=Ys,S.VectorTileSource=Zt,S.VideoSource=It,S.addSourceType=(u,e)=>o._(void 0,void 0,void 0,function*(){if(fi(u))throw new Error(`A source type called "${u}" already exists.`);((i,s)=>{qi[i]=s})(u,e)}),S.clearPrewarmedResources=function(){const u=Ji;u&&(u.isPreloaded()&&u.numActive()===1?(u.release($n),Ji=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=Ao,S.getMaxParallelImageRequests=function(){return o.a.MAX_PARALLEL_IMAGE_REQUESTS},S.getRTLTextPluginStatus=function(){return Xr().getRTLTextPluginStatus()},S.getVersion=function(){return Bc},S.getWorkerCount=function(){return jr.workerCount},S.getWorkerUrl=function(){return o.a.WORKER_URL},S.importScriptInWorkers=function(u){return kr().broadcast("IS",u)},S.prewarm=function(){Tn().acquire($n)},S.setMaxParallelImageRequests=function(u){o.a.MAX_PARALLEL_IMAGE_REQUESTS=u},S.setRTLTextPlugin=function(u,e){return Xr().setRTLTextPlugin(u,e)},S.setWorkerCount=function(u){jr.workerCount=u},S.setWorkerUrl=function(u){o.a.WORKER_URL=u}});var D=b;return D})}(zu)),zu.exports}var Sy=Py();const Sd=wy(Sy);class Wf{constructor(m,b,C,A,D){Ts(this,"bounds1");Ts(this,"bounds2");Ts(this,"getBounds",(m,b,C,A)=>new Sd.LngLatBounds([m,b],[C,A]));Ts(this,"contains",(m,b)=>this.bounds1.contains([b,m])||this.bounds2.contains([b,m]));const S=m.unproject([b,C]),o=m.unproject([A,D]);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 My={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}}]},Iy={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 Nt;(function(y){y.assertEqual=A=>A;function m(A){}y.assertIs=m;function b(A){throw new Error}y.assertNever=b,y.arrayToEnum=A=>{const D={};for(const S of A)D[S]=S;return D},y.getValidEnumValues=A=>{const D=y.objectKeys(A).filter(o=>typeof A[A[o]]!="number"),S={};for(const o of D)S[o]=A[o];return y.objectValues(S)},y.objectValues=A=>y.objectKeys(A).map(function(D){return A[D]}),y.objectKeys=typeof Object.keys=="function"?A=>Object.keys(A):A=>{const D=[];for(const S in A)Object.prototype.hasOwnProperty.call(A,S)&&D.push(S);return D},y.find=(A,D)=>{for(const S of A)if(D(S))return S},y.isInteger=typeof Number.isInteger=="function"?A=>Number.isInteger(A):A=>typeof A=="number"&&isFinite(A)&&Math.floor(A)===A;function C(A,D=" | "){return A.map(S=>typeof S=="string"?`'${S}'`:S).join(D)}y.joinValues=C,y.jsonStringifyReplacer=(A,D)=>typeof D=="bigint"?D.toString():D})(Nt||(Nt={}));var Md;(function(y){y.mergeShapes=(m,b)=>({...m,...b})})(Md||(Md={}));const Ke=Nt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ua=y=>{switch(typeof y){case"undefined":return Ke.undefined;case"string":return Ke.string;case"number":return isNaN(y)?Ke.nan:Ke.number;case"boolean":return Ke.boolean;case"function":return Ke.function;case"bigint":return Ke.bigint;case"symbol":return Ke.symbol;case"object":return Array.isArray(y)?Ke.array:y===null?Ke.null:y.then&&typeof y.then=="function"&&y.catch&&typeof y.catch=="function"?Ke.promise:typeof Map<"u"&&y instanceof Map?Ke.map:typeof Set<"u"&&y instanceof Set?Ke.set:typeof Date<"u"&&y instanceof Date?Ke.date:Ke.object;default:return Ke.unknown}},Oe=Nt.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"]),Cy=y=>JSON.stringify(y,null,2).replace(/"([^"]+)":/g,"$1:");class qr extends Error{get errors(){return this.issues}constructor(m){super(),this.issues=[],this.addIssue=C=>{this.issues=[...this.issues,C]},this.addIssues=(C=[])=>{this.issues=[...this.issues,...C]};const b=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,b):this.__proto__=b,this.name="ZodError",this.issues=m}format(m){const b=m||function(D){return D.message},C={_errors:[]},A=D=>{for(const S of D.issues)if(S.code==="invalid_union")S.unionErrors.map(A);else if(S.code==="invalid_return_type")A(S.returnTypeError);else if(S.code==="invalid_arguments")A(S.argumentsError);else if(S.path.length===0)C._errors.push(b(S));else{let o=C,le=0;for(;le<S.path.length;){const ue=S.path[le];le===S.path.length-1?(o[ue]=o[ue]||{_errors:[]},o[ue]._errors.push(b(S))):o[ue]=o[ue]||{_errors:[]},o=o[ue],le++}}};return A(this),C}static assert(m){if(!(m instanceof qr))throw new Error(`Not a ZodError: ${m}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Nt.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(m=b=>b.message){const b={},C=[];for(const A of this.issues)A.path.length>0?(b[A.path[0]]=b[A.path[0]]||[],b[A.path[0]].push(m(A))):C.push(m(A));return{formErrors:C,fieldErrors:b}}get formErrors(){return this.flatten()}}qr.create=y=>new qr(y);const xo=(y,m)=>{let b;switch(y.code){case Oe.invalid_type:y.received===Ke.undefined?b="Required":b=`Expected ${y.expected}, received ${y.received}`;break;case Oe.invalid_literal:b=`Invalid literal value, expected ${JSON.stringify(y.expected,Nt.jsonStringifyReplacer)}`;break;case Oe.unrecognized_keys:b=`Unrecognized key(s) in object: ${Nt.joinValues(y.keys,", ")}`;break;case Oe.invalid_union:b="Invalid input";break;case Oe.invalid_union_discriminator:b=`Invalid discriminator value. Expected ${Nt.joinValues(y.options)}`;break;case Oe.invalid_enum_value:b=`Invalid enum value. Expected ${Nt.joinValues(y.options)}, received '${y.received}'`;break;case Oe.invalid_arguments:b="Invalid function arguments";break;case Oe.invalid_return_type:b="Invalid function return type";break;case Oe.invalid_date:b="Invalid date";break;case Oe.invalid_string:typeof y.validation=="object"?"includes"in y.validation?(b=`Invalid input: must include "${y.validation.includes}"`,typeof y.validation.position=="number"&&(b=`${b} at one or more positions greater than or equal to ${y.validation.position}`)):"startsWith"in y.validation?b=`Invalid input: must start with "${y.validation.startsWith}"`:"endsWith"in y.validation?b=`Invalid input: must end with "${y.validation.endsWith}"`:Nt.assertNever(y.validation):y.validation!=="regex"?b=`Invalid ${y.validation}`:b="Invalid";break;case Oe.too_small:y.type==="array"?b=`Array must contain ${y.exact?"exactly":y.inclusive?"at least":"more than"} ${y.minimum} element(s)`:y.type==="string"?b=`String must contain ${y.exact?"exactly":y.inclusive?"at least":"over"} ${y.minimum} character(s)`:y.type==="number"?b=`Number must be ${y.exact?"exactly equal to ":y.inclusive?"greater than or equal to ":"greater than "}${y.minimum}`:y.type==="date"?b=`Date must be ${y.exact?"exactly equal to ":y.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(y.minimum))}`:b="Invalid input";break;case Oe.too_big:y.type==="array"?b=`Array must contain ${y.exact?"exactly":y.inclusive?"at most":"less than"} ${y.maximum} element(s)`:y.type==="string"?b=`String must contain ${y.exact?"exactly":y.inclusive?"at most":"under"} ${y.maximum} character(s)`:y.type==="number"?b=`Number must be ${y.exact?"exactly":y.inclusive?"less than or equal to":"less than"} ${y.maximum}`:y.type==="bigint"?b=`BigInt must be ${y.exact?"exactly":y.inclusive?"less than or equal to":"less than"} ${y.maximum}`:y.type==="date"?b=`Date must be ${y.exact?"exactly":y.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(y.maximum))}`:b="Invalid input";break;case Oe.custom:b="Invalid input";break;case Oe.invalid_intersection_types:b="Intersection results could not be merged";break;case Oe.not_multiple_of:b=`Number must be a multiple of ${y.multipleOf}`;break;case Oe.not_finite:b="Number must be finite";break;default:b=m.defaultError,Nt.assertNever(y)}return{message:b}};let Hf=xo;function ky(y){Hf=y}function Ru(){return Hf}const Du=y=>{const{data:m,path:b,errorMaps:C,issueData:A}=y,D=[...b,...A.path||[]],S={...A,path:D};if(A.message!==void 0)return{...A,path:D,message:A.message};let o="";const le=C.filter(ue=>!!ue).slice().reverse();for(const ue of le)o=ue(S,{data:m,defaultError:o}).message;return{...A,path:D,message:o}},Ey=[];function qe(y,m){const b=Ru(),C=Du({issueData:m,data:y.data,path:y.path,errorMaps:[y.common.contextualErrorMap,y.schemaErrorMap,b,b===xo?void 0:xo].filter(A=>!!A)});y.common.issues.push(C)}class hr{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(m,b){const C=[];for(const A of b){if(A.status==="aborted")return dt;A.status==="dirty"&&m.dirty(),C.push(A.value)}return{status:m.value,value:C}}static async mergeObjectAsync(m,b){const C=[];for(const A of b){const D=await A.key,S=await A.value;C.push({key:D,value:S})}return hr.mergeObjectSync(m,C)}static mergeObjectSync(m,b){const C={};for(const A of b){const{key:D,value:S}=A;if(D.status==="aborted"||S.status==="aborted")return dt;D.status==="dirty"&&m.dirty(),S.status==="dirty"&&m.dirty(),D.value!=="__proto__"&&(typeof S.value<"u"||A.alwaysSet)&&(C[D.value]=S.value)}return{status:m.value,value:C}}}const dt=Object.freeze({status:"aborted"}),vo=y=>({status:"dirty",value:y}),Sr=y=>({status:"valid",value:y}),Id=y=>y.status==="aborted",Cd=y=>y.status==="dirty",Ms=y=>y.status==="valid",El=y=>typeof Promise<"u"&&y instanceof Promise;function Lu(y,m,b,C){if(typeof m=="function"?y!==m||!0:!m.has(y))throw new TypeError("Cannot read private member from an object whose class did not declare it");return m.get(y)}function Xf(y,m,b,C,A){if(typeof m=="function"?y!==m||!0:!m.has(y))throw new TypeError("Cannot write private member to an object whose class did not declare it");return m.set(y,b),b}typeof SuppressedError=="function"&&SuppressedError;var rt;(function(y){y.errToObj=m=>typeof m=="string"?{message:m}:m||{},y.toString=m=>typeof m=="string"?m:m==null?void 0:m.message})(rt||(rt={}));var Al,zl;class Zn{constructor(m,b,C,A){this._cachedPath=[],this.parent=m,this.data=b,this._path=C,this._key=A}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Kf=(y,m)=>{if(Ms(m))return{success:!0,data:m.value};if(!y.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const b=new qr(y.common.issues);return this._error=b,this._error}}};function xt(y){if(!y)return{};const{errorMap:m,invalid_type_error:b,required_error:C,description:A}=y;if(m&&(b||C))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return m?{errorMap:m,description:A}:{errorMap:(S,o)=>{var le,ue;const{message:_e}=y;return S.code==="invalid_enum_value"?{message:_e??o.defaultError}:typeof o.data>"u"?{message:(le=_e??C)!==null&&le!==void 0?le:o.defaultError}:S.code!=="invalid_type"?{message:o.defaultError}:{message:(ue=_e??b)!==null&&ue!==void 0?ue:o.defaultError}},description:A}}class Mt{get description(){return this._def.description}_getType(m){return ua(m.data)}_getOrReturnCtx(m,b){return b||{common:m.parent.common,data:m.data,parsedType:ua(m.data),schemaErrorMap:this._def.errorMap,path:m.path,parent:m.parent}}_processInputParams(m){return{status:new hr,ctx:{common:m.parent.common,data:m.data,parsedType:ua(m.data),schemaErrorMap:this._def.errorMap,path:m.path,parent:m.parent}}}_parseSync(m){const b=this._parse(m);if(El(b))throw new Error("Synchronous parse encountered promise.");return b}_parseAsync(m){const b=this._parse(m);return Promise.resolve(b)}parse(m,b){const C=this.safeParse(m,b);if(C.success)return C.data;throw C.error}safeParse(m,b){var C;const A={common:{issues:[],async:(C=b==null?void 0:b.async)!==null&&C!==void 0?C:!1,contextualErrorMap:b==null?void 0:b.errorMap},path:(b==null?void 0:b.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:m,parsedType:ua(m)},D=this._parseSync({data:m,path:A.path,parent:A});return Kf(A,D)}"~validate"(m){var b,C;const A={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:m,parsedType:ua(m)};if(!this["~standard"].async)try{const D=this._parseSync({data:m,path:[],parent:A});return Ms(D)?{value:D.value}:{issues:A.common.issues}}catch(D){!((C=(b=D==null?void 0:D.message)===null||b===void 0?void 0:b.toLowerCase())===null||C===void 0)&&C.includes("encountered")&&(this["~standard"].async=!0),A.common={issues:[],async:!0}}return this._parseAsync({data:m,path:[],parent:A}).then(D=>Ms(D)?{value:D.value}:{issues:A.common.issues})}async parseAsync(m,b){const C=await this.safeParseAsync(m,b);if(C.success)return C.data;throw C.error}async safeParseAsync(m,b){const C={common:{issues:[],contextualErrorMap:b==null?void 0:b.errorMap,async:!0},path:(b==null?void 0:b.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:m,parsedType:ua(m)},A=this._parse({data:m,path:C.path,parent:C}),D=await(El(A)?A:Promise.resolve(A));return Kf(C,D)}refine(m,b){const C=A=>typeof b=="string"||typeof b>"u"?{message:b}:typeof b=="function"?b(A):b;return this._refinement((A,D)=>{const S=m(A),o=()=>D.addIssue({code:Oe.custom,...C(A)});return typeof Promise<"u"&&S instanceof Promise?S.then(le=>le?!0:(o(),!1)):S?!0:(o(),!1)})}refinement(m,b){return this._refinement((C,A)=>m(C)?!0:(A.addIssue(typeof b=="function"?b(C,A):b),!1))}_refinement(m){return new bn({schema:this,typeName:ut.ZodEffects,effect:{type:"refinement",refinement:m}})}superRefine(m){return this._refinement(m)}constructor(m){this.spa=this.safeParseAsync,this._def=m,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:b=>this["~validate"](b)}}optional(){return Un.create(this,this._def)}nullable(){return Za.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return vn.create(this)}promise(){return Po.create(this,this._def)}or(m){return Fl.create([this,m],this._def)}and(m){return Bl.create(this,m,this._def)}transform(m){return new bn({...xt(this._def),schema:this,typeName:ut.ZodEffects,effect:{type:"transform",transform:m}})}default(m){const b=typeof m=="function"?m:()=>m;return new Vl({...xt(this._def),innerType:this,defaultValue:b,typeName:ut.ZodDefault})}brand(){return new Ad({typeName:ut.ZodBranded,type:this,...xt(this._def)})}catch(m){const b=typeof m=="function"?m:()=>m;return new Ul({...xt(this._def),innerType:this,catchValue:b,typeName:ut.ZodCatch})}describe(m){const b=this.constructor;return new b({...this._def,description:m})}pipe(m){return $l.create(this,m)}readonly(){return Gl.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Ay=/^c[^\s-]{8,}$/i,zy=/^[0-9a-z]+$/,Ry=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Dy=/^[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,Ly=/^[a-z0-9_-]{21}$/i,Fy=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,By=/^[-+]?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)?)??$/,Oy=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,jy="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let kd;const Ny=/^(?:(?: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])$/,Zy=/^(?:(?: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])$/,Vy=/^(([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]))$/,Uy=/^(([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])$/,$y=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Gy=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Yf="((\\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])))",qy=new RegExp(`^${Yf}$`);function Jf(y){let m="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return y.precision?m=`${m}\\.\\d{${y.precision}}`:y.precision==null&&(m=`${m}(\\.\\d+)?`),m}function Wy(y){return new RegExp(`^${Jf(y)}$`)}function Qf(y){let m=`${Yf}T${Jf(y)}`;const b=[];return b.push(y.local?"Z?":"Z"),y.offset&&b.push("([+-]\\d{2}:?\\d{2})"),m=`${m}(${b.join("|")})`,new RegExp(`^${m}$`)}function Hy(y,m){return!!((m==="v4"||!m)&&Ny.test(y)||(m==="v6"||!m)&&Vy.test(y))}function Xy(y,m){if(!Fy.test(y))return!1;try{const[b]=y.split("."),C=b.replace(/-/g,"+").replace(/_/g,"/").padEnd(b.length+(4-b.length%4)%4,"="),A=JSON.parse(atob(C));return!(typeof A!="object"||A===null||!A.typ||!A.alg||m&&A.alg!==m)}catch{return!1}}function Ky(y,m){return!!((m==="v4"||!m)&&Zy.test(y)||(m==="v6"||!m)&&Uy.test(y))}class xn extends Mt{_parse(m){if(this._def.coerce&&(m.data=String(m.data)),this._getType(m)!==Ke.string){const D=this._getOrReturnCtx(m);return qe(D,{code:Oe.invalid_type,expected:Ke.string,received:D.parsedType}),dt}const C=new hr;let A;for(const D of this._def.checks)if(D.kind==="min")m.data.length<D.value&&(A=this._getOrReturnCtx(m,A),qe(A,{code:Oe.too_small,minimum:D.value,type:"string",inclusive:!0,exact:!1,message:D.message}),C.dirty());else if(D.kind==="max")m.data.length>D.value&&(A=this._getOrReturnCtx(m,A),qe(A,{code:Oe.too_big,maximum:D.value,type:"string",inclusive:!0,exact:!1,message:D.message}),C.dirty());else if(D.kind==="length"){const S=m.data.length>D.value,o=m.data.length<D.value;(S||o)&&(A=this._getOrReturnCtx(m,A),S?qe(A,{code:Oe.too_big,maximum:D.value,type:"string",inclusive:!0,exact:!0,message:D.message}):o&&qe(A,{code:Oe.too_small,minimum:D.value,type:"string",inclusive:!0,exact:!0,message:D.message}),C.dirty())}else if(D.kind==="email")Oy.test(m.data)||(A=this._getOrReturnCtx(m,A),qe(A,{validation:"email",code:Oe.invalid_string,message:D.message}),C.dirty());else if(D.kind==="emoji")kd||(kd=new RegExp(jy,"u")),kd.test(m.data)||(A=this._getOrReturnCtx(m,A),qe(A,{validation:"emoji",code:Oe.invalid_string,message:D.message}),C.dirty());else if(D.kind==="uuid")Dy.test(m.data)||(A=this._getOrReturnCtx(m,A),qe(A,{validation:"uuid",code:Oe.invalid_string,message:D.message}),C.dirty());else if(D.kind==="nanoid")Ly.test(m.data)||(A=this._getOrReturnCtx(m,A),qe(A,{validation:"nanoid",code:Oe.invalid_string,message:D.message}),C.dirty());else if(D.kind==="cuid")Ay.test(m.data)||(A=this._getOrReturnCtx(m,A),qe(A,{validation:"cuid",code:Oe.invalid_string,message:D.message}),C.dirty());else if(D.kind==="cuid2")zy.test(m.data)||(A=this._getOrReturnCtx(m,A),qe(A,{validation:"cuid2",code:Oe.invalid_string,message:D.message}),C.dirty());else if(D.kind==="ulid")Ry.test(m.data)||(A=this._getOrReturnCtx(m,A),qe(A,{validation:"ulid",code:Oe.invalid_string,message:D.message}),C.dirty());else if(D.kind==="url")try{new URL(m.data)}catch{A=this._getOrReturnCtx(m,A),qe(A,{validation:"url",code:Oe.invalid_string,message:D.message}),C.dirty()}else D.kind==="regex"?(D.regex.lastIndex=0,D.regex.test(m.data)||(A=this._getOrReturnCtx(m,A),qe(A,{validation:"regex",code:Oe.invalid_string,message:D.message}),C.dirty())):D.kind==="trim"?m.data=m.data.trim():D.kind==="includes"?m.data.includes(D.value,D.position)||(A=this._getOrReturnCtx(m,A),qe(A,{code:Oe.invalid_string,validation:{includes:D.value,position:D.position},message:D.message}),C.dirty()):D.kind==="toLowerCase"?m.data=m.data.toLowerCase():D.kind==="toUpperCase"?m.data=m.data.toUpperCase():D.kind==="startsWith"?m.data.startsWith(D.value)||(A=this._getOrReturnCtx(m,A),qe(A,{code:Oe.invalid_string,validation:{startsWith:D.value},message:D.message}),C.dirty()):D.kind==="endsWith"?m.data.endsWith(D.value)||(A=this._getOrReturnCtx(m,A),qe(A,{code:Oe.invalid_string,validation:{endsWith:D.value},message:D.message}),C.dirty()):D.kind==="datetime"?Qf(D).test(m.data)||(A=this._getOrReturnCtx(m,A),qe(A,{code:Oe.invalid_string,validation:"datetime",message:D.message}),C.dirty()):D.kind==="date"?qy.test(m.data)||(A=this._getOrReturnCtx(m,A),qe(A,{code:Oe.invalid_string,validation:"date",message:D.message}),C.dirty()):D.kind==="time"?Wy(D).test(m.data)||(A=this._getOrReturnCtx(m,A),qe(A,{code:Oe.invalid_string,validation:"time",message:D.message}),C.dirty()):D.kind==="duration"?By.test(m.data)||(A=this._getOrReturnCtx(m,A),qe(A,{validation:"duration",code:Oe.invalid_string,message:D.message}),C.dirty()):D.kind==="ip"?Hy(m.data,D.version)||(A=this._getOrReturnCtx(m,A),qe(A,{validation:"ip",code:Oe.invalid_string,message:D.message}),C.dirty()):D.kind==="jwt"?Xy(m.data,D.alg)||(A=this._getOrReturnCtx(m,A),qe(A,{validation:"jwt",code:Oe.invalid_string,message:D.message}),C.dirty()):D.kind==="cidr"?Ky(m.data,D.version)||(A=this._getOrReturnCtx(m,A),qe(A,{validation:"cidr",code:Oe.invalid_string,message:D.message}),C.dirty()):D.kind==="base64"?$y.test(m.data)||(A=this._getOrReturnCtx(m,A),qe(A,{validation:"base64",code:Oe.invalid_string,message:D.message}),C.dirty()):D.kind==="base64url"?Gy.test(m.data)||(A=this._getOrReturnCtx(m,A),qe(A,{validation:"base64url",code:Oe.invalid_string,message:D.message}),C.dirty()):Nt.assertNever(D);return{status:C.value,value:m.data}}_regex(m,b,C){return this.refinement(A=>m.test(A),{validation:b,code:Oe.invalid_string,...rt.errToObj(C)})}_addCheck(m){return new xn({...this._def,checks:[...this._def.checks,m]})}email(m){return this._addCheck({kind:"email",...rt.errToObj(m)})}url(m){return this._addCheck({kind:"url",...rt.errToObj(m)})}emoji(m){return this._addCheck({kind:"emoji",...rt.errToObj(m)})}uuid(m){return this._addCheck({kind:"uuid",...rt.errToObj(m)})}nanoid(m){return this._addCheck({kind:"nanoid",...rt.errToObj(m)})}cuid(m){return this._addCheck({kind:"cuid",...rt.errToObj(m)})}cuid2(m){return this._addCheck({kind:"cuid2",...rt.errToObj(m)})}ulid(m){return this._addCheck({kind:"ulid",...rt.errToObj(m)})}base64(m){return this._addCheck({kind:"base64",...rt.errToObj(m)})}base64url(m){return this._addCheck({kind:"base64url",...rt.errToObj(m)})}jwt(m){return this._addCheck({kind:"jwt",...rt.errToObj(m)})}ip(m){return this._addCheck({kind:"ip",...rt.errToObj(m)})}cidr(m){return this._addCheck({kind:"cidr",...rt.errToObj(m)})}datetime(m){var b,C;return typeof m=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:m}):this._addCheck({kind:"datetime",precision:typeof(m==null?void 0:m.precision)>"u"?null:m==null?void 0:m.precision,offset:(b=m==null?void 0:m.offset)!==null&&b!==void 0?b:!1,local:(C=m==null?void 0:m.local)!==null&&C!==void 0?C:!1,...rt.errToObj(m==null?void 0:m.message)})}date(m){return this._addCheck({kind:"date",message:m})}time(m){return typeof m=="string"?this._addCheck({kind:"time",precision:null,message:m}):this._addCheck({kind:"time",precision:typeof(m==null?void 0:m.precision)>"u"?null:m==null?void 0:m.precision,...rt.errToObj(m==null?void 0:m.message)})}duration(m){return this._addCheck({kind:"duration",...rt.errToObj(m)})}regex(m,b){return this._addCheck({kind:"regex",regex:m,...rt.errToObj(b)})}includes(m,b){return this._addCheck({kind:"includes",value:m,position:b==null?void 0:b.position,...rt.errToObj(b==null?void 0:b.message)})}startsWith(m,b){return this._addCheck({kind:"startsWith",value:m,...rt.errToObj(b)})}endsWith(m,b){return this._addCheck({kind:"endsWith",value:m,...rt.errToObj(b)})}min(m,b){return this._addCheck({kind:"min",value:m,...rt.errToObj(b)})}max(m,b){return this._addCheck({kind:"max",value:m,...rt.errToObj(b)})}length(m,b){return this._addCheck({kind:"length",value:m,...rt.errToObj(b)})}nonempty(m){return this.min(1,rt.errToObj(m))}trim(){return new xn({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new xn({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new xn({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(m=>m.kind==="datetime")}get isDate(){return!!this._def.checks.find(m=>m.kind==="date")}get isTime(){return!!this._def.checks.find(m=>m.kind==="time")}get isDuration(){return!!this._def.checks.find(m=>m.kind==="duration")}get isEmail(){return!!this._def.checks.find(m=>m.kind==="email")}get isURL(){return!!this._def.checks.find(m=>m.kind==="url")}get isEmoji(){return!!this._def.checks.find(m=>m.kind==="emoji")}get isUUID(){return!!this._def.checks.find(m=>m.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(m=>m.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(m=>m.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(m=>m.kind==="cuid2")}get isULID(){return!!this._def.checks.find(m=>m.kind==="ulid")}get isIP(){return!!this._def.checks.find(m=>m.kind==="ip")}get isCIDR(){return!!this._def.checks.find(m=>m.kind==="cidr")}get isBase64(){return!!this._def.checks.find(m=>m.kind==="base64")}get isBase64url(){return!!this._def.checks.find(m=>m.kind==="base64url")}get minLength(){let m=null;for(const b of this._def.checks)b.kind==="min"&&(m===null||b.value>m)&&(m=b.value);return m}get maxLength(){let m=null;for(const b of this._def.checks)b.kind==="max"&&(m===null||b.value<m)&&(m=b.value);return m}}xn.create=y=>{var m;return new xn({checks:[],typeName:ut.ZodString,coerce:(m=y==null?void 0:y.coerce)!==null&&m!==void 0?m:!1,...xt(y)})};function Yy(y,m){const b=(y.toString().split(".")[1]||"").length,C=(m.toString().split(".")[1]||"").length,A=b>C?b:C,D=parseInt(y.toFixed(A).replace(".","")),S=parseInt(m.toFixed(A).replace(".",""));return D%S/Math.pow(10,A)}class Oa extends Mt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(m){if(this._def.coerce&&(m.data=Number(m.data)),this._getType(m)!==Ke.number){const D=this._getOrReturnCtx(m);return qe(D,{code:Oe.invalid_type,expected:Ke.number,received:D.parsedType}),dt}let C;const A=new hr;for(const D of this._def.checks)D.kind==="int"?Nt.isInteger(m.data)||(C=this._getOrReturnCtx(m,C),qe(C,{code:Oe.invalid_type,expected:"integer",received:"float",message:D.message}),A.dirty()):D.kind==="min"?(D.inclusive?m.data<D.value:m.data<=D.value)&&(C=this._getOrReturnCtx(m,C),qe(C,{code:Oe.too_small,minimum:D.value,type:"number",inclusive:D.inclusive,exact:!1,message:D.message}),A.dirty()):D.kind==="max"?(D.inclusive?m.data>D.value:m.data>=D.value)&&(C=this._getOrReturnCtx(m,C),qe(C,{code:Oe.too_big,maximum:D.value,type:"number",inclusive:D.inclusive,exact:!1,message:D.message}),A.dirty()):D.kind==="multipleOf"?Yy(m.data,D.value)!==0&&(C=this._getOrReturnCtx(m,C),qe(C,{code:Oe.not_multiple_of,multipleOf:D.value,message:D.message}),A.dirty()):D.kind==="finite"?Number.isFinite(m.data)||(C=this._getOrReturnCtx(m,C),qe(C,{code:Oe.not_finite,message:D.message}),A.dirty()):Nt.assertNever(D);return{status:A.value,value:m.data}}gte(m,b){return this.setLimit("min",m,!0,rt.toString(b))}gt(m,b){return this.setLimit("min",m,!1,rt.toString(b))}lte(m,b){return this.setLimit("max",m,!0,rt.toString(b))}lt(m,b){return this.setLimit("max",m,!1,rt.toString(b))}setLimit(m,b,C,A){return new Oa({...this._def,checks:[...this._def.checks,{kind:m,value:b,inclusive:C,message:rt.toString(A)}]})}_addCheck(m){return new Oa({...this._def,checks:[...this._def.checks,m]})}int(m){return this._addCheck({kind:"int",message:rt.toString(m)})}positive(m){return this._addCheck({kind:"min",value:0,inclusive:!1,message:rt.toString(m)})}negative(m){return this._addCheck({kind:"max",value:0,inclusive:!1,message:rt.toString(m)})}nonpositive(m){return this._addCheck({kind:"max",value:0,inclusive:!0,message:rt.toString(m)})}nonnegative(m){return this._addCheck({kind:"min",value:0,inclusive:!0,message:rt.toString(m)})}multipleOf(m,b){return this._addCheck({kind:"multipleOf",value:m,message:rt.toString(b)})}finite(m){return this._addCheck({kind:"finite",message:rt.toString(m)})}safe(m){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:rt.toString(m)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:rt.toString(m)})}get minValue(){let m=null;for(const b of this._def.checks)b.kind==="min"&&(m===null||b.value>m)&&(m=b.value);return m}get maxValue(){let m=null;for(const b of this._def.checks)b.kind==="max"&&(m===null||b.value<m)&&(m=b.value);return m}get isInt(){return!!this._def.checks.find(m=>m.kind==="int"||m.kind==="multipleOf"&&Nt.isInteger(m.value))}get isFinite(){let m=null,b=null;for(const C of this._def.checks){if(C.kind==="finite"||C.kind==="int"||C.kind==="multipleOf")return!0;C.kind==="min"?(b===null||C.value>b)&&(b=C.value):C.kind==="max"&&(m===null||C.value<m)&&(m=C.value)}return Number.isFinite(b)&&Number.isFinite(m)}}Oa.create=y=>new Oa({checks:[],typeName:ut.ZodNumber,coerce:(y==null?void 0:y.coerce)||!1,...xt(y)});class ja extends Mt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(m){if(this._def.coerce)try{m.data=BigInt(m.data)}catch{return this._getInvalidInput(m)}if(this._getType(m)!==Ke.bigint)return this._getInvalidInput(m);let C;const A=new hr;for(const D of this._def.checks)D.kind==="min"?(D.inclusive?m.data<D.value:m.data<=D.value)&&(C=this._getOrReturnCtx(m,C),qe(C,{code:Oe.too_small,type:"bigint",minimum:D.value,inclusive:D.inclusive,message:D.message}),A.dirty()):D.kind==="max"?(D.inclusive?m.data>D.value:m.data>=D.value)&&(C=this._getOrReturnCtx(m,C),qe(C,{code:Oe.too_big,type:"bigint",maximum:D.value,inclusive:D.inclusive,message:D.message}),A.dirty()):D.kind==="multipleOf"?m.data%D.value!==BigInt(0)&&(C=this._getOrReturnCtx(m,C),qe(C,{code:Oe.not_multiple_of,multipleOf:D.value,message:D.message}),A.dirty()):Nt.assertNever(D);return{status:A.value,value:m.data}}_getInvalidInput(m){const b=this._getOrReturnCtx(m);return qe(b,{code:Oe.invalid_type,expected:Ke.bigint,received:b.parsedType}),dt}gte(m,b){return this.setLimit("min",m,!0,rt.toString(b))}gt(m,b){return this.setLimit("min",m,!1,rt.toString(b))}lte(m,b){return this.setLimit("max",m,!0,rt.toString(b))}lt(m,b){return this.setLimit("max",m,!1,rt.toString(b))}setLimit(m,b,C,A){return new ja({...this._def,checks:[...this._def.checks,{kind:m,value:b,inclusive:C,message:rt.toString(A)}]})}_addCheck(m){return new ja({...this._def,checks:[...this._def.checks,m]})}positive(m){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:rt.toString(m)})}negative(m){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:rt.toString(m)})}nonpositive(m){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:rt.toString(m)})}nonnegative(m){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:rt.toString(m)})}multipleOf(m,b){return this._addCheck({kind:"multipleOf",value:m,message:rt.toString(b)})}get minValue(){let m=null;for(const b of this._def.checks)b.kind==="min"&&(m===null||b.value>m)&&(m=b.value);return m}get maxValue(){let m=null;for(const b of this._def.checks)b.kind==="max"&&(m===null||b.value<m)&&(m=b.value);return m}}ja.create=y=>{var m;return new ja({checks:[],typeName:ut.ZodBigInt,coerce:(m=y==null?void 0:y.coerce)!==null&&m!==void 0?m:!1,...xt(y)})};class Rl extends Mt{_parse(m){if(this._def.coerce&&(m.data=!!m.data),this._getType(m)!==Ke.boolean){const C=this._getOrReturnCtx(m);return qe(C,{code:Oe.invalid_type,expected:Ke.boolean,received:C.parsedType}),dt}return Sr(m.data)}}Rl.create=y=>new Rl({typeName:ut.ZodBoolean,coerce:(y==null?void 0:y.coerce)||!1,...xt(y)});class Is extends Mt{_parse(m){if(this._def.coerce&&(m.data=new Date(m.data)),this._getType(m)!==Ke.date){const D=this._getOrReturnCtx(m);return qe(D,{code:Oe.invalid_type,expected:Ke.date,received:D.parsedType}),dt}if(isNaN(m.data.getTime())){const D=this._getOrReturnCtx(m);return qe(D,{code:Oe.invalid_date}),dt}const C=new hr;let A;for(const D of this._def.checks)D.kind==="min"?m.data.getTime()<D.value&&(A=this._getOrReturnCtx(m,A),qe(A,{code:Oe.too_small,message:D.message,inclusive:!0,exact:!1,minimum:D.value,type:"date"}),C.dirty()):D.kind==="max"?m.data.getTime()>D.value&&(A=this._getOrReturnCtx(m,A),qe(A,{code:Oe.too_big,message:D.message,inclusive:!0,exact:!1,maximum:D.value,type:"date"}),C.dirty()):Nt.assertNever(D);return{status:C.value,value:new Date(m.data.getTime())}}_addCheck(m){return new Is({...this._def,checks:[...this._def.checks,m]})}min(m,b){return this._addCheck({kind:"min",value:m.getTime(),message:rt.toString(b)})}max(m,b){return this._addCheck({kind:"max",value:m.getTime(),message:rt.toString(b)})}get minDate(){let m=null;for(const b of this._def.checks)b.kind==="min"&&(m===null||b.value>m)&&(m=b.value);return m!=null?new Date(m):null}get maxDate(){let m=null;for(const b of this._def.checks)b.kind==="max"&&(m===null||b.value<m)&&(m=b.value);return m!=null?new Date(m):null}}Is.create=y=>new Is({checks:[],coerce:(y==null?void 0:y.coerce)||!1,typeName:ut.ZodDate,...xt(y)});class Fu extends Mt{_parse(m){if(this._getType(m)!==Ke.symbol){const C=this._getOrReturnCtx(m);return qe(C,{code:Oe.invalid_type,expected:Ke.symbol,received:C.parsedType}),dt}return Sr(m.data)}}Fu.create=y=>new Fu({typeName:ut.ZodSymbol,...xt(y)});class Dl extends Mt{_parse(m){if(this._getType(m)!==Ke.undefined){const C=this._getOrReturnCtx(m);return qe(C,{code:Oe.invalid_type,expected:Ke.undefined,received:C.parsedType}),dt}return Sr(m.data)}}Dl.create=y=>new Dl({typeName:ut.ZodUndefined,...xt(y)});class Ll extends Mt{_parse(m){if(this._getType(m)!==Ke.null){const C=this._getOrReturnCtx(m);return qe(C,{code:Oe.invalid_type,expected:Ke.null,received:C.parsedType}),dt}return Sr(m.data)}}Ll.create=y=>new Ll({typeName:ut.ZodNull,...xt(y)});class bo extends Mt{constructor(){super(...arguments),this._any=!0}_parse(m){return Sr(m.data)}}bo.create=y=>new bo({typeName:ut.ZodAny,...xt(y)});class Cs extends Mt{constructor(){super(...arguments),this._unknown=!0}_parse(m){return Sr(m.data)}}Cs.create=y=>new Cs({typeName:ut.ZodUnknown,...xt(y)});class ha extends Mt{_parse(m){const b=this._getOrReturnCtx(m);return qe(b,{code:Oe.invalid_type,expected:Ke.never,received:b.parsedType}),dt}}ha.create=y=>new ha({typeName:ut.ZodNever,...xt(y)});class Bu extends Mt{_parse(m){if(this._getType(m)!==Ke.undefined){const C=this._getOrReturnCtx(m);return qe(C,{code:Oe.invalid_type,expected:Ke.void,received:C.parsedType}),dt}return Sr(m.data)}}Bu.create=y=>new Bu({typeName:ut.ZodVoid,...xt(y)});class vn extends Mt{_parse(m){const{ctx:b,status:C}=this._processInputParams(m),A=this._def;if(b.parsedType!==Ke.array)return qe(b,{code:Oe.invalid_type,expected:Ke.array,received:b.parsedType}),dt;if(A.exactLength!==null){const S=b.data.length>A.exactLength.value,o=b.data.length<A.exactLength.value;(S||o)&&(qe(b,{code:S?Oe.too_big:Oe.too_small,minimum:o?A.exactLength.value:void 0,maximum:S?A.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:A.exactLength.message}),C.dirty())}if(A.minLength!==null&&b.data.length<A.minLength.value&&(qe(b,{code:Oe.too_small,minimum:A.minLength.value,type:"array",inclusive:!0,exact:!1,message:A.minLength.message}),C.dirty()),A.maxLength!==null&&b.data.length>A.maxLength.value&&(qe(b,{code:Oe.too_big,maximum:A.maxLength.value,type:"array",inclusive:!0,exact:!1,message:A.maxLength.message}),C.dirty()),b.common.async)return Promise.all([...b.data].map((S,o)=>A.type._parseAsync(new Zn(b,S,b.path,o)))).then(S=>hr.mergeArray(C,S));const D=[...b.data].map((S,o)=>A.type._parseSync(new Zn(b,S,b.path,o)));return hr.mergeArray(C,D)}get element(){return this._def.type}min(m,b){return new vn({...this._def,minLength:{value:m,message:rt.toString(b)}})}max(m,b){return new vn({...this._def,maxLength:{value:m,message:rt.toString(b)}})}length(m,b){return new vn({...this._def,exactLength:{value:m,message:rt.toString(b)}})}nonempty(m){return this.min(1,m)}}vn.create=(y,m)=>new vn({type:y,minLength:null,maxLength:null,exactLength:null,typeName:ut.ZodArray,...xt(m)});function wo(y){if(y instanceof Si){const m={};for(const b in y.shape){const C=y.shape[b];m[b]=Un.create(wo(C))}return new Si({...y._def,shape:()=>m})}else return y instanceof vn?new vn({...y._def,type:wo(y.element)}):y instanceof Un?Un.create(wo(y.unwrap())):y instanceof Za?Za.create(wo(y.unwrap())):y instanceof Vn?Vn.create(y.items.map(m=>wo(m))):y}class Si extends Mt{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const m=this._def.shape(),b=Nt.objectKeys(m);return this._cached={shape:m,keys:b}}_parse(m){if(this._getType(m)!==Ke.object){const ue=this._getOrReturnCtx(m);return qe(ue,{code:Oe.invalid_type,expected:Ke.object,received:ue.parsedType}),dt}const{status:C,ctx:A}=this._processInputParams(m),{shape:D,keys:S}=this._getCached(),o=[];if(!(this._def.catchall instanceof ha&&this._def.unknownKeys==="strip"))for(const ue in A.data)S.includes(ue)||o.push(ue);const le=[];for(const ue of S){const _e=D[ue],Re=A.data[ue];le.push({key:{status:"valid",value:ue},value:_e._parse(new Zn(A,Re,A.path,ue)),alwaysSet:ue in A.data})}if(this._def.catchall instanceof ha){const ue=this._def.unknownKeys;if(ue==="passthrough")for(const _e of o)le.push({key:{status:"valid",value:_e},value:{status:"valid",value:A.data[_e]}});else if(ue==="strict")o.length>0&&(qe(A,{code:Oe.unrecognized_keys,keys:o}),C.dirty());else if(ue!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const ue=this._def.catchall;for(const _e of o){const Re=A.data[_e];le.push({key:{status:"valid",value:_e},value:ue._parse(new Zn(A,Re,A.path,_e)),alwaysSet:_e in A.data})}}return A.common.async?Promise.resolve().then(async()=>{const ue=[];for(const _e of le){const Re=await _e.key,xe=await _e.value;ue.push({key:Re,value:xe,alwaysSet:_e.alwaysSet})}return ue}).then(ue=>hr.mergeObjectSync(C,ue)):hr.mergeObjectSync(C,le)}get shape(){return this._def.shape()}strict(m){return rt.errToObj,new Si({...this._def,unknownKeys:"strict",...m!==void 0?{errorMap:(b,C)=>{var A,D,S,o;const le=(S=(D=(A=this._def).errorMap)===null||D===void 0?void 0:D.call(A,b,C).message)!==null&&S!==void 0?S:C.defaultError;return b.code==="unrecognized_keys"?{message:(o=rt.errToObj(m).message)!==null&&o!==void 0?o:le}:{message:le}}}:{}})}strip(){return new Si({...this._def,unknownKeys:"strip"})}passthrough(){return new Si({...this._def,unknownKeys:"passthrough"})}extend(m){return new Si({...this._def,shape:()=>({...this._def.shape(),...m})})}merge(m){return new Si({unknownKeys:m._def.unknownKeys,catchall:m._def.catchall,shape:()=>({...this._def.shape(),...m._def.shape()}),typeName:ut.ZodObject})}setKey(m,b){return this.augment({[m]:b})}catchall(m){return new Si({...this._def,catchall:m})}pick(m){const b={};return Nt.objectKeys(m).forEach(C=>{m[C]&&this.shape[C]&&(b[C]=this.shape[C])}),new Si({...this._def,shape:()=>b})}omit(m){const b={};return Nt.objectKeys(this.shape).forEach(C=>{m[C]||(b[C]=this.shape[C])}),new Si({...this._def,shape:()=>b})}deepPartial(){return wo(this)}partial(m){const b={};return Nt.objectKeys(this.shape).forEach(C=>{const A=this.shape[C];m&&!m[C]?b[C]=A:b[C]=A.optional()}),new Si({...this._def,shape:()=>b})}required(m){const b={};return Nt.objectKeys(this.shape).forEach(C=>{if(m&&!m[C])b[C]=this.shape[C];else{let D=this.shape[C];for(;D instanceof Un;)D=D._def.innerType;b[C]=D}}),new Si({...this._def,shape:()=>b})}keyof(){return em(Nt.objectKeys(this.shape))}}Si.create=(y,m)=>new Si({shape:()=>y,unknownKeys:"strip",catchall:ha.create(),typeName:ut.ZodObject,...xt(m)}),Si.strictCreate=(y,m)=>new Si({shape:()=>y,unknownKeys:"strict",catchall:ha.create(),typeName:ut.ZodObject,...xt(m)}),Si.lazycreate=(y,m)=>new Si({shape:y,unknownKeys:"strip",catchall:ha.create(),typeName:ut.ZodObject,...xt(m)});class Fl extends Mt{_parse(m){const{ctx:b}=this._processInputParams(m),C=this._def.options;function A(D){for(const o of D)if(o.result.status==="valid")return o.result;for(const o of D)if(o.result.status==="dirty")return b.common.issues.push(...o.ctx.common.issues),o.result;const S=D.map(o=>new qr(o.ctx.common.issues));return qe(b,{code:Oe.invalid_union,unionErrors:S}),dt}if(b.common.async)return Promise.all(C.map(async D=>{const S={...b,common:{...b.common,issues:[]},parent:null};return{result:await D._parseAsync({data:b.data,path:b.path,parent:S}),ctx:S}})).then(A);{let D;const S=[];for(const le of C){const ue={...b,common:{...b.common,issues:[]},parent:null},_e=le._parseSync({data:b.data,path:b.path,parent:ue});if(_e.status==="valid")return _e;_e.status==="dirty"&&!D&&(D={result:_e,ctx:ue}),ue.common.issues.length&&S.push(ue.common.issues)}if(D)return b.common.issues.push(...D.ctx.common.issues),D.result;const o=S.map(le=>new qr(le));return qe(b,{code:Oe.invalid_union,unionErrors:o}),dt}}get options(){return this._def.options}}Fl.create=(y,m)=>new Fl({options:y,typeName:ut.ZodUnion,...xt(m)});const da=y=>y instanceof jl?da(y.schema):y instanceof bn?da(y.innerType()):y instanceof Nl?[y.value]:y instanceof Na?y.options:y instanceof Zl?Nt.objectValues(y.enum):y instanceof Vl?da(y._def.innerType):y instanceof Dl?[void 0]:y instanceof Ll?[null]:y instanceof Un?[void 0,...da(y.unwrap())]:y instanceof Za?[null,...da(y.unwrap())]:y instanceof Ad||y instanceof Gl?da(y.unwrap()):y instanceof Ul?da(y._def.innerType):[];class Ou extends Mt{_parse(m){const{ctx:b}=this._processInputParams(m);if(b.parsedType!==Ke.object)return qe(b,{code:Oe.invalid_type,expected:Ke.object,received:b.parsedType}),dt;const C=this.discriminator,A=b.data[C],D=this.optionsMap.get(A);return D?b.common.async?D._parseAsync({data:b.data,path:b.path,parent:b}):D._parseSync({data:b.data,path:b.path,parent:b}):(qe(b,{code:Oe.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[C]}),dt)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(m,b,C){const A=new Map;for(const D of b){const S=da(D.shape[m]);if(!S.length)throw new Error(`A discriminator value for key \`${m}\` could not be extracted from all schema options`);for(const o of S){if(A.has(o))throw new Error(`Discriminator property ${String(m)} has duplicate value ${String(o)}`);A.set(o,D)}}return new Ou({typeName:ut.ZodDiscriminatedUnion,discriminator:m,options:b,optionsMap:A,...xt(C)})}}function Ed(y,m){const b=ua(y),C=ua(m);if(y===m)return{valid:!0,data:y};if(b===Ke.object&&C===Ke.object){const A=Nt.objectKeys(m),D=Nt.objectKeys(y).filter(o=>A.indexOf(o)!==-1),S={...y,...m};for(const o of D){const le=Ed(y[o],m[o]);if(!le.valid)return{valid:!1};S[o]=le.data}return{valid:!0,data:S}}else if(b===Ke.array&&C===Ke.array){if(y.length!==m.length)return{valid:!1};const A=[];for(let D=0;D<y.length;D++){const S=y[D],o=m[D],le=Ed(S,o);if(!le.valid)return{valid:!1};A.push(le.data)}return{valid:!0,data:A}}else return b===Ke.date&&C===Ke.date&&+y==+m?{valid:!0,data:y}:{valid:!1}}class Bl extends Mt{_parse(m){const{status:b,ctx:C}=this._processInputParams(m),A=(D,S)=>{if(Id(D)||Id(S))return dt;const o=Ed(D.value,S.value);return o.valid?((Cd(D)||Cd(S))&&b.dirty(),{status:b.value,value:o.data}):(qe(C,{code:Oe.invalid_intersection_types}),dt)};return C.common.async?Promise.all([this._def.left._parseAsync({data:C.data,path:C.path,parent:C}),this._def.right._parseAsync({data:C.data,path:C.path,parent:C})]).then(([D,S])=>A(D,S)):A(this._def.left._parseSync({data:C.data,path:C.path,parent:C}),this._def.right._parseSync({data:C.data,path:C.path,parent:C}))}}Bl.create=(y,m,b)=>new Bl({left:y,right:m,typeName:ut.ZodIntersection,...xt(b)});class Vn extends Mt{_parse(m){const{status:b,ctx:C}=this._processInputParams(m);if(C.parsedType!==Ke.array)return qe(C,{code:Oe.invalid_type,expected:Ke.array,received:C.parsedType}),dt;if(C.data.length<this._def.items.length)return qe(C,{code:Oe.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),dt;!this._def.rest&&C.data.length>this._def.items.length&&(qe(C,{code:Oe.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),b.dirty());const D=[...C.data].map((S,o)=>{const le=this._def.items[o]||this._def.rest;return le?le._parse(new Zn(C,S,C.path,o)):null}).filter(S=>!!S);return C.common.async?Promise.all(D).then(S=>hr.mergeArray(b,S)):hr.mergeArray(b,D)}get items(){return this._def.items}rest(m){return new Vn({...this._def,rest:m})}}Vn.create=(y,m)=>{if(!Array.isArray(y))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Vn({items:y,typeName:ut.ZodTuple,rest:null,...xt(m)})};class Ol extends Mt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(m){const{status:b,ctx:C}=this._processInputParams(m);if(C.parsedType!==Ke.object)return qe(C,{code:Oe.invalid_type,expected:Ke.object,received:C.parsedType}),dt;const A=[],D=this._def.keyType,S=this._def.valueType;for(const o in C.data)A.push({key:D._parse(new Zn(C,o,C.path,o)),value:S._parse(new Zn(C,C.data[o],C.path,o)),alwaysSet:o in C.data});return C.common.async?hr.mergeObjectAsync(b,A):hr.mergeObjectSync(b,A)}get element(){return this._def.valueType}static create(m,b,C){return b instanceof Mt?new Ol({keyType:m,valueType:b,typeName:ut.ZodRecord,...xt(C)}):new Ol({keyType:xn.create(),valueType:m,typeName:ut.ZodRecord,...xt(b)})}}class ju extends Mt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(m){const{status:b,ctx:C}=this._processInputParams(m);if(C.parsedType!==Ke.map)return qe(C,{code:Oe.invalid_type,expected:Ke.map,received:C.parsedType}),dt;const A=this._def.keyType,D=this._def.valueType,S=[...C.data.entries()].map(([o,le],ue)=>({key:A._parse(new Zn(C,o,C.path,[ue,"key"])),value:D._parse(new Zn(C,le,C.path,[ue,"value"]))}));if(C.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const le of S){const ue=await le.key,_e=await le.value;if(ue.status==="aborted"||_e.status==="aborted")return dt;(ue.status==="dirty"||_e.status==="dirty")&&b.dirty(),o.set(ue.value,_e.value)}return{status:b.value,value:o}})}else{const o=new Map;for(const le of S){const ue=le.key,_e=le.value;if(ue.status==="aborted"||_e.status==="aborted")return dt;(ue.status==="dirty"||_e.status==="dirty")&&b.dirty(),o.set(ue.value,_e.value)}return{status:b.value,value:o}}}}ju.create=(y,m,b)=>new ju({valueType:m,keyType:y,typeName:ut.ZodMap,...xt(b)});class ks extends Mt{_parse(m){const{status:b,ctx:C}=this._processInputParams(m);if(C.parsedType!==Ke.set)return qe(C,{code:Oe.invalid_type,expected:Ke.set,received:C.parsedType}),dt;const A=this._def;A.minSize!==null&&C.data.size<A.minSize.value&&(qe(C,{code:Oe.too_small,minimum:A.minSize.value,type:"set",inclusive:!0,exact:!1,message:A.minSize.message}),b.dirty()),A.maxSize!==null&&C.data.size>A.maxSize.value&&(qe(C,{code:Oe.too_big,maximum:A.maxSize.value,type:"set",inclusive:!0,exact:!1,message:A.maxSize.message}),b.dirty());const D=this._def.valueType;function S(le){const ue=new Set;for(const _e of le){if(_e.status==="aborted")return dt;_e.status==="dirty"&&b.dirty(),ue.add(_e.value)}return{status:b.value,value:ue}}const o=[...C.data.values()].map((le,ue)=>D._parse(new Zn(C,le,C.path,ue)));return C.common.async?Promise.all(o).then(le=>S(le)):S(o)}min(m,b){return new ks({...this._def,minSize:{value:m,message:rt.toString(b)}})}max(m,b){return new ks({...this._def,maxSize:{value:m,message:rt.toString(b)}})}size(m,b){return this.min(m,b).max(m,b)}nonempty(m){return this.min(1,m)}}ks.create=(y,m)=>new ks({valueType:y,minSize:null,maxSize:null,typeName:ut.ZodSet,...xt(m)});class To extends Mt{constructor(){super(...arguments),this.validate=this.implement}_parse(m){const{ctx:b}=this._processInputParams(m);if(b.parsedType!==Ke.function)return qe(b,{code:Oe.invalid_type,expected:Ke.function,received:b.parsedType}),dt;function C(o,le){return Du({data:o,path:b.path,errorMaps:[b.common.contextualErrorMap,b.schemaErrorMap,Ru(),xo].filter(ue=>!!ue),issueData:{code:Oe.invalid_arguments,argumentsError:le}})}function A(o,le){return Du({data:o,path:b.path,errorMaps:[b.common.contextualErrorMap,b.schemaErrorMap,Ru(),xo].filter(ue=>!!ue),issueData:{code:Oe.invalid_return_type,returnTypeError:le}})}const D={errorMap:b.common.contextualErrorMap},S=b.data;if(this._def.returns instanceof Po){const o=this;return Sr(async function(...le){const ue=new qr([]),_e=await o._def.args.parseAsync(le,D).catch(ie=>{throw ue.addIssue(C(le,ie)),ue}),Re=await Reflect.apply(S,this,_e);return await o._def.returns._def.type.parseAsync(Re,D).catch(ie=>{throw ue.addIssue(A(Re,ie)),ue})})}else{const o=this;return Sr(function(...le){const ue=o._def.args.safeParse(le,D);if(!ue.success)throw new qr([C(le,ue.error)]);const _e=Reflect.apply(S,this,ue.data),Re=o._def.returns.safeParse(_e,D);if(!Re.success)throw new qr([A(_e,Re.error)]);return Re.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...m){return new To({...this._def,args:Vn.create(m).rest(Cs.create())})}returns(m){return new To({...this._def,returns:m})}implement(m){return this.parse(m)}strictImplement(m){return this.parse(m)}static create(m,b,C){return new To({args:m||Vn.create([]).rest(Cs.create()),returns:b||Cs.create(),typeName:ut.ZodFunction,...xt(C)})}}class jl extends Mt{get schema(){return this._def.getter()}_parse(m){const{ctx:b}=this._processInputParams(m);return this._def.getter()._parse({data:b.data,path:b.path,parent:b})}}jl.create=(y,m)=>new jl({getter:y,typeName:ut.ZodLazy,...xt(m)});class Nl extends Mt{_parse(m){if(m.data!==this._def.value){const b=this._getOrReturnCtx(m);return qe(b,{received:b.data,code:Oe.invalid_literal,expected:this._def.value}),dt}return{status:"valid",value:m.data}}get value(){return this._def.value}}Nl.create=(y,m)=>new Nl({value:y,typeName:ut.ZodLiteral,...xt(m)});function em(y,m){return new Na({values:y,typeName:ut.ZodEnum,...xt(m)})}class Na extends Mt{constructor(){super(...arguments),Al.set(this,void 0)}_parse(m){if(typeof m.data!="string"){const b=this._getOrReturnCtx(m),C=this._def.values;return qe(b,{expected:Nt.joinValues(C),received:b.parsedType,code:Oe.invalid_type}),dt}if(Lu(this,Al)||Xf(this,Al,new Set(this._def.values)),!Lu(this,Al).has(m.data)){const b=this._getOrReturnCtx(m),C=this._def.values;return qe(b,{received:b.data,code:Oe.invalid_enum_value,options:C}),dt}return Sr(m.data)}get options(){return this._def.values}get enum(){const m={};for(const b of this._def.values)m[b]=b;return m}get Values(){const m={};for(const b of this._def.values)m[b]=b;return m}get Enum(){const m={};for(const b of this._def.values)m[b]=b;return m}extract(m,b=this._def){return Na.create(m,{...this._def,...b})}exclude(m,b=this._def){return Na.create(this.options.filter(C=>!m.includes(C)),{...this._def,...b})}}Al=new WeakMap,Na.create=em;class Zl extends Mt{constructor(){super(...arguments),zl.set(this,void 0)}_parse(m){const b=Nt.getValidEnumValues(this._def.values),C=this._getOrReturnCtx(m);if(C.parsedType!==Ke.string&&C.parsedType!==Ke.number){const A=Nt.objectValues(b);return qe(C,{expected:Nt.joinValues(A),received:C.parsedType,code:Oe.invalid_type}),dt}if(Lu(this,zl)||Xf(this,zl,new Set(Nt.getValidEnumValues(this._def.values))),!Lu(this,zl).has(m.data)){const A=Nt.objectValues(b);return qe(C,{received:C.data,code:Oe.invalid_enum_value,options:A}),dt}return Sr(m.data)}get enum(){return this._def.values}}zl=new WeakMap,Zl.create=(y,m)=>new Zl({values:y,typeName:ut.ZodNativeEnum,...xt(m)});class Po extends Mt{unwrap(){return this._def.type}_parse(m){const{ctx:b}=this._processInputParams(m);if(b.parsedType!==Ke.promise&&b.common.async===!1)return qe(b,{code:Oe.invalid_type,expected:Ke.promise,received:b.parsedType}),dt;const C=b.parsedType===Ke.promise?b.data:Promise.resolve(b.data);return Sr(C.then(A=>this._def.type.parseAsync(A,{path:b.path,errorMap:b.common.contextualErrorMap})))}}Po.create=(y,m)=>new Po({type:y,typeName:ut.ZodPromise,...xt(m)});class bn extends Mt{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ut.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(m){const{status:b,ctx:C}=this._processInputParams(m),A=this._def.effect||null,D={addIssue:S=>{qe(C,S),S.fatal?b.abort():b.dirty()},get path(){return C.path}};if(D.addIssue=D.addIssue.bind(D),A.type==="preprocess"){const S=A.transform(C.data,D);if(C.common.async)return Promise.resolve(S).then(async o=>{if(b.value==="aborted")return dt;const le=await this._def.schema._parseAsync({data:o,path:C.path,parent:C});return le.status==="aborted"?dt:le.status==="dirty"||b.value==="dirty"?vo(le.value):le});{if(b.value==="aborted")return dt;const o=this._def.schema._parseSync({data:S,path:C.path,parent:C});return o.status==="aborted"?dt:o.status==="dirty"||b.value==="dirty"?vo(o.value):o}}if(A.type==="refinement"){const S=o=>{const le=A.refinement(o,D);if(C.common.async)return Promise.resolve(le);if(le instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(C.common.async===!1){const o=this._def.schema._parseSync({data:C.data,path:C.path,parent:C});return o.status==="aborted"?dt:(o.status==="dirty"&&b.dirty(),S(o.value),{status:b.value,value:o.value})}else return this._def.schema._parseAsync({data:C.data,path:C.path,parent:C}).then(o=>o.status==="aborted"?dt:(o.status==="dirty"&&b.dirty(),S(o.value).then(()=>({status:b.value,value:o.value}))))}if(A.type==="transform")if(C.common.async===!1){const S=this._def.schema._parseSync({data:C.data,path:C.path,parent:C});if(!Ms(S))return S;const o=A.transform(S.value,D);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:b.value,value:o}}else return this._def.schema._parseAsync({data:C.data,path:C.path,parent:C}).then(S=>Ms(S)?Promise.resolve(A.transform(S.value,D)).then(o=>({status:b.value,value:o})):S);Nt.assertNever(A)}}bn.create=(y,m,b)=>new bn({schema:y,typeName:ut.ZodEffects,effect:m,...xt(b)}),bn.createWithPreprocess=(y,m,b)=>new bn({schema:m,effect:{type:"preprocess",transform:y},typeName:ut.ZodEffects,...xt(b)});class Un extends Mt{_parse(m){return this._getType(m)===Ke.undefined?Sr(void 0):this._def.innerType._parse(m)}unwrap(){return this._def.innerType}}Un.create=(y,m)=>new Un({innerType:y,typeName:ut.ZodOptional,...xt(m)});class Za extends Mt{_parse(m){return this._getType(m)===Ke.null?Sr(null):this._def.innerType._parse(m)}unwrap(){return this._def.innerType}}Za.create=(y,m)=>new Za({innerType:y,typeName:ut.ZodNullable,...xt(m)});class Vl extends Mt{_parse(m){const{ctx:b}=this._processInputParams(m);let C=b.data;return b.parsedType===Ke.undefined&&(C=this._def.defaultValue()),this._def.innerType._parse({data:C,path:b.path,parent:b})}removeDefault(){return this._def.innerType}}Vl.create=(y,m)=>new Vl({innerType:y,typeName:ut.ZodDefault,defaultValue:typeof m.default=="function"?m.default:()=>m.default,...xt(m)});class Ul extends Mt{_parse(m){const{ctx:b}=this._processInputParams(m),C={...b,common:{...b.common,issues:[]}},A=this._def.innerType._parse({data:C.data,path:C.path,parent:{...C}});return El(A)?A.then(D=>({status:"valid",value:D.status==="valid"?D.value:this._def.catchValue({get error(){return new qr(C.common.issues)},input:C.data})})):{status:"valid",value:A.status==="valid"?A.value:this._def.catchValue({get error(){return new qr(C.common.issues)},input:C.data})}}removeCatch(){return this._def.innerType}}Ul.create=(y,m)=>new Ul({innerType:y,typeName:ut.ZodCatch,catchValue:typeof m.catch=="function"?m.catch:()=>m.catch,...xt(m)});class Nu extends Mt{_parse(m){if(this._getType(m)!==Ke.nan){const C=this._getOrReturnCtx(m);return qe(C,{code:Oe.invalid_type,expected:Ke.nan,received:C.parsedType}),dt}return{status:"valid",value:m.data}}}Nu.create=y=>new Nu({typeName:ut.ZodNaN,...xt(y)});const Jy=Symbol("zod_brand");class Ad extends Mt{_parse(m){const{ctx:b}=this._processInputParams(m),C=b.data;return this._def.type._parse({data:C,path:b.path,parent:b})}unwrap(){return this._def.type}}class $l extends Mt{_parse(m){const{status:b,ctx:C}=this._processInputParams(m);if(C.common.async)return(async()=>{const D=await this._def.in._parseAsync({data:C.data,path:C.path,parent:C});return D.status==="aborted"?dt:D.status==="dirty"?(b.dirty(),vo(D.value)):this._def.out._parseAsync({data:D.value,path:C.path,parent:C})})();{const A=this._def.in._parseSync({data:C.data,path:C.path,parent:C});return A.status==="aborted"?dt:A.status==="dirty"?(b.dirty(),{status:"dirty",value:A.value}):this._def.out._parseSync({data:A.value,path:C.path,parent:C})}}static create(m,b){return new $l({in:m,out:b,typeName:ut.ZodPipeline})}}class Gl extends Mt{_parse(m){const b=this._def.innerType._parse(m),C=A=>(Ms(A)&&(A.value=Object.freeze(A.value)),A);return El(b)?b.then(A=>C(A)):C(b)}unwrap(){return this._def.innerType}}Gl.create=(y,m)=>new Gl({innerType:y,typeName:ut.ZodReadonly,...xt(m)});function tm(y,m){const b=typeof y=="function"?y(m):typeof y=="string"?{message:y}:y;return typeof b=="string"?{message:b}:b}function im(y,m={},b){return y?bo.create().superRefine((C,A)=>{var D,S;const o=y(C);if(o instanceof Promise)return o.then(le=>{var ue,_e;if(!le){const Re=tm(m,C),xe=(_e=(ue=Re.fatal)!==null&&ue!==void 0?ue:b)!==null&&_e!==void 0?_e:!0;A.addIssue({code:"custom",...Re,fatal:xe})}});if(!o){const le=tm(m,C),ue=(S=(D=le.fatal)!==null&&D!==void 0?D:b)!==null&&S!==void 0?S:!0;A.addIssue({code:"custom",...le,fatal:ue})}}):bo.create()}const Qy={object:Si.lazycreate};var ut;(function(y){y.ZodString="ZodString",y.ZodNumber="ZodNumber",y.ZodNaN="ZodNaN",y.ZodBigInt="ZodBigInt",y.ZodBoolean="ZodBoolean",y.ZodDate="ZodDate",y.ZodSymbol="ZodSymbol",y.ZodUndefined="ZodUndefined",y.ZodNull="ZodNull",y.ZodAny="ZodAny",y.ZodUnknown="ZodUnknown",y.ZodNever="ZodNever",y.ZodVoid="ZodVoid",y.ZodArray="ZodArray",y.ZodObject="ZodObject",y.ZodUnion="ZodUnion",y.ZodDiscriminatedUnion="ZodDiscriminatedUnion",y.ZodIntersection="ZodIntersection",y.ZodTuple="ZodTuple",y.ZodRecord="ZodRecord",y.ZodMap="ZodMap",y.ZodSet="ZodSet",y.ZodFunction="ZodFunction",y.ZodLazy="ZodLazy",y.ZodLiteral="ZodLiteral",y.ZodEnum="ZodEnum",y.ZodEffects="ZodEffects",y.ZodNativeEnum="ZodNativeEnum",y.ZodOptional="ZodOptional",y.ZodNullable="ZodNullable",y.ZodDefault="ZodDefault",y.ZodCatch="ZodCatch",y.ZodPromise="ZodPromise",y.ZodBranded="ZodBranded",y.ZodPipeline="ZodPipeline",y.ZodReadonly="ZodReadonly"})(ut||(ut={}));const ex=(y,m={message:`Input not instance of ${y.name}`})=>im(b=>b instanceof y,m),rm=xn.create,nm=Oa.create,tx=Nu.create,ix=ja.create,am=Rl.create,rx=Is.create,nx=Fu.create,ax=Dl.create,sx=Ll.create,ox=bo.create,lx=Cs.create,cx=ha.create,ux=Bu.create,hx=vn.create,dx=Si.create,px=Si.strictCreate,fx=Fl.create,mx=Ou.create,gx=Bl.create,_x=Vn.create,yx=Ol.create,xx=ju.create,vx=ks.create,bx=To.create,wx=jl.create,Tx=Nl.create,Px=Na.create,Sx=Zl.create,Mx=Po.create,sm=bn.create,Ix=Un.create,Cx=Za.create,kx=bn.createWithPreprocess,Ex=$l.create;var ct=Object.freeze({__proto__:null,defaultErrorMap:xo,setErrorMap:ky,getErrorMap:Ru,makeIssue:Du,EMPTY_PATH:Ey,addIssueToContext:qe,ParseStatus:hr,INVALID:dt,DIRTY:vo,OK:Sr,isAborted:Id,isDirty:Cd,isValid:Ms,isAsync:El,get util(){return Nt},get objectUtil(){return Md},ZodParsedType:Ke,getParsedType:ua,ZodType:Mt,datetimeRegex:Qf,ZodString:xn,ZodNumber:Oa,ZodBigInt:ja,ZodBoolean:Rl,ZodDate:Is,ZodSymbol:Fu,ZodUndefined:Dl,ZodNull:Ll,ZodAny:bo,ZodUnknown:Cs,ZodNever:ha,ZodVoid:Bu,ZodArray:vn,ZodObject:Si,ZodUnion:Fl,ZodDiscriminatedUnion:Ou,ZodIntersection:Bl,ZodTuple:Vn,ZodRecord:Ol,ZodMap:ju,ZodSet:ks,ZodFunction:To,ZodLazy:jl,ZodLiteral:Nl,ZodEnum:Na,ZodNativeEnum:Zl,ZodPromise:Po,ZodEffects:bn,ZodTransformer:bn,ZodOptional:Un,ZodNullable:Za,ZodDefault:Vl,ZodCatch:Ul,ZodNaN:Nu,BRAND:Jy,ZodBranded:Ad,ZodPipeline:$l,ZodReadonly:Gl,custom:im,Schema:Mt,ZodSchema:Mt,late:Qy,get ZodFirstPartyTypeKind(){return ut},coerce:{string:y=>xn.create({...y,coerce:!0}),number:y=>Oa.create({...y,coerce:!0}),boolean:y=>Rl.create({...y,coerce:!0}),bigint:y=>ja.create({...y,coerce:!0}),date:y=>Is.create({...y,coerce:!0})},any:ox,array:hx,bigint:ix,boolean:am,date:rx,discriminatedUnion:mx,effect:sm,enum:Px,function:bx,instanceof:ex,intersection:gx,lazy:wx,literal:Tx,map:xx,nan:tx,nativeEnum:Sx,never:cx,null:sx,nullable:Cx,number:nm,object:dx,oboolean:()=>am().optional(),onumber:()=>nm().optional(),optional:Ix,ostring:()=>rm().optional(),pipeline:Ex,preprocess:kx,promise:Mx,record:yx,set:vx,strictObject:px,string:rm,symbol:nx,transformer:sm,tuple:_x,undefined:ax,union:fx,unknown:lx,void:ux,NEVER:dt,ZodIssueCode:Oe,quotelessJson:Cy,ZodError:qr});const om=ct.object({lat:ct.number(),lng:ct.number()}),Ax=ct.object({sw:om,ne:om}),zx=ct.object({name:ct.literal("dark").or(ct.literal("light")),url:ct.string().optional(),colors:ct.object({primary:ct.string().max(64),background:ct.string().max(64),text:ct.string().max(64)})}),Rx=ct.object({container:ct.string(),position:ct.object({center:ct.object({lat:ct.number(),lng:ct.number()}),zoom:ct.number()}),style:zx,events:ct.object({onMapIdle:ct.function().returns(ct.void()).optional(),onMapMove:ct.function().args(ct.object({lat:ct.number(),lng:ct.number(),zoom:ct.number()})).returns(ct.void()).optional(),onMapClick:ct.function().returns(ct.void()).optional(),onPopupClick:ct.function().args(ct.string()).returns(ct.void()).optional(),onLoadingStart:ct.function().returns(ct.void()).optional(),onLoadingEnd:ct.function().returns(ct.void()).optional()}).optional()}),Dx=ct.object({id:ct.string(),rank:ct.number(),lat:ct.number(),lng:ct.number(),width:ct.number(),height:ct.number()}),lm=ct.array(Dx);ct.function().args(Ax).returns(ct.promise(lm));const Lx=ct.function().args(ct.string()).returns(ct.promise(ct.any()));var Fx=(y,m,b)=>m(tt(b).marker.id),Bx=go('<div class="popup svelte-jr9286"></div>'),Ox=go("<!> <!>",1),jx=go('<div class="marker"><!></div>'),Nx=go('<div class="container svelte-jr9286"><div class="map svelte-jr9286"></div> <div class="markers svelte-jr9286"></div></div>');function cm(y,m){var Cr,kr,Di,Hr,vi,si,ar;fu(m,!0);let b,C,A=0,D=Pi(!1);Nf(()=>{Rx.parse(m.options),S(),o()});function S(){const Ve=m.options.position;b=new Sd.Map({style:Ot(m.options.style),center:{lat:Ve.center.lat,lng:Ve.center.lng},zoom:Ve.zoom,minZoom:De(),maxZoom:$f,container:C,pitchWithRotate:!1,attributionControl:{compact:!1}})}function o(){b.on("load",le),b.on("move",ue),b.on("idle",_e),b.on("click",Re),b.dragRotate.disable(),b.keyboard.disable(),b.touchZoomRotate.disableRotation(),b.touchPitch.disable()}function le(){ai(D,!0)}function ue(){var Ve;if((Ve=m.options.events)!=null&&Ve.onMapMove){const Ye=b.getCenter(),Zt=b.getZoom();m.options.events.onMapMove({lat:Ye.lat,lng:Ye.lng,zoom:Zt})}}function _e(){var Ve,Ye;(Ye=(Ve=m.options.events)==null?void 0:Ve.onMapIdle)==null||Ye.call(null)}function Re(Ve){var Ye,Zt;(Zt=(Ye=m.options.events)==null?void 0:Ye.onMapClick)==null||Zt.call(null)}function xe(Ve){var Ye,Zt;(Zt=(Ye=m.options.events)==null?void 0:Ye.onPopupClick)==null||Zt.call(null,Ve)}function ie(){gt(De())}function De(){const Ye=Math.ceil(Math.log2(A/Uf));return Math.max(dy,Ye)}function gt(Ve){b==null||b.setMinZoom(Ve)}function $t(){const Ve=b==null?void 0:b.getCenter();return Ve?{lat:Ve.lat,lng:Ve.lng}:{lat:m.options.position.center.lat,lng:m.options.position.center.lng}}function _t(Ve){b==null||b.setCenter(Ve)}function Rt(){return(b==null?void 0:b.getZoom())??m.options.position.zoom}function Mi(Ve){b==null||b.setZoom(Ve)}function Jt(){const Ve=b==null?void 0:b.getBounds();if(Ve)return{sw:{lat:Ve.getSouthWest().lat,lng:Ve.getSouthWest().lng},ne:{lat:Ve.getNorthEast().lat,lng:Ve.getNorthEast().lng}}}function pi(){b==null||b.zoomIn()}function Bt(){b==null||b.zoomOut()}let vt=Pi(la(m.options.style));fo(()=>{tt(D)&&b.setStyle(Ot(tt(vt)),{diff:!0})});function Ot(Ve){if(Ve.url)return Ve.url;switch(Ve.name){case"light":return Iy;case"dark":return My}}function rr(){return g_(tt(vt))}function on(Ve){ai(vt,Ve,!0),b.setStyle(Ot(tt(vt)),{diff:!0})}class Mr{constructor(Ye){Ts(this,"marker");Ts(this,"libreMarker");wr(this,Cr,Pi());wr(this,kr,Pi(!1));wr(this,Di,Pi());wr(this,Hr,Pi());wr(this,vi,Pi(!1));wr(this,si,Pi());wr(this,ar,Pi());this.marker=Ye,this.libreMarker=void 0,this.element=void 0,this.rendered=!1,this.content=void 0,this.contentLoading=!1,this.component=void 0,this.circle=void 0}get element(){return tt(Ft(this,Cr))}set element(Ye){ai(Ft(this,Cr),Ye,!0)}get rendered(){return tt(Ft(this,kr))}set rendered(Ye){ai(Ft(this,kr),Ye,!0)}get popup(){return tt(Ft(this,Di))}set popup(Ye){ai(Ft(this,Di),Ye,!0)}get content(){return tt(Ft(this,Hr))}set content(Ye){ai(Ft(this,Hr),Ye,!0)}get contentLoading(){return tt(Ft(this,vi))}set contentLoading(Ye){ai(Ft(this,vi),Ye,!0)}get component(){return tt(Ft(this,si))}set component(Ye){ai(Ft(this,si),Ye,!0)}get circle(){return tt(Ft(this,ar))}set circle(Ye){ai(Ft(this,ar),Ye,!0)}getAngle(Ye){let Zt=this.marker.angs,Gt=Zt[0],bi=0;for(;Gt[0]<Ye&&(bi++,bi!=Zt.length);)Gt=Zt[bi];return Gt[1]}getDistance(Ye){return(this.marker.zet-Ye)/Gf}updateZIndex(){var Gt;const Ye=(Gt=this.libreMarker)==null?void 0:Gt.getElement();if(!Ye)throw new Error("Failed to update zIndex");const Zt=Math.round(($f-this.marker.zet)*py);Ye.style.zIndex=Zt.toString()}}Cr=new WeakMap,kr=new WeakMap,Di=new WeakMap,Hr=new WeakMap,vi=new WeakMap,si=new WeakMap,ar=new WeakMap;let yt,ui,At=la(new Array),nr=la(new Map),Tt=new Array,dr;Nf(()=>{const Ve=()=>{Or(),yt=window.setTimeout(Ve,25)};return Ve(),()=>{clearInterval(yt),clearInterval(ui)}});function Or(){if(tt(D)==!1||At.length==0||dr==null)return;const Ve=b.getZoom();if(!Ve)return;const Ye=new Array,Zt=Uf,Gt=new Wf(b,-512,window.innerHeight+Zt,window.innerWidth+Zt,-512),bi=new Wf(b,0,window.innerHeight,window.innerWidth,0);for(let Pt=0;Pt<At.length;Pt++){const st=At[Pt],It=st.marker,qt=st.libreMarker;if(qt){if(It.zet<=Ve&&Gt.contains(It.lat,It.lng)){qt._map!=b&&qt.addTo(b),Ye.push(st);continue}if(It.zet<=Ve+Gf&&bi.contains(It.lat,It.lng)){qt._map!=b&&qt.addTo(b),Ye.push(st);continue}qt._map!=null&&qt.remove()}}for(let Pt=0;Pt<Ye.length;Pt++){const st=Ye[Pt],It=st.marker;st.rendered||(st.rendered=!0);const qt=st.component,qi=st.circle;if(!qi||!qt)continue;It.zet<=Ve+fy?qt.setDisplayed(!0):qt.setDisplayed(!1),It.zet<=Ve?(qi.setCollapsed(!0),qt.setCollapsed(!1),qt.setAngle(st.getAngle(Ve))):(qt.setCollapsed(!0),qi==null||qi.setCollapsed(!1),qi==null||qi.setDistance(st.getDistance(Ve)));const fi=st.popup;if(!fi)continue;st.content==null&&st.contentLoading==!1&&(st.contentLoading=!0,dr(It.id).then(fr=>{st.content=fr,st.contentLoading=!1}));const sr=st.content;if(!sr)continue;fi.firstElementChild==null&&fi.appendChild(sr)}}async function Wr(Ve){var bi;const Ye=new Map(Ve.map(Pt=>[Pt.id,new Mr(Pt)])),Zt=new Array,Gt=Array.from(At);for(const Pt of Gt)Ye.has(Pt.marker.id)==!1&&((bi=Pt.libreMarker)==null||bi.remove(),nr.delete(Pt.marker.id),At.splice(At.indexOf(Pt),1));for(const Pt of Ve){const st=nr.get(Pt.id);if(st)st.marker=Pt,st.updateZIndex();else{const It=new Mr(Pt);nr.set(Pt.id,It),At.push(It),Zt.push(It)}}await O_();for(const Pt of Zt){const st=Pt.marker,It=Pt.element;if(!It)throw new Error("Failed to render marker element.");const qt=new Sd.Marker({element:It});qt.setLngLat([st.lng,st.lat]),Pt.libreMarker=qt,Pt.updateZIndex()}}function wn(){var Ve;for(let Ye=0;Ye<At.length;Ye++)(Ve=At[Ye].libreMarker)==null||Ve.remove();At.length=0,nr.clear()}function $n(Ve){if(!Lx.safeParse(Ve).success)throw new Error("Invalid popup content callback");dr=Ve}async function jr(Ve){var Zt,Gt,bi,Pt;if(dr==null)throw new Error("Popup content callback not set");if(!(await lm.safeParseAsync(Ve)).success)throw new Error("Invalid popups");try{(Gt=(Zt=m.options.events)==null?void 0:Zt.onLoadingStart)==null||Gt.call(null);for(const st of Ve){const It=Tt.findIndex(qt=>qt.id==st.id);It==-1?Tt.push(st):Tt[It]=st}await Wr(await vy(Tt))}finally{(Pt=(bi=m.options.events)==null?void 0:bi.onLoadingEnd)==null||Pt.call(null)}}function Ir(){wn()}var Ji=Nx();$_("resize",hd,ie);var Ei=Pl(Ji);Ba(Ei,Ve=>C=Ve,()=>C);var Tn=dd(Ei,2);return J_(Tn,21,()=>At,Ve=>Ve.marker.id,(Ve,Ye,Zt)=>{var Gt=jx(),bi=Pl(Gt);{var Pt=st=>{var It=Ox(),qt=T_(It);Ba(xy(qt,{}),(fi,sr)=>sr.circle=fi,fi=>fi==null?void 0:fi.circle,()=>[tt(Ye)]);var qi=dd(qt,2);Ba(_y(qi,{children:(fi,sr)=>{var pr=Bx();pr.__click=[Fx,xe,Ye],Ba(pr,(fr,Xr)=>Xr.popup=fr,fr=>fr==null?void 0:fr.popup,()=>[tt(Ye)]),vu(()=>Au(pr,`width: ${tt(Ye).marker.width??""}px; height: ${tt(Ye).marker.height??""}px;`)),_o(fi,pr)},$$slots:{default:!0}}),(fi,sr)=>sr.component=fi,fi=>fi==null?void 0:fi.component,()=>[tt(Ye)]),_o(st,It)};K_(bi,st=>{tt(Ye).rendered&&st(Pt)})}Ba(Gt,(st,It)=>It.element=st,st=>st==null?void 0:st.element,()=>[tt(Ye)]),_o(Ve,Gt)}),vu(()=>Au(Ji,`--primary: ${tt(vt).colors.primary??""}; --background: ${tt(vt).colors.background??""}; --text: ${tt(vt).colors.text??""};`)),_o(y,Ji),mu({getCenter:$t,setCenter:_t,getZoom:Rt,setZoom:Mi,getBounds:Jt,zoomIn:pi,zoomOut:Bt,getStyle:rr,setStyle:on,updatePopupsContentCallback:$n,updatePopups:jr,removePopups:Ir})}G_(["click"]);function Zx(y){const m=document.getElementById(y.container);if(!m)throw new Error(`Container not found: ${y.container}`);return W_(cm,{target:m,props:{options:y}})}function Vx(y){X_(y)}Vt.Map=cm,Vt.mountMap=Zx,Vt.unmountMap=Vx,Object.defineProperty(Vt,Symbol.toStringTag,{value:"Module"})});
729
+ ${O.shaderPreludeCode.vertexSource}`,define:O.shaderDefine},defaultProjectionData:q},W=k.renderingMode?k.renderingMode:"2d";if(f.renderPass==="offscreen"){const X=k.prerender;X&&(f.setCustomLayerDefaults(),E.setColorMode(f.colorModeForRenderPass()),X.call(k,E.gl,G),E.setDirty(),f.setBaseState())}else if(f.renderPass==="translucent"){f.setCustomLayerDefaults(),E.setColorMode(f.colorModeForRenderPass()),E.setStencilMode(Ct.disabled);const X=W==="3d"?f.getDepthModeFor3D():f.getDepthModeForSublayer(0,ft.ReadOnly);E.setDepthMode(X),k.render(E.gl,G),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){this.cache=this.cache||{};const l=!!this.style.map.terrain,h=this.style.projection,f=e+(i?i.cacheKey:"")+`/${s?Ha:h.shaderVariantName}`+(this._showOverdrawInspector?"/overdraw":"")+(l?"/terrain":"");return this.cache[f]||(this.cache[f]=new Ns(this.context,Kr[e],i,oc[e],this._showOverdrawInspector,l,s?Kr.projectionMercator:h.shaderPreludeCode,s?In:h.shaderDefine)),this.cache[f]}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 Ot(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 wc(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 Tc{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=wc(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,v=this._map.getBearing(),T=this._map.getPitch();let I="";if(I+=e?`/${f}/${_}/${s}`:`${s}/${_}/${f}`,(v||T)&&(I+="/"+Math.round(10*v)/10),T&&(I+=`/${Math.round(T)}`),this._hashName){const E=this._hashName;let k=!1;const O=window.location.hash.slice(1).split("&").map(Z=>{const q=Z.split("=")[0];return q===E?(k=!0,`${q}=${I}`):Z}).filter(Z=>Z);return k||O.push(`${E}=${I}`),`#${O.join("&")}`}return`#${I}`}_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 hs={linearity:.3,easing:o.c9(0,0,.3,1)},Ta=o.e({deceleration:2500,maxSpeed:1400},hs),Mh=o.e({deceleration:20,maxSpeed:1400},hs),Ih=o.e({deceleration:1e3,maxSpeed:360},hs),Ch=o.e({deceleration:1e3,maxSpeed:90},hs),kh=o.e({deceleration:1e3,maxSpeed:360},hs);class Eh{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:xe.now(),settings:e})}_drainInertiaBuffer(){const e=this._inertiaBuffer,i=xe.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=ps(i.pan.mag(),s,o.e({},Ta,e||{})),f=i.pan.mult(h.amount/i.pan.mag()),_=this._map.cameraHelper.handlePanInertia(f,this._map.transform);l.center=_.easingCenter,l.offset=_.easingOffset,ds(l,h)}if(i.zoom){const h=ps(i.zoom,s,Mh);l.zoom=this._map.transform.zoom+h.amount,ds(l,h)}if(i.bearing){const h=ps(i.bearing,s,Ih);l.bearing=this._map.transform.bearing+o.ae(h.amount,-179,179),ds(l,h)}if(i.pitch){const h=ps(i.pitch,s,Ch);l.pitch=this._map.transform.pitch+h.amount,ds(l,h)}if(i.roll){const h=ps(i.roll,s,kh);l.roll=this._map.transform.roll+o.ae(h.amount,-179,179),ds(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 ds(u,e){(!u.duration||u.duration<e.duration)&&(u.duration=e.duration,u.easing=e.easing)}function ps(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 er 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=ie.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 fs 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=ie.touchPos(i.getCanvasContainer(),l),f=h.map(v=>i.unproject(v)),_=h.reduce((v,T,I,E)=>v.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 Ur extends o.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,i,s){super(e,{originalEvent:s}),this._defaultPrevented=!1}}class dn{constructor(e,i){this._map=e,this._clickTolerance=i.clickTolerance}reset(){delete this._mousedownPos}wheel(e){return this._firePreventable(new Ur(e.type,this._map,e))}mousedown(e,i){return this._mousedownPos=i,this._firePreventable(new er(e.type,this._map,e))}mouseup(e){this._map.fire(new er(e.type,this._map,e))}click(e,i){this._mousedownPos&&this._mousedownPos.dist(i)>=this._clickTolerance||this._map.fire(new er(e.type,this._map,e))}dblclick(e){return this._firePreventable(new er(e.type,this._map,e))}mouseover(e){this._map.fire(new er(e.type,this._map,e))}mouseout(e){this._map.fire(new er(e.type,this._map,e))}touchstart(e){return this._firePreventable(new fs(e.type,this._map,e))}touchmove(e){this._map.fire(new fs(e.type,this._map,e))}touchend(e){this._map.fire(new fs(e.type,this._map,e))}touchcancel(e){this._map.fire(new fs(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Ah{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(e){this._map.fire(new er(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new er("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._ignoreContextMenu||this._map.fire(new er(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class yr{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 Pa{constructor(e,i){this._map=e,this._tr=new yr(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&&(ie.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=ie.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),v=Math.max(l.y,s.y);ie.setTransform(this._box,`translate(${h}px,${_}px)`),this._box.style.width=f-h+"px",this._box.style.height=v-_+"px"}mouseupWindow(e,i){if(!this._active||e.button!==0)return;const s=this._startPos,l=i;if(this.reset(),ie.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&&(ie.remove(this._box),this._box=null),ie.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(e,i){return this._map.fire(new o.l(e,{originalEvent:i}))}}function Pc(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 Kd{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=Pc(s,i)))}touchmove(e,i,s){if(this.aborted||!this.centroid)return;const l=Pc(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 Sc{constructor(e){this.singleTap=new Kd(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 Yd{constructor(e){this._tr=new yr(e),this._zoomIn=new Sc({numTouches:1,numTaps:2}),this._zoomOut=new Sc({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 ms{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&&ie.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 Xs={0:1,2:2};class Er{constructor(e){this._correctEvent=e.checkCorrectEvent}startMove(e){const i=ie.mouseButton(e);this._eventButton=i}endMove(e){delete this._eventButton}isValidStartEvent(e){return this._correctEvent(e)}isValidMoveEvent(e){return!function(i,s){const l=Xs[s];return i.buttons===void 0||(i.buttons&l)!==l}(e,this._eventButton)}isValidEndEvent(e){return ie.mouseButton(e)===this._eventButton}}class $e{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 zh{constructor(e=new Er({checkCorrectEvent:()=>!0}),i=new $e){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 gs=u=>{u.mousedown=u.dragStart,u.mousemoveWindow=u.dragMove,u.mouseup=u.dragEnd,u.contextmenu=e=>{e.preventDefault()}};class Rh{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=Pc(s,i),h=new o.P(0,0),f=new o.P(0,0);let _=0;for(const T in l){const I=l[T],E=this._touches[T];E&&(h._add(I),f._add(I.sub(E)),_++,l[T]=I)}if(this._touches=l,this._shouldBePrevented(_)||!f.mag())return;const v=f.div(_);return this._sum._add(v),this._sum.mag()<this._clickTolerance?void 0:{around:h.div(_),panDelta:v}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Sa{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=Kn(s,i,l),_=Kn(s,i,h);if(!f||!_)return;const v=this._aroundCenter?null:f.add(_).div(2);return this._move([f,_],v,e)}touchend(e,i,s){if(!this._firstTwoTouches)return;const[l,h]=this._firstTwoTouches,f=Kn(s,i,l),_=Kn(s,i,h);f&&_||(this._active&&ie.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 Kn(u,e,i){for(let s=0;s<u.length;s++)if(u[s].identifier===i)return e[s]}function Mc(u,e){return Math.log(u/e)/Math.LN2}class wt extends Sa{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(Mc(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:Mc(this._distance,s),pinchAround:i}}}function tl(u,e){return 180*u.angleWith(e)/Math.PI}class Dh extends Sa{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:tl(this._vector,l),pinchAround:i}}_isBelowThreshold(e){this._minDiameter=Math.min(this._minDiameter,e.mag());const i=25/(Math.PI*this._minDiameter)*360,s=tl(e,this._startVector);return Math.abs(s)<i}}function Ks(u){return Math.abs(u.y)>Math.abs(u.x)}class Lh extends Sa{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,Ks(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 Ks(e)&&Ks(i)&&f}}const Jd={panStep:100,bearingStep:15,pitchStep:10};class Ic{constructor(e){this._tr=new yr(e);const i=Jd;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 v=this._tr;_.easeTo({duration:300,easeId:"keyboardHandler",easing:Cc,zoom:i?Math.round(v.zoom)+i*(e.shiftKey?2:1):v.zoom,bearing:v.bearing+s*this._bearingStep,pitch:v.pitch+l*this._pitchStep,offset:[-h*this._panStep,-f*this._panStep],center:v.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 Cc(u){return u*(2-u)}const kc=4.000244140625;class Fh{constructor(e,i){this._onTimeout=s=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(s)},this._map=e,this._tr=new yr(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=xe.now(),l=s-(this._lastWheelEventTime||0);this._lastWheelEventTime=s,i!==0&&i%kc==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=ie.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)>kc?this._wheelZoomRate:this._defaultZoomRate;let v=2/(1+Math.exp(-Math.abs(this._delta*_)));this._delta<0&&v!==0&&(v=1/v);const T=typeof this._targetZoom!="number"?e.scale:o.aI(this._targetZoom);this._targetZoom=Math.min(e.maxZoom,Math.max(e.minZoom,o.ab(T*v))),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 _=xe.now()-this._lastWheelEventTime,v=Math.min((_+5)/200,1),T=l(v);h=o.B.number(s,i,T),v<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.cb;if(this._prevEase){const s=this._prevEase,l=(xe.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.c9(f,_,.25,1)}return this._prevEase={start:xe.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 Ec{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 Qd{constructor(e){this._tr=new yr(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 ep{constructor(){this._tap=new Sc({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 En{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 ti{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 Ys{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 il{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=ie.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&&(ie.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 Js=u=>u.zoom||u.drag||u.roll||u.pitch||u.rotate;class Bh extends o.l{}function rl(u){return u.panDelta&&u.panDelta.mag()||u.zoomDelta||u.bearingDelta||u.pitchDelta||u.rollDelta}class tp{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},v={},T={};for(const{handlerName:k,handler:O,allowed:Z}of this._handlers){if(!O.isEnabled())continue;let q;if(this._blockedByActive(T,Z,k))O.reset();else if(O[h||l.type]){if(o.cc(l,h||l.type)){const G=ie.mousePos(this._map.getCanvas(),l);q=O[h||l.type](l,G)}else if(o.cd(l,h||l.type)){const G=this._getMapTouches(l.touches),W=ie.touchPos(this._map.getCanvas(),G);q=O[h||l.type](l,W,G)}else o.ce(h||l.type)||(q=O[h||l.type](l));this.mergeHandlerResult(_,v,q,k,f),q&&q.needsRenderFrame&&this._triggerRenderFrame()}(q||O.isActive())&&(T[k]=O)}const I={};for(const k in this._previousActiveHandlers)T[k]||(I[k]=f);this._previousActiveHandlers=T,(Object.keys(I).length||rl(_))&&(this._changes.push([_,v,I]),this._triggerRenderFrame()),(Object.keys(T).length||rl(_))&&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 Eh(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)ie.addEventListener(l,h,l===document?this.handleWindowEvent:this.handleEvent,f)}destroy(){for(const[e,i,s]of this._listeners)ie.removeEventListener(e,i,e===document?this.handleWindowEvent:this.handleEvent,s)}_addDefaultHandlers(e){const i=this._map,s=i.getCanvasContainer();this._add("mapEvent",new dn(i,e));const l=i.boxZoom=new Pa(i,e);this._add("boxZoom",l),e.interactive&&e.boxZoom&&l.enable();const h=i.cooperativeGestures=new il(i,e.cooperativeGestures);this._add("cooperativeGestures",h),e.cooperativeGestures&&h.enable();const f=new Yd(i),_=new Qd(i);i.doubleClickZoom=new Ec(_,f),this._add("tapZoom",f),this._add("clickZoom",_),e.interactive&&e.doubleClickZoom&&i.doubleClickZoom.enable();const v=new ep;this._add("tapDragZoom",v);const T=i.touchPitch=new Lh(i);this._add("touchPitch",T),e.interactive&&e.touchPitch&&i.touchPitch.enable(e.touchPitch);const I=()=>i.project(i.getCenter()),E=function({enable:ee,clickTolerance:te,aroundCenter:oe=!0,minPixelCenterThreshold:re=100,rotateDegreesPerPixelMoved:me=.8},fe){const Se=new Er({checkCorrectEvent:Ie=>ie.mouseButton(Ie)===0&&Ie.ctrlKey||ie.mouseButton(Ie)===2&&!Ie.ctrlKey});return new ms({clickTolerance:te,move:(Ie,Te)=>{const je=fe();if(oe&&Math.abs(je.y-Ie.y)>re)return{bearingDelta:o.ca(new o.P(Ie.x,Te.y),Te,je)};let Be=(Te.x-Ie.x)*me;return oe&&Te.y<je.y&&(Be=-Be),{bearingDelta:Be}},moveStateManager:Se,enable:ee,assignEvents:gs})}(e,I),k=function({enable:ee,clickTolerance:te,pitchDegreesPerPixelMoved:oe=-.5}){const re=new Er({checkCorrectEvent:me=>ie.mouseButton(me)===0&&me.ctrlKey||ie.mouseButton(me)===2});return new ms({clickTolerance:te,move:(me,fe)=>({pitchDelta:(fe.y-me.y)*oe}),moveStateManager:re,enable:ee,assignEvents:gs})}(e),O=function({enable:ee,clickTolerance:te,rollDegreesPerPixelMoved:oe=.3},re){const me=new Er({checkCorrectEvent:fe=>ie.mouseButton(fe)===2&&fe.ctrlKey});return new ms({clickTolerance:te,move:(fe,Se)=>{const Ie=re();let Te=(Se.x-fe.x)*oe;return Se.y<Ie.y&&(Te=-Te),{rollDelta:Te}},moveStateManager:me,enable:ee,assignEvents:gs})}(e,I);i.dragRotate=new ti(e,E,k,O),this._add("mouseRotate",E,["mousePitch"]),this._add("mousePitch",k,["mouseRotate","mouseRoll"]),this._add("mouseRoll",O,["mousePitch"]),e.interactive&&e.dragRotate&&i.dragRotate.enable();const Z=function({enable:ee,clickTolerance:te}){const oe=new Er({checkCorrectEvent:re=>ie.mouseButton(re)===0&&!re.ctrlKey});return new ms({clickTolerance:te,move:(re,me)=>({around:me,panDelta:me.sub(re)}),activateOnStart:!0,moveStateManager:oe,enable:ee,assignEvents:gs})}(e),q=new Rh(e,i);i.dragPan=new En(s,Z,q),this._add("mousePan",Z),this._add("touchPan",q,["touchZoom","touchRotate"]),e.interactive&&e.dragPan&&i.dragPan.enable(e.dragPan);const G=new Dh,W=new wt;i.touchZoomRotate=new Ys(s,W,G,v),this._add("touchRotate",G,["touchPan","touchZoom"]),this._add("touchZoom",W,["touchPan","touchRotate"]),e.interactive&&e.touchZoomRotate&&i.touchZoomRotate.enable(e.touchZoomRotate);const X=i.scrollZoom=new Fh(i,()=>this._triggerRenderFrame());this._add("scrollZoom",X,["mousePan"]),e.interactive&&e.scrollZoom&&i.scrollZoom.enable(e.scrollZoom);const Q=i.keyboard=new Ic(i);this._add("keyboard",Q),e.interactive&&e.keyboard&&i.keyboard.enable(),this._add("blockableMapEvent",new Ah(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!!Js(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(!(rl(e)||f&&this._terrainMovement))return this._fireEvents(i,s,!0);l._stop(!0);let{panDelta:_,zoomDelta:v,bearingDelta:T,pitchDelta:I,rollDelta:E,around:k,pinchAround:O}=e;O!==void 0&&(k=O),k=k||l.transform.centerPoint,f&&!h.isPointOnMapSurface(k)&&(k=h.centerPoint);const Z={panDelta:_,zoomDelta:v,rollDelta:E,pitchDelta:I,bearingDelta:T,around:k};this._map.cameraHelper.useGlobeControls&&!h.isPointOnMapSurface(k)&&(k=h.centerPoint);const q=k.distSqr(h.centerPoint)<.01?h.center:h.screenPointToLocation(_?k.sub(_):k);f?(this._map.cameraHelper.handleMapControlsRollPitchBearingZoom(Z,h),this._terrainMovement||!i.drag&&!i.zoom?i.drag&&this._terrainMovement?h.setCenter(h.screenPointToLocation(h.centerPoint.sub(_))):this._map.cameraHelper.handleMapControlsPan(Z,h,q):(this._terrainMovement=!0,this._map._elevationFreeze=!0,this._map.cameraHelper.handleMapControlsPan(Z,h,q))):(this._map.cameraHelper.handleMapControlsRollPitchBearingZoom(Z,h),this._map.cameraHelper.handleMapControlsPan(Z,h,q)),l._applyUpdatedTransform(h),this._map._update(),e.noInertia||this._inertia.record(e),this._fireEvents(i,s,!0)}_fireEvents(e,i,s){const l=Js(this._eventsInProgress),h=Js(e),f={};for(const E in e){const{originalEvent:k}=e[E];this._eventsInProgress[E]||(f[`${E}start`]=k),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:k}=e[E];this._fireEvent(E,k)}const _={};let v;for(const E in this._eventsInProgress){const{handlerName:k,originalEvent:O}=this._eventsInProgress[E];this._handlersById[k].isActive()||(delete this._eventsInProgress[E],v=i[k]||O,_[`${E}end`]=v)}for(const E in _)this._fireEvent(E,_[E]);const T=Js(this._eventsInProgress),I=(l||h)&&!T;if(I&&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&&I){this._updatingCamera=!0;const E=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),k=O=>O!==0&&-this._bearingSnap<O&&O<this._bearingSnap;!E||!E.essential&&xe.prefersReducedMotion?(this._map.fire(new o.l("moveend",{originalEvent:v})),k(this._map.getBearing())&&this._map.resetNorth()):(k(E.bearing||this._map.getBearing())&&(E.bearing=0),E.freezeElevation=!0,this._map.easeTo(E,{originalEvent:v})),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 Bh("renderFrame",{timeStamp:e})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class pn extends o.E{constructor(e,i,s){super(),this._renderFrameCallback=()=>{const l=Math.min((xe.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=Ve.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,v=new Ve(e,i);return this.cameraHelper.cameraForBoxAndBearing(l,f,v,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 v=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)),v&&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,v=f.y-h.y,T=f.z-h.z,I=Math.hypot(_,v,T);if(I===0)throw new Error("Can't calculate camera options with same From and To");const E=Math.hypot(_,v),k=o.ab(this.transform.cameraToCenterDistance/I/this.transform.tileSize),O=180*Math.atan2(_,-v)/Math.PI;let Z=180*Math.acos(E/I)/Math.PI;return Z=T<0?90-Z:90+Z,{center:f.toLngLat(),elevation:l,zoom:k,pitch:Z,bearing:O}}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.cb},e)).animate===!1||!e.essential&&xe.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,v="pitch"in e?+e.pitch:h,T="roll"in e?this._normalizeBearing(e.roll,f):f,I="padding"in e?e.padding:s.padding,E=o.P.convert(e.offset);let k,O;e.around&&(k=o.Q.convert(e.around),O=s.locationToScreenPoint(k));const Z={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching,rolling:this._rolling},q=this.cameraHelper.handleEaseTo(s,{bearing:_,pitch:v,roll:T,padding:I,around:k,aroundPoint:O,offsetAsPoint:E,offset:e.offset,zoom:e.zoom,center:e.center});return this._rotating=this._rotating||l!==_,this._pitching=this._pitching||v!==h,this._rolling=this._rolling||T!==f,this._padding=!s.isPaddingEqual(I),this._zooming=this._zooming||q.isZooming,this._easeId=e.easeId,this._prepareEase(i,e.noMoveStart,Z),this.terrain&&this._prepareElevation(q.elevationCenter),this._ease(G=>{q.easeFunc(G),this.terrain&&!e.freezeElevation&&this._updateElevation(G),this._applyUpdatedTransform(s),this._fireMoveEvents(i)},G=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(i,G)},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:v,pitch:T,bearing:I,elevation:E}=l(h);f&&h.setCenter(f),E!==void 0&&h.setElevation(E),_!==void 0&&h.setZoom(_),v!==void 0&&h.setRoll(v),T!==void 0&&h.setPitch(T),I!==void 0&&h.setBearing(I),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&&xe.prefersReducedMotion){const Te=o.O(e,["center","zoom","bearing","pitch","roll","elevation"]);return this.jumpTo(Te,i)}this.stop(),e=o.e({offset:[0,0],speed:1.2,curve:1.42,easing:o.cb},e);const s=this._getTransformForUpdate(),l=s.bearing,h=s.pitch,f=s.roll,_=s.padding,v="bearing"in e?this._normalizeBearing(e.bearing,l):l,T="pitch"in e?+e.pitch:h,I="roll"in e?this._normalizeBearing(e.roll,f):f,E="padding"in e?e.padding:s.padding,k=o.P.convert(e.offset);let O=s.centerPoint.add(k);const Z=s.screenPointToLocation(O),q=this.cameraHelper.handleFlyTo(s,{bearing:v,pitch:T,roll:I,padding:E,locationAtOffset:Z,offsetAsPoint:k,center:e.center,minZoom:e.minZoom,zoom:e.zoom});let G=e.curve;const W=Math.max(s.width,s.height),X=W/q.scaleOfZoom,Q=q.pixelPathLength;typeof q.scaleOfMinZoom=="number"&&(G=Math.sqrt(W/q.scaleOfMinZoom/Q*2));const ee=G*G;function te(Te){const je=(X*X-W*W+(Te?-1:1)*ee*ee*Q*Q)/(2*(Te?X:W)*ee*Q);return Math.log(Math.sqrt(je*je+1)-je)}function oe(Te){return(Math.exp(Te)-Math.exp(-Te))/2}function re(Te){return(Math.exp(Te)+Math.exp(-Te))/2}const me=te(!1);let fe=function(Te){return re(me)/re(me+G*Te)},Se=function(Te){return W*((re(me)*(oe(je=me+G*Te)/re(je))-oe(me))/ee)/Q;var je},Ie=(te(!0)-me)/G;if(Math.abs(Q)<2e-6||!isFinite(Ie)){if(Math.abs(W-X)<1e-6)return this.easeTo(e,i);const Te=X<W?-1:1;Ie=Math.abs(Math.log(X/W))/G,Se=()=>0,fe=je=>Math.exp(Te*G*je)}return e.duration="duration"in e?+e.duration:1e3*Ie/("screenSpeed"in e?+e.screenSpeed/G:+e.speed),e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=l!==v,this._pitching=T!==h,this._rolling=I!==f,this._padding=!s.isPaddingEqual(E),this._prepareEase(i,!1),this.terrain&&this._prepareElevation(q.targetCenter),this._ease(Te=>{const je=Te*Ie,Be=1/fe(je),Ce=Se(je);this._rotating&&s.setBearing(o.B.number(l,v,Te)),this._pitching&&s.setPitch(o.B.number(h,T,Te)),this._rolling&&s.setRoll(o.B.number(f,I,Te)),this._padding&&(s.interpolatePadding(_,E,Te),O=s.centerPoint.add(k)),q.easeFunc(Te,Be,Ce,O),this.terrain&&!e.freezeElevation&&this._updateElevation(Te),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=xe.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 Qs={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class Je{constructor(e=Qs){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=ie.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=ie.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=ie.create("div","maplibregl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("terrain",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container}onRemove(){ie.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(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=ie.sanitize(s),this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class nt{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=ie.create("div","maplibregl-ctrl");const i=ie.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(){ie.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class nl{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 Ac=o.aD([{name:"a_pos3d",type:"Int16",components:3}]);class zc extends o.E{constructor(e){super(),this._lastTilesetChange=xe.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 he(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.bO(l.terrainRttPosMatrix32f,0,o.Z,o.Z,0,0,1),this._tiles[l.key]=new ln(l,this.tileSize),this._lastTilesetChange=xe.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.bO(f,0,o.Z,o.Z,0,0,1);else if(l.canonical.isChildOf(e.canonical)){const _=l.canonical.z-e.canonical.z,v=l.canonical.x-(l.canonical.x>>_<<_),T=l.canonical.y-(l.canonical.y>>_<<_),I=o.Z>>_;o.bO(f,0,I,I,0,0,1),o.L(f,f,[-v*I,-T*I,0])}else{if(!e.canonical.isChildOf(l.canonical))continue;{const _=e.canonical.z-l.canonical.z,v=e.canonical.x-(e.canonical.x>>_<<_),T=e.canonical.y-(e.canonical.y>>_<<_),I=o.Z>>_;o.bO(f,0,o.Z,o.Z,0,0,1),o.L(f,f,[v*I,T*I,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 v=e.canonical.x-h.canonical.x,T=e.canonical.y-h.canonical.y;o.bO(_,0,o.Z,o.Z,0,0,1),o.L(_,_,[v*o.Z,T*o.Z,0])}else if(h.canonical.z>e.canonical.z){const v=h.canonical.z-e.canonical.z,T=h.canonical.x-(h.canonical.x>>v<<v),I=h.canonical.y-(h.canonical.y>>v<<v),E=e.canonical.x-(h.canonical.x>>v),k=e.canonical.y-(h.canonical.y>>v),O=o.Z>>v;o.bO(_,0,O,O,0,0,1),o.L(_,_,[-T*O+E*o.Z,-I*O+k*o.Z,0])}else{const v=e.canonical.z-h.canonical.z,T=e.canonical.x-(e.canonical.x>>v<<v),I=e.canonical.y-(e.canonical.y>>v<<v),E=(e.canonical.x>>v)-h.canonical.x,k=(e.canonical.y>>v)-h.canonical.y,O=o.Z<<v;o.bO(_,0,O,O,0,0,1),o.L(_,_,[T*o.Z+E*O,I*o.Z+k*O,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 xr{constructor(e,i,s){this._meshCache={},this.painter=e,this.sourceCache=new zc(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 v=o.cf([],[i/l*o.Z,s/l*o.Z],f.u_terrain_matrix),T=[v[0]*_.dim,v[1]*_.dim],I=Math.floor(T[0]),E=Math.floor(T[1]),k=T[0]-I,O=T[1]-E;return _.get(I,E)*(1-k)*(1-O)+_.get(I+1,E)*k*(1-O)+_.get(I,E+1)*(1-k)*O+_.get(I+1,E+1)*k*O}getElevationForLngLatZoom(e,i){if(!o.cg(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 Ot(l,h,l.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new Ot(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.at([])}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 Ot(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),v=o.ch(new Float64Array(16),[1/(o.Z<<h),1/(o.Z<<h),0]);o.L(v,v,[f*o.Z,_*o.Z,0]),this._demMatrixCache[e.key]={matrix:v,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 Ot(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 Ot(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 Ot(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 v=i[0]+(i[2]>>4<<8),T=i[1]+((15&i[2])<<8),I=this.coordsIndex[255-i[3]],E=I&&this.sourceCache.getTileByID(I);if(!E)return null;const k=this._coordsTextureSize,O=(1<<E.tileID.canonical.z)*k;return new o.$((E.tileID.canonical.x*k+v)/O+E.tileID.wrap,(E.tileID.canonical.y*k+T)/O,this.getElevation(E.tileID,v,T,k))}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,v=new o.ci,T=new o.aH,I=this.meshSize,E=o.Z/I,k=I*I;for(let re=0;re<=I;re++)for(let me=0;me<=I;me++)v.emplaceBack(me*E,re*E,0);for(let re=0;re<k;re+=I+1)for(let me=0;me<I;me++)T.emplaceBack(me+re,I+me+re+1,I+me+re+2),T.emplaceBack(me+re,I+me+re+2,me+re+1);const O=v.length,Z=O+(I+1),q=(I+1)*I,G=l?o.b9:0,W=l?0:1,X=h?o.ba:o.Z,Q=h?0:1;for(let re=0;re<=I;re++)v.emplaceBack(re*E,G,W);for(let re=0;re<=I;re++)v.emplaceBack(re*E,X,Q);for(let re=0;re<I;re++)T.emplaceBack(q+re,Z+re,Z+re+1),T.emplaceBack(q+re,Z+re+1,q+re+1),T.emplaceBack(0+re,O+re+1,O+re),T.emplaceBack(0+re,0+re+1,O+re+1);const ee=v.length,te=ee+2*(I+1);for(const re of[0,1])for(let me=0;me<=I;me++)for(const fe of[0,1])v.emplaceBack(re*o.Z,me*E,fe);for(let re=0;re<2*I;re+=2)T.emplaceBack(ee+re,ee+re+1,ee+re+3),T.emplaceBack(ee+re,ee+re+3,ee+re+2),T.emplaceBack(te+re,te+re+3,te+re+1),T.emplaceBack(te+re,te+re+2,te+re+3);const oe=new ma(_.createVertexBuffer(v,Ac.members),_.createIndexBuffer(T),o.aG.simpleSegment(0,0,v.length,T.length));return this._meshCache[f]=oe,oe}getMeshFrameDelta(e){return 2*Math.PI*o.br/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),v=Math.floor(f/o.Z);return{tileID:new o.Y(i,0,i,_,v),mercatorX:h,mercatorY:f}}}class Oh{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 Ot(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 cr={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class ip{constructor(e,i){this.painter=e,this.terrain=i,this.pool=new Oh(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 st?h.terrainTileRanges:null;for(const _ of l){const v=this.terrain.sourceCache.getTerrainCoords(_,f);for(const T in v)this._coordsAscending[s][T]||(this._coordsAscending[s][T]=[]),this._coordsAscending[s][T].push(v[T])}}this._coordsAscendingStr={};for(const s of e._order){const l=e._layers[s],h=l.source;if(cr[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(cr[l]&&(this._prevType&&cr[this._prevType]||this._stacks.push([]),this._prevType=l,this._stacks[this._stacks.length-1].push(e.id),!f))return!0;if(cr[this._prevType]||cr[l]&&f){this._prevType=l;const _=this._stacks.length-1,v=this._stacks[_]||[];for(const T of this._renderableTiles){if(this.pool.isFull()&&(el(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 I=this.pool.getOrCreateFreeObject();this.pool.useObject(I),this.pool.stampObject(I),T.rtt[_]={id:I.id,stamp:I.stamp},h.context.bindFramebuffer.set(I.fbo.framebuffer),h.context.clear({color:o.b7.transparent,stencil:0}),h.currentStencilSource=void 0;for(let E=0;E<v.length;E++){const k=h.style._layers[v[E]],O=k.source?this._coordsAscending[k.source][T.tileID.key]:[T.tileID];h.context.viewport.set([0,0,I.fbo.width,I.fbo.height]),h._renderTileClippingMasks(k,O,!0),h.renderLayer(h,h.style.sourceCaches[k.source],k,O,s),k.source&&(T.rttCoords[k.source]=this._coordsAscendingStr[k.source][T.tileID.key])}}return el(this.painter,this.terrain,this._rttTiles,s),this._rttTiles=[],this.pool.freeAllObjects(),cr[l]}return!1}}const eo={"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"},gi=le,Ti={hash:!1,interactive:!0,bearingSnap:7,attributionControl:Qs,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},jh={showCompass:!0,showZoom:!0,visualizePitch:!1,visualizeRoll:!0};class to{constructor(e,i,s=!1){this.mousedown=h=>{this.startMove(h,ie.mousePos(this.element,h)),ie.addEventListener(window,"mousemove",this.mousemove),ie.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=h=>{this.move(h,ie.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=ie.touchPos(this.element,h.targetTouches)[0],this.startMove(h,this._startPos),ie.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),ie.addEventListener(window,"touchend",this.touchend))},this.touchmove=h=>{h.targetTouches.length!==1?this.reset():(this._lastPos=ie.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 zh;this._rotatePitchHanlder=new ms({clickTolerance:3,move:(h,f)=>{const _=i.getBoundingClientRect(),v=new o.P((_.bottom-_.top)/2,(_.right-_.left)/2);return{bearingDelta:o.ca(new o.P(h.x,f.y),f,v),pitchDelta:s?-.5*(f.y-h.y):void 0}},moveStateManager:l,enable:!0,assignEvents:()=>{}}),this.map=e,ie.addEventListener(i,"mousedown",this.mousedown),ie.addEventListener(i,"touchstart",this.touchstart,{passive:!1}),ie.addEventListener(i,"touchcancel",this.reset)}startMove(e,i){this._rotatePitchHanlder.dragStart(e,i),ie.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;ie.removeEventListener(e,"mousedown",this.mousedown),ie.removeEventListener(e,"touchstart",this.touchstart,{passive:!1}),ie.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),ie.removeEventListener(window,"touchend",this.touchend),ie.removeEventListener(e,"touchcancel",this.reset),this.offTemp()}offTemp(){ie.enableDrag(),ie.removeEventListener(window,"mousemove",this.mousemove),ie.removeEventListener(window,"mouseup",this.mouseup),ie.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),ie.removeEventListener(window,"touchend",this.touchend)}}let fn;function al(u,e,i){const s=new o.Q(u.lng,u.lat);if(u=new o.Q(u.lng,u.lat),e){const l=new o.Q(u.lng-360,u.lat),h=new o.Q(u.lng+360,u.lat),f=i.locationToScreenPoint(u).distSqr(e);i.locationToScreenPoint(l).distSqr(e)<f?u=l:i.locationToScreenPoint(h).distSqr(e)<f&&(u=h)}for(;Math.abs(u.lng-i.center.lng)>180;){const l=i.locationToScreenPoint(u);if(l.x>=0&&l.y>=0&&l.x<=i.width&&l.y<=i.height)break;u.lng>i.center.lng?u.lng-=360:u.lng+=360}return u.lng!==s.lng&&i.isPointOnMapSurface(i.locationToScreenPoint(u))?u:s}const io={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 sl(u,e,i){const s=u.classList;for(const l in io)s.remove(`maplibregl-${i}-anchor-${l}`);s.add(`maplibregl-${i}-anchor-${e}`)}class Ma 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=>{var s;if(!this._map)return;const l=this._map.loaded()&&!this._map.isMoving();((i==null?void 0:i.type)==="terrain"||(i==null?void 0:i.type)==="render"&&!l)&&this._map.once("render",this._update),this._lngLat=this._map.transform.renderWorldCopies?al(this._lngLat,this._flatPos,this._map.transform):(s=this._lngLat)===null||s===void 0?void 0:s.wrap(),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 h="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?h=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(h=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let f="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?f="rotateX(0deg)":this._pitchAlignment==="map"&&(f=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||i&&i.type!=="moveend"||(this._pos=this._pos.round()),ie.setTransform(this._element,`${io[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${f} ${h}`),xe.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=ie.create("div");const i=ie.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=ie.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=ie.createNS("http://www.w3.org/2000/svg","g");f.setAttributeNS(null,"fill-rule","nonzero");const _=ie.createNS("http://www.w3.org/2000/svg","g");_.setAttributeNS(null,"transform","translate(3.0, 29.0)"),_.setAttributeNS(null,"fill","#000000");const v=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(const W of v){const X=ie.createNS("http://www.w3.org/2000/svg","ellipse");X.setAttributeNS(null,"opacity","0.04"),X.setAttributeNS(null,"cx","10.5"),X.setAttributeNS(null,"cy","5.80029008"),X.setAttributeNS(null,"rx",W.rx),X.setAttributeNS(null,"ry",W.ry),_.appendChild(X)}const T=ie.createNS("http://www.w3.org/2000/svg","g");T.setAttributeNS(null,"fill",this._color);const I=ie.createNS("http://www.w3.org/2000/svg","path");I.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),T.appendChild(I);const E=ie.createNS("http://www.w3.org/2000/svg","g");E.setAttributeNS(null,"opacity","0.25"),E.setAttributeNS(null,"fill","#000000");const k=ie.createNS("http://www.w3.org/2000/svg","path");k.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(k);const O=ie.createNS("http://www.w3.org/2000/svg","g");O.setAttributeNS(null,"transform","translate(6.0, 7.0)"),O.setAttributeNS(null,"fill","#FFFFFF");const Z=ie.createNS("http://www.w3.org/2000/svg","g");Z.setAttributeNS(null,"transform","translate(8.0, 8.0)");const q=ie.createNS("http://www.w3.org/2000/svg","circle");q.setAttributeNS(null,"fill","#000000"),q.setAttributeNS(null,"opacity","0.25"),q.setAttributeNS(null,"cx","5.5"),q.setAttributeNS(null,"cy","5.5"),q.setAttributeNS(null,"r","5.4999962");const G=ie.createNS("http://www.w3.org/2000/svg","circle");G.setAttributeNS(null,"fill","#FFFFFF"),G.setAttributeNS(null,"cx","5.5"),G.setAttributeNS(null,"cy","5.5"),G.setAttributeNS(null,"r","5.4999962"),Z.appendChild(q),Z.appendChild(G),f.appendChild(_),f.appendChild(T),f.appendChild(E),f.appendChild(O),f.appendChild(Z),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()}),sl(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),ie.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;if(!(!((i=this._map)===null||i===void 0)&&i.terrain)){const E=this._map.transform.isLocationOccluded(this._lngLat)?this._opacityWhenCovered:this._opacity;return void(this._element.style.opacity!==E&&(this._element.style.opacity=E))}if(e)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}const l=this._map,h=l.terrain.depthAtPoint(this._pos),f=l.terrain.getElevationForLngLatZoom(this._lngLat,l.transform.tileZoom);if(l.transform.lngLatToCameraDepth(this._lngLat,f)-h<.006)return void(this._element.style.opacity=this._opacity);const _=-this._offset.y/l.transform.pixelsPerMeter,v=Math.sin(l.getPitch()*Math.PI/180)*_,T=l.terrain.depthAtPoint(new o.P(this._pos.x,this._pos.y-this._offset.y)),I=l.transform.lngLatToCameraDepth(this._lngLat,f+v)-T>.006;!((s=this._popup)===null||s===void 0)&&s.isOpen()&&I&&this._popup.remove(),this._element.style.opacity=I?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 Rc={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let _s=0,Ia=!1;const Dc={maxWidth:100,unit:"metric"};function ol(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]),v=Math.round(u.project(_).x-u.project(f).x),T=Math.min(s,v,u._container.clientWidth),I=f.distanceTo(_);if(i&&i.unit==="imperial"){const E=3.2808*I;E>5280?Ca(e,T,E/5280,u._getUIString("ScaleControl.Miles")):Ca(e,T,E,u._getUIString("ScaleControl.Feet"))}else i&&i.unit==="nautical"?Ca(e,T,I/1852,u._getUIString("ScaleControl.NauticalMiles")):I>=1e3?Ca(e,T,I/1e3,u._getUIString("ScaleControl.Kilometers")):Ca(e,T,I,u._getUIString("ScaleControl.Meters"))}function Ca(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(v){const T=Math.pow(10,Math.ceil(-Math.log(v)/Math.LN10));return Math.round(v*T)/T}(_),f*_}(i);u.style.width=e*(l/i)+"px",u.innerHTML=`${l}&nbsp;${s}`}const Lc={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1,locationOccludedOpacity:void 0},Fc=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function ro(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 ro(new o.P(0,0))}const Bc=le;S.AJAXError=o.cm,S.Event=o.l,S.Evented=o.E,S.LngLat=o.Q,S.MercatorCoordinate=o.$,S.Point=o.P,S.addProtocol=o.cn,S.config=o.a,S.removeProtocol=o.co,S.AttributionControl=Je,S.BoxZoomHandler=Pa,S.CanvasSource=qt,S.CooperativeGesturesHandler=il,S.DoubleClickZoomHandler=Ec,S.DragPanHandler=En,S.DragRotateHandler=ti,S.EdgeInsets=oi,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=ie.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){ie.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const u=this._fullscreenButton=ie.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);ie.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=Pt,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=Ve.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(this.options.trackUserLocation)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&&Ia)return;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=ie.create("button","maplibregl-ctrl-geolocate",this._container),ie.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=ie.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new Ma({element:this._dotElement}),this._circleElement=ie.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Ma({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({},Rc,u)}onAdd(u){return this._map=u,this._container=ie.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),function(){return o._(this,arguments,void 0,function*(e=!1){if(fn!==void 0&&!e)return fn;if(window.navigator.permissions===void 0)return fn=!!window.navigator.geolocation,fn;try{fn=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{fn=!!window.navigator.geolocation}return fn})}().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(),ie.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,_s=0,Ia=!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":_s--,Ia=!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"),_s++,_s>1?(u={maximumAge:6e5,timeout:0},Ia=!0):(u=this.options.positionOptions,Ia=!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=ie.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._globeButton=ie.create("button","maplibregl-ctrl-globe",this._container),ie.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(){ie.remove(this._container),this._map.off("styledata",this._updateGlobeIcon),this._globeButton.removeEventListener("click",this._toggleProjection),this._map=void 0}},S.Hash=Tc,S.ImageSource=st,S.KeyboardHandler=Ic,S.LngLatBounds=Ve,S.LogoControl=nt,S.Map=class extends pn{constructor(u){var e,i;o.cj.mark(o.ck.create);const s=Object.assign(Object.assign(Object.assign({},Ti),u),{canvasContextAttributes:Object.assign(Object.assign({},Ti.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 li,h=new _r;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 nl,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({},eo),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=Jt.addThrottleControl(()=>this.isMoving()),this._requestManager=new pi(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 v=wc(T=>{this._trackResize&&!this._removed&&(this.resize(T),this.redraw())},50);this._resizeObserver=new ResizeObserver(T=>{_?v(T):_=!0}),this._resizeObserver.observe(this._container)}this.handlers=new tp(this,s),this._hash=s.hash&&new Tc(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 Je(typeof s.attributionControl=="boolean"?void 0:s.attributionControl)),s.maplibreLogo&&this.addControl(new nt,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(Ve.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(v=>this.getLayer(v)),_=f.length!==0?this.queryRenderedFeatures(h.point,{layers:f}):[];_.length?s||(s=!0,i.call(this,new er(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(v=>this.getLayer(v));(_.length!==0?this.queryRenderedFeatures(f.point,{layers:_}):[]).length?s=!0:s&&(s=!1,i.call(this,new er(u,this,f.originalEvent)))},mouseout:f=>{s&&(s=!1,i.call(this,new er(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 ts(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 ts(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 xr(this.painter,e,u),this.painter.renderToTexture=new ip(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)}addImage(u,e,i={}){const{pixelRatio:s=1,sdf:l=!1,stretchX:h,stretchY:f,content:_,textFitWidth:v,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:I,height:E,data:k}=e,O=e;return this.style.addImage(u,{data:new o.R({width:I,height:E},new Uint8Array(k)),pixelRatio:s,stretchX:h,stretchY:f,content:_,textFitWidth:v,textFitHeight:T,sdf:l,version:0,userImage:O}),O.onAdd&&O.onAdd(this,u),this}}{const{width:I,height:E,data:k}=xe.getImageData(e);this.style.addImage(u,{data:new o.R({width:I,height:E},k),pixelRatio:s,stretchX:h,stretchY:f,content:_,textFitWidth:v,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)?xe.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 Jt.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=ie.create("div","maplibregl-canvas-container",u);this._interactive&&e.classList.add("maplibregl-interactive"),this._canvas=ie.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=ie.create("div","maplibregl-control-container",u),h=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(f=>{h[f]=ie.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 Sh(i,this.transform),De.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 v=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const E=this.transform.zoom,k=xe.now();this.style.zoomHistory.update(E,k);const O=new o.C(E,{now:k,fadeDuration:f,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),Z=O.crossFadingFactor();Z===1&&Z===this._crossFadingFactor||(v=!0,this._crossFadingFactor=Z),this.style.update(O)}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.cj.mark(o.ck.load),this.fire(new o.l("load"))),this.style&&(this.style.hasTransitions()||v)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const I=this._sourcesDirty||this._styleDirty||this._placementDirty;return I||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new o.l("idle")),!this._loaded||this._fullyLoaded||I||(this._fullyLoaded=!0,o.cj.mark(o.ck.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),Jt.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),ie.remove(this._canvasContainer),ie.remove(this._controlContainer),this._container.removeEventListener("scroll",this._onMapScroll,!1),this._container.classList.remove("maplibregl-map"),o.cj.clearMetrics(),this._removed=!0,this.fire(new o.l("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,xe.frame(this._frameRequest,u=>{o.cj.frame(u),this._frameRequest=null;try{this._render(u)}catch(e){if(!o.cl(e)&&!function(i){return i.message===vh}(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 gi}getCameraTargetElevation(){return this.transform.elevation}getProjection(){return this.style.getProjection()}setProjection(u){return this._lazyInitEmptyStyle(),this.style.setProjection(u),this._update(!0)}},S.MapMouseEvent=er,S.MapTouchEvent=fs,S.MapWheelEvent=Ur,S.Marker=Ma,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({},jh,u),this._container=ie.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})),ie.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})),ie.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=ie.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 to(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){ie.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this.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=ie.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&&ie.remove(this._content),this._container&&(ie.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),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=>{var i;if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=ie.create("div","maplibregl-popup",this._map.getContainer()),this._tip=ie.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const _ of this.options.className.split(" "))this._container.classList.add(_);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=this._map.transform.renderWorldCopies&&!this._trackPointer?al(this._lngLat,this._flatPos,this._map.transform):(i=this._lngLat)===null||i===void 0?void 0:i.wrap(),this._trackPointer&&!e)return;const s=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 l=this.options.anchor;const h=ro(this.options.offset);if(!l){const _=this._container.offsetWidth,v=this._container.offsetHeight;let T;T=s.y+h.bottom.y<v?["top"]:s.y>this._map.transform.height-v?["bottom"]:[],s.x<_/2?T.push("left"):s.x>this._map.transform.width-_/2&&T.push("right"),l=T.length===0?"bottom":T.join("-")}let f=s.add(h[l]);this.options.subpixelPositioning||(f=f.round()),ie.setTransform(this._container,`${io[l]} translate(${f.x}px,${f.y}px)`),sl(this._container,l,"popup"),this._updateOpacity()},this._onClose=()=>{this.remove()},this.options=o.e(Object.create(Lc),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=ie.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=ie.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="&#215;",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const u=this._container.querySelector(Fc);u&&u.focus()}},S.RasterDEMTileSource=bi,S.RasterTileSource=Gt,S.ScaleControl=class{constructor(u){this._onMove=()=>{ol(this._map,this._container,this.options)},this.setUnit=e=>{this.options.unit=e,ol(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},Dc),u)}getDefaultPosition(){return"bottom-left"}onAdd(u){return this._map=u,this._container=ie.create("div","maplibregl-ctrl maplibregl-ctrl-scale",u.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){ie.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},S.ScrollZoomHandler=Fh,S.Style=ts,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=ie.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=ie.create("button","maplibregl-ctrl-terrain",this._container),ie.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(){ie.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},S.TwoFingersTouchPitchHandler=Lh,S.TwoFingersTouchRotateHandler=Dh,S.TwoFingersTouchZoomHandler=wt,S.TwoFingersTouchZoomRotateHandler=Ys,S.VectorTileSource=Zt,S.VideoSource=It,S.addSourceType=(u,e)=>o._(void 0,void 0,void 0,function*(){if(fi(u))throw new Error(`A source type called "${u}" already exists.`);((i,s)=>{qi[i]=s})(u,e)}),S.clearPrewarmedResources=function(){const u=Ji;u&&(u.isPreloaded()&&u.numActive()===1?(u.release($n),Ji=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=Ao,S.getMaxParallelImageRequests=function(){return o.a.MAX_PARALLEL_IMAGE_REQUESTS},S.getRTLTextPluginStatus=function(){return Xr().getRTLTextPluginStatus()},S.getVersion=function(){return Bc},S.getWorkerCount=function(){return jr.workerCount},S.getWorkerUrl=function(){return o.a.WORKER_URL},S.importScriptInWorkers=function(u){return kr().broadcast("IS",u)},S.prewarm=function(){Tn().acquire($n)},S.setMaxParallelImageRequests=function(u){o.a.MAX_PARALLEL_IMAGE_REQUESTS=u},S.setRTLTextPlugin=function(u,e){return Xr().setRTLTextPlugin(u,e)},S.setWorkerCount=function(u){jr.workerCount=u},S.setWorkerUrl=function(u){o.a.WORKER_URL=u}});var D=b;return D})}(zu)),zu.exports}var Sy=Py();const Sd=wy(Sy);class Wf{constructor(m,b,C,A,D){Ts(this,"bounds1");Ts(this,"bounds2");Ts(this,"getBounds",(m,b,C,A)=>new Sd.LngLatBounds([m,b],[C,A]));Ts(this,"contains",(m,b)=>this.bounds1.contains([b,m])||this.bounds2.contains([b,m]));const S=m.unproject([b,C]),o=m.unproject([A,D]);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 My={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}}]},Iy={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 Nt;(function(y){y.assertEqual=A=>A;function m(A){}y.assertIs=m;function b(A){throw new Error}y.assertNever=b,y.arrayToEnum=A=>{const D={};for(const S of A)D[S]=S;return D},y.getValidEnumValues=A=>{const D=y.objectKeys(A).filter(o=>typeof A[A[o]]!="number"),S={};for(const o of D)S[o]=A[o];return y.objectValues(S)},y.objectValues=A=>y.objectKeys(A).map(function(D){return A[D]}),y.objectKeys=typeof Object.keys=="function"?A=>Object.keys(A):A=>{const D=[];for(const S in A)Object.prototype.hasOwnProperty.call(A,S)&&D.push(S);return D},y.find=(A,D)=>{for(const S of A)if(D(S))return S},y.isInteger=typeof Number.isInteger=="function"?A=>Number.isInteger(A):A=>typeof A=="number"&&isFinite(A)&&Math.floor(A)===A;function C(A,D=" | "){return A.map(S=>typeof S=="string"?`'${S}'`:S).join(D)}y.joinValues=C,y.jsonStringifyReplacer=(A,D)=>typeof D=="bigint"?D.toString():D})(Nt||(Nt={}));var Md;(function(y){y.mergeShapes=(m,b)=>({...m,...b})})(Md||(Md={}));const Ke=Nt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ua=y=>{switch(typeof y){case"undefined":return Ke.undefined;case"string":return Ke.string;case"number":return isNaN(y)?Ke.nan:Ke.number;case"boolean":return Ke.boolean;case"function":return Ke.function;case"bigint":return Ke.bigint;case"symbol":return Ke.symbol;case"object":return Array.isArray(y)?Ke.array:y===null?Ke.null:y.then&&typeof y.then=="function"&&y.catch&&typeof y.catch=="function"?Ke.promise:typeof Map<"u"&&y instanceof Map?Ke.map:typeof Set<"u"&&y instanceof Set?Ke.set:typeof Date<"u"&&y instanceof Date?Ke.date:Ke.object;default:return Ke.unknown}},Oe=Nt.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"]),Cy=y=>JSON.stringify(y,null,2).replace(/"([^"]+)":/g,"$1:");class qr extends Error{get errors(){return this.issues}constructor(m){super(),this.issues=[],this.addIssue=C=>{this.issues=[...this.issues,C]},this.addIssues=(C=[])=>{this.issues=[...this.issues,...C]};const b=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,b):this.__proto__=b,this.name="ZodError",this.issues=m}format(m){const b=m||function(D){return D.message},C={_errors:[]},A=D=>{for(const S of D.issues)if(S.code==="invalid_union")S.unionErrors.map(A);else if(S.code==="invalid_return_type")A(S.returnTypeError);else if(S.code==="invalid_arguments")A(S.argumentsError);else if(S.path.length===0)C._errors.push(b(S));else{let o=C,le=0;for(;le<S.path.length;){const ue=S.path[le];le===S.path.length-1?(o[ue]=o[ue]||{_errors:[]},o[ue]._errors.push(b(S))):o[ue]=o[ue]||{_errors:[]},o=o[ue],le++}}};return A(this),C}static assert(m){if(!(m instanceof qr))throw new Error(`Not a ZodError: ${m}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Nt.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(m=b=>b.message){const b={},C=[];for(const A of this.issues)A.path.length>0?(b[A.path[0]]=b[A.path[0]]||[],b[A.path[0]].push(m(A))):C.push(m(A));return{formErrors:C,fieldErrors:b}}get formErrors(){return this.flatten()}}qr.create=y=>new qr(y);const xo=(y,m)=>{let b;switch(y.code){case Oe.invalid_type:y.received===Ke.undefined?b="Required":b=`Expected ${y.expected}, received ${y.received}`;break;case Oe.invalid_literal:b=`Invalid literal value, expected ${JSON.stringify(y.expected,Nt.jsonStringifyReplacer)}`;break;case Oe.unrecognized_keys:b=`Unrecognized key(s) in object: ${Nt.joinValues(y.keys,", ")}`;break;case Oe.invalid_union:b="Invalid input";break;case Oe.invalid_union_discriminator:b=`Invalid discriminator value. Expected ${Nt.joinValues(y.options)}`;break;case Oe.invalid_enum_value:b=`Invalid enum value. Expected ${Nt.joinValues(y.options)}, received '${y.received}'`;break;case Oe.invalid_arguments:b="Invalid function arguments";break;case Oe.invalid_return_type:b="Invalid function return type";break;case Oe.invalid_date:b="Invalid date";break;case Oe.invalid_string:typeof y.validation=="object"?"includes"in y.validation?(b=`Invalid input: must include "${y.validation.includes}"`,typeof y.validation.position=="number"&&(b=`${b} at one or more positions greater than or equal to ${y.validation.position}`)):"startsWith"in y.validation?b=`Invalid input: must start with "${y.validation.startsWith}"`:"endsWith"in y.validation?b=`Invalid input: must end with "${y.validation.endsWith}"`:Nt.assertNever(y.validation):y.validation!=="regex"?b=`Invalid ${y.validation}`:b="Invalid";break;case Oe.too_small:y.type==="array"?b=`Array must contain ${y.exact?"exactly":y.inclusive?"at least":"more than"} ${y.minimum} element(s)`:y.type==="string"?b=`String must contain ${y.exact?"exactly":y.inclusive?"at least":"over"} ${y.minimum} character(s)`:y.type==="number"?b=`Number must be ${y.exact?"exactly equal to ":y.inclusive?"greater than or equal to ":"greater than "}${y.minimum}`:y.type==="date"?b=`Date must be ${y.exact?"exactly equal to ":y.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(y.minimum))}`:b="Invalid input";break;case Oe.too_big:y.type==="array"?b=`Array must contain ${y.exact?"exactly":y.inclusive?"at most":"less than"} ${y.maximum} element(s)`:y.type==="string"?b=`String must contain ${y.exact?"exactly":y.inclusive?"at most":"under"} ${y.maximum} character(s)`:y.type==="number"?b=`Number must be ${y.exact?"exactly":y.inclusive?"less than or equal to":"less than"} ${y.maximum}`:y.type==="bigint"?b=`BigInt must be ${y.exact?"exactly":y.inclusive?"less than or equal to":"less than"} ${y.maximum}`:y.type==="date"?b=`Date must be ${y.exact?"exactly":y.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(y.maximum))}`:b="Invalid input";break;case Oe.custom:b="Invalid input";break;case Oe.invalid_intersection_types:b="Intersection results could not be merged";break;case Oe.not_multiple_of:b=`Number must be a multiple of ${y.multipleOf}`;break;case Oe.not_finite:b="Number must be finite";break;default:b=m.defaultError,Nt.assertNever(y)}return{message:b}};let Hf=xo;function ky(y){Hf=y}function Ru(){return Hf}const Du=y=>{const{data:m,path:b,errorMaps:C,issueData:A}=y,D=[...b,...A.path||[]],S={...A,path:D};if(A.message!==void 0)return{...A,path:D,message:A.message};let o="";const le=C.filter(ue=>!!ue).slice().reverse();for(const ue of le)o=ue(S,{data:m,defaultError:o}).message;return{...A,path:D,message:o}},Ey=[];function qe(y,m){const b=Ru(),C=Du({issueData:m,data:y.data,path:y.path,errorMaps:[y.common.contextualErrorMap,y.schemaErrorMap,b,b===xo?void 0:xo].filter(A=>!!A)});y.common.issues.push(C)}class hr{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(m,b){const C=[];for(const A of b){if(A.status==="aborted")return dt;A.status==="dirty"&&m.dirty(),C.push(A.value)}return{status:m.value,value:C}}static async mergeObjectAsync(m,b){const C=[];for(const A of b){const D=await A.key,S=await A.value;C.push({key:D,value:S})}return hr.mergeObjectSync(m,C)}static mergeObjectSync(m,b){const C={};for(const A of b){const{key:D,value:S}=A;if(D.status==="aborted"||S.status==="aborted")return dt;D.status==="dirty"&&m.dirty(),S.status==="dirty"&&m.dirty(),D.value!=="__proto__"&&(typeof S.value<"u"||A.alwaysSet)&&(C[D.value]=S.value)}return{status:m.value,value:C}}}const dt=Object.freeze({status:"aborted"}),vo=y=>({status:"dirty",value:y}),Sr=y=>({status:"valid",value:y}),Id=y=>y.status==="aborted",Cd=y=>y.status==="dirty",Ms=y=>y.status==="valid",El=y=>typeof Promise<"u"&&y instanceof Promise;function Lu(y,m,b,C){if(typeof m=="function"?y!==m||!0:!m.has(y))throw new TypeError("Cannot read private member from an object whose class did not declare it");return m.get(y)}function Xf(y,m,b,C,A){if(typeof m=="function"?y!==m||!0:!m.has(y))throw new TypeError("Cannot write private member to an object whose class did not declare it");return m.set(y,b),b}typeof SuppressedError=="function"&&SuppressedError;var rt;(function(y){y.errToObj=m=>typeof m=="string"?{message:m}:m||{},y.toString=m=>typeof m=="string"?m:m==null?void 0:m.message})(rt||(rt={}));var Al,zl;class Zn{constructor(m,b,C,A){this._cachedPath=[],this.parent=m,this.data=b,this._path=C,this._key=A}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Kf=(y,m)=>{if(Ms(m))return{success:!0,data:m.value};if(!y.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const b=new qr(y.common.issues);return this._error=b,this._error}}};function xt(y){if(!y)return{};const{errorMap:m,invalid_type_error:b,required_error:C,description:A}=y;if(m&&(b||C))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return m?{errorMap:m,description:A}:{errorMap:(S,o)=>{var le,ue;const{message:_e}=y;return S.code==="invalid_enum_value"?{message:_e??o.defaultError}:typeof o.data>"u"?{message:(le=_e??C)!==null&&le!==void 0?le:o.defaultError}:S.code!=="invalid_type"?{message:o.defaultError}:{message:(ue=_e??b)!==null&&ue!==void 0?ue:o.defaultError}},description:A}}class Mt{get description(){return this._def.description}_getType(m){return ua(m.data)}_getOrReturnCtx(m,b){return b||{common:m.parent.common,data:m.data,parsedType:ua(m.data),schemaErrorMap:this._def.errorMap,path:m.path,parent:m.parent}}_processInputParams(m){return{status:new hr,ctx:{common:m.parent.common,data:m.data,parsedType:ua(m.data),schemaErrorMap:this._def.errorMap,path:m.path,parent:m.parent}}}_parseSync(m){const b=this._parse(m);if(El(b))throw new Error("Synchronous parse encountered promise.");return b}_parseAsync(m){const b=this._parse(m);return Promise.resolve(b)}parse(m,b){const C=this.safeParse(m,b);if(C.success)return C.data;throw C.error}safeParse(m,b){var C;const A={common:{issues:[],async:(C=b==null?void 0:b.async)!==null&&C!==void 0?C:!1,contextualErrorMap:b==null?void 0:b.errorMap},path:(b==null?void 0:b.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:m,parsedType:ua(m)},D=this._parseSync({data:m,path:A.path,parent:A});return Kf(A,D)}"~validate"(m){var b,C;const A={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:m,parsedType:ua(m)};if(!this["~standard"].async)try{const D=this._parseSync({data:m,path:[],parent:A});return Ms(D)?{value:D.value}:{issues:A.common.issues}}catch(D){!((C=(b=D==null?void 0:D.message)===null||b===void 0?void 0:b.toLowerCase())===null||C===void 0)&&C.includes("encountered")&&(this["~standard"].async=!0),A.common={issues:[],async:!0}}return this._parseAsync({data:m,path:[],parent:A}).then(D=>Ms(D)?{value:D.value}:{issues:A.common.issues})}async parseAsync(m,b){const C=await this.safeParseAsync(m,b);if(C.success)return C.data;throw C.error}async safeParseAsync(m,b){const C={common:{issues:[],contextualErrorMap:b==null?void 0:b.errorMap,async:!0},path:(b==null?void 0:b.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:m,parsedType:ua(m)},A=this._parse({data:m,path:C.path,parent:C}),D=await(El(A)?A:Promise.resolve(A));return Kf(C,D)}refine(m,b){const C=A=>typeof b=="string"||typeof b>"u"?{message:b}:typeof b=="function"?b(A):b;return this._refinement((A,D)=>{const S=m(A),o=()=>D.addIssue({code:Oe.custom,...C(A)});return typeof Promise<"u"&&S instanceof Promise?S.then(le=>le?!0:(o(),!1)):S?!0:(o(),!1)})}refinement(m,b){return this._refinement((C,A)=>m(C)?!0:(A.addIssue(typeof b=="function"?b(C,A):b),!1))}_refinement(m){return new bn({schema:this,typeName:ut.ZodEffects,effect:{type:"refinement",refinement:m}})}superRefine(m){return this._refinement(m)}constructor(m){this.spa=this.safeParseAsync,this._def=m,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:b=>this["~validate"](b)}}optional(){return Un.create(this,this._def)}nullable(){return Za.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return vn.create(this)}promise(){return Po.create(this,this._def)}or(m){return Fl.create([this,m],this._def)}and(m){return Bl.create(this,m,this._def)}transform(m){return new bn({...xt(this._def),schema:this,typeName:ut.ZodEffects,effect:{type:"transform",transform:m}})}default(m){const b=typeof m=="function"?m:()=>m;return new Vl({...xt(this._def),innerType:this,defaultValue:b,typeName:ut.ZodDefault})}brand(){return new Ad({typeName:ut.ZodBranded,type:this,...xt(this._def)})}catch(m){const b=typeof m=="function"?m:()=>m;return new Ul({...xt(this._def),innerType:this,catchValue:b,typeName:ut.ZodCatch})}describe(m){const b=this.constructor;return new b({...this._def,description:m})}pipe(m){return $l.create(this,m)}readonly(){return Gl.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Ay=/^c[^\s-]{8,}$/i,zy=/^[0-9a-z]+$/,Ry=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Dy=/^[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,Ly=/^[a-z0-9_-]{21}$/i,Fy=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,By=/^[-+]?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)?)??$/,Oy=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,jy="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let kd;const Ny=/^(?:(?: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])$/,Zy=/^(?:(?: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])$/,Vy=/^(([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]))$/,Uy=/^(([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])$/,$y=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Gy=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Yf="((\\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])))",qy=new RegExp(`^${Yf}$`);function Jf(y){let m="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return y.precision?m=`${m}\\.\\d{${y.precision}}`:y.precision==null&&(m=`${m}(\\.\\d+)?`),m}function Wy(y){return new RegExp(`^${Jf(y)}$`)}function Qf(y){let m=`${Yf}T${Jf(y)}`;const b=[];return b.push(y.local?"Z?":"Z"),y.offset&&b.push("([+-]\\d{2}:?\\d{2})"),m=`${m}(${b.join("|")})`,new RegExp(`^${m}$`)}function Hy(y,m){return!!((m==="v4"||!m)&&Ny.test(y)||(m==="v6"||!m)&&Vy.test(y))}function Xy(y,m){if(!Fy.test(y))return!1;try{const[b]=y.split("."),C=b.replace(/-/g,"+").replace(/_/g,"/").padEnd(b.length+(4-b.length%4)%4,"="),A=JSON.parse(atob(C));return!(typeof A!="object"||A===null||!A.typ||!A.alg||m&&A.alg!==m)}catch{return!1}}function Ky(y,m){return!!((m==="v4"||!m)&&Zy.test(y)||(m==="v6"||!m)&&Uy.test(y))}class xn extends Mt{_parse(m){if(this._def.coerce&&(m.data=String(m.data)),this._getType(m)!==Ke.string){const D=this._getOrReturnCtx(m);return qe(D,{code:Oe.invalid_type,expected:Ke.string,received:D.parsedType}),dt}const C=new hr;let A;for(const D of this._def.checks)if(D.kind==="min")m.data.length<D.value&&(A=this._getOrReturnCtx(m,A),qe(A,{code:Oe.too_small,minimum:D.value,type:"string",inclusive:!0,exact:!1,message:D.message}),C.dirty());else if(D.kind==="max")m.data.length>D.value&&(A=this._getOrReturnCtx(m,A),qe(A,{code:Oe.too_big,maximum:D.value,type:"string",inclusive:!0,exact:!1,message:D.message}),C.dirty());else if(D.kind==="length"){const S=m.data.length>D.value,o=m.data.length<D.value;(S||o)&&(A=this._getOrReturnCtx(m,A),S?qe(A,{code:Oe.too_big,maximum:D.value,type:"string",inclusive:!0,exact:!0,message:D.message}):o&&qe(A,{code:Oe.too_small,minimum:D.value,type:"string",inclusive:!0,exact:!0,message:D.message}),C.dirty())}else if(D.kind==="email")Oy.test(m.data)||(A=this._getOrReturnCtx(m,A),qe(A,{validation:"email",code:Oe.invalid_string,message:D.message}),C.dirty());else if(D.kind==="emoji")kd||(kd=new RegExp(jy,"u")),kd.test(m.data)||(A=this._getOrReturnCtx(m,A),qe(A,{validation:"emoji",code:Oe.invalid_string,message:D.message}),C.dirty());else if(D.kind==="uuid")Dy.test(m.data)||(A=this._getOrReturnCtx(m,A),qe(A,{validation:"uuid",code:Oe.invalid_string,message:D.message}),C.dirty());else if(D.kind==="nanoid")Ly.test(m.data)||(A=this._getOrReturnCtx(m,A),qe(A,{validation:"nanoid",code:Oe.invalid_string,message:D.message}),C.dirty());else if(D.kind==="cuid")Ay.test(m.data)||(A=this._getOrReturnCtx(m,A),qe(A,{validation:"cuid",code:Oe.invalid_string,message:D.message}),C.dirty());else if(D.kind==="cuid2")zy.test(m.data)||(A=this._getOrReturnCtx(m,A),qe(A,{validation:"cuid2",code:Oe.invalid_string,message:D.message}),C.dirty());else if(D.kind==="ulid")Ry.test(m.data)||(A=this._getOrReturnCtx(m,A),qe(A,{validation:"ulid",code:Oe.invalid_string,message:D.message}),C.dirty());else if(D.kind==="url")try{new URL(m.data)}catch{A=this._getOrReturnCtx(m,A),qe(A,{validation:"url",code:Oe.invalid_string,message:D.message}),C.dirty()}else D.kind==="regex"?(D.regex.lastIndex=0,D.regex.test(m.data)||(A=this._getOrReturnCtx(m,A),qe(A,{validation:"regex",code:Oe.invalid_string,message:D.message}),C.dirty())):D.kind==="trim"?m.data=m.data.trim():D.kind==="includes"?m.data.includes(D.value,D.position)||(A=this._getOrReturnCtx(m,A),qe(A,{code:Oe.invalid_string,validation:{includes:D.value,position:D.position},message:D.message}),C.dirty()):D.kind==="toLowerCase"?m.data=m.data.toLowerCase():D.kind==="toUpperCase"?m.data=m.data.toUpperCase():D.kind==="startsWith"?m.data.startsWith(D.value)||(A=this._getOrReturnCtx(m,A),qe(A,{code:Oe.invalid_string,validation:{startsWith:D.value},message:D.message}),C.dirty()):D.kind==="endsWith"?m.data.endsWith(D.value)||(A=this._getOrReturnCtx(m,A),qe(A,{code:Oe.invalid_string,validation:{endsWith:D.value},message:D.message}),C.dirty()):D.kind==="datetime"?Qf(D).test(m.data)||(A=this._getOrReturnCtx(m,A),qe(A,{code:Oe.invalid_string,validation:"datetime",message:D.message}),C.dirty()):D.kind==="date"?qy.test(m.data)||(A=this._getOrReturnCtx(m,A),qe(A,{code:Oe.invalid_string,validation:"date",message:D.message}),C.dirty()):D.kind==="time"?Wy(D).test(m.data)||(A=this._getOrReturnCtx(m,A),qe(A,{code:Oe.invalid_string,validation:"time",message:D.message}),C.dirty()):D.kind==="duration"?By.test(m.data)||(A=this._getOrReturnCtx(m,A),qe(A,{validation:"duration",code:Oe.invalid_string,message:D.message}),C.dirty()):D.kind==="ip"?Hy(m.data,D.version)||(A=this._getOrReturnCtx(m,A),qe(A,{validation:"ip",code:Oe.invalid_string,message:D.message}),C.dirty()):D.kind==="jwt"?Xy(m.data,D.alg)||(A=this._getOrReturnCtx(m,A),qe(A,{validation:"jwt",code:Oe.invalid_string,message:D.message}),C.dirty()):D.kind==="cidr"?Ky(m.data,D.version)||(A=this._getOrReturnCtx(m,A),qe(A,{validation:"cidr",code:Oe.invalid_string,message:D.message}),C.dirty()):D.kind==="base64"?$y.test(m.data)||(A=this._getOrReturnCtx(m,A),qe(A,{validation:"base64",code:Oe.invalid_string,message:D.message}),C.dirty()):D.kind==="base64url"?Gy.test(m.data)||(A=this._getOrReturnCtx(m,A),qe(A,{validation:"base64url",code:Oe.invalid_string,message:D.message}),C.dirty()):Nt.assertNever(D);return{status:C.value,value:m.data}}_regex(m,b,C){return this.refinement(A=>m.test(A),{validation:b,code:Oe.invalid_string,...rt.errToObj(C)})}_addCheck(m){return new xn({...this._def,checks:[...this._def.checks,m]})}email(m){return this._addCheck({kind:"email",...rt.errToObj(m)})}url(m){return this._addCheck({kind:"url",...rt.errToObj(m)})}emoji(m){return this._addCheck({kind:"emoji",...rt.errToObj(m)})}uuid(m){return this._addCheck({kind:"uuid",...rt.errToObj(m)})}nanoid(m){return this._addCheck({kind:"nanoid",...rt.errToObj(m)})}cuid(m){return this._addCheck({kind:"cuid",...rt.errToObj(m)})}cuid2(m){return this._addCheck({kind:"cuid2",...rt.errToObj(m)})}ulid(m){return this._addCheck({kind:"ulid",...rt.errToObj(m)})}base64(m){return this._addCheck({kind:"base64",...rt.errToObj(m)})}base64url(m){return this._addCheck({kind:"base64url",...rt.errToObj(m)})}jwt(m){return this._addCheck({kind:"jwt",...rt.errToObj(m)})}ip(m){return this._addCheck({kind:"ip",...rt.errToObj(m)})}cidr(m){return this._addCheck({kind:"cidr",...rt.errToObj(m)})}datetime(m){var b,C;return typeof m=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:m}):this._addCheck({kind:"datetime",precision:typeof(m==null?void 0:m.precision)>"u"?null:m==null?void 0:m.precision,offset:(b=m==null?void 0:m.offset)!==null&&b!==void 0?b:!1,local:(C=m==null?void 0:m.local)!==null&&C!==void 0?C:!1,...rt.errToObj(m==null?void 0:m.message)})}date(m){return this._addCheck({kind:"date",message:m})}time(m){return typeof m=="string"?this._addCheck({kind:"time",precision:null,message:m}):this._addCheck({kind:"time",precision:typeof(m==null?void 0:m.precision)>"u"?null:m==null?void 0:m.precision,...rt.errToObj(m==null?void 0:m.message)})}duration(m){return this._addCheck({kind:"duration",...rt.errToObj(m)})}regex(m,b){return this._addCheck({kind:"regex",regex:m,...rt.errToObj(b)})}includes(m,b){return this._addCheck({kind:"includes",value:m,position:b==null?void 0:b.position,...rt.errToObj(b==null?void 0:b.message)})}startsWith(m,b){return this._addCheck({kind:"startsWith",value:m,...rt.errToObj(b)})}endsWith(m,b){return this._addCheck({kind:"endsWith",value:m,...rt.errToObj(b)})}min(m,b){return this._addCheck({kind:"min",value:m,...rt.errToObj(b)})}max(m,b){return this._addCheck({kind:"max",value:m,...rt.errToObj(b)})}length(m,b){return this._addCheck({kind:"length",value:m,...rt.errToObj(b)})}nonempty(m){return this.min(1,rt.errToObj(m))}trim(){return new xn({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new xn({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new xn({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(m=>m.kind==="datetime")}get isDate(){return!!this._def.checks.find(m=>m.kind==="date")}get isTime(){return!!this._def.checks.find(m=>m.kind==="time")}get isDuration(){return!!this._def.checks.find(m=>m.kind==="duration")}get isEmail(){return!!this._def.checks.find(m=>m.kind==="email")}get isURL(){return!!this._def.checks.find(m=>m.kind==="url")}get isEmoji(){return!!this._def.checks.find(m=>m.kind==="emoji")}get isUUID(){return!!this._def.checks.find(m=>m.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(m=>m.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(m=>m.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(m=>m.kind==="cuid2")}get isULID(){return!!this._def.checks.find(m=>m.kind==="ulid")}get isIP(){return!!this._def.checks.find(m=>m.kind==="ip")}get isCIDR(){return!!this._def.checks.find(m=>m.kind==="cidr")}get isBase64(){return!!this._def.checks.find(m=>m.kind==="base64")}get isBase64url(){return!!this._def.checks.find(m=>m.kind==="base64url")}get minLength(){let m=null;for(const b of this._def.checks)b.kind==="min"&&(m===null||b.value>m)&&(m=b.value);return m}get maxLength(){let m=null;for(const b of this._def.checks)b.kind==="max"&&(m===null||b.value<m)&&(m=b.value);return m}}xn.create=y=>{var m;return new xn({checks:[],typeName:ut.ZodString,coerce:(m=y==null?void 0:y.coerce)!==null&&m!==void 0?m:!1,...xt(y)})};function Yy(y,m){const b=(y.toString().split(".")[1]||"").length,C=(m.toString().split(".")[1]||"").length,A=b>C?b:C,D=parseInt(y.toFixed(A).replace(".","")),S=parseInt(m.toFixed(A).replace(".",""));return D%S/Math.pow(10,A)}class Oa extends Mt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(m){if(this._def.coerce&&(m.data=Number(m.data)),this._getType(m)!==Ke.number){const D=this._getOrReturnCtx(m);return qe(D,{code:Oe.invalid_type,expected:Ke.number,received:D.parsedType}),dt}let C;const A=new hr;for(const D of this._def.checks)D.kind==="int"?Nt.isInteger(m.data)||(C=this._getOrReturnCtx(m,C),qe(C,{code:Oe.invalid_type,expected:"integer",received:"float",message:D.message}),A.dirty()):D.kind==="min"?(D.inclusive?m.data<D.value:m.data<=D.value)&&(C=this._getOrReturnCtx(m,C),qe(C,{code:Oe.too_small,minimum:D.value,type:"number",inclusive:D.inclusive,exact:!1,message:D.message}),A.dirty()):D.kind==="max"?(D.inclusive?m.data>D.value:m.data>=D.value)&&(C=this._getOrReturnCtx(m,C),qe(C,{code:Oe.too_big,maximum:D.value,type:"number",inclusive:D.inclusive,exact:!1,message:D.message}),A.dirty()):D.kind==="multipleOf"?Yy(m.data,D.value)!==0&&(C=this._getOrReturnCtx(m,C),qe(C,{code:Oe.not_multiple_of,multipleOf:D.value,message:D.message}),A.dirty()):D.kind==="finite"?Number.isFinite(m.data)||(C=this._getOrReturnCtx(m,C),qe(C,{code:Oe.not_finite,message:D.message}),A.dirty()):Nt.assertNever(D);return{status:A.value,value:m.data}}gte(m,b){return this.setLimit("min",m,!0,rt.toString(b))}gt(m,b){return this.setLimit("min",m,!1,rt.toString(b))}lte(m,b){return this.setLimit("max",m,!0,rt.toString(b))}lt(m,b){return this.setLimit("max",m,!1,rt.toString(b))}setLimit(m,b,C,A){return new Oa({...this._def,checks:[...this._def.checks,{kind:m,value:b,inclusive:C,message:rt.toString(A)}]})}_addCheck(m){return new Oa({...this._def,checks:[...this._def.checks,m]})}int(m){return this._addCheck({kind:"int",message:rt.toString(m)})}positive(m){return this._addCheck({kind:"min",value:0,inclusive:!1,message:rt.toString(m)})}negative(m){return this._addCheck({kind:"max",value:0,inclusive:!1,message:rt.toString(m)})}nonpositive(m){return this._addCheck({kind:"max",value:0,inclusive:!0,message:rt.toString(m)})}nonnegative(m){return this._addCheck({kind:"min",value:0,inclusive:!0,message:rt.toString(m)})}multipleOf(m,b){return this._addCheck({kind:"multipleOf",value:m,message:rt.toString(b)})}finite(m){return this._addCheck({kind:"finite",message:rt.toString(m)})}safe(m){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:rt.toString(m)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:rt.toString(m)})}get minValue(){let m=null;for(const b of this._def.checks)b.kind==="min"&&(m===null||b.value>m)&&(m=b.value);return m}get maxValue(){let m=null;for(const b of this._def.checks)b.kind==="max"&&(m===null||b.value<m)&&(m=b.value);return m}get isInt(){return!!this._def.checks.find(m=>m.kind==="int"||m.kind==="multipleOf"&&Nt.isInteger(m.value))}get isFinite(){let m=null,b=null;for(const C of this._def.checks){if(C.kind==="finite"||C.kind==="int"||C.kind==="multipleOf")return!0;C.kind==="min"?(b===null||C.value>b)&&(b=C.value):C.kind==="max"&&(m===null||C.value<m)&&(m=C.value)}return Number.isFinite(b)&&Number.isFinite(m)}}Oa.create=y=>new Oa({checks:[],typeName:ut.ZodNumber,coerce:(y==null?void 0:y.coerce)||!1,...xt(y)});class ja extends Mt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(m){if(this._def.coerce)try{m.data=BigInt(m.data)}catch{return this._getInvalidInput(m)}if(this._getType(m)!==Ke.bigint)return this._getInvalidInput(m);let C;const A=new hr;for(const D of this._def.checks)D.kind==="min"?(D.inclusive?m.data<D.value:m.data<=D.value)&&(C=this._getOrReturnCtx(m,C),qe(C,{code:Oe.too_small,type:"bigint",minimum:D.value,inclusive:D.inclusive,message:D.message}),A.dirty()):D.kind==="max"?(D.inclusive?m.data>D.value:m.data>=D.value)&&(C=this._getOrReturnCtx(m,C),qe(C,{code:Oe.too_big,type:"bigint",maximum:D.value,inclusive:D.inclusive,message:D.message}),A.dirty()):D.kind==="multipleOf"?m.data%D.value!==BigInt(0)&&(C=this._getOrReturnCtx(m,C),qe(C,{code:Oe.not_multiple_of,multipleOf:D.value,message:D.message}),A.dirty()):Nt.assertNever(D);return{status:A.value,value:m.data}}_getInvalidInput(m){const b=this._getOrReturnCtx(m);return qe(b,{code:Oe.invalid_type,expected:Ke.bigint,received:b.parsedType}),dt}gte(m,b){return this.setLimit("min",m,!0,rt.toString(b))}gt(m,b){return this.setLimit("min",m,!1,rt.toString(b))}lte(m,b){return this.setLimit("max",m,!0,rt.toString(b))}lt(m,b){return this.setLimit("max",m,!1,rt.toString(b))}setLimit(m,b,C,A){return new ja({...this._def,checks:[...this._def.checks,{kind:m,value:b,inclusive:C,message:rt.toString(A)}]})}_addCheck(m){return new ja({...this._def,checks:[...this._def.checks,m]})}positive(m){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:rt.toString(m)})}negative(m){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:rt.toString(m)})}nonpositive(m){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:rt.toString(m)})}nonnegative(m){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:rt.toString(m)})}multipleOf(m,b){return this._addCheck({kind:"multipleOf",value:m,message:rt.toString(b)})}get minValue(){let m=null;for(const b of this._def.checks)b.kind==="min"&&(m===null||b.value>m)&&(m=b.value);return m}get maxValue(){let m=null;for(const b of this._def.checks)b.kind==="max"&&(m===null||b.value<m)&&(m=b.value);return m}}ja.create=y=>{var m;return new ja({checks:[],typeName:ut.ZodBigInt,coerce:(m=y==null?void 0:y.coerce)!==null&&m!==void 0?m:!1,...xt(y)})};class Rl extends Mt{_parse(m){if(this._def.coerce&&(m.data=!!m.data),this._getType(m)!==Ke.boolean){const C=this._getOrReturnCtx(m);return qe(C,{code:Oe.invalid_type,expected:Ke.boolean,received:C.parsedType}),dt}return Sr(m.data)}}Rl.create=y=>new Rl({typeName:ut.ZodBoolean,coerce:(y==null?void 0:y.coerce)||!1,...xt(y)});class Is extends Mt{_parse(m){if(this._def.coerce&&(m.data=new Date(m.data)),this._getType(m)!==Ke.date){const D=this._getOrReturnCtx(m);return qe(D,{code:Oe.invalid_type,expected:Ke.date,received:D.parsedType}),dt}if(isNaN(m.data.getTime())){const D=this._getOrReturnCtx(m);return qe(D,{code:Oe.invalid_date}),dt}const C=new hr;let A;for(const D of this._def.checks)D.kind==="min"?m.data.getTime()<D.value&&(A=this._getOrReturnCtx(m,A),qe(A,{code:Oe.too_small,message:D.message,inclusive:!0,exact:!1,minimum:D.value,type:"date"}),C.dirty()):D.kind==="max"?m.data.getTime()>D.value&&(A=this._getOrReturnCtx(m,A),qe(A,{code:Oe.too_big,message:D.message,inclusive:!0,exact:!1,maximum:D.value,type:"date"}),C.dirty()):Nt.assertNever(D);return{status:C.value,value:new Date(m.data.getTime())}}_addCheck(m){return new Is({...this._def,checks:[...this._def.checks,m]})}min(m,b){return this._addCheck({kind:"min",value:m.getTime(),message:rt.toString(b)})}max(m,b){return this._addCheck({kind:"max",value:m.getTime(),message:rt.toString(b)})}get minDate(){let m=null;for(const b of this._def.checks)b.kind==="min"&&(m===null||b.value>m)&&(m=b.value);return m!=null?new Date(m):null}get maxDate(){let m=null;for(const b of this._def.checks)b.kind==="max"&&(m===null||b.value<m)&&(m=b.value);return m!=null?new Date(m):null}}Is.create=y=>new Is({checks:[],coerce:(y==null?void 0:y.coerce)||!1,typeName:ut.ZodDate,...xt(y)});class Fu extends Mt{_parse(m){if(this._getType(m)!==Ke.symbol){const C=this._getOrReturnCtx(m);return qe(C,{code:Oe.invalid_type,expected:Ke.symbol,received:C.parsedType}),dt}return Sr(m.data)}}Fu.create=y=>new Fu({typeName:ut.ZodSymbol,...xt(y)});class Dl extends Mt{_parse(m){if(this._getType(m)!==Ke.undefined){const C=this._getOrReturnCtx(m);return qe(C,{code:Oe.invalid_type,expected:Ke.undefined,received:C.parsedType}),dt}return Sr(m.data)}}Dl.create=y=>new Dl({typeName:ut.ZodUndefined,...xt(y)});class Ll extends Mt{_parse(m){if(this._getType(m)!==Ke.null){const C=this._getOrReturnCtx(m);return qe(C,{code:Oe.invalid_type,expected:Ke.null,received:C.parsedType}),dt}return Sr(m.data)}}Ll.create=y=>new Ll({typeName:ut.ZodNull,...xt(y)});class bo extends Mt{constructor(){super(...arguments),this._any=!0}_parse(m){return Sr(m.data)}}bo.create=y=>new bo({typeName:ut.ZodAny,...xt(y)});class Cs extends Mt{constructor(){super(...arguments),this._unknown=!0}_parse(m){return Sr(m.data)}}Cs.create=y=>new Cs({typeName:ut.ZodUnknown,...xt(y)});class ha extends Mt{_parse(m){const b=this._getOrReturnCtx(m);return qe(b,{code:Oe.invalid_type,expected:Ke.never,received:b.parsedType}),dt}}ha.create=y=>new ha({typeName:ut.ZodNever,...xt(y)});class Bu extends Mt{_parse(m){if(this._getType(m)!==Ke.undefined){const C=this._getOrReturnCtx(m);return qe(C,{code:Oe.invalid_type,expected:Ke.void,received:C.parsedType}),dt}return Sr(m.data)}}Bu.create=y=>new Bu({typeName:ut.ZodVoid,...xt(y)});class vn extends Mt{_parse(m){const{ctx:b,status:C}=this._processInputParams(m),A=this._def;if(b.parsedType!==Ke.array)return qe(b,{code:Oe.invalid_type,expected:Ke.array,received:b.parsedType}),dt;if(A.exactLength!==null){const S=b.data.length>A.exactLength.value,o=b.data.length<A.exactLength.value;(S||o)&&(qe(b,{code:S?Oe.too_big:Oe.too_small,minimum:o?A.exactLength.value:void 0,maximum:S?A.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:A.exactLength.message}),C.dirty())}if(A.minLength!==null&&b.data.length<A.minLength.value&&(qe(b,{code:Oe.too_small,minimum:A.minLength.value,type:"array",inclusive:!0,exact:!1,message:A.minLength.message}),C.dirty()),A.maxLength!==null&&b.data.length>A.maxLength.value&&(qe(b,{code:Oe.too_big,maximum:A.maxLength.value,type:"array",inclusive:!0,exact:!1,message:A.maxLength.message}),C.dirty()),b.common.async)return Promise.all([...b.data].map((S,o)=>A.type._parseAsync(new Zn(b,S,b.path,o)))).then(S=>hr.mergeArray(C,S));const D=[...b.data].map((S,o)=>A.type._parseSync(new Zn(b,S,b.path,o)));return hr.mergeArray(C,D)}get element(){return this._def.type}min(m,b){return new vn({...this._def,minLength:{value:m,message:rt.toString(b)}})}max(m,b){return new vn({...this._def,maxLength:{value:m,message:rt.toString(b)}})}length(m,b){return new vn({...this._def,exactLength:{value:m,message:rt.toString(b)}})}nonempty(m){return this.min(1,m)}}vn.create=(y,m)=>new vn({type:y,minLength:null,maxLength:null,exactLength:null,typeName:ut.ZodArray,...xt(m)});function wo(y){if(y instanceof Si){const m={};for(const b in y.shape){const C=y.shape[b];m[b]=Un.create(wo(C))}return new Si({...y._def,shape:()=>m})}else return y instanceof vn?new vn({...y._def,type:wo(y.element)}):y instanceof Un?Un.create(wo(y.unwrap())):y instanceof Za?Za.create(wo(y.unwrap())):y instanceof Vn?Vn.create(y.items.map(m=>wo(m))):y}class Si extends Mt{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const m=this._def.shape(),b=Nt.objectKeys(m);return this._cached={shape:m,keys:b}}_parse(m){if(this._getType(m)!==Ke.object){const ue=this._getOrReturnCtx(m);return qe(ue,{code:Oe.invalid_type,expected:Ke.object,received:ue.parsedType}),dt}const{status:C,ctx:A}=this._processInputParams(m),{shape:D,keys:S}=this._getCached(),o=[];if(!(this._def.catchall instanceof ha&&this._def.unknownKeys==="strip"))for(const ue in A.data)S.includes(ue)||o.push(ue);const le=[];for(const ue of S){const _e=D[ue],Re=A.data[ue];le.push({key:{status:"valid",value:ue},value:_e._parse(new Zn(A,Re,A.path,ue)),alwaysSet:ue in A.data})}if(this._def.catchall instanceof ha){const ue=this._def.unknownKeys;if(ue==="passthrough")for(const _e of o)le.push({key:{status:"valid",value:_e},value:{status:"valid",value:A.data[_e]}});else if(ue==="strict")o.length>0&&(qe(A,{code:Oe.unrecognized_keys,keys:o}),C.dirty());else if(ue!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const ue=this._def.catchall;for(const _e of o){const Re=A.data[_e];le.push({key:{status:"valid",value:_e},value:ue._parse(new Zn(A,Re,A.path,_e)),alwaysSet:_e in A.data})}}return A.common.async?Promise.resolve().then(async()=>{const ue=[];for(const _e of le){const Re=await _e.key,xe=await _e.value;ue.push({key:Re,value:xe,alwaysSet:_e.alwaysSet})}return ue}).then(ue=>hr.mergeObjectSync(C,ue)):hr.mergeObjectSync(C,le)}get shape(){return this._def.shape()}strict(m){return rt.errToObj,new Si({...this._def,unknownKeys:"strict",...m!==void 0?{errorMap:(b,C)=>{var A,D,S,o;const le=(S=(D=(A=this._def).errorMap)===null||D===void 0?void 0:D.call(A,b,C).message)!==null&&S!==void 0?S:C.defaultError;return b.code==="unrecognized_keys"?{message:(o=rt.errToObj(m).message)!==null&&o!==void 0?o:le}:{message:le}}}:{}})}strip(){return new Si({...this._def,unknownKeys:"strip"})}passthrough(){return new Si({...this._def,unknownKeys:"passthrough"})}extend(m){return new Si({...this._def,shape:()=>({...this._def.shape(),...m})})}merge(m){return new Si({unknownKeys:m._def.unknownKeys,catchall:m._def.catchall,shape:()=>({...this._def.shape(),...m._def.shape()}),typeName:ut.ZodObject})}setKey(m,b){return this.augment({[m]:b})}catchall(m){return new Si({...this._def,catchall:m})}pick(m){const b={};return Nt.objectKeys(m).forEach(C=>{m[C]&&this.shape[C]&&(b[C]=this.shape[C])}),new Si({...this._def,shape:()=>b})}omit(m){const b={};return Nt.objectKeys(this.shape).forEach(C=>{m[C]||(b[C]=this.shape[C])}),new Si({...this._def,shape:()=>b})}deepPartial(){return wo(this)}partial(m){const b={};return Nt.objectKeys(this.shape).forEach(C=>{const A=this.shape[C];m&&!m[C]?b[C]=A:b[C]=A.optional()}),new Si({...this._def,shape:()=>b})}required(m){const b={};return Nt.objectKeys(this.shape).forEach(C=>{if(m&&!m[C])b[C]=this.shape[C];else{let D=this.shape[C];for(;D instanceof Un;)D=D._def.innerType;b[C]=D}}),new Si({...this._def,shape:()=>b})}keyof(){return em(Nt.objectKeys(this.shape))}}Si.create=(y,m)=>new Si({shape:()=>y,unknownKeys:"strip",catchall:ha.create(),typeName:ut.ZodObject,...xt(m)}),Si.strictCreate=(y,m)=>new Si({shape:()=>y,unknownKeys:"strict",catchall:ha.create(),typeName:ut.ZodObject,...xt(m)}),Si.lazycreate=(y,m)=>new Si({shape:y,unknownKeys:"strip",catchall:ha.create(),typeName:ut.ZodObject,...xt(m)});class Fl extends Mt{_parse(m){const{ctx:b}=this._processInputParams(m),C=this._def.options;function A(D){for(const o of D)if(o.result.status==="valid")return o.result;for(const o of D)if(o.result.status==="dirty")return b.common.issues.push(...o.ctx.common.issues),o.result;const S=D.map(o=>new qr(o.ctx.common.issues));return qe(b,{code:Oe.invalid_union,unionErrors:S}),dt}if(b.common.async)return Promise.all(C.map(async D=>{const S={...b,common:{...b.common,issues:[]},parent:null};return{result:await D._parseAsync({data:b.data,path:b.path,parent:S}),ctx:S}})).then(A);{let D;const S=[];for(const le of C){const ue={...b,common:{...b.common,issues:[]},parent:null},_e=le._parseSync({data:b.data,path:b.path,parent:ue});if(_e.status==="valid")return _e;_e.status==="dirty"&&!D&&(D={result:_e,ctx:ue}),ue.common.issues.length&&S.push(ue.common.issues)}if(D)return b.common.issues.push(...D.ctx.common.issues),D.result;const o=S.map(le=>new qr(le));return qe(b,{code:Oe.invalid_union,unionErrors:o}),dt}}get options(){return this._def.options}}Fl.create=(y,m)=>new Fl({options:y,typeName:ut.ZodUnion,...xt(m)});const da=y=>y instanceof jl?da(y.schema):y instanceof bn?da(y.innerType()):y instanceof Nl?[y.value]:y instanceof Na?y.options:y instanceof Zl?Nt.objectValues(y.enum):y instanceof Vl?da(y._def.innerType):y instanceof Dl?[void 0]:y instanceof Ll?[null]:y instanceof Un?[void 0,...da(y.unwrap())]:y instanceof Za?[null,...da(y.unwrap())]:y instanceof Ad||y instanceof Gl?da(y.unwrap()):y instanceof Ul?da(y._def.innerType):[];class Ou extends Mt{_parse(m){const{ctx:b}=this._processInputParams(m);if(b.parsedType!==Ke.object)return qe(b,{code:Oe.invalid_type,expected:Ke.object,received:b.parsedType}),dt;const C=this.discriminator,A=b.data[C],D=this.optionsMap.get(A);return D?b.common.async?D._parseAsync({data:b.data,path:b.path,parent:b}):D._parseSync({data:b.data,path:b.path,parent:b}):(qe(b,{code:Oe.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[C]}),dt)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(m,b,C){const A=new Map;for(const D of b){const S=da(D.shape[m]);if(!S.length)throw new Error(`A discriminator value for key \`${m}\` could not be extracted from all schema options`);for(const o of S){if(A.has(o))throw new Error(`Discriminator property ${String(m)} has duplicate value ${String(o)}`);A.set(o,D)}}return new Ou({typeName:ut.ZodDiscriminatedUnion,discriminator:m,options:b,optionsMap:A,...xt(C)})}}function Ed(y,m){const b=ua(y),C=ua(m);if(y===m)return{valid:!0,data:y};if(b===Ke.object&&C===Ke.object){const A=Nt.objectKeys(m),D=Nt.objectKeys(y).filter(o=>A.indexOf(o)!==-1),S={...y,...m};for(const o of D){const le=Ed(y[o],m[o]);if(!le.valid)return{valid:!1};S[o]=le.data}return{valid:!0,data:S}}else if(b===Ke.array&&C===Ke.array){if(y.length!==m.length)return{valid:!1};const A=[];for(let D=0;D<y.length;D++){const S=y[D],o=m[D],le=Ed(S,o);if(!le.valid)return{valid:!1};A.push(le.data)}return{valid:!0,data:A}}else return b===Ke.date&&C===Ke.date&&+y==+m?{valid:!0,data:y}:{valid:!1}}class Bl extends Mt{_parse(m){const{status:b,ctx:C}=this._processInputParams(m),A=(D,S)=>{if(Id(D)||Id(S))return dt;const o=Ed(D.value,S.value);return o.valid?((Cd(D)||Cd(S))&&b.dirty(),{status:b.value,value:o.data}):(qe(C,{code:Oe.invalid_intersection_types}),dt)};return C.common.async?Promise.all([this._def.left._parseAsync({data:C.data,path:C.path,parent:C}),this._def.right._parseAsync({data:C.data,path:C.path,parent:C})]).then(([D,S])=>A(D,S)):A(this._def.left._parseSync({data:C.data,path:C.path,parent:C}),this._def.right._parseSync({data:C.data,path:C.path,parent:C}))}}Bl.create=(y,m,b)=>new Bl({left:y,right:m,typeName:ut.ZodIntersection,...xt(b)});class Vn extends Mt{_parse(m){const{status:b,ctx:C}=this._processInputParams(m);if(C.parsedType!==Ke.array)return qe(C,{code:Oe.invalid_type,expected:Ke.array,received:C.parsedType}),dt;if(C.data.length<this._def.items.length)return qe(C,{code:Oe.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),dt;!this._def.rest&&C.data.length>this._def.items.length&&(qe(C,{code:Oe.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),b.dirty());const D=[...C.data].map((S,o)=>{const le=this._def.items[o]||this._def.rest;return le?le._parse(new Zn(C,S,C.path,o)):null}).filter(S=>!!S);return C.common.async?Promise.all(D).then(S=>hr.mergeArray(b,S)):hr.mergeArray(b,D)}get items(){return this._def.items}rest(m){return new Vn({...this._def,rest:m})}}Vn.create=(y,m)=>{if(!Array.isArray(y))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Vn({items:y,typeName:ut.ZodTuple,rest:null,...xt(m)})};class Ol extends Mt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(m){const{status:b,ctx:C}=this._processInputParams(m);if(C.parsedType!==Ke.object)return qe(C,{code:Oe.invalid_type,expected:Ke.object,received:C.parsedType}),dt;const A=[],D=this._def.keyType,S=this._def.valueType;for(const o in C.data)A.push({key:D._parse(new Zn(C,o,C.path,o)),value:S._parse(new Zn(C,C.data[o],C.path,o)),alwaysSet:o in C.data});return C.common.async?hr.mergeObjectAsync(b,A):hr.mergeObjectSync(b,A)}get element(){return this._def.valueType}static create(m,b,C){return b instanceof Mt?new Ol({keyType:m,valueType:b,typeName:ut.ZodRecord,...xt(C)}):new Ol({keyType:xn.create(),valueType:m,typeName:ut.ZodRecord,...xt(b)})}}class ju extends Mt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(m){const{status:b,ctx:C}=this._processInputParams(m);if(C.parsedType!==Ke.map)return qe(C,{code:Oe.invalid_type,expected:Ke.map,received:C.parsedType}),dt;const A=this._def.keyType,D=this._def.valueType,S=[...C.data.entries()].map(([o,le],ue)=>({key:A._parse(new Zn(C,o,C.path,[ue,"key"])),value:D._parse(new Zn(C,le,C.path,[ue,"value"]))}));if(C.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const le of S){const ue=await le.key,_e=await le.value;if(ue.status==="aborted"||_e.status==="aborted")return dt;(ue.status==="dirty"||_e.status==="dirty")&&b.dirty(),o.set(ue.value,_e.value)}return{status:b.value,value:o}})}else{const o=new Map;for(const le of S){const ue=le.key,_e=le.value;if(ue.status==="aborted"||_e.status==="aborted")return dt;(ue.status==="dirty"||_e.status==="dirty")&&b.dirty(),o.set(ue.value,_e.value)}return{status:b.value,value:o}}}}ju.create=(y,m,b)=>new ju({valueType:m,keyType:y,typeName:ut.ZodMap,...xt(b)});class ks extends Mt{_parse(m){const{status:b,ctx:C}=this._processInputParams(m);if(C.parsedType!==Ke.set)return qe(C,{code:Oe.invalid_type,expected:Ke.set,received:C.parsedType}),dt;const A=this._def;A.minSize!==null&&C.data.size<A.minSize.value&&(qe(C,{code:Oe.too_small,minimum:A.minSize.value,type:"set",inclusive:!0,exact:!1,message:A.minSize.message}),b.dirty()),A.maxSize!==null&&C.data.size>A.maxSize.value&&(qe(C,{code:Oe.too_big,maximum:A.maxSize.value,type:"set",inclusive:!0,exact:!1,message:A.maxSize.message}),b.dirty());const D=this._def.valueType;function S(le){const ue=new Set;for(const _e of le){if(_e.status==="aborted")return dt;_e.status==="dirty"&&b.dirty(),ue.add(_e.value)}return{status:b.value,value:ue}}const o=[...C.data.values()].map((le,ue)=>D._parse(new Zn(C,le,C.path,ue)));return C.common.async?Promise.all(o).then(le=>S(le)):S(o)}min(m,b){return new ks({...this._def,minSize:{value:m,message:rt.toString(b)}})}max(m,b){return new ks({...this._def,maxSize:{value:m,message:rt.toString(b)}})}size(m,b){return this.min(m,b).max(m,b)}nonempty(m){return this.min(1,m)}}ks.create=(y,m)=>new ks({valueType:y,minSize:null,maxSize:null,typeName:ut.ZodSet,...xt(m)});class To extends Mt{constructor(){super(...arguments),this.validate=this.implement}_parse(m){const{ctx:b}=this._processInputParams(m);if(b.parsedType!==Ke.function)return qe(b,{code:Oe.invalid_type,expected:Ke.function,received:b.parsedType}),dt;function C(o,le){return Du({data:o,path:b.path,errorMaps:[b.common.contextualErrorMap,b.schemaErrorMap,Ru(),xo].filter(ue=>!!ue),issueData:{code:Oe.invalid_arguments,argumentsError:le}})}function A(o,le){return Du({data:o,path:b.path,errorMaps:[b.common.contextualErrorMap,b.schemaErrorMap,Ru(),xo].filter(ue=>!!ue),issueData:{code:Oe.invalid_return_type,returnTypeError:le}})}const D={errorMap:b.common.contextualErrorMap},S=b.data;if(this._def.returns instanceof Po){const o=this;return Sr(async function(...le){const ue=new qr([]),_e=await o._def.args.parseAsync(le,D).catch(ie=>{throw ue.addIssue(C(le,ie)),ue}),Re=await Reflect.apply(S,this,_e);return await o._def.returns._def.type.parseAsync(Re,D).catch(ie=>{throw ue.addIssue(A(Re,ie)),ue})})}else{const o=this;return Sr(function(...le){const ue=o._def.args.safeParse(le,D);if(!ue.success)throw new qr([C(le,ue.error)]);const _e=Reflect.apply(S,this,ue.data),Re=o._def.returns.safeParse(_e,D);if(!Re.success)throw new qr([A(_e,Re.error)]);return Re.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...m){return new To({...this._def,args:Vn.create(m).rest(Cs.create())})}returns(m){return new To({...this._def,returns:m})}implement(m){return this.parse(m)}strictImplement(m){return this.parse(m)}static create(m,b,C){return new To({args:m||Vn.create([]).rest(Cs.create()),returns:b||Cs.create(),typeName:ut.ZodFunction,...xt(C)})}}class jl extends Mt{get schema(){return this._def.getter()}_parse(m){const{ctx:b}=this._processInputParams(m);return this._def.getter()._parse({data:b.data,path:b.path,parent:b})}}jl.create=(y,m)=>new jl({getter:y,typeName:ut.ZodLazy,...xt(m)});class Nl extends Mt{_parse(m){if(m.data!==this._def.value){const b=this._getOrReturnCtx(m);return qe(b,{received:b.data,code:Oe.invalid_literal,expected:this._def.value}),dt}return{status:"valid",value:m.data}}get value(){return this._def.value}}Nl.create=(y,m)=>new Nl({value:y,typeName:ut.ZodLiteral,...xt(m)});function em(y,m){return new Na({values:y,typeName:ut.ZodEnum,...xt(m)})}class Na extends Mt{constructor(){super(...arguments),Al.set(this,void 0)}_parse(m){if(typeof m.data!="string"){const b=this._getOrReturnCtx(m),C=this._def.values;return qe(b,{expected:Nt.joinValues(C),received:b.parsedType,code:Oe.invalid_type}),dt}if(Lu(this,Al)||Xf(this,Al,new Set(this._def.values)),!Lu(this,Al).has(m.data)){const b=this._getOrReturnCtx(m),C=this._def.values;return qe(b,{received:b.data,code:Oe.invalid_enum_value,options:C}),dt}return Sr(m.data)}get options(){return this._def.values}get enum(){const m={};for(const b of this._def.values)m[b]=b;return m}get Values(){const m={};for(const b of this._def.values)m[b]=b;return m}get Enum(){const m={};for(const b of this._def.values)m[b]=b;return m}extract(m,b=this._def){return Na.create(m,{...this._def,...b})}exclude(m,b=this._def){return Na.create(this.options.filter(C=>!m.includes(C)),{...this._def,...b})}}Al=new WeakMap,Na.create=em;class Zl extends Mt{constructor(){super(...arguments),zl.set(this,void 0)}_parse(m){const b=Nt.getValidEnumValues(this._def.values),C=this._getOrReturnCtx(m);if(C.parsedType!==Ke.string&&C.parsedType!==Ke.number){const A=Nt.objectValues(b);return qe(C,{expected:Nt.joinValues(A),received:C.parsedType,code:Oe.invalid_type}),dt}if(Lu(this,zl)||Xf(this,zl,new Set(Nt.getValidEnumValues(this._def.values))),!Lu(this,zl).has(m.data)){const A=Nt.objectValues(b);return qe(C,{received:C.data,code:Oe.invalid_enum_value,options:A}),dt}return Sr(m.data)}get enum(){return this._def.values}}zl=new WeakMap,Zl.create=(y,m)=>new Zl({values:y,typeName:ut.ZodNativeEnum,...xt(m)});class Po extends Mt{unwrap(){return this._def.type}_parse(m){const{ctx:b}=this._processInputParams(m);if(b.parsedType!==Ke.promise&&b.common.async===!1)return qe(b,{code:Oe.invalid_type,expected:Ke.promise,received:b.parsedType}),dt;const C=b.parsedType===Ke.promise?b.data:Promise.resolve(b.data);return Sr(C.then(A=>this._def.type.parseAsync(A,{path:b.path,errorMap:b.common.contextualErrorMap})))}}Po.create=(y,m)=>new Po({type:y,typeName:ut.ZodPromise,...xt(m)});class bn extends Mt{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ut.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(m){const{status:b,ctx:C}=this._processInputParams(m),A=this._def.effect||null,D={addIssue:S=>{qe(C,S),S.fatal?b.abort():b.dirty()},get path(){return C.path}};if(D.addIssue=D.addIssue.bind(D),A.type==="preprocess"){const S=A.transform(C.data,D);if(C.common.async)return Promise.resolve(S).then(async o=>{if(b.value==="aborted")return dt;const le=await this._def.schema._parseAsync({data:o,path:C.path,parent:C});return le.status==="aborted"?dt:le.status==="dirty"||b.value==="dirty"?vo(le.value):le});{if(b.value==="aborted")return dt;const o=this._def.schema._parseSync({data:S,path:C.path,parent:C});return o.status==="aborted"?dt:o.status==="dirty"||b.value==="dirty"?vo(o.value):o}}if(A.type==="refinement"){const S=o=>{const le=A.refinement(o,D);if(C.common.async)return Promise.resolve(le);if(le instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(C.common.async===!1){const o=this._def.schema._parseSync({data:C.data,path:C.path,parent:C});return o.status==="aborted"?dt:(o.status==="dirty"&&b.dirty(),S(o.value),{status:b.value,value:o.value})}else return this._def.schema._parseAsync({data:C.data,path:C.path,parent:C}).then(o=>o.status==="aborted"?dt:(o.status==="dirty"&&b.dirty(),S(o.value).then(()=>({status:b.value,value:o.value}))))}if(A.type==="transform")if(C.common.async===!1){const S=this._def.schema._parseSync({data:C.data,path:C.path,parent:C});if(!Ms(S))return S;const o=A.transform(S.value,D);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:b.value,value:o}}else return this._def.schema._parseAsync({data:C.data,path:C.path,parent:C}).then(S=>Ms(S)?Promise.resolve(A.transform(S.value,D)).then(o=>({status:b.value,value:o})):S);Nt.assertNever(A)}}bn.create=(y,m,b)=>new bn({schema:y,typeName:ut.ZodEffects,effect:m,...xt(b)}),bn.createWithPreprocess=(y,m,b)=>new bn({schema:m,effect:{type:"preprocess",transform:y},typeName:ut.ZodEffects,...xt(b)});class Un extends Mt{_parse(m){return this._getType(m)===Ke.undefined?Sr(void 0):this._def.innerType._parse(m)}unwrap(){return this._def.innerType}}Un.create=(y,m)=>new Un({innerType:y,typeName:ut.ZodOptional,...xt(m)});class Za extends Mt{_parse(m){return this._getType(m)===Ke.null?Sr(null):this._def.innerType._parse(m)}unwrap(){return this._def.innerType}}Za.create=(y,m)=>new Za({innerType:y,typeName:ut.ZodNullable,...xt(m)});class Vl extends Mt{_parse(m){const{ctx:b}=this._processInputParams(m);let C=b.data;return b.parsedType===Ke.undefined&&(C=this._def.defaultValue()),this._def.innerType._parse({data:C,path:b.path,parent:b})}removeDefault(){return this._def.innerType}}Vl.create=(y,m)=>new Vl({innerType:y,typeName:ut.ZodDefault,defaultValue:typeof m.default=="function"?m.default:()=>m.default,...xt(m)});class Ul extends Mt{_parse(m){const{ctx:b}=this._processInputParams(m),C={...b,common:{...b.common,issues:[]}},A=this._def.innerType._parse({data:C.data,path:C.path,parent:{...C}});return El(A)?A.then(D=>({status:"valid",value:D.status==="valid"?D.value:this._def.catchValue({get error(){return new qr(C.common.issues)},input:C.data})})):{status:"valid",value:A.status==="valid"?A.value:this._def.catchValue({get error(){return new qr(C.common.issues)},input:C.data})}}removeCatch(){return this._def.innerType}}Ul.create=(y,m)=>new Ul({innerType:y,typeName:ut.ZodCatch,catchValue:typeof m.catch=="function"?m.catch:()=>m.catch,...xt(m)});class Nu extends Mt{_parse(m){if(this._getType(m)!==Ke.nan){const C=this._getOrReturnCtx(m);return qe(C,{code:Oe.invalid_type,expected:Ke.nan,received:C.parsedType}),dt}return{status:"valid",value:m.data}}}Nu.create=y=>new Nu({typeName:ut.ZodNaN,...xt(y)});const Jy=Symbol("zod_brand");class Ad extends Mt{_parse(m){const{ctx:b}=this._processInputParams(m),C=b.data;return this._def.type._parse({data:C,path:b.path,parent:b})}unwrap(){return this._def.type}}class $l extends Mt{_parse(m){const{status:b,ctx:C}=this._processInputParams(m);if(C.common.async)return(async()=>{const D=await this._def.in._parseAsync({data:C.data,path:C.path,parent:C});return D.status==="aborted"?dt:D.status==="dirty"?(b.dirty(),vo(D.value)):this._def.out._parseAsync({data:D.value,path:C.path,parent:C})})();{const A=this._def.in._parseSync({data:C.data,path:C.path,parent:C});return A.status==="aborted"?dt:A.status==="dirty"?(b.dirty(),{status:"dirty",value:A.value}):this._def.out._parseSync({data:A.value,path:C.path,parent:C})}}static create(m,b){return new $l({in:m,out:b,typeName:ut.ZodPipeline})}}class Gl extends Mt{_parse(m){const b=this._def.innerType._parse(m),C=A=>(Ms(A)&&(A.value=Object.freeze(A.value)),A);return El(b)?b.then(A=>C(A)):C(b)}unwrap(){return this._def.innerType}}Gl.create=(y,m)=>new Gl({innerType:y,typeName:ut.ZodReadonly,...xt(m)});function tm(y,m){const b=typeof y=="function"?y(m):typeof y=="string"?{message:y}:y;return typeof b=="string"?{message:b}:b}function im(y,m={},b){return y?bo.create().superRefine((C,A)=>{var D,S;const o=y(C);if(o instanceof Promise)return o.then(le=>{var ue,_e;if(!le){const Re=tm(m,C),xe=(_e=(ue=Re.fatal)!==null&&ue!==void 0?ue:b)!==null&&_e!==void 0?_e:!0;A.addIssue({code:"custom",...Re,fatal:xe})}});if(!o){const le=tm(m,C),ue=(S=(D=le.fatal)!==null&&D!==void 0?D:b)!==null&&S!==void 0?S:!0;A.addIssue({code:"custom",...le,fatal:ue})}}):bo.create()}const Qy={object:Si.lazycreate};var ut;(function(y){y.ZodString="ZodString",y.ZodNumber="ZodNumber",y.ZodNaN="ZodNaN",y.ZodBigInt="ZodBigInt",y.ZodBoolean="ZodBoolean",y.ZodDate="ZodDate",y.ZodSymbol="ZodSymbol",y.ZodUndefined="ZodUndefined",y.ZodNull="ZodNull",y.ZodAny="ZodAny",y.ZodUnknown="ZodUnknown",y.ZodNever="ZodNever",y.ZodVoid="ZodVoid",y.ZodArray="ZodArray",y.ZodObject="ZodObject",y.ZodUnion="ZodUnion",y.ZodDiscriminatedUnion="ZodDiscriminatedUnion",y.ZodIntersection="ZodIntersection",y.ZodTuple="ZodTuple",y.ZodRecord="ZodRecord",y.ZodMap="ZodMap",y.ZodSet="ZodSet",y.ZodFunction="ZodFunction",y.ZodLazy="ZodLazy",y.ZodLiteral="ZodLiteral",y.ZodEnum="ZodEnum",y.ZodEffects="ZodEffects",y.ZodNativeEnum="ZodNativeEnum",y.ZodOptional="ZodOptional",y.ZodNullable="ZodNullable",y.ZodDefault="ZodDefault",y.ZodCatch="ZodCatch",y.ZodPromise="ZodPromise",y.ZodBranded="ZodBranded",y.ZodPipeline="ZodPipeline",y.ZodReadonly="ZodReadonly"})(ut||(ut={}));const ex=(y,m={message:`Input not instance of ${y.name}`})=>im(b=>b instanceof y,m),rm=xn.create,nm=Oa.create,tx=Nu.create,ix=ja.create,am=Rl.create,rx=Is.create,nx=Fu.create,ax=Dl.create,sx=Ll.create,ox=bo.create,lx=Cs.create,cx=ha.create,ux=Bu.create,hx=vn.create,dx=Si.create,px=Si.strictCreate,fx=Fl.create,mx=Ou.create,gx=Bl.create,_x=Vn.create,yx=Ol.create,xx=ju.create,vx=ks.create,bx=To.create,wx=jl.create,Tx=Nl.create,Px=Na.create,Sx=Zl.create,Mx=Po.create,sm=bn.create,Ix=Un.create,Cx=Za.create,kx=bn.createWithPreprocess,Ex=$l.create;var ct=Object.freeze({__proto__:null,defaultErrorMap:xo,setErrorMap:ky,getErrorMap:Ru,makeIssue:Du,EMPTY_PATH:Ey,addIssueToContext:qe,ParseStatus:hr,INVALID:dt,DIRTY:vo,OK:Sr,isAborted:Id,isDirty:Cd,isValid:Ms,isAsync:El,get util(){return Nt},get objectUtil(){return Md},ZodParsedType:Ke,getParsedType:ua,ZodType:Mt,datetimeRegex:Qf,ZodString:xn,ZodNumber:Oa,ZodBigInt:ja,ZodBoolean:Rl,ZodDate:Is,ZodSymbol:Fu,ZodUndefined:Dl,ZodNull:Ll,ZodAny:bo,ZodUnknown:Cs,ZodNever:ha,ZodVoid:Bu,ZodArray:vn,ZodObject:Si,ZodUnion:Fl,ZodDiscriminatedUnion:Ou,ZodIntersection:Bl,ZodTuple:Vn,ZodRecord:Ol,ZodMap:ju,ZodSet:ks,ZodFunction:To,ZodLazy:jl,ZodLiteral:Nl,ZodEnum:Na,ZodNativeEnum:Zl,ZodPromise:Po,ZodEffects:bn,ZodTransformer:bn,ZodOptional:Un,ZodNullable:Za,ZodDefault:Vl,ZodCatch:Ul,ZodNaN:Nu,BRAND:Jy,ZodBranded:Ad,ZodPipeline:$l,ZodReadonly:Gl,custom:im,Schema:Mt,ZodSchema:Mt,late:Qy,get ZodFirstPartyTypeKind(){return ut},coerce:{string:y=>xn.create({...y,coerce:!0}),number:y=>Oa.create({...y,coerce:!0}),boolean:y=>Rl.create({...y,coerce:!0}),bigint:y=>ja.create({...y,coerce:!0}),date:y=>Is.create({...y,coerce:!0})},any:ox,array:hx,bigint:ix,boolean:am,date:rx,discriminatedUnion:mx,effect:sm,enum:Px,function:bx,instanceof:ex,intersection:gx,lazy:wx,literal:Tx,map:xx,nan:tx,nativeEnum:Sx,never:cx,null:sx,nullable:Cx,number:nm,object:dx,oboolean:()=>am().optional(),onumber:()=>nm().optional(),optional:Ix,ostring:()=>rm().optional(),pipeline:Ex,preprocess:kx,promise:Mx,record:yx,set:vx,strictObject:px,string:rm,symbol:nx,transformer:sm,tuple:_x,undefined:ax,union:fx,unknown:lx,void:ux,NEVER:dt,ZodIssueCode:Oe,quotelessJson:Cy,ZodError:qr});const om=ct.object({lat:ct.number(),lng:ct.number()}),Ax=ct.object({sw:om,ne:om}),zx=ct.object({name:ct.literal("dark").or(ct.literal("light")),url:ct.string().optional(),colors:ct.object({primary:ct.string().max(64),background:ct.string().max(64),text:ct.string().max(64)})}),Rx=ct.object({container:ct.string(),position:ct.object({center:ct.object({lat:ct.number(),lng:ct.number()}),zoom:ct.number()}),style:zx,events:ct.object({onMapIdle:ct.function().returns(ct.void()).optional(),onMapMove:ct.function().args(ct.object({lat:ct.number(),lng:ct.number(),zoom:ct.number()})).returns(ct.void()).optional(),onMapClick:ct.function().returns(ct.void()).optional(),onPopupClick:ct.function().args(ct.string()).returns(ct.void()).optional(),onLoadingStart:ct.function().returns(ct.void()).optional(),onLoadingEnd:ct.function().returns(ct.void()).optional()}).optional()}),Dx=ct.object({id:ct.string(),rank:ct.number(),lat:ct.number(),lng:ct.number(),width:ct.number(),height:ct.number()}),lm=ct.array(Dx);ct.function().args(Ax).returns(ct.promise(lm));const Lx=ct.function().args(ct.string()).returns(ct.promise(ct.any()));var Fx=(y,m,b)=>m(tt(b).marker.id),Bx=go('<div class="popup svelte-1s5t15y"></div>'),Ox=go("<!> <!>",1),jx=go('<div class="marker"><!></div>'),Nx=go('<div class="container svelte-1s5t15y"><div class="map svelte-1s5t15y"></div> <div class="markers svelte-1s5t15y"></div></div>');function cm(y,m){var Cr,kr,Di,Hr,vi,si,ar;fu(m,!0);let b,C,A=0,D=Pi(!1);Nf(()=>{Rx.parse(m.options),S(),o()});function S(){const Ve=m.options.position;b=new Sd.Map({style:Ot(m.options.style),center:{lat:Ve.center.lat,lng:Ve.center.lng},zoom:Ve.zoom,minZoom:De(),maxZoom:$f,container:C,pitchWithRotate:!1,attributionControl:{compact:!1}})}function o(){b.on("load",le),b.on("move",ue),b.on("idle",_e),b.on("click",Re),b.dragRotate.disable(),b.keyboard.disable(),b.touchZoomRotate.disableRotation(),b.touchPitch.disable()}function le(){ai(D,!0)}function ue(){var Ve;if((Ve=m.options.events)!=null&&Ve.onMapMove){const Ye=b.getCenter(),Zt=b.getZoom();m.options.events.onMapMove({lat:Ye.lat,lng:Ye.lng,zoom:Zt})}}function _e(){var Ve,Ye;(Ye=(Ve=m.options.events)==null?void 0:Ve.onMapIdle)==null||Ye.call(null)}function Re(Ve){var Ye,Zt;(Zt=(Ye=m.options.events)==null?void 0:Ye.onMapClick)==null||Zt.call(null)}function xe(Ve){var Ye,Zt;(Zt=(Ye=m.options.events)==null?void 0:Ye.onPopupClick)==null||Zt.call(null,Ve)}function ie(){gt(De())}function De(){const Ye=Math.ceil(Math.log2(A/Uf));return Math.max(dy,Ye)}function gt(Ve){b==null||b.setMinZoom(Ve)}function $t(){const Ve=b==null?void 0:b.getCenter();return Ve?{lat:Ve.lat,lng:Ve.lng}:{lat:m.options.position.center.lat,lng:m.options.position.center.lng}}function _t(Ve){b==null||b.setCenter(Ve)}function Rt(){return(b==null?void 0:b.getZoom())??m.options.position.zoom}function Mi(Ve){b==null||b.setZoom(Ve)}function Jt(){const Ve=b==null?void 0:b.getBounds();if(Ve)return{sw:{lat:Ve.getSouthWest().lat,lng:Ve.getSouthWest().lng},ne:{lat:Ve.getNorthEast().lat,lng:Ve.getNorthEast().lng}}}function pi(){b==null||b.zoomIn()}function Bt(){b==null||b.zoomOut()}let vt=Pi(la(m.options.style));fo(()=>{tt(D)&&b.setStyle(Ot(tt(vt)),{diff:!0})});function Ot(Ve){if(Ve.url)return Ve.url;switch(Ve.name){case"light":return Iy;case"dark":return My}}function rr(){return g_(tt(vt))}function on(Ve){ai(vt,Ve,!0),b.setStyle(Ot(tt(vt)),{diff:!0})}class Mr{constructor(Ye){Ts(this,"marker");Ts(this,"libreMarker");wr(this,Cr,Pi());wr(this,kr,Pi(!1));wr(this,Di,Pi());wr(this,Hr,Pi());wr(this,vi,Pi(!1));wr(this,si,Pi());wr(this,ar,Pi());this.marker=Ye,this.libreMarker=void 0,this.element=void 0,this.rendered=!1,this.content=void 0,this.contentLoading=!1,this.component=void 0,this.circle=void 0}get element(){return tt(Ft(this,Cr))}set element(Ye){ai(Ft(this,Cr),Ye,!0)}get rendered(){return tt(Ft(this,kr))}set rendered(Ye){ai(Ft(this,kr),Ye,!0)}get popup(){return tt(Ft(this,Di))}set popup(Ye){ai(Ft(this,Di),Ye,!0)}get content(){return tt(Ft(this,Hr))}set content(Ye){ai(Ft(this,Hr),Ye,!0)}get contentLoading(){return tt(Ft(this,vi))}set contentLoading(Ye){ai(Ft(this,vi),Ye,!0)}get component(){return tt(Ft(this,si))}set component(Ye){ai(Ft(this,si),Ye,!0)}get circle(){return tt(Ft(this,ar))}set circle(Ye){ai(Ft(this,ar),Ye,!0)}getAngle(Ye){let Zt=this.marker.angs,Gt=Zt[0],bi=0;for(;Gt[0]<Ye&&(bi++,bi!=Zt.length);)Gt=Zt[bi];return Gt[1]}getDistance(Ye){return(this.marker.zet-Ye)/Gf}updateZIndex(){var Gt;const Ye=(Gt=this.libreMarker)==null?void 0:Gt.getElement();if(!Ye)throw new Error("Failed to update zIndex");const Zt=Math.round(($f-this.marker.zet)*py);Ye.style.zIndex=Zt.toString()}}Cr=new WeakMap,kr=new WeakMap,Di=new WeakMap,Hr=new WeakMap,vi=new WeakMap,si=new WeakMap,ar=new WeakMap;let yt,ui,At=la(new Array),nr=la(new Map),Tt=new Array,dr;Nf(()=>{const Ve=()=>{Or(),yt=window.setTimeout(Ve,25)};return Ve(),()=>{clearInterval(yt),clearInterval(ui)}});function Or(){if(tt(D)==!1||At.length==0||dr==null)return;const Ve=b.getZoom();if(!Ve)return;const Ye=new Array,Zt=Uf,Gt=new Wf(b,-512,window.innerHeight+Zt,window.innerWidth+Zt,-512),bi=new Wf(b,0,window.innerHeight,window.innerWidth,0);for(let Pt=0;Pt<At.length;Pt++){const st=At[Pt],It=st.marker,qt=st.libreMarker;if(qt){if(It.zet<=Ve&&Gt.contains(It.lat,It.lng)){qt._map!=b&&qt.addTo(b),Ye.push(st);continue}if(It.zet<=Ve+Gf&&bi.contains(It.lat,It.lng)){qt._map!=b&&qt.addTo(b),Ye.push(st);continue}qt._map!=null&&qt.remove()}}for(let Pt=0;Pt<Ye.length;Pt++){const st=Ye[Pt],It=st.marker;st.rendered||(st.rendered=!0);const qt=st.component,qi=st.circle;if(!qi||!qt)continue;It.zet<=Ve+fy?qt.setDisplayed(!0):qt.setDisplayed(!1),It.zet<=Ve?(qi.setCollapsed(!0),qt.setCollapsed(!1),qt.setAngle(st.getAngle(Ve))):(qt.setCollapsed(!0),qi==null||qi.setCollapsed(!1),qi==null||qi.setDistance(st.getDistance(Ve)));const fi=st.popup;if(!fi)continue;st.content==null&&st.contentLoading==!1&&(st.contentLoading=!0,dr(It.id).then(fr=>{st.content=fr,st.contentLoading=!1}));const sr=st.content;if(!sr)continue;fi.firstElementChild==null&&fi.appendChild(sr)}}async function Wr(Ve){var bi;const Ye=new Map(Ve.map(Pt=>[Pt.id,new Mr(Pt)])),Zt=new Array,Gt=Array.from(At);for(const Pt of Gt)Ye.has(Pt.marker.id)==!1&&((bi=Pt.libreMarker)==null||bi.remove(),nr.delete(Pt.marker.id),At.splice(At.indexOf(Pt),1));for(const Pt of Ve){const st=nr.get(Pt.id);if(st)st.marker=Pt,st.updateZIndex();else{const It=new Mr(Pt);nr.set(Pt.id,It),At.push(It),Zt.push(It)}}await O_();for(const Pt of Zt){const st=Pt.marker,It=Pt.element;if(!It)throw new Error("Failed to render marker element.");const qt=new Sd.Marker({element:It});qt.setLngLat([st.lng,st.lat]),Pt.libreMarker=qt,Pt.updateZIndex()}}function wn(){var Ve;for(let Ye=0;Ye<At.length;Ye++)(Ve=At[Ye].libreMarker)==null||Ve.remove();At.length=0,nr.clear()}function $n(Ve){if(!Lx.safeParse(Ve).success)throw new Error("Invalid popup content callback");dr=Ve}async function jr(Ve){var Zt,Gt,bi,Pt;if(dr==null)throw new Error("Popup content callback not set");if(!(await lm.safeParseAsync(Ve)).success)throw new Error("Invalid popups");try{(Gt=(Zt=m.options.events)==null?void 0:Zt.onLoadingStart)==null||Gt.call(null);for(const st of Ve){const It=Tt.findIndex(qt=>qt.id==st.id);It==-1?Tt.push(st):Tt[It]=st}await Wr(await vy(Tt))}finally{(Pt=(bi=m.options.events)==null?void 0:bi.onLoadingEnd)==null||Pt.call(null)}}function Ir(){wn()}var Ji=Nx();$_("resize",hd,ie);var Ei=Pl(Ji);Ba(Ei,Ve=>C=Ve,()=>C);var Tn=dd(Ei,2);return J_(Tn,21,()=>At,Ve=>Ve.marker.id,(Ve,Ye,Zt)=>{var Gt=jx(),bi=Pl(Gt);{var Pt=st=>{var It=Ox(),qt=T_(It);Ba(xy(qt,{}),(fi,sr)=>sr.circle=fi,fi=>fi==null?void 0:fi.circle,()=>[tt(Ye)]);var qi=dd(qt,2);Ba(_y(qi,{children:(fi,sr)=>{var pr=Bx();pr.__click=[Fx,xe,Ye],Ba(pr,(fr,Xr)=>Xr.popup=fr,fr=>fr==null?void 0:fr.popup,()=>[tt(Ye)]),vu(()=>Au(pr,`width: ${tt(Ye).marker.width??""}px; height: ${tt(Ye).marker.height??""}px;`)),_o(fi,pr)},$$slots:{default:!0}}),(fi,sr)=>sr.component=fi,fi=>fi==null?void 0:fi.component,()=>[tt(Ye)]),_o(st,It)};K_(bi,st=>{tt(Ye).rendered&&st(Pt)})}Ba(Gt,(st,It)=>It.element=st,st=>st==null?void 0:st.element,()=>[tt(Ye)]),_o(Ve,Gt)}),vu(()=>Au(Ji,`--primary: ${tt(vt).colors.primary??""}; --background: ${tt(vt).colors.background??""}; --text: ${tt(vt).colors.text??""};`)),_o(y,Ji),mu({getCenter:$t,setCenter:_t,getZoom:Rt,setZoom:Mi,getBounds:Jt,zoomIn:pi,zoomOut:Bt,getStyle:rr,setStyle:on,updatePopupsContentCallback:$n,updatePopups:jr,removePopups:Ir})}G_(["click"]);function Zx(y){const m=document.getElementById(y.container);if(!m)throw new Error(`Container not found: ${y.container}`);return W_(cm,{target:m,props:{options:y}})}function Vx(y){X_(y)}Vt.Map=cm,Vt.mountMap=Zx,Vt.unmountMap=Vx,Object.defineProperty(Vt,Symbol.toStringTag,{value:"Module"})});